From 8c320ad1ded81f47802c2461617e9685151b5b5f Mon Sep 17 00:00:00 2001 From: e107steved Date: Wed, 8 Aug 2007 19:34:52 +0000 Subject: [PATCH] Notice removal, eliminate DB queries --- e107_plugins/list_new/list_class.php | 16 ++++++++++------ e107_plugins/list_new/list_recent_menu.php | 21 ++++++++++++--------- e107_plugins/pm/pm_func.php | 6 +++--- e107_plugins/poll/poll_class.php | 16 ++++++++++++---- page.php | 5 +++-- 5 files changed, 40 insertions(+), 24 deletions(-) diff --git a/e107_plugins/list_new/list_class.php b/e107_plugins/list_new/list_class.php index 17bff3de4..3cd0b2e90 100644 --- a/e107_plugins/list_new/list_class.php +++ b/e107_plugins/list_new/list_class.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_plugins/list_new/list_class.php,v $ -| $Revision: 1.3 $ -| $Date: 2007-05-31 21:02:53 $ +| $Revision: 1.4 $ +| $Date: 2007-08-08 19:34:34 $ | $Author: e107steved $ +---------------------------------------------------------------+ */ @@ -120,8 +120,10 @@ class listclass { { global $sql, $sections, $titles, $content_types, $content_name; - if(!$content_install = $sql -> db_Select("plugin", "plugin_id", "plugin_path = 'content' AND plugin_installflag = '1' ")){ - return; +// if(!$content_install = $sql -> db_Select("plugin", "plugin_id", "plugin_path = 'content' AND plugin_installflag = '1' ")) + if (!$content_install = isset($pref['plug_installed']['content'])) + { + return; } $datequery = " AND (content_datestamp=0 || content_datestamp < ".time().") AND (content_enddate=0 || content_enddate>".time().") "; @@ -160,7 +162,8 @@ class listclass { $tmp = array_reverse($tmp); $icon['fname'] = $tmp[1]; - if($plugin_installed = $sql -> db_Select("plugin", "plugin_id", "plugin_path = '".$icon['fname']."' AND plugin_installflag = '1' ")) +// if($plugin_installed = $sql -> db_Select("plugin", "plugin_id", "plugin_path = '".$icon['fname']."' AND plugin_installflag = '1' ")) + if ($plugin_installed = isset($pref['plug_installed'][$icon['fname']])) { if($icon['fname'] == "content") { @@ -187,7 +190,8 @@ class listclass { { if(!in_array($sections[$i], $content_types)) { - if($plugin_installed = $sql -> db_Select("plugin", "plugin_id", "plugin_path = '".$tp -> toDB($sections[$i], true)."' AND plugin_installflag = '1' ")) +// if($plugin_installed = $sql -> db_Select("plugin", "plugin_id", "plugin_path = '".$tp -> toDB($sections[$i], true)."' AND plugin_installflag = '1' ")) + if ($plugin_installed = isset($pref['plug_installed'][$tp -> toDB($sections[$i], true)])) { $list_pref["$sections[$i]_recent_menu_caption"] = $sections[$i]; $list_pref["$sections[$i]_recent_page_caption"] = $sections[$i]; diff --git a/e107_plugins/list_new/list_recent_menu.php b/e107_plugins/list_new/list_recent_menu.php index 4bfd4226b..88bf2be58 100644 --- a/e107_plugins/list_new/list_recent_menu.php +++ b/e107_plugins/list_new/list_recent_menu.php @@ -11,17 +11,17 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_plugins/list_new/list_recent_menu.php,v $ -| $Revision: 1.1.1.1 $ -| $Date: 2006-12-02 04:35:26 $ -| $Author: mcfly_e107 $ +| $Revision: 1.2 $ +| $Date: 2007-08-08 19:34:34 $ +| $Author: e107steved $ +---------------------------------------------------------------+ */ if (!defined('e107_INIT')) { exit; } -if(!$sql -> db_Select("plugin", "*", "plugin_path = 'list_new' AND plugin_installflag = '1' ")){ - return; -} +if (!isset($pref['plug_installed']['list_new'])) return; + + global $sysprefs, $tp, $eArrayStorage; $listplugindir = e_PLUGIN."list_new/"; @@ -42,10 +42,13 @@ $arr = $rc -> prepareSectionArray($mode, $sections); //display the sections $text = ""; -for($i=0;$i show_section_list($arr[$i], $mode); - if($sectiontext != ""){ + if($sectiontext != "") + { $text .= $sectiontext; } } diff --git a/e107_plugins/pm/pm_func.php b/e107_plugins/pm/pm_func.php index 8cc6cfb19..33219f144 100755 --- a/e107_plugins/pm/pm_func.php +++ b/e107_plugins/pm/pm_func.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_plugins/pm/pm_func.php,v $ -| $Revision: 1.2 $ -| $Date: 2007-05-28 11:18:18 $ +| $Revision: 1.3 $ +| $Date: 2007-08-08 19:34:34 $ | $Author: e107steved $ +----------------------------------------------------------------------------+ */ @@ -53,7 +53,7 @@ function pm_getInfo($which = "inbox") } if(!isset($pm_info[$which]['limit'])) { - if($pref['pm_limits'] > 0) + if(varset($pref['pm_limits'],0) > 0) { if($pref['pm_limits'] == 1) { diff --git a/e107_plugins/poll/poll_class.php b/e107_plugins/poll/poll_class.php index a95a30f47..3611569f6 100644 --- a/e107_plugins/poll/poll_class.php +++ b/e107_plugins/poll/poll_class.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_plugins/poll/poll_class.php,v $ -| $Revision: 1.4 $ -| $Date: 2007-08-06 19:16:28 $ +| $Revision: 1.5 $ +| $Date: 2007-08-08 19:34:34 $ | $Author: e107steved $ +----------------------------------------------------------------------------+ */ @@ -286,9 +286,17 @@ class poll if(count($voteArray)) { - foreach($voteArray as $votes){ - $percentage[] = round(($votes/$voteTotal) * 100, 2); + foreach($voteArray as $votes) + { + if ($voteTotal > 0) + { + $percentage[] = round(($votes/$voteTotal) * 100, 2); } + else + { + $percentage[] = 0; + } + } } /* get template */ if (file_exists(THEME."poll_template.php")) diff --git a/page.php b/page.php index 2f16345bf..d01f91b10 100644 --- a/page.php +++ b/page.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/page.php,v $ -| $Revision: 1.11 $ -| $Date: 2007-08-03 18:40:49 $ +| $Revision: 1.12 $ +| $Date: 2007-08-08 19:34:34 $ | $Author: e107steved $ | +----------------------------------------------------------------------------+ @@ -288,6 +288,7 @@ class pageClass function pageIndex() { $count = 0; + $itext = ''; foreach($this -> pageTitles as $title) { if (!$count) { $itext = "

"; }