diff --git a/2fa.php b/2fa.php index 9bd5f2cd..14a58fcc 100644 --- a/2fa.php +++ b/2fa.php @@ -1,11 +1,12 @@ $data, 'id' => $uid )); - \Froxlor\UI\Response::standard_success(sprintf($lng['2fa']['2fa_added'], $filename, $s)); + \Froxlor\UI\Response::standard_success(sprintf($lng['2fa']['2fa_added'], $filename)); } $log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed 2fa::overview"); +$type_select_values = []; +$ga_qrcode = ''; if ($userinfo['type_2fa'] == '0') { // available types @@ -77,14 +80,16 @@ if ($userinfo['type_2fa'] == '0') { 2 => 'Authenticator' ); asort($type_select_values); - $type_select = ""; - foreach ($type_select_values as $_val => $_type) { - $type_select .= \Froxlor\UI\HTML::makeoption($_type, $_val); - } } elseif ($userinfo['type_2fa'] == '1') { // email 2fa enabled } elseif ($userinfo['type_2fa'] == '2') { // authenticator 2fa enabled $ga_qrcode = $tfa->getQRCodeImageAsDataUri($userinfo['loginname'], $userinfo['data_2fa']); } -eval("echo \"" . \Froxlor\UI\Template::getTemplate("2fa/overview", true) . "\";"); + +UI::twigBuffer('user/2fa.html.twig', [ + 'themes' => $themes_avail, + 'type_select_values' => $type_select_values, + 'ga_qrcode' => $ga_qrcode +]); +UI::twigOutputBuffer(); diff --git a/admin_index.php b/admin_index.php index 7e2b5003..36dbd673 100644 --- a/admin_index.php +++ b/admin_index.php @@ -254,8 +254,6 @@ if ($page == 'overview') { \Froxlor\UI\Response::redirectTo($filename); } else { - $language_options = ''; - $default_lang = Settings::Get('panel.standardlanguage'); if ($userinfo['def_language'] != '') { $default_lang = $userinfo['def_language']; @@ -284,8 +282,6 @@ if ($page == 'overview') { \Froxlor\UI\Response::redirectTo($filename); } else { - $theme_options = ''; - $default_theme = Settings::Get('panel.default_theme'); if ($userinfo['theme'] != '') { $default_theme = $userinfo['theme']; diff --git a/customer_index.php b/customer_index.php index a0ab94dd..37879c46 100644 --- a/customer_index.php +++ b/customer_index.php @@ -215,12 +215,11 @@ if ($page == 'overview') { $default_lang = $userinfo['def_language']; } - $language_options = ''; - foreach ($languages as $language_file => $language_name) { - $language_options .= \Froxlor\UI\HTML::makeoption($language_name, $language_file, $default_lang, true); - } - - eval("echo \"" . \Froxlor\UI\Template::getTemplate('index/change_language') . "\";"); + UI::twigBuffer('user/change_language.html.twig', [ + 'languages' => $languages, + 'default_lang' => $default_lang + ]); + UI::twigOutputBuffer(); } } elseif ($page == 'change_theme') { if (isset($_POST['send']) && $_POST['send'] == 'send') { @@ -237,18 +236,19 @@ if ($page == 'overview') { $log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "changed default theme to '" . $theme . "'"); \Froxlor\UI\Response::redirectTo($filename); } else { + $default_theme = Settings::Get('panel.default_theme'); if ($userinfo['theme'] != '') { $default_theme = $userinfo['theme']; } - $theme_options = ''; $themes_avail = \Froxlor\UI\Template::getThemes(); - foreach ($themes_avail as $t => $d) { - $theme_options .= \Froxlor\UI\HTML::makeoption($d, $t, $default_theme, true); - } - eval("echo \"" . \Froxlor\UI\Template::getTemplate('index/change_theme') . "\";"); + UI::twigBuffer('user/change_theme.html.twig', [ + 'themes' => $themes_avail, + 'default_theme' => $default_theme + ]); + UI::twigOutputBuffer(); } } elseif ($page == 'send_error_report' && Settings::Get('system.allow_error_report_customer') == '1') { diff --git a/index.php b/index.php index 7976947d..8d5289f2 100644 --- a/index.php +++ b/index.php @@ -36,7 +36,10 @@ if ($action == '2fa_entercode') { exit(); } // show template to enter code - eval("echo \"" . \Froxlor\UI\Template::getTemplate('2fa/entercode', true) . "\";"); + UI::twigBuffer('login/enter2fa.html.twig', [ + 'pagetitle' => $lng['login']['2fa'] + ]); + UI::twigOutputBuffer(); } elseif ($action == '2fa_verify') { // verify code from 2fa code-enter form if (!isset($_SESSION) || !isset($_SESSION['secret_2fa'])) { @@ -660,7 +663,12 @@ if ($action == 'resetpwd') { } } - eval("echo \"" . \Froxlor\UI\Template::getTemplate('rpwd') . "\";"); + UI::twigBuffer('login/rpwd.html.twig', [ + 'pagetitle' => $lng['pwdreminder']['choosenew'], + 'formaction' => 'index.php?action=resetpwd&resetcode=' . $activationcode, + 'message' => $message, + ]); + UI::twigOutputBuffer(); } else { \Froxlor\UI\Response::redirectTo('index.php', array( "showmessage" => '7' @@ -705,7 +713,7 @@ function finishLogin($userinfo) if ($userinfo['adminsession'] == '1') { if (\Froxlor\Froxlor::hasUpdates() || \Froxlor\Froxlor::hasDbUpdates()) { - \Froxlor\UI\Response::redirectTo('admin_updates.php'); + \Froxlor\UI\Response::redirectTo('admin_updates.php?page=overview'); } else { if (isset($_POST['script']) && $_POST['script'] != "") { if (preg_match("/customer\_/", $_POST['script']) === 1) { diff --git a/lib/Froxlor/UI/HTML.php b/lib/Froxlor/UI/HTML.php index 1f122f68..c33ed555 100644 --- a/lib/Froxlor/UI/HTML.php +++ b/lib/Froxlor/UI/HTML.php @@ -43,32 +43,18 @@ class HTML if ((!isset($box['show_element']) || $box['show_element'] === true) && (!isset($box['required_resources']) || $box['required_resources'] == '' || (isset($userinfo[$box['required_resources']]) && ((int) $userinfo[$box['required_resources']] > 0 || $userinfo[$box['required_resources']] == '-1')))) { $navigation_links = []; $box_active = false; - foreach ($box['elements'] as $element_id => $element) { + foreach ($box['elements'] as $element) { if ((!isset($element['show_element']) || $element['show_element'] === true) && (!isset($element['required_resources']) || $element['required_resources'] == '' || (isset($userinfo[$element['required_resources']]) && ((int) $userinfo[$element['required_resources']] > 0 || $userinfo[$element['required_resources']] == '-1')))) { $target = ''; $active = false; $navurl = '#'; if (isset($element['url']) && trim($element['url']) != '') { - // append sid only to local - - if (!preg_match('/^https?\:\/\//', $element['url']) && (isset($userinfo['hash']) && $userinfo['hash'] != '')) { - // generate sid with ? oder & - - if (strpos($element['url'], '?') !== false) { - $element['url'] .= '&s=' . $userinfo['hash']; - } else { - $element['url'] .= '?s=' . $userinfo['hash']; - } - } if (isset($element['new_window']) && $element['new_window'] == true) { $target = ' target="_blank"'; } - if (isset($_GET['page']) && substr_count($element['url'], "page=" . $_GET['page']) > 0 && substr_count($element['url'], basename($_SERVER["SCRIPT_FILENAME"])) > 0 && isset($_GET['action']) && substr_count($element['url'], "action=" . $_GET['action']) > 0) { - $active = true; - $box_active = true; - } elseif (isset($_GET['page']) && substr_count($element['url'], "page=" . $_GET['page']) > 0 && substr_count($element['url'], basename($_SERVER["SCRIPT_FILENAME"])) > 0 && substr_count($element['url'], "action=") == 0 && !isset($_GET['action'])) { + if (isset($_GET['page']) && substr_count($element['url'], "page=" . $_GET['page']) > 0 && substr_count($element['url'], basename($_SERVER["SCRIPT_FILENAME"])) > 0) { $active = true; $box_active = true; } @@ -94,17 +80,6 @@ class HTML if (!empty($navigation_links)) { $target = ''; if (isset($box['url']) && trim($box['url']) != '') { - // append sid only to local - - if (!preg_match('/^https?\:\/\//', $box['url']) && (isset($userinfo['hash']) && $userinfo['hash'] != '')) { - // generate sid with ? oder & - - if (strpos($box['url'], '?') !== false) { - $box['url'] .= '&s=' . $userinfo['hash']; - } else { - $box['url'] .= '?s=' . $userinfo['hash']; - } - } if (isset($box['new_window']) && $box['new_window'] == true) { $target = ' target="_blank"'; @@ -134,55 +109,6 @@ class HTML return $returnvalue; } - /** - * Return HTML Code for a checkbox - * - * @param string $name - * The fieldname - * @param string $title - * The captions - * @param string $value - * The Value which will be returned - * @param bool $break - * Add a
at the end of the checkbox - * @param string $selvalue - * Values which will be selected by default - * @param bool $title_trusted - * Whether the title may contain html or not - * @param bool $value_trusted - * Whether the value may contain html or not - * - * @return string HTML Code - * - * @deprecated - */ - public static function makecheckbox($name, $title, $value, $break = false, $selvalue = null, $title_trusted = false, $value_trusted = false) - { - if ($selvalue !== null && $value == $selvalue) { - $checked = 'checked="checked"'; - } elseif (isset($_SESSION['requestData'][$name])) { - $checked = 'checked="checked"'; - } else { - $checked = ''; - } - - if (!$title_trusted) { - $title = htmlspecialchars($title); - } - - if (!$value_trusted) { - $value = htmlspecialchars($value); - } - - $checkbox = ''; - - if ($break) { - $checkbox .= '
'; - } - - return $checkbox; - } - /** * Return HTML Code for an option within a - '; - } - /** * Output boolean confirm-dialog * diff --git a/lib/init.php b/lib/init.php index 09a74ec1..1f43d854 100644 --- a/lib/init.php +++ b/lib/init.php @@ -295,19 +295,6 @@ if (AREA == 'admin' || AREA == 'customer') { */ $navigation_data = array( 'admin' => array( - 'index' => array( - 'url' => 'admin_index.php', - 'label' => $lng['admin']['overview'], - 'elements' => array( - array( - 'label' => $lng['menue']['main']['username'] - ), - array( - 'url' => 'admin_index.php?action=logout', - 'label' => $lng['login']['logout'] - ) - ) - ), 'server' => array( 'label' => $lng['admin']['server'], 'required_resources' => 'change_serversettings', diff --git a/lng/english.lng.php b/lng/english.lng.php index b536a505..a77a8677 100644 --- a/lng/english.lng.php +++ b/lng/english.lng.php @@ -2048,7 +2048,7 @@ $lng['2fa']['2fa_enabled'] = 'Activate Two-factor authentication (2FA)'; $lng['login']['2fa'] = 'Two-factor authentication (2FA)'; $lng['login']['2facode'] = 'Please enter 2FA code'; $lng['2fa']['2fa_removed'] = '2FA removed successfully'; -$lng['2fa']['2fa_added'] = '2FA activated successfully
View 2FA details'; +$lng['2fa']['2fa_added'] = '2FA activated successfully
View 2FA details'; $lng['2fa']['2fa_add'] = 'Activate 2FA'; $lng['2fa']['2fa_delete'] = 'Deactivate 2FA'; $lng['2fa']['2fa_verify'] = 'Verify code'; diff --git a/lng/german.lng.php b/lng/german.lng.php index 6d0a9d18..28c330b3 100644 --- a/lng/german.lng.php +++ b/lng/german.lng.php @@ -1694,7 +1694,7 @@ $lng['2fa']['2fa_enabled'] = 'Aktiviere Zwei-Faktor Authentifizierung (2FA)'; $lng['login']['2fa'] = 'Zwei-Faktor Authentifizierung (2FA)'; $lng['login']['2facode'] = 'Bitte 2FA Code angeben'; $lng['2fa']['2fa_removed'] = '2FA erfolgreich gelöscht'; -$lng['2fa']['2fa_added'] = '2FA erfolgreich aktiviert
2FA Details öffnen'; +$lng['2fa']['2fa_added'] = '2FA erfolgreich aktiviert
2FA Details öffnen'; $lng['2fa']['2fa_add'] = '2FA aktivieren'; $lng['2fa']['2fa_delete'] = '2FA deaktivieren'; $lng['2fa']['2fa_verify'] = 'Code verifizieren'; diff --git a/templates/Froxlor/login/enter2fa.html.twig b/templates/Froxlor/login/enter2fa.html.twig new file mode 100644 index 00000000..bd4b19b9 --- /dev/null +++ b/templates/Froxlor/login/enter2fa.html.twig @@ -0,0 +1,29 @@ +{% extends "Froxlor/base.html.twig" %} + +{% block content %} +
+
+
+ Froxlor Server Management Panel + +
+
+
{{ pagetitle }}
+ +
+ + +
+ +
+ +
+ + + +
+
+
+
+
+{% endblock %} diff --git a/templates/Froxlor/login/fpwd.html.twig b/templates/Froxlor/login/fpwd.html.twig index f98dfac4..26f7246d 100644 --- a/templates/Froxlor/login/fpwd.html.twig +++ b/templates/Froxlor/login/fpwd.html.twig @@ -38,13 +38,15 @@
- - + +
diff --git a/templates/Froxlor/login/login.html.twig b/templates/Froxlor/login/login.html.twig index 765b4155..14921f9d 100644 --- a/templates/Froxlor/login/login.html.twig +++ b/templates/Froxlor/login/login.html.twig @@ -49,16 +49,16 @@
- - - + + +
{% if get_setting('panel.allow_preset') == '1' %} - + {% endif %} diff --git a/templates/Froxlor/login/rpwd.html.twig b/templates/Froxlor/login/rpwd.html.twig new file mode 100644 index 00000000..7ca573e0 --- /dev/null +++ b/templates/Froxlor/login/rpwd.html.twig @@ -0,0 +1,47 @@ +{% extends "Froxlor/base.html.twig" %} + +{% block body %} +
+
+
+ Froxlor Server Management Panel + +
+
+
{{ pagetitle }}
+

{{ lng('login.presend') }}

+ + {% if message is not empty %} + + {% endif %} + +
+ + +
+ +
+ + +
+
+ +
+ + + +
+ + +
+
+
+
+{% endblock %} diff --git a/templates/Froxlor/sidebar.html.twig b/templates/Froxlor/sidebar.html.twig index 4f2afe6e..a6105bd4 100644 --- a/templates/Froxlor/sidebar.html.twig +++ b/templates/Froxlor/sidebar.html.twig @@ -2,7 +2,7 @@