]> git.mxchange.org Git - mailer.git/blobdiff - inc/wrapper-functions.php
More rewrites to make use of (cached) wrapper functions
[mailer.git] / inc / wrapper-functions.php
index 2a64684ed44874018d4272f62782baee48a25d5e..6af2c038bd453976b151379c6307dee53c0c22fc 100644 (file)
@@ -499,23 +499,14 @@ function isConfigLocalLoaded () {
 
 // Checks wether a nickname or userid was entered and caches the result
 function isNicknameUsed ($userid) {
-       // Default is false
-       $isUsed = false;
-
        // Is the cache there
-       if (isset($GLOBALS['is_nickname_used'][$userid])) {
-               // Then use it
-               $isUsed = $GLOBALS['is_nickname_used'][$userid];
-       } else {
+       if (!isset($GLOBALS['is_nickname_used'][$userid])) {
                // Determine it
-               $isUsed = (('' . round($userid) . '') != $userid);
-
-               // And write it to the cache
-               $GLOBALS['is_nickname_used'][$userid] = $isUsed;
-       }
+               $GLOBALS['is_nickname_used'][$userid] = (('' . round($userid) . '') != $userid);
+       } // END - if
 
        // Return the result
-       return $isUsed;
+       return $GLOBALS['is_nickname_used'][$userid];
 }
 
 // Getter for 'what' value
@@ -568,7 +559,7 @@ function getAction ($strict = true) {
        $action = null;
 
        // Is the value set?
-       if (isActionSet(($strict) && (getOutputMode() == 0))) {
+       if (isActionSet(($strict) && (getScriptOutputMode() == 0))) {
                // Then use it
                $action = $GLOBALS['action'];
        } // END - if
@@ -634,7 +625,7 @@ function isModuleSet ($strict =  false) {
 }
 
 // Getter for 'output_mode' value
-function getOutputMode () {
+function getScriptOutputMode () {
        // Default is null
        $output_mode = null;
 
@@ -885,7 +876,7 @@ function getCurrentUserId () {
 
 // Checks if current userid is set
 function isCurrentUserIdSet () {
-       return ((isset($GLOBALS['current_userid'])) && ($GLOBALS['current_userid'] > 0));
+       return ((isset($GLOBALS['current_userid'])) && (isValidUserId($GLOBALS['current_userid'])));
 }
 
 // Checks wether we are debugging template cache
@@ -908,7 +899,7 @@ function getFetchedUserData ($keyColumn, $userid, $valueColumn) {
                $data = '{--USERNAME_GUEST--}';
 
                // Can we fetch the user data?
-               if (($userid > 0) && (fetchUserData($userid, $keyColumn))) {
+               if ((isValidUserId($userid)) && (fetchUserData($userid, $keyColumn))) {
                        // Now get the data back
                        $data = getUserData($valueColumn);
                } // END - if
@@ -1416,7 +1407,7 @@ function getSaltLength () {
 }
 
 // "Getter" for output_mode
-function getCachedOutputMode () {
+function getOutputMode () {
        // Do we have cache?
        if (!isset($GLOBALS['cached_output_mode'])) {
                // Determine it
@@ -1535,5 +1526,29 @@ function getApInactiveSince () {
        return $GLOBALS['ap_inactive_since'];
 }
 
+// Checks wether proxy configuration is used
+function isProxyUsed () {
+       // Do we have cache?
+       if (!isset($GLOBALS['is_proxy_used'])) {
+               // Determine it
+               $GLOBALS['is_proxy_used'] = ((getExtensionVersion('sql_patches') >= '0.4.3') && (getConfig('proxy_host') != '') && (getConfig('proxy_port') > 0));
+       } // END - if
+
+       // Return cache
+       return $GLOBALS['is_proxy_used'];
+}
+
+// Checks wether POST data contains selections
+function ifPostContainsSelections ($element = 'sel') {
+       // Do we have cache?
+       if (!isset($GLOBALS['post_contains_selections'][$element])) {
+               // Determine it
+               $GLOBALS['post_contains_selections'][$element] = (countPostSelection($element) > 0);
+       } // END - if
+
+       // Return cache
+       return $GLOBALS['post_contains_selections'][$element];
+}
+
 // [EOF]
 ?>