Fixes for POST setter, template and others
[mailer.git] / inc / functions.php
index 4c5ca96fa50f0e41fc16d68381efe35fccb8dd1d..c55b421dd3eb12a381c5c75e3caaea541276aa23 100644 (file)
@@ -123,7 +123,7 @@ function outputHtml ($htmlCode, $newLine = true) {
                $cnt = 0;
 
                // Compile and run finished rendered HTML code
-               while (((strpos($GLOBALS['output'], '{!') > 0) || (strpos($GLOBALS['output'], '{?') > 0)) && ($cnt < 3)) {
+               while (((strpos($GLOBALS['output'], '{--') > 0) || (strpos($GLOBALS['output'], '{!') > 0) || (strpos($GLOBALS['output'], '{?') > 0)) && ($cnt < 3)) {
                        // Prepare the content and eval() it...
                        $content = array();
                        $newContent = '';
@@ -363,8 +363,9 @@ function loadTemplate ($template, $return=false, $content=array()) {
                                        $eval = '$ret = "' . compileCode(smartAddSlashes($GLOBALS['tpl_content'])) . '";';
                                }
                        } else {
-                               // Simply return loaded code
-                               $eval = '$ret = $GLOBALS[\'tpl_content\'];';
+                               // Add surrounding HTML comments to help finding bugs faster
+                               $ret = "<!-- Template " . $template . " - Start -->\n" . $GLOBALS['tpl_content'] . "<!-- Template " . $template . " - End -->\n";
+                               $eval = '$ret = "' . smartAddSlashes($ret) . '";';
                        } // END - if
 
                        // Cache the eval() command here
@@ -888,7 +889,7 @@ function generateDerefererUrl ($URL) {
        // Don't de-refer our own links!
        if (substr($URL, 0, strlen(getConfig('URL'))) != getConfig('URL')) {
                // De-refer this link
-               $URL = 'modules.php?module=loader&amp;url=' . encodeString(compileUriCode($URL));
+               $URL = '{?URL?}/modules.php?module=loader&amp;url=' . encodeString(compileUriCode($URL));
        } // END - if
 
        // Return link
@@ -1324,7 +1325,7 @@ function generateRandomCode ($length, $code, $userid, $DATA = '') {
 // Does only allow numbers
 function bigintval ($num, $castValue = true) {
        // Filter all numbers out
-       $ret = preg_replace("/[^0123456789]/", '', $num);
+       $ret = preg_replace('/[^0123456789]/', '', $num);
 
        // Shall we cast?
        if ($castValue) $ret = (double)$ret;
@@ -3060,7 +3061,7 @@ function rebuildCacheFile ($cache, $inc = '', $force = false) {
                // Rebuild cache
                if ($GLOBALS['cache_instance']->loadCacheFile($cache)) {
                        // Destroy it
-                       $GLOBALS['cache_instance']->removeCacheFile(false, $force);
+                       $GLOBALS['cache_instance']->removeCacheFile($force);
                } // END - if
 
                // Include file given?