From 7b0cdf3260f78ebf0f1b7c3e385623d7366c9aab Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 13 Aug 2011 23:16:11 +0000 Subject: [PATCH] Now all parameters will be restored after login --- inc/modules/admin.php | 46 ++------------------ inc/request-functions.php | 18 ++++++++ templates/de/html/admin/admin_login_form.tpl | 2 +- 3 files changed, 22 insertions(+), 44 deletions(-) diff --git a/inc/modules/admin.php b/inc/modules/admin.php index 75f57901e1..518ed79838 100644 --- a/inc/modules/admin.php +++ b/inc/modules/admin.php @@ -244,25 +244,8 @@ if (!isAdminRegistered()) { // Which status do we have? switch ($ret) { case 'done': // Admin and password are okay, so we log in now - // Construct URL and redirect - $url = 'modules.php?module=admin&'; - - // Rewrite overview module - if (getWhat() == 'overview') { - setAction(getActionFromModuleWhat(getModule(), getWhat())); - } // END - if - - // Add data to URL - if (isWhatSet()) { - $url .= 'what=' . getWhat(); - } elseif (isActionSet()) { - $url .= 'action=' . getAction(); - } elseif (isGetRequestElementSet('area')) { - $url .= 'area=' . getRequestElement('area'); - } - // Load URL - redirectToUrl($url); + redirectToUrl('modules.php?' . addAllGetRequestParameters()); break; case '404': // Administrator login not found @@ -329,31 +312,8 @@ if (!isAdminRegistered()) { } // END - if } // END - if - // Load login form - if (isWhatSet()) { - // Restore old what value - $content = merge_array($content, array('target' => 'what', 'value' => getWhat())); - } elseif (isActionSet()) { - if (getAction() != 'logout') { - // Restore old action value - $content = merge_array($content, array('target' => 'action', 'value' => getAction())); - } else { - // Set default values - $content = merge_array($content, array('target' => 'action', 'value' => 'login')); - } - } elseif (isGetRequestElementSet('area')) { - // Restore old area value - $content = merge_array( - $content, - array( - 'target' => 'area', - 'value' => getRequestElement('area') - ) - ); - } else { - // Set default values - $content = merge_array($content, array('target' => 'action', 'value' => 'login')); - } + // Add all parameter + $content['all_parameter'] = addAllGetRequestParameters(); // Load login form template loadTemplate('admin_login_form', false, $content); diff --git a/inc/request-functions.php b/inc/request-functions.php index 353e24b4e8..d7817ba0c9 100644 --- a/inc/request-functions.php +++ b/inc/request-functions.php @@ -252,5 +252,23 @@ function getRequestUri () { return $_SERVER['REQUEST_URI']; } +// Add all GET parameters to a string (without leading sign) +function addAllGetRequestParameters () { + // Init variable + $return = ''; + + // Now add all parameters + foreach (getRequestArray() as $key => $value) { + // Add it secured + $return .= SQL_ESCAPE($key) . '=' . SQL_ESCAPE($value) . '&'; + } // END - foreach + + // Remove trailing & + $return = substr($return, 0, -5); + + // Return it + return $return; +} + // [EOF] ?> diff --git a/templates/de/html/admin/admin_login_form.tpl b/templates/de/html/admin/admin_login_form.tpl index 0166df915a..f34d9b11b1 100644 --- a/templates/de/html/admin/admin_login_form.tpl +++ b/templates/de/html/admin/admin_login_form.tpl @@ -1,5 +1,5 @@
-
+
-- 2.39.5