Possible further fix for #128
[mailer.git] / inc / functions.php
index 10b4d02d329c05dc548ad0e5d24520cf9cafd306..f55f5135603ad783649c0e0dfd92fd15e04f7ee1 100644 (file)
@@ -120,6 +120,9 @@ function OUTPUT_HTML ($HTML, $newLine = true) {
 
                // 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))."\";";
@@ -128,7 +131,7 @@ function OUTPUT_HTML ($HTML, $newLine = true) {
                        // 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
@@ -286,13 +289,16 @@ function LOAD_TEMPLATE ($template, $return=false, $content=array()) {
        } 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
        }
 
        ////////////////////////
@@ -341,8 +347,11 @@ function LOAD_TEMPLATE ($template, $return=false, $content=array()) {
                        $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 />
@@ -1286,9 +1295,9 @@ function bigintval ($num, $castValue = true) {
 
        // 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
@@ -1412,7 +1421,7 @@ function createTimeSelections ($timestamp, $prefix = '', $display = '', $align =
                        $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";
                }
 
@@ -1452,7 +1461,7 @@ function createTimeSelections ($timestamp, $prefix = '', $display = '', $align =
                        $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++)
@@ -2476,9 +2485,12 @@ function getActualVersion ($type = 'Revision') {
                } // 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']);