[geeklog-hg] geeklog: Added default comment sort order to Configuration. Remo...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Thu Apr 4 15:31:12 EDT 2013


changeset 9036:bbd7490f096b
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/bbd7490f096b
user: Tom <websitemaster at cogeco.net>
date: Thu Apr 04 15:30:49 2013 -0400
description:
Added default comment sort order to Configuration. Removed unused Anonymous comment user settings from database (feature request #0001470)

diffstat:

 language/english.php                           |   4 +++-
 language/english_utf-8.php                     |   4 +++-
 public_html/admin/configuration_validation.php |   3 +++
 public_html/admin/install/config-install.php   |   1 +
 public_html/admin/install/lib-upgrade.php      |  10 ++++++++++
 public_html/docs/english/config.html           |   4 ++++
 public_html/docs/japanese/config.html          |   4 ++++
 sql/mssql_tableanddata.php                     |   1 -
 sql/mysql_tableanddata.php                     |   1 -
 sql/pgsql_tableanddata.php                     |   1 -
 sql/updates/mssql_2.0.0_to_2.0.1.php           |  26 ++++++++++++++++++++++++++
 sql/updates/mysql_2.0.0_to_2.0.1.php           |  26 ++++++++++++++++++++++++++
 sql/updates/pgsql_2.0.0_to_2.0.1.php           |  26 ++++++++++++++++++++++++++
 system/lib-comment.php                         |   2 +-
 system/lib-user.php                            |   2 +-
 15 files changed, 108 insertions(+), 7 deletions(-)

diffs (261 lines):

diff -r 2bc8e6300729 -r bbd7490f096b language/english.php
--- a/language/english.php	Thu Apr 04 21:56:26 2013 +0900
+++ b/language/english.php	Thu Apr 04 15:30:49 2013 -0400
@@ -1974,6 +1974,7 @@
     'commentspeedlimit' => "Comment Speed Limit",
     'comment_limit' => "Comment Limit",
     'comment_mode' => "Comment Mode",
+    'comment_order' => "Comment Order",
     'comment_code' => "Comment Default",
     'comment_edit' => "Allow Comment Edit?",
     'comment_edittime' => "Comment Edit Time (seconds)",
@@ -2173,7 +2174,8 @@
     27 => array('Hits (asc)' => 'hits|asc', 'Hits (desc)' => 'hits|desc', 'Date (asc)' => 'date|asc', 'Date (desc)' => 'date|desc', 'Title (asc)' => 'title|asc', 'Title (desc)' => 'title|desc', 'Author (asc)' => 'uid|asc', 'Author (desc)' => 'uid|desc'), 
     28 => array('No access' => 0, 'Use' => 2),
     29 => array('md5' => 0, 'sha1' => 1, 'sha256' => 2, 'sha512' => 3, 'blowfish' => 4),
-    30 => array('Start' => 'start', 'End' => 'end', 'None' => 'none')
+    30 => array('Start' => 'start', 'End' => 'end', 'None' => 'none'), 
+    31 => array('Newest First' => 'DESC', 'Oldest First' => 'ASC')
 );
 
 ################################################################################
diff -r 2bc8e6300729 -r bbd7490f096b language/english_utf-8.php
--- a/language/english_utf-8.php	Thu Apr 04 21:56:26 2013 +0900
+++ b/language/english_utf-8.php	Thu Apr 04 15:30:49 2013 -0400
@@ -1974,6 +1974,7 @@
     'commentspeedlimit' => "Comment Speed Limit",
     'comment_limit' => "Comment Limit",
     'comment_mode' => "Comment Mode",
+    'comment_order' => "Comment Order",
     'comment_code' => "Comment Default",
     'comment_edit' => "Allow Comment Edit?",
     'comment_edittime' => "Comment Edit Time (seconds)",
@@ -2173,7 +2174,8 @@
     27 => array('Hits (asc)' => 'hits|asc', 'Hits (desc)' => 'hits|desc', 'Date (asc)' => 'date|asc', 'Date (desc)' => 'date|desc', 'Title (asc)' => 'title|asc', 'Title (desc)' => 'title|desc', 'Author (asc)' => 'uid|asc', 'Author (desc)' => 'uid|desc'), 
     28 => array('No access' => 0, 'Use' => 2),
     29 => array('md5' => 0, 'sha1' => 1, 'sha256' => 2, 'sha512' => 3, 'blowfish' => 4),
-    30 => array('Start' => 'start', 'End' => 'end', 'None' => 'none')    
+    30 => array('Start' => 'start', 'End' => 'end', 'None' => 'none'), 
+    31 => array('Newest First' => 'DESC', 'Oldest First' => 'ASC')
 );
 
 ################################################################################
diff -r 2bc8e6300729 -r bbd7490f096b public_html/admin/configuration_validation.php
--- a/public_html/admin/configuration_validation.php	Thu Apr 04 21:56:26 2013 +0900
+++ b/public_html/admin/configuration_validation.php	Thu Apr 04 15:30:49 2013 -0400
@@ -345,6 +345,9 @@
 $_CONF_VALIDATE['Core']['comment_mode'] = array(
     'rule' => array('inList', array('flat', 'nested', 'nocomment', 'threaded'), true)
 );
+$_CONF_VALIDATE['Core']['comment_order'] = array(
+    'rule' => array('inList', array('DESC', 'ASC'), true)
+);
 $_CONF_VALIDATE['Core']['comment_code'] = array(
     'rule' => array('inList', array(0, -1), false)
 );
diff -r 2bc8e6300729 -r bbd7490f096b public_html/admin/install/config-install.php
--- a/public_html/admin/install/config-install.php	Thu Apr 04 21:56:26 2013 +0900
+++ b/public_html/admin/install/config-install.php	Thu Apr 04 15:30:49 2013 -0400
@@ -277,6 +277,7 @@
     $c->add('commentspeedlimit',45,'text',4,21,NULL,1640,TRUE, $me, 21);
     $c->add('comment_limit',100,'text',4,21,NULL,1650,TRUE, $me, 21);
     $c->add('comment_mode','nested','select',4,21,11,1660,TRUE, $me, 21);
+    $c->add('comment_order','ASC','select',4,21,31,1665,TRUE, $me, 21);
     $c->add('comment_code',0,'select',4,21,17,1670,TRUE, $me, 21);
     $c->add('comment_edit',0,'select',4,21,0,1680,TRUE, $me, 21);
     $c->add('commentsubmission',0,'select',4,21,0, 1682, TRUE, $me, 21);
diff -r 2bc8e6300729 -r bbd7490f096b public_html/admin/install/lib-upgrade.php
--- a/public_html/admin/install/lib-upgrade.php	Thu Apr 04 21:56:26 2013 +0900
+++ b/public_html/admin/install/lib-upgrade.php	Thu Apr 04 15:30:49 2013 -0400
@@ -495,6 +495,16 @@
             $current_gl_version = '2.0.0';
             $_SQL = '';
             break;
+
+        case '2.0.0':
+            require_once $_CONF['path'] . 'sql/updates/' . $_DB_dbms . '_2.0.0_to_2.0.1.php';
+            INST_updateDB($_SQL);
+
+            update_ConfValuesFor201();
+
+            $current_gl_version = '2.0.1';
+            $_SQL = '';
+            break;
             
         default:
             $done = true;
diff -r 2bc8e6300729 -r bbd7490f096b public_html/docs/english/config.html
--- a/public_html/docs/english/config.html	Thu Apr 04 21:56:26 2013 +0900
+++ b/public_html/docs/english/config.html	Thu Apr 04 15:30:49 2013 -0400
@@ -1050,6 +1050,10 @@
   <td valign="top">nested</td>
   <td valign="top">How to display comments (threaded, nested, flat or nocomments)</td></tr>
 <tr>
+  <td valign="top"><a name="desc_comment_order">comment_order</a></td>
+  <td valign="top">ASC</td>
+  <td valign="top">Date sort order to display comments at the top level (ASC = Oldest First, DESC = Newest First)</td></tr>
+<tr>
   <td valign="top"><a name="desc_comment_code">comment_code</a></td>
   <td valign="top">0</td>
   <td valign="top">Default value for new stories: Comments enabled (0) or disabled (-1)</td></tr>
diff -r 2bc8e6300729 -r bbd7490f096b public_html/docs/japanese/config.html
--- a/public_html/docs/japanese/config.html	Thu Apr 04 21:56:26 2013 +0900
+++ b/public_html/docs/japanese/config.html	Thu Apr 04 15:30:49 2013 -0400
@@ -909,6 +909,10 @@
   <td valign="top">å
¥ã‚Œå­(nested)</td>
   <td valign="top">コメントの表示方法として、一覧(flat)、å
¥ã‚Œå­(nested)、ツリー(threaded)、表示しない(nocomments)のうちのどれかを指定します。</td></tr>
 <tr>
+  <td valign="top"><a name="desc_comment_order">comment_order</a></td>
+  <td valign="top">ASC</td>
+  <td valign="top">Date sort order to display comments at the top level (ASC = Oldest First, DESC = Newest First)</td></tr>
+<tr>
   <td valign="top"><a name="desc_comment_code">新規作成時のデフォルト(comment_code)</a></td>
   <td valign="top">はい(0)</td>
   <td valign="top">新規記事に対するデフォルトを指定します。はい(0)なら許可し、いいえ(-1)なら許可しません。</td></tr>
diff -r 2bc8e6300729 -r bbd7490f096b sql/mssql_tableanddata.php
--- a/sql/mssql_tableanddata.php	Thu Apr 04 21:56:26 2013 +0900
+++ b/sql/mssql_tableanddata.php	Thu Apr 04 15:30:49 2013 -0400
@@ -1533,7 +1533,6 @@
 $_SQL[] = "INSERT INTO {$_TABLES['topics']} (tid, topic, imageurl, meta_description, meta_keywords, sortnum, limitnews, group_id, owner_id, perm_owner, perm_group, perm_members, perm_anon) VALUES ('General','General News','/images/topics/topic_news.png','A topic that contains general news related posts.','News, Post, Information',1,10,6,2,3,2,2,2)";
 $_SQL[] = "INSERT INTO {$_TABLES['topics']} (tid, topic, imageurl, meta_description, meta_keywords, sortnum, limitnews, group_id, owner_id, perm_owner, perm_group, perm_members, perm_anon) VALUES ('Geeklog','Geeklog','/images/topics/topic_gl.png','A topic that contains posts about Geeklog.','Geeklog, Posts, Information',2,10,6,2,3,2,2,2)";
 
-$_SQL[] = "INSERT INTO {$_TABLES['usercomment']} (uid, commentmode, commentorder, commentlimit) VALUES (1,'nested','ASC',100)";
 $_SQL[] = "INSERT INTO {$_TABLES['usercomment']} (uid, commentmode, commentorder, commentlimit) VALUES (2,'nested','ASC',100)";
 
 $_SQL[] = "INSERT INTO {$_TABLES['userindex']} (uid, tids, etids, aids, boxes, noboxes, maxstories) VALUES (1,'','-','','',0,NULL)";
diff -r 2bc8e6300729 -r bbd7490f096b sql/mysql_tableanddata.php
--- a/sql/mysql_tableanddata.php	Thu Apr 04 21:56:26 2013 +0900
+++ b/sql/mysql_tableanddata.php	Thu Apr 04 15:30:49 2013 -0400
@@ -808,7 +808,6 @@
 $_DATA[] = "INSERT INTO {$_TABLES['topics']} (tid, topic, imageurl, meta_description, meta_keywords, sortnum, limitnews, group_id, owner_id, perm_owner, perm_group, perm_members, perm_anon) VALUES ('General','General News','/images/topics/topic_news.png','A topic that contains general news related posts.','News, Post, Information',1,10,6,2,3,2,2,2)";
 $_DATA[] = "INSERT INTO {$_TABLES['topics']} (tid, topic, imageurl, meta_description, meta_keywords, sortnum, limitnews, group_id, owner_id, perm_owner, perm_group, perm_members, perm_anon) VALUES ('Geeklog','Geeklog','/images/topics/topic_gl.png','A topic that contains posts about Geeklog.','Geeklog, Posts, Information',2,10,6,2,3,2,2,2)";
 
-$_DATA[] = "INSERT INTO {$_TABLES['usercomment']} (uid, commentmode, commentorder, commentlimit) VALUES (1,'nested','ASC',100) ";
 $_DATA[] = "INSERT INTO {$_TABLES['usercomment']} (uid, commentmode, commentorder, commentlimit) VALUES (2,'nested','ASC',100) ";
 
 $_DATA[] = "INSERT INTO {$_TABLES['userindex']} (uid, tids, etids, aids, boxes, noboxes, maxstories) VALUES (1,'','-','','',0,NULL) ";
diff -r 2bc8e6300729 -r bbd7490f096b sql/pgsql_tableanddata.php
--- a/sql/pgsql_tableanddata.php	Thu Apr 04 21:56:26 2013 +0900
+++ b/sql/pgsql_tableanddata.php	Thu Apr 04 15:30:49 2013 -0400
@@ -826,7 +826,6 @@
 $_DATA[] = "INSERT INTO {$_TABLES['topics']} (tid, topic, imageurl, meta_description, meta_keywords, sortnum, limitnews, group_id, owner_id, perm_owner, perm_group, perm_members, perm_anon) VALUES ('General','General News','/images/topics/topic_news.png','A topic that contains general news related posts.','News, Post, Information',1,10,6,2,3,2,2,2)";
 $_DATA[] = "INSERT INTO {$_TABLES['topics']} (tid, topic, imageurl, meta_description, meta_keywords, sortnum, limitnews, group_id, owner_id, perm_owner, perm_group, perm_members, perm_anon) VALUES ('Geeklog','Geeklog','/images/topics/topic_gl.png','A topic that contains posts about Geeklog.','Geeklog, Posts, Information',2,10,6,2,3,2,2,2)";
 
-$_DATA[] = "INSERT INTO {$_TABLES['usercomment']} (uid, commentmode, commentorder, commentlimit) VALUES (1,'nested','ASC',100) ";
 $_DATA[] = "INSERT INTO {$_TABLES['usercomment']} (uid, commentmode, commentorder, commentlimit) VALUES (2,'nested','ASC',100) ";
 
 $_DATA[] = "INSERT INTO {$_TABLES['userindex']} (uid, tids, etids, aids, boxes, noboxes, maxstories) VALUES (1,'','-','0','0',0,0) ";
diff -r 2bc8e6300729 -r bbd7490f096b sql/updates/mssql_2.0.0_to_2.0.1.php
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sql/updates/mssql_2.0.0_to_2.0.1.php	Thu Apr 04 15:30:49 2013 -0400
@@ -0,0 +1,26 @@
+<?php
+
+// Delete anonymous user comment settings since all 3 are now config options
+$_SQL[] = "DELETE FROM {$_TABLES['usercomment']} WHERE uid = 1";
+
+/**
+ * Add new config options
+ *
+ */
+function update_ConfValuesFor201()
+{
+    global $_CONF, $_TABLES;
+
+    require_once $_CONF['path_system'] . 'classes/config.class.php';
+
+    $c = config::get_instance();
+
+    $me = 'Core';
+    
+    // Default Comment Order
+    $c->add('comment_order','ASC','select',4,21,31,1665,TRUE, $me, 21);
+
+    return true;
+}
+
+?>
diff -r 2bc8e6300729 -r bbd7490f096b sql/updates/mysql_2.0.0_to_2.0.1.php
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sql/updates/mysql_2.0.0_to_2.0.1.php	Thu Apr 04 15:30:49 2013 -0400
@@ -0,0 +1,26 @@
+<?php
+
+// Delete anonymous user comment settings since all 3 are now config options
+$_SQL[] = "DELETE FROM {$_TABLES['usercomment']} WHERE uid = 1";
+
+/**
+ * Add new config options
+ *
+ */
+function update_ConfValuesFor201()
+{
+    global $_CONF, $_TABLES;
+
+    require_once $_CONF['path_system'] . 'classes/config.class.php';
+
+    $c = config::get_instance();
+
+    $me = 'Core';
+    
+    // Default Comment Order
+    $c->add('comment_order','ASC','select',4,21,31,1665,TRUE, $me, 21);
+
+    return true;
+}
+
+?>
diff -r 2bc8e6300729 -r bbd7490f096b sql/updates/pgsql_2.0.0_to_2.0.1.php
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sql/updates/pgsql_2.0.0_to_2.0.1.php	Thu Apr 04 15:30:49 2013 -0400
@@ -0,0 +1,26 @@
+<?php
+
+// Delete anonymous user comment settings since all 3 are now config options
+$_SQL[] = "DELETE FROM {$_TABLES['usercomment']} WHERE uid = 1";
+
+/**
+ * Add new config options
+ *
+ */
+function update_ConfValuesFor201()
+{
+    global $_CONF, $_TABLES;
+
+    require_once $_CONF['path_system'] . 'classes/config.class.php';
+
+    $c = config::get_instance();
+
+    $me = 'Core';
+    
+    // Default Comment Order
+    $c->add('comment_order','ASC','select',4,21,31,1665,TRUE, $me, 21);
+
+    return true;
+}
+
+?>
diff -r 2bc8e6300729 -r bbd7490f096b system/lib-comment.php
--- a/system/lib-comment.php	Thu Apr 04 21:56:26 2013 +0900
+++ b/system/lib-comment.php	Thu Apr 04 15:30:49 2013 -0400
@@ -657,7 +657,7 @@
     }
 
     if( $order != 'ASC' && $order != 'DESC' ) {
-        $order = 'ASC';
+        $order = $_CONF['comment_order'];
     }
 
     if( empty( $mode )) {
diff -r 2bc8e6300729 -r bbd7490f096b system/lib-user.php
--- a/system/lib-user.php	Thu Apr 04 21:56:26 2013 +0900
+++ b/system/lib-user.php	Thu Apr 04 15:30:49 2013 -0400
@@ -317,7 +317,7 @@
         DB_query("INSERT INTO {$_TABLES['userindex']} (uid,etids) VALUES ($uid, '-')");
     }
 
-    DB_query("INSERT INTO {$_TABLES['usercomment']} (uid,commentmode,commentlimit) VALUES ($uid,'{$_CONF['comment_mode']}','{$_CONF['comment_limit']}')");
+    DB_query("INSERT INTO {$_TABLES['usercomment']} (uid,commentmode,commentorder,commentlimit) VALUES ($uid,'{$_CONF['comment_mode']}','{$_CONF['comment_order']}','{$_CONF['comment_limit']}')");
     DB_query("INSERT INTO {$_TABLES['userinfo']} (uid) VALUES ($uid)");
 
     // call custom registration function and plugins



More information about the geeklog-cvs mailing list