New naming convention applied to many functions, see #118 for details
[mailer.git] / inc / libs / user_functions.php
index 32be05f4b6aed24ae2c5d0a3234322fae09e436e..1b72e2065efaaf37f6da424ed89229d50bc92bc1 100644 (file)
@@ -49,7 +49,7 @@ function alpha ($sortby, $colspan, $return=false) {
        if (REQUEST_ISSET_GET(('mode'))) $add .= "&mode=".REQUEST_GET(('mode'));
 
        /* Creates the list of letters and makes them a link. */
-       $alphabet = array(getMessage('_ALL2'),"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z",getMessage('_OTHERS'));
+       $alphabet = explode(',', getMessage('_ALL2') . 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z' . getMessage('_OTHERS'));
        $num = count($alphabet) - 1;
        $OUT = '';
        while (list($counter, $ltr) = each($alphabet)) {
@@ -103,7 +103,7 @@ function SortLinks ($letter, $sortby, $colspan, $return=false) {
        $list = array(
                'userid'                => getMessage('_UID'),
                'family'                => getMessage('FAMILY_NAME'),
-               'email'         => getMessage('ADDY'),
+               'email'                 => getMessage('ADDY'),
                'REMOTE_ADDR'   => getMessage('REMOTE_IP')
        );
 
@@ -195,7 +195,7 @@ function ADD_PAGENAV ($PAGES, $offset, $show_form, $colspan,$return=false) {
 }
 
 // Create email link to user's account
-function USER_CREATE_EMAIL_LINK($email, $mod='admin') {
+function USER_generateMemberEmailLink($email, $mod='admin') {
        // Show contact link only if user is confirmed by default
        $locked = " AND `status`='CONFIRMED'";
 
@@ -229,7 +229,7 @@ function SELECT_RANDOM_REFID () {
        // Is the extension version fine?
        if (GET_EXT_VERSION('user') >= '0.3.4') {
                // Get all user ids
-               $totalUsers = GET_TOTAL_DATA("CONFIRMED", "user_data", 'userid', "status", true, " AND `rand_confirmed` >= ".getConfig('user_min_confirmed')."");
+               $totalUsers = GET_TOTAL_DATA('CONFIRMED', 'user_data', 'userid', 'status', true, " AND `rand_confirmed` >= ".getConfig('user_min_confirmed')."");
 
                // Do we have at least one?
                if ($totalUsers > 0) {
@@ -343,7 +343,7 @@ function USER_DO_LOGIN ($uid, $passwd) {
                        setUserId($uid);
 
                        // Try to set session data (which shall normally always work!)
-                       if ((set_session('userid', $uid )) && (set_session('u_hash', $content['hash']))) {
+                       if ((setSession('userid', $uid )) && (setSession('u_hash', $content['hash']))) {
                                // Update database records
                                SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET total_logins=total_logins+1".$add." WHERE userid=%s LIMIT 1",
                                        array($uid), __FUNCTION__, __LINE__);
@@ -384,7 +384,7 @@ function USER_DO_LOGIN ($uid, $passwd) {
                        list($status) = SQL_FETCHROW($result);
 
                        // Create an error code from given status
-                       $errorCode = GEN_ERROR_CODE_FROM_ACCOUNT_STATUS($status);
+                       $errorCode = generateErrorCodeFromUserStatus($status);
                } else {
                        // ID not found!
                        $errorCode = getCode('WRONG_ID');
@@ -436,7 +436,7 @@ function USER_DO_NEW_PASSWORD ($email, $uid) {
 
                if ($status == 'CONFIRMED') {
                        // Ooppps, this was missing! ;-) We should update the database...
-                       $NEW_PASS = GEN_PASS();
+                       $NEW_PASS = generatePassword();
                        SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET password='%s' WHERE userid=%s LIMIT 1",
                                array(generateHash($NEW_PASS), $uid), __FUNCTION__, __LINE__);
 
@@ -444,16 +444,16 @@ function USER_DO_NEW_PASSWORD ($email, $uid) {
                        $msg = LOAD_EMAIL_TEMPLATE('new-pass', array('new_pass' => $NEW_PASS), $uid);
 
                        // ... and send it away
-                       SEND_EMAIL($uid, getMessage('GUEST_NEW_PASSWORD'), $msg);
+                       sendEmail($uid, getMessage('GUEST_NEW_PASSWORD'), $msg);
 
                        // Output note to user
                        LOAD_TEMPLATE('admin_settings_saved', false, getMessage('GUEST_NEW_PASSWORD_SEND'));
                } else {
                        // Account is locked or unconfirmed
-                       $errorCode = GEN_ERROR_CODE_FROM_ACCOUNT_STATUS($status);
+                       $errorCode = generateErrorCodeFromUserStatus($status);
 
                        // Load URL
-                       LOAD_URL('modules.php?module=index&what=login&login='.$errorCode);
+                       redirectToUrl('modules.php?module=index&what=login&login='.$errorCode);
                }
        } else {
                // ID or email is wrong