// Compile and run finished rendered HTML code
while (strpos($OUTPUT, '{!') > 0) {
+ // Replace _MYSQL_PREFIX
+ $OUTPUT = str_replace("{!_MYSQL_PREFIX!}", getConfig('_MYSQL_PREFIX'), $OUTPUT);
+
// Prepare the content and eval() it...
$newContent = '';
$eval = "\$newContent = \"".COMPILE_CODE(smartAddSlashes($OUTPUT))."\";";
// Was that eval okay?
if (empty($newContent)) {
// Something went wrong!
- app_die(__FUNCTION__, __LINE__, "Evaluation error:<pre>".htmlentities($eval)."</pre>");
+ app_die(__FUNCTION__, __LINE__, 'Evaluation error:<pre>' . htmlentities($eval) . '</pre>');
} // END - if
$OUTPUT = $newContent;
} // END - while
} elseif (strpos($template, 'la_') > -1) {
// 'Logical-area' template found
$mode = 'la/';
+ } elseif (strpos($template, 'js_') > -1) {
+ // JavaScript template found
+ $mode = 'js/';
} else {
// Test for extension
$test = substr($template, 0, strpos($template, '_'));
if (EXT_IS_ACTIVE($test)) {
// Set extra path to extension's name
- $mode = $test.'/';
- }
+ $mode = $test . '/';
+ } // END - if
}
////////////////////////
$ret = $tmpl_file;
}
- // Add surrounding HTML comments to help finding bugs faster
- $ret = "<!-- Template " . $template . " - Start -->\n" . $ret . "<!-- Template " . $template . " - End -->\n";
+ // Normal HTML output?
+ if ($GLOBALS['output_mode'] == 0) {
+ // Add surrounding HTML comments to help finding bugs faster
+ $ret = "<!-- Template " . $template . " - Start -->\n" . $ret . "<!-- Template " . $template . " - End -->\n";
+ } // END - if
} elseif ((IS_ADMIN()) || ((isInstalling()) && (!isInstalled()))) {
// Only admins shall see this warning or when installation mode is active
$ret = "<br /><span class=\"guest_failed\">{--TEMPLATE_404--}</span><br />
eval($eval);
// Set from header
- if ((!eregi("@", $toEmail)) && ($toEmail > 0)) {
+ if ((!eregi('@', $toEmail)) && ($toEmail > 0)) {
// Value detected, is the message extension installed?
- if (EXT_IS_ACTIVE("msg")) {
+ // @TODO Extension 'msg' does not exist
+ if (EXT_IS_ACTIVE('msg')) {
ADD_MESSAGE_TO_BOX($toEmail, $subject, $message, $HTML);
return;
} else {
// Load email address
- $result_email = SQL_QUERY_ESC("SELECT email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1", array(bigintval($toEmail)), __FUNCTION__, __LINE__);
+ $result_email = SQL_QUERY_ESC("SELECT `email` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s LIMIT 1",
+ array(bigintval($toEmail)), __FUNCTION__, __LINE__);
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):numRows=".SQL_NUMROWS($result_email)."<br />\n";
// Does the user exist?
$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').date("d-m-Y (l-F-T)", getConfig(('patch_ctime')));
+ $keys .= getConfig('ENCRYPT_SEPERATOR') . date("d-m-Y (l-F-T)", getConfig('patch_ctime'));
if (isConfigEntrySet('master_salt')) $keys .= getConfig('ENCRYPT_SEPERATOR').getConfig('master_salt');
// Build string from misc data
// Has the whole value changed?
// @TODO Remove this if() block if all is working fine
- if ("" . $ret."" != '' . $num."") {
+ if ('' . $ret . '' != '' . $num . '') {
// Log the values
- debug_report_bug("{$ret}<>{$num}");
+ //debug_report_bug("{$ret}<>{$num}");
} // END - if
// Return result
$OUT .= " <td align=\"center\" class=\"admin_title bottom\"><div class=\"tiny\">{--_YEARS--}</strong></td>\n";
}
- if (ereg("M", $display) || (empty($display))) {
+ if (ereg('M', $display) || (empty($display))) {
$OUT .= " <td align=\"center\" class=\"admin_title bottom\"><div class=\"tiny\">{--_MONTHS--}</strong></td>\n";
}
$OUT .= "<INPUT type=\"hidden\" name=\"" . $prefix."_ye\" value=\"0\" />\n";
}
- if (ereg("M", $display) || (empty($display))) {
+ if (ereg('M', $display) || (empty($display))) {
// Generate month selection
$OUT .= " <td align=\"center\"><select class=\"mini_select\" name=\"" . $prefix."_mo\" size=\"1\">\n";
for ($idx = 0; $idx <= 11; $idx++)
}
// Generate an email link
-function generateMemberEmailLink ($email, $table = 'admins') {
+function generateEmailLink ($email, $table = 'admins') {
// Default email link (INSECURE! Spammer can read this by harvester programs)
$EMAIL = 'mailto:' . $email;
// Check for several extensions
if ((EXT_IS_ACTIVE('admins')) && ($table == 'admins')) {
// Create email link for contacting admin in guest area
- $EMAIL = adminsCreateEmailLink($email);
+ $EMAIL = generateAdminEmailLink($email);
} elseif ((EXT_IS_ACTIVE('user')) && (GET_EXT_VERSION('user') >= '0.3.3') && ($table == 'user_data')) {
// Create email link for contacting a member within admin area (or later in other areas, too?)
- $EMAIL = USER_generateMemberEmailLink($email);
+ $EMAIL = generateEmailLink($email, 'user_data');
} elseif ((EXT_IS_ACTIVE('sponsor')) && ($table == 'sponsor_data')) {
// Create email link to contact sponsor within admin area (or like the link above?)
- $EMAIL = SPONSOR_generateMemberEmailLink($email);
+ $EMAIL = generateEmailLink($email, 'sponsor_data');
}
// Shall I close the link when there is no admin?
$server = $_SERVER['PHP_SELF'].getConfig('ENCRYPT_SEPERATOR').detectUserAgent().getConfig('ENCRYPT_SEPERATOR').getenv('SERVER_SOFTWARE').getConfig('ENCRYPT_SEPERATOR').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').date("d-m-Y (l-F-T)", getConfig(('patch_ctime'))).getConfig('ENCRYPT_SEPERATOR').getConfig('master_salt');
+ $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').date("d-m-Y (l-F-T)", getConfig('patch_ctime')).getConfig('ENCRYPT_SEPERATOR').getConfig('master_salt');
// Additional data
$data = $plainText.getConfig('ENCRYPT_SEPERATOR').uniqid(mt_rand(), true).getConfig('ENCRYPT_SEPERATOR').time();
} // END - if
// Is the cache file outdated/invalid?
- if ($new === true){
+ if ($new === true) {
+ // Reload the cache file
+ $GLOBALS['cache_instance']->loadCacheFile('revision');
+
// Destroy cache file
- $GLOBALS['cache_instance']->destroyCacheFile();
+ $GLOBALS['cache_instance']->destroyCacheFile(false, true);
// @TODO shouldn't do the unset and the reloading $GLOBALS['cache_instance']->destroyCacheFile() Or a new methode like forceCacheReload('revision')?
unset($GLOBALS['cache_array']['revision']);
// Is the extension there?
if (EXT_IS_ACTIVE('admins')) {
// Admin found
- $admin = "<a href=\"".adminsCreateEmailLink(getAdminEmail($aid))."\">" . $login."</a>";
+ $admin = "<a href=\"".generateEmailLink(getAdminEmail($aid), 'admins')."\">" . $login."</a>";
} else {
// Extension not found
$admin = sprintf(getMessage('EXTENSION_PROBLEM_NOT_INSTALLED'), 'admins');
}
// Compile characters which are allowed in URLs
-function compileUriCode ($code, $simple=true) {
+function compileUriCode ($code, $simple = true) {
// Compile constants
if (!$simple) $code = str_replace('{--', '".', str_replace('--}', '."', $code));
$tmp = $FQFN . '.tmp';
// Open the source file
- $fp = fopen($FQFN, 'r') or OUTPUT_HTML('<strong>READ:</strong> ' . $FQFN . "<br />\n");
+ $fp = fopen($FQFN, 'r') or OUTPUT_HTML('<strong>READ:</strong> ' . $FQFN . '<br />');
// Is the resource valid?
if (is_resource($fp)) {
// Open temporary file
- $fp_tmp = fopen($tmp, 'w') or OUTPUT_HTML('<strong>WRITE:</strong> ' . $tmp . "<br />\n");
+ $fp_tmp = fopen($tmp, 'w') or OUTPUT_HTML('<strong>WRITE:</strong> ' . $tmp . '<br />');
// Is the resource again valid?
if (is_resource($fp_tmp)) {
} else {
$next++;
}
- }
+ } // END - if
// Write to temp file
fputs($fp_tmp, $line);
// Remove CRLF
$message = str_replace("\r", '', str_replace("\n", '', $message));
- // Log this message away
- $fp = fopen(constant('PATH')."inc/cache/debug.log", 'a') or app_die(__FUNCTION__, __LINE__, "Cannot write logfile debug.log!");
- fwrite($fp, date("d.m.Y|H:i:s", time())."|" . getModule()."|".basename($funcFile)."|" . $line."|".strip_tags($message)."\n");
+ // Log this message away, we better don't call app_die() here to prevent an endless loop
+ $fp = fopen(constant('PATH') . 'inc/cache/debug.log', 'a') or die(__FUNCTION__.'['.__LINE__.']: Cannot write logfile debug.log!');
+ fwrite($fp, date('d.m.Y|H:i:s', time()) . '|' . getModule() . '|' . basename($funcFile) . '|' . $line . '|' . strip_tags($message) . "\n");
fclose($fp);
} // END - if
}
// Is the reset set or old sql_patches?
if ((!isResetModeEnabled()) || (EXT_VERSION_IS_OLDER('sql_patches', '0.4.5'))) {
// Then abort here
- DEBUG_LOG(__FUNCTION__, __LINE__, "Cannot run reset! Please report this bug. Thanks");
+ DEBUG_LOG(__FUNCTION__, __LINE__, 'Cannot run reset! Please report this bug. Thanks');
} // END - if
// Get more daily reset scripts
$GLOBALS['refid'] = bigintval(getSession('refid'));
} elseif ((GET_EXT_VERSION('sql_patches') != '') && (getConfig('def_refid') > 0)) {
// Set default refid as refid in URL
- $GLOBALS['refid'] = getConfig(('def_refid'));
+ $GLOBALS['refid'] = getConfig('def_refid');
} elseif ((GET_EXT_VERSION('user') >= '0.3.4') && (getConfig('select_user_zero_refid')) == 'Y') {
// Select a random user which has confirmed enougth mails
$GLOBALS['refid'] = determineRandomReferalId();