update ui class and traffic stats

This commit is contained in:
envoyr
2022-03-18 12:53:34 +01:00
parent ba0d33392c
commit 69895943bd
41 changed files with 90927 additions and 16754 deletions

View File

@@ -15,9 +15,9 @@ namespace Froxlor\Database;
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Classes
*
*
* @since 0.9.31
*
*
*/
/**
@@ -30,7 +30,7 @@ namespace Froxlor\Database;
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Classes
*
*
* @method static \PDOStatement prepare($statement, array $driver_options = null) Prepares a statement for execution and returns a statement object
* @method static \PDOStatement query ($statement) Executes an SQL statement, returning a result set as a PDOStatement object
* @method static string lastInsertId ($name = null) Returns the ID of the last inserted row or sequence value
@@ -97,7 +97,7 @@ class Database
* (optional)
* @param bool $showerror
* suppress errordisplay (default true)
*
*
* @return array
*/
public static function pexecute_first(&$stmt, $params = null, $showerror = true, $json_response = false)
@@ -471,13 +471,12 @@ class Database
// show
\Froxlor\UI\Panel\UI::initTwig(true);
\Froxlor\UI\Panel\UI::twig()->addGlobal('install_mode', '1');
\Froxlor\UI\Panel\UI::twigBuffer('misc/dberrornice.html.twig', [
\Froxlor\UI\Panel\UI::view('misc/dberrornice.html.twig', [
'page_title' => 'Database error',
'message' => $error_message,
'debug' => $error_trace,
'report' => $err_report_link
]);
echo \Froxlor\UI\Panel\UI::twigOutputBuffer();
die();
}
die("We are sorry, but a MySQL - error occurred. The administrator may find more information in the syslog");

View File

@@ -47,7 +47,7 @@ class PhpHelper
* See php documentation about this
* @param string $charset
* See php documentation about this
*
*
* @return array|string The string or an array with htmlentities converted strings
* @author Florian Lippert <flo@syscp.org>
*/
@@ -158,14 +158,13 @@ class PhpHelper
// show
\Froxlor\UI\Panel\UI::initTwig(true);
\Froxlor\UI\Panel\UI::twig()->addGlobal('install_mode', '1');
\Froxlor\UI\Panel\UI::twigBuffer('misc/alert_nosession.html.twig', [
\Froxlor\UI\Panel\UI::view('misc/alert_nosession.html.twig', [
'page_title' => 'Uncaught exception',
'heading' => 'Uncaught exception',
'type' => 'danger',
'alert_msg' => $exception->getCode() . ' ' . $exception->getMessage(),
'alert_info' => $exception->getTraceAsString()
]);
echo \Froxlor\UI\Panel\UI::twigOutputBuffer();
die();
}
}
@@ -309,7 +308,7 @@ class PhpHelper
* maximum unit
* @param string $system
* 'si' for SI, 'bi' for binary prefixes
*
*
* @param string $retstring
* string
*/
@@ -365,7 +364,7 @@ class PhpHelper
* The string that should be searched for variables
* @param array $vars
* The array containing the variables with their values
*
*
* @return string The submitted string with the variables replaced.
*/
public static function replaceVariables($text, $vars)

View File

@@ -126,7 +126,7 @@ class HTML
* @param bool $disabled
*
* @return string HTML Code
*
*
* @deprecated
*/
public static function makeoption($title, $value, $selvalue = null, $title_trusted = false, $value_trusted = false, $id = null, $disabled = false)
@@ -169,9 +169,9 @@ class HTML
* Values which will be given to $yesfile. Format: array(variable1=>value1, variable2=>value2, variable3=>value3)
* @param string $replacer
* value of a possible existing string-replacer in the question
*
*
* @author Froxlor team <team@froxlor.org> (2010-)
*
*
* @return string
*/
public static function askYesNo(string $text, string $yesfile, array $params = [], string $replacer = '')
@@ -186,12 +186,11 @@ class HTML
'%s' => htmlspecialchars($replacer)
));
Panel\UI::twigBuffer('form/yesnoquestion.html.twig', [
Panel\UI::view('form/yesnoquestion.html.twig', [
'action' => $yesfile,
'url_params' => $params,
'question' => $text
]);
Panel\UI::twigOutputBuffer();
exit();
}
@@ -210,7 +209,7 @@ class HTML
$chk_text = $lng['question'][$chk_text];
}
Panel\UI::twigBuffer('form/yesnoquestion.html.twig', [
Panel\UI::view('form/yesnoquestion.html.twig', [
'action' => $yesfile,
'url_params' => $params,
'question' => $text,
@@ -219,7 +218,6 @@ class HTML
'show' => $show_checkbox
]
]);
Panel\UI::twigOutputBuffer();
exit();
}
}

View File

@@ -326,4 +326,10 @@ class UI
}
return $themes_available;
}
public static function view($name, array $context = [])
{
self::twigBuffer($name, $context);
self::twigOutputBuffer();
}
}

View File

@@ -15,7 +15,7 @@ class Response
* @param boolean $isRelative
* if the target we are creating for a redirect
* should be a relative or an absolute url
*
*
* @return boolean false if params is not an array
*/
public static function redirectTo($destination, $get_variables = null, $isRelative = true)
@@ -114,14 +114,13 @@ class Response
if ($throw_exception) {
throw new \Exception(strip_tags($error), 400);
}
\Froxlor\UI\Panel\UI::twigBuffer('misc/alert.html.twig', [
\Froxlor\UI\Panel\UI::view('misc/alert.html.twig', [
'type' => 'danger',
'btntype' => 'light',
'heading' => $lng['error']['error'],
'alert_msg' => $error,
'redirect_link' => $link_ref
]);
\Froxlor\UI\Panel\UI::twigOutputBuffer();
exit;
}
@@ -134,14 +133,13 @@ class Response
$link_ref = htmlentities($_SERVER['HTTP_REFERER']);
}
\Froxlor\UI\Panel\UI::twigBuffer('misc/alert.html.twig', [
\Froxlor\UI\Panel\UI::view('misc/alert.html.twig', [
'type' => 'danger',
'btntype' => 'light',
'heading' => $lng['error']['error'],
'alert_msg' => $message,
'redirect_link' => $link_ref
]);
\Froxlor\UI\Panel\UI::twigOutputBuffer();
exit;
}
@@ -186,14 +184,13 @@ class Response
$redirect_url = '';
}
\Froxlor\UI\Panel\UI::twigBuffer('misc/alert.html.twig', [
\Froxlor\UI\Panel\UI::view('misc/alert.html.twig', [
'type' => 'success',
'btntype' => 'light',
'heading' => $lng['success']['success'],
'alert_msg' => $success_message,
'redirect_link' => $redirect_url
]);
\Froxlor\UI\Panel\UI::twigOutputBuffer();
exit;
}
}