inc/autopurge/purge-tsks.php -text
inc/autopurge/purge-unconfirmed.php -text
inc/cache/.htaccess -text
-inc/cache/templates/.htaccess -text
+inc/cache/_compiled/.htaccess -text
+inc/cache/_compiled/templates/.htaccess -text
inc/classes/.htaccess -text
inc/classes/cachesystem.class.php -text
inc/classes/rdf.class.php -text
inc/.secret/dummy.php
inc/cache/*.cache
inc/cache/.revision
+inc/cache/_compiled/templates/*.cache
inc/cache/config-local.php
inc/cache/debug.log
inc/cache/sess_*
-inc/cache/templates/*.cache
--- /dev/null
+Deny from all
\ No newline at end of file
--- /dev/null
+Deny from all
\ No newline at end of file
+++ /dev/null
-Deny from all
\ No newline at end of file
// Increment or init with given value or 1 as default the given config entry
function incrementConfigEntry ($configEntry, $value=1) {
// Increment it if set or init it with 1
- if (getConfig($configEntry) > 0) {
+ if (isConfigEntrySet($configEntry)) {
$GLOBALS['config'][$configEntry] += $value;
} else {
$GLOBALS['config'][$configEntry] = $value;
$sqlString = str_replace("\t", ' ', str_replace("\n", ' ', str_replace("\r", ' ', $sqlString)));
// Compile config out
- $sqlString = FILTER_COMPILE_CONFIG($sqlString);
+ $sqlString = FILTER_COMPILE_CONFIG($sqlString, true);
// Starting time
$querytimeBefore = array_sum(explode(' ', microtime()));
}
// Filter for compiling config entries
-function FILTER_COMPILE_CONFIG ($code) {
- // Compile {?some_var?} to getConfig('some_var')
- preg_match_all('/\{\?(([a-zA-Z0-9-_]+)*)\?\}/', $code, $matches);
+function FILTER_COMPILE_CONFIG ($code, $compiled = false) {
+ // Save the uncompiled code
+ $uncompiled = $code;
+
+ // Do we have cache?
+ if (!isset($GLOBALS['compiled_config'][$code])) {
+ // Compile {?some_var?} to getConfig('some_var')
+ preg_match_all('/\{\?(([a-zA-Z0-9-_]+)*)\?\}/', $code, $matches);
+
+ // Some entries found?
+ if ((count($matches) > 0) && (count($matches[0]) > 0)) {
+ // Replace all matches
+ foreach ($matches[0] as $key => $match) {
+ // Do we have cache?
+ if (!isset($GLOBALS['compile_config'][$matches[1][$key]])) {
+ // Is the config valid?
+ if (isConfigEntrySet($matches[1][$key])) {
+ // Set it for caching
+ $GLOBALS['compile_config'][$matches[1][$key]] = "\".getConfig('" . $matches[1][$key] . "').\"";
+ } elseif (isConfigEntrySet('default_' . strtoupper($matches[1][$key]))) {
+ // Use default value
+ $GLOBALS['compile_config'][$matches[1][$key]] = "\".getConfig('" . 'DEFAULT_' . strtoupper($matches[1][$key]) . "').\"";
+ } elseif (isMessageIdValid('DEFAULT_' . strtoupper($matches[1][$key]))) {
+ // No config, try the language system
+ $GLOBALS['compile_config'][$matches[1][$key]] = "\".getMessage('". 'DEFAULT_' . strtoupper($matches[1][$key]) . "').\"";
+ } else {
+ // Unhandled!
+ $GLOBALS['compile_config'][$matches[1][$key]] = '!' . $matches[1][$key] . '!';
+ }
+ } // END - if
- // Some entries found?
- if ((count($matches) > 0) && (count($matches[0]) > 0)) {
- // Replace all matches
- foreach ($matches[0] as $key => $match) {
- // Do we have cache?
- if (!isset($GLOBALS['compile_config'][$matches[1][$key]])) {
- // Is the config valid?
- if (isConfigEntrySet($matches[1][$key])) {
- // Set it for caching
- $GLOBALS['compile_config'][$matches[1][$key]] = getConfig($matches[1][$key]);
- } elseif (isConfigEntrySet('default_' . strtoupper($matches[1][$key]))) {
- // Use default value
- $GLOBALS['compile_config'][$matches[1][$key]] = getConfig('DEFAULT_' . strtoupper($matches[1][$key]));
- } elseif (isMessageIdValid('DEFAULT_' . strtoupper($matches[1][$key]))) {
- // No config, try the language system
- $GLOBALS['compile_config'][$matches[1][$key]] = getMessage('DEFAULT_' . strtoupper($matches[1][$key]));
- } else {
- // Unhandled!
- $GLOBALS['compile_config'][$matches[1][$key]] = '!' . $matches[1][$key] . '!';
- }
- } // END - if
+ // Use this for replacing
+ $code = str_replace($match, $GLOBALS['compile_config'][$matches[1][$key]], $code);
+ //* DEBUG: */ if (($match == '{?URL?}') && (strlen($code) > 10000)) die('<pre>'.htmlentities($code).'</pre>');
+ } // END - foreach
+ } // END - if
- // Use this for replacing
- $code = str_replace($match, $GLOBALS['compile_config'][$matches[1][$key]], $code);
- //* DEBUG: */ if (($match == '{?URL?}') && (strlen($code) > 10000)) die('<pre>'.htmlentities($code).'</pre>');
- } // END - foreach
+ // Add it to cache
+ $GLOBALS['compiled_config'][$uncompiled] = $code;
+ } // END - if
+
+ // Should we compile it?
+ if ($compiled === true) {
+ // Run the code
+ eval("\$GLOBALS['compiled_config'][\$uncompiled] = \"" . $GLOBALS['compiled_config'][$uncompiled] . "\";");
} // END - if
// Return compiled code
- return $code;
+ return $GLOBALS['compiled_config'][$uncompiled];
}
// Filter for compiling extension data
function loadEmailTemplate ($template, $content = array(), $UID = 0) {
global $DATA;
- // Our configuration is kept non-global here
- $_CONFIG = getConfigArray();
-
// Make sure all template names are lowercase!
$template = strtolower($template);
unset($DATA);
// Compile the code and eval it
- $eval = '$newContent = "' . compileCode(smartAddSlashes($newContent)) . '";';
+ $eval = '$newContent = "' . compileRawCode(smartAddSlashes($newContent)) . '";';
eval($eval);
// Return content
//* DEBUG: */ outputHtml(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):TO={$toEmail},SUBJECT={$subject}<br />");
// Compile subject line (for POINTS constant etc.)
- eval("\$subject = decodeEntities(\"".compileCode(smartAddSlashes($subject))."\");");
+ eval("\$subject = decodeEntities(\"".compileRawCode(smartAddSlashes($subject))."\");");
// Set from header
if ((!eregi('@', $toEmail)) && ($toEmail > 0)) {
}
// Compile "TO"
- eval("\$toEmail = \"".compileCode(smartAddSlashes($toEmail))."\";");
+ eval("\$toEmail = \"".compileRawCode(smartAddSlashes($toEmail))."\";");
// Compile "MSG"
- eval("\$message = \"".compileCode(smartAddSlashes($message))."\";");
+ eval("\$message = \"".compileRawCode(smartAddSlashes($message))."\";");
// Fix HTML parameter (default is no!)
if (empty($isHtml)) $isHtml = 'N';
// Redirects to an URL and if neccessarry extends it with own base URL
function redirectToUrl ($URL) {
// Compile out codes
- eval('$URL = "' . compileCode($URL) . '";');
+ eval('$URL = "' . compileRawCode($URL) . '";');
// Check if http(s):// is there
if ((substr($URL, 0, 7) != 'http://') && (substr($URL, 0, 8) != 'https://')) {
// Start couting
$startCompile = explode(' ', microtime());
+ // Comile the code
+ $code = compileRawCode($code, $simple, $constants, $full);
+
+ // Get timing
+ $compiled = explode(' ', microtime());
+
+ // Add timing
+ $code .= '<!-- Compilation time: ' . ((($compiled[1] + $compiled[0]) - ($startCompile[1] + $startCompile[0])) * 1000). 'ms //-->';
+
+ // Return compiled code
+ return $code;
+}
+
+// Compiles the code (use compileCode() only for HTML because of the comments)
+function compileRawCode ($code, $simple = false, $constants = true, $full = true) {
+ // Is the code a string?
+ if (!is_string($code)) {
+ // Silently return it
+ return $code;
+ } // END - if
+
// Init replacement-array with full security characters
$secChars = $GLOBALS['security_chars'];
} // END - foreach
} // END - if
- // Get timing
- $compiled = explode(' ', microtime());
-
- // Add timing
- $code .= '<!-- Compilation time: ' . ((($compiled[1] + $compiled[0]) - ($startCompile[1] + $startCompile[0])) * 1000). 'ms //-->';
-
- // Return compiled code
+ // Return it
return $code;
}
//* DEBUG: */ die("SCRIPT=" . $script.'<br />');
if ($useProxy === true) {
// Connect to host through proxy connection
- $fp = @fsockopen(compileCode(getConfig('proxy_host')), bigintval(getConfig('proxy_port')), $errno, $errdesc, 30);
+ $fp = @fsockopen(compileRawCode(getConfig('proxy_host')), bigintval(getConfig('proxy_port')), $errno, $errdesc, 30);
} else {
// Connect to host directly
$fp = @fsockopen($host, 80, $errno, $errdesc, 30);
// Use login data to proxy? (username at least!)
if (getConfig('proxy_username') != '') {
// Add it as well
- $encodedAuth = base64_encode(compileCode(getConfig('proxy_username')) . getConfig('ENCRYPT_SEPERATOR') . compileCode(getConfig('proxy_password')));
+ $encodedAuth = base64_encode(compileRawCode(getConfig('proxy_username')) . getConfig('ENCRYPT_SEPERATOR') . compileRawCode(getConfig('proxy_password')));
$proxyTunnel .= "Proxy-Authorization: Basic " . $encodedAuth . getConfig('HTTP_EOL');
} // END - if
// Function taken from user comments on www.php.net / function eregi()
function isUrlValidSimple ($url) {
// Prepare URL
- $url = secureString(str_replace("\\", '', compileCode(urldecode($url))));
+ $url = secureString(str_replace("\\", '', compileRawCode(urldecode($url))));
// Allows http and https
$http = "(http|https)+(:\/\/)";
// Do we have cached this result?
if (!isset($GLOBALS['template_cache'][$template])) {
// Generate FQFN
- $FQFN = sprintf("%stemplates/%s.tpl.cache", getConfig('CACHE_PATH'), $template);
+ $FQFN = sprintf("%s_compiled/templates/%s.tpl.cache", getConfig('CACHE_PATH'), $template);
// Is it there?
$GLOBALS['template_cache'][$template] = isFileReadable($FQFN);
// Is this cache flushed?
if (!isTemplateCached($template)) {
// Generate FQFN
- $FQFN = sprintf("%stemplates/%s.tpl.cache", getConfig('CACHE_PATH'), $template);
+ $FQFN = sprintf("%s_compiled/templates/%s.tpl.cache", getConfig('CACHE_PATH'), $template);
// Replace username with a call
$eval = str_replace('$username', '".getUsername()."', $eval);
// Check it again
if (isTemplateCached($template)) {
// Generate FQFN
- $FQFN = sprintf("%stemplates/%s.tpl.cache", getConfig('CACHE_PATH'), $template);
+ $FQFN = sprintf("%s_compiled/templates/%s.tpl.cache", getConfig('CACHE_PATH'), $template);
// And read from it
$GLOBALS['template_eval'][$template] = readFromFile($FQFN);
$api = new PrimeraApi($primusNick, $userMd5);
// Prepare purpose
- eval("\$purpose = \"".compileCode(sprintf(getMessage('PRIMERA_API_PURPOSE_WITHDRAW'), getSession('sponsorid')))."\";");
+ eval("\$purpose = \"".compileRawCode(sprintf(getMessage('PRIMERA_API_PURPOSE_WITHDRAW'), getSession('sponsorid')))."\";");
// Pay the Primera
return $api->payPrimera($primusNick, $amount, $purpose);
$api = new PrimeraApi(getConfig('primera_api_name'), getConfig('primera_api_md5'));
// Prepare purpose
- eval("\$purpose = \"".compileCode(sprintf(getMessage('PRIMERA_API_PURPOSE_PAYOUT'), getUserId()))."\";");
+ eval("\$purpose = \"".compileRawCode(sprintf(getMessage('PRIMERA_API_PURPOSE_PAYOUT'), getUserId()))."\";");
// Pay the Primera
return $api->payPrimera($primusNick, $amount, $purpose);
$result = false;
// Prepare the purpose
- eval("\$purpose = \"".compileCode(sprintf(getMessage('WERNIS_API_PURPOSE_WITHDRAW'), getUserId()))."\";");
+ eval("\$purpose = \"".compileRawCode(sprintf(getMessage('WERNIS_API_PURPOSE_WITHDRAW'), getUserId()))."\";");
// Prepare the request data
$requestData = array(
$result = false;
// Prepare the purpose
- eval("\$purpose = \"".compileCode(sprintf(getMessage('WERNIS_API_PURPOSE_PAYOUT'), getUserId()))."\";");
+ eval("\$purpose = \"".compileRawCode(sprintf(getMessage('WERNIS_API_PURPOSE_PAYOUT'), getUserId()))."\";");
// Prepare the request data
$requestData = array(
************************************************************************/
// XDEBUG call
-/* DEBUG: */ xdebug_start_trace();
+//* DEBUG: */ xdebug_start_trace();
// Load security stuff here
require('inc/libs/security_functions.php');