]> git.mxchange.org Git - mailer.git/commitdiff
Now all parameters will be restored after login
authorRoland Häder <roland@mxchange.org>
Sat, 13 Aug 2011 23:16:11 +0000 (23:16 +0000)
committerRoland Häder <roland@mxchange.org>
Sat, 13 Aug 2011 23:16:11 +0000 (23:16 +0000)
inc/modules/admin.php
inc/request-functions.php
templates/de/html/admin/admin_login_form.tpl

index 75f57901e1a2c3c32f5abc7f9be247c7c209d166..518ed798387313497f067cb986f463ccfa188ae1 100644 (file)
@@ -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&amp;';
-
-                               // 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);
index 353e24b4e8a6acba00e0c8fb770d44fd25022c0a..d7817ba0c921108d059409c33ac75941c3a28cd2 100644 (file)
@@ -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) . '&amp;';
+       } // END - foreach
+
+       // Remove trailing &amp;
+       $return = substr($return, 0, -5);
+
+       // Return it
+       return $return;
+}
+
 // [EOF]
 ?>
index 0166df915a5ad4baad2241a14524f82a8540ee75..f34d9b11b12e0f4b230984e4bd4487dd8a473928 100644 (file)
@@ -1,5 +1,5 @@
 <div align="center">
-<form accept-charset="UTF-8" action="{%url=modules.php?module=admin&amp;$content[target]=$content[value]%}" method="post">
+<form accept-charset="UTF-8" action="{%url=modules.php?$content[all_parameter]%}" method="post">
 <table border="0" cellspacing="0" cellpadding="0" class="table dashed">
        <tr>
                <td colspan="2" align="center" class="table_header bottom">