refactor UI functions
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -43,7 +43,7 @@ if ($action == 'logout') {
|
||||
}
|
||||
Database::pexecute($stmt, $params);
|
||||
|
||||
redirectTo('index.php');
|
||||
\Froxlor\UI\Response::redirectTo('index.php');
|
||||
}
|
||||
|
||||
if ($page == 'overview') {
|
||||
@@ -105,31 +105,31 @@ if ($page == 'overview') {
|
||||
if ($userinfo['perlenabled'] == '1') $se[] = "Perl/CGI";
|
||||
$services_enabled = implode(", ", $se);
|
||||
|
||||
eval("echo \"" . getTemplate('index/index') . "\";");
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate('index/index') . "\";");
|
||||
} elseif ($page == 'change_password') {
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
$old_password = validate($_POST['old_password'], 'old password');
|
||||
if (!validatePasswordLogin($userinfo,$old_password,TABLE_PANEL_CUSTOMERS,'customerid')) {
|
||||
standard_error('oldpasswordnotcorrect');
|
||||
\Froxlor\UI\Response::standard_error('oldpasswordnotcorrect');
|
||||
}
|
||||
|
||||
$new_password = validatePassword($_POST['new_password'], 'new password');
|
||||
$new_password_confirm = validatePassword($_POST['new_password_confirm'], 'new password confirm');
|
||||
|
||||
if ($old_password == '') {
|
||||
standard_error(array('stringisempty', 'oldpassword'));
|
||||
\Froxlor\UI\Response::standard_error(array('stringisempty', 'oldpassword'));
|
||||
} elseif ($new_password == '') {
|
||||
standard_error(array('stringisempty', 'newpassword'));
|
||||
\Froxlor\UI\Response::standard_error(array('stringisempty', 'newpassword'));
|
||||
} elseif ($new_password_confirm == '') {
|
||||
standard_error(array('stringisempty', 'newpasswordconfirm'));
|
||||
\Froxlor\UI\Response::standard_error(array('stringisempty', 'newpasswordconfirm'));
|
||||
} elseif ($new_password != $new_password_confirm) {
|
||||
standard_error('newpasswordconfirmerror');
|
||||
\Froxlor\UI\Response::standard_error('newpasswordconfirmerror');
|
||||
} else {
|
||||
// Update user password
|
||||
try {
|
||||
Customers::getLocal($userinfo, array('id' => $userinfo['customerid'], 'new_customer_password' => $new_password))->update();
|
||||
} catch (Exception $e) {
|
||||
dynamic_error($e->getMessage());
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
}
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, 'changed password');
|
||||
|
||||
@@ -172,10 +172,10 @@ if ($page == 'overview') {
|
||||
Database::pexecute($stmt, $params);
|
||||
}
|
||||
|
||||
redirectTo($filename, array('s' => $s));
|
||||
\Froxlor\UI\Response::redirectTo($filename, array('s' => $s));
|
||||
}
|
||||
} else {
|
||||
eval("echo \"" . getTemplate('index/change_password') . "\";");
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate('index/change_password') . "\";");
|
||||
}
|
||||
} elseif ($page == 'change_language') {
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
@@ -184,7 +184,7 @@ if ($page == 'overview') {
|
||||
try {
|
||||
Customers::getLocal($userinfo, array('id' => $userinfo['customerid'], 'def_language' => $def_language))->update();
|
||||
} catch (Exception $e) {
|
||||
dynamic_error($e->getMessage());
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
}
|
||||
|
||||
// also update current session
|
||||
@@ -195,7 +195,7 @@ if ($page == 'overview') {
|
||||
Database::pexecute($stmt, array("lang" => $def_language, "hash" => $s));
|
||||
}
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, "changed default language to '" . $def_language . "'");
|
||||
redirectTo($filename, array('s' => $s));
|
||||
\Froxlor\UI\Response::redirectTo($filename, array('s' => $s));
|
||||
} else {
|
||||
$default_lang = Settings::Get('panel.standardlanguage');
|
||||
if ($userinfo['def_language'] != '') {
|
||||
@@ -207,7 +207,7 @@ if ($page == 'overview') {
|
||||
$language_options .= makeoption($language_name, $language_file, $default_lang, true);
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate('index/change_language') . "\";");
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate('index/change_language') . "\";");
|
||||
}
|
||||
} elseif ($page == 'change_theme') {
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
@@ -215,7 +215,7 @@ if ($page == 'overview') {
|
||||
try {
|
||||
Customers::getLocal($userinfo, array('id' => $userinfo['customerid'], 'theme' => $theme))->update();
|
||||
} catch (Exception $e) {
|
||||
dynamic_error($e->getMessage());
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
}
|
||||
|
||||
// also update current session
|
||||
@@ -226,7 +226,7 @@ if ($page == 'overview') {
|
||||
Database::pexecute($stmt, array("theme" => $theme, "hash" => $s));
|
||||
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, "changed default theme to '" . $theme . "'");
|
||||
redirectTo($filename, array('s' => $s));
|
||||
\Froxlor\UI\Response::redirectTo($filename, array('s' => $s));
|
||||
} else {
|
||||
$default_theme = Settings::Get('panel.default_theme');
|
||||
if ($userinfo['theme'] != '') {
|
||||
@@ -239,7 +239,7 @@ if ($page == 'overview') {
|
||||
$theme_options.= makeoption($d, $t, $default_theme, true);
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate('index/change_theme') . "\";");
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate('index/change_theme') . "\";");
|
||||
}
|
||||
|
||||
} elseif ($page == 'send_error_report' && Settings::Get('system.allow_error_report_customer') == '1') {
|
||||
@@ -300,22 +300,22 @@ if ($page == 'overview') {
|
||||
|
||||
if ($_mailerror) {
|
||||
// error when reporting an error...LOLFUQ
|
||||
standard_error('send_report_error', $mailerr_msg);
|
||||
\Froxlor\UI\Response::standard_error('send_report_error', $mailerr_msg);
|
||||
}
|
||||
|
||||
// finally remove error from fs
|
||||
@unlink($err_file);
|
||||
redirectTo($filename, array('s' => $s));
|
||||
\Froxlor\UI\Response::redirectTo($filename, array('s' => $s));
|
||||
}
|
||||
// show a nice summary of the error-report
|
||||
// before actually sending anything
|
||||
eval("echo \"" . getTemplate("index/send_error_report") . "\";");
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("index/send_error_report") . "\";");
|
||||
|
||||
} else {
|
||||
redirectTo($filename, array('s' => $s));
|
||||
\Froxlor\UI\Response::redirectTo($filename, array('s' => $s));
|
||||
}
|
||||
} else {
|
||||
redirectTo($filename, array('s' => $s));
|
||||
\Froxlor\UI\Response::redirectTo($filename, array('s' => $s));
|
||||
}
|
||||
}
|
||||
elseif ($page == 'apikeys' && Settings::Get('api.enabled') == 1) {
|
||||
|
||||
Reference in New Issue
Block a user