- 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'];
+ 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(getModeAction(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);
+ break;
+
+ case '404': // Administrator login not found
+ setRequestPostElement('ok', $ret);
+ $ret = sprintf(getMessage('ADMIN_404'), postRequestElement('login'));
+ destroyAdminSession();
+ break;
+
+ case 'pass': // Wrong password
+ setRequestPostElement('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