./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)
./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?
// 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();
} // 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
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
} // 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
} // 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
} // 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
// 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 {
$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])) {
$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];
}
);
// 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();
/// ... 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
$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());
//
// 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");
// 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);
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
} // END - if
// Generate replacer
- $replacer = sprintf("&ext=%s&ver=%s&rev={DQUOTE} . getConfig('CURR_SVN_REVISION') . {DQUOTE}", $data['matches'][4][$data['key']], $replacer);
+ $replacer = sprintf("&ext=%s&ver=%s&rev={?CURR_SVN_REVISION?}", $data['matches'][4][$data['key']], $replacer);
// Replace it and insert parameter for GET request
$code = replaceExpressionCode($data, $replacer);
// 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);
// Template file
$tpl = sprintf("%stemplates/%s/html/ext/ext_%s.tpl",
- getConfig('PATH'),
+ getPath(),
getLanguage(),
$ext_name
);
// Construct FQFN for check
$FQFN = sprintf("%stheme/%s/css/%s.css",
- getConfig('PATH'),
+ getPath(),
getCurrentTheme(),
getCurrentExtensionName()
);
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
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');
} // 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));
} // 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
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'));
$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
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
}
$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;
} 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;
$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();
// 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&url=' . encodeString(compileUriCode($URL)) . '%}';
} // END - if
$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
//
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();
// 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://') {
// 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');
// 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');
// 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 />');
//* 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
}
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)));
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;
//* 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) . ')');
} // END - for
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $passHash . ',' . $newHash . ' (' . strlen($newHash) . ')');
- $ret = generateHash($newHash, getConfig('master_salt'));
+ $ret = generateHash($newHash, getMasterSalt());
} // END - if
// Return result
$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
} 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)) {
$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)) {
// Construct include filename and FQFN
$fileName = $baseDir . $baseFile;
- $FQFN = getConfig('PATH') . $fileName;
+ $FQFN = getPath() . $fileName;
// Remove double slashes
$FQFN = str_replace('//', '/', $FQFN);
// 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
} // 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
// 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);
} // END - if
// Check if there is no scrambling string
-if (getConfig('pass_scramble') == '') {
+if (getPassScramble() == '') {
// Generate 40 chars long scramble string
$scrambleString = genScrambleString(40);
} // 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))));
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
);
// Generate FQFN for .htaccess file
$FQFN = sprintf("%sinc/.secret/.htaccess",
- getConfig('PATH')
+ getPath()
);
// Is the .htaccess file there?
// 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)) {
// 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])) {
// 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);
// 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
$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')) {
$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
// 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);
// Some security stuff...
if (!defined('__SECURITY')) {
die();
-}
+} // END - if
// Add points in autopurge-mode
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]
?>
// 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 = '';
//
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'))) {
// 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
}
}
+// 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]
?>
// 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
// 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') . '/' .
} // 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')) {
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
// 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
// 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
$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;
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;
$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)) {
// 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&register=done');
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']);
$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);
$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');
// 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>';
// 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'));
}
// 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...
// 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');
}
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)) {
}
} 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>');
} // 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__);
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",
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);
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')
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')
);
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')) {
}
// 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__);
$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(
$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'))) {
// 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 = '';
// 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
// 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
$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
// 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
//* 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')) {
// 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)) {
} // 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]
?>
$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) {
$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 = '';
$OUT .= '?theme=' . $newTheme . '&installing=1';
} else {
// Add SVN revision to bypass caching problems
- $OUT .= '?rev=' . getConfig('CURR_SVN_REVISION');
+ $OUT .= '?rev=' . getCurrSvnRevision();
}
// Close tag
// 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') {
// 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();
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);;
////////////////////////
} // 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);
// Load image
$img = sprintf("%s/theme/%s/images/code_bg.%s",
- getConfig('PATH'),
+ getPath(),
getCurrentTheme(),
getConfig('img_type')
);
} // 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>';
$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()) {
} // 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
$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--}';
// 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--}';
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 {
// Generate the FQFN
$GLOBALS['template_cache_fqfn'][$template] = sprintf(
"%s_compiled/%s/%s.tpl.cache",
- getConfig('CACHE_PATH'),
+ getCachePath(),
$mode,
$template
);
)
) || (
// 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
// 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
// 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
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]
?>
// 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(
// 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....