Fix for the fix... ;-)
[mailer.git] / inc / functions.php
index 0e6812343dd13ad168e9a40de97110632a002f35..b888b2779f474ac59860e01cd8ba69ad48b8ee9d 100644 (file)
@@ -133,9 +133,10 @@ function OUTPUT_HTML($HTML, $NEW_LINE = true) {
                // Clear output buffer for later output
                ob_end_clean();
 
+               // Extension "rewrite" installed?
                if ((EXT_IS_ACTIVE("rewrite", true)) && (function_exists('REWRITE_LINKS')) && ($CSS != "1") && ($CSS != "-1")) {
                        $OUTPUT = REWRITE_LINKS($OUTPUT);
-               }
+               } // END - if
 
                // Compile and run finished rendered HTML code
                while (strpos($OUTPUT, '{!') > 0) {
@@ -144,12 +145,13 @@ function OUTPUT_HTML($HTML, $NEW_LINE = true) {
                        $eval = "\$newContent = \"".COMPILE_CODE(addslashes($OUTPUT))."\";";
                        @eval($eval);
 
+                       // Was that eval okay?
                        if (empty($newContent)) {
                                // Something went wrong!
                                die("Evaluation error:<pre>".htmlentities($eval)."</pre>");
-                       }
+                       } // END - if
                        $OUTPUT = $newContent;
-               }
+               } // END - while
 
                // Output code here, DO NOT REMOVE! ;-)
                OUTPUT_RAW($OUTPUT);
@@ -157,13 +159,13 @@ function OUTPUT_HTML($HTML, $NEW_LINE = true) {
                // Rewrite links when rewrite extension is active
                if ((EXT_IS_ACTIVE("rewrite", true)) && (function_exists('REWRITE_LINKS')) && ($CSS != "1") && ($CSS != "-1")) {
                        $OUTPUT = REWRITE_LINKS($OUTPUT);
-               }
+               } // END - if
 
                // Compile and run finished rendered HTML code
                while (strpos($OUTPUT, '{!') > 0) {
                        $eval = "\$OUTPUT = \"".COMPILE_CODE(addslashes($OUTPUT))."\";";
                        eval($eval);
-               }
+               } // END - while
 
                // Output code here, DO NOT REMOVE! ;-)
                OUTPUT_RAW($OUTPUT);
@@ -173,13 +175,13 @@ function OUTPUT_HTML($HTML, $NEW_LINE = true) {
 // Output the raw HTML code
 function OUTPUT_RAW ($HTML) {
        // Output stripped HTML code to avoid broken JavaScript code, etc.
-       echo stripslashes($HTML);
+       echo stripslashes(stripslashes($HTML));
 
        // Flush the output if only _OB_CACHING is not "on"
        if (_OB_CACHING != "on") {
                // Flush it
                flush();
-       }
+       } // END - if
 }
 
 // Add a fatal error message to the queue array
@@ -319,7 +321,7 @@ function LOAD_TEMPLATE($template, $return=false, $content="") {
 
                // Add surrounding HTML comments to help finding bugs faster
                $ret = "<!-- Template ".$template." - Start -->\n".$ret."<!-- Template ".$template." - End -->\n";
-       } elseif ((IS_ADMIN()) || ((isBooleanConstantAndTrue('mxchange_installing')) && (!isBooleanConstantAndTrue('mxchange_installed')))) {
+       } elseif ((IS_ADMIN()) || ((isBooleanConstantAndTrue('mxchange_installing')) && (!defined('mxchange_installed')))) {
                // Only admins shall see this warning or when installation mode is active
                $ret = "<br /><SPAN class=\"guest_failed\">".TEMPLATE_404."</SPAN><br />
 (".basename($file).")<br />
@@ -749,15 +751,6 @@ function LOAD_EMAIL_TEMPLATE($template, $content="", $UID="0") {
                $content['expiration'] = $EXPIRATION;
        } // END - if
 
-       // @TODO Try to rewrite this part
-       if ($template == "add-points") {
-               if (isset($_POST['points'])) {
-                       $points = bigintval($_POST['points']);
-               } else {
-                       $points = __POINTS_VALUE;
-               }
-       } // END - if
-
        // Load user's data
        if ($UID > 0) {
                if (EXT_IS_ACTIVE("nickname")) {
@@ -910,7 +903,7 @@ function LOAD_URL($URL, $addUrlData=true) {
                print("<pre>");
                debug_print_backtrace();
                die("</pre>URL={$URL}");
-               /**/
+               */
                @header ("Location: ".str_replace("&amp;", "&", $URL));
        } else {
                // Output error message
@@ -2234,14 +2227,17 @@ function isBooleanConstantAndTrue($constName) { // : Boolean
        // In cache?
        if (isset($constCache[$constName])) {
                // Use cache
+               //* DEBUG: */ echo __FUNCTION__.": ".$constName."-CACHE!<br />\n";
                $res = $constCache[$constName];
        } else {
                // Check constant
+               //* DEBUG: */ echo __FUNCTION__.": ".$constName."-RESOLVE!<br />\n";
                if (defined($constName)) $res = (constant($constName) === true);
 
                // Set cache
                $constCache[$constName] = $res;
        }
+       //* DEBUG: */ var_dump($res);
 
        // Return value
        return $res;
@@ -2360,7 +2356,7 @@ function RESET_ADD_INCLUDES () {
        global $_CONFIG;
 
        // Is the reset set or old sql_patches?
-       if ((!isBooleanConstantAndTrue('__DAILY_RESET')) || (EXT_VERSION_IS_OLDER("sql_patches", "0.4.5"))) {
+       if ((!defined('__DAILY_RESET')) || (EXT_VERSION_IS_OLDER("sql_patches", "0.4.5"))) {
                // Then abort here
                return array();
        } // END - if