]> git.mxchange.org Git - mailer.git/blobdiff - inc/template-functions.php
AJAX installation is 'basicly finished' :) Plus I threw in a small christmas present...
[mailer.git] / inc / template-functions.php
index 00d4b9d9a510c870330a4c2b1293dafd1719c5b8..f53fc9115a00cd3c73838c308652d0e632793b28 100644 (file)
@@ -344,6 +344,10 @@ function loadTemplate ($template, $return = FALSE, $content = array(), $compileC
                                        // 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) . '");';
+                               } elseif (isAjaxOutputMode()) {
+                                       // AJAX (JSON content)
+                                       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Reached!');
+                                       $GLOBALS['template_eval']['html'][$template] = '$ret = "' . 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!');
@@ -354,6 +358,10 @@ function loadTemplate ($template, $return = FALSE, $content = array(), $compileC
                                $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) . '";';
+                       } elseif (isAjaxOutputMode()) {
+                               // AJAX (JSON content)
+                               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Reached!');
+                               $GLOBALS['template_eval']['html'][$template] = '$ret = "' . compileRawCode(escapeJavaScriptQuotes($GLOBALS['template_content']['html'][$template]), FALSE, TRUE, TRUE, $compileCode) . '";';
                        } else {
                                // JavaScript again
                                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Reached!');
@@ -506,6 +514,7 @@ function loadEmailTemplate ($template, $content = array(), $userid = NULL, $load
                        $GLOBALS['template_content']['email'][$template] = readFromFile($FQFN);
 
                        // Run code
+                       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Reached!');
                        $GLOBALS['template_eval']['email'][$template] = '$newContent = decodeEntities("' . compileRawCode(escapeQuotes($GLOBALS['template_content']['email'][$template])) . '");';
                } elseif (!empty($template)) {
                        // Template file not found
@@ -536,7 +545,7 @@ function loadEmailTemplate ($template, $content = array(), $userid = NULL, $load
        if ((isset($GLOBALS['template_eval']['email'][$template])) && ($GLOBALS['template_eval']['email'][$template] != '404')) {
                // Eval the code
                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'template=' . $template . ' - BEFORE EVAL');
-               ///* DEBUG: */ print('<pre>'.htmlentities($GLOBALS['template_eval']['email'][$template]).'</pre>');
+               //* DEBUG: */ print('<pre>'.htmlentities($GLOBALS['template_eval']['email'][$template]).'</pre>');
                eval($GLOBALS['template_eval']['email'][$template]);
                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'template=' . $template . ' - AFTER EVAL');
        } // END - if
@@ -1693,7 +1702,7 @@ function sendModeMails ($mod, $modes) {
                $hash = encodeHashForCookie(getUserData('password'));
 
                // Does the hash match or should we change it?
-               if (($hash == getSession('u_hash')) || (postRequestElement('pass1') == postRequestElement('pass2'))) {
+               if (($hash == getSession('u_hash')) || (postRequestElement('password1') == postRequestElement('password2'))) {
                        // Load the data
                        $content = getUserDataArray();