// Check wether we are installing
function isInstalling () {
// Determine wether we are installing
- if (!isset($GLOBALS['mxchange_installing'])) {
+ if (!isset($GLOBALS['mailer_installing'])) {
// Check URL (css.php/js.php need this)
- $GLOBALS['mxchange_installing'] = isGetRequestParameterSet('installing');
+ $GLOBALS['mailer_installing'] = isGetRequestParameterSet('installing');
} // END - if
// Return result
- return $GLOBALS['mxchange_installing'];
+ return $GLOBALS['mailer_installing'];
}
// Check wether this script is installed
// Check wether an admin is registered
function isAdminRegistered () {
- return ((isConfigEntrySet('ADMIN_REGISTERED')) && (getConfig('ADMIN_REGISTERED') == 'Y'));
+ // Is cache set?
+ if (!isset($GLOBALS['is_admin_registered'])) {
+ // Simply check it
+ $GLOBALS['is_admin_registered'] = ((isConfigEntrySet('ADMIN_REGISTERED')) && (getConfig('ADMIN_REGISTERED') == 'Y'));
+ } // END - if
+
+ // Return it
+ return $GLOBALS['is_admin_registered'];
}
// Checks wether the reset mode is active
// Checks wether the debug mode is enabled
function isDebugModeEnabled () {
- // Simply check it
- return ((isConfigEntrySet('DEBUG_MODE')) && (getConfig('DEBUG_MODE') == 'Y'));
+ // Is cache set?
+ if (!isset($GLOBALS['is_debugmode_enabled'])) {
+ // Simply check it
+ $GLOBALS['is_debugmode_enabled'] = ((isConfigEntrySet('DEBUG_MODE')) && (getConfig('DEBUG_MODE') == 'Y'));
+ } // END - if
+
+ // Return it
+ return $GLOBALS['is_debugmode_enabled'];
}
// Checks wether SQL debugging is enabled
function isSqlDebuggingEnabled () {
- return ((isConfigEntrySet('DEBUG_SQL')) && (getConfig('DEBUG_SQL') == 'Y'));
+ // Is cache set?
+ if (!isset($GLOBALS['is_sql_debug_enabled'])) {
+ // Determine if SQL debugging is enabled
+ $GLOBALS['is_sql_debug_enabled'] = ((isConfigEntrySet('DEBUG_SQL')) && (getConfig('DEBUG_SQL') == 'Y'));
+ } // END - if
+
+ // Return it
+ return $GLOBALS['is_sql_debug_enabled'];
}
// Checks wether we shall debug regular expressions
-function isDebugRegExpressionEnabled () {
- // Simply check it
- return ((isConfigEntrySet('DEBUG_REGEX')) && (getConfig('DEBUG_REGEX') == 'Y'));
+function isDebugRegularExpressionEnabled () {
+ // Is cache set?
+ if (!isset($GLOBALS['is_regular_exp_debug_enabled'])) {
+ // Simply check it
+ $GLOBALS['is_regular_exp_debug_enabled'] = ((isConfigEntrySet('DEBUG_REGEX')) && (getConfig('DEBUG_REGEX') == 'Y'));
+ } // END - if
+
+ // Return it
+ return $GLOBALS['is_regular_exp_debug_enabled'];
}
// Checks wether the cache instance is valid
}
// Getter for 'action' value
-function getAction () {
+function getAction ($strict = true) {
// Default is null
$action = null;
// Is the value set?
- if (isActionSet(true)) {
+ if (isActionSet(($strict) && (getOutputMode() == 0))) {
// Then use it
$action = $GLOBALS['action'];
} // END - if
// Wrapper function for checking if extension is installed and newer or same version
function isExtensionInstalledAndNewer ($ext_name, $version) {
+ // Is an cache entry found?
+ if (!isset($GLOBALS['ext_installed_newer'][$ext_name][$version])) {
+ $GLOBALS['ext_installed_newer'][$ext_name][$version] = ((isExtensionInstalled($ext_name)) && (getExtensionVersion($ext_name) >= $version));
+ } else {
+ // Cache hits should be incremented twice
+ incrementStatsEntry('cache_hits', 2);
+ }
+
// Return it
- //* DEBUG: */ print __FUNCTION__.':'.$ext_name.'=>'.$version.'<br />';
- return ((isExtensionInstalled($ext_name)) && (getExtensionVersion($ext_name) >= $version));
+ //* DEBUG: */ print __FUNCTION__.':'.$ext_name.'=>'.$version.':'.intval($GLOBALS['ext_installed_newer'][$ext_name][$version]).'<br />';
+ return $GLOBALS['ext_installed_newer'][$ext_name][$version];
}
// Wrapper function for checking if extension is installed and older than given version
function isExtensionInstalledAndOlder ($ext_name, $version) {
+ // Is an cache entry found?
+ if (!isset($GLOBALS['ext_installed_older'][$ext_name][$version])) {
+ $GLOBALS['ext_installed_older'][$ext_name][$version] = ((isExtensionInstalled($ext_name)) && (isExtensionOlder($ext_name, $version)));
+ } else {
+ // Cache hits should be incremented twice
+ incrementStatsEntry('cache_hits', 2);
+ }
+
// Return it
- //* DEBUG: */ print __FUNCTION__.':'.$ext_name.'<'.$version.'<br />';
- return ((isExtensionInstalled($ext_name)) && (isExtensionOlder($ext_name, $version)));
+ //* DEBUG: */ print __FUNCTION__.':'.$ext_name.'<'.$version.':'.intval($GLOBALS['ext_installed_older'][$ext_name][$version]).'<br />';
+ return $GLOBALS['ext_installed_older'][$ext_name][$version];
}
// Set username
// Get username
function getUsername () {
- // default is guest
- $username = getMessage('USERNAME_GUEST');
-
// User name set?
- if (isset($GLOBALS['username'])) {
- // Use the set name
- $username = $GLOBALS['username'];
+ if (!isset($GLOBALS['username'])) {
+ // No, so it has to be a guest
+ $GLOBALS['username'] = getMessage('USERNAME_GUEST');
} // END - if
// Return it
- return $username;
+ return $GLOBALS['username'];
}
// Wrapper function for installation phase
// Checks wether the extension demo is actuve and the admin login is demo (password needs to be demo, too!)
function isDemoModeActive () {
- return ((isExtensionActive('demo')) && (getSession('admin_login') == 'demo'));
+ // Is cache set?
+ if (!isset($GLOBALS['demo_mode_active'])) {
+ // Simply check it
+ $GLOBALS['demo_mode_active'] = ((isExtensionActive('demo')) && (getSession('admin_login') == 'demo'));
+ } // END - if
+
+ // Return it
+ return $GLOBALS['demo_mode_active'];
}
// Getter for PHP caching value
// User id should not be zero so abort here
if (!isCurrentUserIdSet()) return false;
- // Is the array there and filled?
- return ((isset($GLOBALS['user_data'][getCurrentUserId()])) && (count($GLOBALS['user_data'][getCurrentUserId()]) > 1));
+ // Is it cached?
+ if (!isset($GLOBALS['is_userdata_valid'][getCurrentUserId()])) {
+ // Determine it
+ $GLOBALS['is_userdata_valid'][getCurrentUserId()] = ((isset($GLOBALS['user_data'][getCurrentUserId()])) && (count($GLOBALS['user_data'][getCurrentUserId()]) > 1));
+ } // END - if
+
+ // Return the result
+ return $GLOBALS['is_userdata_valid'][getCurrentUserId()];
}
// Setter for current userid
function setCurrentUserId ($userid) {
+ // Set userid
$GLOBALS['current_userid'] = bigintval($userid);
+
+ // Unset it to re-determine the actual state
+ unset($GLOBALS['is_userdata_valid'][$userid]);
}
// Getter for current userid
// Checks if current userid is set
function isCurrentUserIdSet () {
- return isset($GLOBALS['current_userid']);
+ return ((isset($GLOBALS['current_userid'])) && ($GLOBALS['current_userid'] > 0));
}
// Checks wether we are debugging template cache
}
// Wrapper for fetchUserData() and getUserData() calls
-function getFetchedUserData ($keyColumn, $userId, $valueColumn) {
- // Default is 'guest'
- $data = getMessage('USERNAME_GUEST');
-
- // Can we fetch the user data?
- if (($userId > 0) && (fetchUserData($userId, $keyColumn))) {
- // Now get the data back
- $data = getUserData($valueColumn);
+function getFetchedUserData ($keyColumn, $userid, $valueColumn) {
+ // Is it cached?
+ if (!isset($GLOBALS['user_data_cache'][$userid][$keyColumn][$valueColumn])) {
+ // Default is 'guest'
+ $data = getMessage('USERNAME_GUEST');
+
+ // Can we fetch the user data?
+ if (($userid > 0) && (fetchUserData($userid, $keyColumn))) {
+ // Now get the data back
+ $data = getUserData($valueColumn);
+ } // END - if
+
+ // Cache it
+ $GLOBALS['user_data_cache'][$userid][$keyColumn][$valueColumn] = $data;
} // END - if
// Return it
- return $data;
+ return $GLOBALS['user_data_cache'][$userid][$keyColumn][$valueColumn];
}
// Wrapper for strpos() to ease porting from deprecated ereg() function