Several fixes for guest menu system and template engine
authorRoland Häder <roland@mxchange.org>
Tue, 27 Oct 2009 22:42:59 +0000 (22:42 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 27 Oct 2009 22:42:59 +0000 (22:42 +0000)
inc/filter-functions.php
inc/functions.php
inc/modules/guest/action-
inc/modules/guest/action-admin.php
inc/modules/guest/action-online.php
inc/modules/guest/action-sponsor.php
inc/modules/guest/action-themes.php
inc/mysql-manager.php

index ce4d302..792e335 100644 (file)
@@ -69,9 +69,6 @@ function initFilterSystem () {
                        $filterArray['chains'][$filterName][$filterFunction]  = $GLOBALS['cache_array']['filter']['filter_active'][$idx];
                } // END - foreach
 
-               // Mark filters as loaded
-               $GLOBALS['cache_array']['filter'] = true;
-
                // Remove the cache
                $GLOBALS['cache_array']['filter'] = $filterArray;
        } elseif ((!isInstallationPhase()) && (isExtensionInstalledAndNewer('sql_patches', '0.5.9'))) {
index 4c5ca96..ee2d1b4 100644 (file)
@@ -363,8 +363,9 @@ function loadTemplate ($template, $return=false, $content=array()) {
                                        $eval = '$ret = "' . compileCode(smartAddSlashes($GLOBALS['tpl_content'])) . '";';
                                }
                        } else {
-                               // Simply return loaded code
-                               $eval = '$ret = $GLOBALS[\'tpl_content\'];';
+                               // Add surrounding HTML comments to help finding bugs faster
+                               $ret = "<!-- Template " . $template . " - Start -->\n" . $GLOBALS['tpl_content'] . "<!-- Template " . $template . " - End -->\n";
+                               $eval = '$ret = "' . smartAddSlashes($ret) . '";';
                        } // END - if
 
                        // Cache the eval() command here
index c865842..3a71404 100644 (file)
 // Some security stuff...
 if (!defined('__SECURITY')) {
        die();
-} // END - if
+} elseif (isBlockModeEnabled()) {
+       // Block mode detected
+       return;
+}
 
 // Add description as navigation point
 addMenuDescription('guest', __FILE__);
@@ -47,9 +50,6 @@ addMenuDescription('guest', __FILE__);
 if ((!isExtensionActive('')) && (!isAdmin())) {
        loadTemplate('admin_settings_saved', false, generateExtensionInactiveNotInstalledMessage(''));
        return;
-} elseif (isBlockModeEnabled()) {
-       // Block mode detected
-       return;
 }
 
 // Load the include file
index 246108d..26dd5cc 100644 (file)
@@ -44,6 +44,9 @@ if (!defined('__SECURITY')) {
        return;
 }
 
+// Add description as navigation point
+addMenuDescription('guest', __FILE__);
+
 // Only when one admin link is clicked...
 $inc = sprintf("inc/modules/guest/what-%s.php", getWhat());
 if (isIncludeReadable($inc)) {
index f2f36de..a01eb37 100644 (file)
@@ -42,6 +42,9 @@ if (!defined('__SECURITY')) {
 } elseif ((!isExtensionActive('online')) && (!isAdmin())) {
        // Just skip this extension
        return;
+} elseif (!isBlockModeEnabled()) {
+       // Block mode detected
+       return;
 }
 
 // Total visitors online
index 6cffad8..5252f61 100644 (file)
@@ -43,9 +43,6 @@ if (!defined('__SECURITY')) {
        return;
 }
 
-// Add description as navigation point
-addMenuDescription('guest', __FILE__);
-
 // Load the include file
 $inc = sprintf("inc/modules/guest/what-%s.php", getWhat());
 if (isIncludeReadable($inc)) {
index 8b4ee7f..00b6bf4 100644 (file)
 // Some security stuff...
 if (!defined('__SECURITY')) {
        die();
-} // END - if
-
-// Add description as navigation point
-addMenuDescription('guest', __FILE__);
+} elseif (!isBlockModeEnabled()) {
+       // Block mode detected
+       return;
+}
 
 if ((!isExtensionActive('theme')) && (!isAdmin())) {
        loadTemplate('admin_settings_saved', false, generateExtensionInactiveNotInstalledMessage('theme'));
@@ -58,6 +58,7 @@ if (isAdmin()) {
        $num_themes = countSumTotalData('', 'themes', 'id', '', true);
 }
 
+$OUT = '';
 if ($num_themes > 1) {
        // If more than 1 is installed output selection box
        $OUT = generateThemeSelectionBox();
index 754ca58..7c4d4a8 100644 (file)
@@ -513,21 +513,21 @@ function addMenu ($mode, $action, $what) {
                                enableBlockMode();
 
                                // Load menu block
-                               $inc_BLOCK = sprintf("inc/modules/%s/action-%s.php", $mode, $content['action']);
-                               if (isFileReadable($inc_BLOCK)) {
+                               $INC = sprintf("inc/modules/%s/action-%s.php", $mode, $content['action']);
+                               if (isFileReadable($INC)) {
                                        // Load include file
                                        if ((!isExtensionActive($content['action'])) || ($content['action'] == 'online')) $GLOBALS['rows'] .= loadTemplate('menu_what_begin', true, $mode);
-                                       //* DEBUG: */ outputHtml(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.$content['sub_what'].':'.getWhat()."*<br />");
-                                       loadInclude($inc_BLOCK);
-                                       //* DEBUG: */ outputHtml(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.$content['sub_what'].':'.getWhat()."*<br />");
-                                       if ((!isExtensionActive($content['action'])) || ($content['action'] == 'online')) $GLOBALS['rows'] .= loadTemplate('menu_what_end', true);
+                                       //* DEBUG: */ outputHtml(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.getWhat()."*<br />");
+                                       loadInclude($INC);
+                                       //* DEBUG: */ outputHtml(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.getWhat()."*<br />");
+                                       if ((!isExtensionActive($content['action'])) || ($content['action'] == 'online')) $GLOBALS['rows'] .= loadTemplate('menu_what_end', true, $mode);
                                }
                                //* DEBUG: */ outputHtml(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.$content['sub_what'].':'.getWhat()."*<br />");
                        }
 
                        $main_cnt++;
 
-                       //* DEBUG: */ outputHtml(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.$content['sub_what'].':'.getWhat()."*<br />");
+                       //* DEBUG: */ outputHtml(__LINE__.'/'.$main_cnt.':'.getWhat()."*<br />");
                        if (SQL_NUMROWS($result_main) > $main_cnt) {
                                // Add seperator
                                $GLOBALS['rows'] .= loadTemplate('menu_seperator', true, $mode);