[geeklog-cvs] geeklog: Changes to have the comment form on the same page as th...
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Sun Jan 22 03:28:00 EST 2012
changeset 8481:8ce120e08017
url: http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/8ce120e08017
user: Dirk Haun <dirk at haun-online.de>
date: Sun Jan 22 09:26:05 2012 +0100
description:
Changes to have the comment form on the same page as the story (patch #0000728, provided by dengen)
Committed on a separate branch since there are some issues left to resolve.
diffstat:
language/english.php | 5 +-
language/english_utf-8.php | 5 +-
language/japanese_utf-8.php | 5 +-
public_html/admin/configuration_validation.php | 2 +
public_html/admin/install/config-install.php | 2 +
public_html/article.php | 14 +-
public_html/comment.php | 486 +----
public_html/docs/english/config.html | 8 +
public_html/docs/japanese/config.html | 8 +
public_html/layout/professional/comment/commentbar.thtml | 12 +-
public_html/layout/professional/comment/commentform.thtml | 21 +-
public_html/layout/professional/comment/commentform_advanced.thtml | 21 +-
public_html/layout/professional/comment/startcomment.thtml | 5 +-
public_html/layout/professional/comment/thread.thtml | 2 +-
public_html/layout/professional/style.css | 25 +
public_html/layout/professional_css/comment/commentbar.thtml | 12 +-
public_html/layout/professional_css/comment/commentform.thtml | 17 +-
public_html/layout/professional_css/comment/commentform_advanced.thtml | 15 +-
public_html/layout/professional_css/comment/startcomment.thtml | 11 +-
public_html/layout/professional_css/css/comment/comment.css | 94 +-
system/lib-comment.php | 989 ++++++++-
system/lib-story.php | 21 +-
22 files changed, 1092 insertions(+), 688 deletions(-)
diffs (truncated from 2611 to 300 lines):
diff -r 9d479db12ac9 -r 8ce120e08017 language/english.php
--- a/language/english.php Fri Jan 20 10:52:03 2012 -0500
+++ b/language/english.php Sun Jan 22 09:26:05 2012 +0100
@@ -230,7 +230,8 @@
41 => 'Hello %s,',
42 => 'Unsubscribe',
43 => 'Unsubscribe from reply notifications',
- 44 => 'Your Name'
+ 44 => 'Your Name',
+ 45 => "Thank you for your comment. You must wait {$_CONF['commentspeedlimit']} seconds to post a new comment."
);
###############################################################################
@@ -1990,6 +1991,8 @@
'article_comment_close_days' => 'Days to close comments (default)',
'comment_close_rec_stories' => 'Number of most recent stories enabled for comments',
'allow_reply_notifications' => 'Allow comment reply notifications?',
+ 'comment_on_same_page' => 'Comment on Same Page?',
+ 'show_comments_at_replying' => 'Show Comments at Replying?',
'search_style' => "Results List Style",
'search_limits' => "Page Limits",
'search_show_num' => "Show Result Number?",
diff -r 9d479db12ac9 -r 8ce120e08017 language/english_utf-8.php
--- a/language/english_utf-8.php Fri Jan 20 10:52:03 2012 -0500
+++ b/language/english_utf-8.php Sun Jan 22 09:26:05 2012 +0100
@@ -230,7 +230,8 @@
41 => 'Hello %s,',
42 => 'Unsubscribe',
43 => 'Unsubscribe from reply notifications',
- 44 => 'Your Name'
+ 44 => 'Your Name',
+ 45 => "Thank you for your comment. You must wait {$_CONF['commentspeedlimit']} seconds to post a new comment."
);
###############################################################################
@@ -1990,6 +1991,8 @@
'article_comment_close_days' => 'Days to close comments (default)',
'comment_close_rec_stories' => 'Number of most recent stories enabled for comments',
'allow_reply_notifications' => 'Allow comment reply notifications?',
+ 'comment_on_same_page' => 'Comment on Same Page?',
+ 'show_comments_at_replying' => 'Show Comments at Replying?',
'search_style' => "Results List Style",
'search_limits' => "Page Limits",
'search_show_num' => "Show Result Number?",
diff -r 9d479db12ac9 -r 8ce120e08017 language/japanese_utf-8.php
--- a/language/japanese_utf-8.php Fri Jan 20 10:52:03 2012 -0500
+++ b/language/japanese_utf-8.php Sun Jan 22 09:26:05 2012 +0100
@@ -238,7 +238,8 @@
41 => 'ããã«ã¡ã¯ %s,',
42 => 'éç¥è§£é¤',
43 => 'è¿ä¿¡ã®éç¥ã解é¤ãã',
- 44 => 'ããªãã®åå'
+ 44 => 'ããªãã®åå',
+ 45 => "ã³ã¡ã³ãããããã¨ããããã¾ãã æ°ããªã³ã¡ã³ãæ稿ã®ããã« {$_CONF['commentspeedlimit']} ç§ä»¥ä¸ãå¾
ã¡ãã ããã"
);
###############################################################################
@@ -1976,6 +1977,8 @@
'article_comment_close_days' => 'åæ¢ã¾ã§ã®æ¥æ°(ããã©ã«ã)',
'comment_close_rec_stories' => 'ã³ã¡ã³ãå¯è½ãªè¨äºã®æ大æ°',
'allow_reply_notifications' => 'è¿ä¿¡ã®ã¡ã¼ã«éç¥ã許å¯ãã',
+ 'comment_on_same_page' => 'ã³ã³ãã³ãã®ãã¼ã¸ä¸ã§ã³ã¡ã³ãæ稿',
+ 'show_comments_at_replying' => 'è¿ä¿¡æã«ã³ã¡ã³ããªã¹ãã表示',
'search_style' => 'æ¤ç´¢çµæ表示ã¹ã¿ã¤ã«',
'search_limits' => '表示件æ°ã®é¸æãªãã·ã§ã³',
'search_show_num' => 'æ¤ç´¢é ã®çªå·ã表示ãã',
diff -r 9d479db12ac9 -r 8ce120e08017 public_html/admin/configuration_validation.php
--- a/public_html/admin/configuration_validation.php Fri Jan 20 10:52:03 2012 -0500
+++ b/public_html/admin/configuration_validation.php Sun Jan 22 09:26:05 2012 +0100
@@ -335,6 +335,8 @@
$_CONF_VALIDATE['Core']['article_comment_close_days'] = array('rule' => 'numeric');
$_CONF_VALIDATE['Core']['comment_close_rec_stories'] = array('rule' => 'numeric');
$_CONF_VALIDATE['Core']['allow_reply_notifications'] = array('rule' => 'boolean');
+$_CONF_VALIDATE['Core']['comment_on_same_page'] = array('rule' => 'boolean');
+$_CONF_VALIDATE['Core']['show_comments_at_replying'] = array('rule' => 'boolean');
/* Subgroup Images, Tab Image Library */
$_CONF_VALIDATE['Core']['image_lib'] = array(
diff -r 9d479db12ac9 -r 8ce120e08017 public_html/admin/install/config-install.php
--- a/public_html/admin/install/config-install.php Fri Jan 20 10:52:03 2012 -0500
+++ b/public_html/admin/install/config-install.php Sun Jan 22 09:26:05 2012 +0100
@@ -273,6 +273,8 @@
$c->add('article_comment_close_days',30,'text',4,21,NULL,1686,TRUE, $me, 21);
$c->add('comment_close_rec_stories',0,'text',4,21,NULL,1688,TRUE, $me, 21);
$c->add('allow_reply_notifications',0,'select',4,21,0, 1689, TRUE, $me, 21);
+ $c->add('comment_on_same_page',0,'select',4,21,0, 1690, TRUE, $me, 21);
+ $c->add('show_comments_at_replying',0,'select',4,21,0, 1691, TRUE, $me, 21);
// Subgroup: Images
$c->add('sg_images', NULL, 'subgroup', 5, 0, NULL, 0, TRUE, $me, 0);
diff -r 9d479db12ac9 -r 8ce120e08017 public_html/article.php
--- a/public_html/article.php Fri Jan 20 10:52:03 2012 -0500
+++ b/public_html/article.php Sun Jan 22 09:26:05 2012 +0100
@@ -65,9 +65,14 @@
$query = '';
$reply = '';
$page = 0;
+$mode = '';
if (isset ($_POST['mode'])) {
+ $mode = COM_applyFilter ($_POST['mode']);
+} else if (isset ($_POST['format'])) {
+ $mode = COM_applyFilter ($_POST['format']);
+}
+if (!empty($mode)) {
$sid = COM_applyFilter ($_POST['story']);
- $mode = COM_applyFilter ($_POST['mode']);
if (isset ($_POST['order'])) {
$order = COM_applyFilter ($_POST['order']);
}
@@ -98,6 +103,12 @@
}
}
+if (!empty ($_REQUEST['sid'])) {
+ $sid = COM_applyFilter ($_REQUEST['sid']);
+}
+if (empty ($sid) && !empty ($_POST['cmt_sid'])) {
+ $sid = COM_applyFilter ($_POST['cmt_sid']);
+}
if (empty ($sid)) {
echo COM_refresh ($_CONF['site_url'] . '/index.php');
exit();
@@ -406,7 +417,6 @@
if (($story->displayElements('commentcode') >= 0) and $show_comments) {
$delete_option = (SEC_hasRights('story.edit') && ($story->getAccess() == 3)
? true : false);
- require_once ( $_CONF['path_system'] . 'lib-comment.php' );
$story_template->set_var ('commentbar',
CMT_userComments ($story->getSid(), $story->displayElements('title'), 'article',
$order, $mode, 0, $page, false, $delete_option, $story->displayElements('commentcode')));
diff -r 9d479db12ac9 -r 8ce120e08017 public_html/comment.php
--- a/public_html/comment.php Fri Jan 20 10:52:03 2012 -0500
+++ b/public_html/comment.php Sun Jan 22 09:26:05 2012 +0100
@@ -60,319 +60,6 @@
// the data being passed in a POST operation
// echo COM_debug($_POST);
-
-/**
- * Handles a comment submission
- *
- * @copyright Vincent Furia 2005
- * @author Vincent Furia, vinny01 AT users DOT sourceforge DOT net
- * @return string HTML (possibly a refresh)
- */
-function handleCancel()
-{
- global $_CONF;
-
- $display = '';
-
- $type = COM_applyFilter ($_POST['type']);
- $sid = COM_applyFilter ($_POST['sid']);
- switch ( $type ) {
- case 'article':
- $display = COM_refresh (COM_buildUrl ($_CONF['site_url']
- . "/article.php?story=$sid"));
-
- break;
- default: // assume plugin
- // Need a way to go back to initial page for plugins.
- $url = PLG_getItemInfo($type, $sid, 'url');
- if ($url == '') { // Then plugin doesn't support PLG_getItemInfo
- $url = $_CONF['site_url'] . '/index.php';
- }
- $display = COM_refresh ($url);
-
- break;
- }
-
- return $display;
-}
-
-/**
- * Handles a comment submission
- *
- * @copyright Vincent Furia 2005
- * @author Vincent Furia, vinny01 AT users DOT sourceforge DOT net
- * @return string HTML (possibly a refresh)
- */
-function handleSubmit()
-{
- global $_CONF, $_TABLES, $LANG03;
-
- $display = '';
-
- $type = COM_applyFilter($_POST['type']);
- $sid = COM_applyFilter($_POST['sid']);
- $pid = COM_applyFilter($_POST['pid'], true);
- $postmode = COM_applyFilter($_POST['postmode']);
- $title = strip_tags(COM_stripslashes($_POST['title']));
-
- if ($type == 'article') {
- $commentcode = DB_getItem($_TABLES['stories'], 'commentcode',
- "(sid = '$sid') AND (draft_flag = 0) AND (date <= NOW())"
- . COM_getPermSQL('AND'));
- if (!isset($commentcode) || ($commentcode != 0 || TOPIC_hasMultiTopicAccess('article', $sid) < 2)) { // Need read access of topics to post comment
- return COM_refresh($_CONF['site_url'] . '/index.php');
- }
-
- $ret = CMT_saveComment($title, $_POST['comment'], $sid, $pid,
- 'article', $postmode);
- if ($ret == -1) {
- $url = COM_buildUrl($_CONF['site_url'] . '/article.php?story='
- . $sid);
- $url .= (strpos($url, '?') ? '&' : '?') . 'msg=15';
- $display = COM_refresh($url);
- } elseif ($ret > 0) { // failure
- // FIXME: some failures should not return to comment form
- $display .= COM_siteHeader('menu', $LANG03[1])
- . CMT_commentForm($title, $_POST['comment'], $sid, $pid,
- $type, $LANG03[14], $postmode)
- . COM_siteFooter();
- } else { // success
- $comments = DB_count($_TABLES['comments'], array('type', 'sid'), array('article', $sid));
- DB_change($_TABLES['stories'], 'comments', $comments, 'sid', $sid);
- COM_olderStuff(); // update comment count in Older Stories block
- $display = COM_refresh(COM_buildUrl($_CONF['site_url']
- . "/article.php?story=$sid"));
- }
-
- } else { // assume plugin
-
- if (!($display = PLG_commentSave($type, $title, $_POST['comment'],
- $sid, $pid, $postmode))) {
- $display = COM_refresh($_CONF['site_url'] . '/index.php');
- }
-
- }
-
- return $display;
-}
-
-/**
- * Handles a comment delete
- *
- * @copyright Vincent Furia 2005
- * @author Vincent Furia, vinny01 AT users DOT sourceforge DOT net
- * @return string HTML (possibly a refresh)
- */
-function handleDelete($formtype)
-{
- global $_CONF, $_TABLES;
-
- $display = '';
-
- if ($formtype == 'editsubmission') {
- DB_delete($_TABLES['commentsubmissions'], 'cid', COM_applyFilter($_REQUEST['cid'], true));
-
- $display = COM_refresh ( $_CONF['site_admin_url'] . '/moderation.php');
- } else {
- $type = COM_applyFilter($_REQUEST['type']);
- $sid = COM_applyFilter($_REQUEST['sid']);
-
- switch ($type) {
- case 'article':
- $has_editPermissions = SEC_hasRights('story.edit');
- $result = DB_query("SELECT owner_id,group_id,perm_owner,perm_group,perm_members,perm_anon FROM {$_TABLES['stories']} WHERE sid = '$sid'");
- $A = DB_fetchArray($result);
-
- if ($has_editPermissions && SEC_hasAccess($A['owner_id'],
- $A['group_id'], $A['perm_owner'], $A['perm_group'],
- $A['perm_members'], $A['perm_anon']) == 3) {
- CMT_deleteComment(COM_applyFilter($_REQUEST['cid'], true), $sid,
- 'article');
- $comments = DB_count($_TABLES['comments'], 'sid', $sid);
- DB_change($_TABLES['stories'], 'comments', $comments,
- 'sid', $sid);
- $display .= COM_refresh(COM_buildUrl ($_CONF['site_url']
- . "/article.php?story=$sid") . '#comments');
- } else {
- COM_errorLog("User {$_USER['username']} (IP: {$_SERVER['REMOTE_ADDR']}) tried to illegally delete comment $cid from $type $sid");
- $display .= COM_refresh($_CONF['site_url'] . '/index.php');
- }
- break;
-
- default: // assume plugin
- if (!($display = PLG_commentDelete($type,
- COM_applyFilter($_REQUEST['cid'], true), $sid))) {
- $display = COM_refresh($_CONF['site_url'] . '/index.php');
- }
- break;
- }
- }
-
- return $display;
-}
-
-/**
- * Handles a comment view request
- *
- * @copyright Vincent Furia 2005
- * @author Vincent Furia, vinny01 AT users DOT sourceforge DOT net
- * @param boolean $view View or display (true for view)
- * @return string HTML (possibly a refresh)
- */
-function handleView($view = true)
-{
- global $_CONF, $_TABLES, $_USER, $LANG_ACCESS;
-
More information about the geeklog-cvs
mailing list