]> git.mxchange.org Git - mailer.git/commitdiff
HTTP status codes added for missing/locked modules, fixed double-logging of debug...
authorRoland Häder <roland@mxchange.org>
Mon, 7 Jun 2010 22:17:16 +0000 (22:17 +0000)
committerRoland Häder <roland@mxchange.org>
Mon, 7 Jun 2010 22:17:16 +0000 (22:17 +0000)
inc/functions.php
inc/header.php
inc/wrapper-functions.php
modules.php

index 254a29a17ef88d789297edfd803751925360f30c..864e26f9678eda20f32524877b8129e96053070e 100644 (file)
@@ -126,7 +126,7 @@ function sendHttpHeaders () {
        $now = gmdate('D, d M Y H:i:s') . ' GMT';
 
        // Send HTTP header
        $now = gmdate('D, d M Y H:i:s') . ' GMT';
 
        // Send HTTP header
-       sendHeader('HTTP/1.1 200 OK');
+       sendHeader('HTTP/1.1 ' . getHttpStatus());
 
        // General headers for no caching
        sendHeader('Expires: ' . $now); // RFC2616 - Section 14.21
 
        // General headers for no caching
        sendHeader('Expires: ' . $now); // RFC2616 - Section 14.21
@@ -2364,12 +2364,6 @@ function app_die ($F, $L, $message) {
                // Rewrite message for output
                $message = sprintf(getMessage('MAILER_HAS_DIED'), basename($F), $L, $message);
 
                // Rewrite message for output
                $message = sprintf(getMessage('MAILER_HAS_DIED'), basename($F), $L, $message);
 
-               // We don't want to log messages from debug_report_bug() itself...
-               if ($F != 'debug_report_bug') {
-                       // Better log this message away
-                       logDebugMessage($F, $L, $message);
-               } // END - if
-
                // Load the message template
                loadTemplate('app_die_message', false, $message);
 
                // Load the message template
                loadTemplate('app_die_message', false, $message);
 
index 06f8f74daa9e34cb9d44660525d4d3bf8f53444b..0313f88583d39f2c2deefa01e9f7bd96095b6b77 100644 (file)
@@ -49,6 +49,9 @@ $GLOBALS['page_header'] = '';
 
 // Is the header already sent?
 if (($GLOBALS['header_sent'] != 1) && ($GLOBALS['header_sent'] != 2)) {
 
 // Is the header already sent?
 if (($GLOBALS['header_sent'] != 1) && ($GLOBALS['header_sent'] != 2)) {
+       // Set default HTTP status to "200 OK"
+       setHttpStatus('200 OK');
+
        // If not in CSS mode generate the header
        if (getOutputMode() != 1) {
                // Prepare the header for HTML output
        // If not in CSS mode generate the header
        if (getOutputMode() != 1) {
                // Prepare the header for HTML output
index dbd6e713f4c0173f6106b82e8dc2edd9852ded04..8877bcc150e85ff0c92416d0088ac8b35e44235e 100644 (file)
@@ -946,5 +946,15 @@ function preCompileCode ($code, $template = '', $compiled = false, $full = true,
        return compileCode($code, false, true, $full);
 }
 
        return compileCode($code, false, true, $full);
 }
 
+// Setter for HTTP status
+function setHttpStatus ($status) {
+       $GLOBALS['http_status'] = (string) $status;
+}
+
+// Getter for HTTP status
+function getHttpStatus () {
+       return $GLOBALS['http_status'];
+}
+
 // [EOF]
 ?>
 // [EOF]
 ?>
index 9bddeb8a605553566b18f83ea36d4feddb246474..796b1e8128191000cc04810ef640d0afc45390f7 100644 (file)
@@ -93,17 +93,30 @@ if ((isExtensionActive('maintenance')) && (getConfig('maintenance') == 'Y') && (
                                // Module is valid, active and located on the local disc...
                                $isModuleValid = true;
                        } elseif (!ifFatalErrorsDetected()) {
                                // Module is valid, active and located on the local disc...
                                $isModuleValid = true;
                        } elseif (!ifFatalErrorsDetected()) {
+                               // Set HTTP status
+                               setHttpStatus('404');
+
                                // Module not found!
                                addFatalMessage(__FILE__, __LINE__, getMaskedMessage('MODULE_REGISTRY_404', getModule()));
                        }
                        break;
 
                case '404':
                                // Module not found!
                                addFatalMessage(__FILE__, __LINE__, getMaskedMessage('MODULE_REGISTRY_404', getModule()));
                        }
                        break;
 
                case '404':
+                       // Set HTTP status
+                       setHttpStatus('404');
+
+                       // Add fatal message
                        addFatalMessage(__FILE__, __LINE__, getMaskedMessage('MODULE_REGISTRY_404', getModule()));
                        break;
 
                case 'locked':
                        addFatalMessage(__FILE__, __LINE__, getMaskedMessage('MODULE_REGISTRY_404', getModule()));
                        break;
 
                case 'locked':
+                       // Set HTTP status
+                       setHttpStatus('403');
+
                        if (!isIncludeReadable($GLOBALS['module_inc'])) {
                        if (!isIncludeReadable($GLOBALS['module_inc'])) {
+                               // Set HTTP status
+                               setHttpStatus('404');
+
                                // Module does addionally not exists
                                addFatalMessage(__FILE__, __LINE__, getMaskedMessage('MODULE_REGISTRY_404', getModule()));
                        } // END - if
                                // Module does addionally not exists
                                addFatalMessage(__FILE__, __LINE__, getMaskedMessage('MODULE_REGISTRY_404', getModule()));
                        } // END - if
@@ -113,6 +126,7 @@ if ((isExtensionActive('maintenance')) && (getConfig('maintenance') == 'Y') && (
                        break;
 
                default:
                        break;
 
                default:
+                       // Unknown module status
                        logDebugMessage(__FILE__, __LINE__, sprintf("Unknown status %s return from module check. Module=%s", $check, getModule()));
                        addFatalMessage(__FILE__, __LINE__, getMaskedMessage('UNKNOWN_MODULE_STATUS', $check));
                        break;
                        logDebugMessage(__FILE__, __LINE__, sprintf("Unknown status %s return from module check. Module=%s", $check, getModule()));
                        addFatalMessage(__FILE__, __LINE__, getMaskedMessage('UNKNOWN_MODULE_STATUS', $check));
                        break;