From e357f7e9c31fa90bc014c20a9f5948aae138348a Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Mon, 12 Jun 2023 13:06:18 +0200 Subject: [PATCH] beautification Signed-off-by: Michael Kaufmann --- admin_apcuinfo.php | 2 +- admin_opcacheinfo.php | 4 ++-- admin_settings.php | 4 ++-- lib/Froxlor/UI/Response.php | 18 ++++++++++-------- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/admin_apcuinfo.php b/admin_apcuinfo.php index aba02807..f4a7e340 100644 --- a/admin_apcuinfo.php +++ b/admin_apcuinfo.php @@ -62,7 +62,7 @@ if ($action == 'delete' && function_exists('apcu_clear_cache') && $userinfo['cha } if (!function_exists('apcu_cache_info') || !function_exists('apcu_sma_info')) { - Response::standardError(lng('error.no_apcuinfo')); + Response::standardError('no_apcuinfo'); } if ($page == 'showinfo' && $userinfo['change_serversettings'] == '1') { diff --git a/admin_opcacheinfo.php b/admin_opcacheinfo.php index 82c4eb91..eddace9e 100644 --- a/admin_opcacheinfo.php +++ b/admin_opcacheinfo.php @@ -58,12 +58,12 @@ if ($action == 'reset' && function_exists('opcache_reset') && $userinfo['change_ } if (!extension_loaded('Zend OPcache')) { - Response::standardError(lng('error.no_opcacheinfo')); + Response::standardError('no_opcacheinfo'); } $ocEnabled = ini_get('opcache.enable'); if (empty($ocEnabled)) { - Response::standardError(lng('error.inactive_opcacheinfo')); + Response::standardError('inactive_opcacheinfo'); } if ($page == 'showinfo' && $userinfo['change_serversettings'] == '1') { diff --git a/admin_settings.php b/admin_settings.php index 18a1d60a..b3c84e72 100644 --- a/admin_settings.php +++ b/admin_settings.php @@ -70,7 +70,7 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') { // check if the session timeout is too low #815 if (isset($_POST['session_sessiontimeout']) && $_POST['session_sessiontimeout'] < 60) { - Response::standardError(lng('error.session_timeout'), lng('error.session_timeout_desc')); + Response::standardError(['session_timeout', 'session_timeout_desc']); } try { @@ -132,7 +132,7 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') { } } } else { - Response::standardError(lng('error.no_phpinfo')); + Response::standardError('error.no_phpinfo'); } UI::view('settings/phpinfo.html.twig', [ 'phpversion' => PHP_VERSION, diff --git a/lib/Froxlor/UI/Response.php b/lib/Froxlor/UI/Response.php index e8dd0279..a12b3683 100644 --- a/lib/Froxlor/UI/Response.php +++ b/lib/Froxlor/UI/Response.php @@ -32,7 +32,7 @@ class Response { /** - * Sends an header ( 'Location ...' ) to the browser. + * Sends a header ( 'Location ...' ) to the browser. * * @param string $destination * Destination @@ -74,18 +74,18 @@ class Response $linker->filename = $path . $destination; } header('Location: ' . $linker->getLink()); - exit(); + exit; } elseif ($get_variables == null) { $linker = new Linker($destination); header('Location: ' . $linker->getLink()); - exit(); + exit; } return false; } /** - * Prints one ore more errormessages on screen + * Prints one or more errormessages on screen * * @param array $errors * Errormessages @@ -93,8 +93,9 @@ class Response * A %s in the errormessage will be replaced by this string. * @param bool $throw_exception * - * @author Florian Lippert (2003-2009) + * @throws Exception * @author Ron Brand + * @author Florian Lippert (2003-2009) */ public static function standardError($errors = '', $replacer = '', $throw_exception = false) { @@ -115,7 +116,7 @@ class Response $error = ''; foreach ($errors as $single_error) { if (strpos($single_error, ".") === false) { - $single_error = 'error.'.$single_error; + $single_error = 'error.' . $single_error; } $single_error = lng($single_error, [htmlentities($replacer)]); if (empty($error)) { @@ -157,7 +158,7 @@ class Response } /** - * Prints one ore more errormessages on screen + * Prints one or more errormessages on screen * * @param array $success_message * Errormessages @@ -166,12 +167,13 @@ class Response * @param array $params * @param bool $throw_exception * + * @throws Exception * @author Florian Lippert (2003-2009) */ public static function standardSuccess($success_message = '', $replacer = '', $params = [], $throw_exception = false) { if (strpos($success_message, ".") === false) { - $success_message = 'success.'.$success_message; + $success_message = 'success.' . $success_message; } $success_message = lng($success_message, [htmlentities($replacer)]);