Renamed ifSqlHasZeroNums() to ifSqlHasZeroNumRows() and improved some queries.
[mailer.git] / inc / referral-functions.php
index 4a9832a681b4f64bb63e633eaebf679619ad1e3c..788e40cfa80bbabba4de8349a181f7d283f4f8a5 100644 (file)
@@ -414,7 +414,7 @@ ORDER BY
                ), __FUNCTION__, __LINE__);
 
        // Are there some entries?
-       if (!ifSqlHasZeroNums($result)) {
+       if (!ifSqlHasZeroNumRows($result)) {
                // Fetch all entries
                while ($row = sqlFetchArray($result)) {
                        // Init click rate with zero
@@ -817,7 +817,7 @@ function determineReferralId () {
        if (isValidReferralId()) {
                // Do not determine it, just return it
                return getReferralId();
-       } elseif ((!isHtmlOutputMode()) && (basename($_SERVER['PHP_SELF']) != 'ref.php')) {
+       } elseif ((!isHtmlOutputMode()) && (getModule() != 'ref')) {
                // Skip this in non-html-mode and outside ref.php
                return FALSE;
        }
@@ -838,7 +838,7 @@ function determineReferralId () {
                // Set refid=ref (the referral link uses such variable)
                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Using ref from GET data (' . getRequestElement('ref') . ')');
                setReferralId(getRequestElement('ref'));
-       } elseif ((isGetRequestElementSet('user')) && (basename($_SERVER['PHP_SELF']) == 'click.php')) {
+       } elseif ((isGetRequestElementSet('user')) && (getModule() == 'click')) {
                // The variable user comes from  click.php
                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Using user from GET data (' . getRequestElement('user') . ')');
                setReferralId(bigintval(getRequestElement('user')));