Complete rewrite of and , wrapper functions added, see bug #101
[mailer.git] / inc / modules / guest / what-login.php
index cd575419ea0ab085828403e2a57c63c62113c89d..4a2f2a233ef16b2557cd61d2eec6ed50afd2c070 100644 (file)
@@ -58,46 +58,46 @@ $ADD = "";
 if ((!empty($GLOBALS['userid'])) && (isSessionVariableSet('u_hash'))) {
        // Maybe, then continue with it
        $uid = $GLOBALS['userid'];
-} elseif ((!empty($_POST['id'])) && (!empty($_POST['password'])) && (isset($_POST['ok']))) {
+} elseif ((REQUEST_ISSET_POST(('id'))) && (REQUEST_ISSET_POST(('password'))) && (IS_FORM_SENT())) {
        // Set userid and crypt password when login data was submitted
-       if ((EXT_IS_ACTIVE("nickname")) && (NICKNAME_PROBE_ON_USERID($_POST['id']))) {
+       if ((EXT_IS_ACTIVE("nickname")) && (NICKNAME_PROBE_ON_USERID(REQUEST_POST('id')))) {
                // Nickname entered
-               $uid = SQL_ESCAPE($_POST['id']);
+               $uid = SQL_ESCAPE(REQUEST_POST('id'));
        } else {
                // Direct userid entered
-               $uid  = bigintval($_POST['id']);
+               $uid  = bigintval(REQUEST_POST('id'));
        }
-} elseif (!empty($_POST['new_pass'])) {
+} elseif (REQUEST_ISSET_POST(('new_pass'))) {
        // New password requested
        $uid = 0;
-       if (!empty($_POST['id'])) $uid = $_POST['id'];
+       if (REQUEST_ISSET_POST(('id'))) $uid = REQUEST_POST('id');
 } else {
        // Not logged in
        $uid = 0; $hash = "";
 }
 
 // Set unset variables
-if (empty($_POST['new_pass'])) $_POST['new_pass'] = "";
-if (empty($_GET['login']))     $_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 ((isset($_POST['ok'])) && ("".$uid."" != "".$_POST['id']."")) {
+} elseif ((IS_FORM_SENT()) && ("".$uid."" != "".REQUEST_POST('id')."")) {
        // Invalid input (no nickname extension installed but nickname entered)
        $ERROR = constant('CODE_EXTENSION_PROBLEM');
-} elseif (isset($_POST['ok'])) {
+} elseif (IS_FORM_SENT()) {
        // Try the login (see inc/libs/user_functions.php)
-       $URL = USER_DO_LOGIN($_POST['id'], $_POST['password']);
-} elseif ((!empty($_POST['new_pass'])) && (isset($uid))) {
+       $URL = USER_DO_LOGIN(REQUEST_POST('id'), REQUEST_POST('password'));
+} elseif ((REQUEST_ISSET_POST(('new_pass'))) && (isset($uid))) {
        // Try the userid/email lookup (see inc/libs/user_functions.php)
-       $ERROR = USER_DO_NEW_PASSWORD($_POST['email'], $uid);
+       $ERROR = USER_DO_NEW_PASSWORD(REQUEST_POST('email'), $uid);
 }
 
 // Login problems?
-if (!empty($_GET['login'])) {
+if (REQUEST_ISSET_GET(('login'))) {
        // Use code from URL
-       $ERROR = SQL_ESCAPE($_GET['login']);
+       $ERROR = SQL_ESCAPE(REQUEST_GET('login'));
 } // END  - if
 
 // Login problems?