]> git.mxchange.org Git - mailer.git/blobdiff - inc/ajax/ajax_admin.php
Added more logging of half-failed AJAX requests
[mailer.git] / inc / ajax / ajax_admin.php
index 827af52ec4fd3143510efca908dcc1d1b4a119be..a7fe37dc1c3d661c2c2eac6017f6112d24994590 100644 (file)
@@ -37,7 +37,8 @@
 
 // Some security stuff...
 if ((!defined('__SECURITY')) || (!isAjaxOutputMode()) || (!isAdmin())) {
-       die();
+       header('HTTP/1.1 403 Forbidden');
+       die(json_encode(array('reply_content' => 'Access forbidden'), JSON_FORCE_OBJECT));
 } // END - if
 
 // "Generates" admin content by loading a message template
@@ -59,6 +60,7 @@ function doAjaxProcessAdmin () {
 
        // Again we do a call-back, so generate a function name depending on 'do'
        $callbackName = 'doAjaxAdmin' . capitalizeUnderscoreString(postRequestElement('do'));
+       $GLOBALS['ajax_callback_function'] = $callbackName;
 
        // Is the call-back function there?
        if (!function_exists($callbackName)) {
@@ -104,7 +106,7 @@ function doAjaxAdminRequestContent () {
                        setHttpStatus('200 OK');
                } else {
                        // Set 404 error
-                       setHttpStatus('404 NOT FOUND');
+                       setHttpStatus('404 Not Found');
                }
        } // END - if
 }