1 ############################################################
3 # Comment¥×¥é¥°¥¤¥ó¤Î¥¢¥¯¥·¥ç¥ó¥Ï¥ó¥É¥é¡£
5 ############################################################
6 package plugin::comment::CommentHandler;
9 #===========================================================
11 #===========================================================
15 return bless $self,$class;
18 #===========================================================
20 #===========================================================
24 my $cgi = $wiki->get_CGI;
26 my $name = $cgi->param("name");
27 my $message = $cgi->param("message");
28 my $count = $cgi->param("count");
29 my $page = $cgi->param("page");
30 my $option = $cgi->param("option");
32 if(!$wiki->can_show($page)){
33 return $wiki->error(RC_FORBIDDEN, "¥Ú¡¼¥¸¤Î»²¾È¸¢¸Â¤¬¤¢¤ê¤Þ¤»¤ó¡£");
38 # fswiki_post_name¤È¤¤¤¦¥¡¼¤Ç¥¯¥Ã¥¡¼¤ò¥»¥Ã¥È¤¹¤ë
39 my $path = &Util::cookie_path($wiki);
40 my $cookie = $cgi->cookie(-name=>'fswiki_post_name',-value=>Util::url_encode($name),-expires=>'+1M',-path=>$path);
41 print "Set-Cookie: ",$cookie->as_string,"\n";
44 # ¥Õ¥©¡¼¥Þ¥Ã¥È¥×¥é¥°¥¤¥ó¤Ø¤ÎÂбþ
45 my $format = $wiki->get_edit_format();
46 $name = $wiki->convert_to_fswiki($name ,$format,1);
47 $message = $wiki->convert_to_fswiki($message,$format,1);
49 if($page ne "" && $message ne "" && $count ne ""){
51 my @lines = split(/\n/,$wiki->get_page($page));
58 if($option eq "reverse"){
59 $content = $content.$_."\n";
60 if(/^\{\{comment\s*.*\}\}$/ && $flag==0){
61 if($form_count==$count){
62 $content = $content."*$message - $name (".Util::format_date(time()).")\n";
68 # ¥Ú¡¼¥¸ËöÈø¤ËÄɲäξì¹ç
69 } elsif($option eq "tail"){
70 $content = $content.$_."\n";
74 if(/^\{\{comment\s*.*\}\}$/ && $flag==0){
75 if($form_count==$count){
76 $content = $content."*$message - $name (".Util::format_date(time()).")\n";
82 $content = $content.$_."\n";
86 # ¥Ú¡¼¥¸ËöÈø¤ËÄɲäξì¹ç¤ÏºÇ¸å¤ËÄɲÃ
87 if($option eq "tail" && check_comment($wiki, 'Footer')){
88 $content = $content."*$message - $name (".Util::format_date(time()).")\n";
93 $wiki->save_page($page,$content);
97 # ¸µ¤Î¥Ú¡¼¥¸¤Ë¥ê¥À¥¤¥ì¥¯¥È
98 $wiki->redirect($page);
101 #==================================================================
102 # ¥Ú¡¼¥¸¤Ëcomment¥×¥é¥°¥¤¥ó¤¬´Þ¤Þ¤ì¤Æ¤¤¤ë¤«¤É¤¦¤«¤ò¥Á¥§¥Ã¥¯
103 #==================================================================
107 my @lines = split(/\n/,$wiki->get_page($page));
109 if(/^\{\{comment\s*.*\}\}$/){