X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fguest%2Fwhat-login.php;h=56085111a2a3fd4bf7a5a0c912fb73d014a5e131;hb=b8aa17b98b99c27eafbdca0fa090bae63527da9a;hp=0c942a81ee5558fcea3461e88ba57e6caa934fb2;hpb=414570c5081d337bb6c28dcf521bd8bca02f69e7;p=mailer.git diff --git a/inc/modules/guest/what-login.php b/inc/modules/guest/what-login.php index 0c942a81ee..56085111a2 100644 --- a/inc/modules/guest/what-login.php +++ b/inc/modules/guest/what-login.php @@ -11,10 +11,10 @@ * Kurzbeschreibung : Loginbereich (leitet an das richtige Lgin-Modul * * weiter) * * -------------------------------------------------------------------- * - * $Revision:: 856 $ * - * $Date:: 2009-03-06 20:24:32 +0100 (Fr, 06. Mär 2009) $ * + * $Revision:: $ * + * $Date:: $ * * $Tag:: 0.2.1-FINAL $ * - * $Author:: stelzi $ * + * $Author:: $ * * Needs to be in all Files and every File needs "svn propset * * svn:keywords Date Revision" (autoprobset!) at least!!!!!! * * -------------------------------------------------------------------- * @@ -39,129 +39,128 @@ // Some security stuff... if (!defined('__SECURITY')) { - $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php"; + $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php'; require($INC); -} elseif ((!EXT_IS_ACTIVE("user")) && (!IS_ADMIN())) { - addFatalMessage(__FILE__, __LINE__, getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), "user"); +} elseif ((!EXT_IS_ACTIVE('user')) && (!IS_ADMIN())) { + addFatalMessage(__FILE__, __LINE__, generateExtensionInactiveNotInstalledMessage('user')); return; } // Add description as navigation point -ADD_DESCR("guest", __FILE__); +ADD_DESCR('guest', __FILE__); -global $DATA, $ERROR; +global $DATA; // Initialize variables -$ERROR = 0; -$probe_nickname = false; +$errorCode = 0; $uid = false; -$hash = ""; -$URL = ""; -$ADD = ""; +$hash = ''; +$URL = ''; +$add = ''; // Already logged in? -if ((!empty($GLOBALS['userid'])) && (isSessionVariableSet('u_hash'))) { +if ((isUserIdSet()) && (isSessionVariableSet('u_hash'))) { // Maybe, then continue with it - $uid = $GLOBALS['userid']; -} elseif ((REQUEST_ISSET_POST(('id'))) && (REQUEST_ISSET_POST(('password'))) && (IS_FORM_SENT())) { + $uid = getUserId(); +} elseif ((REQUEST_ISSET_POST('id')) && (REQUEST_ISSET_POST('password')) && (isFormSent())) { // Set userid and crypt password when login data was submitted - if ((EXT_IS_ACTIVE("nickname")) && (NICKNAME_PROBE_ON_USERID(REQUEST_POST('id')))) { + if ((EXT_IS_ACTIVE('nickname')) && (NICKNAME_IS_ACTIVE(REQUEST_POST('id')))) { // Nickname entered $uid = SQL_ESCAPE(REQUEST_POST('id')); } else { // Direct userid entered $uid = bigintval(REQUEST_POST('id')); } -} elseif (REQUEST_ISSET_POST(('new_pass'))) { +} elseif (REQUEST_ISSET_POST('new_pass')) { // New password requested $uid = 0; - if (REQUEST_ISSET_POST(('id'))) $uid = REQUEST_POST('id'); + if (REQUEST_ISSET_POST('id')) $uid = REQUEST_POST('id'); } else { // Not logged in - $uid = 0; $hash = ""; + $uid = 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 (!REQUEST_ISSET_POST('new_pass')) REQUEST_SET_POST('new_pass', ''); +if (!REQUEST_ISSET_GET('login')) REQUEST_SET_GET('login' , ''); if (IS_MEMBER()) { // Login immidiately... - $URL = "modules.php?module=login"; -} elseif ((IS_FORM_SENT()) && ("".$uid."" != "".REQUEST_POST('id')."")) { + $URL = 'modules.php?module=login'; +} elseif ((isFormSent()) && (''.$uid.'' != ''.REQUEST_POST('id') . '')) { // Invalid input (no nickname extension installed but nickname entered) - $ERROR = constant('CODE_EXTENSION_PROBLEM'); -} elseif (IS_FORM_SENT()) { + $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))) { +} elseif ((REQUEST_ISSET_POST('new_pass')) && (isset($uid))) { // Try the userid/email lookup (see inc/libs/user_functions.php) - $ERROR = USER_DO_NEW_PASSWORD(REQUEST_POST('email'), $uid); + $errorCode = USER_DO_NEW_PASSWORD(REQUEST_POST('email'), $uid); } // Login problems? -if (REQUEST_ISSET_GET(('login'))) { +if (REQUEST_ISSET_GET('login')) { // Use code from URL - $ERROR = REQUEST_GET(('login')); + $errorCode = REQUEST_GET('login'); } // END - if // Login problems? -if (!empty($ERROR)) { +if (!empty($errorCode)) { // Ok, which one now? - $MSG = " + $message = "   "; - switch ($ERROR) { - case constant('CODE_WRONG_PASS'): - $MSG .= getMessage('LOGIN_WRONG_PASS'); + switch ($errorCode) { + case getCode('WRONG_PASS'): + $message .= getMessage('LOGIN_WRONG_PASS'); break; - case constant('CODE_WRONG_ID'): - $MSG .= getMessage('LOGIN_WRONG_ID'); + case getCode('WRONG_ID'): + $message .= getMessage('LOGIN_WRONG_ID'); break; - case constant('CODE_ID_LOCKED'): - $MSG .= getMessage('LOGIN_ID_LOCKED'); + case getCode('ID_LOCKED'): + $message .= getMessage('LOGIN_ID_LOCKED'); break; - case constant('CODE_ID_UNCONFIRMED'): - $MSG .= getMessage('LOGIN_ID_UNCONFIRMED'); + case getCode('ID_UNCONFIRMED'): + $message .= getMessage('LOGIN_ID_UNCONFIRMED'); break; - case constant('CODE_NO_COOKIES'): - $MSG .= getMessage('LOGIN_NO_COOKIES'); + case getCode('NO_COOKIES'): + $message .= getMessage('LOGIN_NO_COOKIES'); break; - case constant('CODE_EXTENSION_PROBLEM'): + case getCode('EXTENSION_PROBLEM'): if (IS_ADMIN()) { - $MSG .= sprintf(getMessage('EXTENSION_PROBLEM_NOT_INSTALLED'), "nickname"); + $message .= sprintf(getMessage('EXTENSION_PROBLEM_NOT_INSTALLED'), 'nickname'); } else { - $MSG .= getMessage('LOGIN_WRONG_ID'); + $message .= getMessage('LOGIN_WRONG_ID'); } break; default: - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unhandled error code %s detected.", $ERROR)); - $MSG .= getMessage('LOGIN_WRONG_ID'); + DEBUG_LOG(__FILE__, __LINE__, sprintf("Unhandled error code %s detected.", $errorCode)); + $message .= getMessage('LOGIN_WRONG_ID'); break; - } - $MSG .= " + } + $message .= "   \n"; - define('LOGIN_FAILURE_MSG', $MSG); + define('LOGIN_FAILURE_MSG', $message); } else { // No problems, no output - define('LOGIN_FAILURE_MSG', ""); + define('LOGIN_FAILURE_MSG', ''); } // Display login form with resend-password form -if (EXT_IS_ACTIVE("nickname")) { - LOAD_TEMPLATE("guest_nickname_login"); +if (EXT_IS_ACTIVE('nickname')) { + LOAD_TEMPLATE('guest_nickname_login'); } else { - LOAD_TEMPLATE("guest_login"); + LOAD_TEMPLATE('guest_login'); } // Was an URL constructed? @@ -169,10 +168,10 @@ if (!empty($URL)) { // URL was constructed if (getTotalFatalErrors()) { // Fatal errors! - LOAD_INC_ONCE("inc/fatal_errors.php"); + loadIncludeOnce('inc/fatal_errors.php'); } else { // Load URL - LOAD_URL($URL); + redirectToUrl($URL); } } // END - if