]> git.mxchange.org Git - mailer.git/blobdiff - inc/functions.php
ext-holiday is no self-account-cancelation function
[mailer.git] / inc / functions.php
index ac03d6e5cd7e37a4bc8b0fd1f46ea706e0f4af53..d5a17008139e5d4db190787747aba6cba8a791ea 100644 (file)
@@ -1690,7 +1690,7 @@ function determineReferalId () {
        }
 
        // Set cookie when default refid > 0
-       if (!isSessionVariableSet('refid') || (!isValidUserId(getReferalId())) || ((!isValidUserId(getSession('refid'))) && (isExtensionInstalledAndNewer('sql_patches', '0.1.2')) && (isValidUserId(getDefRefid())))) {
+       if ((!isSessionVariableSet('refid')) || (!isValidUserId(getReferalId())) || ((!isValidUserId(getSession('refid'))) && (isExtensionInstalledAndNewer('sql_patches', '0.1.2')) && (isValidUserId(getDefRefid())))) {
                // Default is not found
                $found = false;
 
@@ -1721,11 +1721,12 @@ function determineReferalId () {
                // Set cookie
                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Saving refid to session (' . getReferalId() . ') #1');
                setSession('refid', getReferalId());
-       } elseif (!isReferalIdValid()) {
+       } elseif ((!isReferalIdValid()) || (!fetchUserData(getReferalId()))) {
                // Not valid!
                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Not valid referal id (' . getReferalId() . '), setting NULL in session');
+               setReferalId(NULL);
                setSession('refid', NULL);
-       } elseif ((!isSessionVariableSet('refid')) && (isValidUserId(getReferalId()))) {
+       } else {
                // Set it from GLOBALS array in session
                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Saving refid to session (' . getReferalId() . ') #2');
                setSession('refid', getReferalId());