- switch ($ret)
- {
- case "done": // Admin and password are okay, so we log in now
- // Construct URL and redirect
- $URL = URL."/modules.php?module=admin&";
-
- // Rewrite overview module
- if ($GLOBALS['what'] == "overview") {
- $GLOBALS['action'] = GET_ACTION($GLOBALS['module'], $GLOBALS['what']);
- } // END - if
-
- // Add data to URL
- if (!empty($GLOBALS['what'])) $URL .= "what=".$GLOBALS['what'];
- elseif (!empty($GLOBALS['action'])) $URL .= "action=".$GLOBALS['action'];
- elseif (!empty($_GET['area'])) $URL .= "area=".$_GET['area'];
-
- // Load URL
- LOAD_URL($URL);
- break;
-
- case "404": // Administrator login not found
- $_POST['ok'] = $ret;
- $ret = ADMIN_NOT_FOUND;
- DESTROY_ADMIN_SESSION();
- break;
-
- case "pass": // Wrong password
- $_POST['ok'] = $ret;
- $ret = WRONG_PASS." [<A href=\"".URL."/modules.php?module=admin&reset_pass=1\">".ADMIN_RESET_PASS."</A>]\n";
- DESTROY_ADMIN_SESSION();
- break;
+ switch ($ret) {
+ case 'done': // Admin and password are okay, so we log in now
+ // Load URL
+ redirectToUrl('modules.php?' . addAllGetRequestParameters());
+ break;
+
+ case '404': // Administrator login not found
+ setPostRequestElement('login', $ret);
+ $ret = '{%message,ADMIN_ACCOUNT_404=' . postRequestElement('admin_login') . '%}';
+ destroyAdminSession();
+ break;
+
+ case 'password': // Wrong password
+ setPostRequestElement('login', $ret);
+ $ret = '{--WRONG_PASS--} [<a href="{%url=modules.php?module=admin&reset_pass=1%}">{--ADMIN_RESET_PASS--}</a>]';
+ destroyAdminSession();
+ break;
+
+ default: // Others will be logged
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown return code %s from ifAdminLoginDataIsValid()", $ret));
+ break;