OSDN Git Service

BugTrack2/23: corrected the comment position on the oldest message when 'below' is...
authorteanan <teanan>
Tue, 8 Mar 2005 17:58:38 +0000 (02:58 +0900)
committerteanan <teanan>
Tue, 8 Mar 2005 17:58:38 +0000 (02:58 +0900)
plugin/pcomment.inc.php

index edda17b..0282eec 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 // PukiWiki - Yet another WikiWikiWeb clone
-// $Id: pcomment.inc.php,v 1.39 2005/03/06 16:39:14 teanan Exp $
+// $Id: pcomment.inc.php,v 1.40 2005/03/08 17:58:38 teanan Exp $
 //
 // pcomment plugin - Insetring comment into specified (another) page
 
@@ -245,12 +245,14 @@ function pcmt_insert()
                $dir = isset($vars['dir']) ? $vars['dir'] : '';
 
                //¥ê¥×¥é¥¤Àè¤Î¥³¥á¥ó¥È¤ò¸¡º÷
+               $b_reply = FALSE;
                if ($reply_hash != '') {
                        while ($pos < count($postdata)) {
                                $matches = array();
                                if (preg_match('/^(\-{1,2})(?!\-)(.*)$/', $postdata[$pos++], $matches)
                                        && md5($matches[2]) == $reply_hash)
                                {
+                                       $b_reply = TRUE;
                                        $level = strlen($matches[1]) + 1; //ÁÞÆþ¤¹¤ë¥ì¥Ù¥ë
 
                                        // ¥³¥á¥ó¥È¤ÎËöÈø¤ò¸¡º÷
@@ -263,18 +265,10 @@ function pcmt_insert()
                                        break;
                                }
                        }
-               } else {
-                       $pos = ($dir == 0) ? $start_pos : count($postdata);
                }
 
-               if ($dir == '0') {
-                       if ($pos == count($postdata)) {
-                               $pos = $start_pos; //ÀèƬ
-                       }
-               } else {
-                       if ($pos == 0) {
-                               $pos = count($postdata); //ËöÈø
-                       }
+               if($b_reply==FALSE) {
+                       $pos = ($dir == '0') ? $start_pos : count($postdata);
                }
 
                //¥³¥á¥ó¥È¤òÁÞÆþ