aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2011-09-08 10:03:04 +0000
committerplegall <plg@piwigo.org>2011-09-08 10:03:04 +0000
commit9252e5cb2d0cb9a5b2943049e8bb813285d40cd3 (patch)
treea6e5f5165650efcae5ae0bb25c00878885fb5805
parent6a4096f8b941d84606adeaa442824d38a547fba5 (diff)
bug 2434 fixed: try to stay on the same page when changing admin colors
git-svn-id: http://piwigo.org/svn/trunk@12102 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r--admin.php30
1 files changed, 28 insertions, 2 deletions
diff --git a/admin.php b/admin.php
index 4838b2c75..382ec76cb 100644
--- a/admin.php
+++ b/admin.php
@@ -65,7 +65,22 @@ if (isset($_GET['change_theme']))
conf_update_param('admin_theme', $new_admin_theme);
- redirect('admin.php');
+ $url_params = array();
+ foreach (array('page', 'tab', 'section') as $url_param)
+ {
+ if (isset($_GET[$url_param]))
+ {
+ $url_params[] = $url_param.'='.$_GET[$url_param];
+ }
+ }
+
+ $redirect_url = 'admin.php';
+ if (count($url_params) > 0)
+ {
+ $redirect_url.= '?'.implode('&amp;', $url_params);
+ }
+
+ redirect($redirect_url);
}
// +-----------------------------------------------------------------------+
@@ -82,6 +97,17 @@ if ($conf['external_authentification'])
// | Variables init |
// +-----------------------------------------------------------------------+
+$change_theme_url = PHPWG_ROOT_PATH.'admin.php?';
+$test_get = $_GET;
+unset($test_get['page']);
+unset($test_get['section']);
+unset($test_get['tag']);
+if (count($test_get) == 0)
+{
+ $change_theme_url.= str_replace('&', '&amp;', $_SERVER['QUERY_STRING']).'&amp;';
+}
+$change_theme_url.= 'change_theme=1';
+
// ?page=plugin-community-pendings is an clean alias of
// ?page=plugin&section=community/admin.php&tab=pendings
if (isset($_GET['page']) and preg_match('/^plugin-([^-]*)(?:-(.*))?$/', $_GET['page'], $matches))
@@ -161,7 +187,7 @@ $template->assign(
'U_LOGOUT'=> PHPWG_ROOT_PATH.'index.php?act=logout',
'U_PLUGINS'=> $link_start.'plugins',
'U_ADD_PHOTOS' => $link_start.'photos_add',
- 'U_CHANGE_THEME' => PHPWG_ROOT_PATH.'admin.php?change_theme=1',
+ 'U_CHANGE_THEME' => $change_theme_url,
'U_PENDING_COMMENTS' => $link_start.'comments',
'U_UPDATES' => $link_start.'updates',
)