1 ##########################################################################################
3 # ¥¹¥Ñ¥à¥Õ¥£¥ë¥¿¡¼¥×¥é¥°¥¤¥ó¡Ê³Ø½¬µ¡Ç½Ìµ¤·ÈÇ¡Ë
4 #¡Êcomment¥×¥é¥°¥¤¥ó¤Î¥ª¡¼¥Ð¡¼¥é¥¤¥É¡Ë
6 ##########################################################################################
9 use plugin::comment::CommentHandler;
11 # plugin::comment::CommentHandler¤Îdo_action¥á¥½¥Ã¥É¤ÎÃÖ¤´¹¤¨
12 package plugin::comment::CommentHandler;
17 my $cgi = $wiki->get_CGI;
19 my $name = $cgi->param("name");
20 my $message = $cgi->param("message");
21 my $count = $cgi->param("count");
22 my $page = $cgi->param("page");
23 my $option = $cgi->param("option");
25 if(!$wiki->can_show($page)){
26 return $wiki->error("¥Ú¡¼¥¸¤Î»²¾È¸¢¸Â¤¬¤¢¤ê¤Þ¤»¤ó¡£");
29 #--------------------------------------------------------------------------------------------------
31 unless(&plugin::_ex_spam_filter_light::Install::judgment_text($message)){
32 my $time = Util::format_date(time());
33 my $file = $wiki->config('log_dir')."/spam_comment.txt";
34 if(open(SPAM_LOG, ">>$file")){
35 print SPAM_LOG "$page:$message - $name($time)\n";
38 my $error_message = $wiki->error("Åê¹Æ¤µ¤ì¤¿Ê¸¾Ï¤Ï¥¹¥Ñ¥à¥á¥Ã¥»¡¼¥¸¤ÈȽÄꤵ¤ì¤Þ¤·¤¿¡£\n");
39 $error_message .= "<p>\n";
40 $error_message .= "<div>Åê¹Æ¤µ¤ì¤¿Ê¸¾Ï¡§</div>\n";
41 $error_message .= "<div>" . Util::escapeHTML("$message") . "</div>\n";
42 $error_message .= "</p>\n";
43 return $error_message;
46 #--------------------------------------------------------------------------------------------------
51 # fswiki_post_name¤È¤¤¤¦¥¡¼¤Ç¥¯¥Ã¥¡¼¤ò¥»¥Ã¥È¤¹¤ë
52 my $path = &Util::cookie_path($wiki);
53 my $cookie = $cgi->cookie(-name=>'fswiki_post_name',-value=>Util::url_encode($name),-expires=>'+1M',-path=>$path);
54 print "Set-Cookie: ",$cookie->as_string,"\n";
57 # ¥Õ¥©¡¼¥Þ¥Ã¥È¥×¥é¥°¥¤¥ó¤Ø¤ÎÂбþ
58 my $format = $wiki->get_edit_format();
59 $name = $wiki->convert_to_fswiki($name ,$format,1);
60 $message = $wiki->convert_to_fswiki($message,$format,1);
62 if($page ne "" && $message ne "" && $count ne ""){
64 my @lines = split(/\n/,$wiki->get_page($page));
71 if($option eq "reverse"){
72 $content = $content.$_."\n";
73 if(/^\{\{comment\s*.*\}\}$/ && $flag==0){
74 if($form_count==$count){
75 $content = $content."*$message - $name (".Util::format_date(time()).")\n";
81 # ¥Ú¡¼¥¸ËöÈø¤ËÄɲäξì¹ç
82 } elsif($option eq "tail"){
83 $content = $content.$_."\n";
87 if(/^\{\{comment\s*.*\}\}$/ && $flag==0){
88 if($form_count==$count){
89 $content = $content."*$message - $name (".Util::format_date(time()).")\n";
95 $content = $content.$_."\n";
99 # ¥Ú¡¼¥¸ËöÈø¤ËÄɲäξì¹ç¤ÏºÇ¸å¤ËÄɲÃ
100 if($option eq "tail" && check_comment($wiki, 'Footer')){
101 $content = $content."*$message - $name (".Util::format_date(time()).")\n";
106 $wiki->save_page($page,$content);
110 # ¸µ¤Î¥Ú¡¼¥¸¤Ë¥ê¥À¥¤¥ì¥¯¥È
111 $wiki->redirect($page);