// That's why you don't need any \n at the end of your HTML code... :-)
if ($newLine === TRUE) {
- outputRawCode(chr(10));
+ outputRawCode(PHP_EOL);
} // END - if
} else {
// Render mode for old or lame servers...
// That's why you don't need any \n at the end of your HTML code... :-)
if ($newLine === TRUE) {
- $GLOBALS['__output'] .= chr(10);
+ $GLOBALS['__output'] .= PHP_EOL;
} // END - if
}
break;
// The same as above... ^
outputRawCode($htmlCode);
if ($newLine === TRUE) {
- outputRawCode(chr(10));
+ outputRawCode(PHP_EOL);
} // END - if
break;
addPageHeaderFooter();
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, '__output(length)=' . strlen($GLOBALS['__output']) . ' - After addPageHeaderFooter() call.');
- // Do the final compilation
- $GLOBALS['__output'] = compileUriCode(doFinalCompilation($GLOBALS['__output']));
+ // Do the final (general) compilation
+ $GLOBALS['__output'] = doFinalCompilation($GLOBALS['__output']);
+
+ // Compile any other things out
+ $GLOBALS['__output'] = compileUriCode($GLOBALS['__output']);
// Extension 'rewrite' installed?
if ((isExtensionActive('rewrite')) && (!isCssOutputMode())) {
$code = '<!-- Template ' . $template . ' - Start //-->' . $GLOBALS['template_content']['html'][$template] . '<!-- Template ' . $template . ' - End //-->';
// Prepare eval() command
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Reached!');
$GLOBALS['template_eval']['html'][$template] = '$ret = "' . getColorSwitchCode($template) . compileCode(escapeQuotes($code), FALSE, TRUE, TRUE, $compileCode) . '";';
} elseif (substr($template, 0, 3) == 'js_') {
// JavaScripts don't like entities, dollar signs and timings
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Reached!');
$GLOBALS['template_eval']['html'][$template] = '$ret = decodeEntities("' . compileRawCode(escapeJavaScriptQuotes($GLOBALS['template_content']['html'][$template]), FALSE, TRUE, TRUE, $compileCode) . '");';
} else {
// Prepare eval() command, other output doesn't like entities, maybe
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Reached!');
$GLOBALS['template_eval']['html'][$template] = '$ret = decodeEntities("' . compileRawCode(escapeQuotes($GLOBALS['template_content']['html'][$template]), FALSE, TRUE, TRUE, $compileCode) . '");';
}
} elseif (isHtmlOutputMode()) {
// Add surrounding HTML comments to help finding bugs faster
$ret = '<!-- Template ' . $template . ' - Start //-->' . $GLOBALS['template_content']['html'][$template] . '<!-- Template ' . $template . ' - End //-->';
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Reached!');
$GLOBALS['template_eval']['html'][$template] = '$ret = "' . getColorSwitchCode($template) . compileRawCode(escapeQuotes($ret), FALSE, TRUE, TRUE, $compileCode) . '";';
} else {
// JavaScript again
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Reached!');
$GLOBALS['template_eval']['html'][$template] = '$ret = decodeEntities("' . compileRawCode(escapeJavaScriptQuotes($GLOBALS['template_content']['html'][$template]), FALSE, TRUE, TRUE, $compileCode) . '");';
} // END - if
} elseif ((isAdmin()) || ((isInstalling()) && (!isInstalled()))) {
// Is content an array?
if (is_array($content)) {
// Add expiration to array
- if ((isConfigEntrySet('auto_purge')) && (getAutoPurge() == '0')) {
+ if ((isExtensionInstalled('autopurge')) && (getAutoPurge() == '0')) {
// Will never expire!
$content['expiration'] = '{--MAIL_WILL_NEVER_EXPIRE--}';
- } elseif (isConfigEntrySet('auto_purge')) {
+ } elseif ((isExtensionInstalled('autopurge')) && (isConfigEntrySet('auto_purge'))) {
// Create nice date string
$content['expiration'] = '{%config,createFancyTime=auto_purge%}';
} else {
// Are there some content?
if (empty($newContent)) {
// Compiling failed
- $newContent = "Compiler error for template " . $template . " !\nUncompiled content:\n" . $GLOBALS['template_content']['email'][$template];
+ $newContent = "Compiler error for template " . $template . " !\nUncompiled content:\n" . $GLOBALS['template_eval']['email'][$template];
// Add last error if the required function exists
if (function_exists('error_get_last')) {
// Compile constants
if ($simple === FALSE) {
// Add more 'from'
- array_push($charsCompile['from'], '{--', '--}');
+ array_unshift($charsCompile['from'], '{--', '--}');
// Add more 'to'
- array_push($charsCompile['to'], '".', '."');
+ array_unshift($charsCompile['to'], '".', '."');
} // END - if
// Compile QUOT and other non-HTML codes
$code = str_replace($charsCompile['from'], $charsCompile['to'], $code);
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'code=' . $code);
// Return compiled code
return $code;
// Is the extension not installed or just deactivated?
switch (isExtensionInstalled($ext_name)) {
- case true; // Deactivated!
+ case TRUE; // Deactivated!
$message = generateExtensionInactiveMessage($ext_name);
break;
- case false; // Not installed!
+ case FALSE; // Not installed!
$message = generateExtensionNotInstalledMessage($ext_name);
break;
if (!is_array($code)) {
// We need an array, so try it with the new-line character
- $codeE = explode(chr(10), $code);
+ $codeE = explode(PHP_EOL, $code);
} // END - if
$count_lines = count($codeE);
$pageTitle .= ' {%config,trim=title_middle%} {DQUOTE} . getModuleTitle(getModule()) . {DQUOTE}';
} // END - if
- // Add title from what file
- $menuMode = '';
- if (getModule() == 'login') {
- $menuMode = 'member';
- } elseif (getModule() == 'index') {
- $menuMode = 'guest';
- } elseif (getModule() == 'admin') {
- $menuMode = 'admin';
- } elseif (getModule() == 'sponsor') {
- $menuMode = 'sponsor';
- }
+ // Get menu mode from module
+ $menuMode = getMenuModeFromModule();
// Add middle part (always in admin area!)
if ((!empty($menuMode)) && ((isWhatTitleEnabled()) || ($menuMode == 'admin'))) {
$str = str_replace(array("\\'", '"', "\\\\"), array(chr(39), "\\\"", chr(92)), $str);
}
- // Return the escaped string
+ // Return the escape'd string
return $str;
}
switch ($mode) {
case 'normal': break; // Do not add any special lines
case 'email': // Email was changed!
- $content['message'] = '{--MEMBER_CHANGED_EMAIL--}' . ': ' . postRequestElement('old_email') . chr(10);
+ $content['message'] = '{--MEMBER_CHANGED_EMAIL--}' . ': ' . postRequestElement('old_email') . PHP_EOL;
break;
case 'password': // Password was changed
- $content['message'] = '{--MEMBER_CHANGED_PASS--}' . chr(10);
+ $content['message'] = '{--MEMBER_CHANGED_PASS--}' . PHP_EOL;
break;
default:
logDebugMessage(__FUNCTION__, __LINE__, sprintf("Unknown mode %s detected.", $mode));
- $content['message'] = '{--MEMBER_UNKNOWN_MODE--}' . ': ' . $mode . "\n\n";
+ $content['message'] = '{--MEMBER_UNKNOWN_MODE--}' . ': ' . $mode . PHP_EOL . PHP_EOL;
break;
} // END - switch
} // END - foreach
$OUT = '<span title="{--ADMIN_EXTENSION_IS_DEPRECATED_TITLE--}">---</span>';
} elseif (isExtensionProductive($ext_name)) {
// Productive code
- $OUT = '<a title="{--ADMIN_REGISTER_EXTENSION_TITLE--}" href="{%url=modules.php?module=admin&what=extensions&reg_ext=' . $ext_name . '%}">{--ADMIN_REGISTER_EXTENSION--}</a>';
+ $OUT = '<a title="{--ADMIN_REGISTER_EXTENSION_TITLE--}" href="{%url=modules.php?module=admin&what=extensions&register_ext=' . $ext_name . '%}">{--ADMIN_REGISTER_EXTENSION--}</a>';
}
// Return code
return $OUT;
}
+// Helper function to add extra content for guest area (module=index and others)
+function doTemplateGuestFooterExtras ($templateName, $clear) {
+ // Init filter data
+ $filterData = array(
+ // Name of used template
+ 'template' => $templateName,
+ // Target array for gathered data
+ '__data' => array(),
+ // Where the HTML output will go
+ '__output' => '',
+ );
+
+ // Run the filter chain
+ $filterData = runFilterChain('guest_footer_extras', $filterData);
+
+ // Return output
+ return $filterData['__output'];
+}
+
// Helper function to add extra content for member area (module=login)
function doTemplateMemberFooterExtras ($templateName, $clear) {
// Is a member logged in?
return $content;
}
+// Template helper function to create a deferrer code if URL is not empty
+function doTemplateDereferrerUrl ($templateName, $clear = FALSE, $url = NULL) {
+ // Is the URL not NULL and not empty?
+ if ((!is_null($url)) && (!empty($url))) {
+ // Set HTML with EL code
+ $url = '<a href="{%pipe,generateDereferrerUrl=' . $url . '%}" rel="external" target="_blank">{--ADMIN_TEST_URL--}</a>';
+ } // END - if
+
+ // Return URL (or content) or dashes if empty
+ return fixEmptyContentToDashes($url);
+}
+
// Tries to anonymize some sensitive data (e.g. IP address, user agent, referrer, etc.)
function anonymizeSensitiveData ($data) {
// Trim it
*/
function compactContent ($uncompactedContent) {
// First, remove all tab/new-line/revert characters
- $compactedContent = str_replace(chr(9), '', str_replace(chr(10), '', str_replace(chr(13), '', $uncompactedContent)));
+ $compactedContent = str_replace(chr(9), '', str_replace(PHP_EOL, '', str_replace(chr(13), '', $uncompactedContent)));
// Then regex all comments like <!-- //--> away
preg_match_all('/<!--[\w\W]*?(\/\/){0,1}-->/', $compactedContent, $matches);