]> git.mxchange.org Git - mailer.git/blobdiff - inc/functions.php
Invisible/locked menus are now styleable with CSS classes (sub_)menu_[in]visible_css...
[mailer.git] / inc / functions.php
index 305ee3f8aa02f6b18964bd1878aa3fb6aac2c7cb..5a5507bab8f13d8c8a12b519fba444de03eaf2f8 100644 (file)
@@ -126,7 +126,7 @@ function sendHttpHeaders () {
        $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
@@ -324,9 +324,6 @@ function loadTemplate ($template, $return = false, $content = array()) {
 
                        // Cache the eval() command here
                        $GLOBALS['template_eval'][$template] = $eval;
-
-                       // Eval the code
-                       eval($GLOBALS['template_eval'][$template]);
                } elseif ((isAdmin()) || ((isInstalling()) && (!isInstalled()))) {
                        // Only admins shall see this warning or when installation mode is active
                        $ret = '<br /><span class="guest_failed">{--TEMPLATE_404--}</span><br />
@@ -341,10 +338,13 @@ function loadTemplate ($template, $return = false, $content = array()) {
                        // No file!
                        $GLOBALS['template_eval'][$template] = '404';
                }
-       } else {
+       }
+
+       // Code set?
+       if ((isset($GLOBALS['template_eval'][$template])) && ($GLOBALS['template_eval'][$template] != '404')) {
                // Eval the code
                eval($GLOBALS['template_eval'][$template]);
-       }
+       } // END - if
 
        // Do we have some content to output or return?
        if (!empty($ret)) {
@@ -872,6 +872,34 @@ function translateUserStatus ($status) {
        return $ret;
 }
 
+// "Translates" 'visible' and 'locked' to a CSS class
+function translateMenuVisibleLocked ($content, $prefix = '') {
+       // Translate 'visible' and keep an eye on the prefix
+       switch ($content[$prefix . 'visible']) {
+               // Should be visible
+               case 'Y': $content[$prefix . 'visible_css'] = $prefix . 'menu_visible_css'  ; break;
+               case 'N': $content[$prefix . 'visible_css'] = $prefix . 'menu_invisible_css'; break;
+               default:
+                       // Please report this
+                       debug_report_bug('Unsupported visible value detected. content=<pre>'.print_r($content, true).'</pre>');
+                       break;
+       } // END - switch
+
+       // Translate 'locked' and keep an eye on the prefix
+       switch ($content[$prefix . 'locked']) {
+               // Should be locked
+               case 'Y': $content[$prefix . 'locked_css'] = $prefix . 'menu_locked_css'  ; break;
+               case 'N': $content[$prefix . 'locked_css'] = $prefix . 'menu_unlocked_css'; break;
+               default:
+                       // Please report this
+                       debug_report_bug('Unsupported locked value detected. content=<pre>'.print_r($content, true).'</pre>');
+                       break;
+       } // END - switch
+
+       // Return the resulting array
+       return $content;
+}
+
 // Generates an URL for the dereferer
 function generateDerefererUrl ($URL) {
        // Don't de-refer our own links!
@@ -2364,12 +2392,6 @@ function app_die ($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);