[geeklog-cvs] geeklog: We don't need the comment title in the URL to submit a ...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Sun Aug 28 11:08:52 EDT 2011


changeset 8359:6d2060ebebbb
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/6d2060ebebbb
user: Dirk Haun <dirk at haun-online.de>
date: Sat Jun 18 22:50:18 2011 +0200
description:
We don't need the comment title in the URL to submit a follow-up comment (feature request #0001031)

diffstat:

 public_html/comment.php |  19 +++++++++++++------
 system/lib-comment.php  |  29 ++++++++++++++---------------
 2 files changed, 27 insertions(+), 21 deletions(-)

diffs (121 lines):

diff -r 974698df2be7 -r 6d2060ebebbb public_html/comment.php
--- a/public_html/comment.php	Sat Jun 18 16:31:46 2011 +0200
+++ b/public_html/comment.php	Sat Jun 18 22:50:18 2011 +0200
@@ -2,13 +2,13 @@
 
 /* Reminder: always indent with 4 spaces (no tabs). */
 // +---------------------------------------------------------------------------+
-// | Geeklog 1.6                                                               |
+// | Geeklog 1.8                                                               |
 // +---------------------------------------------------------------------------+
 // | comment.php                                                               |
 // |                                                                           |
 // | Let user comment on a story or plugin.                                    |
 // +---------------------------------------------------------------------------+
-// | Copyright (C) 2000-2010 by the following authors:                         |
+// | Copyright (C) 2000-2011 by the following authors:                         |
 // |                                                                           |
 // | Authors: Tony Bibbs        - tony AT tonybibbs DOT com                    |
 // |          Mark Limburg      - mlimburg AT users DOT sourceforge DOT net    |
@@ -477,6 +477,7 @@
     }
     $display = COM_refresh($_CONF['site_url'] . '/index.php');
     break;
+
 case $LANG_ADMIN['cancel']:
     if ($formtype == 'editsubmission') {
         $display = COM_refresh ( $_CONF['site_admin_url'] . '/moderation.php');        
@@ -484,6 +485,7 @@
         $display .= handleCancel();  // moved to function for readibility
     }
     break;
+
 default:  // New Comment
     $abort = false;
     $sid = '';
@@ -515,6 +517,15 @@
     }
     if (!$abort) {
         if (!empty($sid) && !empty($type)) {
+            $pid = 0;
+            if (isset($_REQUEST['pid'])) {
+                $pid = COM_applyFilter($_REQUEST['pid'], true);
+            }
+            if (($pid > 0) && empty($title)) {
+                $atype = addslashes($type);
+                $title = DB_getItem($_TABLES['comments'], 'title',
+                                    "(cid = $pid) AND (type = '$atype')");
+            }
             if (empty($title)) {
                 if ($type == 'article') {
                     $title = $dbTitle;
@@ -530,10 +541,6 @@
             }
             $noindex = '<meta name="robots" content="noindex"' . XHTML . '>'
                      . LB;
-            $pid = 0;
-            if (isset($_REQUEST['pid'])) {
-                $pid = COM_applyFilter($_REQUEST['pid'], true);
-            }
             $display .= COM_siteHeader('menu', $LANG03[1], $noindex)
                      . CMT_commentForm($title, '', $sid, $pid, $type, $mode,
                                        $postmode)
diff -r 974698df2be7 -r 6d2060ebebbb system/lib-comment.php
--- a/system/lib-comment.php	Sat Jun 18 16:31:46 2011 +0200
+++ b/system/lib-comment.php	Sat Jun 18 22:50:18 2011 +0200
@@ -2,13 +2,13 @@
 
 /* Reminder: always indent with 4 spaces (no tabs). */
 // +---------------------------------------------------------------------------+
-// | Geeklog 1.6                                                               |
+// | Geeklog 1.8                                                               |
 // +---------------------------------------------------------------------------+
 // | lib-comment.php                                                           |
 // |                                                                           |
 // | Geeklog comment library.                                                  |
 // +---------------------------------------------------------------------------+
-// | Copyright (C) 2000-2010 by the following authors:                         |
+// | Copyright (C) 2000-2011 by the following authors:                         |
 // |                                                                           |
 // | Authors: Tony Bibbs        - tony AT tonybibbs DOT com                    |
 // |          Mark Limburg      - mlimburg AT users DOT sourceforge DOT net    |
@@ -377,18 +377,18 @@
 
         // for threaded mode, add a link to comment parent
         if( $mode == 'threaded' && $A['pid'] != 0 && $indent == 0 ) {
-            $result = DB_query( "SELECT title,pid FROM {$_TABLES['comments']} WHERE cid = '{$A['pid']}'" );
-            $P = DB_fetchArray( $result );
-            if( $P['pid'] != 0 ) {
-                $plink = $_CONF['site_url'] . '/comment.php?mode=display&sid='
-                       . $A['sid'] . '&title=' . urlencode( htmlspecialchars( $P['title'] ))
-                       . '&type=' . $type . '&order=' . $order . '&pid='
-                       . $P['pid'] . '&format=threaded';
+            $pid = DB_getItem($_TABLES['comments'], 'pid',
+                              "cid = '{$A['pid']}'");
+            if ($pid != 0) {
+                $plink = $_CONF['site_url'] . '/comment.php?mode=display'
+                       . '&sid=' . $A['sid'] . '&type=' . $type
+                       . '&order=' . $order . '&pid=' . $pid
+                       . '&format=threaded';
             } else {
-                $plink = $_CONF['site_url'] . '/comment.php?mode=view&sid='
-                       . $A['sid'] . '&title=' . urlencode( htmlspecialchars( $P['title'] ))
-                       . '&type=' . $type . '&order=' . $order . '&cid='
-                       . $A['pid'] . '&format=threaded';
+                $plink = $_CONF['site_url'] . '/comment.php?mode=view'
+                       . '&sid=' . $A['sid'] . '&type=' . $type
+                       . '&order=' . $order . '&cid=' . $A['pid']
+                       . '&format=threaded';
             }
             $parent_link = COM_createLink($LANG01[44], $plink) . ' | ';
             $template->set_var('parent_link', $parent_link);
@@ -514,8 +514,7 @@
         $reply_link = '';
         if ($ccode == 0) {
             $reply_link = $_CONF['site_url'] . '/comment.php?sid=' . $A['sid']
-                        . '&pid=' . $A['cid'] . '&title='
-                        . urlencode($A['title']) . '&type=' . $A['type'];
+                        . '&pid=' . $A['cid'] . '&type=' . $A['type'];
             $reply_option = COM_createLink($LANG01[43], $reply_link,
                                            array('rel' => 'nofollow')) . ' | ';
             $template->set_var('reply_option', $reply_option);



More information about the geeklog-cvs mailing list