From c8a83fa31256474eccf50db85187ee6a83d67e26 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 27 Oct 2009 22:42:59 +0000 Subject: [PATCH] Several fixes for guest menu system and template engine --- inc/filter-functions.php | 3 --- inc/functions.php | 5 +++-- inc/modules/guest/action- | 8 ++++---- inc/modules/guest/action-admin.php | 3 +++ inc/modules/guest/action-online.php | 3 +++ inc/modules/guest/action-sponsor.php | 3 --- inc/modules/guest/action-themes.php | 9 +++++---- inc/mysql-manager.php | 14 +++++++------- 8 files changed, 25 insertions(+), 23 deletions(-) diff --git a/inc/filter-functions.php b/inc/filter-functions.php index ce4d30276e..792e335c61 100644 --- a/inc/filter-functions.php +++ b/inc/filter-functions.php @@ -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'))) { diff --git a/inc/functions.php b/inc/functions.php index 4c5ca96fa5..ee2d1b41ad 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -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 = "\n" . $GLOBALS['tpl_content'] . "\n"; + $eval = '$ret = "' . smartAddSlashes($ret) . '";'; } // END - if // Cache the eval() command here diff --git a/inc/modules/guest/action- b/inc/modules/guest/action- index c865842667..3a71404735 100644 --- a/inc/modules/guest/action- +++ b/inc/modules/guest/action- @@ -39,7 +39,10 @@ // 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 diff --git a/inc/modules/guest/action-admin.php b/inc/modules/guest/action-admin.php index 246108d811..26dd5cc40b 100644 --- a/inc/modules/guest/action-admin.php +++ b/inc/modules/guest/action-admin.php @@ -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)) { diff --git a/inc/modules/guest/action-online.php b/inc/modules/guest/action-online.php index f2f36dec20..a01eb37653 100644 --- a/inc/modules/guest/action-online.php +++ b/inc/modules/guest/action-online.php @@ -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 diff --git a/inc/modules/guest/action-sponsor.php b/inc/modules/guest/action-sponsor.php index 6cffad8374..5252f61fea 100644 --- a/inc/modules/guest/action-sponsor.php +++ b/inc/modules/guest/action-sponsor.php @@ -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)) { diff --git a/inc/modules/guest/action-themes.php b/inc/modules/guest/action-themes.php index 8b4ee7ff02..00b6bf45f5 100644 --- a/inc/modules/guest/action-themes.php +++ b/inc/modules/guest/action-themes.php @@ -39,10 +39,10 @@ // 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(); diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index 754ca58d90..7c4d4a8960 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -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()."*
"); - loadInclude($inc_BLOCK); - //* DEBUG: */ outputHtml(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.$content['sub_what'].':'.getWhat()."*
"); - if ((!isExtensionActive($content['action'])) || ($content['action'] == 'online')) $GLOBALS['rows'] .= loadTemplate('menu_what_end', true); + //* DEBUG: */ outputHtml(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.getWhat()."*
"); + loadInclude($INC); + //* DEBUG: */ outputHtml(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.getWhat()."*
"); + 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()."*
"); } $main_cnt++; - //* DEBUG: */ outputHtml(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.$content['sub_what'].':'.getWhat()."*
"); + //* DEBUG: */ outputHtml(__LINE__.'/'.$main_cnt.':'.getWhat()."*
"); if (SQL_NUMROWS($result_main) > $main_cnt) { // Add seperator $GLOBALS['rows'] .= loadTemplate('menu_seperator', true, $mode); -- 2.30.2