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 #--------------------------------------------------------------------------------------------------
27 unless(&plugin::_ex_spam_filter_light::Install::judgment_text($message)){
28 my $time = Util::format_date(time());
29 my $file = $wiki->config('log_dir')."/spam_comment.txt";
30 if(open(SPAM_LOG, ">>$file")){
31 print SPAM_LOG "$page:$message - $name($time)\n";
34 my $error_message = $wiki->error("Åê¹Æ¤µ¤ì¤¿Ê¸¾Ï¤Ï¥¹¥Ñ¥à¥á¥Ã¥»¡¼¥¸¤ÈȽÄꤵ¤ì¤Þ¤·¤¿¡£\n");
35 $error_message .= "<p>\n";
36 $error_message .= "<div>Åê¹Æ¤µ¤ì¤¿Ê¸¾Ï¡§</div>\n";
37 $error_message .= "<div>" . Util::escapeHTML("$message") . "</div>\n";
38 $error_message .= "</p>\n";
39 return $error_message;
42 #--------------------------------------------------------------------------------------------------
47 # post_name¤È¤¤¤¦¥¡¼¤Ç¥¯¥Ã¥¡¼¤ò¥»¥Ã¥È¤¹¤ë
48 my $path = &Util::cookie_path($wiki);
49 my $cookie = $cgi->cookie(-name=>'post_name',-value=>$name,-expires=>'+1M',-path=>$path);
50 print "Set-Cookie: ",$cookie->as_string,"\n";
53 # ¥Õ¥©¡¼¥Þ¥Ã¥È¥×¥é¥°¥¤¥ó¤Ø¤ÎÂбþ
54 my $format = $wiki->get_edit_format();
55 $name = $wiki->convert_to_fswiki($name ,$format,1);
56 $message = $wiki->convert_to_fswiki($message,$format,1);
58 if($page ne "" && $message ne "" && $count ne ""){
60 my @lines = split(/\n/,$wiki->get_page($page));
67 if($option eq "reverse"){
68 $content = $content.$_."\n";
69 if(/^{{comment\s*.*}}$/ && $flag==0){
70 if($form_count==$count){
71 $content = $content."*$message - $name (".Util::format_date(time()).")\n";
77 # ¥Ú¡¼¥¸ËöÈø¤ËÄɲäξì¹ç
78 } elsif($option eq "tail"){
79 $content = $content.$_."\n";
83 if(/^{{comment\s*.*}}$/ && $flag==0){
84 if($form_count==$count){
85 $content = $content."*$message - $name (".Util::format_date(time()).")\n";
91 $content = $content.$_."\n";
95 # ¥Ú¡¼¥¸ËöÈø¤ËÄɲäξì¹ç¤ÏºÇ¸å¤ËÄɲÃ
96 if($option eq "tail"){
97 $content = $content."*$message - $name (".Util::format_date(time()).")\n";
102 $wiki->save_page($page,$content);
106 # ¸µ¤Î¥Ú¡¼¥¸¤Ë¥ê¥À¥¤¥ì¥¯¥È
107 $wiki->redirect($page);