More rewrites to make use of (cached) wrapper functions
[mailer.git] / inc / functions.php
index fbfc36201714a216853d3f13295b90e057134500..69d696e544cba7d48983c67135cd89a08c87a952 100644 (file)
@@ -907,7 +907,7 @@ function sendRawRequest ($host, $request) {
        $useProxy = false;
 
        // Are proxy settins set?
-       if ((isConfigEntrySet('proxy_host')) && (getConfig('proxy_host') != '') && (isConfigEntrySet('proxy_port')) && (getConfig('proxy_port') > 0)) {
+       if (isProxyUsed()) {
                // Then use it
                $useProxy = true;
        } // END - if
@@ -1919,13 +1919,13 @@ function determineReferalId () {
        } elseif (isGetRequestParameterSet('ref')) {
                // Set refid=ref (the referal link uses such variable)
                $GLOBALS['refid'] = secureString(getRequestParameter('ref'));
-       } elseif ((isSessionVariableSet('refid')) && (getSession('refid') > 0)) {
+       } elseif ((isSessionVariableSet('refid')) && (isValidUserId(getSession('refid')))) {
                // Set session refid als global
                $GLOBALS['refid'] = bigintval(getSession('refid'));
        } elseif ((isExtensionInstalledAndNewer('user', '0.3.4')) && (isRandomReferalIdEnabled())) {
                // Select a random user which has confirmed enougth mails
                $GLOBALS['refid'] = determineRandomReferalId();
-       } elseif ((isExtensionInstalledAndNewer('sql_patches', '0.1.2')) && (getConfig('def_refid') > 0)) {
+       } elseif ((isExtensionInstalledAndNewer('sql_patches', '0.1.2')) && (isValidUserId(getConfig('def_refid')))) {
                // Set default refid as refid in URL
                $GLOBALS['refid'] = getConfig('def_refid');
        } else {
@@ -1934,7 +1934,7 @@ function determineReferalId () {
        }
 
        // Set cookie when default refid > 0
-       if (!isSessionVariableSet('refid') || (!empty($GLOBALS['refid'])) || ((getSession('refid') == '0') && (isConfigEntrySet('def_refid')) && (getConfig('def_refid') > 0))) {
+       if (!isSessionVariableSet('refid') || (!empty($GLOBALS['refid'])) || ((!isValidUserId(getSession('refid'))) && (isConfigEntrySet('def_refid')) && (isValidUserId(getConfig('def_refid'))))) {
                // Default is not found
                $found = false;