From 5f42c937583896273657ce7a7618534a6a4e3484 Mon Sep 17 00:00:00 2001 From: e107steved Date: Sun, 16 Nov 2008 17:49:24 +0000 Subject: [PATCH] Bugtracker #4553 - check for poll comments, odd tidying up --- e107_plugins/poll/poll_class.php | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/e107_plugins/poll/poll_class.php b/e107_plugins/poll/poll_class.php index fae08aa06..de1aea92d 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.11 $ -| $Date: 2008-08-17 11:54:39 $ +| $Revision: 1.12 $ +| $Date: 2008-11-16 17:49:24 $ | $Author: e107steved $ +----------------------------------------------------------------------------+ */ @@ -137,14 +137,12 @@ class poll if ($sql->db_Select_gen($query)) { $pollArray = $sql -> db_Fetch(); - if (!check_class($pollArray['poll_vote_userclass'])) { $POLLMODE = "disallowed"; } else { - switch($pollArray['poll_storage_method']) { case POLL_MODE_COOKIE: @@ -195,6 +193,10 @@ class poll } } } + else + { + return FALSE; + } if(isset($_POST['pollvote']) && $POLLMODE == "notvoted" && ($POLLMODE != "disallowed")) { if ($_POST['votea']) @@ -251,7 +253,10 @@ class poll switch ($POLLMODE) { case "query" : // Show poll, register any vote - $this->get_poll($pollArray); + if ($this->get_poll($pollArray) === FALSE) + { + return ''; // No display if no poll + } $pollArray = $this->pollRow; $POLLMODE = $this->pollmode; break; @@ -270,8 +275,7 @@ class poll if($type == "preview") { /* load lan file */ - @include_once(e_PLUGIN."poll/languages/".e_LANGUAGE.".php"); - @include_once(e_PLUGIN."poll/languages/English.php"); + @include_lan(e_PLUGIN."poll/languages/".e_LANGUAGE.".php"); $optionArray = $pollArray['poll_option']; $voteArray = array(); $voteArray = array_pad($voteArray, count($optionArray), 0); @@ -279,8 +283,7 @@ class poll } else if($type == "forum") { - @include_once(e_PLUGIN."poll/languages/".e_LANGUAGE.".php"); - @include_once(e_PLUGIN."poll/languages/English.php"); + @include_lan(e_PLUGIN."poll/languages/".e_LANGUAGE.".php"); if(isset($_POST['fpreview'])) { $pollArray['poll_allow_multiple'] = $pollArray['multipleChoice']; @@ -341,12 +344,16 @@ class poll $preview = TRUE; } + $comment_total = 0; + if ($pollArray['poll_comment']) + { // Only get comments if they're allowed on poll $comment_total = $sql->db_Select("comments", "*", "comment_item_id='".intval($pollArray['poll_id'])."' AND comment_type=4"); + } $QUESTION = $tp -> toHTML($pollArray['poll_title'], TRUE,"emotes_off, defs"); $VOTE_TOTAL = POLLAN_31.": ".$voteTotal; $COMMENTS = ($pollArray['poll_comment'] ? " ".POLLAN_27.": ".$comment_total."" : ""); - $OLDPOLLS = ($type == "menu" ? "".POLLAN_28."" : ""); + $OLDPOLLS = ($type == "menu" ? "".POLLAN_28."" : ""); $AUTHOR = POLLAN_35." ".($type == "preview" || $type == "forum" ? USERNAME : "".$pollArray['user_name'].""); switch ($POLLMODE)