X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fmodules%2Fguest%2Fwhat-login.php;h=e888b2cbbb076e89571c46c7ea2043a801b36b43;hp=f48373d62f062d148c5d60365ded7a6bb2a5f79c;hb=76fd13e5938a334f08e43893eb9a4ff49f72bf07;hpb=12d1414024e87153a133bb1d0fe0185ca2c700c5 diff --git a/inc/modules/guest/what-login.php b/inc/modules/guest/what-login.php index f48373d62f..e888b2cbbb 100644 --- a/inc/modules/guest/what-login.php +++ b/inc/modules/guest/what-login.php @@ -1,7 +1,7 @@ 0)) $userid = bigintval(postRequestParameter('id')); } else { // Not logged in - $uid = 0; $hash = ''; + $userid = '0'; $hash = ''; } -// Set unset variables -if (!REQUEST_ISSET_POST(('new_pass'))) REQUEST_SET_POST('new_pass', ''); -if (!REQUEST_ISSET_GET('login')) REQUEST_SET_GET('login' , ''); - -if (IS_MEMBER()) { +if (isMember()) { // Login immidiately... - $URL = 'modules.php?module=login'; -} elseif ((isFormSent()) && (''.$uid.'' != ''.REQUEST_POST('id') . '')) { + $url = 'modules.php?module=login'; +} elseif ((isFormSent()) && ('' . $userid . '' != '' . postRequestParameter('id') . '')) { // Invalid input (no nickname extension installed but nickname entered) $errorCode = getCode('EXTENSION_PROBLEM'); } elseif (isFormSent()) { // Try the login (see inc/libs/user_functions.php) - $URL = USER_DO_LOGIN(REQUEST_POST('id'), REQUEST_POST('password')); -} elseif ((REQUEST_ISSET_POST(('new_pass'))) && (isset($uid))) { + $url = doUserLogin(postRequestParameter('id'), postRequestParameter('password')); +} elseif ((isPostRequestParameterSet('new_pass')) && (isset($userid))) { // Try the userid/email lookup (see inc/libs/user_functions.php) - $errorCode = USER_DO_NEW_PASSWORD(REQUEST_POST('email'), $uid); + $errorCode = doNewUserPassword(postRequestParameter('email'), $userid); } // Login problems? -if (REQUEST_ISSET_GET('login')) { +if (isGetRequestParameterSet('login')) { // Use code from URL - $errorCode = REQUEST_GET('login'); + $errorCode = getRequestParameter('login'); } // END - if +// No problems, no output by detault +$content['message'] = ''; + // Login problems? if (!empty($errorCode)) { - // Ok, which one now? - $message = " -   - - "; - - switch ($errorCode) { - case getCode('WRONG_PASS'): - $message .= getMessage('LOGIN_WRONG_PASS'); - break; - - case getCode('WRONG_ID'): - $message .= getMessage('LOGIN_WRONG_ID'); - break; - - case getCode('ID_LOCKED'): - $message .= getMessage('LOGIN_ID_LOCKED'); - break; - - case getCode('ID_UNCONFIRMED'): - $message .= getMessage('LOGIN_ID_UNCONFIRMED'); - break; - - case getCode('NO_COOKIES'): - $message .= getMessage('LOGIN_NO_COOKIES'); - break; - - case getCode('EXTENSION_PROBLEM'): - if (IS_ADMIN()) { - $message .= sprintf(getMessage('EXTENSION_PROBLEM_NOT_INSTALLED'), 'nickname'); - } else { - $message .= getMessage('LOGIN_WRONG_ID'); - } - break; - - default: - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unhandled error code %s detected.", $errorCode)); - $message .= getMessage('LOGIN_WRONG_ID'); - break; - } - $message .= " + // Do we have a userid set? + if (isSessionVariableSet('current_userid')) { + // Then prefetch data for this account + fetchUserData(getSession('current_userid')); + } // END - if + + // @TODO Move this HTML code into a template + $content['message'] = ' + + ' . getMessageFromErrorCode($errorCode) . ' -   -\n"; - define('LOGIN_FAILURE_MSG', $message); -} else { - // No problems, no output - define('LOGIN_FAILURE_MSG', ''); -} +'; +} // END - if // Display login form with resend-password form -if (EXT_IS_ACTIVE('nickname')) { - LOAD_TEMPLATE('guest_nickname_login'); +if (isExtensionActive('nickname')) { + loadTemplate('guest_nickname_login', false, $content); } else { - LOAD_TEMPLATE('guest_login'); + loadTemplate('guest_login', false, $content); } // Was an URL constructed? -if (!empty($URL)) { +if (!empty($url)) { // URL was constructed - if (getTotalFatalErrors()) { - // Fatal errors! - loadIncludeOnce('inc/fatal_errors.php'); + if (ifFatalErrorsDetected()) { + // Handle fatal errors + runFilterChain('handle_fatal_errors'); } else { // Load URL - redirectToUrl($URL); + redirectToUrl($url); } } // END - if -// +// [EOF] ?>