- 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']);
- }
-
- // 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;
+ 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 (isGetRequestParameterSet('area')) $url .= 'area='.getRequestParameter('area');
+
+ // Load URL
+ redirectToUrl($url);
+ break;
+
+ case '404': // Administrator login not found
+ setPostRequestParameter('ok', $ret);
+ $ret = getMaskedMessage('ADMIN_ACCOUNT_404', postRequestParameter('login'));
+ destroyAdminSession();
+ break;
+
+ case 'pass': // Wrong password
+ setPostRequestParameter('ok', $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;
+ } // END - switch
+ } // END - if