beautification

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2023-06-12 13:06:18 +02:00
parent da7309c41e
commit e357f7e9c3
4 changed files with 15 additions and 13 deletions

View File

@@ -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')) { 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') { if ($page == 'showinfo' && $userinfo['change_serversettings'] == '1') {

View File

@@ -58,12 +58,12 @@ if ($action == 'reset' && function_exists('opcache_reset') && $userinfo['change_
} }
if (!extension_loaded('Zend OPcache')) { if (!extension_loaded('Zend OPcache')) {
Response::standardError(lng('error.no_opcacheinfo')); Response::standardError('no_opcacheinfo');
} }
$ocEnabled = ini_get('opcache.enable'); $ocEnabled = ini_get('opcache.enable');
if (empty($ocEnabled)) { if (empty($ocEnabled)) {
Response::standardError(lng('error.inactive_opcacheinfo')); Response::standardError('inactive_opcacheinfo');
} }
if ($page == 'showinfo' && $userinfo['change_serversettings'] == '1') { if ($page == 'showinfo' && $userinfo['change_serversettings'] == '1') {

View File

@@ -70,7 +70,7 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
// check if the session timeout is too low #815 // check if the session timeout is too low #815
if (isset($_POST['session_sessiontimeout']) && $_POST['session_sessiontimeout'] < 60) { 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 { try {
@@ -132,7 +132,7 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
} }
} }
} else { } else {
Response::standardError(lng('error.no_phpinfo')); Response::standardError('error.no_phpinfo');
} }
UI::view('settings/phpinfo.html.twig', [ UI::view('settings/phpinfo.html.twig', [
'phpversion' => PHP_VERSION, 'phpversion' => PHP_VERSION,

View File

@@ -32,7 +32,7 @@ class Response
{ {
/** /**
* Sends an header ( 'Location ...' ) to the browser. * Sends a header ( 'Location ...' ) to the browser.
* *
* @param string $destination * @param string $destination
* Destination * Destination
@@ -74,18 +74,18 @@ class Response
$linker->filename = $path . $destination; $linker->filename = $path . $destination;
} }
header('Location: ' . $linker->getLink()); header('Location: ' . $linker->getLink());
exit(); exit;
} elseif ($get_variables == null) { } elseif ($get_variables == null) {
$linker = new Linker($destination); $linker = new Linker($destination);
header('Location: ' . $linker->getLink()); header('Location: ' . $linker->getLink());
exit(); exit;
} }
return false; return false;
} }
/** /**
* Prints one ore more errormessages on screen * Prints one or more errormessages on screen
* *
* @param array $errors * @param array $errors
* Errormessages * Errormessages
@@ -93,8 +93,9 @@ class Response
* A %s in the errormessage will be replaced by this string. * A %s in the errormessage will be replaced by this string.
* @param bool $throw_exception * @param bool $throw_exception
* *
* @author Florian Lippert <flo@syscp.org> (2003-2009) * @throws Exception
* @author Ron Brand <ron.brand@web.de> * @author Ron Brand <ron.brand@web.de>
* @author Florian Lippert <flo@syscp.org> (2003-2009)
*/ */
public static function standardError($errors = '', $replacer = '', $throw_exception = false) public static function standardError($errors = '', $replacer = '', $throw_exception = false)
{ {
@@ -115,7 +116,7 @@ class Response
$error = ''; $error = '';
foreach ($errors as $single_error) { foreach ($errors as $single_error) {
if (strpos($single_error, ".") === false) { if (strpos($single_error, ".") === false) {
$single_error = 'error.'.$single_error; $single_error = 'error.' . $single_error;
} }
$single_error = lng($single_error, [htmlentities($replacer)]); $single_error = lng($single_error, [htmlentities($replacer)]);
if (empty($error)) { 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 * @param array $success_message
* Errormessages * Errormessages
@@ -166,12 +167,13 @@ class Response
* @param array $params * @param array $params
* @param bool $throw_exception * @param bool $throw_exception
* *
* @throws Exception
* @author Florian Lippert <flo@syscp.org> (2003-2009) * @author Florian Lippert <flo@syscp.org> (2003-2009)
*/ */
public static function standardSuccess($success_message = '', $replacer = '', $params = [], $throw_exception = false) public static function standardSuccess($success_message = '', $replacer = '', $params = [], $throw_exception = false)
{ {
if (strpos($success_message, ".") === false) { if (strpos($success_message, ".") === false) {
$success_message = 'success.'.$success_message; $success_message = 'success.' . $success_message;
} }
$success_message = lng($success_message, [htmlentities($replacer)]); $success_message = lng($success_message, [htmlentities($replacer)]);