]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/user_functions.php
Extension ext-network continued:
[mailer.git] / inc / libs / user_functions.php
index 688640aa4d72d7e521ecf6e93c49d7ed5ee1226b..2a4bc4f03f3f0d79ef6bef8299953a058feb76c7 100644 (file)
@@ -43,7 +43,7 @@ if (!defined('__SECURITY')) {
 // Add links for selecting some users
 function alpha ($sortby) {
        $add = '';
-       foreach (array('page','offset','mode','status') as $param) {
+       foreach (array('page','offset','do','status') as $param) {
                if (isGetRequestElementSet($param)) {
                        $add .= '&' . $param . '=' . getRequestElement($param);
                } // END - if
@@ -91,7 +91,7 @@ function addSortLinks ($letter, $sortby) {
        $add = '&page=' . getRequestElement('page') . '&offset=' . getRequestElement('offset');
 
        // Add status/ mode
-       foreach (array('mode','status') as $param) {
+       foreach (array('do','status') as $param) {
                if (isGetRequestElementSet($param)) {
                        $add .= '&' . $param . '=' . getRequestElement($param);
                } // END - if
@@ -152,7 +152,7 @@ function addPageNavigation ($numPages) {
                                $OUT .= '<a href="{%url=modules.php?module=admin&amp;what=' . getWhat();
 
                                // Add status/mode
-                               foreach (array('mode','status') as $param) {
+                               foreach (array('do','status') as $param) {
                                        if (isGetRequestElementSet($param)) {
                                                $OUT .= '&amp;' . $param . '=' . getRequestElement($param);
                                        } // END - if
@@ -223,9 +223,9 @@ LIMIT 1",
        return $email;
 }
 
-// Selects a random user id as the new referal id if they have at least X confirmed mails in this run
+// Selects a random user id as the new referral id if they have at least X confirmed mails in this run
 // @TODO Double-check configuration entry here
-function determineRandomReferalId () {
+function determineRandomReferralId () {
        // Default is zero refid
        $refid = NULL;
 
@@ -245,7 +245,7 @@ function determineRandomReferalId () {
 
                        // Do we have one entry there?
                        if (SQL_NUMROWS($result) == 1) {
-                               // Use that userid as new referal id
+                               // Use that userid as new referral id
                                list($refid) = SQL_FETCHROW($result);
                        } // END - if
 
@@ -334,7 +334,7 @@ function doUserLogin ($userid, $passwd, $successUrl = '', $errorUrl = 'modules.p
                                // Is the timeout reached?
                                if ($probe >= getConfig('login_timeout')) {
                                        // Add login bonus to user's account
-                                       $add = ', `login_bonus`=`login_bonus`+{?login_bonus?}';
+                                       $add = ',`login_bonus`=`login_bonus`+{?login_bonus?}';
                                        $GLOBALS['bonus_payed'] = true;
 
                                        // Subtract login bonus from userid's account or jackpot
@@ -361,10 +361,10 @@ function doUserLogin ($userid, $passwd, $successUrl = '', $errorUrl = 'modules.p
                                                // Procedure to checking for login data
                                                if (($GLOBALS['bonus_payed'] === true) && (isExtensionActive('bonus'))) {
                                                        // Bonus added (just displaying!)
-                                                       $url = 'modules.php?module=chk_login&amp;mode=bonus';
+                                                       $url = 'modules.php?module=chk_login&amp;do=bonus';
                                                } else {
                                                        // Bonus not added
-                                                       $url = 'modules.php?module=chk_login&amp;mode=login';
+                                                       $url = 'modules.php?module=chk_login&amp;do=login';
                                                }
                                        } else {
                                                // Use this URL
@@ -468,8 +468,8 @@ function doNewUserPassword ($email, $userid) {
                        redirectToUrl('modules.php?module=index&amp;what=login&amp;login=' . $errorCode);
                }
        } else {
-               // id or email is wrong
-               displayMessage('<span class="notice">{--GUEST_WRONG_ID_EMAIL--}</span>');
+               // Id or email is wrong
+               displayMessage('<span class="bad">{--GUEST_WRONG_ID_EMAIL--}</span>');
        }
 
        // Return the error code
@@ -601,12 +601,12 @@ LIMIT 1",
                        // And send him right away the confirmation mail
                        sendEmail($userid, '{--GUEST_THANX_CONFIRM--}', $message);
 
-                       // Maybe he got "referaled"?
+                       // Maybe he got "referraled"?
                        if ((isValidUserId($refid)) && ($refid != $userid)) {
-                               // Select the referal userid
+                               // Select the referral userid
                                if (fetchUserData($refid)) {
                                        // Update ref counter...
-                                       updateReferalCounter($refid);
+                                       updateReferralCounter($refid);
 
                                        // If version matches add ref bonus to refid's account
                                        if ((isExtensionInstalledAndNewer('bonus', '0.4.4')) && (isBonusRallyeActive())) {
@@ -618,15 +618,15 @@ LIMIT 1",
                                                handleBonusPoints(getConfig('bonus_ref'), $refid);
                                        } // END - if
 
-                                       // Add one-time referal bonus over referal system or directly
-                                       initReferalSystem();
-                                       addPointsThroughReferalSystem('referal_bonus', $refid, getPointsRef(), bigintval($userid));
+                                       // Add one-time referral bonus over referral system or directly
+                                       initReferralSystem();
+                                       addPointsThroughReferralSystem('referral_bonus', $refid, getPointsRef(), bigintval($userid));
                                } // END - if
                        } // END - if
 
                        if (isExtensionActive('rallye')) {
                                // Add user to rallye (or not?)
-                               addUserToReferalRallye(bigintval($userid));
+                               addUserToReferralRallye(bigintval($userid));
                        } // END - if
 
                        // Account confirmed!
@@ -764,18 +764,36 @@ function doTemplateAdminListUserTitle ($template, $clear = false) {
        // Init title with "all accounts"
        $code = '{--ADMIN_LIST_ALL_ACCOUNTS--}';
 
-       // Do we have a 'status' or 'mode' set?
+       // Do we have a 'status' or 'do' set?
        if (isGetRequestElementSet('status')) {
                // Set title according to the 'status'
                $code = sprintf("{--ADMIN_LIST_STATUS_%s_ACCOUNTS--}", strtoupper(getRequestElement('status')));
-       } elseif (isGetRequestElementSet('mode')) {
-               // Set title according to the "mode"
-               $code = sprintf("{--ADMIN_LIST_MODE_%s_ACCOUNTS--}", strtoupper(getRequestElement('mode')));
+       } elseif (isGetRequestElementSet('do')) {
+               // Set title according to 'do'
+               $code = sprintf("{--ADMIN_LIST_DO_%s_ACCOUNTS--}", strtoupper(getRequestElement('do')));
        }
 
        // Return the code
        return $code;
 }
 
+// Template call-back function for displaying "username"
+function doTemplateDisplayUsername ($template, $clear = false, $userid = NULL) {
+       // Is a userid set?
+       if (!isValidUserId($userid)) {
+               // Please don't call this without a valid userid
+               debug_report_bug(__FUNCTION__, __LINE__, 'template=' . $template . ',clear=' . intval($clear) . ',userid[' . gettype($userid) . ']=' . intval($userid) . ' - Invalid userid provided.');
+       } // END - if
+
+       // Do we have cache?
+       if (!isset($GLOBALS[__FUNCTION__][$userid])) {
+               // Generate code
+               $GLOBALS[__FUNCTION__][$userid] = $userid . ' ({%user,nickname,fixEmptyContentToDashes=' . $userid . '%})';
+       } // END - if
+
+       // Return cache
+       return $GLOBALS[__FUNCTION__][$userid];
+}
+
 // [EOF]
 ?>