More misc fixes and rewrites (sorry, lame description)
[mailer.git] / inc / modules / guest / what-login.php
index 98abf6a52c5802d66c2eb4bb555ecab4235eea16..56085111a2a3fd4bf7a5a0c912fb73d014a5e131 100644 (file)
@@ -42,7 +42,7 @@ if (!defined('__SECURITY')) {
        $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');
+       addFatalMessage(__FILE__, __LINE__, generateExtensionInactiveNotInstalledMessage('user'));
        return;
 }
 
@@ -53,7 +53,6 @@ global $DATA;
 
 // Initialize variables
 $errorCode = 0;
-$probe_nickname = false;
 $uid = false;
 $hash = '';
 $URL = '';
@@ -63,46 +62,46 @@ $add = '';
 if ((isUserIdSet()) && (isSessionVariableSet('u_hash'))) {
        // Maybe, then continue with it
        $uid = getUserId();
-} elseif ((REQUEST_ISSET_POST(('id'))) && (REQUEST_ISSET_POST(('password'))) && (IS_FORM_SENT())) {
+} 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 = '';
 }
 
 // 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').'')) {
+} elseif ((isFormSent()) && (''.$uid.'' != ''.REQUEST_POST('id') . '')) {
        // Invalid input (no nickname extension installed but nickname entered)
        $errorCode = getCode('EXTENSION_PROBLEM');
-} elseif (IS_FORM_SENT()) {
+} 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)
        $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
-       $errorCode = REQUEST_GET(('login'));
+       $errorCode = REQUEST_GET('login');
 } // END  - if
 
 // Login problems?
@@ -146,12 +145,12 @@ if (!empty($errorCode)) {
                        DEBUG_LOG(__FILE__, __LINE__, sprintf("Unhandled error code %s detected.", $errorCode));
                        $message .= getMessage('LOGIN_WRONG_ID');
                        break;
-               }
-               $message .= "</span>
+       }
+       $message .= "</span>
   </td>
   <td width=\"10\" class=\"seperator\">&nbsp;</td>
 </tr>\n";
-               define('LOGIN_FAILURE_MSG', $message);
+       define('LOGIN_FAILURE_MSG', $message);
 } else {
        // No problems, no output
        define('LOGIN_FAILURE_MSG', '');
@@ -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