add change pwd|lang|theme; twig-ify standard_error()
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -182,7 +182,6 @@ if ($page == 'overview') {
|
|||||||
'uptime' => $uptime
|
'uptime' => $uptime
|
||||||
];
|
];
|
||||||
|
|
||||||
// @fixme add all the overview/dashboard data from above
|
|
||||||
UI::Twig()->addGlobal('userinfo', $userinfo);
|
UI::Twig()->addGlobal('userinfo', $userinfo);
|
||||||
UI::TwigBuffer('user/index.html.twig', [
|
UI::TwigBuffer('user/index.html.twig', [
|
||||||
'sysinfo' => $sysinfo,
|
'sysinfo' => $sysinfo,
|
||||||
@@ -239,7 +238,8 @@ if ($page == 'overview') {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("index/change_password") . "\";");
|
UI::TwigBuffer('user/change_password.html.twig');
|
||||||
|
UI::TwigOutputBuffer();
|
||||||
}
|
}
|
||||||
} elseif ($page == 'change_language') {
|
} elseif ($page == 'change_language') {
|
||||||
|
|
||||||
@@ -279,11 +279,11 @@ if ($page == 'overview') {
|
|||||||
$default_lang = $userinfo['def_language'];
|
$default_lang = $userinfo['def_language'];
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($languages as $language_file => $language_name) {
|
UI::TwigBuffer('user/change_language.html.twig', [
|
||||||
$language_options .= \Froxlor\UI\HTML::makeoption($language_name, $language_file, $default_lang, true);
|
'languages' => $languages,
|
||||||
}
|
'default_lang' => $default_lang
|
||||||
|
]);
|
||||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("index/change_language") . "\";");
|
UI::TwigOutputBuffer();
|
||||||
}
|
}
|
||||||
} elseif ($page == 'change_theme') {
|
} elseif ($page == 'change_theme') {
|
||||||
|
|
||||||
@@ -322,11 +322,12 @@ if ($page == 'overview') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$themes_avail = \Froxlor\UI\Template::getThemes();
|
$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_admin') == '1') {
|
} elseif ($page == 'send_error_report' && Settings::Get('system.allow_error_report_admin') == '1') {
|
||||||
|
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ class Response
|
|||||||
*/
|
*/
|
||||||
public static function standard_error($errors = '', $replacer = '', $throw_exception = false)
|
public static function standard_error($errors = '', $replacer = '', $throw_exception = false)
|
||||||
{
|
{
|
||||||
global $userinfo, $s, $header, $footer, $lng, $theme;
|
global $lng;
|
||||||
|
|
||||||
$_SESSION['requestData'] = $_POST;
|
$_SESSION['requestData'] = $_POST;
|
||||||
$replacer = htmlentities($replacer);
|
$replacer = htmlentities($replacer);
|
||||||
@@ -92,9 +92,9 @@ class Response
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$link = '';
|
$link_ref = '';
|
||||||
if (isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST']) !== false) {
|
if (isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST']) !== false) {
|
||||||
$link = '<a href="' . htmlentities($_SERVER['HTTP_REFERER']) . '">' . $lng['panel']['back'] . '</a>';
|
$link_ref = htmlentities($_SERVER['HTTP_REFERER']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$error = '';
|
$error = '';
|
||||||
@@ -119,8 +119,15 @@ class Response
|
|||||||
if ($throw_exception) {
|
if ($throw_exception) {
|
||||||
throw new \Exception(strip_tags($error), 400);
|
throw new \Exception(strip_tags($error), 400);
|
||||||
}
|
}
|
||||||
eval("echo \"" . Template::getTemplate('misc/error', '1') . "\";");
|
\Froxlor\UI\Panel\UI::TwigBuffer('misc/alert.html.twig', [
|
||||||
exit();
|
'type' => 'danger',
|
||||||
|
'btntype' => 'light',
|
||||||
|
'heading' => $lng['error']['error'],
|
||||||
|
'alert_msg' => $error,
|
||||||
|
'redirect_link' => $link_ref
|
||||||
|
]);
|
||||||
|
\Froxlor\UI\Panel\UI::TwigOutputBuffer();
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function dynamic_error($message)
|
public static function dynamic_error($message)
|
||||||
|
|||||||
@@ -500,6 +500,10 @@ if ($page == '') {
|
|||||||
$page = 'overview';
|
$page = 'overview';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UI::Twig()->addGlobal('action', $action);
|
||||||
|
UI::Twig()->addGlobal('page', $page);
|
||||||
|
UI::Twig()->addGlobal('s', $s);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the mailingsystem
|
* Initialize the mailingsystem
|
||||||
*/
|
*/
|
||||||
|
|||||||
25
templates/Froxlor/misc/alert.html.twig
Normal file
25
templates/Froxlor/misc/alert.html.twig
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
{% extends "Froxlor/userarea.html.twig" %}
|
||||||
|
|
||||||
|
{% set body_class = "min-vh-100 d-flex align-items-center" %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="alert alert-{{ type }} fade show" role="alert">
|
||||||
|
<h4 class="alert-heading">
|
||||||
|
{{ heading }}
|
||||||
|
</h4>
|
||||||
|
<p>
|
||||||
|
{{ alert_msg|raw }}
|
||||||
|
</p>
|
||||||
|
{% if alert_info %}
|
||||||
|
<hr>
|
||||||
|
<p class="mb-0">
|
||||||
|
<pre>{{ alert_info|raw }}</pre>
|
||||||
|
</p>
|
||||||
|
{% endif %}
|
||||||
|
{% if redirect_link %}
|
||||||
|
<p class="mt-1">
|
||||||
|
<a href="{{ redirect_link }}" class="btn btn-{{ btntype }}">{% if type == 'danger' %}{{ lng('panel.back') }}{% else %}{{ lng('success.clickheretocontinue') }}{% endif %}</a>
|
||||||
|
</p>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
34
templates/Froxlor/user/change_language.html.twig
Normal file
34
templates/Froxlor/user/change_language.html.twig
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
{% extends "Froxlor/userarea.html.twig" %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="container">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<form action="{{ linker({'section':'index'}) }}" class="col-12 max-w-420 d-flex flex-column" method="post" enctype="application/x-www-form-urlencoded">
|
||||||
|
<div class="card shadow">
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title">{{ lng('menue.main.changelanguage') }}</h5>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label for="def_language" class="col-form-label">{{ lng('login.language') }}</label>
|
||||||
|
<select class="form-select" name="def_language" id="def_language" required>
|
||||||
|
<option value="profile">{{ lng('login.profile_lng') }}</option>
|
||||||
|
{% for val,lang in languages %}
|
||||||
|
<option value="{{ val }}" {% if default_lang == val %} selected="selected" {% endif %}>{{ lang|raw }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card-body d-grid gap-2">
|
||||||
|
<input type="hidden" name="s" value="{{ s }}"/>
|
||||||
|
<input type="hidden" name="page" value="{{ page }}"/>
|
||||||
|
<input type="hidden" name="send" value="send"/>
|
||||||
|
<button class="btn btn-primary rounded-top-0" type="submit" name="dosave">
|
||||||
|
<i class="fa-regular fa-floppy-disk"></i>
|
||||||
|
{{ lng('menue.main.changelanguage') }}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
37
templates/Froxlor/user/change_password.html.twig
Normal file
37
templates/Froxlor/user/change_password.html.twig
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
{% extends "Froxlor/userarea.html.twig" %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="container">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<form action="{{ linker({'section':'index'}) }}" class="col-12 max-w-420 d-flex flex-column" method="post" enctype="application/x-www-form-urlencoded">
|
||||||
|
<div class="card shadow">
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title">{{ lng('menue.main.changepassword') }}</h5>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="old_password" class="col-form-label">{{ lng('changepassword.old_password') }}</label>
|
||||||
|
<input class="form-control" type="password" name="old_password" id="old_password" value="" required/>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="new_password" class="col-form-label">{{ lng('changepassword.new_password') }}</label>
|
||||||
|
<input class="form-control" type="password" name="new_password" id="new_password" value="" required/>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="new_password_confirm" class="col-form-label">{{ lng('changepassword.new_password_confirm') }}</label>
|
||||||
|
<input class="form-control" type="password" name="new_password_confirm" id="new_password_confirm" value="" required/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card-body d-grid gap-2">
|
||||||
|
<input type="hidden" name="s" value="{{ s }}"/>
|
||||||
|
<input type="hidden" name="page" value="{{ page }}"/>
|
||||||
|
<input type="hidden" name="send" value="send"/>
|
||||||
|
<button class="btn btn-primary rounded-top-0" type="submit" name="dosave">
|
||||||
|
<i class="fa-regular fa-floppy-disk"></i>
|
||||||
|
{{ lng('menue.main.changepassword') }}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
33
templates/Froxlor/user/change_theme.html.twig
Normal file
33
templates/Froxlor/user/change_theme.html.twig
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
{% extends "Froxlor/userarea.html.twig" %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="container">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<form action="{{ linker({'section':'index'}) }}" class="col-12 max-w-420 d-flex flex-column" method="post" enctype="application/x-www-form-urlencoded">
|
||||||
|
<div class="card shadow">
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title">{{ lng('menue.main.changetheme') }}</h5>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label for="theme" class="col-form-label">{{ lng('panel.theme') }}</label>
|
||||||
|
<select class="form-select" name="theme" id="theme" required>
|
||||||
|
{% for val,t in themes %}
|
||||||
|
<option value="{{ val }}" {% if default_theme == val %} selected="selected" {% endif %}>{{ t|raw }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card-body d-grid gap-2">
|
||||||
|
<input type="hidden" name="s" value="{{ s }}"/>
|
||||||
|
<input type="hidden" name="page" value="{{ page }}"/>
|
||||||
|
<input type="hidden" name="send" value="send"/>
|
||||||
|
<button class="btn btn-primary rounded-top-0" type="submit" name="dosave">
|
||||||
|
<i class="fa-regular fa-floppy-disk"></i>
|
||||||
|
{{ lng('menue.main.changetheme') }}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
Reference in New Issue
Block a user