A lot calls saved, expression language rewritten:
authorRoland Häder <roland@mxchange.org>
Thu, 1 Jul 2010 01:43:30 +0000 (01:43 +0000)
committerRoland Häder <roland@mxchange.org>
Thu, 1 Jul 2010 01:43:30 +0000 (01:43 +0000)
- A lot getConfig() calls saved and wrapped: getConfig('FOO_BAR') can now be
  done with getFooBar(), except OUTPUT_MODE: getCachedOutputMode(). We need to
  fix that later on.
- Expression language rewritten (and cached) to take a look for above wrapper
  functions.
- TODOs.txt updated

53 files changed:
DOCS/TODOs.txt
inc/autopurge/purge-general.php
inc/autopurge/purge-inact.php
inc/autopurge/purge-mails.php
inc/autopurge/purge-tsks.php
inc/autopurge/purge-unconfirmed.php
inc/classes/cachesystem.class.php
inc/config-functions.php
inc/db/lib-mysql3.php
inc/expression-functions.php
inc/extensions-functions.php
inc/extensions/ext-bonus.php
inc/extensions/ext-sql_patches.php
inc/filters.php
inc/functions.php
inc/gen_sql_patches.php
inc/inc-functions.php
inc/install-functions.php
inc/language-functions.php
inc/libs/autopurge_functions.php
inc/libs/bonus_functions.php
inc/libs/other_functions.php
inc/libs/register_functions.php
inc/libs/rewrite_functions.php
inc/libs/task_functions.php
inc/load_config.php
inc/loader/load_cache-revision.php
inc/modules/admin.php
inc/modules/admin/admin-inc.php
inc/modules/admin/what-config_autopurge.php
inc/modules/admin/what-edit_sponsor.php
inc/modules/admin/what-list_beg.php
inc/modules/admin/what-list_bonus.php
inc/modules/admin/what-logs.php
inc/modules/admin/what-unlock_emails.php
inc/modules/admin/what-updates.php
inc/modules/admin/what-usage.php
inc/modules/frametester.php
inc/modules/guest/what-confirm.php
inc/modules/guest/what-wernis_portal.php
inc/modules/member/what-points.php
inc/modules/member/what-reflinks.php
inc/monthly/monthly_beg.php
inc/monthly/monthly_bonus.php
inc/mysql-manager.php
inc/reset/reset_birthday.php
inc/revision-functions.php
inc/stats-functions.php
inc/stylesheet.php
inc/template-functions.php
inc/wrapper-functions.php
mailid.php
mailid_top.php

index bb3611baebc84de49a1d115ff8bcda605f09a014..e8048982851ab60677de49cb76616a566d2f4452 100644 (file)
@@ -6,8 +6,8 @@
 ./inc/autopurge/purge-inact.php:57:    // @TODO Rewrite these if() blocks to a filter
 ./inc/cache/config-local.php:126:// @TODO Rewrite the following three constants, somehow...
 ./inc/classes/cachesystem.class.php:474:       // @TODO Add support for more types which break in last else-block
-./inc/config-functions.php:140:        // @TODO Make this all better... :-/
-./inc/expression-functions.php:152:// @TODO FILTER_COMPILE_CONFIG does not handle call-back functions so we handle it here again
+./inc/config-functions.php:141:        // @TODO Make this all better... :-/
+./inc/expression-functions.php:202:// @TODO FILTER_COMPILE_CONFIG does not handle call-back functions so we handle it here again
 ./inc/expression-functions.php:48:     // @TODO is escapeQuotes() enougth for strings with single/double quotes?
 ./inc/extensions/ext-html_mail.php:138:                // @TODO Move these arrays into config
 ./inc/extensions/ext-menu.php:54:              // @TODO Convert menu-Id to one coding-standard. admin(edit|_add) => admin_menu_(edit|add), mem(edit|_add) => mem_menu_(edit|add)
@@ -48,7 +48,7 @@
 ./inc/functions.php:1591:// @TODO Rewrite this function to use readFromFile() and writeToFile()
 ./inc/functions.php:178:// @TODO Rewrite this to an extension 'smtp'
 ./inc/functions.php:2244:      // @TODO This is still very static, rewrite it somehow
-./inc/install-functions.php:63:        // @TODO DEACTIVATED: changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', 'OUTPUT-MODE', "setConfigEntry('OUTPUT_MODE', '", "');", postRequestParameter('omode'), 0);
+./inc/install-functions.php:63:        // @TODO DEACTIVATED: changeDataInFile(getCachePath() . 'config-local.php', 'OUTPUT-MODE', "setConfigEntry('OUTPUT_MODE', '", "');", postRequestParameter('omode'), 0);
 ./inc/language/de.php:1143:// @TODO Rewrite these two constants
 ./inc/language/de.php:1158:// @TODO Rewrite these three constants
 ./inc/language/de.php:309:     // @TODO Following two are unused?
index a0c315998c3631abb6600ff63c449e833fe6785f..0e26307b13849fa5b71121dcf1c509b2bd787710 100644 (file)
 // Some security stuff...
 if (!defined('__SECURITY')) {
        die();
-}
-
-// Abort if autopurge is not active or disabled by admin
-if ((!isExtensionActive('autopurge')) || (getConfig('auto_purge_active') != 'Y')) {
+} elseif ((!isExtensionActive('autopurge')) || (!isAutoPurgingActive())) {
        // Abort here
        return false;
 }
 
-if ((getConfig('auto_purge_active') == 'Y') && (getConfig('auto_purge') > 0)) {
+if (getConfig('auto_purge') > 0) {
        // Init SQLs
        initSqls();
 
index aa74f85ad8b252df2bd18722ec166a4e95709234..74dd7469a14577fc6becaa474bcc9d51fd868393 100644 (file)
@@ -43,7 +43,7 @@ if (!defined('__SECURITY')) {
 } // END - if
 
 // Abort if autopurge is not active or disabled by admin
-if ((!isExtensionActive('autopurge')) || (getConfig('auto_purge_active') != 'Y')) {
+if ((!isExtensionActive('autopurge')) || (!isAutoPurgingActive())) {
        // Abort here
        return false;
 } // END - if
@@ -84,15 +84,15 @@ WHERE
 ORDER BY
        d.userid ASC",
                array(
-                       getConfig('ap_inactive_since'),
-                       getConfig('ap_inactive_since'),
-                       getConfig('ap_inactive_since')
+                       getApInactiveSince(),
+                       getApInactiveSince(),
+                       getApInactiveSince()
                ), __FILE__, __LINE__);
 
        if (SQL_NUMROWS($result_inactive) > 0) {
                // Prepare variables and constants...
                $useridsContent = '';
-               $content['since'] = (getConfig('ap_inactive_since') / 60 / 60);
+               $content['since'] = (getApInactiveSince() / 60 / 60);
                $content['time']  = (getConfig('ap_inactive_time')  / 60 / 60);
 
                // Mark found accounts as inactive and send an email
index 765c775836f6ce8df1a1092633d929ba85e96679..d605fc33a99c83386ff1cb87355d6fc63a952e11 100644 (file)
@@ -43,7 +43,7 @@ if (!defined('__SECURITY')) {
 } // END - if
 
 // Abort if autopurge is not active or disabled by admin
-if ((!isExtensionActive('autopurge')) || (getConfig('auto_purge_active') != 'Y') || (getConfig('ap_del_mails') != 'Y')) {
+if ((!isExtensionActive('autopurge')) || (!isAutoPurgingActive()) || (getConfig('ap_del_mails') != 'Y')) {
        // Abort here
        return false;
 } // END - if
index 3e1c97b4a84d9121c3afbfb4bee3a9db7d3edd61..d7e899d0b69fc866de5c2f7b11522a47b59d5eaa 100644 (file)
@@ -43,7 +43,7 @@ if (!defined('__SECURITY')) {
 } // END - if
 
 // Abort if autopurge is not active or disabled by admin
-if ((!isExtensionActive('autopurge')) || (getConfig('auto_purge_active') != 'Y')) {
+if ((!isExtensionActive('autopurge')) || (!isAutoPurgingActive())) {
        // Abort here
        return false;
 } // END - if
index c8f587e3e42d4f2ed63d67688b70f360320faef7..8b94274b75729e405f02e013272ad48cdb8993e9 100644 (file)
@@ -43,7 +43,7 @@ if (!defined('__SECURITY')) {
 } // END - if
 
 // Abort if autopurge is not active or disabled by admin
-if ((!isExtensionActive('autopurge')) || (getConfig('auto_purge_active') != 'Y')) {
+if ((!isExtensionActive('autopurge')) || (!isAutoPurgingActive())) {
        // Abort here
        return false;
 } // END - if
index 5a428985b9271fdbc5286767ffd06212586baa30..4776a89ed11b24f24be894b660a27aa5c0464405 100644 (file)
@@ -65,9 +65,9 @@ class CacheSystem {
                // Remeber path
 
                // Check if path exists
-               if (isDirectory(getConfig('CACHE_PATH'))) {
+               if (isDirectory(getCachePath())) {
                        // Is there a .htaccess file?
-                       if (isFileReadable(getConfig('CACHE_PATH') . '.htaccess')) {
+                       if (isFileReadable(getCachePath() . '.htaccess')) {
                                // All done!
                                $this->ret = $this->statusDone;
                        } else {
@@ -83,7 +83,7 @@ class CacheSystem {
                $this->name = $cacheName;
 
                // Construct FQFN (full qualified file name)
-               $this->fqfn = getConfig('CACHE_PATH') . $cacheName . $this->extension;
+               $this->fqfn = getCachePath() . $cacheName . $this->extension;
 
                // Check if file exists and if version matches
                if (!isset($this->status[$cacheName])) {
index 918ce0fb39904e63c5c3edcfd4c974e3569f4cb5..b81e1633ae18f45a6f4b600e12543366767a51f7 100644 (file)
@@ -77,12 +77,13 @@ function getConfig ($configEntry) {
        $value = null;
 
        // Is the entry there?
-       if (!isset($GLOBALS['config'][$configEntry])) {
+       if (!isConfigEntrySet($configEntry)) {
                // Raise an error of missing entries
                debug_report_bug(__FUNCTION__, __LINE__, sprintf("Configuration entry <em>%s</em> is missing.", $configEntry));
        } // END - if
 
        // Return it
+       //* DEBUG: */ error_log(__FUNCTION__.'['.__LINE__.':] '.$configEntry.'='.$GLOBALS['config'][$configEntry]);
        return $GLOBALS['config'][$configEntry];
 }
 
@@ -182,10 +183,10 @@ function updateOldConfigFile () {
        );
 
        // Copy template to new file destionation
-       copyFileVerified(getConfig('PATH') . 'inc/config-local.php.dist', getConfig('CACHE_PATH') . 'config-local.php', 0644);
+       copyFileVerified(getPath() . 'inc/config-local.php.dist', getCachePath() . 'config-local.php', 0644);
 
        // First of all, load the old one!
-       $oldConfig = explode("\n", readFromFile(getConfig('PATH') . 'inc/config.php'));
+       $oldConfig = explode("\n", readFromFile(getPath() . 'inc/config.php'));
 
        // Now, analyze every entry
        $done = array();
@@ -224,7 +225,7 @@ function updateOldConfigFile () {
 
                                /// ... and write it to the new config
                                //* DEBUG: */ debugOutput('function=' . $function . ',new=' . $new . ',comment=' . $comment);
-                               changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', $comment, $function . "('" . $oldNew . "', \"", '");', constant($new), 0);
+                               changeDataInFile(getCachePath() . 'config-local.php', $comment, $function . "('" . $oldNew . "', \"", '");', constant($new), 0);
                                //* DEBUG: */ debugOutput('CHANGED!');
 
                                // Mark it as done
@@ -263,12 +264,12 @@ function updateOldConfigFile () {
                        $key = substr(trim($parts[0]), 1, -1); $value = substr(trim($parts[1]), 1, -2);
 
                        // We can now save the right part in new config file
-                       changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', $comments[$key], "       '".$key."'     => \"", '",', $value, 0);
+                       changeDataInFile(getCachePath() . 'config-local.php', $comments[$key], "        '".$key."'     => \"", '",', $value, 0);
                }
        } // END - foreach
 
        // Finally remove old config file
-       removeFile(getConfig('PATH') . 'inc/config.php');
+       removeFile(getPath() . 'inc/config.php');
 
        // Redirect to same URL to reload our new config
        redirectToUrl(getRequestUri());
index 7441e5ab21d1fdac935c19fa0bd3d5827e380ab2..b079a48e5ad4414f3260b3f5fb0e266edf5bb3ac 100644 (file)
@@ -105,7 +105,7 @@ function SQL_QUERY ($sqlString, $F, $L) {
                //
                // Debugging stuff...
                //
-               $fp = fopen(getConfig('CACHE_PATH') . 'mysql.log', 'a') or debug_report_bug(__FUNCTION__, __LINE__, 'Cannot write mysql.log!');
+               $fp = fopen(getCachePath() . 'mysql.log', 'a') or debug_report_bug(__FUNCTION__, __LINE__, 'Cannot write mysql.log!');
                if (!isset($GLOBALS['sql_first_entry'])) {
                        // Write first entry
                        fwrite($fp, 'Module=' . getModule() . "\n");
@@ -272,7 +272,7 @@ function SQL_QUERY_ESC ($sqlString, $data, $F, $L, $run = true, $strip = true, $
 
        // Debugging
        //
-       //* DEBUG: */ $fp = fopen(getConfig('CACHE_PATH') . 'escape_debug.log', 'a') or debug_report_bug(__FUNCTION__, __LINE__, 'Cannot write debug.log!');
+       //* DEBUG: */ $fp = fopen(getCachePath() . 'escape_debug.log', 'a') or debug_report_bug(__FUNCTION__, __LINE__, 'Cannot write debug.log!');
        //* DEBUG: */ fwrite($fp, $F . '(' . $L . '): ' . str_replace("\r", '', str_replace("\n", ' ', $eval)) . "\n");
        //* DEBUG: */ fclose($fp);
 
index bb7a1807a240dd1541cfea378f2b36881db3c1ec..29d412872442de503769cb4e0bdc05c5a0856290 100644 (file)
@@ -49,6 +49,56 @@ function replaceExpressionCode ($data, $replacer) {
        return str_replace($data['matches'][0][$data['key']], $replacer, escapeQuotes($data['code']));
 }
 
+// Private function to determine wether we have a special expression function avaible
+// (mostly located in wrapper-functions.php)
+function isExpressionFunctionAvaiable ($data) {
+       // Get the enty we need
+       $entry = $data['matches'][4][$data['key']];
+
+       // Do we have cache?
+       if (!isset($GLOBALS['expression_function_available'][$entry])) {
+               // Init function name
+               $functionName = 'get';
+
+               // Explode it in an array
+               foreach (explode('_', $entry) as $piece) {
+                       // Add non-empty parts
+                       if (!empty($piece)) {
+                               // Add it
+                               $functionName .= ucfirst(strtolower($piece));
+                       } // END - if
+               } // END - foreach
+
+               // Is that function there?
+               if (function_exists($functionName)) {
+                       // Cache it all
+                       $GLOBALS['expression_function_name'][$entry] = $functionName;
+                       $GLOBALS['expression_function_available'][$entry] = true;
+               } else {
+                       // Not avaiable
+                       logDebugMessage(__FUNCTION__, __LINE__, 'Expression function ' . $functionName . ' not found. Please consider adding it to improve execution speed.');
+
+                       // And cache it
+                       $GLOBALS['expression_function_available'][$entry] = false;
+               }
+       } elseif ($GLOBALS['expression_function_available'][$entry] == false) {
+               // Debug message
+               logDebugMessage(__FUNCTION__, __LINE__, 'Expression function for entry ' . $entry . ' requested but not found.');
+       }
+
+       // Return cache
+       return $GLOBALS['expression_function_available'][$entry];
+}
+
+// Getter for above expression function
+function getExpressionFunction ($data) {
+       // Get the enty we need
+       $entry = $data['matches'][4][$data['key']];
+
+       // Return it
+       return $GLOBALS['expression_function_name'][$entry];
+}
+
 // Expression call-back function for getCode() calls
 function doExpressionCode ($data) {
        // Replace the code
@@ -139,7 +189,7 @@ function doExpressionExt ($data) {
        } // END - if
 
        // Generate replacer
-       $replacer = sprintf("&amp;ext=%s&amp;ver=%s&amp;rev={DQUOTE} . getConfig('CURR_SVN_REVISION') . {DQUOTE}", $data['matches'][4][$data['key']], $replacer);
+       $replacer = sprintf("&amp;ext=%s&amp;ver=%s&amp;rev={?CURR_SVN_REVISION?}", $data['matches'][4][$data['key']], $replacer);
 
        // Replace it and insert parameter for GET request
        $code = replaceExpressionCode($data, $replacer);
@@ -151,8 +201,14 @@ function doExpressionExt ($data) {
 // Expression call-back function for getting configuration data
 // @TODO FILTER_COMPILE_CONFIG does not handle call-back functions so we handle it here again
 function doExpressionConfig ($data) {
-       // Default replacer is the config value itself
-       $replacer = '{DQUOTE}  . ' . $data['callback'] . '(getConfig(' . "'" . $data['matches'][4][$data['key']] . "'" . ')) . {DQUOTE}';
+       // Do we have a special expression function for it?
+       if (isExpressionFunctionAvaiable($data)) {
+               // Then use it
+               $replacer = '{DQUOTE}  . ' . $data['callback'] . '('.getExpressionFunction($data).'(' . "'" . $data['matches'][4][$data['key']] . "'" . ')) . {DQUOTE}';
+       } else {
+               // Default replacer is the config value itself
+               $replacer = '{DQUOTE}  . ' . $data['callback'] . '(getConfig(' . "'" . $data['matches'][4][$data['key']] . "'" . ')) . {DQUOTE}';
+       }
 
        // Replace the config entry
        $code = replaceExpressionCode($data, $replacer);
index 44a8ea04f1435c2b91450384b8e4cecb2818f7b2..a680cc148770565a9499f898a22aed5253c204f3 100644 (file)
@@ -977,7 +977,7 @@ function createNewExtensionTask ($ext_name) {
 
                // Template file
                $tpl = sprintf("%stemplates/%s/html/ext/ext_%s.tpl",
-                       getConfig('PATH'),
+                       getPath(),
                        getLanguage(),
                        $ext_name
                );
@@ -1603,7 +1603,7 @@ function getExtensionHasCss () {
 
        // Construct FQFN for check
        $FQFN = sprintf("%stheme/%s/css/%s.css",
-               getConfig('PATH'),
+               getPath(),
                getCurrentTheme(),
                getCurrentExtensionName()
        );
index b7d4bda9d01169e88b16e455e1fe3cad0a70ca97..4d94f99b42caa3190e8a10a1c3c21a3d0784a541 100644 (file)
@@ -579,7 +579,7 @@ WHERE `last_online` < ".$mark." ORDER BY `userid` ASC");
 
        case 'init': // Do stuff when extension is initialized
                // Check for bonus rallye is active and send mails out
-               if ((getExtensionVersion('bonus') >= '0.9.1') && (getConfig('bonus_active') == 'Y') && (getConfig('bonus_new_member_notify') == 'Y')) {
+               if ((getExtensionVersion('bonus') >= '0.9.1') && (ifBonusRallyeActive()) && (getConfig('bonus_new_member_notify') == 'Y')) {
                        // Include file for sending out mails
                        addIncludeToPool('notify', 'inc/mails/bonus_mails.php');
                } // END - if
index 7db75716c0421d3a5e7f49947fedb1206b02ef88..43d87e3bad540821c9cd574527c95e6bea7238f9 100644 (file)
@@ -755,7 +755,7 @@ INDEX (`ip`)
                setConfigEntry('secret_key', '');
 
                // Read key from secret file
-               if ((isExtensionInstalledAndNewer('sql_patches', '0.3.6')) && ((getConfig('file_hash') == '') || (getConfig('master_salt') == '') || (getConfig('pass_scramble') == ''))) {
+               if ((isExtensionInstalledAndNewer('sql_patches', '0.3.6')) && ((getFileHash() == '') || (getMasterSalt() == '') || (getPassScramble() == ''))) {
                        // Cache instance
                        // Maybe need setup of secret key!
                        loadIncludeOnce('inc/gen_sql_patches.php');
@@ -770,9 +770,9 @@ INDEX (`ip`)
                } // END - if
 
                // Test again
-               if ((isExtensionInstalledAndNewer('sql_patches', '0.3.6')) && (getConfig('file_hash') != '') && (getConfig('master_salt') != '') && (getConfig('pass_scramble') != '')) {
+               if ((isExtensionInstalledAndNewer('sql_patches', '0.3.6')) && (getFileHash() != '') && (getMasterSalt() != '') && (getPassScramble() != '')) {
                        // File hash fas generated so we can also file the secret file... hopefully.
-                       $hashFile = sprintf("%sinc/.secret/.%s", getConfig('PATH'), getConfig('file_hash'));
+                       $hashFile = sprintf("%sinc/.secret/.%s", getPath(), getFileHash());
                        if (isFileReadable($hashFile)) {
                                // Read file
                                setConfigEntry('secret_key', readFromFile($hashFile));
index 4551d1d80c1e95b7c7c32e6178ead81e26f58785..a470fa1275088c7894a2d0231068c9911e53a6e9 100644 (file)
@@ -107,7 +107,7 @@ function FILTER_FLUSH_FILTERS () {
        } // END - if
 
        // Shall we update usage counters (ONLY FOR DEBUGGING!)
-       if ((isExtensionInstalledAndNewer('sql_patches', '0.6.0')) && (isConfigEntrySet('update_filter_usage')) && (getConfig('update_filter_usage') == 'Y')) {
+       if (isFilterUsageUpdateEnabled()) {
                // Update all counters
                foreach ($GLOBALS['cache_array']['filter']['counter'] as $filterName => $filterArray) {
                        // Walk through all filters
@@ -324,7 +324,7 @@ function FILTER_INIT_RANDOMIZER () {
        setConfigEntry('_PRIME', 591623);
 
        // Calculate "entropy" with the prime number (for code generation)
-       setConfigEntry('_ADD', (getConfig('_PRIME') * getConfig('_PRIME') / (pi() * getConfig('code_length') + 1)));
+       setConfigEntry('_ADD', (getPrime() * getPrime() / (pi() * getConfig('code_length') + 1)));
 
        // Simply init the randomizer with seed and _ADD value
        mt_srand(generateSeed() + getConfig('_ADD'));
@@ -551,24 +551,24 @@ function FILTER_RUN_RESET_INCLUDES () {
                $currWeek = getWeek();
 
                // Has it changed?
-               if ((getConfig('last_week') != $currWeek) || ((isConfigEntrySet('DEBUG_WEEKLY')) && (getConfig('DEBUG_WEEKLY') == 'Y'))) {
+               if ((getConfig('last_week') != $currWeek) || (isWeeklyResetDebugEnabled())) {
                        // Include weekly reset scripts
                        mergeIncludePool('reset', getArrayFromDirectory('inc/weekly/', 'weekly_'));
 
-                       // Update config
-                       if ((!isConfigEntrySet('DEBUG_WEEKLY')) || (getConfig('DEBUG_WEEKLY') != 'Y')) updateConfiguration('last_week', $currWeek);
+                       // Update config if not in debug mode
+                       if (!isWeeklyResetDebugEnabled()) updateConfiguration('last_week', $currWeek);
                } // END - if
 
                // Create current month mark
                $currMonth = getMonth();
 
                // Has it changed?
-               if ((getConfig('last_month') != $currMonth) || ((isConfigEntrySet('DEBUG_MONTHLY')) && (getConfig('DEBUG_MONTHLY') == 'Y'))) {
+               if ((getConfig('last_month') != $currMonth) || (isMonthlyResetDebugEnabled())) {
                        // Include monthly reset scripts
                        mergeIncludePool('reset', getArrayFromDirectory('inc/monthly/', 'monthly_'));
 
                        // Update config
-                       if ((!isConfigEntrySet('DEBUG_MONTHLY')) || (getConfig('DEBUG_MONTHLY') != 'Y')) updateConfiguration('last_month', $currMonth);
+                       if (!isMonthlyResetDebugEnabled()) updateConfiguration('last_month', $currMonth);
                } // END - if
        } // END - if
 
@@ -694,10 +694,10 @@ function FILTER_CHECK_SVN_REVISION () {
        if ((!isInstalled()) || (!isConfigEntrySet('patch_level'))) return;
 
        // Check for patch level differences between databases and current hard-coded
-       if ((getConfig('CURR_SVN_REVISION') > getConfig('patch_level')) || (getConfig('patch_level') == 'CURR_SVN_REVISION') || (getConfig('patch_ctime') == 'UNIX_TIMES')) {
+       if ((getCurrSvnRevision() > getConfig('patch_level')) || (getConfig('patch_level') == 'CURR_SVN_REVISION') || (getConfig('patch_ctime') == 'UNIX_TIMES')) {
                // Update database and CONFIG array
-               updateConfiguration(array('patch_level', 'patch_ctime'), array(getConfig('CURR_SVN_REVISION'), 'UNIX_TIMESTAMP()'));
-               setConfigEntry('patch_level', getConfig('CURR_SVN_REVISION'));
+               updateConfiguration(array('patch_level', 'patch_ctime'), array(getCurrSvnRevision(), 'UNIX_TIMESTAMP()'));
+               setConfigEntry('patch_level', getCurrSvnRevision());
                setConfigEntry('patch_ctime', time());
        } // END - if
 }
index 6327c0d6e3f1aec5b271ef969bf69ec4c521a9a9..a81f011107945350090a43acd2a935e0dcf15504 100644 (file)
@@ -202,7 +202,7 @@ function sendRawEmail ($toEmail, $subject, $message, $from) {
                $mail->CharSet = 'UTF-8';
 
                // Path for PHPMailer
-               $mail->PluginDir  = sprintf("%sinc/phpmailer/", getConfig('PATH'));
+               $mail->PluginDir  = sprintf("%sinc/phpmailer/", getPath());
 
                $mail->IsSMTP();
                $mail->SMTPAuth   = true;
@@ -215,7 +215,7 @@ function sendRawEmail ($toEmail, $subject, $message, $from) {
                } else {
                        $mail->From = $from;
                }
-               $mail->FromName   = getConfig('MAIN_TITLE');
+               $mail->FromName   = getMainTitle();
                $mail->Subject    = $subject;
                if ((isExtensionActive('html_mail')) && (secureString($message) != $message)) {
                        $mail->Body       = $message;
@@ -226,7 +226,7 @@ function sendRawEmail ($toEmail, $subject, $message, $from) {
                        $mail->Body       = decodeEntities($message);
                }
                $mail->AddAddress($toEmail, '');
-               $mail->AddReplyTo(getConfig('WEBMASTER'), getConfig('MAIN_TITLE'));
+               $mail->AddReplyTo(getConfig('WEBMASTER'), getMainTitle());
                $mail->AddCustomHeader('Errors-To:' . getConfig('WEBMASTER'));
                $mail->AddCustomHeader('X-Loop:' . getConfig('WEBMASTER'));
                $mail->Send();
@@ -473,7 +473,7 @@ function translateMenuVisibleLocked ($content, $prefix = '') {
 // Generates an URL for the dereferer
 function generateDerefererUrl ($URL) {
        // Don't de-refer our own links!
-       if (substr($URL, 0, strlen(getConfig('URL'))) != getConfig('URL')) {
+       if (substr($URL, 0, strlen(getUrl())) != getUrl()) {
                // De-refer this link
                $URL = '{%url=modules.php?module=loader&amp;url=' . encodeString(compileUriCode($URL)) . '%}';
        } // END - if
@@ -544,7 +544,7 @@ function redirectToUrl ($URL, $allowSpider = true) {
        $rel = ' rel="external"';
 
        // Do we have internal or external URL?
-       if (substr($URL, 0, strlen(getConfig('URL'))) == getConfig('URL')) {
+       if (substr($URL, 0, strlen(getUrl())) == getUrl()) {
                // Own (=internal) URL
                $rel = '';
        } // END - if
@@ -645,39 +645,39 @@ function array_pk_sort (&$array, $a_sort, $primary_key = '0', $order = -1, $nums
 //
 function generateRandomCode ($length, $code, $userid, $DATA = '') {
        // Build server string
-       $server = $_SERVER['PHP_SELF'] . getConfig('ENCRYPT_SEPERATOR') . detectUserAgent() . getConfig('ENCRYPT_SEPERATOR') . getenv('SERVER_SOFTWARE') . getConfig('ENCRYPT_SEPERATOR') . detectRemoteAddr();
+       $server = $_SERVER['PHP_SELF'] . getEncryptSeperator() . detectUserAgent() . getEncryptSeperator() . getenv('SERVER_SOFTWARE') . getEncryptSeperator() . detectRemoteAddr();
 
        // Build key string
-       $keys = getConfig('SITE_KEY') . getConfig('ENCRYPT_SEPERATOR') . getConfig('DATE_KEY');
-       if (isConfigEntrySet('secret_key'))  $keys .= getConfig('ENCRYPT_SEPERATOR').getConfig('secret_key');
-       if (isConfigEntrySet('file_hash'))   $keys .= getConfig('ENCRYPT_SEPERATOR').getConfig('file_hash');
-       $keys .= getConfig('ENCRYPT_SEPERATOR') . getDateFromPatchTime();
-       if (isConfigEntrySet('master_salt')) $keys .= getConfig('ENCRYPT_SEPERATOR').getConfig('master_salt');
+       $keys = getConfig('SITE_KEY') . getEncryptSeperator() . getConfig('DATE_KEY');
+       if (isConfigEntrySet('secret_key'))  $keys .= getEncryptSeperator().getSecretKey();
+       if (isConfigEntrySet('file_hash'))   $keys .= getEncryptSeperator().getFileHash();
+       $keys .= getEncryptSeperator() . getDateFromPatchTime();
+       if (isConfigEntrySet('master_salt')) $keys .= getEncryptSeperator().getMasterSalt();
 
        // Build string from misc data
-       $data   = $code . getConfig('ENCRYPT_SEPERATOR') . $userid . getConfig('ENCRYPT_SEPERATOR') . $DATA;
+       $data   = $code . getEncryptSeperator() . $userid . getEncryptSeperator() . $DATA;
 
        // Add more additional data
-       if (isSessionVariableSet('u_hash'))         $data .= getConfig('ENCRYPT_SEPERATOR') . getSession('u_hash');
+       if (isSessionVariableSet('u_hash'))         $data .= getEncryptSeperator() . getSession('u_hash');
 
        // Add referal id, language, theme and userid
-       $data .= getConfig('ENCRYPT_SEPERATOR') . determineReferalId();
-       $data .= getConfig('ENCRYPT_SEPERATOR') . getLanguage();
-       $data .= getConfig('ENCRYPT_SEPERATOR') . getCurrentTheme();
-       $data .= getConfig('ENCRYPT_SEPERATOR') . getMemberId();
+       $data .= getEncryptSeperator() . determineReferalId();
+       $data .= getEncryptSeperator() . getLanguage();
+       $data .= getEncryptSeperator() . getCurrentTheme();
+       $data .= getEncryptSeperator() . getMemberId();
 
        // Calculate number for generating the code
        $a = $code + getConfig('_ADD') - 1;
 
        if (isConfigEntrySet('master_salt')) {
                // Generate hash with master salt from modula of number with the prime number and other data
-               $saltedHash = generateHash(($a % getConfig('_PRIME')) . getConfig('ENCRYPT_SEPERATOR') . $server . getConfig('ENCRYPT_SEPERATOR') . $keys . getConfig('ENCRYPT_SEPERATOR') . $data . getConfig('ENCRYPT_SEPERATOR') . getConfig('DATE_KEY') . getConfig('ENCRYPT_SEPERATOR') . $a, getConfig('master_salt'));
+               $saltedHash = generateHash(($a % getPrime()) . getEncryptSeperator() . $server . getEncryptSeperator() . $keys . getEncryptSeperator() . $data . getEncryptSeperator() . getConfig('DATE_KEY') . getEncryptSeperator() . $a, getMasterSalt());
 
                // Create number from hash
-               $rcode = hexdec(substr($saltedHash, strlen(getConfig('master_salt')), 9)) / abs(getConfig('rand_no') - $a + sqrt(getConfig('_ADD'))) / pi();
+               $rcode = hexdec(substr($saltedHash, strlen(getMasterSalt()), 9)) / abs(getConfig('rand_no') - $a + sqrt(getConfig('_ADD'))) / pi();
        } else {
                // Generate hash with "hash of site key" from modula of number with the prime number and other data
-               $saltedHash = generateHash(($a % getConfig('_PRIME')) . getConfig('ENCRYPT_SEPERATOR') . $server . getConfig('ENCRYPT_SEPERATOR') . $keys . getConfig('ENCRYPT_SEPERATOR') . $data . getConfig('ENCRYPT_SEPERATOR') . getConfig('DATE_KEY') . getConfig('ENCRYPT_SEPERATOR') . $a, substr(sha1(getConfig('SITE_KEY')), 0, getConfig('salt_length')));
+               $saltedHash = generateHash(($a % getPrime()) . getEncryptSeperator() . $server . getEncryptSeperator() . $keys . getEncryptSeperator() . $data . getEncryptSeperator() . getConfig('DATE_KEY') . getEncryptSeperator() . $a, substr(sha1(getConfig('SITE_KEY')), 0, getSaltLength()));
 
                // Create number from hash
                $rcode = hexdec(substr($saltedHash, 8, 9)) / abs(getConfig('rand_no') - $a + sqrt(getConfig('_ADD'))) / pi();
@@ -780,7 +780,7 @@ function createFancyTime ($stamp) {
 // Extract host from script name
 function extractHostnameFromUrl (&$script) {
        // Use default SERVER_URL by default... ;) So?
-       $url = getConfig('SERVER_URL');
+       $url = getServerUrl();
 
        // Is this URL valid?
        if (substr($script, 0, 7) == 'http://') {
@@ -838,11 +838,11 @@ function sendGetRequest ($script, $data = array()) {
        // Generate GET request header
        $request  = 'GET /' . trim($script) . ' HTTP/1.1' . getConfig('HTTP_EOL');
        $request .= 'Host: ' . $host . getConfig('HTTP_EOL');
-       $request .= 'Referer: ' . getConfig('URL') . '/admin.php' . getConfig('HTTP_EOL');
+       $request .= 'Referer: ' . getUrl() . '/admin.php' . getConfig('HTTP_EOL');
        if (isConfigEntrySet('FULL_VERSION')) {
-               $request .= 'User-Agent: ' . getConfig('TITLE') . '/' . getConfig('FULL_VERSION') . getConfig('HTTP_EOL');
+               $request .= 'User-Agent: ' . getTitle() . '/' . getFullVersion() . getConfig('HTTP_EOL');
        } else {
-               $request .= 'User-Agent: ' . getConfig('TITLE') . '/' . getConfig('VERSION') . getConfig('HTTP_EOL');
+               $request .= 'User-Agent: ' . getTitle() . '/' . getConfig('VERSION') . getConfig('HTTP_EOL');
        }
        $request .= 'Accept: image/png,image/*;q=0.8,text/plain,text/html,*/*;q=0.5' . getConfig('HTTP_EOL');
        $request .= 'Accept-Charset: UTF-8,*' . getConfig('HTTP_EOL');
@@ -875,8 +875,8 @@ function sendPostRequest ($script, $postData) {
        // Generate POST request header
        $request  = 'POST /' . trim($script) . ' HTTP/1.0' . getConfig('HTTP_EOL');
        $request .= 'Host: ' . $host . getConfig('HTTP_EOL');
-       $request .= 'Referer: ' . getConfig('URL') . '/admin.php' . getConfig('HTTP_EOL');
-       $request .= 'User-Agent: ' . getConfig('TITLE') . '/' . getConfig('FULL_VERSION') . getConfig('HTTP_EOL');
+       $request .= 'Referer: ' . getUrl() . '/admin.php' . getConfig('HTTP_EOL');
+       $request .= 'User-Agent: ' . getTitle() . '/' . getFullVersion() . getConfig('HTTP_EOL');
        $request .= 'Accept: text/plain;q=0.8' . getConfig('HTTP_EOL');
        $request .= 'Accept-Charset: UTF-8,*' . getConfig('HTTP_EOL');
        $request .= 'Cache-Control: no-cache' . getConfig('HTTP_EOL');
@@ -1148,19 +1148,19 @@ function generateHash ($plainText, $salt = '', $hash = true) {
        // When the salt is empty build a new one, else use the first x configured characters as the salt
        if (empty($salt)) {
                // Build server string for more entropy
-               $server = $_SERVER['PHP_SELF'] . getConfig('ENCRYPT_SEPERATOR') . detectUserAgent() . getConfig('ENCRYPT_SEPERATOR') . getenv('SERVER_SOFTWARE') . getConfig('ENCRYPT_SEPERATOR') . detectRemoteAddr();
+               $server = $_SERVER['PHP_SELF'] . getEncryptSeperator() . detectUserAgent() . getEncryptSeperator() . getenv('SERVER_SOFTWARE') . getEncryptSeperator() . detectRemoteAddr();
 
                // Build key string
-               $keys   = getConfig('SITE_KEY') . getConfig('ENCRYPT_SEPERATOR') . getConfig('DATE_KEY') . getConfig('ENCRYPT_SEPERATOR') . getConfig('secret_key') . getConfig('ENCRYPT_SEPERATOR') . getConfig('file_hash') . getConfig('ENCRYPT_SEPERATOR') . getDateFromPatchTime() . getConfig('ENCRYPT_SEPERATOR') . getConfig('master_salt');
+               $keys   = getConfig('SITE_KEY') . getEncryptSeperator() . getConfig('DATE_KEY') . getEncryptSeperator() . getSecretKey() . getEncryptSeperator() . getFileHash() . getEncryptSeperator() . getDateFromPatchTime() . getEncryptSeperator() . getMasterSalt();
 
                // Additional data
-               $data = $plainText . getConfig('ENCRYPT_SEPERATOR') . uniqid(mt_rand(), true) . getConfig('ENCRYPT_SEPERATOR') . time();
+               $data = $plainText . getEncryptSeperator() . uniqid(mt_rand(), true) . getEncryptSeperator() . time();
 
                // Calculate number for generating the code
                $a = time() + getConfig('_ADD') - 1;
 
                // Generate SHA1 sum from modula of number and the prime number
-               $sha1 = sha1(($a % getConfig('_PRIME')) . $server . getConfig('ENCRYPT_SEPERATOR') . $keys . getConfig('ENCRYPT_SEPERATOR') . $data . getConfig('ENCRYPT_SEPERATOR') . getConfig('DATE_KEY') . getConfig('ENCRYPT_SEPERATOR') . $a);
+               $sha1 = sha1(($a % getPrime()) . $server . getEncryptSeperator() . $keys . getEncryptSeperator() . $data . getEncryptSeperator() . getConfig('DATE_KEY') . getEncryptSeperator() . $a);
                //* DEBUG: */ debugOutput('SHA1=' . $sha1.' ('.strlen($sha1).')<br />');
                $sha1 = scrambleString($sha1);
                //* DEBUG: */ debugOutput('Scrambled=' . $sha1.' ('.strlen($sha1).')<br />');
@@ -1168,18 +1168,18 @@ function generateHash ($plainText, $salt = '', $hash = true) {
                //* DEBUG: */ debugOutput('Descrambled=' . $sha1b.' ('.strlen($sha1b).')<br />');
 
                // Generate the password salt string
-               $salt = substr($sha1, 0, getConfig('salt_length'));
+               $salt = substr($sha1, 0, getSaltLength());
                //* DEBUG: */ debugOutput($salt.' ('.strlen($salt).')<br />');
        } else {
                // Use given salt
                //* DEBUG: */ debugOutput('salt=' . $salt);
-               $salt = substr($salt, 0, getConfig('salt_length'));
-               //* DEBUG: */ debugOutput('salt=' . $salt . '(' . strlen($salt) . '/' . getConfig('salt_length') . ')<br />');
+               $salt = substr($salt, 0, getSaltLength());
+               //* DEBUG: */ debugOutput('salt=' . $salt . '(' . strlen($salt) . '/' . getSaltLength() . ')<br />');
 
                // Sanity check on salt
-               if (strlen($salt) != getConfig('salt_length')) {
+               if (strlen($salt) != getSaltLength()) {
                        // Not the same!
-                       debug_report_bug(__FUNCTION__.': salt length mismatch! ('.strlen($salt).'/'.getConfig('salt_length').')');
+                       debug_report_bug(__FUNCTION__.': salt length mismatch! ('.strlen($salt).'/'.getSaltLength().')');
                } // END - if
        }
 
@@ -1204,7 +1204,7 @@ function scrambleString($str) {
                return $str;
        } elseif (strlen($str) == 40) {
                // From database
-               $scrambleNums = explode(':', getConfig('pass_scramble'));
+               $scrambleNums = explode(':', getPassScramble());
        } else {
                // Generate new numbers
                $scrambleNums = explode(':', genScrambleString(strlen($str)));
@@ -1234,7 +1234,7 @@ function descrambleString($str) {
        if (strlen($str) != 40) return $str;
 
        // Load numbers from config
-       $scrambleNums = explode(':', getConfig('pass_scramble'));
+       $scrambleNums = explode(':', getPassScramble());
 
        // Validate numbers
        if (count($scrambleNums) != 40) return $str;
@@ -1285,24 +1285,24 @@ function encodeHashForCookie ($passHash) {
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, intval(isExtensionInstalled('sql_patches')) . '/' . intval(isConfigEntrySet('_PRIME')) . '/' . intval(isConfigEntrySet('secret_key')) . '/' . intval(isConfigEntrySet('master_salt')));
        if ((isExtensionInstalled('sql_patches')) && (isConfigEntrySet('_PRIME')) && (isConfigEntrySet('secret_key')) && (isConfigEntrySet('master_salt'))) {
                // Only calculate when the secret key is generated
-               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, strlen($passHash) . '/' . strlen(getConfig('secret_key')));
-               if ((strlen($passHash) != 49) || (strlen(getConfig('secret_key')) != 40)) {
+               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, strlen($passHash) . '/' . strlen(getSecretKey()));
+               if ((strlen($passHash) != 49) || (strlen(getSecretKey()) != 40)) {
                        // Both keys must have same length so return unencrypted
-                       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, strlen($passHash) . '!=49/' . strlen(getConfig('secret_key')) . '!=40');
+                       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, strlen($passHash) . '!=49/' . strlen(getSecretKey()) . '!=40');
                        return $ret;
                } // END - if
 
                $newHash = ''; $start = 9;
                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'passHash=' . $passHash . '(' . strlen($passHash) . ')');
                for ($idx = 0; $idx < 20; $idx++) {
-                       $part1 = hexdec(substr($passHash, ($idx * 2) + (strlen($passHash) - strlen(getConfig('secret_key'))), 2));
-                       $part2 = hexdec(substr(getConfig('secret_key'), $start, 2));
+                       $part1 = hexdec(substr($passHash, ($idx * 2) + (strlen($passHash) - strlen(getSecretKey())), 2));
+                       $part2 = hexdec(substr(getSecretKey(), $start, 2));
                        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'part1=' . $part1 . '/part2=' . $part2);
                        $mod = dechex($idx);
                        if ($part1 > $part2) {
-                               $mod = dechex(sqrt(($part1 - $part2) * getConfig('_PRIME') / pi()));
+                               $mod = dechex(sqrt(($part1 - $part2) * getPrime() / pi()));
                        } elseif ($part2 > $part1) {
-                               $mod = dechex(sqrt(($part2 - $part1) * getConfig('_PRIME') / pi()));
+                               $mod = dechex(sqrt(($part2 - $part1) * getPrime() / pi()));
                        }
                        $mod = substr($mod, 0, 2);
                        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'part1=' . $part1 . '/part2=' . $part2 . '/mod=' . $mod . '(' . strlen($mod) . ')');
@@ -1313,7 +1313,7 @@ function encodeHashForCookie ($passHash) {
                } // END - for
 
                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $passHash . ',' . $newHash . ' (' . strlen($newHash) . ')');
-               $ret = generateHash($newHash, getConfig('master_salt'));
+               $ret = generateHash($newHash, getMasterSalt());
        } // END - if
 
        // Return result
@@ -1682,7 +1682,7 @@ function logDebugMessage ($funcFile, $line, $message, $force=true) {
                $message = str_replace("\r", '', str_replace("\n", '', $message));
 
                // Log this message away
-               $fp = fopen(getConfig('CACHE_PATH') . 'debug.log', 'a') or debug_report_bug(__FUNCTION__, __LINE__, 'Cannot write logfile debug.log!');
+               $fp = fopen(getCachePath() . 'debug.log', 'a') or debug_report_bug(__FUNCTION__, __LINE__, 'Cannot write logfile debug.log!');
                fwrite($fp, generateDateTime(time(), '4') . '|' . getModule(false) . '|' . basename($funcFile) . '|' . $line . '|' . $message . "\n");
                fclose($fp);
        } // END - if
@@ -1919,10 +1919,10 @@ function determineReferalId () {
        } elseif (isGetRequestParameterSet('ref')) {
                // Set refid=ref (the referal link uses such variable)
                $GLOBALS['refid'] = secureString(getRequestParameter('ref'));
-       } elseif ((isSessionVariableSet('refid')) && (getSession('refid') != 0)) {
+       } elseif ((isSessionVariableSet('refid')) && (getSession('refid') > 0)) {
                // Set session refid als global
                $GLOBALS['refid'] = bigintval(getSession('refid'));
-       } elseif ((isExtensionInstalledAndNewer('user', '0.3.4')) && (getConfig('select_user_zero_refid') == 'Y')) {
+       } elseif ((isExtensionInstalledAndNewer('user', '0.3.4')) && (isRandomReferalIdEnabled())) {
                // Select a random user which has confirmed enougth mails
                $GLOBALS['refid'] = determineRandomReferalId();
        } elseif ((isExtensionInstalledAndNewer('sql_patches', '0.1.2')) && (getConfig('def_refid') > 0)) {
@@ -2059,7 +2059,7 @@ function getArrayFromDirectory ($baseDir, $prefix, $fileIncludeDirs = false, $ad
        $files = array();
 
        // Open directory
-       $dirPointer = opendir(getConfig('PATH') . $baseDir) or debug_report_bug(__FUNCTION__, __LINE__, 'Cannot read directory ' . basename($baseDir) . '.');
+       $dirPointer = opendir(getPath() . $baseDir) or debug_report_bug(__FUNCTION__, __LINE__, 'Cannot read directory ' . basename($baseDir) . '.');
 
        // Read all entries
        while ($baseFile = readdir($dirPointer)) {
@@ -2072,7 +2072,7 @@ function getArrayFromDirectory ($baseDir, $prefix, $fileIncludeDirs = false, $ad
 
                // Construct include filename and FQFN
                $fileName = $baseDir . $baseFile;
-               $FQFN = getConfig('PATH') . $fileName;
+               $FQFN = getPath() . $fileName;
 
                // Remove double slashes
                $FQFN = str_replace('//', '/', $FQFN);
@@ -2181,7 +2181,7 @@ function addSqlToDebug ($result, $sqlString, $timing, $F, $L) {
        // Do we have cache?
        if (!isset($GLOBALS['debug_sql_available'])) {
                // Check it and cache it in $GLOBALS
-               $GLOBALS['debug_sql_available'] = ((isConfigurationLoaded()) && (isExtensionInstalledAndNewer('other', '0.2.2')) && (getConfig('display_debug_sqls') == 'Y'));
+               $GLOBALS['debug_sql_available'] = ((isConfigurationLoaded()) && (isDisplayDebugSqlEnabled()));
        } // END - if
        
        // Don't execute anything here if we don't need or ext-other is missing
@@ -2287,7 +2287,7 @@ function encodeUrl ($url, $outputMode = '0') {
        } // END - if
 
        // Add {?URL?} ?
-       if ((substr($url, 0, strlen(getConfig('URL'))) != getConfig('URL')) && (substr($url, 0, 7) != '{?URL?}') && (substr($url, 0, 7) != 'http://') && (substr($url, 0, 8) != 'https://')) {
+       if ((substr($url, 0, strlen(getUrl())) != getUrl()) && (substr($url, 0, 7) != '{?URL?}') && (substr($url, 0, 7) != 'http://') && (substr($url, 0, 8) != 'https://')) {
                // Add it
                $url = '{?URL?}/' . $url;
        } // END - if
@@ -2322,7 +2322,7 @@ function searchDirsRecursive ($dir, &$last_changed, $lookFor = 'Date') {
        // Walk through all entries
        foreach ($ds as $d) {
                // Generate proper FQFN
-               $FQFN = str_replace('//', '/', getConfig('PATH') . $dir . '/' . $d);
+               $FQFN = str_replace('//', '/', getPath() . $dir . '/' . $d);
 
                // Is it a file and readable?
                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'dir=' . $dir . ',d=' . $d);
index d853f1ca8d9b9b1b56619e90b1827f27d2c1db99..4853da16b7023890ae3083769503b693e3bd3377 100644 (file)
@@ -43,7 +43,7 @@ if (!defined('__SECURITY')) {
 } // END - if
 
 // Check if there is no scrambling string
-if (getConfig('pass_scramble') == '') {
+if (getPassScramble() == '') {
        // Generate 40 chars long scramble string
        $scrambleString = genScrambleString(40);
 
@@ -55,7 +55,7 @@ if (getConfig('pass_scramble') == '') {
 } // END - if
 
 // Check if there is no master salt string
-if (getConfig('master_salt') == '') {
+if (getMasterSalt() == '') {
        // Generate the master salt which is the first chars minus 40 chars of this random hash
        // We do an extra scrambling here...
        $masterSalt = scrambleString(sha1(generatePassword(mt_rand(128, 256))));
@@ -67,11 +67,11 @@ if (getConfig('master_salt') == '') {
        unset($masterSalt);
 } // END - if
 
-if (getConfig('file_hash') == '') {
+if (getFileHash() == '') {
        // Create filename from hashed random string
        $fileHash = sha1(generatePassword(mt_rand(128, 256)));
        $FQFN = sprintf("%sinc/.secret/.%s",
-               getConfig('PATH'),
+               getPath(),
                $fileHash
        );
 
@@ -93,7 +93,7 @@ if (getConfig('file_hash') == '') {
 
                // Generate FQFN for .htaccess file
                $FQFN = sprintf("%sinc/.secret/.htaccess",
-                       getConfig('PATH')
+                       getPath()
                );
 
                // Is the .htaccess file there?
index ee808594438db16295ca8c916ad7f772bfc504de..43ac1d9f4385be0412abe0974db13ce2395eb2c5 100644 (file)
@@ -118,7 +118,7 @@ function loadInclude ($inc) {
        // Do we have cache?
        if (!isset($GLOBALS['inc_loaded'][$inc])) {
                // Add the path. This is why we need a trailing slash in config.php
-               $GLOBALS['inc_loaded'][$inc] = getConfig('PATH') . $inc;
+               $GLOBALS['inc_loaded'][$inc] = getPath() . $inc;
 
                // Is the include file there?
                if (!isIncludeReadable($inc)) {
@@ -134,7 +134,7 @@ function loadInclude ($inc) {
 // Loads an include file once
 function loadIncludeOnce ($inc) {
        // Remove double path
-       $inc = str_replace(getConfig('PATH'), '', $inc);
+       $inc = str_replace(getPath(), '', $inc);
 
        // Is it not loaded?
        if (!isset($GLOBALS['load_once'][$inc])) {
@@ -151,10 +151,10 @@ function isIncludeReadable ($inc) {
        // Do we have cache?
        if (!isset($GLOBALS['inc_readable'][$inc])) {
                // Remove double path
-               $inc = str_replace(getConfig('PATH'), '', $inc);
+               $inc = str_replace(getPath(), '', $inc);
 
                // Construct FQFN
-               $FQFN = getConfig('PATH') . $inc;
+               $FQFN = getPath() . $inc;
 
                // Is it readable?
                $GLOBALS['inc_readable'][$inc] = isFileReadable($FQFN);
index 9e794c2ccd60b2b3b5c5c597fa5c4211881c312a..9cabd5ce8ae9dbbee53cf31dcde3f3904cb20e6d 100644 (file)
@@ -49,36 +49,36 @@ if (!defined('__SECURITY')) {
 // Write the local config-local.php file from "template"
 function doInstallWriteLocalConfig () {
        // Copy the config template and verify it
-       copyFileVerified(postRequestParameter('spath') . 'inc/config-local.php.dist', getConfig('CACHE_PATH') . 'config-local.php', 0644);
+       copyFileVerified(postRequestParameter('spath') . 'inc/config-local.php.dist', getCachePath() . 'config-local.php', 0644);
 
        // Ok, all done. So we can write the config data to the php files
-       if (postRequestParameter('spath') != getConfig('PATH')) changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', 'SERVER-PATH', "setConfigEntry('PATH', '", "');", postRequestParameter('spath'), 0);
-       if (postRequestParameter('burl')  != getConfig('URL'))  changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', 'HOST-URL', "setConfigEntry('URL', '", "');", postRequestParameter('burl'), 0);
-       changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', 'MAIN-TITLE', "setConfigEntry('MAIN_TITLE', '", "');", postRequestParameter('title'), 0);
-       changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', 'SLOGAN', "setConfigEntry('SLOGAN', '", "');", postRequestParameter('slogan'), 0);
-       changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', 'WEBMASTER', "setConfigEntry('WEBMASTER', '", "');", postRequestParameter('email'), 0);
-       changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', 'NULLPASS-WARNING', "setConfigEntry('WARN_NO_PASS', '", "');", postRequestParameter('warn_no_pass'), 0);
-       changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', 'WRITE-FOOTER', "setConfigEntry('WRITE_FOOTER', '", "');", postRequestParameter('wfooter'), 0);
-       changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', 'BACKLINK', "setConfigEntry('ENABLE_BACKLINK', '", "');", postRequestParameter('blink'), 0);
-       // @TODO DEACTIVATED: changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', 'OUTPUT-MODE', "setConfigEntry('OUTPUT_MODE', '", "');", postRequestParameter('omode'), 0);
-       changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', 'MYSQL-HOST', "  'host'     => '", "',", postRequestParameter('mysql','host'), 0);
-       changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', 'MYSQL-DBASE', " 'dbase'    => '", "',", postRequestParameter('mysql','dbase'), 0);
-       changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', 'MYSQL-LOGIN', " 'login'    => '", "',", postRequestParameter('mysql','login'), 0);
-       changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', 'MYSQL-PASSWORD', "      'password' => '", "',", postRequestParameter('mysql','pass1'), 0);
-       changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', 'MYSQL-PREFIX', "setConfigEntry('_MYSQL_PREFIX', '", "');", postRequestParameter('mysql','prefix'), 0);
-       changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', 'TABLE-TYPE', "setConfigEntry('_TABLE_TYPE', '", "');", postRequestParameter('mysql','type'), 0);
-       changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', 'SMTP-HOSTNAME', "setConfigEntry('SMTP_HOSTNAME', '", "');", postRequestParameter('smtp_host'), 0);
-       changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', 'SMTP-USER', "setConfigEntry('SMTP_USER', '", "');", postRequestParameter('smtp_user'), 0);
-       changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', 'SMTP-PASSWORD', "setConfigEntry('SMTP_PASSWORD', '", "');", postRequestParameter('smtp_pass1'), 0);
+       if (postRequestParameter('spath') != getPath()) changeDataInFile(getCachePath() . 'config-local.php', 'SERVER-PATH', "setConfigEntry('PATH', '", "');", postRequestParameter('spath'), 0);
+       if (postRequestParameter('burl')  != getUrl())  changeDataInFile(getCachePath() . 'config-local.php', 'HOST-URL', "setConfigEntry('URL', '", "');", postRequestParameter('burl'), 0);
+       changeDataInFile(getCachePath() . 'config-local.php', 'MAIN-TITLE', "setConfigEntry('MAIN_TITLE', '", "');", postRequestParameter('title'), 0);
+       changeDataInFile(getCachePath() . 'config-local.php', 'SLOGAN', "setConfigEntry('SLOGAN', '", "');", postRequestParameter('slogan'), 0);
+       changeDataInFile(getCachePath() . 'config-local.php', 'WEBMASTER', "setConfigEntry('WEBMASTER', '", "');", postRequestParameter('email'), 0);
+       changeDataInFile(getCachePath() . 'config-local.php', 'NULLPASS-WARNING', "setConfigEntry('WARN_NO_PASS', '", "');", postRequestParameter('warn_no_pass'), 0);
+       changeDataInFile(getCachePath() . 'config-local.php', 'WRITE-FOOTER', "setConfigEntry('WRITE_FOOTER', '", "');", postRequestParameter('wfooter'), 0);
+       changeDataInFile(getCachePath() . 'config-local.php', 'BACKLINK', "setConfigEntry('ENABLE_BACKLINK', '", "');", postRequestParameter('blink'), 0);
+       // @TODO DEACTIVATED: changeDataInFile(getCachePath() . 'config-local.php', 'OUTPUT-MODE', "setConfigEntry('OUTPUT_MODE', '", "');", postRequestParameter('omode'), 0);
+       changeDataInFile(getCachePath() . 'config-local.php', 'MYSQL-HOST', "   'host'     => '", "',", postRequestParameter('mysql','host'), 0);
+       changeDataInFile(getCachePath() . 'config-local.php', 'MYSQL-DBASE', "  'dbase'    => '", "',", postRequestParameter('mysql','dbase'), 0);
+       changeDataInFile(getCachePath() . 'config-local.php', 'MYSQL-LOGIN', "  'login'    => '", "',", postRequestParameter('mysql','login'), 0);
+       changeDataInFile(getCachePath() . 'config-local.php', 'MYSQL-PASSWORD', "       'password' => '", "',", postRequestParameter('mysql','pass1'), 0);
+       changeDataInFile(getCachePath() . 'config-local.php', 'MYSQL-PREFIX', "setConfigEntry('_MYSQL_PREFIX', '", "');", postRequestParameter('mysql','prefix'), 0);
+       changeDataInFile(getCachePath() . 'config-local.php', 'TABLE-TYPE', "setConfigEntry('_TABLE_TYPE', '", "');", postRequestParameter('mysql','type'), 0);
+       changeDataInFile(getCachePath() . 'config-local.php', 'SMTP-HOSTNAME', "setConfigEntry('SMTP_HOSTNAME', '", "');", postRequestParameter('smtp_host'), 0);
+       changeDataInFile(getCachePath() . 'config-local.php', 'SMTP-USER', "setConfigEntry('SMTP_USER', '", "');", postRequestParameter('smtp_user'), 0);
+       changeDataInFile(getCachePath() . 'config-local.php', 'SMTP-PASSWORD', "setConfigEntry('SMTP_PASSWORD', '", "');", postRequestParameter('smtp_pass1'), 0);
 
        // Generate a long site key
        $siteKey = generatePassword(50);
 
        // And write it
-       changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', 'SITE-KEY', "setConfigEntry('SITE_KEY', '", "');", $siteKey, 0);
+       changeDataInFile(getCachePath() . 'config-local.php', 'SITE-KEY', "setConfigEntry('SITE_KEY', '", "');", $siteKey, 0);
 
        // Script is now installed
-       changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', 'INSTALLED', "setConfigEntry('MXCHANGE_INSTALLED', '", "');", 'Y', 0);
+       changeDataInFile(getCachePath() . 'config-local.php', 'INSTALLED', "setConfigEntry('MXCHANGE_INSTALLED', '", "');", 'Y', 0);
 }
 
 // Adds a given template with content to install output stream
index ccf61cb51e3c1cccba7eeaeea909b4772102f8b6..5e227601343167b93e1abf8498300bc724e76910 100644 (file)
@@ -108,7 +108,7 @@ function getLanguage () {
        $ret = 'de';
 
        // Set default return value to default language from config
-       if (isConfigEntrySet('DEFAULT_LANG')) $ret = getConfig('DEFAULT_LANG');
+       if (isConfigEntrySet('DEFAULT_LANG')) $ret = getDefaultLanguage();
 
        // Is the variable set
        if (isGetRequestParameterSet('mx_lang')) {
@@ -122,7 +122,7 @@ function getLanguage () {
                $ret = getSession('mx_lang');
 
                // Fixes a warning before the session has the mx_lang constant
-               if (empty($ret)) $ret = getConfig('DEFAULT_LANG');
+               if (empty($ret)) $ret = getDefaultLanguage();
        }
 
        // Cache entry
@@ -173,7 +173,7 @@ function loadLanguageFile ($ext_name = 'none') {
        // Set default language if it is not (yet) set
        if (is_null($currLanguage)) {
                // Get it from config
-               $currLanguage = getConfig('DEFAULT_LANG');
+               $currLanguage = getDefaultLanguage();
 
                // And save it in session
                setLanguage($currLanguage);
index 76be497ee5ad86b9c2c499907b3aa116d2a10ac9..fe3cdd4b586c22d6f55f2e95f96677966c55089b 100644 (file)
@@ -40,7 +40,7 @@
 // Some security stuff...
 if (!defined('__SECURITY')) {
        die();
-}
+} // END - if
 
 // Add points in autopurge-mode
 function addPointsAutoPurge ($userid, $points) {
@@ -52,5 +52,17 @@ function addPointsAutoPurge ($userid, $points) {
        sendEmail($userid, '{--AUTOPURGE_MEMBER_SUBJECT--}', $message);
 }
 
+// Checks wether auto-purging is active
+function isAutoPurgingActive () {
+       // Do we have cache?
+       if (!isset($GLOBALS['auto_purging_active'])) {
+               // Determine it
+               $GLOBALS['auto_purging_active'] = (getConfig('auto_purge_active') == 'Y');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS['auto_purging_active'];
+}
+
 // [EOF]
 ?>
index dfe22f5b08a3c21676158b6eb65078e3f1936683..8570debddff4212e612b400c22f323179dddd851 100644 (file)
@@ -45,7 +45,7 @@ if (!defined('__SECURITY')) {
 // This function must be run *BEFORE* a link is removed from table 'mxchange_user_links' !
 function addTurboBonus ($mid, $userid, $type) {
        // Shall we add bonus points?
-       if (getConfig('bonus_active') != 'Y') return false;
+       if (!isBonusRallyeActive()) return false;
 
        // Init variables
        $sql = ''; $bonus = '0'; $mail = '0'; $column = '';
@@ -218,7 +218,7 @@ LIMIT 1",
 //
 function handleBonusPoints ($mode) {
        // Shall we add bonus points?
-       if (getConfig('bonus_active') != 'Y') return;
+       if (!isBonusRallyeActive()) return;
 
        // Switch to jackpot-mode when no UID is supplied but userid-mode is selected
        if ((getConfig('bonus_mode') == 'UID') && (getConfig('bonus_userid') == '0') && (isExtensionActive('jackpot'))) {
@@ -285,7 +285,7 @@ function FILTER_ADD_LOGIN_BONUS () {
 
        // Bonus is not given by default ;-)
        $bonus = false;
-       if ((isExtensionInstalledAndNewer('sql_patches', '0.2.8')) && (getConfig('bonus_active') == 'Y') && (getConfig('bonus_login_yn') == 'Y')) {
+       if ((isExtensionInstalledAndNewer('sql_patches', '0.2.8')) && (ifBonusRallyeActive()) && (getConfig('bonus_login_yn') == 'Y')) {
                // Update last login if far enougth away
                // @TODO This query isn't right, it will only update if the user was for a longer time away!
                SQL_QUERY_ESC('UPDATE
@@ -314,5 +314,17 @@ LIMIT 1',
        }
 }
 
+// Determines wether the "bonus rallye" is active
+function isBonusRallyeActive () {
+       // Do we have cache?
+       if (!isset($GLOBALS['bonus_rallye_active'])) {
+               // Just determine it
+               $GLOBALS['bonus_rallye_active'] = (getConfig('bonus_active') == 'Y');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS['bonus_rallye_active'];
+}
+
 // [EOF]
 ?>
index ae30baba48187eb69b0910a9a37f734237b05339..958d92a882c9d72c326654b4d7eaf0cbda79541a 100644 (file)
@@ -65,7 +65,7 @@ function displayDebugSqls () {
 // Filter for debugging SQLs
 function FILTER_DISPLAY_DEBUG_SQL () {
        // Shall we display SQL queries?
-       if ((isAdmin()) && (isExtensionInstalledAndNewer('other', '0.2.2')) && (getConfig('display_debug_sqls') == 'Y') && (!isGetRequestParameterSet('frame')) && ($GLOBALS['header_sent'] == 2)) {
+       if ((isAdmin()) && (isDisplayDebugSqlEnabled()) && (!isGetRequestParameterSet('frame')) && ($GLOBALS['header_sent'] == 2)) {
                // Then display it here
                displayDebugSqls();
        } // END - if
index 4c5c05aeeb6fe22f83b3e1504e8b0ca2e970b375..e34ccd2b503ccd57c68a7184df3e46d6c15e1021 100644 (file)
@@ -274,14 +274,14 @@ function doRegistration () {
 
        // Generate hash which will be inserted into confirmation mail
        $hash = generateHash(sha1(
-               $confirmedUsers . getConfig('ENCRYPT_SEPERATOR') .
-               $unconfirmedUsers . getConfig('ENCRYPT_SEPERATOR') .
-               $lockedUsers . getConfig('ENCRYPT_SEPERATOR') .
+               $confirmedUsers . getEncryptSeperator() .
+               $unconfirmedUsers . getEncryptSeperator() .
+               $lockedUsers . getEncryptSeperator() .
                postRequestParameter('month') . '-' .
                postRequestParameter('day') . '-' .
-               postRequestParameter('year') . getConfig('ENCRYPT_SEPERATOR') .
-               detectServerName() . getConfig('ENCRYPT_SEPERATOR') .
-               detectRemoteAddr() . getConfig('ENCRYPT_SEPERATOR') .
+               postRequestParameter('year') . getEncryptSeperator() .
+               detectServerName() . getEncryptSeperator() .
+               detectRemoteAddr() . getEncryptSeperator() .
                detectUserAgent() . '/' .
                getConfig('SITE_KEY') . '/' .
                getConfig('DATE_KEY') . '/' .
@@ -409,7 +409,7 @@ VALUES ('%s','%s','%s','%s','%s',%s,'%s','%s',%s, %s,%s,'%s',%s, %s,'%s','UNCONF
        } // END - if
 
        // ... rewrite a zero referal id to the main title
-       if (postRequestParameter('refid') == '0') setPostRequestParameter('refid', getConfig('MAIN_TITLE'));
+       if (postRequestParameter('refid') == '0') setPostRequestParameter('refid', getMainTitle());
 
        // Is ZIP code set?
        if (isPostRequestParameterSet('zip')) {
index bf041ab195e064a2228764d524c930ef67fcad83..a36cbbfe968435d81cb560a2234cdd8ac0aea40e 100644 (file)
@@ -48,20 +48,20 @@ function rewriteLinksInCode ($code) {
        if (isInStringIgnoreCase(getModule(), getConfig('rewrite_skip')) !== false) return $code;
 
        // Generate target URL
-       $target = getConfig('URL') . '/cms/';
+       $target = getUrl() . '/cms/';
 
        // Convert modules.php?module=...
-       foreach (array(getConfig('URL'), '{?URL?}') as $rewrite) {
+       foreach (array(getUrl(), '{?URL?}') as $rewrite) {
                $code = str_replace($rewrite . '/modules.php?module=', $target, $code);
        } // END - foreach
 
        // Do we have an URL linked to mxchange.org?
-       if (isInStringIgnoreCase(getConfig('SERVER_URL'), $code)) {
+       if (isInStringIgnoreCase(getServerUrl(), $code)) {
                // Convert URLs from my server
-               $code = str_replace('{?URL?}/modules.php?module=', getConfig('SERVER_URL') . '/cms/', $code);
+               $code = str_replace('{?URL?}/modules.php?module=', getServerUrl() . '/cms/', $code);
 
                // Convert URLs from my server
-               $code = str_replace(getConfig('URL') . '/modules.php?module=', getConfig('SERVER_URL') . '/cms/', $code);
+               $code = str_replace(getUrl() . '/modules.php?module=', getServerUrl() . '/cms/', $code);
        } // END - if
 
        // Strip slashes as above for the main URL
index dfdd7f2a88c2b064a91b8e4af67485fac13d2ec7..09c7788bae890a4ae04d4fe3e01a05ea7fc33540 100644 (file)
@@ -336,7 +336,7 @@ ORDER BY
 
                // Autopurge installed?
                $lastOnline = '';
-               if ((isExtensionActive('autopurge')) && (getConfig('autopurge_inactive') == 'Y') && (getConfig('ap_inactive_since') > 0)) {
+               if ((isExtensionActive('autopurge')) && (getConfig('autopurge_inactive') == 'Y') && (getApInactiveSince() > 0)) {
                        // Use last online timestamp to keep inactive members away from here
                        $lastOnline   = ' AND `last_online` >= (UNIX_TIMESTAMP() - {?ap_inactive_since?})';
                } // END - if
@@ -360,7 +360,7 @@ ORDER BY
 
                // Autopurge installed?
                $lastOnline = '';
-               if ((isExtensionActive('autopurge')) && (getConfig('autopurge_inactive') == 'Y') && (getConfig('ap_inactive_since') > 0)) {
+               if ((isExtensionActive('autopurge')) && (getConfig('autopurge_inactive') == 'Y') && (getApInactiveSince() > 0)) {
                        // Use last online timestamp to keep inactive members away from here
                        $lastOnline   = ' AND `last_online` >= (UNIX_TIMESTAMP() - {?ap_inactive_since?})';
                } // END - if
index fce7ca86967a46abc9bd8818c3728bcda1f78e88..266eca12cecc70837bf7b13db55ad8505dd7473c 100644 (file)
@@ -51,7 +51,7 @@ setConfigEntry('_DB_TYPE'    , 'mysql3');
 $GLOBALS['config_local_loaded'] = false;
 
 // Is the local configuration there?
-if ((isIncludeReadable(getConfig('CACHE_PATH') . 'config-local.php')) && (isIncludeReadable('inc/config.php'))) {
+if ((isIncludeReadable(getCachePath() . 'config-local.php')) && (isIncludeReadable('inc/config.php'))) {
        // We are better in installation mode
        $GLOBALS['mailer_installing'] = true;
 
@@ -62,10 +62,10 @@ if ((isIncludeReadable(getConfig('CACHE_PATH') . 'config-local.php')) && (isIncl
        setConfigEntry('OUTPUT_MODE', 'render');
 
        // Both exist! This is bad and should be avoided by the admin
-       debug_report_bug(__FILE__, __LINE__, 'You have uploaded or kept an out-dated file at <strong>inc/config.php</strong> along with the new file <strong>'.getConfig('CACHE_PATH').'config-local.php</strong>. Please remove <strong>inc/config.php</strong> to avoid incompatiblity issues. Thank you.');
-} elseif (isIncludeReadable(getConfig('CACHE_PATH') . 'config-local.php')) {
+       debug_report_bug(__FILE__, __LINE__, 'You have uploaded or kept an out-dated file at <strong>inc/config.php</strong> along with the new file <strong>'.getCachePath().'config-local.php</strong>. Please remove <strong>inc/config.php</strong> to avoid incompatiblity issues. Thank you.');
+} elseif (isIncludeReadable(getCachePath() . 'config-local.php')) {
        // Then load it
-       loadIncludeOnce(getConfig('CACHE_PATH') . 'config-local.php');
+       loadIncludeOnce(getCachePath() . 'config-local.php');
 
        // Mark configuration as loaded
        $GLOBALS['config_local_loaded'] = true;
index f61ce66fba0c52ee410b518faffaed73a423d999..260b928919fd9eb49afd28885f57c0a16439dfe6 100644 (file)
@@ -57,7 +57,7 @@ if ($GLOBALS['cache_instance']->loadCacheFile('revision')) {
        $GLOBALS['cache_instance']->finalize();
 
        // Generate FQFN for old revision file
-       $FQFN = sprintf("%s/.revision", getConfig('CACHE_PATH'));
+       $FQFN = sprintf("%s/.revision", getCachePath());
 
        // Is it there?
        if (isFileReadable($FQFN)) {
index 01facaab06f0026c69e97acdb88e1f24108ad377..dae1e4cdfeb98ed1d4442679f27722d0033db896 100644 (file)
@@ -74,7 +74,7 @@ if (!isAdminRegistered()) {
                // Check if registration wents fine
                switch ($ret) {
                        case 'done':
-                               $done = changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', 'ADMIN-SETUP', "setConfigEntry('ADMIN_REGISTERED', '", "');", 'Y', 0);
+                               $done = changeDataInFile(getCachePath() . 'config-local.php', 'ADMIN-SETUP', "setConfigEntry('ADMIN_REGISTERED', '", "');", 'Y', 0);
                                if ($done === true) {
                                        // Registering is done
                                        redirectToUrl('modules.php?module=admin&amp;register=done');
index 3096cd930e2108f56d2813f79f761ab533971c86..e4296a066b3522250b43eb46cf349e93f34a7e5f 100644 (file)
@@ -1124,7 +1124,7 @@ function sendAdminPasswordResetLink ($email) {
        SQL_FREERESULT($result);
 
        // Generate hash for reset link
-       $content['hash'] = generateHash(getConfig('URL') . ':' . $content['id'] . ':' . $content['login'] . ':' . $content['password'], substr($content['password'], 10));
+       $content['hash'] = generateHash(getUrl() . ':' . $content['id'] . ':' . $content['login'] . ':' . $content['password'], substr($content['password'], 10));
 
        // Remove some data
        unset($content['id']);
@@ -1155,7 +1155,7 @@ function adminResetValidateHashLogin ($hash, $login) {
                $content = SQL_FETCHARRAY($result);
 
                // Generate hash again
-               $hashFromData = generateHash(getConfig('URL') . ':' . $content['id'] . ':' . $login . ':' . $content['password'], substr($content['password'], 10));
+               $hashFromData = generateHash(getUrl() . ':' . $content['id'] . ':' . $login . ':' . $content['password'], substr($content['password'], 10));
 
                // Does both match?
                $valid = ($hash == $hashFromData);
index 39df93d2074f3edb112775ea44cc52fda8516281..c7d37f83f73b0e62f37cfeb7b85bf726000b4ff1 100644 (file)
@@ -62,7 +62,7 @@ if (isFormSent()) {
        $content['ap_notify_del_mails']   = addSelectionBox('yn', getConfig('ap_dm_notify')   , 'ap_dm_notify');
 
        // Output time selection boxes
-       $content['ap_in_since']       = createTimeSelections(getConfig('ap_inactive_since')  , 'ap_inactive_since'  , 'MWDh');
+       $content['ap_in_since']       = createTimeSelections(getApInactiveSince()  , 'ap_inactive_since'  , 'MWDh');
        $content['ap_in_time']        = createTimeSelections(getConfig('ap_inactive_time')   , 'ap_inactive_time'   , 'MWDh');
        $content['ap_un_time']        = createTimeSelections(getConfig('ap_unconfirmed_time'), 'ap_unconfirmed_time', 'MWDh');
        $content['ap_task_time']      = createTimeSelections(getConfig('ap_tasks_time')      , 'ap_tasks_time'      , 'MWDh');
index 785222427f0287a0882b37a4388f6c3c219d4515..88bf548263f0a90078c59a999523425310f5b7a7 100644 (file)
@@ -169,7 +169,7 @@ LIMIT 1",
                                // Output message
                                loadTemplate('admin_settings_saved', false, $message);
                        } // END - if
-               } elseif (isFileReadable(sprintf("%stemplates/%s/html/admin/%s.tpl", getConfig('PATH'), getLanguage(), $TPL))) {
+               } elseif (isFileReadable(sprintf("%stemplates/%s/html/admin/%s.tpl", getPath(), getLanguage(), $TPL))) {
                        // Create mailto link
                        $content['contact'] = '<a href="' . generateEmailLink($content['email'], 'sponsor_data') . '">' . $content['surname'] . ' ' . $content['family'] . '</a>';
 
index f098de3f1cad5cce32f5f4a225a5ad43e3d98e4d..954a70a92f87f36a06e2e72aa65499212c9066fa 100644 (file)
@@ -118,7 +118,7 @@ ORDER BY
 
                // Prepare constant for timemark
                if (isExtensionActive('autopurge')) {
-                       $content['autopurge_timeout'] = generateDateTime(time() - getConfig('ap_inactive_since'), 2);
+                       $content['autopurge_timeout'] = generateDateTime(time() - getApInactiveSince(), 2);
                } else {
                        $content['autopurge_timeout'] = loadTemplate('admin_settings_saved', true, getMaskedMessage('EXTENSION_PROBLEM_EXTENSION_NOT_INSTALLED', 'autopurge'));
                }
index 83c96f2799290fd89d7028e5de2779dbec904cce..2cf00c09d67cb2b18043382bd49490bcc9aaf433 100644 (file)
@@ -45,7 +45,7 @@ if ((!defined('__SECURITY')) || (!isAdmin())) {
 // Add description as navigation point
 addMenuDescription('admin', __FILE__);
 
-if (getConfig('bonus_active') == 'Y') {
+if (ifBonusRallyeActive()) {
        // Shall I withdraw now?
        if (isPostRequestParameterSet('withdraw')) {
                // Okay, let's prepare...
@@ -133,7 +133,7 @@ ORDER BY
                // Prepare constant for timemark
                // @TODO Can't this be moved into our expression language?
                if (isExtensionActive('autopurge')) {
-                       $content['autopurge_timeout'] = generateDateTime(time() - getConfig('ap_inactive_since'), 2);
+                       $content['autopurge_timeout'] = generateDateTime(time() - getApInactiveSince(), 2);
                } else {
                        $content['autopurge_timeout'] = getMaskedMessage('EXTENSION_PROBLEM_EXTENSION_NOT_INSTALLED', 'autopurge');
                }
index 829bc839bad52f457e7c92aa847fe296b65bd41a..bc0c597d0894348b21859ef0aa8eaf2d839fcf4b 100644 (file)
@@ -48,7 +48,7 @@ addMenuDescription('admin', __FILE__);
 if (isGetRequestParameterSet('access')) {
        // Secure input and construct FQFN
        $access = SQL_ESCAPE(secureString(getRequestParameter('access')));
-       $target = sprintf("%slogs/%s", getConfig('PATH'), $access);
+       $target = sprintf("%slogs/%s", getPath(), $access);
 
        // Is the file valid and readable?
        if (isFileReadable($target)) {
@@ -89,7 +89,7 @@ if (isGetRequestParameterSet('access')) {
        }
 } else {
        // Is the directory there?
-       if (isDirectory(getConfig('PATH') . getConfig('logs_base'))) {
+       if (isDirectory(getPath() . getConfig('logs_base'))) {
                // Logs directory does exist so begin the list
                outputHtml('<ol>');
 
index 74384a2434c50551d10d758f531963eb0e6705d4..a7c5a861dfcf2b47fd2c357f0bf29bbfb76b55ab 100644 (file)
@@ -93,7 +93,7 @@ LIMIT 1",
                                        } // END - if
 
                                        // Check for bonus extension version >= 0.4.4 for the order bonus
-                                       if ((isExtensionInstalledAndNewer('bonus', '0.4.4')) && (getConfig('bonus_active') == 'Y')) {
+                                       if ((isExtensionInstalledAndNewer('bonus', '0.4.4')) && (ifBonusRallyeActive())) {
                                                // Add points directly
                                                SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `bonus_order`=`bonus_order`+{?bonus_order?} WHERE `userid`=%s LIMIT 1",
                                                        array(bigintval($content['sender'])), __FILE__, __LINE__);
@@ -146,7 +146,7 @@ LIMIT 1",
                                sendEmail($content['sender'], '{--MEMBER_ORDER_REJECTED--}', $message_user);
 
                                // If you do not enter an URL to redirect to, your URL will be set!
-                               if ((!isPostRequestParameterSet('redirect')) || (postRequestParameter('redirect') == 'http://')) setPostRequestParameter('redirect', getConfig('URL'));
+                               if ((!isPostRequestParameterSet('redirect')) || (postRequestParameter('redirect') == 'http://')) setPostRequestParameter('redirect', getUrl());
 
                                // Redirect URL
                                SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_pool` SET url='%s', `data_type`='NEW' WHERE `id`=%s LIMIT 1",
index 0219bab845f1aba6e987d3ef289ec016890bf8fe..8955a29616ad3a56bd4dcd3c8ef38e8cc77451a9 100644 (file)
@@ -91,7 +91,7 @@ if (empty($response[0]) && empty($response[1]) && empty($response[2]) && empty($
 if (empty($ONLINE['version'])) {
        // Disconnected?
        loadTemplate('admin_settings_saved', false, '<div class="admin_failed">{--ADMIN_CANNOT_CHECK_VERSION--} (' . $ONLINE['code'] . ')</div>');
-} elseif (($ONLINE['version'] != getConfig('FULL_VERSION')) || ($ONLINE['revision'] != getConfig('CURR_SVN_REVISION'))) {
+} elseif (($ONLINE['version'] != getFullVersion()) || ($ONLINE['revision'] != getCurrSvnRevision())) {
        // New full-version available (all previous released patches are included in this version!)
        $ONLINE['changed'] = generateDateTime($ONLINE['changed'], 2);
 
index 0af9eee3a811c12615a6bc8868c51cbc600e35ad..1ff86f45f9fc1816818da5a8987539ad87cfb4ef 100644 (file)
@@ -51,13 +51,13 @@ $usage = getConfig('usage_base') . '/';
 if (isGetRequestParameterSet('image')) {
        if (getRequestParameter('type') == 'usage') {
                $FQFN = sprintf("%s%s/usage.png",
-                       getConfig('PATH'),
+                       getPath(),
                        getConfig('usage_base')
                );
        } else {
                if (strpos(getRequestParameter('image'), "\\") > 0) setGetRequestParameter('image', substr(getRequestParameter('image'), 0, strpos(getRequestParameter('image'), "\\")));
                $FQFN = sprintf("%s%s/%s_usage_%s.png",
-                       getConfig('PATH'),
+                       getPath(),
                        getConfig('usage_base'),
                        getRequestParameter('type'),
                        getRequestParameter('image')
@@ -73,12 +73,12 @@ if (isGetRequestParameterSet('image')) {
        shutdown();
 } elseif (!isGetRequestParameterSet('usage')) {
        $FQFN = sprintf("%s%s/index.html",
-               getConfig('PATH'),
+               getPath(),
                getConfig('usage_base')
        );
 } else {
        $FQFN = sprintf("%s%s/usage_%s.html",
-               getConfig('PATH'),
+               getPath(),
                getConfig('usage_base'),
                getRequestParameter('usage')
        );
index e9fe5042261253f9bc8efec937327a3d65e970e7..fa5f8dc9b0556b73004dcb04025e97c802b30781 100644 (file)
@@ -76,7 +76,7 @@ if (isGetRequestParameterSet('order')) {
 
 if ((isPostRequestParameterSet('url')) || (isGetRequestParameterSet('url')) || (isGetRequestParameterSet('frame'))) {
        // Default URL is ours
-       $url = getConfig('URL');
+       $url = getUrl();
 
        // Use URL from POST or GET data if set
        if (isPostRequestParameterSet('url')) {
index fcbbddb482f44af4b7a450b87d5852839fcafa5e..777a4a433f60dc7f123115e9d66901a1edbeb556 100644 (file)
@@ -107,7 +107,7 @@ LIMIT 1",
                                        }
 
                                        // If version matches add ref bonus to refid's account
-                                       if ((isExtensionInstalledAndNewer('bonus', '0.4.4')) && (getConfig('bonus_active') == 'Y')) {
+                                       if ((isExtensionInstalledAndNewer('bonus', '0.4.4')) && (ifBonusRallyeActive())) {
                                                // Add points (directly only!)
                                                SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `bonus_ref`=`bonus_ref`+{?bonus_ref?} WHERE `userid`=%s LIMIT 1",
                                                        array(bigintval($refid)), __FILE__, __LINE__);
index 5b52e527edd8eb98a049ab11bbf5d766bed82ffc..7a29cbe3e1db2afb3be9607061a4a1182dcca0e3 100644 (file)
@@ -57,7 +57,7 @@ outputHtml('<div style="padding-left: 10px; padding-right: 10px">');
 $rdf = new fase4_rdf();
 $rdf->_use_nl2br = false;
 $rdf->use_dynamic_display(false);
-$rdf->set_CacheDir(getConfig('CACHE_PATH') . '');
+$rdf->set_CacheDir(getCachePath() . '');
 $rdf->set_salt(md5(getConfig('SITE_KEY')));
 $rdf->set_max_item(10);
 $rdf->set_Options(
index 2017dfd9022049c299bb2057b9670c79b506d39f..1a15e0068bd6576114c6acd71101cac7cf32eb3a 100644 (file)
@@ -154,13 +154,13 @@ if (isExtensionInstalledAndOlder('bonus', '0.4.4')) setConfigEntry('bonus_active
 $content['special_rows'] = '';
 
 // Display login bonus and turbo-click bonus
-if ((isExtensionInstalledAndNewer('bonus', '0.2.2')) && (isExtensionActive('bonus')) && (getConfig('bonus_active') == 'Y')) {
+if ((isExtensionInstalledAndNewer('bonus', '0.2.2')) && (isExtensionActive('bonus')) && (ifBonusRallyeActive())) {
        // Total bonus points
        $content['total'] = getUserData('turbo_bonus') + getUserData('login_bonus') + getUserData('bonus_ref') + getUserData('bonus_order') + getUserData('bonus_stats');
 
        // Output rows
        $content['special_rows'] = loadTemplate('member_points_bonus_rows', true, $content);
-} elseif ((isExtensionActive('bonus')) && (getConfig('bonus_active') != 'Y')) {
+} elseif ((isExtensionActive('bonus')) && (!isBonusRallyeActive())) {
        // Bonus active rallye deactivated
        $content['special_rows'] = loadTemplate('member_points_bonus_disabled', true);
 } elseif ((isAdmin()) && (isExtensionOlder('bonus', '0.2.2')) && (isExtensionActive('bonus'))) {
index 04ecf577420afae10125f2b5449f36a2ac1a1f99..2e838689b888c67c13c7dfdb0d34688bea03fa2c 100644 (file)
@@ -73,7 +73,7 @@ if (SQL_NUMROWS($result) > 0) {
        // List available ref banners
        $OUT = '';
        while ($row = SQL_FETCHARRAY($result)) {
-               $test = str_replace(getConfig('URL'), getConfig('PATH'), $row['url']); $size = '0';
+               $test = str_replace(getUrl(), getPath(), $row['url']); $size = '0';
                if ($test == $row['url']) {
                        // Download banner (I hope you keep the banner on same server???)
                        $fp = sendGetRequest($row['url']); $bannerContent = '';
index 63440b567a33a198e2963cc3f88b5777ded38934..2e664ec27bf1bec0968d47914ffdba7ea8d613ce 100644 (file)
@@ -65,7 +65,7 @@ if (($curr != getConfig('last_month')) && (getConfig('last_month') > 0) && (getC
        // Let's check if there are some points left we can 'pay'...
        if (isExtensionActive('autopurge')) {
                // Use last online stamp only when autopurge for inactive members is activated
-               if ((getConfig('ap_inactive_since') > 0) && (getConfig('beg_active') == 'Y')) {
+               if ((getApInactiveSince() > 0) && (getConfig('beg_active') == 'Y')) {
                        // Okay, include last online timestamp
                        $whereStatement1 .= " AND `last_online` >= (UNIX_TIMESTAMP() - {?ap_inactive_since?})";
                } // END - if
index cb010de05e74c2545ff4d830b30cc96be63a2297..14640c1a2b67c09150fcb728d053617937dabe05 100644 (file)
@@ -58,7 +58,7 @@ if (($curr != getConfig('last_month')) && (getConfig('bonus_ranks') > 0) && (get
        // Shall I keep inactive members away from here? (mostly wanted in an "active-rallye" ...)
        if (isExtensionActive('autopurge')) {
                // Use last online stamp only when autopurge for inactive members is activated
-               if (getConfig('ap_inactive_since') > 0) {
+               if (getApInactiveSince() > 0) {
                        // Okay, include last online timestamp
                        $whereStatement1 = "WHERE `status`='CONFIRMED' AND `last_online` >= (UNIX_TIMESTAMP() - {?ap_inactive_since?})";
                } // END - if
index 65ff7e9f968a8e7a8b491ecaec50d01de667d812..322626c01f6f50e53158e9b7cbc0c1659acbff7e 100644 (file)
@@ -1849,7 +1849,7 @@ ORDER BY
                        $row['activity'] = '{--MEMBER_ACTIVITY_ACTIVE--}';
 
                        // Is autopurge installed and the user inactive?
-                       if ((isExtensionActive('autopurge')) && ((time() - getConfig('ap_inactive_since')) >= $row['last_online']))  {
+                       if ((isExtensionActive('autopurge')) && ((time() - getApInactiveSince()) >= $row['last_online']))  {
                                // Inactive user!
                                $row['activity'] = '{--MEMBER_ACTIVITY_INACTIVE--}';
                        } // END - if
index 2ca54a1cbe9d94e9728a3f855a5699d3d05170d4..493e9ee43c371da7714b11609b08a8e6dda20def 100644 (file)
@@ -55,7 +55,7 @@ $year  = getYear();
 
 // Shall I include only active members?
 $add = '%s'; $value = '';
-if ((getConfig('birthday_active')) && (isExtensionActive('autopurge')) && (getConfig('autopurge_inactive') == 'Y') && (getConfig('ap_inactive_since') > 0)) {
+if ((getConfig('birthday_active')) && (isExtensionActive('autopurge')) && (getConfig('autopurge_inactive') == 'Y') && (getApInactiveSince() > 0)) {
        $add = " AND `last_online` >= (UNIX_TIMESTAMP() - {?ap_inactive_since?})";
 } // END - if
 
index a87bfc48862b32e2ab3e7611500a70ad8a13ba8d..de6c340851fddfdc74b1675dfb21922560092f6b 100644 (file)
@@ -61,7 +61,7 @@ function getActualVersion ($type = 'Revision') {
                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ret[' . $type . ']=' . $ret);
        } else {
                // FQFN of revision file
-               $FQFN = sprintf("%s/.revision", getConfig('CACHE_PATH'));
+               $FQFN = sprintf("%s/.revision", getCachePath());
 
                // Check if 'check_revision_data' is setted (switch for manually rewrite the .revision-File)
                if ((isGetRequestParameterSet('check_revision_data')) && (getRequestParameter('check_revision_data') == 'yes')) {
index 4383b26f5277a767b78fe5c8eb1ec1eadc6bf8b4..3190a6d9ab3388885ebb67dfaa2a8fa7d3b28a74 100644 (file)
@@ -66,7 +66,7 @@ function isStatsEntrySet ($entry) {
 // Increments a statistics entry
 function incrementStatsEntry ($entry, $amount=1) {
        // Do we have stats enabled?
-       if (getConfig('stats_enabled') != 'Y') return;
+       if (!ifStatsAreEnabled()) return;
 
        // Is it there?
        if (isStatsEntrySet($entry)) {
@@ -182,17 +182,5 @@ function FILTER_FLUSH_STATS () {
        } // END - if
 }
 
-// Check wether stats are enabled
-function ifStatsAreEnabled () {
-       // Do we have cache?
-       if (!isset($GLOBALS['stats_enabled'])) {
-               // Then determine it
-               $GLOBALS['stats_enabled'] = (getConfig('stats_enabled') == 'Y');
-       } // END - if
-
-       // Return cached value
-       return $GLOBALS['stats_enabled'];
-}
-
 // [EOF]
 ?>
index ebe08b6e9b21d726af8adc94564816a539bab101..644ff0c6073bc689f2966d149991cf96f5ab9465 100644 (file)
@@ -59,7 +59,7 @@ if ((getOutputMode() == 1) || (getConfig('css_php') == 'DIRECT')) {
        $stylesList = merge_array($stylesList, getExtensionCssFiles());
 
        // Generate base path
-       $basePath = sprintf("%stheme/%s/css/", getConfig('PATH'), getCurrentTheme());
+       $basePath = sprintf("%stheme/%s/css/", getPath(), getCurrentTheme());
 
        // Output inclusion lines
        foreach ($stylesList as $value) {
@@ -88,7 +88,7 @@ if ((getOutputMode() == 1) || (getConfig('css_php') == 'DIRECT')) {
        $stylesList = merge_array($stylesList, getExtensionCssFiles());
 
        // Generate base path
-       $basePath = sprintf("%stheme/%s/css/", getConfig('PATH'), getCurrentTheme());
+       $basePath = sprintf("%stheme/%s/css/", getPath(), getCurrentTheme());
 
        // Output inclusion lines
        $OUT = '';
@@ -116,7 +116,7 @@ if ((getOutputMode() == 1) || (getConfig('css_php') == 'DIRECT')) {
                $OUT .= '?theme=' . $newTheme . '&amp;installing=1';
        } else {
                // Add SVN revision to bypass caching problems
-               $OUT .= '?rev=' . getConfig('CURR_SVN_REVISION');
+               $OUT .= '?rev=' . getCurrSvnRevision();
        }
 
        // Close tag
index fad3dc2df35d68961d078876cebc6f263f70b6f9..d520c5f0b83c595f886b2574fe7d236db49293c8 100644 (file)
@@ -126,7 +126,7 @@ function outputHtml ($htmlCode, $newLine = true) {
        // Do we have HTML-Code here?
        if (!empty($htmlCode)) {
                // Yes, so we handle it as you have configured
-               switch (getConfig('OUTPUT_MODE')) {
+               switch (getCachedOutputMode()) {
                        case 'render':
                                // That's why you don't need any \n at the end of your HTML code... :-)
                                if (getPhpCaching() == 'on') {
@@ -175,7 +175,7 @@ function outputHtml ($htmlCode, $newLine = true) {
 
                // Output code here, DO NOT REMOVE! ;-)
                outputRawCode($GLOBALS['output']);
-       } elseif ((getConfig('OUTPUT_MODE') == 'render') && (!empty($GLOBALS['output']))) {
+       } elseif ((getCachedOutputMode() == 'render') && (!empty($GLOBALS['output']))) {
                // Send all HTTP headers
                sendHttpHeaders();
 
@@ -296,7 +296,7 @@ function loadTemplate ($template, $return = false, $content = array()) {
                if (empty($GLOBALS['refid'])) $GLOBALS['refid'] = '0';
 
                // Base directory
-               $basePath = sprintf("%stemplates/%s/html/", getConfig('PATH'), getLanguage());
+               $basePath = sprintf("%stemplates/%s/html/", getPath(), getLanguage());
                $extraPath = detectExtraTemplatePath($template);;
 
                ////////////////////////
@@ -479,7 +479,7 @@ function loadEmailTemplate ($template, $content = array(), $userid = '0') {
        } // END - if
 
        // Base directory
-       $basePath = sprintf("%stemplates/%s/emails/", getConfig('PATH'), getLanguage());
+       $basePath = sprintf("%stemplates/%s/emails/", getPath(), getLanguage());
 
        // Detect extra path
        $extraPath = detectExtraTemplatePath($template);
@@ -793,7 +793,7 @@ function generateImageOrCode ($img_code, $headerSent = true) {
 
        // Load image
        $img = sprintf("%s/theme/%s/images/code_bg.%s",
-               getConfig('PATH'),
+               getPath(),
                getCurrentTheme(),
                getConfig('img_type')
        );
@@ -1188,7 +1188,7 @@ function debug_report_bug ($F, $L, $message = '', $sendEmail = true) {
        } // END - if
 
        // Add output
-       $debug .= 'Please report this bug at <a title="Direct link to the bug-tracker" href="http://bugs.mxchange.org" rel="external" target="_blank">http://bugs.mxchange.org</a> and include the logfile from <strong>' . str_replace(getConfig('PATH'), '', getConfig('CACHE_PATH')) . 'debug.log</strong> in your report (you can now attach files):<pre>';
+       $debug .= 'Please report this bug at <a title="Direct link to the bug-tracker" href="http://bugs.mxchange.org" rel="external" target="_blank">http://bugs.mxchange.org</a> and include the logfile from <strong>' . str_replace(getPath(), '', getCachePath()) . 'debug.log</strong> in your report (you can now attach files):<pre>';
        $debug .= debug_get_printable_backtrace();
        $debug .= '</pre>';
        $debug .= '<div>Request-URI: ' . getRequestUri() . '</div>';
@@ -1347,7 +1347,7 @@ function determinePageTitle () {
                $TITLE = '';
 
                // Title decoration enabled?
-               if ((getConfig('enable_title_deco') == 'Y') && (getConfig('title_left') != '')) $TITLE .= trim(getConfig('title_left')) . ' ';
+               if ((isTitleDecorationEnabled()) && (getConfig('title_left') != '')) $TITLE .= trim(getConfig('title_left')) . ' ';
 
                // Do we have some extra title?
                if (isExtraTitleSet()) {
@@ -1356,10 +1356,10 @@ function determinePageTitle () {
                } // END - if
 
                // Add main title
-               $TITLE .= getConfig('MAIN_TITLE');
+               $TITLE .= getMainTitle();
 
                // Add title of module? (middle decoration will also be added!)
-               if ((getConfig('enable_mod_title') == 'Y') || ((!isWhatSet()) && (!isActionSet())) || (getModule() == 'admin')) {
+               if ((isModuleTitleEnabled()) || ((!isWhatSet()) && (!isActionSet())) || (getModule() == 'admin')) {
                        $TITLE .= ' ' . trim(getConfig('title_middle')) . ' ' . getModuleTitle(getModule());
                } // END - if
 
@@ -1367,16 +1367,16 @@ function determinePageTitle () {
                $mode = '';
                if (getModule() == 'login') $mode = 'member';
                elseif (getModule() == 'index') $mode = 'guest';
-               if ((!empty($mode)) && (getConfig('enable_what_title') == 'Y')) $TITLE .= ' ' . trim(getConfig('title_middle')) . ' ' . getTitleFromMenu($mode, getWhat());
+               if ((!empty($mode)) && (isWhatTitleEnabled())) $TITLE .= ' ' . trim(getConfig('title_middle')) . ' ' . getTitleFromMenu($mode, getWhat());
 
                // Add title decorations? (right)
-               if ((getConfig('enable_title_deco') == 'Y') && (getConfig('title_right') != '')) $TITLE .= ' ' . trim(getConfig('title_right'));
+               if ((isTitleDecorationEnabled()) && (getConfig('title_right') != '')) $TITLE .= ' ' . trim(getConfig('title_right'));
 
                // Remember title in constant for the template
                $pageTitle = $TITLE;
        } elseif ((isInstalled()) && (isAdminRegistered())) {
                // Installed, admin registered but no ext-sql_patches
-               $pageTitle = '[-- ' . getConfig('MAIN_TITLE') . ' - ' . getModuleTitle(getModule()) . ' --]';
+               $pageTitle = '[-- ' . getMainTitle() . ' - ' . getModuleTitle(getModule()) . ' --]';
        } elseif ((isInstalled()) && (!isAdminRegistered())) {
                // Installed but no admin registered
                $pageTitle = '{--SETUP_OF_MAILER--}';
@@ -1522,7 +1522,7 @@ function sendModeMails ($mod, $modes) {
                                        // Load template
                                        $message = loadEmailTemplate('member_mydata_notify', $content, getMemberId());
 
-                                       if (getConfig('admin_notify') == 'Y') {
+                                       if (isAdminNotificationEnabled()) {
                                                // The admin needs to be notified about a profile change
                                                $message_admin = 'admin_mydata_notify';
                                                $sub_adm   = '{--ADMIN_CHANGED_DATA--}';
@@ -1564,7 +1564,7 @@ function sendModeMails ($mod, $modes) {
                if ((!empty($sub_adm)) && (!empty($message_admin))) {
                        // Send admin mail
                        sendAdminNotification($sub_adm, $message_admin, $content, getMemberId());
-               } elseif (getConfig('admin_notify') == 'Y') {
+               } elseif (isAdminNotificationEnabled()) {
                        // Cannot send mails to admin!
                        $content = '{--CANNOT_SEND_ADMIN_MAILS--}';
                } else {
@@ -1660,7 +1660,7 @@ function generateCacheFqfn ($template, $mode = 'html') {
                // Generate the FQFN
                $GLOBALS['template_cache_fqfn'][$template] = sprintf(
                        "%s_compiled/%s/%s.tpl.cache",
-                       getConfig('CACHE_PATH'),
+                       getCachePath(),
                        $mode,
                        $template
                );
index 6fc935bd28a050adf6a4116e55d3ee69c8b4e1c1..2a64684ed44874018d4272f62782baee48a25d5e 100644 (file)
@@ -303,11 +303,11 @@ function isInstalled () {
                        )
                ) || (
                        // New config file found and loaded
-                       isIncludeReadable(getConfig('CACHE_PATH') . 'config-local.php')
+                       isIncludeReadable(getCachePath() . 'config-local.php')
                ) || (
                        (
                                // New config file found, but not yet read
-                               isIncludeReadable(getConfig('CACHE_PATH') . 'config-local.php')
+                               isIncludeReadable(getCachePath() . 'config-local.php')
                        ) && (
                                (
                                        // Only new config file is found
@@ -399,7 +399,7 @@ function copyFileVerified ($source, $dest, $chmod = '') {
        // Is the target directory there?
        if (!isDirectory(dirname($dest))) {
                // Then abort here
-               debug_report_bug(__FUNCTION__, __LINE__, 'Cannot find directory ' . str_replace(getConfig('PATH'), '', dirname($dest)) . '.');
+               debug_report_bug(__FUNCTION__, __LINE__, 'Cannot find directory ' . str_replace(getPath(), '', dirname($dest)) . '.');
        } // END - if
 
        // Now try to copy it
@@ -890,7 +890,14 @@ function isCurrentUserIdSet () {
 
 // Checks wether we are debugging template cache
 function isDebuggingTemplateCache () {
-       return (getConfig('DEBUG_TEMPLATE_CACHE') == 'Y');
+       // Do we have cache?
+       if (!isset($GLOBALS['debug_template_cache'])) {
+               // Determine it
+               $GLOBALS['debug_template_cache'] = (getConfig('DEBUG_TEMPLATE_CACHE') == 'Y');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS['debug_template_cache'];
 }
 
 // Wrapper for fetchUserData() and getUserData() calls
@@ -1168,5 +1175,365 @@ function getMinute ($timestamp = null) {
        return $GLOBALS['minute'][$timestamp];
 }
 
+// Checks wether the title decoration is enabled
+function isTitleDecorationEnabled () {
+       // Do we have cache?
+       if (!isset($GLOBALS['title_deco_enabled'])) {
+               // Just check it
+               $GLOBALS['title_deco_enabled'] = (getConfig('enable_title_deco') == 'Y');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS['title_deco_enabled'];
+}
+
+// Checks wether filter usage updates are enabled (expensive queries!)
+function isFilterUsageUpdateEnabled () {
+       // Do we have cache?
+       if (!isset($GLOBALS['filter_usage_updates'])) {
+               // Determine it
+               $GLOBALS['filter_usage_updates'] = ((isExtensionInstalledAndNewer('sql_patches', '0.6.0')) && (isConfigEntrySet('update_filter_usage')) && (getConfig('update_filter_usage') == 'Y'));
+       } // END - if
+
+       // Return cache
+       return $GLOBALS['filter_usage_updates'];
+}
+
+// Checks wether debugging of weekly resets is enabled
+function isWeeklyResetDebugEnabled () {
+       // Do we have cache?
+       if (!isset($GLOBALS['weekly_reset_debug'])) {
+               // Determine it
+               $GLOBALS['weekly_reset_debug'] = ((isConfigEntrySet('DEBUG_WEEKLY')) && (getConfig('DEBUG_WEEKLY') == 'Y'));
+       } // END - if
+
+       // Return cache
+       return $GLOBALS['weekly_reset_debug'];
+}
+
+// Checks wether debugging of monthly resets is enabled
+function isMonthlyResetDebugEnabled () {
+       // Do we have cache?
+       if (!isset($GLOBALS['monthly_reset_debug'])) {
+               // Determine it
+               $GLOBALS['monthly_reset_debug'] = ((isConfigEntrySet('DEBUG_MONTHLY')) && (getConfig('DEBUG_MONTHLY') == 'Y'));
+       } // END - if
+
+       // Return cache
+       return $GLOBALS['monthly_reset_debug'];
+}
+
+// Checks wether displaying of debug SQLs are enabled
+function isDisplayDebugSqlEnabled () {
+       // Do we have cache?
+       if (!isset($GLOBALS['display_debug_sql'])) {
+               // Determine it
+               $GLOBALS['display_debug_sql'] = ((isExtensionInstalledAndNewer('other', '0.2.2')) && (getConfig('display_debug_sqls') == 'Y'));
+       } // END - if
+
+       // Return cache
+       return $GLOBALS['display_debug_sql'];
+}
+
+// Checks wether module title is enabled
+function isModuleTitleEnabled () {
+       // Do we have cache?
+       if (!isset($GLOBALS['mod_title_enabled'])) {
+               // Determine it
+               $GLOBALS['mod_title_enabled'] = (getConfig('enable_mod_title') == 'Y');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS['mod_title_enabled'];
+}
+
+// Checks wether what title is enabled
+function isWhatTitleEnabled () {
+       // Do we have cache?
+       if (!isset($GLOBALS['mod_title_enabled'])) {
+               // Determine it
+               $GLOBALS['mod_title_enabled'] = (getConfig('enable_what_title') == 'Y');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS['mod_title_enabled'];
+}
+
+// Checks wether stats are enabled
+function ifStatsAreEnabled () {
+       // Do we have cache?
+       if (!isset($GLOBALS['stats_enabled'])) {
+               // Then determine it
+               $GLOBALS['stats_enabled'] = (getConfig('stats_enabled') == 'Y');
+       } // END - if
+
+       // Return cached value
+       return $GLOBALS['stats_enabled'];
+}
+
+// Checks wether admin-notification of certain user actions is enabled
+function isAdminNotificationEnabled () {
+       // Do we have cache?
+       if (!isset($GLOBALS['admin_notification_enabled'])) {
+               // Determine it
+               $GLOBALS['admin_notification_enabled'] = (getConfig('admin_notify') == 'Y');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS['admin_notification_enabled'];
+}
+
+// Checks wether random referal id selection is enabled
+function isRandomReferalIdEnabled () {
+       // Do we have cache?
+       if (!isset($GLOBALS['select_user_zero_refid'])) {
+               // Determine it
+               $GLOBALS['select_user_zero_refid'] = (getConfig('select_user_zero_refid') == 'Y');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS['select_user_zero_refid'];
+}
+
+// "Getter" for default language
+function getDefaultLanguage () {
+       // Do we have cache?
+       if (!isset($GLOBALS['default_language'])) {
+               // Determine it
+               $GLOBALS['default_language'] = getConfig('DEFAULT_LANG');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS['default_language'];
+}
+
+// "Getter" for path
+function getPath () {
+       // Do we have cache?
+       if (!isset($GLOBALS['path'])) {
+               // Determine it
+               $GLOBALS['path'] = getConfig('PATH');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS['path'];
+}
+
+// "Getter" for url
+function getUrl () {
+       // Do we have cache?
+       if (!isset($GLOBALS['url'])) {
+               // Determine it
+               $GLOBALS['url'] = getConfig('URL');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS['url'];
+}
+
+// "Getter" for cache_path
+function getCachePath () {
+       // Do we have cache?
+       if (!isset($GLOBALS['cache_path'])) {
+               // Determine it
+               $GLOBALS['cache_path'] = getConfig('CACHE_PATH');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS['cache_path'];
+}
+
+// "Getter" for secret_key
+function getSecretKey () {
+       // Do we have cache?
+       if (!isset($GLOBALS['secret_key'])) {
+               // Determine it
+               $GLOBALS['secret_key'] = getConfig('secret_key');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS['secret_key'];
+}
+
+// "Getter" for master_salt
+function getMasterSalt () {
+       // Do we have cache?
+       if (!isset($GLOBALS['master_salt'])) {
+               // Determine it
+               $GLOBALS['master_salt'] = getConfig('master_salt');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS['master_salt'];
+}
+
+// "Getter" for prime
+function getPrime () {
+       // Do we have cache?
+       if (!isset($GLOBALS['prime'])) {
+               // Determine it
+               $GLOBALS['prime'] = getConfig('_PRIME');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS['prime'];
+}
+
+// "Getter" for encrypt_seperator
+function getEncryptSeperator () {
+       // Do we have cache?
+       if (!isset($GLOBALS['encrypt_seperator'])) {
+               // Determine it
+               $GLOBALS['encrypt_seperator'] = getConfig('ENCRYPT_SEPERATOR');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS['encrypt_seperator'];
+}
+
+// "Getter" for mysql_prefix
+function getMysqlPrefix () {
+       // Do we have cache?
+       if (!isset($GLOBALS['mysql_prefix'])) {
+               // Determine it
+               $GLOBALS['mysql_prefix'] = getConfig('_MYSQL_PREFIX');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS['mysql_prefix'];
+}
+
+// "Getter" for salt_length
+function getSaltLength () {
+       // Do we have cache?
+       if (!isset($GLOBALS['salt_length'])) {
+               // Determine it
+               $GLOBALS['salt_length'] = getConfig('salt_length');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS['salt_length'];
+}
+
+// "Getter" for output_mode
+function getCachedOutputMode () {
+       // Do we have cache?
+       if (!isset($GLOBALS['cached_output_mode'])) {
+               // Determine it
+               $GLOBALS['cached_output_mode'] = getConfig('OUTPUT_MODE');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS['cached_output_mode'];
+}
+
+// "Getter" for full_version
+function getFullVersion () {
+       // Do we have cache?
+       if (!isset($GLOBALS['full_version'])) {
+               // Determine it
+               $GLOBALS['full_version'] = getConfig('FULL_VERSION');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS['full_version'];
+}
+
+// "Getter" for title
+function getTitle () {
+       // Do we have cache?
+       if (!isset($GLOBALS['title'])) {
+               // Determine it
+               $GLOBALS['title'] = getConfig('TITLE');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS['title'];
+}
+
+// "Getter" for curr_svn_revision
+function getCurrSvnRevision () {
+       // Do we have cache?
+       if (!isset($GLOBALS['curr_svn_revision'])) {
+               // Determine it
+               $GLOBALS['curr_svn_revision'] = getConfig('CURR_SVN_REVISION');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS['curr_svn_revision'];
+}
+
+// "Getter" for server_url
+function getServerUrl () {
+       // Do we have cache?
+       if (!isset($GLOBALS['server_url'])) {
+               // Determine it
+               $GLOBALS['server_url'] = getConfig('SERVER_URL');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS['server_url'];
+}
+
+// "Getter" for mt_word
+function getMtWord () {
+       // Do we have cache?
+       if (!isset($GLOBALS['mt_word'])) {
+               // Determine it
+               $GLOBALS['mt_word'] = getConfig('mt_word');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS['mt_word'];
+}
+
+// "Getter" for main_title
+function getMainTitle () {
+       // Do we have cache?
+       if (!isset($GLOBALS['main_title'])) {
+               // Determine it
+               $GLOBALS['main_title'] = getConfig('MAIN_TITLE');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS['main_title'];
+}
+
+// "Getter" for file_hash
+function getFileHash () {
+       // Do we have cache?
+       if (!isset($GLOBALS['file_hash'])) {
+               // Determine it
+               $GLOBALS['file_hash'] = getConfig('file_hash');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS['file_hash'];
+}
+
+// "Getter" for pass_scramble
+function getPassScramble () {
+       // Do we have cache?
+       if (!isset($GLOBALS['pass_scramble'])) {
+               // Determine it
+               $GLOBALS['pass_scramble'] = getConfig('pass_scramble');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS['pass_scramble'];
+}
+
+// "Getter" for ap_inactive_since
+function getApInactiveSince () {
+       // Do we have cache?
+       if (!isset($GLOBALS['ap_inactive_since'])) {
+               // Determine it
+               $GLOBALS['ap_inactive_since'] = getConfig('ap_inactive_since');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS['ap_inactive_since'];
+}
+
 // [EOF]
 ?>
index 1c4762dab2a2906ee91ebfb2d81a48fb135be41d..72f107e4e8761ab7336707618d67fb8bf23a405b 100644 (file)
@@ -175,7 +175,7 @@ if (($url_userid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (!ifFatalErrorsDe
                                        // Was that mail a valid one?
                                        if ($isValid === true) {
                                                // If time is zero seconds we have a sponsor mail. 1 Second shall be set to avoid problems
-                                               if (($time == '0') && ($payment > 0)) { $URL = getConfig('URL'); $time = 1; }
+                                               if (($time == '0') && ($payment > 0)) { $URL = getUrl(); $time = 1; }
                                                if (($time > 0) && (($payment > 0) || ($points > 0))) {
                                                        // Export data into constants for the template
                                                        $content = array(
index e9afe997ddc1b326fb1f7472949e5d798a2af586..d516df02aed42d4701c4fa9f756139e5dae8960e 100644 (file)
@@ -261,7 +261,7 @@ if (($url_userid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (!ifFatalErrorsDe
                                                                                // Shall I add bonus points for "turbo clickers" ?
                                                                                if (isExtensionInstalledAndNewer('bonus', '0.2.2')) {
                                                                                        // Is an active-rallye running and this is not a notification mail?
-                                                                                       if ((getConfig('bonus_active') == 'Y') && ($notify != 'Y')) {
+                                                                                       if ((ifBonusRallyeActive()) && ($notify != 'Y')) {
                                                                                                // Shall I exclude the webmaster's own userid from the active-rallye?
                                                                                                if ((((getConfig('bonus_userid') == $url_userid) && (getConfig('bonus_include_own') == 'Y')) || (getConfig('bonus_userid') != $url_userid)) && (getConfig('def_refid') != $url_userid)) {
                                                                                                        // Add points and remember ranking are done in this function....