Move theme selection to index.php

- It really makes no sense to do this on every request.
- We want to redirect after changing to make sure page is loaded with new theme.
- Use value only from POST request (it used to be set by GET in past as well).

Signed-off-by: Michal Čihař <michal@cihar.com>
This commit is contained in:
Michal Čihař 2017-11-28 15:19:05 +01:00
parent f9c73c7b10
commit 263722fef8
2 changed files with 10 additions and 5 deletions

View File

@ -66,6 +66,7 @@ if (isset($_REQUEST['ajax_request']) && ! empty($_REQUEST['access_time'])) {
exit;
}
// user selected font size
if (isset($_POST['set_fontsize']) && preg_match('/^[0-9.]+(px|em|pt|\%)$/', $_POST['set_fontsize'])) {
$GLOBALS['PMA_Config']->setUserValue(
null,
@ -76,6 +77,15 @@ if (isset($_POST['set_fontsize']) && preg_match('/^[0-9.]+(px|em|pt|\%)$/', $_PO
header('Location: index.php' . Url::getCommonRaw());
exit();
}
// if user selected a theme
if (isset($_POST['set_theme'])) {
$tmanager = ThemeManager::getInstance();
$tmanager->setActiveTheme($_POST['set_theme']);
$tmanager->setThemeCookie();
header('Location: index.php' . Url::getCommonRaw());
exit();
}
// See FAQ 1.34
if (! empty($_REQUEST['db'])) {

View File

@ -428,11 +428,6 @@ class ThemeManager
{
$tmanager = self::getInstance();
if (isset($_REQUEST['set_theme'])) {
// if user selected a theme
$tmanager->setActiveTheme($_REQUEST['set_theme']);
}
/**
* the theme object
*