X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fguest%2Fwhat-login.php;h=49228e9cf397cb6e8a404bc2f423a6744a2b42eb;hb=49a9663311b732d12ba0c53af2f9eb39a7850fbc;hp=94904e1be4459483357de4321a660e83b2585e9a;hpb=af98c1d0bac78bdcd185e97939da95ac82c35c5d;p=mailer.git diff --git a/inc/modules/guest/what-login.php b/inc/modules/guest/what-login.php index 94904e1be4..49228e9cf3 100644 --- a/inc/modules/guest/what-login.php +++ b/inc/modules/guest/what-login.php @@ -15,11 +15,10 @@ * $Date:: $ * * $Tag:: 0.2.1-FINAL $ * * $Author:: $ * - * Needs to be in all Files and every File needs "svn propset * - * svn:keywords Date Revision" (autoprobset!) at least!!!!!! * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * For more information visit: http://www.mxchange.org * + * Copyright (c) 2009 - 2012 by Mailer Developer Team * + * For more information visit: http://mxchange.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -39,14 +38,14 @@ // Some security stuff... if (!defined('__SECURITY')) { - die(); -} + exit(); +} // END - if // Add description as navigation point -addMenuDescription('guest', __FILE__); +addYouAreHereLink('guest', __FILE__); if ((!isExtensionActive('user')) && (!isAdmin())) { - loadTemplate('admin_settings_saved', false, generateExtensionInactiveNotInstalledMessage('user')); + displayMessage('{%pipe,generateExtensionInactiveNotInstalledMessage=user%}'); return; } // END - if @@ -54,16 +53,16 @@ if ((!isExtensionActive('user')) && (!isAdmin())) { $errorCode = '0'; $userid = false; $hash = ''; -$URL = ''; +$url = ''; $add = ''; // Already logged in? if ((isMemberIdSet()) && (isSessionVariableSet('u_hash'))) { // Maybe, then continue with it $userid = getMemberId(); -} elseif ((isPostRequestElementSet('id')) && (isPostRequestElementSet('password')) && (isFormSent())) { +} elseif ((isPostRequestElementSet('id')) && (isPostRequestElementSet('password')) && (isFormSent('login'))) { // Set userid and crypt password when login data was submitted - if ((isExtensionActive('nickname')) && (isNicknameUsed(postRequestElement('id')))) { + if (isNicknameUsed(postRequestElement('id'))) { // Nickname entered $userid = SQL_ESCAPE(postRequestElement('id')); } else { @@ -72,23 +71,45 @@ if ((isMemberIdSet()) && (isSessionVariableSet('u_hash'))) { } } elseif (isPostRequestElementSet('new_pass')) { // New password requested - $userid = '0'; - if ((isPostRequestElementSet('id')) && (postRequestElement('id') > 0)) $userid = bigintval(postRequestElement('id')); + $userid = NULL; + if (isPostRequestElementSet('email')) { + // Email is set + $userid = SQL_ESCAPE(postRequestElement('email')); + } elseif (isPostRequestElementSet('id')) { + // Do we have nickname or userid? + if (isNicknameUsed(postRequestElement('id'))) { + // Nickname entered + $userid = SQL_ESCAPE(postRequestElement('id')); + } else { + // Direct userid entered + $userid = bigintval(postRequestElement('id')); + } + } // END - if } else { // Not logged in - $userid = '0'; $hash = ''; + $userid = NULL; + $hash = ''; } if (isMember()) { // Login immidiately... - $URL = 'modules.php?module=login'; -} elseif ((isFormSent()) && ('' . $userid . '' != '' . postRequestElement('id') . '')) { + $url = 'modules.php?module=login'; +} elseif ((isFormSent('login')) && ('' . $userid . '' != '' . postRequestElement('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 = doUserLogin(postRequestElement('id'), postRequestElement('password')); -} elseif ((isPostRequestElementSet('new_pass')) && (isset($userid))) { +} elseif (isFormSent('login')) { + // Are both 'id' and 'password' set? + if ((isPostRequestElementSet('id')) && (isPostRequestElementSet('password'))) { + // Try the login (see inc/libs/user_functions.php) + $url = doUserLogin(postRequestElement('id'), postRequestElement('password')); + } elseif (!isPostRequestElementSet('id')) { + // Empty 'id' + $errorCode = getCode('LOGIN_EMPTY_ID'); + } else { + // Empty 'password' + $errorCode = getCode('LOGIN_EMPTY_PASSWORD'); + } +} elseif ((isPostRequestElementSet('new_pass')) && (!empty($userid))) { // Try the userid/email lookup (see inc/libs/user_functions.php) $errorCode = doNewUserPassword(postRequestElement('email'), $userid); } @@ -104,21 +125,14 @@ $content['message'] = ''; // Login problems? if (!empty($errorCode)) { - // @TODO Move this HTML code into a template - $message = " -   - - "; - - // Convert the code to message - $message .= getMessageFromErrorCode($errorCode); + // Do we have a userid set? + if (isSessionVariableSet('userid')) { + // Then prefetch data for this account + fetchUserData(getSession('userid')); + } // END - if - // Continue with HTML - $message .= " - -   -\n"; - $content['message'] = $message; + // @TODO Move this HTML code into a template + $content['message'] = loadTemplate('guest_login_error_message', true, $errorCode); } // END - if // Display login form with resend-password form @@ -129,14 +143,14 @@ if (isExtensionActive('nickname')) { } // Was an URL constructed? -if (!empty($URL)) { +if (!empty($url)) { // URL was constructed - if (getTotalFatalErrors() > 0) { + if (ifFatalErrorsDetected()) { // Handle fatal errors runFilterChain('handle_fatal_errors'); } else { // Load URL - redirectToUrl($URL); + redirectToUrl($url); } } // END - if