• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

PukiWiki


Commit MetaInfo

Revisióncc0bb66accdbd45240302587763ff4677e214364 (tree)
Tiempo2016-02-07 20:40:07
Autorumorigu <umorigu@gmai...>
Commiterumorigu

Log Message

BugTrack2/381 Handle failure to add comment - comment plugin

Cambiar Resumen

Diferencia incremental

--- a/en.lng.php
+++ b/en.lng.php
@@ -224,6 +224,8 @@ $_msg_comment = 'Comment: ';
224224 $_title_comment_collided = 'On updating $1, a collision has occurred.';
225225 $_msg_comment_collided = 'It seems that someone has already updated the page you were editing.<br />
226226 The comment was added, alhough it may be inserted in the wrong position.<br />';
227+$_comment_plugin_fail_msg = 'It seems that someone has already updated the page you were editing.<br />
228+ Failed to add the comment.<br />';
227229
228230 ///////////////////////////////////////
229231 // deleted.inc.php
--- a/ja.lng.php
+++ b/ja.lng.php
@@ -226,6 +226,8 @@ $_msg_comment = 'コメント: ';
226226 $_title_comment_collided = '$1 で【更新の衝突】が起きました';
227227 $_msg_comment_collided = 'あなたがこのページを編集している間に、他の人が同じページを更新してしまったようです。<br />
228228 コメントを追加しましたが、違う位置に挿入されているかもしれません。<br />';
229+$_comment_plugin_fail_msg = 'あなたがこのページを編集している間に、他の人が同じページを更新してしまったようです。<br />
230+コメントの追加に失敗しました。<br />';
229231
230232 ///////////////////////////////////////
231233 // deleted.inc.php
--- a/plugin/comment.inc.php
+++ b/plugin/comment.inc.php
@@ -1,8 +1,8 @@
11 <?php
22 // PukiWiki - Yet another WikiWikiWeb clone
3-// $Id: comment.inc.php,v 1.41 2011/01/25 15:01:01 henoheno Exp $
4-// Copyright (C)
5-// 2002-2005 PukiWiki Developers Team
3+// comment.inc.php
4+// Copyright
5+// 2002-2016 PukiWiki Development Team
66 // 2001-2002 Originally written by yu-ji
77 // License: GPL v2 or (at your option) any later version
88 //
@@ -22,6 +22,7 @@ function plugin_comment_action()
2222 {
2323 global $script, $vars, $now, $_title_updated, $_no_name;
2424 global $_msg_comment_collided, $_title_comment_collided;
25+ global $_comment_plugin_fail_msg;
2526
2627 if (PKWK_READONLY) die_message('PKWK_READONLY prohibits editing');
2728
@@ -51,9 +52,11 @@ function plugin_comment_action()
5152 $postdata = '';
5253 $comment_no = 0;
5354 $above = (isset($vars['above']) && $vars['above'] == '1');
55+ $comment_added = FALSE;
5456 foreach (get_source($vars['refer']) as $line) {
5557 if (! $above) $postdata .= $line;
5658 if (preg_match('/^#comment/i', $line) && $comment_no++ == $vars['comment_no']) {
59+ $comment_added = TRUE;
5760 if ($above) {
5861 $postdata = rtrim($postdata) . "\n" .
5962 $comment . "\n" .
@@ -65,21 +68,23 @@ function plugin_comment_action()
6568 }
6669 if ($above) $postdata .= $line;
6770 }
68-
6971 $title = $_title_updated;
7072 $body = '';
71- if (md5(get_source($vars['refer'], TRUE, TRUE)) !== $vars['digest']) {
73+ if ($comment_added) {
74+ // new comment added
75+ if (md5(get_source($vars['refer'], TRUE, TRUE)) !== $vars['digest']) {
76+ $title = $_title_comment_collided;
77+ $body = $_msg_comment_collided . make_pagelink($vars['refer']);
78+ }
79+ page_write($vars['refer'], $postdata);
80+ } else {
81+ // failed to add the comment
7282 $title = $_title_comment_collided;
73- $body = $_msg_comment_collided . make_pagelink($vars['refer']);
83+ $body = $_comment_plugin_fail_msg . make_pagelink($vars['refer']);
7484 }
75-
76- page_write($vars['refer'], $postdata);
77-
7885 $retvars['msg'] = $title;
7986 $retvars['body'] = $body;
80-
8187 $vars['page'] = $vars['refer'];
82-
8388 return $retvars;
8489 }
8590
@@ -130,4 +135,3 @@ EOD;
130135
131136 return $string;
132137 }
133-?>