]> git.mxchange.org Git - mailer.git/blobdiff - inc/template-functions.php
Continued on AJAX installer to start first step (more are easily to add)
[mailer.git] / inc / template-functions.php
index c57e2c52e2fdad3e363e9f3a57b020b1b9821b53..00d4b9d9a510c870330a4c2b1293dafd1719c5b8 100644 (file)
@@ -1208,8 +1208,14 @@ function app_exit ($F, $L, $message) {
        // Make sure, that the script realy realy diese here and now
        $GLOBALS['app_died'] = TRUE;
 
-       // Set content type as text/html
-       setContentType('text/html');
+       // Is this AJAX mode?
+       if (isAjaxOutputMode()) {
+               // Set content type as application/json
+               setContentType('application/json');
+       } else {
+               // Set content type as text/html
+               setContentType('text/html');
+       }
 
        // Load header
        loadIncludeOnce('inc/header.php');
@@ -1222,8 +1228,17 @@ function app_exit ($F, $L, $message) {
                $message
        );
 
-       // Load the message template
-       loadTemplate('app_exit_message', FALSE, $message);
+       // Is this AJAX mode again
+       if (isAjaxOutputMode()) {
+               // Load the message template
+               $OUT = loadTemplate('ajax_app_exit_message', TRUE, $message);
+
+               // Output it as JSON encoded
+               outputHtml(encodeJson(array('reply_content' => urlencode(doFinalCompilation($OUT)))));
+       } else {
+               // Load the message template
+               loadTemplate('app_exit_message', FALSE, $message);
+       }
 
        // Load footer
        loadIncludeOnce('inc/footer.php');