From 9dce16e5c74dd56e67723b08d7e6e642b1634759 Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Thu, 17 Feb 2022 17:23:04 +0100 Subject: [PATCH] kinda fix error-handlers; more work on admin-dashboard Signed-off-by: Michael Kaufmann --- admin_index.php | 4 +- lib/Froxlor/PhpHelper.php | 68 ++++++++++++-------------- lib/Froxlor/System/Cronjob.php | 56 ++++++++++----------- templates/Froxlor/base.html.twig | 12 ++++- templates/Froxlor/user/index.html.twig | 25 ++++++++++ 5 files changed, 96 insertions(+), 69 deletions(-) diff --git a/admin_index.php b/admin_index.php index 6547a2c7..bd77fa7a 100644 --- a/admin_index.php +++ b/admin_index.php @@ -186,7 +186,9 @@ if ($page == 'overview') { UI::Twig()->addGlobal('userinfo', $userinfo); UI::TwigBuffer('user/index.html.twig', [ 'sysinfo' => $sysinfo, - 'overview' => $overview + 'overview' => $overview, + 'outstanding_tasks' => $outstanding_tasks, + 'cron_last_runs' => $cron_last_runs ]); UI::TwigOutputBuffer(); } elseif ($page == 'change_password') { diff --git a/lib/Froxlor/PhpHelper.php b/lib/Froxlor/PhpHelper.php index fdc508c5..a303f6b1 100644 --- a/lib/Froxlor/PhpHelper.php +++ b/lib/Froxlor/PhpHelper.php @@ -1,4 +1,5 @@ $value) { - if ((! is_array($fields) || empty($fields)) || (is_array($fields) && ! empty($fields) && in_array($field, $fields))) { + if ((!is_array($fields) || empty($fields)) || (is_array($fields) && !empty($fields) && in_array($field, $fields))) { // Just call ourselve to manage multi-dimensional arrays $subject[$field] = self::htmlentitiesArray($subject[$field], $fields, $quote_style, $charset); } @@ -90,7 +91,7 @@ class PhpHelper if (is_array($subject)) { $fields = self::arrayTrim(explode(' ', $fields)); foreach ($subject as $field => $value) { - if ((! is_array($fields) || empty($fields)) || (is_array($fields) && ! empty($fields) && in_array($field, $fields))) { + if ((!is_array($fields) || empty($fields)) || (is_array($fields) && !empty($fields) && in_array($field, $fields))) { $subject[$field] = str_replace($search, $replace, $subject[$field]); } } @@ -108,18 +109,17 @@ class PhpHelper * @param string $errstr * @param string $errfile * @param int $errline - * @param array $errcontext * * @return void|boolean */ - public static function phpErrHandler($errno, $errstr, $errfile, $errline, $errcontext = array()) + public static function phpErrHandler($errno, $errstr, $errfile, $errline) { - if (! (error_reporting() & $errno)) { + if (!(error_reporting() & $errno)) { // This error code is not included in error_reporting return; } - if (! isset($_SERVER['SHELL']) || (isset($_SERVER['SHELL']) && $_SERVER['SHELL'] == '')) { + if (!isset($_SERVER['SHELL']) || (isset($_SERVER['SHELL']) && $_SERVER['SHELL'] == '')) { // prevent possible file-path-disclosure $errfile = str_replace(\Froxlor\Froxlor::getInstallDir(), "", $errfile); // build alert @@ -129,16 +129,16 @@ class PhpHelper } elseif ($errno = E_WARNING) { $type = 'warning'; } - $err_display = '