]> git.mxchange.org Git - mailer.git/blobdiff - inc/wrapper-functions.php
Opps
[mailer.git] / inc / wrapper-functions.php
index 762538a570dd0680dcf69dc9c4dc51634d29a119..31e30cbefe98f21f223b82595b9e59b4244f8fe7 100644 (file)
@@ -62,25 +62,25 @@ function readFromFile ($FQFN) {
 }
 
 // Writes content to a file
-function writeToFile ($FQFN, $content, $aquireLock = false) {
+function writeToFile ($FQFN, $content, $aquireLock = FALSE) {
        // Is the file writeable?
        if ((isFileReadable($FQFN)) && (!is_writeable($FQFN)) && (!changeMode($FQFN, 0644))) {
                // Not writeable!
                logDebugMessage(__FUNCTION__, __LINE__, sprintf("File %s not writeable.", basename($FQFN)));
 
                // Failed! :(
-               return false;
+               return FALSE;
        } // END - if
 
        // By default all is failed...
-       $GLOBALS['file_readable'][$FQFN] = false;
+       $GLOBALS['file_readable'][$FQFN] = FALSE;
        unset($GLOBALS['file_content'][$FQFN]);
-       $return = false;
+       $return = FALSE;
 
        // Is the function there?
        if (function_exists('file_put_contents')) {
                // With lock?
-               if ($aquireLock === true) {
+               if ($aquireLock === TRUE) {
                        // Write it directly with lock
                        $return = file_put_contents($FQFN, $content, LOCK_EX);
                } else {
@@ -92,7 +92,7 @@ function writeToFile ($FQFN, $content, $aquireLock = false) {
                $fp = fopen($FQFN, 'w') or reportBug(__FUNCTION__, __LINE__, 'Cannot write to file ' . basename($FQFN) . '!');
 
                // Aquire a lock?
-               if ($aquireLock === true) {
+               if ($aquireLock === TRUE) {
                        // Aquire a lock.
                        flock($fp, LOCK_EX);
                } // END - if
@@ -105,16 +105,16 @@ function writeToFile ($FQFN, $content, $aquireLock = false) {
        }
 
        // Was something written?
-       if ($return !== false) {
+       if ($return !== FALSE) {
                // Mark it as readable
-               $GLOBALS['file_readable'][$FQFN] = true;
+               $GLOBALS['file_readable'][$FQFN] = TRUE;
 
                // Remember content in cache
                $GLOBALS['file_content'][$FQFN] = $content;
        } // END - if
 
        // Return status
-       return (($return !== false) && (changeMode($FQFN, 0644)));
+       return (($return !== FALSE) && (changeMode($FQFN, 0644)));
 }
 
 // Clears the output buffer. This function does *NOT* backup sent content.
@@ -132,7 +132,7 @@ function clearOutputBuffer () {
        } // END - if
 
        // Mark this function as called
-       $GLOBALS[__FUNCTION__] = true;
+       $GLOBALS[__FUNCTION__] = TRUE;
 }
 
 // Encode strings
@@ -219,7 +219,7 @@ function detectRealIpAddress () {
 // "Getter" for remote IP number
 function detectRemoteAddr () {
        // Get remote ip from environment
-       $remoteAddr = determineRealRemoteAddress(true);
+       $remoteAddr = determineRealRemoteAddress(TRUE);
 
        // Is removeip installed?
        if (isExtensionActive('removeip')) {
@@ -247,12 +247,12 @@ function detectRemoteHostname () {
 }
 
 // "Getter" for user agent
-function detectUserAgent ($alwaysReal = false) {
+function detectUserAgent ($alwaysReal = FALSE) {
        // Get remote ip from environment
        $userAgent = getenv('HTTP_USER_AGENT');
 
        // Is removeip installed?
-       if ((isExtensionActive('removeip')) && ($alwaysReal === false)) {
+       if ((isExtensionActive('removeip')) && ($alwaysReal === FALSE)) {
                // Then anonymize it
                $userAgent = getAnonymousUserAgent($userAgent);
        } // END - if
@@ -380,13 +380,13 @@ function isAdminRegistered () {
 // Checks whether the hourly reset mode is active
 function isHourlyResetEnabled () {
        // Now simply check it
-       return ((isset($GLOBALS['hourly_enabled'])) && ($GLOBALS['hourly_enabled'] === true));
+       return ((isset($GLOBALS['hourly_enabled'])) && ($GLOBALS['hourly_enabled'] === TRUE));
 }
 
 // Checks whether the reset mode is active
 function isResetModeEnabled () {
        // Now simply check it
-       return ((isset($GLOBALS['reset_enabled'])) && ($GLOBALS['reset_enabled'] === true));
+       return ((isset($GLOBALS['reset_enabled'])) && ($GLOBALS['reset_enabled'] === TRUE));
 }
 
 // Checks whether the debug mode is enabled
@@ -454,7 +454,7 @@ function isCacheInstanceValid () {
 // even if there is no xdebug extension installed.
 function copyFileVerified ($source, $dest, $chmod = '') {
        // Failed is the default
-       $status = false;
+       $status = FALSE;
 
        // Is the source file there?
        if (!isFileReadable($source)) {
@@ -474,11 +474,11 @@ function copyFileVerified ($source, $dest, $chmod = '') {
                reportBug(__FUNCTION__, __LINE__, 'copy() has failed to copy the file.');
        } else {
                // Reset cache
-               $GLOBALS['file_readable'][$dest] = true;
+               $GLOBALS['file_readable'][$dest] = TRUE;
        }
 
        // All fine by default
-       $status = true;
+       $status = TRUE;
 
        // If there are chmod rights set, apply them
        if (!empty($chmod)) {
@@ -508,7 +508,7 @@ function removeFile ($FQFN) {
        // Is the file there?
        if (isFileReadable($FQFN)) {
                // Reset cache first
-               $GLOBALS['file_readable'][$FQFN] = false;
+               $GLOBALS['file_readable'][$FQFN] = FALSE;
 
                // Yes, so remove it
                return unlink($FQFN);
@@ -516,7 +516,7 @@ function removeFile ($FQFN) {
 
        // All fine if no file was removed. If we change this to 'false' or rewrite
        // above if() block it would be to restrictive.
-       return true;
+       return TRUE;
 }
 
 // Wrapper for $_POST['sel']
@@ -539,7 +539,7 @@ function countPostSelection ($element = 'sel') {
 
 // Checks whether the config-local.php is loaded
 function isConfigLocalLoaded () {
-       return ((isset($GLOBALS['config_local_loaded'])) && ($GLOBALS['config_local_loaded'] === true));
+       return ((isset($GLOBALS['config_local_loaded'])) && ($GLOBALS['config_local_loaded'] === TRUE));
 }
 
 // Checks whether a nickname or userid was entered and caches the result
@@ -547,7 +547,7 @@ function isNicknameUsed ($userid) {
        // Is the cache there
        if (!isset($GLOBALS[__FUNCTION__][$userid])) {
                // Determine it
-               $GLOBALS[__FUNCTION__][$userid] = ((!empty($userid)) && (('' . bigintval($userid, true, false) . '') != $userid) && ($userid != 'NULL'));
+               $GLOBALS[__FUNCTION__][$userid] = ((!empty($userid)) && (('' . bigintval($userid, TRUE, FALSE) . '') != $userid) && ($userid != 'NULL'));
        } // END - if
 
        // Return the result
@@ -555,7 +555,7 @@ function isNicknameUsed ($userid) {
 }
 
 // Getter for 'what' value
-function getWhat ($strict = true) {
+function getWhat ($strict = TRUE) {
        // Default is null
        $what = NULL;
 
@@ -590,7 +590,7 @@ function isWhatSet ($strict =  false) {
        $isset = (isset($GLOBALS['__what']) && (!empty($GLOBALS['__what'])));
 
        // Should we abort here?
-       if (($strict === true) && ($isset === false)) {
+       if (($strict === TRUE) && ($isset === FALSE)) {
                // Output backtrace
                debug_report_bug(__FUNCTION__, __LINE__, 'what is empty.');
        } // END - if
@@ -600,7 +600,7 @@ function isWhatSet ($strict =  false) {
 }
 
 // Getter for 'action' value
-function getAction ($strict = true) {
+function getAction ($strict = TRUE) {
        // Default is null
        $action = NULL;
 
@@ -625,7 +625,7 @@ function isActionSet ($strict =  false) {
        $isset = ((isset($GLOBALS['__action'])) && (!empty($GLOBALS['__action'])));
 
        // Should we abort here?
-       if (($strict === true) && ($isset === false)) {
+       if (($strict === TRUE) && ($isset === FALSE)) {
                // Output backtrace
                reportBug(__FUNCTION__, __LINE__, 'action is empty.');
        } // END - if
@@ -635,7 +635,7 @@ function isActionSet ($strict =  false) {
 }
 
 // Getter for 'module' value
-function getModule ($strict = true) {
+function getModule ($strict = TRUE) {
        // Default is null
        $module = NULL;
 
@@ -661,13 +661,13 @@ function isModuleSet ($strict =  false) {
        $isset = ((isset($GLOBALS['__module'])) && (!empty($GLOBALS['__module'])));
 
        // Should we abort here?
-       if (($strict === true) && ($isset === false)) {
+       if (($strict === TRUE) && ($isset === FALSE)) {
                // Output backtrace
                reportBug(__FUNCTION__, __LINE__, 'Module is empty.');
        } // END - if
 
        // Return it
-       return (($isset === true) && ($GLOBALS['__module'] != 'unknown')) ;
+       return (($isset === TRUE) && ($GLOBALS['__module'] != 'unknown')) ;
 }
 
 // Getter for 'output_mode' value
@@ -700,7 +700,7 @@ function isOutputModeSet ($strict =  false) {
        $isset = (isset($GLOBALS['__output_mode']));
 
        // Should we abort here?
-       if (($strict === true) && ($isset === false)) {
+       if (($strict === TRUE) && ($isset === FALSE)) {
                // Output backtrace
                reportBug(__FUNCTION__, __LINE__, 'Output mode is not set.');
        } // END - if
@@ -710,7 +710,7 @@ function isOutputModeSet ($strict =  false) {
 }
 
 // Enables block-mode
-function enableBlockMode ($enabled = true) {
+function enableBlockMode ($enabled = TRUE) {
        $GLOBALS['__block_mode'] = $enabled;
 }
 
@@ -746,7 +746,7 @@ function redirectToRequestUri () {
 // Wrapper function to redirect to de-refered URL
 function redirectToDereferedUrl ($url) {
        // Redirect to to
-       redirectToUrl(generateDerefererUrl($url));
+       redirectToUrl(generateDereferrerUrl($url));
 }
 
 // Wrapper function for checking if extension is installed and newer or same version
@@ -982,7 +982,7 @@ function isUserDataValid () {
                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'isCurrentUserIdSet()=false - ABORTING!');
 
                // Abort here
-               return false;
+               return FALSE;
        } // END - if
 
        // Is it cached?
@@ -1097,8 +1097,8 @@ function getFetchedUserData ($keyColumn, $userid, $valueColumn) {
 
 // Wrapper for strpos() to ease porting from deprecated ereg() function
 function isInString ($needle, $haystack) {
-       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'needle=' . $needle . ', haystack=' . $haystack . ', returned=' . intval(strpos($haystack, $needle) !== false));
-       return (strpos($haystack, $needle) !== false);
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'needle=' . $needle . ', haystack=' . $haystack . ', returned=' . intval(strpos($haystack, $needle) !== FALSE));
+       return (strpos($haystack, $needle) !== FALSE);
 }
 
 // Wrapper for strpos() to ease porting from deprecated eregi() function
@@ -1215,7 +1215,7 @@ function getTotalConfirmedUser () {
        if (!isset($GLOBALS[__FUNCTION__])) {
                // Then do it
                if (isExtensionActive('user')) {
-                       $GLOBALS[__FUNCTION__] = countSumTotalData('CONFIRMED', 'user_data', 'userid', 'status', true, runFilterChain('user_exclusion_sql', ' '));
+                       $GLOBALS[__FUNCTION__] = countSumTotalData('CONFIRMED', 'user_data', 'userid', 'status', TRUE, runFilterChain('user_exclusion_sql', ' '));
                } else {
                        $GLOBALS[__FUNCTION__] = 0;
                }
@@ -1231,7 +1231,7 @@ function getTotalUnconfirmedUser () {
        if (!isset($GLOBALS[__FUNCTION__])) {
                // Then do it
                if (isExtensionActive('user')) {
-                       $GLOBALS[__FUNCTION__] = countSumTotalData('UNCONFIRMED', 'user_data', 'userid', 'status', true, runFilterChain('user_exclusion_sql', ' '));
+                       $GLOBALS[__FUNCTION__] = countSumTotalData('UNCONFIRMED', 'user_data', 'userid', 'status', TRUE, runFilterChain('user_exclusion_sql', ' '));
                } else {
                        $GLOBALS[__FUNCTION__] = 0;
                }
@@ -1247,7 +1247,7 @@ function getTotalLockedUser () {
        if (!isset($GLOBALS[__FUNCTION__])) {
                // Then do it
                if (isExtensionActive('user')) {
-                       $GLOBALS[__FUNCTION__] = countSumTotalData('LOCKED', 'user_data', 'userid', 'status', true, runFilterChain('user_exclusion_sql', ' '));
+                       $GLOBALS[__FUNCTION__] = countSumTotalData('LOCKED', 'user_data', 'userid', 'status', TRUE, runFilterChain('user_exclusion_sql', ' '));
                } else {
                        $GLOBALS[__FUNCTION__] = 0;
                }
@@ -1263,7 +1263,7 @@ function getTotalRandomRefidUser () {
        if (!isset($GLOBALS[__FUNCTION__])) {
                // Then do it
                if (isExtensionInstalledAndNewer('user', '0.3.4')) {
-                       $GLOBALS[__FUNCTION__] = countSumTotalData('{?user_min_confirmed?}', 'user_data', 'userid', 'rand_confirmed', true, runFilterChain('user_exclusion_sql', ' '), '>=');
+                       $GLOBALS[__FUNCTION__] = countSumTotalData('{?user_min_confirmed?}', 'user_data', 'userid', 'rand_confirmed', TRUE, runFilterChain('user_exclusion_sql', ' '), '>=');
                } else {
                        $GLOBALS[__FUNCTION__] = 0;
                }
@@ -1292,7 +1292,7 @@ function isValidUserId ($userid) {
 // Encodes entities
 function encodeEntities ($str) {
        // Secure it first
-       $str = secureString($str, true, true);
+       $str = secureString($str, TRUE, TRUE);
 
        // Encode dollar sign as well
        $str = str_replace('$', '$', $str);
@@ -2899,7 +2899,7 @@ function generateYesNoOptions ($defaultValue = '') {
 // "Getter" for total available receivers
 function getTotalReceivers ($mode = 'normal') {
        // Get num rows
-       $numRows = countSumTotalData('CONFIRMED', 'user_data', 'userid', 'status', true, runFilterChain('user_exclusion_sql', ' AND `receive_mails` > 0' . runFilterChain('exclude_users', $mode)));
+       $numRows = countSumTotalData('CONFIRMED', 'user_data', 'userid', 'status', TRUE, runFilterChain('user_exclusion_sql', ' AND `receive_mails` > 0' . runFilterChain('exclude_users', $mode)));
 
        // Return value
        return $numRows;
@@ -2910,7 +2910,7 @@ function getTotalUnconfirmedMails ($userid) {
        // Is there cache?
        if (!isset($GLOBALS[__FUNCTION__][$userid])) {
                // Determine it
-               $GLOBALS[__FUNCTION__][$userid] = countSumTotalData($userid, 'user_links', 'id', 'userid', true);
+               $GLOBALS[__FUNCTION__][$userid] = countSumTotalData($userid, 'user_links', 'id', 'userid', TRUE);
        } // END - if
 
        // Return cache
@@ -3017,7 +3017,7 @@ function isFullPage () {
 // Checks whether frameset_mode is set to true
 function isFramesetModeEnabled () {
        // Check it
-       return ((isset($GLOBALS['frameset_mode'])) && ($GLOBALS['frameset_mode'] === true));
+       return ((isset($GLOBALS['frameset_mode'])) && ($GLOBALS['frameset_mode'] === TRUE));
 }
 
 // Function to determine correct 'what' value
@@ -3067,7 +3067,7 @@ function prependZeros ($mStretch, $length = 2) {
 function convertSelectionsToEpocheTimeInPostData ($id) {
        // Init variables
        $content = array();
-       $skip = false;
+       $skip = FALSE;
 
        // Get all POST data
        $postData = postRequestArray();
@@ -3082,7 +3082,7 @@ function convertSelectionsToEpocheTimeInPostData ($id) {
 // Wraps checking if given points account type matches with given in POST data
 function ifPointsAccountTypeMatchesPost ($type) {
        // Check condition
-       exit(__FUNCTION__.':type='.$type.',post=<pre>'.print_r(postRequestArray(), true).'</pre>');
+       exit(__FUNCTION__.':type='.$type.',post=<pre>'.print_r(postRequestArray(), TRUE).'</pre>');
 }
 
 // Gets given user's total referral
@@ -3092,10 +3092,10 @@ function getUsersTotalReferrals ($userid, $level = NULL) {
                // Is the level NULL?
                if (is_null($level)) {
                        // Get total amount (all levels)
-                       $GLOBALS[__FUNCTION__][$userid][$level] = countSumTotalData($userid, 'user_refs', 'refid', 'userid', true);
+                       $GLOBALS[__FUNCTION__][$userid][$level] = countSumTotalData($userid, 'user_refs', 'refid', 'userid', TRUE);
                } else {
                        // Get it from user refs
-                       $GLOBALS[__FUNCTION__][$userid][$level] = countSumTotalData($userid, 'user_refs', 'refid', 'userid', true, ' AND `level`=' . bigintval($level));
+                       $GLOBALS[__FUNCTION__][$userid][$level] = countSumTotalData($userid, 'user_refs', 'refid', 'userid', TRUE, ' AND `level`=' . bigintval($level));
                }
        } // END - if