--- /dev/null
+##########################################################################################
+#
+# ¥¹¥Ñ¥à¥Õ¥£¥ë¥¿¡¼¥×¥é¥°¥¤¥ó¡Ê³Ø½¬µ¡Ç½Ìµ¤·ÈÇ¡Ë
+#¡Êcomment¥×¥é¥°¥¤¥ó¤Î¥ª¡¼¥Ð¡¼¥é¥¤¥É¡Ë
+#
+##########################################################################################
+use strict;
+
+use plugin::comment::CommentHandler;
+
+# plugin::comment::CommentHandler¤Îdo_action¥á¥½¥Ã¥É¤ÎÃÖ¤´¹¤¨
+package plugin::comment::CommentHandler;
+
+sub do_action {
+ my $self = shift;
+ my $wiki = shift;
+ my $cgi = $wiki->get_CGI;
+
+ my $name = $cgi->param("name");
+ my $message = $cgi->param("message");
+ my $count = $cgi->param("count");
+ my $page = $cgi->param("page");
+ my $option = $cgi->param("option");
+
+#--------------------------------------------------------------------------------------------------
+ if($message){
+ unless(&plugin::_ex_spam_filter_light::Install::judgment_text($message)){
+ my $time = Util::format_date(time());
+ my $file = $wiki->config('log_dir')."/spam_comment.txt";
+ if(open(SPAM_LOG, ">>$file")){
+ print SPAM_LOG "$page:$message - $name($time)\n";
+ close(SPAM_LOG);
+ }
+ my $error_message = $wiki->error("Åê¹Æ¤µ¤ì¤¿Ê¸¾Ï¤Ï¥¹¥Ñ¥à¥á¥Ã¥»¡¼¥¸¤ÈȽÄꤵ¤ì¤Þ¤·¤¿¡£\n");
+ $error_message .= "<p>\n";
+ $error_message .= "<div>Åê¹Æ¤µ¤ì¤¿Ê¸¾Ï¡§</div>\n";
+ $error_message .= "<div>" . Util::escapeHTML("$message") . "</div>\n";
+ $error_message .= "</p>\n";
+ return $error_message;
+ }
+ }
+#--------------------------------------------------------------------------------------------------
+
+ if($name eq ""){
+ $name = "̵̾¤·¤µ¤ó";
+ } else {
+ # post_name¤È¤¤¤¦¥¡¼¤Ç¥¯¥Ã¥¡¼¤ò¥»¥Ã¥È¤¹¤ë
+ my $path = &Util::cookie_path($wiki);
+ my $cookie = $cgi->cookie(-name=>'post_name',-value=>$name,-expires=>'+1M',-path=>$path);
+ print "Set-Cookie: ",$cookie->as_string,"\n";
+ }
+
+ # ¥Õ¥©¡¼¥Þ¥Ã¥È¥×¥é¥°¥¤¥ó¤Ø¤ÎÂбþ
+ my $format = $wiki->get_edit_format();
+ $name = $wiki->convert_to_fswiki($name ,$format,1);
+ $message = $wiki->convert_to_fswiki($message,$format,1);
+
+ if($page ne "" && $message ne "" && $count ne ""){
+
+ my @lines = split(/\n/,$wiki->get_page($page));
+ my $flag = 0;
+ my $form_count = 1;
+ my $content = "";
+
+ foreach(@lines){
+ # ¿·Ãå½ç¤Î¾ì¹ç
+ if($option eq "reverse"){
+ $content = $content.$_."\n";
+ if(/^{{comment\s*.*}}$/ && $flag==0){
+ if($form_count==$count){
+ $content = $content."*$message - $name (".Util::format_date(time()).")\n";
+ $flag = 1;
+ } else {
+ $form_count++;
+ }
+ }
+ # ¥Ú¡¼¥¸ËöÈø¤ËÄɲäξì¹ç
+ } elsif($option eq "tail"){
+ $content = $content.$_."\n";
+
+ # Åê¹Æ½ç¤Î¾ì¹ç
+ } else {
+ if(/^{{comment\s*.*}}$/ && $flag==0){
+ if($form_count==$count){
+ $content = $content."*$message - $name (".Util::format_date(time()).")\n";
+ $flag = 1;
+ } else {
+ $form_count++;
+ }
+ }
+ $content = $content.$_."\n";
+ }
+ }
+
+ # ¥Ú¡¼¥¸ËöÈø¤ËÄɲäξì¹ç¤ÏºÇ¸å¤ËÄɲÃ
+ if($option eq "tail"){
+ $content = $content."*$message - $name (".Util::format_date(time()).")\n";
+ $flag = 1;
+ }
+
+ if($flag==1){
+ $wiki->save_page($page,$content);
+ }
+ }
+
+ # ¸µ¤Î¥Ú¡¼¥¸¤Ë¥ê¥À¥¤¥ì¥¯¥È
+ $wiki->redirect($page);
+}
+
+1;