OSDN Git Service

BugTrack/788: Correct r1.36, disabling 'reply' option
authorhenoheno <henoheno>
Sun, 30 Jan 2005 00:51:51 +0000 (09:51 +0900)
committerhenoheno <henoheno>
Sun, 30 Jan 2005 00:51:51 +0000 (09:51 +0900)
plugin/pcomment.inc.php

index 34e3bdf..431a469 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 // PukiWiki - Yet another WikiWikiWeb clone
-// $Id: pcomment.inc.php,v 1.36 2005/01/23 07:01:56 henoheno Exp $
+// $Id: pcomment.inc.php,v 1.37 2005/01/30 00:51:51 henoheno Exp $
 //
 // pcomment plugin - Insetring comment into specified (another) page
 
@@ -117,7 +117,7 @@ function plugin_pcomment_convert()
        list($comments, $digest) = pcmt_get_comments($_page, $count, $dir, $params['reply']);
 
        if (PKWK_READONLY) {
-               $form = '';
+               $form_start = $form = $form_end = '';
        } else {
                // ¥Õ¥©¡¼¥à¤òɽ¼¨
                if ($params['noname']) {
@@ -138,8 +138,8 @@ function plugin_pcomment_convert()
                $s_nodate = htmlspecialchars($params['nodate']);
                $s_count  = htmlspecialchars($count);
 
+               $form_start = '<form action="' . $script . '" method="post">' . "\n";
                $form = <<<EOD
-<form action="$script" method="post">
   <div>
   <input type="hidden" name="digest" value="$digest" />
   <input type="hidden" name="plugin" value="pcomment" />
@@ -151,8 +151,8 @@ function plugin_pcomment_convert()
   $radio $title $name $comment
   <input type="submit" value="{$_pcmt_messages['btn_comment']}" />
   </div>
-</form>
 EOD;
+               $form_end = '</form>' . "\n";
        }
 
        if (! is_page($_page)) {
@@ -164,9 +164,24 @@ EOD;
                $recent = ! empty($count) ? sprintf($_pcmt_messages['msg_recent'], $count) : '';
        }
 
-       return $dir ?
-               '<div><p>' . $recent . ' ' . $link . '</p>' . "\n" .  $comments . "\n" .  $form . '</div>' . "\n" :
-               '<div>' . $form . $comments. "\n" . '<p>' . $recent . ' ' . $link . '</p>' . "\n" . '</div>' . "\n";
+       if ($dir) {
+               return '<div>' .
+                       '<p>' . $recent . ' ' . $link . '</p>' . "\n" .
+                       $form_start .
+                               $comments . "\n" .
+                               $form .
+                       $form_end .
+                       '</div>' . "\n";
+       } else {
+               return '<div>' .
+                       $form_start .
+                               $form .
+                               $comments. "\n" .
+                       $form_end .
+                       '<p>' . $recent . ' ' . $link . '</p>' . "\n" .
+                       '</div>' . "\n";
+       }
+       // TODO: READONLY»þ¤Îradiobox¤Îºï½ü¤ò˺¤ì¤º¤Ë¡£
 }
 
 function pcmt_insert()
@@ -370,11 +385,10 @@ function pcmt_get_comments($page, $count, $dir, $reply)
        unset($data);
 
        //¥³¥á¥ó¥È¤Ë¥é¥¸¥ª¥Ü¥¿¥ó¤Î°õ¤ò¤Ä¤±¤ë
-       if ($reply) {
+       if ($reply)
                $comments = preg_replace("/<li>\x01(\d+)\x02(.*)\x03/",
                        '<li class="pcmt"><input class="pcmt" type="radio" name="reply" value="$2" tabindex="$1" />',
                        $comments);
-       }
 
        return array($comments, $digest);
 }