X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Flibs%2Fuser_functions.php;h=1241a8748bd1f4264365ed40c29be449ec00512d;hb=b4042713447d2eb3777a49f24523511dbba8970f;hp=527ed293e163d9735f3ba385e726aa49aaee9188;hpb=2379934be6a196a54f4155bb8e24c49b20736969;p=mailer.git diff --git a/inc/libs/user_functions.php b/inc/libs/user_functions.php index 527ed293e1..1241a8748b 100644 --- a/inc/libs/user_functions.php +++ b/inc/libs/user_functions.php @@ -17,7 +17,7 @@ * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * * Copyright (c) 2009 - 2011 by Mailer Developer Team * - * For more information visit: http://www.mxchange.org * + * For more information visit: http://mxchange.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -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 @@ -468,8 +468,8 @@ function doNewUserPassword ($email, $userid) { redirectToUrl('modules.php?module=index&what=login&login=' . $errorCode); } } else { - // id or email is wrong - displayMessage('{--GUEST_WRONG_ID_EMAIL--}'); + // Id or email is wrong + displayMessage('{--GUEST_WRONG_ID_EMAIL--}'); } // 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! @@ -777,5 +777,23 @@ function doTemplateAdminListUserTitle ($template, $clear = false) { 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] ?>