Rewritten to use NICKNAME_IS_ACTIVE()
[mailer.git] / inc / libs / user_functions.php
index 27ec67fe21b9e88cb28609e43539ab0c542c0da3..5fc33f72a2d2a35df50ae38dc77133b73a7fec7b 100644 (file)
@@ -58,7 +58,7 @@ function alpha ($sortby, $colspan, $return=false) {
                        $OUT .= "<strong>".$ltr."</strong>";
                } else {
                        // Output link to letter
-                       $OUT .= "<a href=\"{!URL!}/modules.php?module=admin&amp;what=".$GLOBALS['what'];
+                       $OUT .= "<a href=\"{!URL!}/modules.php?module=admin&amp;what=".getWhat();
                        if (REQUEST_ISSET_GET('mode')) $OUT .= "&amp;mode=".REQUEST_GET('mode');
                        $OUT .= "&amp;letter=".$ltr."&amp;sortby=".$sortby.$add."\">".$ltr."</a>";
                }
@@ -160,7 +160,7 @@ function ADD_PAGENAV ($PAGES, $offset, $show_form, $colspan,$return=false) {
                        if (!REQUEST_ISSET_GET('sortby')) REQUEST_SET_GET('sortby', 'userid');
 
                        // Base link
-                       $OUT .= "<a href=\"{!URL!}/modules.php?module=admin&amp;what=".$GLOBALS['what'];
+                       $OUT .= "<a href=\"{!URL!}/modules.php?module=admin&amp;what=".getWhat();
 
                        // Add status or mode
                        if (REQUEST_ISSET_GET(('status'))) $OUT .= "&amp;mode=".REQUEST_GET(('status'));
@@ -280,14 +280,14 @@ function USER_DO_LOGIN ($uid, $passwd) {
                );
 
                // Check login data
-               if ((EXT_IS_ACTIVE('nickname')) && (NICKNAME_PROBE_ON_USERID($uid))) {
+               if ((EXT_IS_ACTIVE('nickname')) && (NICKNAME_IS_ACTIVE($uid))) {
                        // Nickname entered
                        $result = SQL_QUERY_ESC("SELECT userid, password, last_online".$lastOnline." FROM `{!_MYSQL_PREFIX!}_user_data` WHERE nickname='%s' AND `status`='CONFIRMED' LIMIT 1",
-                       array($uid), __FUNCTION__, __LINE__);
+                               array($uid), __FUNCTION__, __LINE__);
                } else {
                        // Direct userid entered
                        $result = SQL_QUERY_ESC("SELECT userid, password, last_online".$lastOnline." FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND `status`='CONFIRMED' LIMIT 1",
-                       array($uid, $content['hash']), __FUNCTION__, __LINE__);
+                               array($uid, $content['hash']), __FUNCTION__, __LINE__);
                }
 
                // Load entry
@@ -295,7 +295,7 @@ function USER_DO_LOGIN ($uid, $passwd) {
                if (!empty($content['userid'])) $uid = bigintval($content['userid']);
 
                // Is there an entry?
-               if ((SQL_NUMROWS($result) == 1) && ((($probe_nickname) && (!empty($content['userid']))) || ($content['userid'] == $uid))) {
+               if ((SQL_NUMROWS($result) == 1) && ((isNicknameUsed($content['userid'] === true) && (!empty($content['userid']))) || ($content['userid'] == $uid))) {
                        // Free result
                        SQL_FREERESULT($result);
 
@@ -372,7 +372,7 @@ function USER_DO_LOGIN ($uid, $passwd) {
                                // Wrong password!
                                $URL = 'modules.php?module=index&amp;what=login&amp;login='.getCode('WRONG_PASS');
                        }
-               } elseif ((($probe_nickname) && (!empty($content['userid']))) || ($content['userid'] == $uid)) {
+               } elseif (((isNicknameUsed($content['userid'])) && (!empty($content['userid']))) || ($content['userid'] == $uid)) {
                        // Other account status?
                        // @TODO Can this query be merged with above query?
                        $result = SQL_QUERY_ESC("SELECT status FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
@@ -411,7 +411,7 @@ function USER_DO_NEW_PASSWORD ($email, $uid) {
        $result = false;
 
        // Probe userid/nickname
-       if ((EXT_IS_ACTIVE('nickname')) && (NICKNAME_PROBE_ON_USERID($uid))) {
+       if ((EXT_IS_ACTIVE('nickname')) && (NICKNAME_IS_ACTIVE($uid))) {
                // Nickname entered
                $result = SQL_QUERY_ESC("SELECT userid, status FROM `{!_MYSQL_PREFIX!}_user_data` WHERE nickname='%s' OR email='%s' LIMIT 1",
                array($uid, $email), __FUNCTION__, __LINE__);