2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 04/04/2009 *
4 * =================== Last change: 04/04/2009 *
6 * -------------------------------------------------------------------- *
7 * File : wrapper-functions.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Wrapper functions *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Wrapper-Funktionen *
12 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
17 * -------------------------------------------------------------------- *
18 * Copyright (c) 2003 - 2009 by Roland Haeder *
19 * Copyright (c) 2009 - 2011 by Mailer Developer Team *
20 * For more information visit: http://www.mxchange.org *
22 * This program is free software; you can redistribute it and/or modify *
23 * it under the terms of the GNU General Public License as published by *
24 * the Free Software Foundation; either version 2 of the License, or *
25 * (at your option) any later version. *
27 * This program is distributed in the hope that it will be useful, *
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
30 * GNU General Public License for more details. *
32 * You should have received a copy of the GNU General Public License *
33 * along with this program; if not, write to the Free Software *
34 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
36 ************************************************************************/
38 // Some security stuff...
39 if (!defined('__SECURITY')) {
44 function readFromFile ($FQFN) {
45 // Sanity-check if file is there (should be there, but just to make it sure)
46 if (!isFileReadable($FQFN)) {
47 // This should not happen
48 debug_report_bug(__FUNCTION__, __LINE__, 'File ' . basename($FQFN) . ' is not readable!');
49 } elseif (!isset($GLOBALS['file_content'][$FQFN])) {
51 if (function_exists('file_get_contents')) {
53 $GLOBALS['file_content'][$FQFN] = file_get_contents($FQFN);
55 // Fall-back to implode-file chain
56 $GLOBALS['file_content'][$FQFN] = implode('', file($FQFN));
61 return $GLOBALS['file_content'][$FQFN];
64 // Writes content to a file
65 function writeToFile ($FQFN, $content, $aquireLock = false) {
66 // Is the file writeable?
67 if ((isFileReadable($FQFN)) && (!is_writeable($FQFN)) && (!changeMode($FQFN, 0644))) {
69 logDebugMessage(__FUNCTION__, __LINE__, sprintf("File %s not writeable.", basename($FQFN)));
75 // By default all is failed...
76 $GLOBALS['file_readable'][$FQFN] = false;
77 unset($GLOBALS['file_content'][$FQFN]);
80 // Is the function there?
81 if (function_exists('file_put_contents')) {
83 if ($aquireLock === true) {
84 // Write it directly with lock
85 $return = file_put_contents($FQFN, $content, LOCK_EX);
88 $return = file_put_contents($FQFN, $content);
91 // Write it with fopen
92 $fp = fopen($FQFN, 'w') or debug_report_bug(__FUNCTION__, __LINE__, 'Cannot write to file ' . basename($FQFN) . '!');
94 // Do we need to aquire a lock?
95 if ($aquireLock === true) {
101 $return = fwrite($fp, $content);
107 // Was something written?
108 if ($return !== false) {
109 // Mark it as readable
110 $GLOBALS['file_readable'][$FQFN] = true;
112 // Remember content in cache
113 $GLOBALS['file_content'][$FQFN] = $content;
117 return (($return !== false) && (changeMode($FQFN, 0644)));
120 // Clears the output buffer. This function does *NOT* backup sent content.
121 function clearOutputBuffer () {
122 // Trigger an error on failure
123 if ((ob_get_length() > 0) && (!ob_end_clean())) {
125 debug_report_bug(__FUNCTION__, __LINE__, 'Failed to clean output buffer.');
130 // @TODO Implement $compress
131 function encodeString ($str, $compress = true) {
132 $str = urlencode(base64_encode(compileUriCode($str)));
136 // Decode strings encoded with encodeString()
137 // @TODO Implement $decompress
138 function decodeString ($str, $decompress = true) {
139 $str = compileUriCode(base64_decode(urldecode(compileUriCode($str))));
143 // Decode entities in a nicer way
144 function decodeEntities ($str, $quote = ENT_NOQUOTES) {
145 // Decode the entities to UTF-8 now
146 $decodedString = html_entity_decode($str, $quote, 'UTF-8');
148 // Return decoded string
149 return $decodedString;
152 // Merges an array together but only if both are arrays
153 function merge_array ($array1, $array2) {
154 // Are both an array?
155 if ((!is_array($array1)) && (!is_array($array2))) {
156 // Both are not arrays
157 debug_report_bug(__FUNCTION__, __LINE__, 'No arrays provided!');
158 } elseif (!is_array($array1)) {
159 // Left one is not an array
160 debug_report_bug(__FUNCTION__, __LINE__, sprintf("array1 is not an array. array != %s", gettype($array1)));
161 } elseif (!is_array($array2)) {
162 // Right one is not an array
163 debug_report_bug(__FUNCTION__, __LINE__, sprintf("array2 is not an array. array != %s", gettype($array2)));
166 // Merge all together
167 return array_merge($array1, $array2);
170 // Check if given FQFN is a readable file
171 function isFileReadable ($FQFN) {
173 if (!isset($GLOBALS['file_readable'][$FQFN])) {
175 $GLOBALS['file_readable'][$FQFN] = ((file_exists($FQFN)) && (is_file($FQFN)) && (is_readable($FQFN)));
179 return $GLOBALS['file_readable'][$FQFN];
182 // Checks wether the given FQFN is a directory and not ., .. or .svn
183 function isDirectory ($FQFN) {
185 if (!isset($GLOBALS[__FUNCTION__][$FQFN])) {
187 $baseName = basename($FQFN);
190 $GLOBALS[__FUNCTION__][$FQFN] = ((is_dir($FQFN)) && ($baseName != '.') && ($baseName != '..') && ($baseName != '.svn'));
194 return $GLOBALS[__FUNCTION__][$FQFN];
197 // "Getter" for the real remote IP number
198 function detectRealIpAddress () {
199 // Get remote ip from environment
200 $remoteAddr = determineRealRemoteAddress();
202 // Is removeip installed?
203 if (isExtensionActive('removeip')) {
205 $remoteAddr = getAnonymousRemoteAddress($remoteAddr);
212 // "Getter" for remote IP number
213 function detectRemoteAddr () {
214 // Get remote ip from environment
215 $remoteAddr = determineRealRemoteAddress(true);
217 // Is removeip installed?
218 if (isExtensionActive('removeip')) {
220 $remoteAddr = getAnonymousRemoteAddress($remoteAddr);
227 // "Getter" for remote hostname
228 function detectRemoteHostname () {
229 // Get remote ip from environment
230 $remoteHost = getenv('REMOTE_HOST');
232 // Is removeip installed?
233 if (isExtensionActive('removeip')) {
235 $remoteHost = getAnonymousRemoteHost($remoteHost);
242 // "Getter" for user agent
243 function detectUserAgent ($alwaysReal = false) {
244 // Get remote ip from environment
245 $userAgent = getenv('HTTP_USER_AGENT');
247 // Is removeip installed?
248 if ((isExtensionActive('removeip')) && ($alwaysReal === false)) {
250 $userAgent = getAnonymousUserAgent($userAgent);
257 // "Getter" for referer
258 function detectReferer () {
259 // Get remote ip from environment
260 $referer = getenv('HTTP_REFERER');
262 // Is removeip installed?
263 if (isExtensionActive('removeip')) {
265 $referer = getAnonymousReferer($referer);
272 // "Getter" for request URI
273 function detectRequestUri () {
275 return (getenv('REQUEST_URI'));
278 // "Getter" for query string
279 function detectQueryString () {
280 return str_replace('&', '&', (getenv('QUERY_STRING')));
283 // "Getter" for SERVER_NAME
284 function detectServerName () {
286 return (getenv('SERVER_NAME'));
289 // Removes any existing www. from SERVER_NAME. This is very silly but enough
290 // for our purpose here.
291 function detectDomainName () {
293 if (!isset($GLOBALS[__FUNCTION__])) {
295 $domainName = detectServerName();
297 // Is there any www. ?
298 if (substr($domainName, 0, 4) == 'www.') {
300 $domainName = substr($domainName, 4);
304 $GLOBALS[__FUNCTION__] = $domainName;
308 return $GLOBALS[__FUNCTION__];
311 // Check wether we are installing
312 function isInstalling () {
313 // Determine wether we are installing
314 if (!isset($GLOBALS['mailer_installing'])) {
315 // Check URL (css.php/js.php need this)
316 $GLOBALS['mailer_installing'] = isGetRequestParameterSet('installing');
320 return $GLOBALS['mailer_installing'];
323 // Check wether this script is installed
324 function isInstalled () {
326 if (!isset($GLOBALS[__FUNCTION__])) {
327 // Determine wether this script is installed
328 $GLOBALS[__FUNCTION__] = (
333 isConfigEntrySet('MXCHANGE_INSTALLED')
335 getConfig('MXCHANGE_INSTALLED') == 'Y'
339 // New config file found and loaded
340 isIncludeReadable(getCachePath() . 'config-local.php')
343 // New config file found, but not yet read
344 isIncludeReadable(getCachePath() . 'config-local.php')
347 // Only new config file is found
348 !isIncludeReadable('inc/config.php')
350 // Is installation mode
357 // Then use the cache
358 return $GLOBALS[__FUNCTION__];
361 // Check wether an admin is registered
362 function isAdminRegistered () {
364 if (!isset($GLOBALS[__FUNCTION__])) {
366 $GLOBALS[__FUNCTION__] = ((isConfigEntrySet('ADMIN_REGISTERED')) && (getConfig('ADMIN_REGISTERED') == 'Y'));
370 return $GLOBALS[__FUNCTION__];
373 // Checks wether the hourly reset mode is active
374 function isHourlyResetEnabled () {
375 // Now simply check it
376 return ((isset($GLOBALS['hourly_enabled'])) && ($GLOBALS['hourly_enabled'] === true));
379 // Checks wether the reset mode is active
380 function isResetModeEnabled () {
381 // Now simply check it
382 return ((isset($GLOBALS['reset_enabled'])) && ($GLOBALS['reset_enabled'] === true));
385 // Checks wether the debug mode is enabled
386 function isDebugModeEnabled () {
388 if (!isset($GLOBALS[__FUNCTION__])) {
390 $GLOBALS[__FUNCTION__] = ((isConfigEntrySet('DEBUG_MODE')) && (getConfig('DEBUG_MODE') == 'Y'));
394 return $GLOBALS[__FUNCTION__];
397 // Checks wether the debug reset is enabled
398 function isDebugResetEnabled () {
400 if (!isset($GLOBALS[__FUNCTION__])) {
402 $GLOBALS[__FUNCTION__] = ((isConfigEntrySet('DEBUG_RESET')) && (getConfig('DEBUG_RESET') == 'Y'));
406 return $GLOBALS[__FUNCTION__];
409 // Checks wether SQL debugging is enabled
410 function isSqlDebuggingEnabled () {
412 if (!isset($GLOBALS[__FUNCTION__])) {
413 // Determine if SQL debugging is enabled
414 $GLOBALS[__FUNCTION__] = ((isConfigEntrySet('DEBUG_SQL')) && (getConfig('DEBUG_SQL') == 'Y'));
418 return $GLOBALS[__FUNCTION__];
421 // Checks wether we shall debug regular expressions
422 function isDebugRegularExpressionEnabled () {
424 if (!isset($GLOBALS[__FUNCTION__])) {
426 $GLOBALS[__FUNCTION__] = ((isConfigEntrySet('DEBUG_REGEX')) && (getConfig('DEBUG_REGEX') == 'Y'));
430 return $GLOBALS[__FUNCTION__];
433 // Checks wether the cache instance is valid
434 function isCacheInstanceValid () {
436 if (!isset($GLOBALS[__FUNCTION__])) {
438 $GLOBALS[__FUNCTION__] = ((isset($GLOBALS['cache_instance'])) && (is_object($GLOBALS['cache_instance'])));
442 return $GLOBALS[__FUNCTION__];
445 // Copies a file from source to destination and verifies if that goes fine.
446 // This function should wrap the copy() command and make a nicer debug backtrace
447 // even if there is no xdebug extension installed.
448 function copyFileVerified ($source, $dest, $chmod = '') {
449 // Failed is the default
452 // Is the source file there?
453 if (!isFileReadable($source)) {
455 debug_report_bug(__FUNCTION__, __LINE__, 'Cannot read from source file ' . basename($source) . '.');
458 // Is the target directory there?
459 if (!isDirectory(dirname($dest))) {
461 debug_report_bug(__FUNCTION__, __LINE__, 'Cannot find directory ' . str_replace(getPath(), '', dirname($dest)) . '.');
464 // Now try to copy it
465 if (!copy($source, $dest)) {
466 // Something went wrong
467 debug_report_bug(__FUNCTION__, __LINE__, 'copy() has failed to copy the file.');
470 $GLOBALS['file_readable'][$dest] = true;
473 // If there are chmod rights set, apply them
474 if (!empty($chmod)) {
476 $status = changeMode($dest, $chmod);
486 // Wrapper function for header()
487 // Send a header but checks before if we can do so
488 function sendHeader ($header) {
490 //* DEBUG: */ logDebugMessage(__FUNCTION__ . ': header=' . $header);
491 $GLOBALS['header'][] = trim($header);
494 // Flushes all headers
495 function flushHeaders () {
496 // Is the header already sent?
497 if (headers_sent()) {
499 debug_report_bug(__FUNCTION__, __LINE__, 'Headers already sent!');
502 // Flush all headers if found
503 if ((isset($GLOBALS['header'])) && (is_array($GLOBALS['header']))) {
504 foreach ($GLOBALS['header'] as $header) {
509 // Mark them as flushed
510 $GLOBALS['header'] = array();
513 // Wrapper function for chmod()
514 // @TODO Do some more sanity check here
515 function changeMode ($FQFN, $mode) {
516 // Is the file/directory there?
517 if ((!isFileReadable($FQFN)) && (!isDirectory($FQFN))) {
518 // Neither, so abort here
519 debug_report_bug(__FUNCTION__, __LINE__, 'Cannot chmod() on ' . basename($FQFN) . '.');
523 return chmod($FQFN, $mode);
526 // Wrapper for unlink()
527 function removeFile ($FQFN) {
528 // Is the file there?
529 if (isFileReadable($FQFN)) {
531 $GLOBALS['file_readable'][$FQFN] = false;
534 return unlink($FQFN);
537 // All fine if no file was removed. If we change this to 'false' or rewrite
538 // above if() block it would be to restrictive.
542 // Wrapper for $_POST['sel']
543 function countPostSelection ($element = 'sel') {
545 if (isPostRequestParameterSet($element)) {
546 // Return counted elements
547 return countSelection(postRequestParameter($element));
549 // Return zero if not found
554 // Checks wether the config-local.php is loaded
555 function isConfigLocalLoaded () {
556 return ((isset($GLOBALS['config_local_loaded'])) && ($GLOBALS['config_local_loaded'] === true));
559 // Checks wether a nickname or userid was entered and caches the result
560 function isNicknameUsed ($userid) {
561 // Is the cache there
562 if (!isset($GLOBALS[__FUNCTION__][$userid])) {
564 $GLOBALS[__FUNCTION__][$userid] = ((!empty($userid)) && (('' . round($userid) . '') != $userid));
568 return $GLOBALS[__FUNCTION__][$userid];
571 // Getter for 'what' value
572 function getWhat () {
577 if (isWhatSet(true)) {
579 $what = $GLOBALS['what'];
586 // Setter for 'what' value
587 function setWhat ($newWhat) {
588 $GLOBALS['what'] = SQL_ESCAPE($newWhat);
591 // Setter for 'what' from configuration
592 function setWhatFromConfig ($configEntry) {
593 // Get 'what' from config
594 $what = getConfig($configEntry);
600 // Checks wether what is set and optionally aborts on miss
601 function isWhatSet ($strict = false) {
603 $isset = isset($GLOBALS['what']);
605 // Should we abort here?
606 if (($strict === true) && ($isset === false)) {
608 debug_report_bug(__FUNCTION__, __LINE__, 'what is empty.');
615 // Getter for 'action' value
616 function getAction ($strict = true) {
621 if (isActionSet(($strict) && (isHtmlOutputMode()))) {
623 $action = $GLOBALS['action'];
630 // Setter for 'action' value
631 function setAction ($newAction) {
632 $GLOBALS['action'] = SQL_ESCAPE($newAction);
635 // Checks wether action is set and optionally aborts on miss
636 function isActionSet ($strict = false) {
638 $isset = ((isset($GLOBALS['action'])) && (!empty($GLOBALS['action'])));
640 // Should we abort here?
641 if (($strict === true) && ($isset === false)) {
643 debug_report_bug(__FUNCTION__, __LINE__, 'action is empty.');
650 // Getter for 'module' value
651 function getModule ($strict = true) {
656 if (isModuleSet($strict)) {
658 $module = $GLOBALS['module'];
665 // Setter for 'module' value
666 function setModule ($newModule) {
667 // Secure it and make all modules lower-case
668 $GLOBALS['module'] = SQL_ESCAPE(strtolower($newModule));
671 // Checks wether module is set and optionally aborts on miss
672 function isModuleSet ($strict = false) {
674 $isset = (!empty($GLOBALS['module']));
676 // Should we abort here?
677 if (($strict === true) && ($isset === false)) {
679 debug_report_bug(__FUNCTION__, __LINE__, 'module is empty.');
683 return (($isset === true) && ($GLOBALS['module'] != 'unknown')) ;
686 // Getter for 'output_mode' value
687 function getScriptOutputMode () {
689 if (!isset($GLOBALS[__FUNCTION__])) {
694 if (isOutputModeSet(true)) {
696 $output_mode = $GLOBALS['output_mode'];
700 $GLOBALS[__FUNCTION__] = $output_mode;
704 return $GLOBALS[__FUNCTION__];
707 // Setter for 'output_mode' value
708 function setOutputMode ($newOutputMode) {
709 $GLOBALS['output_mode'] = (int) $newOutputMode;
712 // Checks wether output_mode is set and optionally aborts on miss
713 function isOutputModeSet ($strict = false) {
715 $isset = (isset($GLOBALS['output_mode']));
717 // Should we abort here?
718 if (($strict === true) && ($isset === false)) {
720 debug_report_bug(__FUNCTION__, __LINE__, 'Output mode is not set.');
727 // Enables block-mode
728 function enableBlockMode ($enabled = true) {
729 $GLOBALS['block_mode'] = $enabled;
732 // Checks wether block-mode is enabled
733 function isBlockModeEnabled () {
735 if (!isset($GLOBALS['block_mode'])) {
737 debug_report_bug(__FUNCTION__, __LINE__, 'Block_mode is not set.');
741 return $GLOBALS['block_mode'];
745 * Wrapper function for addPointsThroughReferalSystem(), you should generally
746 * avoid this function and use addPointsThroughReferalSystem() directly and add
747 * your special payment method entry to points_data instead.
749 * @param $subject A string-encoded subject for this add
750 * @param $userid The recipient (member) for given points
751 * @param $points Points to be added to member's account
752 * @return $added Wether the points has been added to the user's account
754 function addPointsDirectly ($subject, $userid, $points) {
758 // Call more complicated method (due to more parameters)
759 return addPointsThroughReferalSystem($subject, $userid, $points, false, 0, 'DIRECT');
762 // Wrapper for redirectToUrl but URL comes from a configuration entry
763 function redirectToConfiguredUrl ($configEntry) {
765 redirectToUrl(getConfig($configEntry));
768 // Wrapper function to redirect from member-only modules to index
769 function redirectToIndexMemberOnlyModule () {
770 // Do the redirect here
771 redirectToUrl('modules.php?module=index&code=' . getCode('MODULE_MEMBER_ONLY') . '&mod=' . getModule());
774 // Wrapper function to redirect to current URL
775 function redirectToRequestUri () {
776 redirectToUrl(basename(detectRequestUri()));
779 // Wrapper function to redirect to de-refered URL
780 function redirectToDereferedUrl ($url) {
782 redirectToUrl(generateDerefererUrl($url));
785 // Wrapper function for checking if extension is installed and newer or same version
786 function isExtensionInstalledAndNewer ($ext_name, $version) {
787 // Is an cache entry found?
788 if (!isset($GLOBALS[__FUNCTION__][$ext_name][$version])) {
790 $GLOBALS[__FUNCTION__][$ext_name][$version] = ((isExtensionInstalled($ext_name)) && (getExtensionVersion($ext_name) >= $version));
792 // Cache hits should be incremented twice
793 incrementStatsEntry('cache_hits', 2);
797 //* DEBUG: */ debugOutput(__FUNCTION__ . ':' . $ext_name . '=>' . $version . ':' . intval($GLOBALS[__FUNCTION__][$ext_name][$version]));
798 return $GLOBALS[__FUNCTION__][$ext_name][$version];
801 // Wrapper function for checking if extension is installed and older than given version
802 function isExtensionInstalledAndOlder ($ext_name, $version) {
803 // Is an cache entry found?
804 if (!isset($GLOBALS[__FUNCTION__][$ext_name][$version])) {
806 $GLOBALS[__FUNCTION__][$ext_name][$version] = ((isExtensionInstalled($ext_name)) && (isExtensionOlder($ext_name, $version)));
808 // Cache hits should be incremented twice
809 incrementStatsEntry('cache_hits', 2);
813 //* DEBUG: */ debugOutput(__FUNCTION__ . ':' . $ext_name . '<' . $version . ':' . intval($GLOBALS[__FUNCTION__][$ext_name][$version]));
814 return $GLOBALS[__FUNCTION__][$ext_name][$version];
818 function setUsername ($userName) {
819 $GLOBALS['username'] = (string) $userName;
823 function getUsername () {
825 if (!isset($GLOBALS['username'])) {
826 // No, so it has to be a guest
827 $GLOBALS['username'] = '{--USERNAME_GUEST--}';
831 return $GLOBALS['username'];
834 // Wrapper function for installation phase
835 function isInstallationPhase () {
837 if (!isset($GLOBALS[__FUNCTION__])) {
839 $GLOBALS[__FUNCTION__] = ((!isInstalled()) || (isInstalling()));
843 return $GLOBALS[__FUNCTION__];
846 // Checks wether the extension demo is actuve and the admin login is demo (password needs to be demo, too!)
847 function isDemoModeActive () {
849 if (!isset($GLOBALS[__FUNCTION__])) {
851 $GLOBALS[__FUNCTION__] = ((isExtensionActive('demo')) && (getCurrentAdminLogin() == 'demo'));
855 return $GLOBALS[__FUNCTION__];
858 // Getter for PHP caching value
859 function getPhpCaching () {
860 return $GLOBALS['php_caching'];
863 // Checks wether the admin hash is set
864 function isAdminHashSet ($adminId) {
865 // Is the array there?
866 if (!isset($GLOBALS['cache_array']['admin'])) {
867 // Missing array should be reported
868 debug_report_bug(__FUNCTION__, __LINE__, 'Cache not set.');
871 // Check for admin hash
872 return isset($GLOBALS['cache_array']['admin']['password'][$adminId]);
875 // Setter for admin hash
876 function setAdminHash ($adminId, $hash) {
877 $GLOBALS['cache_array']['admin']['password'][$adminId] = $hash;
880 // Getter for current admin login
881 function getCurrentAdminLogin () {
883 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'called!');
886 if (!isset($GLOBALS[__FUNCTION__])) {
888 $GLOBALS[__FUNCTION__] = getAdminLogin(getCurrentAdminId());
892 return $GLOBALS[__FUNCTION__];
895 // Setter for admin id (and current)
896 function setAdminId ($adminId) {
898 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'adminId=' . $adminId);
901 $status = setSession('admin_id', bigintval($adminId));
904 setCurrentAdminId($adminId);
910 // Setter for admin_last
911 function setAdminLast ($adminLast) {
913 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'adminLast=' . $adminLast);
916 $status = setSession('admin_last', $adminLast);
922 // Setter for admin_md5
923 function setAdminMd5 ($adminMd5) {
925 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'adminMd5=' . $adminMd5);
928 $status = setSession('admin_md5', $adminMd5);
934 // Getter for admin_md5
935 function getAdminMd5 () {
937 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'called!');
940 return getSession('admin_md5');
943 // Init user data array
944 function initUserData () {
945 // User id should not be zero
946 if (!isValidUserId(getCurrentUserId())) {
947 // Should be always valid
948 debug_report_bug(__FUNCTION__, __LINE__, 'Current user id is invalid: ' . getCurrentUserId());
952 unset($GLOBALS['is_userdata_valid'][getCurrentUserId()]);
953 $GLOBALS['user_data'][getCurrentUserId()] = array();
956 // Getter for user data
957 function getUserData ($column) {
958 // User id should not be zero
959 if (!isValidUserId(getCurrentUserId())) {
960 // Should be always valid
961 debug_report_bug(__FUNCTION__, __LINE__, 'Current user id is invalid: ' . getCurrentUserId());
967 if (isset($GLOBALS['user_data'][getCurrentUserId()][$column])) {
969 $data = $GLOBALS['user_data'][getCurrentUserId()][$column];
976 // Checks wether given user data is set to 'Y'
977 function isUserDataEnabled ($column) {
979 if (!isset($GLOBALS[__FUNCTION__][getCurrentUserId()][$column])) {
981 $GLOBALS[__FUNCTION__][getCurrentUserId()][$column] = (getUserData($column) == 'Y');
985 return $GLOBALS[__FUNCTION__][getCurrentUserId()][$column];
988 // Geter for whole user data array
989 function getUserDataArray () {
991 $userid = getCurrentUserId();
993 // Is the current userid valid?
994 if (!isValidUserId($userid)) {
995 // Should be always valid
996 debug_report_bug(__FUNCTION__, __LINE__, 'Current user id is invalid: ' . $userid);
999 // Get the whole array if found
1000 if (isset($GLOBALS['user_data'][$userid])) {
1001 // Found, so return it
1002 return $GLOBALS['user_data'][$userid];
1004 // Return empty array
1009 // Checks if the user data is valid, this may indicate that the user has logged
1010 // in, but you should use isMember() if you want to find that out.
1011 function isUserDataValid () {
1012 // User id should not be zero so abort here
1013 if (!isCurrentUserIdSet()) {
1018 if (!isset($GLOBALS['is_userdata_valid'][getCurrentUserId()])) {
1020 $GLOBALS['is_userdata_valid'][getCurrentUserId()] = ((isset($GLOBALS['user_data'][getCurrentUserId()])) && (count($GLOBALS['user_data'][getCurrentUserId()]) > 1));
1023 // Return the result
1024 return $GLOBALS['is_userdata_valid'][getCurrentUserId()];
1027 // Setter for current userid
1028 function setCurrentUserId ($userid) {
1030 $GLOBALS['current_userid'] = bigintval($userid);
1032 // Unset it to re-determine the actual state
1033 unset($GLOBALS['is_userdata_valid'][$userid]);
1036 // Getter for current userid
1037 function getCurrentUserId () {
1038 // Userid must be set before it can be used
1039 if (!isCurrentUserIdSet()) {
1041 debug_report_bug(__FUNCTION__, __LINE__, 'User id is not set.');
1044 // Return the userid
1045 return $GLOBALS['current_userid'];
1048 // Checks if current userid is set
1049 function isCurrentUserIdSet () {
1050 return ((isset($GLOBALS['current_userid'])) && (isValidUserId($GLOBALS['current_userid'])));
1053 // Checks wether we are debugging template cache
1054 function isDebuggingTemplateCache () {
1055 // Do we have cache?
1056 if (!isset($GLOBALS[__FUNCTION__])) {
1058 $GLOBALS[__FUNCTION__] = (getConfig('DEBUG_TEMPLATE_CACHE') == 'Y');
1062 return $GLOBALS[__FUNCTION__];
1065 // Wrapper for fetchUserData() and getUserData() calls
1066 function getFetchedUserData ($keyColumn, $userid, $valueColumn) {
1067 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'keyColumn=' . $keyColumn . ',userid=' . $userid . ',valueColumn=' . $valueColumn . ' - ENTERED!');
1069 if (!isset($GLOBALS[__FUNCTION__][$userid][$keyColumn][$valueColumn])) {
1073 // Can we fetch the user data?
1074 if ((isValidUserId($userid)) && (fetchUserData($userid, $keyColumn))) {
1075 // Now get the data back
1076 $data = getUserData($valueColumn);
1080 $GLOBALS[__FUNCTION__][$userid][$keyColumn][$valueColumn] = $data;
1084 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'keyColumn=' . $keyColumn . ',userid=' . $userid . ',valueColumn=' . $valueColumn . ',value=' . $GLOBALS[__FUNCTION__][$userid][$keyColumn][$valueColumn] . ' - EXIT!');
1085 return $GLOBALS[__FUNCTION__][$userid][$keyColumn][$valueColumn];
1088 // Wrapper for strpos() to ease porting from deprecated ereg() function
1089 function isInString ($needle, $haystack) {
1090 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'needle=' . $needle . ', haystack=' . $haystack . ', returned=' . intval(strpos($haystack, $needle) !== false));
1091 return (strpos($haystack, $needle) !== false);
1094 // Wrapper for strpos() to ease porting from deprecated eregi() function
1095 // This function is case-insensitive
1096 function isInStringIgnoreCase ($needle, $haystack) {
1097 return (isInString(strtolower($needle), strtolower($haystack)));
1100 // Wrapper to check for if fatal errors where detected
1101 function ifFatalErrorsDetected () {
1102 // Just call the inner function
1103 return (getTotalFatalErrors() > 0);
1106 // Setter for HTTP status
1107 function setHttpStatus ($status) {
1108 $GLOBALS['http_status'] = (string) $status;
1111 // Getter for HTTP status
1112 function getHttpStatus () {
1113 // Is the status set?
1114 if (!isset($GLOBALS['http_status'])) {
1116 debug_report_bug(__FUNCTION__, __LINE__, 'No HTTP status set!');
1120 return $GLOBALS['http_status'];
1124 * Send a HTTP redirect to the browser. This function was taken from DokuWiki
1125 * (GNU GPL 2; http://www.dokuwiki.org) and modified to fit into mailer project.
1127 * ----------------------------------------------------------------------------
1128 * If you want to redirect, please use redirectToUrl(); instead
1129 * ----------------------------------------------------------------------------
1131 * Works arround Microsoft IIS cookie sending bug. Does exit the script.
1133 * @link http://support.microsoft.com/kb/q176113/
1134 * @author Andreas Gohr <andi@splitbrain.org>
1137 function sendRawRedirect ($url) {
1138 // Send helping header
1139 setHttpStatus('302 Found');
1141 // always close the session
1142 session_write_close();
1144 // Revert entity &
1145 $url = str_replace('&', '&', $url);
1147 // check if running on IIS < 6 with CGI-PHP
1148 if ((isset($_SERVER['SERVER_SOFTWARE'])) && (isset($_SERVER['GATEWAY_INTERFACE'])) &&
1149 (strpos($_SERVER['GATEWAY_INTERFACE'], 'CGI') !== false) &&
1150 (preg_match('|^Microsoft-IIS/(\d)\.\d$|', trim($_SERVER['SERVER_SOFTWARE']), $matches)) &&
1151 ($matches[1] < 6)) {
1152 // Send the IIS header
1153 sendHeader('Refresh: 0;url=' . $url);
1155 // Send generic header
1156 sendHeader('Location: ' . $url);
1163 // Determines the country of the given user id
1164 function determineCountry ($userid) {
1165 // Do we have cache?
1166 if (!isset($GLOBALS[__FUNCTION__][$userid])) {
1167 // Default is 'invalid'
1168 $GLOBALS[__FUNCTION__][$userid] = 'invalid';
1170 // Is extension country active?
1171 if (isExtensionActive('country')) {
1172 // Determine the right country code through the country id
1173 $id = getUserData('country_code');
1175 // Then handle it over
1176 $GLOBALS[__FUNCTION__][$userid] = generateCountryInfo($id);
1178 // Get raw code from user data
1179 $GLOBALS[__FUNCTION__][$userid] = getUserData('country');
1184 return $GLOBALS[__FUNCTION__][$userid];
1187 // "Getter" for total confirmed user accounts
1188 function getTotalConfirmedUser () {
1190 if (!isset($GLOBALS[__FUNCTION__])) {
1192 if (isExtensionActive('user')) {
1193 $GLOBALS[__FUNCTION__] = countSumTotalData('CONFIRMED', 'user_data', 'userid', 'status', true);
1195 $GLOBALS[__FUNCTION__] = 0;
1199 // Return cached value
1200 return $GLOBALS[__FUNCTION__];
1203 // "Getter" for total unconfirmed user accounts
1204 function getTotalUnconfirmedUser () {
1206 if (!isset($GLOBALS[__FUNCTION__])) {
1208 if (isExtensionActive('user')) {
1209 $GLOBALS[__FUNCTION__] = countSumTotalData('UNCONFIRMED', 'user_data', 'userid', 'status', true);
1211 $GLOBALS[__FUNCTION__] = 0;
1215 // Return cached value
1216 return $GLOBALS[__FUNCTION__];
1219 // "Getter" for total locked user accounts
1220 function getTotalLockedUser () {
1222 if (!isset($GLOBALS[__FUNCTION__])) {
1224 if (isExtensionActive('user')) {
1225 $GLOBALS[__FUNCTION__] = countSumTotalData('LOCKED', 'user_data', 'userid', 'status', true);
1227 $GLOBALS[__FUNCTION__] = 0;
1231 // Return cached value
1232 return $GLOBALS[__FUNCTION__];
1235 // "Getter" for total locked user accounts
1236 function getTotalRandomRefidUser () {
1238 if (!isset($GLOBALS[__FUNCTION__])) {
1240 if (isExtensionInstalledAndNewer('user', '0.3.4')) {
1241 $GLOBALS[__FUNCTION__] = countSumTotalData('{?user_min_confirmed?}', 'user_data', 'userid', 'rand_confirmed', true, '', '>=');
1243 $GLOBALS[__FUNCTION__] = 0;
1247 // Return cached value
1248 return $GLOBALS[__FUNCTION__];
1251 // Is given userid valid?
1252 function isValidUserId ($userid) {
1253 // Do we have cache?
1254 if (!isset($GLOBALS[__FUNCTION__][$userid])) {
1256 $GLOBALS[__FUNCTION__][$userid] = ((!is_null($userid)) && (!empty($userid)) && ($userid > 0));
1260 return $GLOBALS[__FUNCTION__][$userid];
1264 function encodeEntities ($str) {
1266 $str = secureString($str, true, true);
1268 // Encode dollar sign as well
1269 $str = str_replace('$', '$', $str);
1275 // "Getter" for date from patch_ctime
1276 function getDateFromRepository () {
1278 if (!isset($GLOBALS[__FUNCTION__])) {
1280 $GLOBALS[__FUNCTION__] = generateDateTime(getConfig('CURRENT_REPOSITORY_DATE'), '5');
1284 return $GLOBALS[__FUNCTION__];
1287 // "Getter" for date/time from patch_ctime
1288 function getDateTimeFromRepository () {
1290 if (!isset($GLOBALS[__FUNCTION__])) {
1292 $GLOBALS[__FUNCTION__] = generateDateTime(getConfig('CURRENT_REPOSITORY_DATE'), '2');
1296 return $GLOBALS[__FUNCTION__];
1299 // Getter for current year (default)
1300 function getYear ($timestamp = NULL) {
1302 if (!isset($GLOBALS[__FUNCTION__][$timestamp])) {
1304 if (is_null($timestamp)) {
1305 $timestamp = time();
1309 $GLOBALS[__FUNCTION__][$timestamp] = date('Y', $timestamp);
1313 return $GLOBALS[__FUNCTION__][$timestamp];
1316 // Getter for current month (default)
1317 function getMonth ($timestamp = NULL) {
1319 if (!isset($GLOBALS[__FUNCTION__][$timestamp])) {
1320 // If null is set, use time()
1321 if (is_null($timestamp)) {
1322 // Use time() which is current timestamp
1323 $timestamp = time();
1327 $GLOBALS[__FUNCTION__][$timestamp] = date('m', $timestamp);
1331 return $GLOBALS[__FUNCTION__][$timestamp];
1334 // Getter for current hour (default)
1335 function getHour ($timestamp = NULL) {
1337 if (!isset($GLOBALS[__FUNCTION__][$timestamp])) {
1339 if (is_null($timestamp)) {
1340 $timestamp = time();
1344 $GLOBALS[__FUNCTION__][$timestamp] = date('H', $timestamp);
1348 return $GLOBALS[__FUNCTION__][$timestamp];
1351 // Getter for current day (default)
1352 function getDay ($timestamp = NULL) {
1354 if (!isset($GLOBALS[__FUNCTION__][$timestamp])) {
1356 if (is_null($timestamp)) {
1357 $timestamp = time();
1361 $GLOBALS[__FUNCTION__][$timestamp] = date('d', $timestamp);
1365 return $GLOBALS[__FUNCTION__][$timestamp];
1368 // Getter for current week (default)
1369 function getWeek ($timestamp = NULL) {
1371 if (!isset($GLOBALS[__FUNCTION__][$timestamp])) {
1373 if (is_null($timestamp)) $timestamp = time();
1376 $GLOBALS[__FUNCTION__][$timestamp] = date('W', $timestamp);
1380 return $GLOBALS[__FUNCTION__][$timestamp];
1383 // Getter for current short_hour (default)
1384 function getShortHour ($timestamp = NULL) {
1386 if (!isset($GLOBALS[__FUNCTION__][$timestamp])) {
1388 if (is_null($timestamp)) $timestamp = time();
1391 $GLOBALS[__FUNCTION__][$timestamp] = date('G', $timestamp);
1395 return $GLOBALS[__FUNCTION__][$timestamp];
1398 // Getter for current long_hour (default)
1399 function getLongHour ($timestamp = NULL) {
1401 if (!isset($GLOBALS[__FUNCTION__][$timestamp])) {
1403 if (is_null($timestamp)) $timestamp = time();
1406 $GLOBALS[__FUNCTION__][$timestamp] = date('H', $timestamp);
1410 return $GLOBALS[__FUNCTION__][$timestamp];
1413 // Getter for current second (default)
1414 function getSecond ($timestamp = NULL) {
1416 if (!isset($GLOBALS[__FUNCTION__][$timestamp])) {
1418 if (is_null($timestamp)) $timestamp = time();
1421 $GLOBALS[__FUNCTION__][$timestamp] = date('s', $timestamp);
1425 return $GLOBALS[__FUNCTION__][$timestamp];
1428 // Getter for current minute (default)
1429 function getMinute ($timestamp = NULL) {
1431 if (!isset($GLOBALS[__FUNCTION__][$timestamp])) {
1433 if (is_null($timestamp)) $timestamp = time();
1436 $GLOBALS[__FUNCTION__][$timestamp] = date('i', $timestamp);
1440 return $GLOBALS[__FUNCTION__][$timestamp];
1443 // Checks wether the title decoration is enabled
1444 function isTitleDecorationEnabled () {
1445 // Do we have cache?
1446 if (!isset($GLOBALS[__FUNCTION__])) {
1448 $GLOBALS[__FUNCTION__] = (getConfig('enable_title_deco') == 'Y');
1452 return $GLOBALS[__FUNCTION__];
1455 // Checks wether filter usage updates are enabled (expensive queries!)
1456 function isFilterUsageUpdateEnabled () {
1457 // Do we have cache?
1458 if (!isset($GLOBALS[__FUNCTION__])) {
1460 $GLOBALS[__FUNCTION__] = ((isExtensionInstalledAndNewer('sql_patches', '0.6.0')) && (isConfigEntrySet('update_filter_usage')) && (getConfig('update_filter_usage') == 'Y'));
1464 return $GLOBALS[__FUNCTION__];
1467 // Checks wether debugging of weekly resets is enabled
1468 function isWeeklyResetDebugEnabled () {
1469 // Do we have cache?
1470 if (!isset($GLOBALS[__FUNCTION__])) {
1472 $GLOBALS[__FUNCTION__] = ((isConfigEntrySet('DEBUG_WEEKLY')) && (getConfig('DEBUG_WEEKLY') == 'Y'));
1476 return $GLOBALS[__FUNCTION__];
1479 // Checks wether debugging of monthly resets is enabled
1480 function isMonthlyResetDebugEnabled () {
1481 // Do we have cache?
1482 if (!isset($GLOBALS[__FUNCTION__])) {
1484 $GLOBALS[__FUNCTION__] = ((isConfigEntrySet('DEBUG_MONTHLY')) && (getConfig('DEBUG_MONTHLY') == 'Y'));
1488 return $GLOBALS[__FUNCTION__];
1491 // Checks wether displaying of debug SQLs are enabled
1492 function isDisplayDebugSqlEnabled () {
1493 // Do we have cache?
1494 if (!isset($GLOBALS[__FUNCTION__])) {
1496 $GLOBALS[__FUNCTION__] = ((isExtensionInstalledAndNewer('other', '0.2.2')) && (getConfig('display_debug_sqls') == 'Y'));
1500 return $GLOBALS[__FUNCTION__];
1503 // Checks wether module title is enabled
1504 function isModuleTitleEnabled () {
1505 // Do we have cache?
1506 if (!isset($GLOBALS[__FUNCTION__])) {
1508 $GLOBALS[__FUNCTION__] = (getConfig('enable_mod_title') == 'Y');
1512 return $GLOBALS[__FUNCTION__];
1515 // Checks wether what title is enabled
1516 function isWhatTitleEnabled () {
1517 // Do we have cache?
1518 if (!isset($GLOBALS[__FUNCTION__])) {
1520 $GLOBALS[__FUNCTION__] = (getConfig('enable_what_title') == 'Y');
1524 return $GLOBALS[__FUNCTION__];
1527 // Checks wether stats are enabled
1528 function ifStatsAreEnabled () {
1529 // Do we have cache?
1530 if (!isset($GLOBALS[__FUNCTION__])) {
1531 // Then determine it
1532 $GLOBALS[__FUNCTION__] = (getConfig('stats_enabled') == 'Y');
1535 // Return cached value
1536 return $GLOBALS[__FUNCTION__];
1539 // Checks wether admin-notification of certain user actions is enabled
1540 function isAdminNotificationEnabled () {
1541 // Do we have cache?
1542 if (!isset($GLOBALS[__FUNCTION__])) {
1544 $GLOBALS[__FUNCTION__] = (getConfig('admin_notify') == 'Y');
1548 return $GLOBALS[__FUNCTION__];
1551 // Checks wether random referal id selection is enabled
1552 function isRandomReferalIdEnabled () {
1553 // Do we have cache?
1554 if (!isset($GLOBALS[__FUNCTION__])) {
1556 $GLOBALS[__FUNCTION__] = ((isExtensionInstalledAndNewer('user', '0.3.4')) && (getConfig('select_user_zero_refid') == 'Y'));
1560 return $GLOBALS[__FUNCTION__];
1563 // "Getter" for default language
1564 function getDefaultLanguage () {
1565 // Do we have cache?
1566 if (!isset($GLOBALS[__FUNCTION__])) {
1568 $GLOBALS[__FUNCTION__] = getConfig('DEFAULT_LANG');
1572 return $GLOBALS[__FUNCTION__];
1575 // "Getter" for default referal id
1576 function getDefRefid () {
1577 // Do we have cache?
1578 if (!isset($GLOBALS[__FUNCTION__])) {
1580 $GLOBALS[__FUNCTION__] = getConfig('def_refid');
1584 return $GLOBALS[__FUNCTION__];
1587 // "Getter" for path
1588 function getPath () {
1589 // Do we have cache?
1590 if (!isset($GLOBALS[__FUNCTION__])) {
1592 $GLOBALS[__FUNCTION__] = getConfig('PATH');
1596 return $GLOBALS[__FUNCTION__];
1600 function getUrl () {
1601 // Do we have cache?
1602 if (!isset($GLOBALS[__FUNCTION__])) {
1604 $GLOBALS[__FUNCTION__] = getConfig('URL');
1608 return $GLOBALS[__FUNCTION__];
1611 // "Getter" for cache_path
1612 function getCachePath () {
1613 // Do we have cache?
1614 if (!isset($GLOBALS[__FUNCTION__])) {
1616 $GLOBALS[__FUNCTION__] = getConfig('CACHE_PATH');
1620 return $GLOBALS[__FUNCTION__];
1623 // "Getter" for secret_key
1624 function getSecretKey () {
1625 // Do we have cache?
1626 if (!isset($GLOBALS[__FUNCTION__])) {
1628 $GLOBALS[__FUNCTION__] = getConfig('secret_key');
1632 return $GLOBALS[__FUNCTION__];
1635 // "Getter" for SITE_KEY
1636 function getSiteKey () {
1637 // Do we have cache?
1638 if (!isset($GLOBALS[__FUNCTION__])) {
1640 $GLOBALS[__FUNCTION__] = getConfig('SITE_KEY');
1644 return $GLOBALS[__FUNCTION__];
1647 // "Getter" for DATE_KEY
1648 function getDateKey () {
1649 // Do we have cache?
1650 if (!isset($GLOBALS[__FUNCTION__])) {
1652 $GLOBALS[__FUNCTION__] = getConfig('DATE_KEY');
1656 return $GLOBALS[__FUNCTION__];
1659 // "Getter" for master_salt
1660 function getMasterSalt () {
1661 // Do we have cache?
1662 if (!isset($GLOBALS[__FUNCTION__])) {
1664 $GLOBALS[__FUNCTION__] = getConfig('master_salt');
1668 return $GLOBALS[__FUNCTION__];
1671 // "Getter" for prime
1672 function getPrime () {
1673 // Do we have cache?
1674 if (!isset($GLOBALS[__FUNCTION__])) {
1676 $GLOBALS[__FUNCTION__] = getConfig('_PRIME');
1680 return $GLOBALS[__FUNCTION__];
1683 // "Getter" for encrypt_seperator
1684 function getEncryptSeperator () {
1685 // Do we have cache?
1686 if (!isset($GLOBALS[__FUNCTION__])) {
1688 $GLOBALS[__FUNCTION__] = getConfig('ENCRYPT_SEPERATOR');
1692 return $GLOBALS[__FUNCTION__];
1695 // "Getter" for mysql_prefix
1696 function getMysqlPrefix () {
1697 // Do we have cache?
1698 if (!isset($GLOBALS[__FUNCTION__])) {
1700 $GLOBALS[__FUNCTION__] = getConfig('_MYSQL_PREFIX');
1704 return $GLOBALS[__FUNCTION__];
1707 // "Getter" for table_type
1708 function getTableType () {
1709 // Do we have cache?
1710 if (!isset($GLOBALS[__FUNCTION__])) {
1712 $GLOBALS[__FUNCTION__] = getConfig('_TABLE_TYPE');
1716 return $GLOBALS[__FUNCTION__];
1719 // "Getter" for salt_length
1720 function getSaltLength () {
1721 // Do we have cache?
1722 if (!isset($GLOBALS[__FUNCTION__])) {
1724 $GLOBALS[__FUNCTION__] = getConfig('salt_length');
1728 return $GLOBALS[__FUNCTION__];
1731 // "Getter" for output_mode
1732 function getOutputMode () {
1733 // Do we have cache?
1734 if (!isset($GLOBALS[__FUNCTION__])) {
1736 $GLOBALS[__FUNCTION__] = getConfig('OUTPUT_MODE');
1740 return $GLOBALS[__FUNCTION__];
1743 // "Getter" for full_version
1744 function getFullVersion () {
1745 // Do we have cache?
1746 if (!isset($GLOBALS[__FUNCTION__])) {
1748 $GLOBALS[__FUNCTION__] = getConfig('FULL_VERSION');
1752 return $GLOBALS[__FUNCTION__];
1755 // "Getter" for title
1756 function getTitle () {
1757 // Do we have cache?
1758 if (!isset($GLOBALS[__FUNCTION__])) {
1760 $GLOBALS[__FUNCTION__] = getConfig('TITLE');
1764 return $GLOBALS[__FUNCTION__];
1767 // "Getter" for curr_svn_revision
1768 function getCurrentRepositoryRevision () {
1769 // Do we have cache?
1770 if (!isset($GLOBALS[__FUNCTION__])) {
1772 $GLOBALS[__FUNCTION__] = getConfig('CURRENT_REPOSITORY_REVISION');
1776 return $GLOBALS[__FUNCTION__];
1779 // "Getter" for server_url
1780 function getServerUrl () {
1781 // Do we have cache?
1782 if (!isset($GLOBALS[__FUNCTION__])) {
1784 $GLOBALS[__FUNCTION__] = getConfig('SERVER_URL');
1788 return $GLOBALS[__FUNCTION__];
1791 // "Getter" for mt_word
1792 function getMtWord () {
1793 // Do we have cache?
1794 if (!isset($GLOBALS[__FUNCTION__])) {
1796 $GLOBALS[__FUNCTION__] = getConfig('mt_word');
1800 return $GLOBALS[__FUNCTION__];
1803 // "Getter" for mt_word2
1804 function getMtWord2 () {
1805 // Do we have cache?
1806 if (!isset($GLOBALS[__FUNCTION__])) {
1808 $GLOBALS[__FUNCTION__] = getConfig('mt_word2');
1812 return $GLOBALS[__FUNCTION__];
1815 // "Getter" for main_title
1816 function getMainTitle () {
1817 // Do we have cache?
1818 if (!isset($GLOBALS[__FUNCTION__])) {
1820 $GLOBALS[__FUNCTION__] = getConfig('MAIN_TITLE');
1824 return $GLOBALS[__FUNCTION__];
1827 // "Getter" for file_hash
1828 function getFileHash () {
1829 // Do we have cache?
1830 if (!isset($GLOBALS[__FUNCTION__])) {
1832 $GLOBALS[__FUNCTION__] = getConfig('file_hash');
1836 return $GLOBALS[__FUNCTION__];
1839 // "Getter" for pass_scramble
1840 function getPassScramble () {
1841 // Do we have cache?
1842 if (!isset($GLOBALS[__FUNCTION__])) {
1844 $GLOBALS[__FUNCTION__] = getConfig('pass_scramble');
1848 return $GLOBALS[__FUNCTION__];
1851 // "Getter" for ap_inactive_since
1852 function getApInactiveSince () {
1853 // Do we have cache?
1854 if (!isset($GLOBALS[__FUNCTION__])) {
1856 $GLOBALS[__FUNCTION__] = getConfig('ap_inactive_since');
1860 return $GLOBALS[__FUNCTION__];
1863 // "Getter" for user_min_confirmed
1864 function getUserMinConfirmed () {
1865 // Do we have cache?
1866 if (!isset($GLOBALS[__FUNCTION__])) {
1868 $GLOBALS[__FUNCTION__] = getConfig('user_min_confirmed');
1872 return $GLOBALS[__FUNCTION__];
1875 // "Getter" for auto_purge
1876 function getAutoPurge () {
1877 // Do we have cache?
1878 if (!isset($GLOBALS[__FUNCTION__])) {
1880 $GLOBALS[__FUNCTION__] = getConfig('auto_purge');
1884 return $GLOBALS[__FUNCTION__];
1887 // "Getter" for bonus_userid
1888 function getBonusUserid () {
1889 // Do we have cache?
1890 if (!isset($GLOBALS[__FUNCTION__])) {
1892 $GLOBALS[__FUNCTION__] = getConfig('bonus_userid');
1896 return $GLOBALS[__FUNCTION__];
1899 // "Getter" for ap_inactive_time
1900 function getApInactiveTime () {
1901 // Do we have cache?
1902 if (!isset($GLOBALS[__FUNCTION__])) {
1904 $GLOBALS[__FUNCTION__] = getConfig('ap_inactive_time');
1908 return $GLOBALS[__FUNCTION__];
1911 // "Getter" for ap_dm_timeout
1912 function getApDmTimeout () {
1913 // Do we have cache?
1914 if (!isset($GLOBALS[__FUNCTION__])) {
1916 $GLOBALS[__FUNCTION__] = getConfig('ap_dm_timeout');
1920 return $GLOBALS[__FUNCTION__];
1923 // "Getter" for ap_tasks_time
1924 function getApTasksTime () {
1925 // Do we have cache?
1926 if (!isset($GLOBALS[__FUNCTION__])) {
1928 $GLOBALS[__FUNCTION__] = getConfig('ap_tasks_time');
1932 return $GLOBALS[__FUNCTION__];
1935 // "Getter" for ap_unconfirmed_time
1936 function getApUnconfirmedTime () {
1937 // Do we have cache?
1938 if (!isset($GLOBALS[__FUNCTION__])) {
1940 $GLOBALS[__FUNCTION__] = getConfig('ap_unconfirmed_time');
1944 return $GLOBALS[__FUNCTION__];
1947 // "Getter" for points
1948 function getPoints () {
1949 // Do we have cache?
1950 if (!isset($GLOBALS[__FUNCTION__])) {
1952 $GLOBALS[__FUNCTION__] = getConfig('POINTS');
1956 return $GLOBALS[__FUNCTION__];
1959 // "Getter" for slogan
1960 function getSlogan () {
1961 // Do we have cache?
1962 if (!isset($GLOBALS[__FUNCTION__])) {
1964 $GLOBALS[__FUNCTION__] = getConfig('SLOGAN');
1968 return $GLOBALS[__FUNCTION__];
1971 // "Getter" for copy
1972 function getCopy () {
1973 // Do we have cache?
1974 if (!isset($GLOBALS[__FUNCTION__])) {
1976 $GLOBALS[__FUNCTION__] = getConfig('COPY');
1980 return $GLOBALS[__FUNCTION__];
1983 // "Getter" for webmaster
1984 function getWebmaster () {
1985 // Do we have cache?
1986 if (!isset($GLOBALS[__FUNCTION__])) {
1988 $GLOBALS[__FUNCTION__] = getConfig('WEBMASTER');
1992 return $GLOBALS[__FUNCTION__];
1995 // "Getter" for sql_count
1996 function getSqlCount () {
1997 // Do we have cache?
1998 if (!isset($GLOBALS[__FUNCTION__])) {
2000 $GLOBALS[__FUNCTION__] = getConfig('sql_count');
2004 return $GLOBALS[__FUNCTION__];
2007 // "Getter" for num_templates
2008 function getNumTemplates () {
2009 // Do we have cache?
2010 if (!isset($GLOBALS[__FUNCTION__])) {
2012 $GLOBALS[__FUNCTION__] = getConfig('num_templates');
2016 return $GLOBALS[__FUNCTION__];
2019 // "Getter" for dns_cache_timeout
2020 function getDnsCacheTimeout () {
2021 // Do we have cache?
2022 if (!isset($GLOBALS[__FUNCTION__])) {
2024 $GLOBALS[__FUNCTION__] = getConfig('dns_cache_timeout');
2028 return $GLOBALS[__FUNCTION__];
2031 // "Getter" for menu_blur_spacer
2032 function getMenuBlurSpacer () {
2033 // Do we have cache?
2034 if (!isset($GLOBALS[__FUNCTION__])) {
2036 $GLOBALS[__FUNCTION__] = getConfig('menu_blur_spacer');
2040 return $GLOBALS[__FUNCTION__];
2043 // "Getter" for points_register
2044 function getPointsRegister () {
2045 // Do we have cache?
2046 if (!isset($GLOBALS[__FUNCTION__])) {
2048 $GLOBALS[__FUNCTION__] = getConfig('points_register');
2052 return $GLOBALS[__FUNCTION__];
2055 // "Getter" for points_ref
2056 function getPointsRef () {
2057 // Do we have cache?
2058 if (!isset($GLOBALS[__FUNCTION__])) {
2060 $GLOBALS[__FUNCTION__] = getConfig('points_ref');
2064 return $GLOBALS[__FUNCTION__];
2067 // "Getter" for ref_payout
2068 function getRefPayout () {
2069 // Do we have cache?
2070 if (!isset($GLOBALS[__FUNCTION__])) {
2072 $GLOBALS[__FUNCTION__] = getConfig('ref_payout');
2076 return $GLOBALS[__FUNCTION__];
2079 // "Getter" for online_timeout
2080 function getOnlineTimeout () {
2081 // Do we have cache?
2082 if (!isset($GLOBALS[__FUNCTION__])) {
2084 $GLOBALS[__FUNCTION__] = getConfig('online_timeout');
2088 return $GLOBALS[__FUNCTION__];
2091 // "Getter" for index_home
2092 function getIndexHome () {
2093 // Do we have cache?
2094 if (!isset($GLOBALS[__FUNCTION__])) {
2096 $GLOBALS[__FUNCTION__] = getConfig('index_home');
2100 return $GLOBALS[__FUNCTION__];
2103 // "Getter" for one_day
2104 function getOneDay () {
2105 // Do we have cache?
2106 if (!isset($GLOBALS[__FUNCTION__])) {
2108 $GLOBALS[__FUNCTION__] = getConfig('ONE_DAY');
2112 return $GLOBALS[__FUNCTION__];
2115 // "Getter" for activate_xchange
2116 function getActivateXchange () {
2117 // Do we have cache?
2118 if (!isset($GLOBALS[__FUNCTION__])) {
2120 $GLOBALS[__FUNCTION__] = getConfig('activate_xchange');
2124 return $GLOBALS[__FUNCTION__];
2127 // "Getter" for img_type
2128 function getImgType () {
2129 // Do we have cache?
2130 if (!isset($GLOBALS[__FUNCTION__])) {
2132 $GLOBALS[__FUNCTION__] = getConfig('img_type');
2136 return $GLOBALS[__FUNCTION__];
2139 // "Getter" for code_length
2140 function getCodeLength () {
2141 // Do we have cache?
2142 if (!isset($GLOBALS[__FUNCTION__])) {
2144 $GLOBALS[__FUNCTION__] = getConfig('code_length');
2148 return $GLOBALS[__FUNCTION__];
2151 // "Getter" for least_cats
2152 function getLeastCats () {
2153 // Do we have cache?
2154 if (!isset($GLOBALS[__FUNCTION__])) {
2156 $GLOBALS[__FUNCTION__] = getConfig('least_cats');
2160 return $GLOBALS[__FUNCTION__];
2163 // "Getter" for pass_len
2164 function getPassLen () {
2165 // Do we have cache?
2166 if (!isset($GLOBALS[__FUNCTION__])) {
2168 $GLOBALS[__FUNCTION__] = getConfig('pass_len');
2172 return $GLOBALS[__FUNCTION__];
2175 // "Getter" for admin_menu
2176 function getAdminMenu () {
2177 // Do we have cache?
2178 if (!isset($GLOBALS[__FUNCTION__])) {
2180 $GLOBALS[__FUNCTION__] = getConfig('admin_menu');
2184 return $GLOBALS[__FUNCTION__];
2187 // "Getter" for last_month
2188 function getLastMonth () {
2189 // Do we have cache?
2190 if (!isset($GLOBALS[__FUNCTION__])) {
2192 $GLOBALS[__FUNCTION__] = getConfig('last_month');
2196 return $GLOBALS[__FUNCTION__];
2199 // "Getter" for max_send
2200 function getMaxSend () {
2201 // Do we have cache?
2202 if (!isset($GLOBALS[__FUNCTION__])) {
2204 $GLOBALS[__FUNCTION__] = getConfig('max_send');
2208 return $GLOBALS[__FUNCTION__];
2211 // "Getter" for mails_page
2212 function getMailsPage () {
2213 // Do we have cache?
2214 if (!isset($GLOBALS[__FUNCTION__])) {
2216 $GLOBALS[__FUNCTION__] = getConfig('mails_page');
2220 return $GLOBALS[__FUNCTION__];
2223 // "Getter" for rand_no
2224 function getRandNo () {
2225 // Do we have cache?
2226 if (!isset($GLOBALS[__FUNCTION__])) {
2228 $GLOBALS[__FUNCTION__] = getConfig('rand_no');
2232 return $GLOBALS[__FUNCTION__];
2235 // "Getter" for __DB_NAME
2236 function getDbName () {
2237 // Do we have cache?
2238 if (!isset($GLOBALS[__FUNCTION__])) {
2240 $GLOBALS[__FUNCTION__] = getConfig('__DB_NAME');
2244 return $GLOBALS[__FUNCTION__];
2247 // "Getter" for DOMAIN
2248 function getDomain () {
2249 // Do we have cache?
2250 if (!isset($GLOBALS[__FUNCTION__])) {
2252 $GLOBALS[__FUNCTION__] = getConfig('DOMAIN');
2256 return $GLOBALS[__FUNCTION__];
2259 // "Getter" for proxy_username
2260 function getProxyUsername () {
2261 // Do we have cache?
2262 if (!isset($GLOBALS[__FUNCTION__])) {
2264 $GLOBALS[__FUNCTION__] = getConfig('proxy_username');
2268 return $GLOBALS[__FUNCTION__];
2271 // "Getter" for proxy_password
2272 function getProxyPassword () {
2273 // Do we have cache?
2274 if (!isset($GLOBALS[__FUNCTION__])) {
2276 $GLOBALS[__FUNCTION__] = getConfig('proxy_password');
2280 return $GLOBALS[__FUNCTION__];
2283 // "Getter" for proxy_host
2284 function getProxyHost () {
2285 // Do we have cache?
2286 if (!isset($GLOBALS[__FUNCTION__])) {
2288 $GLOBALS[__FUNCTION__] = getConfig('proxy_host');
2292 return $GLOBALS[__FUNCTION__];
2295 // "Getter" for proxy_port
2296 function getProxyPort () {
2297 // Do we have cache?
2298 if (!isset($GLOBALS[__FUNCTION__])) {
2300 $GLOBALS[__FUNCTION__] = getConfig('proxy_port');
2304 return $GLOBALS[__FUNCTION__];
2307 // "Getter" for SMTP_HOSTNAME
2308 function getSmtpHostname () {
2309 // Do we have cache?
2310 if (!isset($GLOBALS[__FUNCTION__])) {
2312 $GLOBALS[__FUNCTION__] = getConfig('SMTP_HOSTNAME');
2316 return $GLOBALS[__FUNCTION__];
2319 // "Getter" for SMTP_USER
2320 function getSmtpUser () {
2321 // Do we have cache?
2322 if (!isset($GLOBALS[__FUNCTION__])) {
2324 $GLOBALS[__FUNCTION__] = getConfig('SMTP_USER');
2328 return $GLOBALS[__FUNCTION__];
2331 // "Getter" for SMTP_PASSWORD
2332 function getSmtpPassword () {
2333 // Do we have cache?
2334 if (!isset($GLOBALS[__FUNCTION__])) {
2336 $GLOBALS[__FUNCTION__] = getConfig('SMTP_PASSWORD');
2340 return $GLOBALS[__FUNCTION__];
2343 // "Getter" for points_word
2344 function getPointsWord () {
2345 // Do we have cache?
2346 if (!isset($GLOBALS[__FUNCTION__])) {
2348 $GLOBALS[__FUNCTION__] = getConfig('points_word');
2352 return $GLOBALS[__FUNCTION__];
2355 // "Getter" for profile_lock
2356 function getProfileLock () {
2357 // Do we have cache?
2358 if (!isset($GLOBALS[__FUNCTION__])) {
2360 $GLOBALS[__FUNCTION__] = getConfig('profile_lock');
2364 return $GLOBALS[__FUNCTION__];
2367 // "Getter" for url_tlock
2368 function getUrlTlock () {
2369 // Do we have cache?
2370 if (!isset($GLOBALS[__FUNCTION__])) {
2372 $GLOBALS[__FUNCTION__] = getConfig('url_tlock');
2376 return $GLOBALS[__FUNCTION__];
2379 // "Getter" for title_left
2380 function getTitleLeft () {
2381 // Do we have cache?
2382 if (!isset($GLOBALS[__FUNCTION__])) {
2384 $GLOBALS[__FUNCTION__] = getConfig('title_left');
2388 return $GLOBALS[__FUNCTION__];
2391 // "Getter" for title_right
2392 function getTitleRight () {
2393 // Do we have cache?
2394 if (!isset($GLOBALS[__FUNCTION__])) {
2396 $GLOBALS[__FUNCTION__] = getConfig('title_right');
2400 return $GLOBALS[__FUNCTION__];
2403 // "Getter" for title_middle
2404 function getTitleMiddle () {
2405 // Do we have cache?
2406 if (!isset($GLOBALS[__FUNCTION__])) {
2408 $GLOBALS[__FUNCTION__] = getConfig('title_middle');
2412 return $GLOBALS[__FUNCTION__];
2415 // Getter for 'check_double_email'
2416 function getCheckDoubleEmail () {
2417 // Is the cache entry set?
2418 if (!isset($GLOBALS[__FUNCTION__])) {
2419 // No, so determine it
2420 $GLOBALS[__FUNCTION__] = getConfig('check_double_email');
2423 // Return cached entry
2424 return $GLOBALS[__FUNCTION__];
2427 // Checks wether 'check_double_email' is 'Y'
2428 function isCheckDoubleEmailEnabled () {
2429 // Is the cache entry set?
2430 if (!isset($GLOBALS[__FUNCTION__])) {
2431 // No, so determine it
2432 $GLOBALS[__FUNCTION__] = (getCheckDoubleEmail() == 'Y');
2435 // Return cached entry
2436 return $GLOBALS[__FUNCTION__];
2439 // Getter for 'display_home_in_index'
2440 function getDisplayHomeInIndex () {
2441 // Is the cache entry set?
2442 if (!isset($GLOBALS[__FUNCTION__])) {
2443 // No, so determine it
2444 $GLOBALS[__FUNCTION__] = getConfig('display_home_in_index');
2447 // Return cached entry
2448 return $GLOBALS[__FUNCTION__];
2451 // Checks wether 'display_home_in_index' is 'Y'
2452 function isDisplayHomeInIndexEnabled () {
2453 // Is the cache entry set?
2454 if (!isset($GLOBALS[__FUNCTION__])) {
2455 // No, so determine it
2456 $GLOBALS[__FUNCTION__] = (getDisplayHomeInIndex() == 'Y');
2459 // Return cached entry
2460 return $GLOBALS[__FUNCTION__];
2463 // Checks wether proxy configuration is used
2464 function isProxyUsed () {
2465 // Do we have cache?
2466 if (!isset($GLOBALS[__FUNCTION__])) {
2468 $GLOBALS[__FUNCTION__] = ((isExtensionInstalledAndNewer('sql_patches', '0.4.3')) && (getConfig('proxy_host') != '') && (getConfig('proxy_port') > 0));
2472 return $GLOBALS[__FUNCTION__];
2475 // Checks wether POST data contains selections
2476 function ifPostContainsSelections ($element = 'sel') {
2477 // Do we have cache?
2478 if (!isset($GLOBALS[__FUNCTION__][$element])) {
2480 $GLOBALS[__FUNCTION__][$element] = ((isPostRequestParameterSet($element)) && (countPostSelection($element) > 0));
2484 return $GLOBALS[__FUNCTION__][$element];
2487 // Checks wether verbose_sql is Y and returns true/false if so
2488 function isVerboseSqlEnabled () {
2489 // Do we have cache?
2490 if (!isset($GLOBALS[__FUNCTION__])) {
2492 $GLOBALS[__FUNCTION__] = ((isExtensionInstalledAndNewer('sql_patches', '0.0.7')) && (getConfig('verbose_sql') == 'Y'));
2496 return $GLOBALS[__FUNCTION__];
2499 // "Getter" for total user points
2500 function getTotalPoints ($userid) {
2501 // Do we have cache?
2502 if (!isset($GLOBALS[__FUNCTION__][$userid])) {
2503 // Init array for filter chain
2505 'userid' => $userid,
2509 // Run filter chain for getting more point values
2510 $data = runFilterChain('get_total_points', $data);
2513 $GLOBALS[__FUNCTION__][$userid] = $data['points'] - countSumTotalData($userid, 'user_data', 'used_points');
2517 return $GLOBALS[__FUNCTION__][$userid];
2520 // Wrapper to check if url_blacklist is enabled
2521 function isUrlBlacklistEnabled () {
2522 // Do we have cache?
2523 if (!isset($GLOBALS[__FUNCTION__])) {
2525 $GLOBALS[__FUNCTION__] = (getConfig('url_blacklist') == 'Y');
2529 return $GLOBALS[__FUNCTION__];
2532 // Checks wether direct payment is allowed in configuration
2533 function isDirectPaymentEnabled () {
2534 // Do we have cache?
2535 if (!isset($GLOBALS[__FUNCTION__])) {
2537 $GLOBALS[__FUNCTION__] = (getConfig('allow_direct_pay') == 'Y');
2541 return $GLOBALS[__FUNCTION__];
2544 // Wrapper to check if current task is for extension (not update)
2545 function isExtensionTask ($content) {
2546 // Do we have cache?
2547 if (!isset($GLOBALS[__FUNCTION__][$content['task_type'] . '_' . $content['infos']])) {
2549 $GLOBALS[__FUNCTION__][$content['task_type'] . '_' . $content['infos']] = (($content['task_type'] == 'EXTENSION') && (isExtensionNameValid($content['infos'])) && (!isExtensionInstalled($content['infos'])));
2553 return $GLOBALS[__FUNCTION__][$content['task_type'] . '_' . $content['infos']];
2556 // Wrapper to check if output mode is CSS
2557 function isCssOutputMode () {
2559 return (getScriptOutputMode() == 1);
2562 // Wrapper to check if output mode is HTML
2563 function isHtmlOutputMode () {
2565 return (getScriptOutputMode() == 0);
2568 // Wrapper to check if output mode is RAW
2569 function isRawOutputMode () {
2571 return (getScriptOutputMode() == -1);
2574 // Wrapper to generate a user email link
2575 function generateWrappedUserEmailLink ($email) {
2576 // Just call the inner function
2577 return generateEmailLink($email, 'user_data');
2580 // Wrapper to check if user points are locked
2581 function ifUserPointsLocked ($userid) {
2582 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ' - ENTERED!');
2583 // Do we have cache?
2584 if (!isset($GLOBALS[__FUNCTION__][$userid])) {
2586 $GLOBALS[__FUNCTION__][$userid] = ((getFetchedUserData('userid', $userid, 'ref_payout') > 0) && (!isDirectPaymentEnabled()));
2590 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',locked=' . intval($GLOBALS[__FUNCTION__][$userid]) . ' - EXIT!');
2591 return $GLOBALS[__FUNCTION__][$userid];
2594 // Appends a line to an existing file or creates it instantly with given content.
2595 // This function does always add a new-line character to every line.
2596 function appendLineToFile ($file, $line) {
2597 $fp = fopen($file, 'a') or debug_report_bug(__FUNCTION__, __LINE__, 'Cannot write to file ' . basename($file) . '!');
2598 fwrite($fp, $line . "\n");
2602 // Wrapper for changeDataInFile() but with full path added
2603 function changeDataInInclude ($FQFN, $comment, $prefix, $suffix, $inserted, $seek=0) {
2605 $FQFN = getPath() . $FQFN;
2607 // Call inner function
2608 return changeDataInFile($FQFN, $comment, $prefix, $suffix, $inserted, $seek);
2611 // Wrapper for changing entries in config-local.php
2612 function changeDataInLocalConfigurationFile ($comment, $prefix, $suffix, $inserted, $seek = 0) {
2613 // Call the inner function
2614 return changeDataInInclude(getCachePath() . 'config-local.php', $comment, $prefix, $suffix, $inserted, $seek);
2617 // Shortens ucfirst(strtolower()) calls
2618 function firstCharUpperCase ($str) {
2619 return ucfirst(strtolower($str));
2622 // Shortens calls with configuration entry as first argument (the second will become obsolete in the future)
2623 function createConfigurationTimeSelections ($configEntry, $stamps, $align = 'center') {
2624 // Get the configuration entry
2625 $configValue = getConfig($configEntry);
2627 // Call inner method
2628 return createTimeSelections($configValue, $configEntry, $stamps, $align);
2631 // Shortens converting of German comma to Computer's version in POST data
2632 function convertCommaToDotInPostData ($postEntry) {
2633 // Read and convert given entry
2634 $postValue = convertCommaToDot(postRequestParameter($postEntry));
2636 // ... and set it again
2637 setPostRequestParameter($postEntry, $postValue);
2640 // Converts German commas to Computer's version in all entries
2641 function convertCommaToDotInPostDataArray ($postEntries) {
2642 // Replace german decimal comma with computer decimal dot
2643 foreach ($postEntries as $entry) {
2644 // Is the entry there?
2645 if (isPostRequestParameterSet($entry)) {
2647 convertCommaToDotInPostData($entry);
2653 * Parses a string into a US formated float variable, taken from user comments
2654 * from PHP documentation website.
2656 * @param $floatString A string holding a float expression
2657 * @return $float Corresponding float variable
2658 * @author chris<at>georgakopoulos<dot>com
2659 * @link http://de.php.net/manual/en/function.floatval.php#92563
2661 function parseFloat ($floatString){
2662 $LocaleInfo = localeconv();
2663 $floatString = str_replace($LocaleInfo['mon_thousands_sep'] , '', $floatString);
2664 $floatString = str_replace($LocaleInfo['mon_decimal_point'] , '.', $floatString);
2665 return floatval($floatString);
2668 // Generates a YES/NO option list from given default
2669 function generateYesNoOptionList ($configValue = '') {
2671 return generateOptionList('/ARRAY/', array('Y', 'N'), array('{--YES--}', '{--NO--}'), $configValue);
2674 // "Getter" for total available receivers
2675 function getTotalReceivers ($mode = 'normal') {
2677 $numRows = countSumTotalData('CONFIRMED', 'user_data', 'userid', 'status', true, ' AND `receive_mails` > 0' . runFilterChain('exclude_users', $mode));
2683 // Wrapper "getter" to get total unconfirmed mails for given userid
2684 function getTotalUnconfirmedMails ($userid) {
2685 // Do we have cache?
2686 if (!isset($GLOBALS[__FUNCTION__][$userid])) {
2688 $GLOBALS[__FUNCTION__][$userid] = countSumTotalData($userid, 'user_links', 'id', 'userid', true);
2692 return $GLOBALS[__FUNCTION__][$userid];