Rewrites/fixes for handling config entries in SQLs
[mailer.git] / inc / functions.php
index bac7b16a82c2a885ece8cd0f7738929d43bf0ecf..1d7c71f5d230274e05c92a05351c2c551fb2fa97 100644 (file)
@@ -178,7 +178,7 @@ function doFinalCompilation ($code, $insertComments = true) {
        $cnt = 0;
 
        // Compile all out
-       while (((strpos($code, '{--') !== false) || (strpos($code, '{DQUOTE}') !== false) || (strpos($code, '{!') !== false) || (strpos($code, '{?') !== false) || (strpos($code, '{%') !== false)) && ($cnt < 3)) {
+       while (((strpos($code, '{--') !== false) || (strpos($code, '{DQUOTE}') !== false) || (strpos($code, '{?') !== false) || (strpos($code, '{%') !== false)) && ($cnt < 3)) {
                // Init common variables
                $content = array();
                $newContent = '';
@@ -306,7 +306,7 @@ function loadTemplate ($template, $return = false, $content = array()) {
 
                        // Do we have to compile the code?
                        $ret = '';
-                       if ((strpos($GLOBALS['tpl_content'], '$') !== false) || (strpos($GLOBALS['tpl_content'], '{--') !== false) || (strpos($GLOBALS['tpl_content'], '{!') !== false) || (strpos($GLOBALS['tpl_content'], '{?') !== false) || (strpos($GLOBALS['tpl_content'], '{%') !== false)) {
+                       if ((strpos($GLOBALS['tpl_content'], '$') !== false) || (strpos($GLOBALS['tpl_content'], '{--') !== false) || (strpos($GLOBALS['tpl_content'], '{?') !== false) || (strpos($GLOBALS['tpl_content'], '{%') !== false)) {
                                // Normal HTML output?
                                if (getOutputMode() == '0') {
                                        // Add surrounding HTML comments to help finding bugs faster
@@ -607,7 +607,7 @@ Message : ' . htmlentities(utf8_decode($message)) . '
        }
 
        // Why did we end up here? This should not happen
-       debug_report_bug('Ending up: template=' . $template);
+       debug_report_bug(__FUNCTION__, __LINE__, 'Ending up: template=' . $template);
 }
 
 // Check to use wether legacy mail() command or PHPMailer class
@@ -880,7 +880,7 @@ function translateMenuVisibleLocked ($content, $prefix = '') {
                case 'N': $content[$prefix . 'visible_css'] = $prefix . 'menu_invisible'; break;
                default:
                        // Please report this
-                       debug_report_bug('Unsupported visible value detected. content=<pre>'.print_r($content, true).'</pre>');
+                       debug_report_bug(__FUNCTION__, __LINE__, 'Unsupported visible value detected. content=<pre>'.print_r($content, true).'</pre>');
                        break;
        } // END - switch
 
@@ -891,7 +891,7 @@ function translateMenuVisibleLocked ($content, $prefix = '') {
                case 'N': $content[$prefix . 'locked_css'] = $prefix . 'menu_unlocked'; break;
                default:
                        // Please report this
-                       debug_report_bug('Unsupported locked value detected. content=<pre>'.print_r($content, true).'</pre>');
+                       debug_report_bug(__FUNCTION__, __LINE__, 'Unsupported locked value detected. content=<pre>'.print_r($content, true).'</pre>');
                        break;
        } // END - switch
 
@@ -1049,7 +1049,7 @@ function compileCode ($code, $simple = false, $constants = true, $full = true) {
 }
 
 // Compiles the code (use compileCode() only for HTML because of the comments)
-// @TODO $simple is deprecated
+// @TODO $simple/$constants are deprecated
 function compileRawCode ($code, $simple = false, $constants = true, $full = true) {
        // Is the code a string?
        if (!is_string($code)) {
@@ -1066,16 +1066,8 @@ function compileRawCode ($code, $simple = false, $constants = true, $full = true
        // Compile more through a filter
        $code = runFilterChain('compile_code', $code);
 
-       // Compile constants
-       if ($constants === true) {
-               // BEFORE 0.2.1 : Language and data constants
-               // WITH 0.2.1+  : Only language constants
-               $code = str_replace('{--', "{DQUOTE} . getMessage('", str_replace('--}', "') . {DQUOTE}", $code));
-
-               // BEFORE 0.2.1 : Not used
-               // WITH 0.2.1+  : Data constants
-               $code = str_replace('{!', "{DQUOTE} . constant('", str_replace('!}', "') . {DQUOTE}", $code));
-       } // END - if
+       // Compile message strings
+       $code = str_replace('{--', '{%message,', str_replace('--}', '%}', $code));
 
        // Compile QUOT and other non-HTML codes
        foreach ($secChars['to'] as $k => $to) {
@@ -3487,7 +3479,7 @@ function initCacheInstance () {
        $GLOBALS['cache_instance'] = new CacheSystem();
        if ($GLOBALS['cache_instance']->getStatus() != 'done') {
                // Failed to initialize cache sustem
-               addFatalMessage(__FUNCTION__, __LINE__, '(<font color="#0000aa">' . __LINE__ . '</font>): ' . getMessage('CACHE_CANNOT_INITIALIZE'));
+               addFatalMessage(__FUNCTION__, __LINE__, '(<font color="#0000aa">' . __LINE__ . '</font>): {--CACHE_CANNOT_INITIALIZE--}');
        } // END - if
 }