[geeklog-cvs] geeklog: Don't use a $topic variable for the poll topic to avoid...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Sun Feb 7 06:42:32 EST 2010


changeset 7710:936690bc3ce0
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/936690bc3ce0
user: Dirk Haun <dirk at haun-online.de>
date: Sun Feb 07 11:05:56 2010 +0100
description:
Don't use a $topic variable for the poll topic to avoid mixups with a story topic (e.g. with the "Contribute" link)

diffstat:

 plugins/polls/functions.inc |  23 ++++++++++++-----------
 public_html/polls/index.php |   8 ++++----
 2 files changed, 16 insertions(+), 15 deletions(-)

diffs (97 lines):

diff -r 0033cdff4a24 -r 936690bc3ce0 plugins/polls/functions.inc
--- a/plugins/polls/functions.inc	Sun Feb 07 10:54:20 2010 +0100
+++ b/plugins/polls/functions.inc	Sun Feb 07 11:05:56 2010 +0100
@@ -452,22 +452,23 @@
 * @return       string  HTML Formatted Poll
 *
 */
-
 function POLLS_pollVote($pid, $showall = true, $displaytype = 0, $order = '', $mode = '')
 {
-    global $_CONF, $_TABLES, $LANG_POLLS, $LANG01, $_USER, $LANG25, $_IMAGE_TYPE;
+    global $_CONF, $_TABLES, $_USER, $LANG_POLLS, $LANG01, $LANG25,
+           $_IMAGE_TYPE;
+
     $retval = '';
 
-    $topic = DB_query("SELECT topic,voters,commentcode,is_open,hideresults,owner_id "
+    $result = DB_query("SELECT topic,voters,commentcode,is_open,hideresults,owner_id "
         . ",group_id,perm_owner,perm_group,perm_anon,perm_members "
         . "FROM {$_TABLES['polltopics']} WHERE pid='$pid'" . COM_getPermSql('AND'));
-    $ntopics = DB_numRows($topic);
+    $ntopics = DB_numRows($result);
 
     if ($ntopics == 0) {
         return $retval;
     }
 
-    $P = DB_fetchArray($topic);
+    $P = DB_fetchArray($result);
     
     if ((!isset($_COOKIE[$pid]) && !POLLS_ipAlreadyVoted($pid)) or ($P['is_open'] == 1)) {
         if ($ntopics == 1) {
@@ -515,9 +516,9 @@
                 }
                 $poll->set_var('poll_results', $results);
 
-                $access = SEC_hasAccess($topic['owner_id'], $topic['group_id'],
-                                $topic['perm_owner'], $topic['perm_group'],
-                                $topic['perm_members'], $topic['perm_anon']);
+                $access = SEC_hasAccess($P['owner_id'], $P['group_id'],
+                                $P['perm_owner'], $P['perm_group'],
+                                $P['perm_members'], $P['perm_anon']);
                 if ($access == 3) {
                     $editlink = COM_createLink($LANG25[27], $_CONF['site_admin_url']
                         . '/plugins/polls/index.php?mode=edit&pid=' . $pid);
@@ -762,8 +763,8 @@
     $topic_sql = "SELECT topic,voters,is_open,hideresults,commentcode,owner_id,group_id,"
         . "perm_owner,perm_group,perm_members,perm_anon "
         . "FROM {$_TABLES['polltopics']} WHERE pid='$pid'";
-    $topic = DB_query($topic_sql);
-    $P = DB_fetchArray($topic);
+    $result = DB_query($topic_sql);
+    $P = DB_fetchArray($result);
 
     if(SEC_hasAccess($P['owner_id'], $P['group_id'], $P['perm_owner'],
         $P['perm_group'], $P['perm_members'], $P['perm_anon']) == 0 ) {
@@ -788,7 +789,7 @@
         return $retval;
     }
     
-    $ntopic = DB_numRows($topic );
+    $ntopic = DB_numRows($result);
     if ($ntopic == 1) {
         $questions_sql = "SELECT qid,pid,question "
             . "FROM {$_TABLES['pollquestions']} "
diff -r 0033cdff4a24 -r 936690bc3ce0 public_html/polls/index.php
--- a/public_html/polls/index.php	Sun Feb 07 10:54:20 2010 +0100
+++ b/public_html/polls/index.php	Sun Feb 07 11:05:56 2010 +0100
@@ -158,8 +158,8 @@
     $result = DB_query ("SELECT topic, meta_description, meta_keywords FROM {$_TABLES['polltopics']} WHERE pid = '{$pid}'" . COM_getPermSQL('AND'));
     $A = DB_fetchArray ($result);
     
-    $topic = $A['topic'];
-    if (empty($topic)) {
+    $polltopic = $A['topic'];
+    if (empty($polltopic)) {
         // poll doesn't exist or user doesn't have access
         $display .= COM_siteHeader('menu', $LANG_POLLS['pollstitle'])
                  . COM_showMessageText(sprintf($LANG25[12], $pid));
@@ -172,7 +172,7 @@
             $headercode = COM_createMetaTags($meta_description, $meta_keywords);
         }
 
-        $display .= COM_siteHeader('menu', $topic, $headercode);
+        $display .= COM_siteHeader('menu', $polltopic, $headercode);
         if ($msg > 0) {
             $display .= COM_showMessage($msg, 'polls');
         }
@@ -180,7 +180,7 @@
             $display .= COM_startBlock (
                     $LANG_POLLS['not_saved'], '',
                     COM_getBlockTemplate ('_msg_block', 'header'))
-                . $LANG_POLLS['answer_all'] . ' "' . $topic . '"'
+                . $LANG_POLLS['answer_all'] . ' "' . $polltopic . '"'
                 . COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));
         }
         if (DB_getItem($_TABLES['polltopics'], 'is_open', "pid = '$pid'") != 1) {



More information about the geeklog-cvs mailing list