[geeklog-cvs] geeklog: Updated to allow comments with multiple pages to work p...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Tue Feb 16 11:26:14 EST 2010


changeset 7726:008d5dbf7a36
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/008d5dbf7a36
user: Tom <websitemaster at cogeco.net>
date: Tue Feb 16 11:22:55 2010 -0500
description:
Updated to allow comments with multiple pages to work properly.
Fixed order not being set for comments.

diffstat:

 plugins/polls/functions.inc |  22 +++++++++++-----------
 public_html/polls/index.php |   8 ++++++--
 2 files changed, 17 insertions(+), 13 deletions(-)

diffs (120 lines):

diff -r 3fffe09ae6cd -r 008d5dbf7a36 plugins/polls/functions.inc
--- a/plugins/polls/functions.inc	Tue Feb 16 11:22:08 2010 -0500
+++ b/plugins/polls/functions.inc	Tue Feb 16 11:22:55 2010 -0500
@@ -452,7 +452,7 @@
 * @return       string  HTML Formatted Poll
 *
 */
-function POLLS_pollVote($pid, $showall = true, $displaytype = 0, $order = '', $mode = '')
+function POLLS_pollVote($pid, $showall = true, $displaytype = 0, $order = '', $mode = '', $page = 1)
 {
     global $_CONF, $_TABLES, $_USER, $LANG_POLLS, $LANG01, $LANG25,
            $_IMAGE_TYPE;
@@ -604,13 +604,13 @@
                     require_once $_CONF['path_system'] . 'lib-comment.php';
 
                     $retval .= CMT_userComments($pid, $P['topic'], 'polls',
-                                                $order, $mode, 0, 1, false,
+                                                $order, $mode, 0, $page, false,
                                                 $delete_option, $P['commentcode']);
                 }
             }
         }
     } else {
-        $retval .= POLLS_pollResults($pid, 0, '', '', $displaytype);
+        $retval .= POLLS_pollResults($pid, 0, '', '', 1, $displaytype);
     }
 
     return $retval;
@@ -649,7 +649,7 @@
                 ($Q['is_open'] == 1)) {
             $retval .= POLLS_pollVote($pid, $showall, $displaytype);
         } else {
-            $retval .= POLLS_pollResults($pid, $size, '', '', $displaytype);
+            $retval .= POLLS_pollResults($pid, $size, '', '', 1, $displaytype);
         }
     } else {
         $result = DB_query("SELECT pid,topic,is_open FROM {$_TABLES['polltopics']} WHERE display = 1" . COM_getPermSql('AND') . " ORDER BY date DESC");
@@ -672,7 +672,7 @@
                         !POLLS_ipAlreadyVoted($pid) && ($Q['is_open'] == 1)) {
                     $retval .= POLLS_pollVote($pid, $showall, $displaytype);
                 } else {
-                    $retval .= POLLS_pollResults($pid, $size, '', '',
+                    $retval .= POLLS_pollResults($pid, $size, '', '', 1,
                                                  $displaytype);
                 }
 
@@ -754,7 +754,7 @@
 * @return     string   HTML Formated Poll Results
 *
 */
-function POLLS_pollResults($pid, $scale=400, $order='', $mode='', $displaytype = 0)
+function POLLS_pollResults($pid, $scale=400, $order='', $mode='', $page = 1, $displaytype = 0)
 {
     global $_CONF, $_TABLES, $_USER, $_IMAGE_TYPE,
            $_PO_CONF, $LANG01, $LANG_POLLS, $_COM_VERBOSE, $LANG25;
@@ -831,9 +831,9 @@
                 $poll->set_var('edit_icon', $editlink);
             }
             if ($_PO_CONF['answerorder'] == 'voteorder'){
-                $order = "votes DESC";
+                $answerorder = "votes DESC";
             } else {
-                $order = "aid";
+                $answerorder = "aid";
             }
 
             for ($j = 0; $j < $nquestions; $j++) {
@@ -847,7 +847,7 @@
                 $answer_sql = "SELECT votes,answer,remark "
                     . "FROM {$_TABLES['pollanswers']} "
                     . "WHERE pid='$pid' and qid='{$Q['qid']}' "
-                    . "ORDER BY $order";
+                    . "ORDER BY $answerorder";
                 $answers = DB_query ($answer_sql);
                 $nanswers = DB_numRows($answers);
 
@@ -918,7 +918,7 @@
                     $P['perm_anon']) == 3 ? true : false);
                 require_once $_CONF['path_system'] . 'lib-comment.php';
                 $retval .= CMT_userComments($pid, $P['topic'], 'polls',
-                                            $order, $mode, 0, 1, false,
+                                            $order, $mode, 0, $page, false,
                                             $delete_option, $P['commentcode']);
             }
         }
@@ -1463,7 +1463,7 @@
             if ($autotag['tag'] == 'poll_vote') {
                 $retval = POLLS_showPoll(0, $pid, $showall, 2);
             } else {
-                $retval = POLLS_pollResults($pid, 0,'', '', 2);
+                $retval = POLLS_pollResults($pid, 0,'', '', 1, 2);
             }
             $retval = '<div class="' . $css_class . '">' . $retval . '</div>';
             break;
diff -r 3fffe09ae6cd -r 008d5dbf7a36 public_html/polls/index.php
--- a/public_html/polls/index.php	Tue Feb 16 11:22:08 2010 -0500
+++ b/public_html/polls/index.php	Tue Feb 16 11:22:55 2010 -0500
@@ -132,6 +132,10 @@
 if (isset ($_REQUEST['mode'])) {
     $mode = COM_applyFilter ($_REQUEST['mode']);
 }
+$page = 1;
+if (isset ($_REQUEST['cpage'])) {
+    $page = COM_applyFilter ($_REQUEST['cpage']);
+}
 $msg = 0;
 if (isset($_REQUEST['msg'])) {
     $msg = COM_applyFilter($_REQUEST['msg'], true);
@@ -190,9 +194,9 @@
             && !POLLS_ipAlreadyVoted ($pid)
             && $aid != -1
             ) {
-            $display .= POLLS_pollVote($pid, true, 0, $order, $mode);
+            $display .= POLLS_pollVote($pid, true, 0, $order, $mode, $page);
         } else {
-            $display .= POLLS_pollResults($pid, 400, $order, $mode);
+            $display .= POLLS_pollResults($pid, 400, $order, $mode, $page);
         }
     }
 } else {



More information about the geeklog-cvs mailing list