forked from ZwiiCMS-Team/ZwiiCMS
Csrf Theme reset
This commit is contained in:
parent
adf0ac8f80
commit
f262b661e9
@ -811,44 +811,32 @@ class theme extends common
|
|||||||
*/
|
*/
|
||||||
public function reset()
|
public function reset()
|
||||||
{
|
{
|
||||||
// $url prend l'adresse sans le token
|
// Réinitialisation
|
||||||
$url = explode('&', $this->getUrl(2));
|
$redirect = '';
|
||||||
|
switch ($this->getUrl(2)) {
|
||||||
if (
|
case 'admin':
|
||||||
isset($_GET['csrf'])
|
$this->initData('admin', self::$i18nUI);
|
||||||
and $_GET['csrf'] === $_SESSION['csrf']
|
$redirect = helper::baseUrl() . 'theme/admin';
|
||||||
) {
|
break;
|
||||||
// Réinitialisation
|
case 'manage':
|
||||||
$redirect = '';
|
$this->initData('theme', self::$i18nUI);
|
||||||
switch ($url[0]) {
|
$redirect = helper::baseUrl() . 'theme/manage';
|
||||||
case 'admin':
|
break;
|
||||||
$this->initData('admin', self::$i18nUI);
|
case 'custom':
|
||||||
$redirect = helper::baseUrl() . 'theme/admin';
|
unlink(self::DATA_DIR . 'custom.css');
|
||||||
break;
|
$redirect = helper::baseUrl() . 'theme/advanced';
|
||||||
case 'manage':
|
break;
|
||||||
$this->initData('theme', self::$i18nUI);
|
default:
|
||||||
$redirect = helper::baseUrl() . 'theme/manage';
|
$redirect = helper::baseUrl() . 'theme';
|
||||||
break;
|
|
||||||
case 'custom':
|
|
||||||
unlink(self::DATA_DIR . 'custom.css');
|
|
||||||
$redirect = helper::baseUrl() . 'theme/advanced';
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$redirect = helper::baseUrl() . 'theme';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Valeurs en sortie
|
|
||||||
$this->addOutput([
|
|
||||||
'notification' => helper::translate('Thème réinitialisé'),
|
|
||||||
'redirect' => $redirect,
|
|
||||||
'state' => true
|
|
||||||
]);
|
|
||||||
} else {
|
|
||||||
// Valeurs en sortie
|
|
||||||
$this->addOutput([
|
|
||||||
'notification' => helper::translate('Jeton incorrect')
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Valeurs en sortie
|
||||||
|
$this->addOutput([
|
||||||
|
'notification' => helper::translate('Thème réinitialisé'),
|
||||||
|
'redirect' => $redirect,
|
||||||
|
'state' => true
|
||||||
|
]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user