Code style changed, ext-user continued:
[mailer.git] / inc / referral-functions.php
index fc628b3daa59f2579be6486046aaefaad9960be4..26700a53061e710b70659489379f8742bb51b0d5 100644 (file)
@@ -44,7 +44,7 @@ if (!defined('__SECURITY')) {
 function initReferralSystem () {
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, ' Referral system initialized!');
        $GLOBALS['ref_level']  = NULL;
-       $GLOBALS['ref_system'] = true;
+       $GLOBALS['ref_system'] = TRUE;
 }
 
 // Getter fro ref level percents
@@ -56,7 +56,7 @@ function getReferralLevelPercents ($level) {
        if ((isset($GLOBALS['cache_array']['refdepths']['level'])) && (isExtensionActive('cache'))) {
                // First look for level
                $key = array_search($level, $GLOBALS['cache_array']['refdepths']['level']);
-               if ($key !== false) {
+               if ($key !== FALSE) {
                        // Entry found
                        $data['percents'] = $GLOBALS['cache_array']['refdepths']['percents'][$key];
 
@@ -93,7 +93,7 @@ function getReferralLevelPercents ($level) {
 function addPointsThroughReferralSystem ($subject, $userid, $points, $refid = NULL) {
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'subject=' . $subject . ',userid=' . $userid . ',points=' . $points . ',refid=' . convertNullToZero($refid) . ' - ENTERED!');
        // By default nothing has been added
-       $added = false;
+       $added = FALSE;
 
        // Determine payment method and notification
        $paymentMethod = strtoupper(getPaymentMethodFromSubject($subject));
@@ -200,7 +200,7 @@ function addPointsThroughReferralSystem ($subject, $userid, $points, $refid = NU
                        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'subject=' . $subject . ',userid=' . $userid . ',refid=' . $refid . ',paymentMethod=' . $paymentMethod . ',sendNotify=' . intval($sendNotify) . ',isLocked=' . intval($isLocked));
 
                        // Send "referral confirmed" mails out?
-                       if ((isValidUserid($refid)) && ($refid != $userid) && ($sendNotify === true)) {
+                       if ((isValidUserid($refid)) && ($refid != $userid) && ($sendNotify === TRUE)) {
                                // Calculate the referral's points and percents
                                $percentsReferral = getReferralLevelPercents($GLOBALS['ref_level'] + 1);
 
@@ -226,7 +226,7 @@ function addPointsThroughReferralSystem ($subject, $userid, $points, $refid = NU
                        } // END - if
 
                        // Points updated, maybe I shall send him an email?
-                       if (($sendNotify === true) && ($isLocked === false)) {
+                       if (($sendNotify === TRUE) && ($isLocked === FALSE)) {
                                // "Explode" subject
                                $subjectArray = explode(':', $subject);
                                $subjectUserid = (isset($subjectArray[1])) ? $subjectArray[1] : '0';
@@ -518,7 +518,7 @@ function getPointsColumnNameFromSubjectLocked ($subject, $isLocked) {
        $columnName = $pointsData['column_name'];
 
        // Are the points locked?
-       if (($isLocked === true) && ($pointsData['locked_mode'] == 'LOCKED')) {
+       if (($isLocked === TRUE) && ($pointsData['locked_mode'] == 'LOCKED')) {
                // Locked points, so prefix it
                $columnName = 'locked_' . $pointsData['column_name'];
        } // END - if
@@ -666,7 +666,7 @@ function addMissingReferralLevels ($userid) {
                        } // END - foreach
                } // END - foreach
        } // END - foreach
-       //die('<pre>'.print_r($GLOBALS['referral_refid'][$userid],true).'</pre>');
+       //die('<pre>'.print_r($GLOBALS['referral_refid'][$userid],TRUE).'</pre>');
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ' - EXIT!');
 }
 
@@ -689,7 +689,7 @@ function flushReferralTableToDatabase ($userid) {
 
        // Prepare SQL
        $SQL = 'INSERT INTO `{?_MYSQL_PREFIX?}_user_refs` (`userid`, `level`, `refid`) VALUES ';
-       $executeSql = false;
+       $executeSql = FALSE;
 
        // Now walk through the array, first levels
        foreach ($GLOBALS['referral_refid'][$userid] as $level => $levelArray) {
@@ -711,7 +711,7 @@ function flushReferralTableToDatabase ($userid) {
                                $SQL .= '(' . $userid . ',' . $level . ',' . $refid . '),';
 
                                // Some has been added, so execute the query
-                               $executeSql = true;
+                               $executeSql = TRUE;
                        } // END - if
                } // END - foreach
        } // END - foreach
@@ -721,7 +721,7 @@ function flushReferralTableToDatabase ($userid) {
 
        // And run it
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',SQL=' . $SQL);
-       if ($executeSql === true) {
+       if ($executeSql === TRUE) {
                SQL_QUERY($SQL, __FUNCTION__, __LINE__);
        } // END - if
 
@@ -820,7 +820,7 @@ function determineReferralId () {
                return getReferralId();
        } elseif ((!isHtmlOutputMode()) && (basename($_SERVER['PHP_SELF']) != 'ref.php')) {
                // Skip this in non-html-mode and outside ref.php
-               return false;
+               return FALSE;
        }
 
        // Check if refid is set
@@ -864,7 +864,7 @@ function determineReferralId () {
        // Set cookie when default refid > 0
        if ((!isSessionVariableSet('refid')) || (!isValidUserId(getReferralId())) || ((!isValidUserId(getSession('refid'))) && (isExtensionInstalledAndNewer('sql_patches', '0.1.2')) && (isValidUserId(getDefRefid())))) {
                // Default is not found
-               $found = false;
+               $found = FALSE;
 
                // Is there nickname or userid set?
                if ((isExtensionActive('nickname')) && (isNicknameUsed(getReferralId()))) {
@@ -872,7 +872,7 @@ function determineReferralId () {
                        $found = fetchUserData(getReferralId(), 'nickname');
 
                        // If we found it, use the userid as referral id
-                       if ($found === true) {
+                       if ($found === TRUE) {
                                // Set the userid as 'refid'
                                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Using refid from user account by nickname (' . getUserData('userid') . ')');
                                setReferralId(getUserData('userid'));
@@ -884,7 +884,7 @@ function determineReferralId () {
                }
 
                // Is the record valid?
-               if ((($found === false) || (!isUserDataValid())) && (isExtensionInstalledAndNewer('sql_patches', '0.1.2'))) {
+               if ((($found === FALSE) || (!isUserDataValid())) && (isExtensionInstalledAndNewer('sql_patches', '0.1.2'))) {
                        // No, then reset referral id
                        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Using default refid (' . getDefRefid() . ')');
                        setReferralId(getDefRefid());