0) && (!ob_end_clean())) { // Failed! reportBug(__FUNCTION__, __LINE__, 'Failed to clean output buffer.'); } // END - if // Mark this function as called $GLOBALS[__FUNCTION__] = TRUE; } // Encode strings function encodeString ($str) { $str = urlencode(base64_encode(compileUriCode($str))); return $str; } // Decode strings encoded with encodeString() function decodeString ($str) { $str = compileUriCode(base64_decode(urldecode(compileUriCode($str)))); return $str; } // Decode entities in a nicer way function decodeEntities ($str, $quote = ENT_NOQUOTES) { // Decode the entities to UTF-8 now $decodedString = html_entity_decode($str, $quote, 'UTF-8'); // Return decoded string return $decodedString; } // Merges an array together but only if both are arrays function merge_array ($array1, $array2, $keepIndex = FALSE) { // Are both an array? if ((!is_array($array1)) && (!is_array($array2))) { // Both are not arrays reportBug(__FUNCTION__, __LINE__, 'No arrays provided!'); } elseif (!is_array($array1)) { // Left one is not an array reportBug(__FUNCTION__, __LINE__, sprintf("array1 is not an array. array != %s", gettype($array1))); } elseif (!is_array($array2)) { // Right one is not an array reportBug(__FUNCTION__, __LINE__, sprintf("array2 is not an array. array != %s", gettype($array2))); } // Maintain index of array2? if ($keepIndex === TRUE) { // Keep index of array2, array_merge() rewrites e.g. $key=1 to $key=0, $key=2 to $key=1 ! :( foreach ($array2 as $key => $value) { // Add it $array1[$key] = $value; } // END - foreach // Return it return $array1; } else { // Merge both together normally return array_merge($array1, $array2); } } // Check if given FQFN is a readable file function isFileReadable ($FQFN) { // Is there cache? if (!isset($GLOBALS['file_readable'][$FQFN])) { // Check all... $GLOBALS['file_readable'][$FQFN] = ((is_file($FQFN)) && (file_exists($FQFN)) && (is_readable($FQFN))); } // END - if // Return result return $GLOBALS['file_readable'][$FQFN]; } // Checks whether the given FQFN is a directory and not ., .. or .svn function isDirectory ($FQFN) { // Is there cache? if (!isset($GLOBALS[__FUNCTION__][$FQFN])) { // Generate baseName $baseName = basename($FQFN); // Check it $GLOBALS[__FUNCTION__][$FQFN] = ((is_dir($FQFN)) && ($baseName != '.') && ($baseName != '..') && ($baseName != '.svn')); } // END - if // Return the result return $GLOBALS[__FUNCTION__][$FQFN]; } // "Getter" for the real remote IP number function detectRealIpAddress ($alwaysReal = FALSE) { // Get remote ip from environment $remoteAddr = determineRealRemoteAddress(); // Is removeip installed? if ((isExtensionActive('removeip')) && ($alwaysReal === FALSE)) { // Then anonymize it $remoteAddr = getAnonymousRemoteAddress($remoteAddr); } // END - if // Return it return $remoteAddr; } // "Getter" for remote IP number function detectRemoteAddr ($alwaysReal = FALSE) { // Get remote ip from environment $remoteAddr = determineRealRemoteAddress(TRUE); // Is removeip installed? if ((isExtensionActive('removeip')) && ($alwaysReal === FALSE)) { // Then anonymize it $remoteAddr = getAnonymousRemoteAddress($remoteAddr); } // END - if // Return it return $remoteAddr; } // "Getter" for remote hostname function detectRemoteHostname ($alwaysReal = FALSE) { // Get remote ip from environment $remoteHost = getenv('REMOTE_HOST'); // Is removeip installed? if ((isExtensionActive('removeip')) && ($alwaysReal === FALSE)) { // Then anonymize it $remoteHost = getAnonymousRemoteHost($remoteHost); } // END - if // Return it return $remoteHost; } // "Getter" for user agent function detectUserAgent ($alwaysReal = FALSE) { // Get remote ip from environment $userAgent = getenv('HTTP_USER_AGENT'); // Is removeip installed? if ((isExtensionActive('removeip')) && ($alwaysReal === FALSE)) { // Then anonymize it $userAgent = getAnonymousUserAgent($userAgent); } // END - if // Return it return $userAgent; } // "Getter" for referer function detectReferer ($alwaysReal = FALSE) { // Get remote ip from environment $referer = getenv('HTTP_REFERER'); // Is removeip installed? if ((isExtensionActive('removeip')) && ($alwaysReal === TRUE)) { // Then anonymize it $referer = getAnonymousReferer($referer); } // END - if // Return it return $referer; } // "Getter" for request URI function detectRequestUri () { // Return it return (getenv('REQUEST_URI')); } // "Getter" for query string function detectQueryString () { return str_replace('&', '&', (getenv('QUERY_STRING'))); } // "Getter" for SERVER_NAME function detectServerName () { // Return it return (getenv('SERVER_NAME')); } // Removes any existing www. from SERVER_NAME. This is very silly but enough // for our purpose here. function detectDomainName () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Get server name $domainName = detectServerName(); // Is there any www. ? if (substr($domainName, 0, 4) == 'www.') { // Remove it $domainName = substr($domainName, 4); } // END - if // Set cache $GLOBALS[__FUNCTION__] = $domainName; } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // Check whether we are installing function isInstalling () { // Determine whether we are installing if (!isset($GLOBALS['__mailer_installing'])) { // Check URL (css.php/js.php need this) $GLOBALS['__mailer_installing'] = (isGetRequestElementSet('installing') || ((isGetRequestElementSet('level')) && (getRequestElement('level') == 'install'))); } // END - if // Return result return $GLOBALS['__mailer_installing']; } // Check whether this script is installed function isInstalled () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine whether this script is installed $GLOBALS[__FUNCTION__] = ( ( // First is config ( ( isConfigEntrySet('MAILER_INSTALLED') ) && ( getConfig('MAILER_INSTALLED') == 'Y' ) ) ) || ( // New config file found and loaded isIncludeReadable(getCachePath() . 'config-local.php') ) || ( ( // New config file found, but not yet read isIncludeReadable(getCachePath() . 'config-local.php') ) && ( ( // Only new config file is found !isIncludeReadable('inc/config.php') ) || ( // Is installation mode !isInstalling() ) ) )); } // END - if // Then use the cache return $GLOBALS[__FUNCTION__]; } // Check whether an admin is registered function isAdminRegistered () { // Is cache set? if (!isset($GLOBALS[__FUNCTION__])) { // Simply check it $GLOBALS[__FUNCTION__] = ((isConfigEntrySet('ADMIN_REGISTERED')) && (getConfig('ADMIN_REGISTERED') == 'Y')); } // END - if // Return it return $GLOBALS[__FUNCTION__]; } // Checks whether the hourly reset mode is active function isHourlyResetEnabled () { // Now simply check it return ((isset($GLOBALS['hourly_enabled'])) && ($GLOBALS['hourly_enabled'] === TRUE)); } // Checks whether the daily reset mode is active function isDailyResetEnabled () { // Now simply check it return ((isset($GLOBALS['daily_enabled'])) && ($GLOBALS['daily_enabled'] === TRUE)); } // Checks whether the weekly reset mode is active function isWeeklyResetEnabled () { // Now simply check it return ((isset($GLOBALS['weekly_enabled'])) && ($GLOBALS['weekly_enabled'] === TRUE)); } // Checks whether the monthly reset mode is active function isMonthlyResetEnabled () { // Now simply check it return ((isset($GLOBALS['monthly_enabled'])) && ($GLOBALS['monthly_enabled'] === TRUE)); } // Checks whether one of the reset modes is enabled function isResetModeEnabled () { // Now simply check it return ((isHourlyResetEnabled()) || (isDailyResetEnabled()) || (isWeeklyResetEnabled()) || (isMonthlyResetEnabled())); } // Checks whether the debug mode is enabled function isDebugModeEnabled () { // Is cache set? if (!isset($GLOBALS[__FUNCTION__])) { // Simply check it $GLOBALS[__FUNCTION__] = ((isConfigEntrySet('DEBUG_MODE')) && (getConfig('DEBUG_MODE') == 'Y')); } // END - if // Return it return $GLOBALS[__FUNCTION__]; } // Checks whether the debug hourly is enabled function isDebugHourlyEnabled () { // Is cache set? if (!isset($GLOBALS[__FUNCTION__])) { // Simply check it $GLOBALS[__FUNCTION__] = ((isConfigEntrySet('DEBUG_HOURLY')) && (getConfig('DEBUG_HOURLY') == 'Y')); } // END - if // Return it return $GLOBALS[__FUNCTION__]; } // Checks whether the debug daily is enabled function isDebugDailyEnabled () { // Is cache set? if (!isset($GLOBALS[__FUNCTION__])) { // Simply check it $GLOBALS[__FUNCTION__] = ((isConfigEntrySet('DEBUG_DAILY')) && (getConfig('DEBUG_DAILY') == 'Y')); } // END - if // Return it return $GLOBALS[__FUNCTION__]; } // Checks whether the debug weekly is enabled function isDebugWeeklyEnabled () { // Is cache set? if (!isset($GLOBALS[__FUNCTION__])) { // Simply check it $GLOBALS[__FUNCTION__] = ((isConfigEntrySet('DEBUG_WEEKLY')) && (getConfig('DEBUG_WEEKLY') == 'Y')); } // END - if // Return it return $GLOBALS[__FUNCTION__]; } // Checks whether the debug monthly is enabled function isDebugMonthlyEnabled () { // Is cache set? if (!isset($GLOBALS[__FUNCTION__])) { // Simply check it $GLOBALS[__FUNCTION__] = ((isConfigEntrySet('DEBUG_MONTHLY')) && (getConfig('DEBUG_MONTHLY') == 'Y')); } // END - if // Return it return $GLOBALS[__FUNCTION__]; } // Checks whether SQL debugging is enabled function isSqlDebuggingEnabled () { // Is cache set? if (!isset($GLOBALS[__FUNCTION__])) { // Determine if SQL debugging is enabled $GLOBALS[__FUNCTION__] = ((isConfigEntrySet('DEBUG_SQL')) && (getConfig('DEBUG_SQL') == 'Y')); } // END - if // Return it return $GLOBALS[__FUNCTION__]; } // Checks whether we shall debug regular expressions function isDebugRegularExpressionEnabled () { // Is cache set? if (!isset($GLOBALS[__FUNCTION__])) { // Simply check it $GLOBALS[__FUNCTION__] = ((isConfigEntrySet('DEBUG_REGEX')) && (getConfig('DEBUG_REGEX') == 'Y')); } // END - if // Return it return $GLOBALS[__FUNCTION__]; } // Checks whether debugging of build mails is enabled function isDebugBuildMailsEnabled () { // Is cache set? if (!isset($GLOBALS[__FUNCTION__])) { // Simply check it $GLOBALS[__FUNCTION__] = ((isConfigEntrySet('DEBUG_BUILD_MAILS')) && (getConfig('DEBUG_BUILD_MAILS') == 'Y')); } // END - if // Return it return $GLOBALS[__FUNCTION__]; } // Checks whether the cache instance is valid function isCacheInstanceValid () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = ((isset($GLOBALS['cache_instance'])) && (is_object($GLOBALS['cache_instance']))); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // Copies a file from source to destination and verifies if that goes fine. // This function should wrap the copy() command and make a nicer debug backtrace // even if there is no xdebug extension installed. function copyFileVerified ($source, $dest, $chmod = '') { // Failed is the default $status = FALSE; // Is the source file there? if (!isFileReadable($source)) { // Then abort here reportBug(__FUNCTION__, __LINE__, 'Cannot read from source file ' . basename($source) . '.'); } // END - if // Is the target directory there? if (!isDirectory(dirname($dest))) { // Then abort here reportBug(__FUNCTION__, __LINE__, 'Cannot find directory ' . str_replace(getPath(), '', dirname($dest)) . '.'); } // END - if // Now try to copy it if (!copy($source, $dest)) { // Something went wrong reportBug(__FUNCTION__, __LINE__, 'copy() has failed to copy the file.'); } else { // Reset cache $GLOBALS['file_readable'][$dest] = TRUE; } // All fine by default $status = TRUE; // If there are chmod rights set, apply them if (!empty($chmod)) { // Try to apply them $status = changeMode($dest, $chmod); } // END - if // All fine return $status; } // Wrapper function for chmod() // @TODO Do some more sanity check here function changeMode ($FQFN, $mode) { // Is the file/directory there? if ((!isFileReadable($FQFN)) && (!isDirectory($FQFN))) { // Neither, so abort here reportBug(__FUNCTION__, __LINE__, 'Cannot chmod() on ' . basename($FQFN) . '.'); } // END - if // Try to set them return chmod($FQFN, $mode); } // Wrapper for unlink() function removeFile ($FQFN) { // Is the file there? if (isFileReadable($FQFN)) { // Reset cache first $GLOBALS['file_readable'][$FQFN] = FALSE; // Yes, so remove it return unlink($FQFN); } // END - if // 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; } // Wrapper for $_POST['sel'] function countPostSelection ($element = 'sel') { // Is there cache? if (!isset($GLOBALS[__FUNCTION__][$element])) { // Default is zero $GLOBALS[__FUNCTION__][$element] = '0'; // Is it set? if (isPostRequestElementSet($element)) { // Return counted elements $GLOBALS[__FUNCTION__][$element] = countSelection(postRequestElement($element)); } // END - if } // END - if // Return cached value return $GLOBALS[__FUNCTION__][$element]; } // Checks whether the config-local.php is loaded function isConfigLocalLoaded () { return ((isset($GLOBALS['config_local_loaded'])) && ($GLOBALS['config_local_loaded'] === TRUE)); } // Checks whether a nickname or userid was entered and caches the result 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')); } // END - if // Return the result return $GLOBALS[__FUNCTION__][$userid]; } // Getter for 'what' value function getWhat ($strict = TRUE) { // Default is null $what = NULL; // Is the value set? if (isWhatSet($strict)) { // Then use it $what = $GLOBALS['__what']; } // END - if // Return it return $what; } // Setter for 'what' value function setWhat ($newWhat) { //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'newWhat=' . $newWhat); $GLOBALS['__what'] = $newWhat; } // Setter for 'what' from configuration function setWhatFromConfig ($configEntry) { // Get 'what' from config $what = getConfig($configEntry); // Set it setWhat($what); } // Checks whether what is set and optionally aborts on miss function isWhatSet ($strict = FALSE) { // Check for it $isset = (isset($GLOBALS['__what']) && (!empty($GLOBALS['__what']))); // Should we abort here? if (($strict === TRUE) && ($isset === FALSE)) { // Output backtrace debug_report_bug(__FUNCTION__, __LINE__, 'what is empty.'); } // END - if // Return it return $isset; } // Getter for 'action' value function getAction ($strict = TRUE) { // Default is null $action = NULL; // Is the value set? if (isActionSet(($strict) && (isHtmlOutputMode()))) { // Then use it $action = $GLOBALS['__action']; } // END - if // Return it return $action; } // Setter for 'action' value function setAction ($newAction) { $GLOBALS['__action'] = $newAction; } // Checks whether action is set and optionally aborts on miss function isActionSet ($strict = FALSE) { // Check for it $isset = ((isset($GLOBALS['__action'])) && (!empty($GLOBALS['__action']))); // Should we abort here? if (($strict === TRUE) && ($isset === FALSE)) { // Output backtrace reportBug(__FUNCTION__, __LINE__, 'action is empty.'); } // END - if // Return it return $isset; } // Getter for 'module' value function getModule ($strict = TRUE) { // Default is null $module = NULL; // Is the value set? if (isModuleSet($strict)) { // Then use it $module = $GLOBALS['__module']; } // END - if // Return it return $module; } // Setter for 'module' value function setModule ($newModule) { // Secure it and make all modules lower-case $GLOBALS['__module'] = strtolower($newModule); } // Wrapper to get extra module names function getExtraModule () { // Default is 'NULL' $extra = 'NULL'; // Is 'tab/step' set? if (isPostRequestElementSet('tab')) { // Use this $extra = 'tab=' . postRequestElement('tab'); } elseif (isPostRequestElementSet('step')) { // Use this $extra = 'step=' . postRequestElement('step'); } elseif ((isActionSet()) && (isWhatSet())) { // Use 'action/what' $extra = 'action=' . getAction() . ':what=' . getWhat(); } // Return it return $extra; } // Checks whether module is set and optionally aborts on miss function isModuleSet ($strict = FALSE) { // Check for it $isset = ((isset($GLOBALS['__module'])) && (!empty($GLOBALS['__module']))); // Should we abort here? if (($strict === TRUE) && ($isset === FALSE)) { // Output backtrace reportBug(__FUNCTION__, __LINE__, 'Module is empty.'); } // END - if // Return it return (($isset === TRUE) && ($GLOBALS['__module'] != 'unknown')) ; } // Getter for 'output_mode' value function getScriptOutputMode () { // Is cache set? if (!isset($GLOBALS[__FUNCTION__])) { // Is the output mode set? if (!isOutputModeSet()) { // No, then abort here reportBug(__FUNCTION__, __LINE__, 'Output mode not set.'); } // END - if // Set it in cache $GLOBALS[__FUNCTION__] = $GLOBALS['__output_mode']; } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // Setter for 'output_mode' value function setScriptOutputMode ($newOutputMode) { //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'output_mode=' . $newOutputMode); $GLOBALS['__output_mode'] = (int) $newOutputMode; } // Checks whether output_mode is set and optionally aborts on miss function isOutputModeSet ($strict = FALSE) { // Check for it $isset = (isset($GLOBALS['__output_mode'])); // Should we abort here? if (($strict === TRUE) && ($isset === FALSE)) { // Output backtrace reportBug(__FUNCTION__, __LINE__, 'Output mode is not set.'); } // END - if // Return it return $isset; } // Enables block-mode function enableBlockMode ($enabled = TRUE) { $GLOBALS['__block_mode'] = $enabled; } // Checks whether block-mode is enabled function isBlockModeEnabled () { // Abort if not set if (!isset($GLOBALS['__block_mode'])) { // Needs to be fixed reportBug(__FUNCTION__, __LINE__, 'Block_mode is not set.'); } // END - if // Return it return $GLOBALS['__block_mode']; } // Wrapper for redirectToUrl but URL comes from a configuration entry function redirectToConfiguredUrl ($configEntry) { // Load the URL redirectToUrl(getConfig($configEntry)); } // Wrapper function to redirect from member-only modules to index function redirectToIndexMemberOnlyModule () { // Do the redirect here redirectToUrl('modules.php?module=index&code=' . getCode('MODULE_MEMBER_ONLY') . '&mod=' . getModule()); } // Wrapper function to redirect to current URL function redirectToRequestUri () { redirectToUrl(basename(detectRequestUri())); } // Wrapper function to redirect to de-refered URL function redirectToDereferedUrl ($url) { // Redirect to to redirectToUrl(generateDereferrerUrl($url)); } // Wrapper function for checking if extension is installed and newer or same version function isExtensionInstalledAndNewer ($ext_name, $ext_ver) { // Is an cache entry found? if (!isset($GLOBALS[__FUNCTION__][$ext_name][$ext_ver])) { // Determine it $GLOBALS[__FUNCTION__][$ext_name][$ext_ver] = ((isExtensionInstalled($ext_name)) && (version_compare(getExtensionVersion($ext_name), $ext_ver, '>=') === TRUE)); } else { // Cache hits should be incremented twice incrementStatsEntry('cache_hits', 2); } // Return it //* DEBUG: */ debugOutput(__FUNCTION__ . ':' . $ext_name . '=>' . $ext_ver . ':' . intval($GLOBALS[__FUNCTION__][$ext_name][$ext_ver])); return $GLOBALS[__FUNCTION__][$ext_name][$ext_ver]; } // Wrapper function for checking if extension is installed and older than given version function isExtensionInstalledAndOlder ($ext_name, $ext_ver) { // Is an cache entry found? if (!isset($GLOBALS[__FUNCTION__][$ext_name][$ext_ver])) { // Determine it $GLOBALS[__FUNCTION__][$ext_name][$ext_ver] = ((isExtensionInstalled($ext_name)) && (version_compare(getExtensionVersion($ext_name), $ext_ver, '<') === TRUE)); } else { // Cache hits should be incremented twice incrementStatsEntry('cache_hits', 2); } // Return it //* DEBUG: */ debugOutput(__FUNCTION__ . ':' . $ext_name . '<' . $ext_ver . ':' . intval($GLOBALS[__FUNCTION__][$ext_name][$ext_ver])); return $GLOBALS[__FUNCTION__][$ext_name][$ext_ver]; } // Set username function setUsername ($userName) { $GLOBALS['username'] = (string) $userName; } // Get username function getUsername () { // User name set? if (!isset($GLOBALS['username'])) { // No, so it has to be a guest $GLOBALS['username'] = '{--USERNAME_GUEST--}'; } // END - if // Return it return $GLOBALS['username']; } // Wrapper function for installation phase function isInstallationPhase () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = ((!isInstalled()) || (isInstalling())); } // END - if // Return result return $GLOBALS[__FUNCTION__]; } // Checks whether the extension demo is actuve and the admin login is demo (password needs to be demo, too!) function isDemoModeActive () { // Is cache set? if (!isset($GLOBALS[__FUNCTION__])) { // Simply check it $GLOBALS[__FUNCTION__] = ((isExtensionActive('demo')) && (getCurrentAdminLogin() == 'demo')); } // END - if // Return it return $GLOBALS[__FUNCTION__]; } // Getter for PHP caching value function getPhpCaching () { return $GLOBALS['php_caching']; } // Checks whether the admin hash is set function isAdminHashSet ($adminId) { // Is the array there? if (!isset($GLOBALS['cache_array']['admin'])) { // Missing array should be reported reportBug(__FUNCTION__, __LINE__, 'Cache not set.'); } // END - if // Check for admin hash return isset($GLOBALS['cache_array']['admin']['password'][$adminId]); } // Setter for admin hash function setAdminHash ($adminId, $hash) { $GLOBALS['cache_array']['admin']['password'][$adminId] = $hash; } // Getter for current admin login function getCurrentAdminLogin () { // Log debug message //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'called!'); // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getAdminLogin(getCurrentAdminId()); } // END - if // Return it return $GLOBALS[__FUNCTION__]; } // Setter for admin id (and current) function setAdminId ($adminId) { // Log debug message //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'adminId=' . $adminId); // Set session $status = setSession('admin_id', bigintval($adminId)); // Set current id setCurrentAdminId($adminId); // Return status return $status; } // Setter for admin_last function setAdminLast ($adminLast) { // Log debug message //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'adminLast=' . $adminLast); // Set session $status = setSession('admin_last', $adminLast); // Return status return $status; } // Setter for admin_md5 function setAdminMd5 ($adminMd5) { // Log debug message //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'adminMd5=' . $adminMd5); // Set session $status = setSession('admin_md5', $adminMd5); // Return status return $status; } // Getter for admin_md5 function getAdminMd5 () { // Log debug message //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'called!'); // Get session return getSession('admin_md5'); } // Init user data array function initUserData () { // User id should not be zero if (!isValidId(getCurrentUserId())) { // Should be always valid reportBug(__FUNCTION__, __LINE__, 'Current user id is invalid: ' . getCurrentUserId()); } // END - if // Init the user unset($GLOBALS['is_userdata_valid'][getCurrentUserId()]); $GLOBALS['user_data'][getCurrentUserId()] = array(); } // Getter for user data function getUserData ($column) { // User id should not be zero if (!isValidId(getCurrentUserId())) { // Should be always valid reportBug(__FUNCTION__, __LINE__, 'Current user id is invalid: ' . getCurrentUserId()); } // END - if // Default is empty $data = NULL; if (isset($GLOBALS['user_data'][getCurrentUserId()][$column])) { // Return the value $data = $GLOBALS['user_data'][getCurrentUserId()][$column]; } // END - if // Return it return $data; } // Checks whether given user data is set to 'Y' function isUserDataEnabled ($column) { // Is there cache? if (!isset($GLOBALS[__FUNCTION__][getCurrentUserId()][$column])) { // Determine it $GLOBALS[__FUNCTION__][getCurrentUserId()][$column] = (getUserData($column) == 'Y'); } // END - if // Return cache return $GLOBALS[__FUNCTION__][getCurrentUserId()][$column]; } // Geter for whole user data array function getUserDataArray () { // Get user id $userid = getCurrentUserId(); // Is the current userid valid? if (!isValidId($userid)) { // Should be always valid reportBug(__FUNCTION__, __LINE__, 'Current user id is invalid: ' . $userid); } // END - if // Get the whole array if found if (isset($GLOBALS['user_data'][$userid])) { // Found, so return it return $GLOBALS['user_data'][$userid]; } else { // Return empty array return array(); } } // Checks if the user data is valid, this may indicate that the user has logged // in, but you should use isMember() if you want to find that out. function isUserDataValid () { // User id should not be zero so abort here if (!isCurrentUserIdSet()) { // Debug message, may be noisy //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'isCurrentUserIdSet()=false - ABORTING!'); // Abort here return FALSE; } // END - if // 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) { // Debug message //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid[' . gettype($userid) . ']=' . $userid . ' - ENTERED!'); // Is the cache from below functions different? if (((isset($GLOBALS['getCurrentUserId'])) && ($GLOBALS['getCurrentUserId'] != $userid)) || ((!isset($GLOBALS['current_userid'])) && (isset($GLOBALS['isCurrentUserIdSet'])))) { // Then unset both unsetCurrentUserId(); } // END - if // Set userid $GLOBALS['current_userid'] = bigintval($userid); // Unset it to re-determine the actual state unset($GLOBALS['is_userdata_valid'][$userid]); // Debug message //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid[' . gettype($userid) . ']=' . $userid . ' - EXIT!'); } // Getter for current userid function getCurrentUserId () { // Is cache set? if (!isset($GLOBALS[__FUNCTION__])) { // Userid must be set before it can be used if (!isCurrentUserIdSet()) { // Not set reportBug(__FUNCTION__, __LINE__, 'User id is not set.'); } // END - if // Set userid in cache $GLOBALS[__FUNCTION__] = $GLOBALS['current_userid']; } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // Checks if current userid is set function isCurrentUserIdSet () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = ((isset($GLOBALS['current_userid'])) && (isValidId($GLOBALS['current_userid']))); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // Unsets current userid function unsetCurrentUserId () { // Is it set? if (isset($GLOBALS['current_userid'])) { // Unset this, too unset($GLOBALS['isValidId'][$GLOBALS['current_userid']]); } // END - if // Unset all cache entries unset($GLOBALS['current_userid']); unset($GLOBALS['getCurrentUserId']); unset($GLOBALS['isCurrentUserIdSet']); } // Checks whether we are debugging template cache function isDebugTemplateCacheEnabled () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = (getConfig('DEBUG_TEMPLATE_CACHE') == 'Y'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // Wrapper for fetchUserData() and getUserData() calls function getFetchedUserData ($keyColumn, $userid, $valueColumn) { //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'keyColumn=' . $keyColumn . ',userid=' . $userid . ',valueColumn=' . $valueColumn . ' - ENTERED!'); // Is it cached? if (!isset($GLOBALS[__FUNCTION__][$userid][$keyColumn][$valueColumn])) { // Default is NULL $data = NULL; // Can we fetch the user data? if ((isValidId($userid)) && (fetchUserData($userid, $keyColumn))) { // Now get the data back $data = getUserData($valueColumn); } // END - if // Cache it $GLOBALS[__FUNCTION__][$userid][$keyColumn][$valueColumn] = $data; } // END - if // Return it //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'keyColumn=' . $keyColumn . ',userid=' . $userid . ',valueColumn=' . $valueColumn . ',value=' . $GLOBALS[__FUNCTION__][$userid][$keyColumn][$valueColumn] . ' - EXIT!'); return $GLOBALS[__FUNCTION__][$userid][$keyColumn][$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); } // Wrapper for strpos() to ease porting from deprecated eregi() function // This function is case-insensitive function isInStringIgnoreCase ($needle, $haystack) { return (isInString(strtolower($needle), strtolower($haystack))); } // Wrapper to check for if fatal errors where detected function ifFatalErrorsDetected () { // Just call the inner function return (getTotalFatalErrors() > 0); } // Checks whether a HTTP status has been set function isHttpStatusSet () { // Is it set and not empty? return ((isset($GLOBALS['http_status'])) && (!empty($GLOBALS['http_status']))); } // Setter for HTTP status function setHttpStatus ($status) { $GLOBALS['http_status'] = (string) $status; } // Getter for HTTP status function getHttpStatus () { // Is the status set? if (!isHttpStatusSet()) { // Abort here reportBug(__FUNCTION__, __LINE__, 'No HTTP status set!'); } // END - if // Return it return $GLOBALS['http_status']; } /** * Send a HTTP redirect to the browser. This function was taken from DokuWiki * (GNU GPL 2; http://www.dokuwiki.org) and modified to fit into mailer project. * * ---------------------------------------------------------------------------- * If you want to redirect, please use redirectToUrl(); instead * ---------------------------------------------------------------------------- * * Works arround Microsoft IIS cookie sending bug. Does exit the script. * * @link http://support.microsoft.com/kb/q176113/ * @author Andreas Gohr * @access private */ function sendRawRedirect ($url) { // Clear output buffer clearOutputBuffer(); // Clear own output buffer $GLOBALS['__output'] = ''; // To make redirects working (no content type), output mode must be raw setScriptOutputMode(-1); // Send helping header setHttpStatus('302 Found'); // always close the session session_write_close(); // Revert entity & $url = str_replace('&', '&', $url); // check if running on IIS < 6 with CGI-PHP if ((isset($_SERVER['SERVER_SOFTWARE'])) && (isset($_SERVER['GATEWAY_INTERFACE'])) && (isInString('CGI', $_SERVER['GATEWAY_INTERFACE'])) && (preg_match('|^Microsoft-IIS/(\d)\.\d$|', trim($_SERVER['SERVER_SOFTWARE']), $matches)) && ($matches[1] < 6)) { // Send the IIS header addHttpHeader('Refresh: 0;url=' . $url); } else { // Send generic header addHttpHeader('Location: ' . $url); } // Shutdown here doShutdown(); } // Determines the country of the given user id function determineCountry ($userid) { // Is there cache? if (!isset($GLOBALS[__FUNCTION__][$userid])) { // Default is 'invalid' $GLOBALS[__FUNCTION__][$userid] = 'invalid'; // Is extension country active? if (isExtensionActive('country')) { // Determine the right country code through the country id $id = getUserData('country_code'); // Then handle it over $GLOBALS[__FUNCTION__][$userid] = generateCountryInfo($id); } else { // Get raw code from user data $GLOBALS[__FUNCTION__][$userid] = getUserData('country'); } } // END - if // Return cache return $GLOBALS[__FUNCTION__][$userid]; } // "Getter" for total confirmed user accounts function getTotalConfirmedUser () { // Is it cached? if (!isset($GLOBALS[__FUNCTION__])) { // Then do it if (isExtensionActive('user')) { $GLOBALS[__FUNCTION__] = countSumTotalData('CONFIRMED', 'user_data', 'userid', 'status', TRUE, runFilterChain('user_exclusion_sql', ' ')); } else { $GLOBALS[__FUNCTION__] = 0; } } // END - if // Return cached value //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, __FUNCTION__ . '()=' . $GLOBALS[__FUNCTION__]); return $GLOBALS[__FUNCTION__]; } // "Getter" for total unconfirmed user accounts function getTotalUnconfirmedUser () { // Is it cached? if (!isset($GLOBALS[__FUNCTION__])) { // Then do it if (isExtensionActive('user')) { $GLOBALS[__FUNCTION__] = countSumTotalData('UNCONFIRMED', 'user_data', 'userid', 'status', TRUE, runFilterChain('user_exclusion_sql', ' ')); } else { $GLOBALS[__FUNCTION__] = 0; } } // END - if // Return cached value //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, __FUNCTION__ . '()=' . $GLOBALS[__FUNCTION__]); return $GLOBALS[__FUNCTION__]; } // "Getter" for total locked user accounts function getTotalLockedUser () { // Is it cached? if (!isset($GLOBALS[__FUNCTION__])) { // Then do it if (isExtensionActive('user')) { $GLOBALS[__FUNCTION__] = countSumTotalData('LOCKED', 'user_data', 'userid', 'status', TRUE, runFilterChain('user_exclusion_sql', ' ')); } else { $GLOBALS[__FUNCTION__] = 0; } } // END - if // Return cached value //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, __FUNCTION__ . '()=' . $GLOBALS[__FUNCTION__]); return $GLOBALS[__FUNCTION__]; } // "Getter" for total locked user accounts function getTotalRandomRefidUser () { // Is it cached? 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', ' '), '>='); } else { $GLOBALS[__FUNCTION__] = 0; } } // END - if // Return cached value //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, __FUNCTION__ . '()=' . $GLOBALS[__FUNCTION__]); return $GLOBALS[__FUNCTION__]; } // Is given id number valid? function isValidId ($id) { // Debug message //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'id[' . gettype($id) . ']=' . $id); // Is there cache? if (!isset($GLOBALS[__FUNCTION__][$id])) { // Check it out $GLOBALS[__FUNCTION__][$id] = ((!is_null($id)) && (!is_bool($id)) && (!empty($id)) && ($id != 'NULL') && ($id > 0)); } // END - if // Return cache //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'id=' . $id . ',result=' . intval($GLOBALS[__FUNCTION__][$id])); return $GLOBALS[__FUNCTION__][$id]; } // Encodes entities function encodeEntities ($str) { // Secure it first $str = secureString($str, TRUE, TRUE); // Encode dollar sign as well $str = str_replace('$', '$', $str); // Return it return $str; } // "Getter" for date from patch_ctime function getDateFromRepository () { // Is it cached? if (!isset($GLOBALS[__FUNCTION__])) { // Then set it $GLOBALS[__FUNCTION__] = generateDateTime(getConfig('CURRENT_REPOSITORY_DATE'), '5'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for date/time from patch_ctime function getDateTimeFromRepository () { // Is it cached? if (!isset($GLOBALS[__FUNCTION__])) { // Then set it $GLOBALS[__FUNCTION__] = generateDateTime(getConfig('CURRENT_REPOSITORY_DATE'), '2'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // Getter for current year (default) function getYear ($timestamp = NULL) { // Is it cached? if (!isset($GLOBALS[__FUNCTION__][$timestamp])) { // If NULL is set, use time() if (is_null($timestamp)) { $timestamp = time(); } // END - if // Then create it $GLOBALS[__FUNCTION__][$timestamp] = date('Y', $timestamp); } // END - if // Return cache return $GLOBALS[__FUNCTION__][$timestamp]; } // Getter for current month (default) function getMonth ($timestamp = NULL) { // Is it cached? if (!isset($GLOBALS[__FUNCTION__][$timestamp])) { // If NULL is set, use time() if (is_null($timestamp)) { // Use time() which is current timestamp $timestamp = time(); } // END - if // Then create it $GLOBALS[__FUNCTION__][$timestamp] = date('m', $timestamp); } // END - if // Return cache return $GLOBALS[__FUNCTION__][$timestamp]; } // Getter for current hour (default) function getHour ($timestamp = NULL) { // Is it cached? if (!isset($GLOBALS[__FUNCTION__][$timestamp])) { // null is time() if (is_null($timestamp)) { $timestamp = time(); } // END - if // Then create it $GLOBALS[__FUNCTION__][$timestamp] = date('H', $timestamp); } // END - if // Return cache return $GLOBALS[__FUNCTION__][$timestamp]; } // Getter for current day (default) function getDay ($timestamp = NULL) { // Is it cached? if (!isset($GLOBALS[__FUNCTION__][$timestamp])) { // null is time() if (is_null($timestamp)) { $timestamp = time(); } // END - if // Then create it $GLOBALS[__FUNCTION__][$timestamp] = date('d', $timestamp); } // END - if // Return cache return $GLOBALS[__FUNCTION__][$timestamp]; } // Getter for current week (default) function getWeek ($timestamp = NULL) { // Is it cached? if (!isset($GLOBALS[__FUNCTION__][$timestamp])) { // null is time() if (is_null($timestamp)) $timestamp = time(); // Then create it $GLOBALS[__FUNCTION__][$timestamp] = date('W', $timestamp); } // END - if // Return cache return $GLOBALS[__FUNCTION__][$timestamp]; } // Getter for current short_hour (default) function getShortHour ($timestamp = NULL) { // Is it cached? if (!isset($GLOBALS[__FUNCTION__][$timestamp])) { // null is time() if (is_null($timestamp)) $timestamp = time(); // Then create it $GLOBALS[__FUNCTION__][$timestamp] = date('G', $timestamp); } // END - if // Return cache return $GLOBALS[__FUNCTION__][$timestamp]; } // Getter for current long_hour (default) function getLongHour ($timestamp = NULL) { // Is it cached? if (!isset($GLOBALS[__FUNCTION__][$timestamp])) { // null is time() if (is_null($timestamp)) $timestamp = time(); // Then create it $GLOBALS[__FUNCTION__][$timestamp] = date('H', $timestamp); } // END - if // Return cache return $GLOBALS[__FUNCTION__][$timestamp]; } // Getter for current second (default) function getSecond ($timestamp = NULL) { // Is it cached? if (!isset($GLOBALS[__FUNCTION__][$timestamp])) { // null is time() if (is_null($timestamp)) $timestamp = time(); // Then create it $GLOBALS[__FUNCTION__][$timestamp] = date('s', $timestamp); } // END - if // Return cache return $GLOBALS[__FUNCTION__][$timestamp]; } // Getter for current minute (default) function getMinute ($timestamp = NULL) { // Is it cached? if (!isset($GLOBALS[__FUNCTION__][$timestamp])) { // null is time() if (is_null($timestamp)) $timestamp = time(); // Then create it $GLOBALS[__FUNCTION__][$timestamp] = date('i', $timestamp); } // END - if // Return cache return $GLOBALS[__FUNCTION__][$timestamp]; } // Checks whether the title decoration is enabled function isTitleDecorationEnabled () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Just check it $GLOBALS[__FUNCTION__] = (getConfig('enable_title_deco') == 'Y'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // Checks whether filter usage updates are enabled (expensive queries!) function isFilterUsageUpdateEnabled () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = ((isExtensionInstalledAndNewer('sql_patches', '0.6.0')) && (isConfigEntrySet('update_filter_usage')) && (getConfig('update_filter_usage') == 'Y')); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // Checks whether debugging of weekly resets is enabled function isWeeklyResetDebugEnabled () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = ((isConfigEntrySet('DEBUG_WEEKLY')) && (getConfig('DEBUG_WEEKLY') == 'Y')); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // Checks whether debugging of monthly resets is enabled function isMonthlyResetDebugEnabled () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = ((isConfigEntrySet('DEBUG_MONTHLY')) && (getConfig('DEBUG_MONTHLY') == 'Y')); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // Checks whether displaying of debug SQLs are enabled function isDisplayDebugSqlEnabled () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = ((isExtensionInstalledAndNewer('other', '0.2.2')) && (getDisplayDebugSqls() == 'Y')); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // Checks whether module title is enabled function isModuleTitleEnabled () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = (getConfig('enable_mod_title') == 'Y'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // Checks whether what title is enabled function isWhatTitleEnabled () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = (getConfig('enable_what_title') == 'Y'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for internal_stats function getInternalStats () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('internal_stats'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // Checks whether stats are enabled function ifInternalStatsEnabled () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Then determine it, do not add isExtensionInstalledAndNewer() here as it breaks very first SQL query $GLOBALS[__FUNCTION__] = ((isConfigEntrySet('internal_stats')) && (getInternalStats() == 'Y')); } // END - if // Return cached value return $GLOBALS[__FUNCTION__]; } // Checks whether admin-notification of certain user actions is enabled function isAdminNotificationEnabled () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = ((isExtensionInstalledAndNewer('other', '0.3.0')) && (getAdminNotify() == 'Y')); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // Checks whether random referral id selection is enabled function isRandomReferralIdEnabled () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = ((isExtensionInstalledAndNewer('user', '0.3.4')) && (getSelectUserZeroRefid() == 'Y')); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for default language function getDefaultLanguage () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('DEFAULT_LANG'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for default referral id function getDefRefid () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('def_refid'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for path function getPath () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('PATH'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for url function getUrl () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('URL'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for cache_path function getCachePath () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('CACHE_PATH'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for WRITE_FOOTER function getWriteFooter () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('WRITE_FOOTER'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for secret_key function getSecretKey () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('secret_key'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for SITE_KEY function getSiteKey () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('SITE_KEY'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for DATE_KEY function getDateKey () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('DATE_KEY'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for master_salt function getMasterSalt () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('master_salt'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for prime function getPrime () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('_PRIME'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for encrypt_separator function getEncryptSeparator () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('ENCRYPT_SEPARATOR'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for mysql_prefix function getMysqlPrefix () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('_MYSQL_PREFIX'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for table_type function getTableType () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('_TABLE_TYPE'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for salt_length function getSaltLength () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('salt_length'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for output_mode function getOutputMode () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('OUTPUT_MODE'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for full_version function getFullVersion () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('FULL_VERSION'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for title function getTitle () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('TITLE'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for curr_svn_revision function getCurrentRepositoryRevision () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('CURRENT_REPOSITORY_REVISION'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for server_url function getServerUrl () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('SERVER_URL'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for mt_word function getMtWord () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('mt_word'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for mt_word2 function getMtWord2 () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('mt_word2'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for mt_word3 function getMtWord3 () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('mt_word3'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for START_TDAY function getStartTday () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('START_TDAY'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for START_YDAY function getStartYday () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('START_YDAY'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for main_title function getMainTitle () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('MAIN_TITLE'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for file_hash function getFileHash () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('file_hash'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for pass_scramble function getPassScramble () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('pass_scramble'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for ap_inactive_since function getApInactiveSince () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('ap_inactive_since'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for user_min_confirmed function getUserMinConfirmed () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('user_min_confirmed'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for points function getPoints () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('POINTS'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for slogan function getSlogan () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('SLOGAN'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for copy function getCopy () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('COPY'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for webmaster function getWebmaster () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('WEBMASTER'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for sql_count function getSqlCount () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('sql_count'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for num_templates function getNumTemplates () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('num_templates'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for dns_cache_timeout function getDnsCacheTimeout () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('dns_cache_timeout'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for menu_blur_spacer function getMenuBlurSpacer () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('menu_blur_spacer'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for points_register function getPointsRegister () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('points_register'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for points_ref function getPointsRef () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('points_ref'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for ref_payout function getRefPayout () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('ref_payout'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for online_timeout function getOnlineTimeout () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('online_timeout'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for index_home function getIndexHome () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('index_home'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for one_day function getOneDay () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('ONE_DAY'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for img_type function getImgType () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('img_type'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for code_length function getCodeLength () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('code_length'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for pass_len function getPassLen () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('pass_len'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for admin_menu function getAdminMenu () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('admin_menu'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for last_hourly function getLastHourly () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('last_hourly'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for last_daily function getLastDaily () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('last_daily'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for last_weekly function getLastWeekly () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('last_weekly'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for last_monthly function getLastMonthly () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('last_monthly'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for mails_page function getMailsPage () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('mails_page'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for rand_no function getRandNo () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('rand_no'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for __DB_NAME function getDbName () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('__DB_NAME'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for DOMAIN function getDomain () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('DOMAIN'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for proxy_username function getProxyUsername () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('proxy_username'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for proxy_password function getProxyPassword () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('proxy_password'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for proxy_host function getProxyHost () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('proxy_host'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for proxy_port function getProxyPort () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('proxy_port'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for SMTP_HOSTNAME function getSmtpHostname () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('SMTP_HOSTNAME'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for SMTP_USER function getSmtpUser () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('SMTP_USER'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for SMTP_PASSWORD function getSmtpPassword () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('SMTP_PASSWORD'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for points_word function getPointsWord () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('points_word'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for profile_lock function getProfileLock () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('profile_lock'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for url_tlock function getUrlTlock () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('url_tlock'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for title_left function getTitleLeft () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('title_left'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for title_right function getTitleRight () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('title_right'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for title_middle function getTitleMiddle () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('title_middle'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // Getter for 'display_home_in_index' function getDisplayHomeInIndex () { // Is the cache entry set? if (!isset($GLOBALS[__FUNCTION__])) { // No, so determine it $GLOBALS[__FUNCTION__] = getConfig('display_home_in_index'); } // END - if // Return cached entry return $GLOBALS[__FUNCTION__]; } // Checks whether 'display_home_in_index' is 'Y' function isDisplayHomeInIndexEnabled () { // Is the cache entry set? if (!isset($GLOBALS[__FUNCTION__])) { // No, so determine it $GLOBALS[__FUNCTION__] = (getDisplayHomeInIndex() == 'Y'); } // END - if // Return cached entry return $GLOBALS[__FUNCTION__]; } // Getter for 'show_points_unconfirmed' function getShowPointsUnconfirmed () { // Is the cache entry set? if (!isset($GLOBALS[__FUNCTION__])) { // No, so determine it $GLOBALS[__FUNCTION__] = getConfig('show_points_unconfirmed'); } // END - if // Return cached entry return $GLOBALS[__FUNCTION__]; } // Checks whether 'show_points_unconfirmed' is 'Y' function isShowPointsUnconfirmedEnabled () { // Is the cache entry set? if (!isset($GLOBALS[__FUNCTION__])) { // No, so determine it $GLOBALS[__FUNCTION__] = (getShowPointsUnconfirmed() == 'Y'); } // END - if // Return cached entry return $GLOBALS[__FUNCTION__]; } // Getter for 'youre_here' function getYoureHere () { // Is the cache entry set? if (!isset($GLOBALS[__FUNCTION__])) { // No, so determine it $GLOBALS[__FUNCTION__] = getConfig('youre_here'); } // END - if // Return cached entry return $GLOBALS[__FUNCTION__]; } // Checks whether 'show_timings' is 'Y' function isYoureHereEnabled () { // Is the cache entry set? if (!isset($GLOBALS[__FUNCTION__])) { // No, so determine it $GLOBALS[__FUNCTION__] = (getYoureHere() == 'Y'); } // END - if // Return cached entry return $GLOBALS[__FUNCTION__]; } // Getter for 'show_timings' function getShowTimings () { // Is the cache entry set? if (!isset($GLOBALS[__FUNCTION__])) { // No, so determine it $GLOBALS[__FUNCTION__] = getConfig('show_timings'); } // END - if // Return cached entry return $GLOBALS[__FUNCTION__]; } // Checks whether 'show_timings' is 'Y' function isShowTimingsEnabled () { // Is the cache entry set? if (!isset($GLOBALS[__FUNCTION__])) { // No, so determine it $GLOBALS[__FUNCTION__] = (getShowTimings() == 'Y'); } // END - if // Return cached entry return $GLOBALS[__FUNCTION__]; } // Getter for 'ap_server_name_since' function getApServerNameSince () { // Is the cache entry set? if (!isset($GLOBALS[__FUNCTION__])) { // No, so determine it $GLOBALS[__FUNCTION__] = getConfig('ap_server_name_since'); } // END - if // Return cached entry return $GLOBALS[__FUNCTION__]; } // Getter for 'ap_server_name' function getApServerName () { // Is the cache entry set? if (!isset($GLOBALS[__FUNCTION__])) { // No, so determine it $GLOBALS[__FUNCTION__] = getConfig('ap_server_name'); } // END - if // Return cached entry return $GLOBALS[__FUNCTION__]; } // Getter for 'index_delay' function getIndexDelay () { // Is the cache entry set? if (!isset($GLOBALS[__FUNCTION__])) { // No, so determine it $GLOBALS[__FUNCTION__] = getConfig('index_delay'); } // END - if // Return cached entry return $GLOBALS[__FUNCTION__]; } // Checks whether 'ap_server_name' is 'Y' function isApServerNameEnabled () { // Is the cache entry set? if (!isset($GLOBALS[__FUNCTION__])) { // No, so determine it $GLOBALS[__FUNCTION__] = (getApServerName() == 'Y'); } // END - if // Return cached entry return $GLOBALS[__FUNCTION__]; } // Getter for 'admin_menu_javascript' function getAdminMenuJavascript () { // Is the cache entry set? if (!isset($GLOBALS[__FUNCTION__])) { // No, so determine it $GLOBALS[__FUNCTION__] = getConfig('admin_menu_javascript'); } // END - if // Return cached entry return $GLOBALS[__FUNCTION__]; } // Getter for 'points_remove_account' function getPointsRemoveAccount () { // Is the cache entry set? if (!isset($GLOBALS[__FUNCTION__])) { // No, so determine it $GLOBALS[__FUNCTION__] = getConfig('points_remove_account'); } // END - if // Return cached entry return $GLOBALS[__FUNCTION__]; } // Getter for 'css_php' function getCssPhp () { // Is the cache entry set? if (!isset($GLOBALS[__FUNCTION__])) { // No, so determine it $GLOBALS[__FUNCTION__] = getConfig('css_php'); } // END - if // Return cached entry return $GLOBALS[__FUNCTION__]; } // Getter for 'guest_menu' function getGuestMenu () { // Is the cache entry set? if (!isset($GLOBALS[__FUNCTION__])) { // No, so determine it $GLOBALS[__FUNCTION__] = getConfig('guest_menu'); } // END - if // Return cached entry return $GLOBALS[__FUNCTION__]; } // Checks if guest menu is enabled function isGuestMenuEnabled () { // Is the cache entry set? if (!isset($GLOBALS[__FUNCTION__])) { // No, so determine it $GLOBALS[__FUNCTION__] = (getGuestMenu() == 'Y'); } // END - if // Return cached entry return $GLOBALS[__FUNCTION__]; } // Getter for 'member_menu' function getMemberMenu () { // Is the cache entry set? if (!isset($GLOBALS[__FUNCTION__])) { // No, so determine it $GLOBALS[__FUNCTION__] = getConfig('member_menu'); } // END - if // Return cached entry return $GLOBALS[__FUNCTION__]; } // Checks if member menu is enabled function isMemberMenuEnabled () { // Is the cache entry set? if (!isset($GLOBALS[__FUNCTION__])) { // No, so determine it $GLOBALS[__FUNCTION__] = (getMemberMenu() == 'Y'); } // END - if // Return cached entry return $GLOBALS[__FUNCTION__]; } // Getter for 'word_wrap' function getWordWrap () { // Is the cache entry set? if (!isset($GLOBALS[__FUNCTION__])) { // Construct config entry name $configEntry = getMenuModeFromModule() . '_word_wrap_' . getWhat(); // Is a special config entry found or ext-sql_patches updated? if (isConfigEntrySet($configEntry)) { // A special config entry has been found, then use it $GLOBALS[__FUNCTION__] = getConfig($configEntry); } elseif (isExtensionInstalledAndNewer('other', '0.2.9')) { // No special config entry found, then use it as "fall-back" $GLOBALS[__FUNCTION__] = getConfig('word_wrap'); } else { // No, use default (15 characters) $GLOBALS[__FUNCTION__] = 15; } } // END - if // Return cached entry return $GLOBALS[__FUNCTION__]; } // Checks whether proxy configuration is used function isProxyUsed () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = ((isExtensionInstalledAndNewer('sql_patches', '0.4.3')) && (getConfig('proxy_host') != '') && (getConfig('proxy_port') > 0)); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // Checks whether POST data contains selections function ifPostContainsSelections ($element = 'sel') { // Is there cache? if (!isset($GLOBALS[__FUNCTION__][$element])) { // Determine it $GLOBALS[__FUNCTION__][$element] = ((isPostRequestElementSet($element)) && (is_array(postRequestElement($element))) && (countPostSelection($element) > 0)); } // END - if // Return cache return $GLOBALS[__FUNCTION__][$element]; } // Checks whether verbose_sql is Y and returns true/false if so function isVerboseSqlEnabled () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = ((isExtensionInstalledAndNewer('sql_patches', '0.0.7')) && (getConfig('verbose_sql') == 'Y')); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for total user points function getTotalPoints ($userid) { // Is there cache? if (!isset($GLOBALS[__FUNCTION__][$userid])) { // Init array for filter chain $data = array( 'userid' => $userid, 'points' => 0 ); // Run filter chain for getting more point values $data = runFilterChain('get_total_points', $data); // Determine it $GLOBALS[__FUNCTION__][$userid] = $data['points'] - getUserUsedPoints($userid); } // END - if // Return cache return $GLOBALS[__FUNCTION__][$userid]; } // Wrapper to get used points for given userid function getUserUsedPoints ($userid) { // Is there cache? if (!isset($GLOBALS[__FUNCTION__][$userid])) { // Determine it $GLOBALS[__FUNCTION__][$userid] = countSumTotalData($userid, 'user_data', 'used_points'); } // END - if // Return cache return $GLOBALS[__FUNCTION__][$userid]; } // Checks whether direct payment is allowed in configuration function isDirectPaymentEnabled () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = (getConfig('allow_direct_pay') == 'Y'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // Checks whether JavaScript-based admin menu is enabled function isAdminMenuJavascriptEnabled () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = ((isExtensionInstalledAndNewer('sql_patches', '0.8.7')) && (getAdminMenuJavaScript() == 'Y')); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // Wrapper to check if current task is for extension (not update) function isExtensionTask ($content) { // Is there cache? if (!isset($GLOBALS[__FUNCTION__][$content['task_type'] . '_' . $content['infos']])) { // Determine it $GLOBALS[__FUNCTION__][$content['task_type'] . '_' . $content['infos']] = (($content['task_type'] == 'EXTENSION') && ((isExtensionNameValid($content['infos'])) || (isExtensionDeprecated($content['infos']))) && (!isExtensionInstalled($content['infos']))); } // END - if // Return cache return $GLOBALS[__FUNCTION__][$content['task_type'] . '_' . $content['infos']]; } // Checks whether ALLOW_TESTER_ACCOUNTS is set function ifTesterAccountsAllowed () { // Is the cache entry set? if (!isset($GLOBALS[__FUNCTION__])) { // No, so determine it $GLOBALS[__FUNCTION__] = ((isConfigEntrySet('ALLOW_TESTER_ACCOUNTS')) && (getConfig('ALLOW_TESTER_ACCOUNTS') == 'Y')); } // END - if // Return cached entry return $GLOBALS[__FUNCTION__]; } // Wrapper to check if output mode is CSS function isCssOutputMode () { // Is cache set? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'getScriptOutputMode()=' . getScriptOutputMode()); $GLOBALS[__FUNCTION__] = (getScriptOutputMode() == 1); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // Wrapper to check if output mode is HTML function isHtmlOutputMode () { // Is cache set? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'getScriptOutputMode()=' . getScriptOutputMode()); $GLOBALS[__FUNCTION__] = (getScriptOutputMode() == 0); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // Wrapper to check if output mode is RAW function isRawOutputMode () { // Is cache set? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'getScriptOutputMode()=' . getScriptOutputMode()); $GLOBALS[__FUNCTION__] = (getScriptOutputMode() == -1); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // Wrapper to check if output mode is AJAX function isAjaxOutputMode () { // Is cache set? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'getScriptOutputMode()=' . getScriptOutputMode()); $GLOBALS[__FUNCTION__] = (getScriptOutputMode() == -2); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // Wrapper to check if output mode is image function isImageOutputMode () { // Is cache set? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'getScriptOutputMode()=' . getScriptOutputMode()); $GLOBALS[__FUNCTION__] = (getScriptOutputMode() == -3); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // Wrapper to generate a user email link function generateWrappedUserEmailLink ($email) { // Just call the inner function return generateEmailLink($email, 'user_data'); } // Wrapper to check if user points are locked function ifUserPointsLocked ($userid) { //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ' - ENTERED!'); // Is there cache? if (!isset($GLOBALS[__FUNCTION__][$userid])) { // Determine it $GLOBALS[__FUNCTION__][$userid] = ((getFetchedUserData('userid', $userid, 'ref_payout') > 0) && (!isDirectPaymentEnabled())); } // END - if // Return cache //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',locked=' . intval($GLOBALS[__FUNCTION__][$userid]) . ' - EXIT!'); return $GLOBALS[__FUNCTION__][$userid]; } // Appends a line to an existing file or creates it instantly with given content. // This function does always add a new-line character to every line. function appendLineToFile ($file, $line) { $fp = fopen($file, 'a') or reportBug(__FUNCTION__, __LINE__, 'Cannot write to file ' . basename($file) . '!'); fwrite($fp, $line . PHP_EOL); fclose($fp); } // Wrapper for changeDataInFile() but with full path added function changeDataInInclude ($FQFN, $comment, $prefix, $suffix, $inserted, $seek=0) { // Add full path $FQFN = getPath() . $FQFN; // Call inner function return changeDataInFile($FQFN, $comment, $prefix, $suffix, $inserted, $seek); } // Wrapper for changing entries in config-local.php function changeDataInLocalConfigurationFile ($comment, $prefix, $suffix, $inserted, $seek = 0) { // Call the inner function return changeDataInInclude(getCachePath() . 'config-local.php', $comment, $prefix, $suffix, $inserted, $seek); } // Shortens ucfirst(strtolower()) calls function firstCharUpperCase ($str) { return ucfirst(strtolower($str)); } // Shortens calls with configuration entry as first argument (the second will become obsolete in the future) function createConfigurationTimeSelections ($configEntry, $stamps, $align = 'center') { // Get the configuration entry $configValue = getConfig($configEntry); // Call inner method return createTimeSelections($configValue, $configEntry, $stamps, $align); } // Shortens converting of German comma to Computer's version in POST data function convertCommaToDotInPostData ($postEntry) { // Read and convert given entry $postValue = convertCommaToDot(postRequestElement($postEntry)); // Log message //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'postEntry=' . $postEntry . ',postValue=' . $postValue); // ... and set it again setPostRequestElement($postEntry, $postValue); } // Converts German commas to Computer's version in all entries function convertCommaToDotInPostDataArray ($postEntries) { // Replace german decimal comma with computer decimal dot foreach ($postEntries as $entry) { // Is the entry there? if (isPostRequestElementSet($entry)) { // Then convert it convertCommaToDotInPostData($entry); } // END - if } // END - foreach } /** * Parses a string into a US formated float variable, taken from user comments * from PHP documentation website. * * @param $floatString A string holding a float expression * @return $float Corresponding float variable * @author chrisgeorgakopouloscom * @link http://de.php.net/manual/en/function.floatval.php#92563 */ function parseFloat ($floatString){ // Load locale info $LocaleInfo = localeconv(); // Remove thousand separators $floatString = str_replace($LocaleInfo['mon_thousands_sep'] , '' , $floatString); // Convert decimal point $floatString = str_replace($LocaleInfo['mon_decimal_point'] , '.', $floatString); // Return float value of converted string return floatval($floatString); } /** * Searches a multi-dimensional array (as used in many places) for given * key/value pair as taken from user comments from PHP documentation website. * * @param $array An array with one or more dimensions * @param $key Key to look for * @param $value Value to look for * @param $parentIndex Parent index (ONLY INTERNAL USE!) * @return $results Resulted array or empty array if $array is no array * @author sunelbegmailcom * @link http://de.php.net/manual/en/function.array-search.php#110120 */ function search_array ($array, $key, $value, $parentIndex = NULL) { //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'array(' . count($array) . ')=' . print_r($array, TRUE) . ',key=' . $key . ',value=' . $value . ',parentIndex[' . gettype($parentIndex) . '=' . $parentIndex . ' - ENTERED!'); // Init array result $results = array(); // Is $array really an array? if (is_array($array)) { // Search for whole array foreach ($array as $idx => $dummy) { //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'key=' . $key . ',value=' . $value . ',idx=' . $idx . ',parentIndex[' . gettype($parentIndex) . ']=' . $parentIndex); //* DEBUG: */ print 'idx=' . $idx . ',parentIndex[' . gettype($parentIndex) . ']=' . $parentIndex . ',key=' . $key . ',value=' . $value . ',array=
'.print_r($array, TRUE).'
'; // Is dummy an array? if ((is_array($dummy)) && ((is_null($parentIndex)) || ($parentIndex === $value))) { // Then search again $subResult = search_array($dummy, $key, $value, $idx); //* DEBUG: */ print 'subResult=
' . print_r($subResult, TRUE).'
'; // And merge both $results = merge_array($results, $subResult, TRUE); } elseif (($key == $idx) && (isset($array[$key])) && ($array[$key] === $value)) { // Is found, so add it $results[$parentIndex] = $array; //* DEBUG: */ print 'ARRAY: key=' . $key . ',idx=' . $idx . ',value=' . $value . ',parentIndex[' . gettype($parentIndex) . ']=' . $parentIndex . ',array=
' . print_r($array, TRUE).'
'; } } // END - foreach } // END - if // Return resulting array //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'results(' . count($results) . ')=' . print_r($results, TRUE) . ' - EXIT!'); return $results; } // Generates a YES/NO option list from given default function generateYesNoOptions ($defaultValue = '') { // Generate it return generateOptions('/ARRAY/', array('Y', 'N'), array('{--YES--}', '{--NO--}'), $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))); // Return value return $numRows; } // Wrapper "getter" to get total unconfirmed mails for given userid function getTotalUnconfirmedMails ($userid) { // Is there cache? if (!isset($GLOBALS[__FUNCTION__][$userid])) { // Determine it $GLOBALS[__FUNCTION__][$userid] = countSumTotalData($userid, 'user_links', 'id', 'userid', TRUE); } // END - if // Return cache return $GLOBALS[__FUNCTION__][$userid]; } // Checks whether 'mailer_theme' was found in session function isMailerThemeSet () { // Is cache set? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = isSessionVariableSet('mailer_theme'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } /** * Setter for theme in session (This setter does return the success of * setSession() which is required e.g. for destroySponsorSession(). */ function setMailerTheme ($newTheme) { // Set it in session return setSession('mailer_theme', $newTheme); } /** * Getter for theme from session (This getter does return 'mailer_theme' from * session data or throws an error if not possible */ function getMailerTheme () { // Is cache set? if (!isset($GLOBALS[__FUNCTION__])) { // Is 'mailer_theme' set? if (!isMailerThemeSet()) { // No, then abort here reportBug(__FUNCTION__, __LINE__, 'mailer_theme not set in session. Please fix your code.'); } // END - if // Get it and store it in cache $GLOBALS[__FUNCTION__] = getSession('mailer_theme'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // "Getter" for last_module/last_what depending on ext-user version function getUserLastWhatName () { // Default is old one: last_module $columnName = 'last_module'; // Is ext-user up-to-date? if (isExtensionInstalledAndNewer('user', '0.4.9')) { // Yes, then use new one $columnName = 'last_what'; } // END - if // Return it return $columnName; } // "Getter" for all columns for given alias and separator function getAllPointColumns ($alias = NULL, $separator = ',') { // Prepare the filter array $filterData = array( 'columns' => '', 'alias' => $alias, 'separator' => $separator ); // Run the filter $filterData = runFilterChain('get_all_point_columns', $filterData); // Return the columns return $filterData['columns']; } // Checks whether the copyright footer (which breaks framesets) is enabled function ifCopyrightFooterEnabled () { // Is not unset and not 'N'? return ((!isset($GLOBALS['__copyright_enabled'])) || ($GLOBALS['__copyright_enabled'] == 'Y')); } /** * Wrapper to check whether we have a "full page". This means that the actual * content is not delivered in any frame of a frameset. */ function isFullPage () { /* * The parameter 'frame' is generic and always indicates that this content * will be output into a frame. Furthermore, if a frameset is reported or * the copyright line is explicitly deactivated, this cannot be a "full * page" again. */ // @TODO Find a way to not use direct module comparison $isFullPage = ((!isGetRequestElementSet('frame')) && (getModule() != 'frametester') && (!isFramesetModeEnabled()) && (ifCopyrightFooterEnabled())); // Return it return $isFullPage; } // Checks whether frameset_mode is set to true function isFramesetModeEnabled () { // Check it return ((isset($GLOBALS['frameset_mode'])) && ($GLOBALS['frameset_mode'] === TRUE)); } // Function to determine correct 'what' value function determineWhat ($module = NULL) { // Init default 'what' $what = 'welcome'; // Is module NULL? if (is_null($module)) { // Then use default $module = getModule(); } // END - if // Is what set? if (isWhatSet()) { // Then use it $what = getWhat(); } else { // Else try to get it from current module $what = getWhatFromModule($module); } //* DEBUG: */ debugOutput(__LINE__.'*'.$what.'/'.$module.'/'.getAction().'/'.getWhat().'*'); // Remove any spaces from variable $what = trim($what); // Is it empty? if (empty($what)) { // Default action for non-admin menus $what = 'welcome'; } else { // Secure it $what = secureString($what); } // Return what return $what; } // Fills (prepend) a string with zeros. This function has been taken from user comments at de.php.net/str_pad function prependZeros ($str, $length = 2) { // Return prepended string return sprintf('%0' . (int) $length . 's', $str); } // Wraps convertSelectionsToEpocheTime() function convertSelectionsToEpocheTimeInPostData ($id) { // Init variables $content = array(); $skip = FALSE; // Get all POST data $postData = postRequestArray(); // Convert given selection id convertSelectionsToEpocheTime($postData, $content, $id, $skip); // Set the POST array back setPostRequestArray($postData); } // Wraps checking if given points account type matches with given in POST data function ifPointsAccountTypeMatchesPost ($type) { // Check condition exit(__FUNCTION__.':type='.$type.',post=
'.print_r(postRequestArray(), TRUE).'
'); } // Gets given user's total referral function getUsersTotalReferrals ($userid, $level = NULL) { // Is there cache? if (!isset($GLOBALS[__FUNCTION__][$userid][$level])) { // Is the level NULL? if (is_null($level)) { // Get total amount (all levels) $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)); } } // END - if // Return it return $GLOBALS[__FUNCTION__][$userid][$level]; } // Gets given user's total referral function getUsersTotalLockedReferrals ($userid, $level = NULL) { //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',level[' . gettype($level) . ']=' . $level . ' - ENTERED!'); // Is there cache? if (!isset($GLOBALS[__FUNCTION__][$userid][$level])) { // Default is all refs $add = ''; // Is the not level NULL? if (!is_null($level)) { // Then add referral level $add = ' AND `r`.`level`=' . bigintval($level); } // END - if // Check for all referrals $result = SQL_QUERY_ESC("SELECT COUNT(`d`.`userid`) AS `cnt` FROM `{?_MYSQL_PREFIX?}_user_data` AS `d` INNER JOIN `{?_MYSQL_PREFIX?}_user_refs` AS `r` ON `d`.`userid`=`r`.`refid` WHERE `d`.`status` != 'CONFIRMED' AND `r`.`userid`=%s " . $add . " ORDER BY `d`.`userid` ASC LIMIT 1", array( $userid ), __FUNCTION__, __LINE__); // Load count list($GLOBALS[__FUNCTION__][$userid][$level]) = SQL_FETCHROW($result); // Free result SQL_FREERESULT($result); } // END - if // Return it //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',level[' . gettype($level) . ']=' . $level . ':' . $GLOBALS[__FUNCTION__][$userid][$level] . ' - EXIT!'); return $GLOBALS[__FUNCTION__][$userid][$level]; } // Converts, if found, dollar data to get element function convertDollarDataToGetElement ($data) { // Is first char a dollar? if (substr($data, 0, 1) == chr(36)) { // Use last part for getRequestElement() $data = getRequestElement(substr($data, 1)); } // END - if // Return it return $data; } // Wrapper function for SQL layer to speed-up things function SQL_DEBUG_ENABLED () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = ((!isCssOutputMode()) && (isDebugModeEnabled()) && (isSqlDebuggingEnabled())); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // Wrapper function to wrap call of wordwrap() function wrapWords ($text) { // Wrap words $wrapped = wordwrap($test, getWordWrap()); // Return it return $wrapped; } // Encodes given data into a JSON object function encodeJson ($data) { // Encode it return json_encode($data, JSON_FORCE_OBJECT); } // Get all extension files function loadAllExtensionsByTemplate () { // Get all $extensions = getArrayFromDirectory( 'templates/' . getLanguage() . '/html/ext/', 'ext_', false, false, array(), '.tpl', '@(\.|\.\.)$@', false ); // Return them return $extensions; } // Wrapper function to allow full float values as supported by current database layout function translateFullComma ($dotted) { // Call inner function return translateComma($dotted, TRUE, 5); } // Wrapper to check if the first element to be shifted is set to given value function shift_array (&$array, $value, $key = '0') { // Is the element set and value matches? assert(is_array($array)); assert(isset($array[$key])); assert($array[$key] === $value); // Shift it array_shift($array); } // Wrapper for str_pad() with left padding zeros function padLeftZero ($str, $amount = 2) { // Is str_pad() there? if (function_exists('str_pad')) { // Use prependZeros() return prependZeros($str, $amount); } else { // Pad it return str_pad($str, $amount, '0', STR_PAD_LEFT); } } // [EOF] ?>