]> git.mxchange.org Git - mailer.git/blobdiff - inc/template-functions.php
Fix for wrong SERVER_NAME usage (may cause trouble)
[mailer.git] / inc / template-functions.php
index 55a4e8299e76071a4a285ba9fdd93fd8a83c3754..7bfe4b9ddda0b4d012fe98f5c6f9c9f122901fae 100644 (file)
@@ -184,8 +184,11 @@ function compileFinalOutput () {
        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())) {
@@ -335,20 +338,25 @@ function loadTemplate ($template, $return = FALSE, $content = array(), $compileC
                                        $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()))) {
@@ -536,7 +544,7 @@ function loadEmailTemplate ($template, $content = array(), $userid = NULL, $load
        // 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')) {
@@ -1370,7 +1378,7 @@ function compileUriCode ($code, $simple = TRUE) {
        } // END - if
 
        // Compile QUOT and other non-HTML codes
-       $code = str_replace($charsCompile['from'], $charsCompile['to'], decodeEntities($code));
+       $code = str_replace($charsCompile['from'], $charsCompile['to'], $code);
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'code=' . $code);
 
        // Return compiled code
@@ -1651,7 +1659,7 @@ function escapeQuotes ($str, $single = FALSE) {
                $str = str_replace(array("\\'", '"', "\\\\"), array(chr(39), "\\\"", chr(92)), $str);
        }
 
-       // Return the escaped string
+       // Return the escape'd string
        return $str;
 }
 
@@ -2075,7 +2083,7 @@ function doTemplateExtensionRegistrationLink ($templateName, $clear, $ext_name)
                $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&amp;what=extensions&amp;reg_ext=' . $ext_name . '%}">{--ADMIN_REGISTER_EXTENSION--}</a>';
+               $OUT = '<a title="{--ADMIN_REGISTER_EXTENSION_TITLE--}" href="{%url=modules.php?module=admin&amp;what=extensions&amp;register_ext=' . $ext_name . '%}">{--ADMIN_REGISTER_EXTENSION--}</a>';
        }
 
        // Return code