From 24612333ae5efdbe365e5fbd57462f1c846d920a Mon Sep 17 00:00:00 2001 From: kgsoft Date: Thu, 7 Dec 2017 09:59:07 +0000 Subject: [PATCH] =?utf8?q?FSWiki=203.6.4=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../trunk/plugin/_ex_spam_filter_light/bbs.pm | 10 +- .../trunk/plugin/_ex_spam_filter_light/bugtrack.pm | 4 +- .../trunk/plugin/_ex_spam_filter_light/comment.pm | 14 ++- .../trunk/plugin/_ex_spam_filter_light/core.pm | 110 +++++++++++++++------ 4 files changed, 98 insertions(+), 40 deletions(-) diff --git a/kgsoft/_ex_spam_filter_light/trunk/plugin/_ex_spam_filter_light/bbs.pm b/kgsoft/_ex_spam_filter_light/trunk/plugin/_ex_spam_filter_light/bbs.pm index 570d9e4..62abf5d 100644 --- a/kgsoft/_ex_spam_filter_light/trunk/plugin/_ex_spam_filter_light/bbs.pm +++ b/kgsoft/_ex_spam_filter_light/trunk/plugin/_ex_spam_filter_light/bbs.pm @@ -27,9 +27,9 @@ sub do_action { if($name eq ""){ $name = "̵̾¤·¤µ¤ó"; } else { - # post_name¤È¤¤¤¦¥­¡¼¤Ç¥¯¥Ã¥­¡¼¤ò¥»¥Ã¥È¤¹¤ë + # fswiki_post_name¤È¤¤¤¦¥­¡¼¤Ç¥¯¥Ã¥­¡¼¤ò¥»¥Ã¥È¤¹¤ë my $path = &Util::cookie_path($wiki); - my $cookie = $cgi->cookie(-name=>'post_name',-value=>$name,-expires=>'+1M',-path=>$path); + my $cookie = $cgi->cookie(-name=>'fswiki_post_name',-value=>Util::url_encode($name),-expires=>'+1M',-path=>$path); print "Set-Cookie: ",$cookie->as_string,"\n"; } @@ -84,7 +84,7 @@ sub do_action { foreach(@lines){ $content = $content.$_."\n"; - if(/^{{bbs\s*.*}}$/ && $flag==0){ + if(/^\{\{bbs\s*.*\}\}$/ && $flag==0){ if($form_count==$count){ $content .= "!!$subject - $name (".&Util::format_date(time()).")\n". "$message\n"; @@ -133,9 +133,9 @@ sub do_action { if($name eq ""){ $name = "̵̾¤·¤µ¤ó"; } else { - # post_name¤È¤¤¤¦¥­¡¼¤Ç¥¯¥Ã¥­¡¼¤ò¥»¥Ã¥È¤¹¤ë + # fswiki_post_name¤È¤¤¤¦¥­¡¼¤Ç¥¯¥Ã¥­¡¼¤ò¥»¥Ã¥È¤¹¤ë my $path = &Util::cookie_path($wiki); - my $cookie = $cgi->cookie(-name=>'post_name',-value=>$name,-expires=>'+1M',-path=>$path); + my $cookie = $cgi->cookie(-name=>'fswiki_post_name',-value=>Util::url_encode($name),-expires=>'+1M',-path=>$path); print "Set-Cookie: ",$cookie->as_string,"\n"; } diff --git a/kgsoft/_ex_spam_filter_light/trunk/plugin/_ex_spam_filter_light/bugtrack.pm b/kgsoft/_ex_spam_filter_light/trunk/plugin/_ex_spam_filter_light/bugtrack.pm index ed6a4c0..6312509 100644 --- a/kgsoft/_ex_spam_filter_light/trunk/plugin/_ex_spam_filter_light/bugtrack.pm +++ b/kgsoft/_ex_spam_filter_light/trunk/plugin/_ex_spam_filter_light/bugtrack.pm @@ -33,9 +33,9 @@ sub do_action { return $wiki->error("¥Ð¥°ÆâÍƤ¬ÆþÎϤµ¤ì¤Æ¤¤¤Þ¤»¤ó¡£"); } - # post_name¤È¤¤¤¦¥­¡¼¤Ç¥¯¥Ã¥­¡¼¤ò¥»¥Ã¥È¤¹¤ë + # fswiki_post_name¤È¤¤¤¦¥­¡¼¤Ç¥¯¥Ã¥­¡¼¤ò¥»¥Ã¥È¤¹¤ë my $path = &Util::cookie_path($wiki); - my $cookie = $cgi->cookie(-name=>'post_name',-value=>$name,-expires=>'+1M',-path=>$path); + my $cookie = $cgi->cookie(-name=>'fswiki_post_name',-value=>Util::url_encode($name),-expires=>'+1M',-path=>$path); print "Set-Cookie: ",$cookie->as_string,"\n"; #-------------------------------------------------------------------------------------------------- diff --git a/kgsoft/_ex_spam_filter_light/trunk/plugin/_ex_spam_filter_light/comment.pm b/kgsoft/_ex_spam_filter_light/trunk/plugin/_ex_spam_filter_light/comment.pm index 701fda5..7bc906a 100644 --- a/kgsoft/_ex_spam_filter_light/trunk/plugin/_ex_spam_filter_light/comment.pm +++ b/kgsoft/_ex_spam_filter_light/trunk/plugin/_ex_spam_filter_light/comment.pm @@ -21,6 +21,10 @@ sub do_action { my $count = $cgi->param("count"); my $page = $cgi->param("page"); my $option = $cgi->param("option"); + + if(!$wiki->can_show($page)){ + return $wiki->error("¥Ú¡¼¥¸¤Î»²¾È¸¢¸Â¤¬¤¢¤ê¤Þ¤»¤ó¡£"); + } #-------------------------------------------------------------------------------------------------- if($message){ @@ -44,9 +48,9 @@ sub do_action { if($name eq ""){ $name = "̵̾¤·¤µ¤ó"; } else { - # post_name¤È¤¤¤¦¥­¡¼¤Ç¥¯¥Ã¥­¡¼¤ò¥»¥Ã¥È¤¹¤ë + # fswiki_post_name¤È¤¤¤¦¥­¡¼¤Ç¥¯¥Ã¥­¡¼¤ò¥»¥Ã¥È¤¹¤ë my $path = &Util::cookie_path($wiki); - my $cookie = $cgi->cookie(-name=>'post_name',-value=>$name,-expires=>'+1M',-path=>$path); + my $cookie = $cgi->cookie(-name=>'fswiki_post_name',-value=>Util::url_encode($name),-expires=>'+1M',-path=>$path); print "Set-Cookie: ",$cookie->as_string,"\n"; } @@ -66,7 +70,7 @@ sub do_action { # ¿·Ãå½ç¤Î¾ì¹ç if($option eq "reverse"){ $content = $content.$_."\n"; - if(/^{{comment\s*.*}}$/ && $flag==0){ + if(/^\{\{comment\s*.*\}\}$/ && $flag==0){ if($form_count==$count){ $content = $content."*$message - $name (".Util::format_date(time()).")\n"; $flag = 1; @@ -80,7 +84,7 @@ sub do_action { # Åê¹Æ½ç¤Î¾ì¹ç } else { - if(/^{{comment\s*.*}}$/ && $flag==0){ + if(/^\{\{comment\s*.*\}\}$/ && $flag==0){ if($form_count==$count){ $content = $content."*$message - $name (".Util::format_date(time()).")\n"; $flag = 1; @@ -93,7 +97,7 @@ sub do_action { } # ¥Ú¡¼¥¸ËöÈø¤ËÄɲäξì¹ç¤ÏºÇ¸å¤ËÄɲà - if($option eq "tail"){ + if($option eq "tail" && check_comment($wiki, 'Footer')){ $content = $content."*$message - $name (".Util::format_date(time()).")\n"; $flag = 1; } diff --git a/kgsoft/_ex_spam_filter_light/trunk/plugin/_ex_spam_filter_light/core.pm b/kgsoft/_ex_spam_filter_light/trunk/plugin/_ex_spam_filter_light/core.pm index 7f2b2f1..c0bcc87 100644 --- a/kgsoft/_ex_spam_filter_light/trunk/plugin/_ex_spam_filter_light/core.pm +++ b/kgsoft/_ex_spam_filter_light/trunk/plugin/_ex_spam_filter_light/core.pm @@ -40,11 +40,31 @@ sub do_action { #-------------------------------------------------------------------------- # Êݸ½èÍý if($cgi->param("save") ne ""){ - if($wiki->page_exists($pagename)){ - if($cgi->param("lastmodified") < $time){ - return $wiki->error("¥Ú¡¼¥¸¤Ï´û¤ËÊ̤Υ桼¥¶¤Ë¤è¤Ã¤Æ¹¹¿·¤µ¤ì¤Æ¤¤¤Þ¤¹¡£"); + if($wiki->config('page_max') ne '' && $wiki->config('page_max') > 0){ + if(length($content) > $wiki->config('page_max')){ + return $wiki->error('¥Ú¡¼¥¸¤¬Êݸ²Äǽ¤ÊºÇÂ祵¥¤¥º¤òĶ¤¨¤Æ¤¤¤Þ¤¹¡£'); } } + if($wiki->page_exists($pagename) && $cgi->param("lastmodified") != $time){ + $buf .= "

¥Ú¡¼¥¸¤Ï´û¤ËÊ̤Υ桼¥¶¤Ë¤è¤Ã¤Æ¹¹¿·¤µ¤ì¤Æ¤¤¤Þ¤¹¡£ºÇ¿·ÈǤȤκ¹Ê¬¤ò³Îǧ¤·¤ÆºÆÅÙÊÔ½¸¤ò¹Ô¤Ã¤Æ¤¯¤À¤µ¤¤¡£

"; + + my $mode = $wiki->get_edit_format(); + my $orig_source = undef; + if($artno eq ""){ + $orig_source = $wiki->convert_from_fswiki($wiki->get_page($pagename), $mode); + } else { + $orig_source = $wiki->convert_from_fswiki(&read_by_part($wiki->get_page($pagename), $artno), $mode); + } + my $your_source = $content; + $your_source =~ s/\r\n/\n/g; + $your_source =~ s/\r/\n/g; + + my $diff = plugin::core::Diff::_get_diff_html($wiki, $orig_source, $your_source); + $buf .= $diff."
"; + + $content = $orig_source; + + } else { #-------------------------------------------------------------------------------------------------- if($content){ @@ -73,37 +93,71 @@ sub do_action { } #-------------------------------------------------------------------------------------------------- - #my $save_content = $content; - my $mode = $wiki->get_edit_format(); - my $save_content = $wiki->convert_to_fswiki($content,$mode); + #my $save_content = $content; + my $mode = $wiki->get_edit_format(); + my $save_content = $wiki->convert_to_fswiki($content,$mode); - # ¥Ñ¡¼¥ÈÊÔ½¸¤Î¾ì¹ç - if($artno ne ""){ - $save_content = &make_save_source($wiki->get_page($pagename),$save_content,$artno,$wiki); - } - # FrontPage¤Ïºï½üÉÔ²Ä - if($pagename eq $wiki->config("frontpage") && $save_content eq ""){ - $buf = "".&Util::escapeHTML($wiki->config("frontpage"))."¤Ïºï½ü¤¹¤ë¤³¤È¤Ï¤Ç¤­¤Þ¤»¤ó¡£\n"; + # ¥Ñ¡¼¥ÈÊÔ½¸¤Î¾ì¹ç + if($artno ne ""){ + $save_content = &make_save_source($wiki->get_page($pagename), $save_content, $artno, $wiki); + } + # FrontPage¤Ïºï½üÉÔ²Ä + if($pagename eq $wiki->config("frontpage") && $save_content eq ""){ + $buf = "".&Util::escapeHTML($wiki->config("frontpage"))."¤Ïºï½ü¤¹¤ë¤³¤È¤Ï¤Ç¤­¤Þ¤»¤ó¡£\n"; - # ¤½¤ì°Ê³°¤Î¾ì¹ç¤Ï½èÍý¤ò¼Â¹Ô¤·¤Æ¥á¥Ã¥»¡¼¥¸¤òÊÖµÑ - } else { - $wiki->save_page($pagename,$save_content,$sage); - - if($content ne ""){ - $wiki->redirect($pagename); + # ¤½¤ì°Ê³°¤Î¾ì¹ç¤Ï½èÍý¤ò¼Â¹Ô¤·¤Æ¥á¥Ã¥»¡¼¥¸¤òÊÖµÑ } else { - if($artno eq ""){ - $wiki->set_title($pagename."¤òºï½ü¤·¤Þ¤·¤¿"); - return $cgi->escapeHTML($pagename)."¤òºï½ü¤·¤Þ¤·¤¿¡£"; + $wiki->save_page($pagename, $save_content, $sage); + + if($content ne ""){ + $wiki->redirect($pagename, $artno); } else { - $wiki->set_title($pagename."¤Î¥Ñ¡¼¥È¤òºï½ü¤·¤Þ¤·¤¿"); - return $cgi->escapeHTML($pagename)."¤Î¥Ñ¡¼¥È¤òºï½ü¤·¤Þ¤·¤¿¡£"; + if($artno eq ""){ + $wiki->set_title($pagename."¤òºï½ü¤·¤Þ¤·¤¿"); + return Util::escapeHTML($pagename)."¤òºï½ü¤·¤Þ¤·¤¿¡£"; + } else { + $wiki->set_title($pagename."¤Î¥Ñ¡¼¥È¤òºï½ü¤·¤Þ¤·¤¿"); + return Util::escapeHTML($pagename)."¤Î¥Ñ¡¼¥È¤òºï½ü¤·¤Þ¤·¤¿¡£"; + } } } } #-------------------------------------------------------------------------- + # º¹Ê¬³Îǧ½èÍý + } elsif($cgi->param("diff") ne ""){ + if($wiki->config('page_max') ne '' && $wiki->config('page_max') > 0){ + if(length($content) > $wiki->config('page_max')){ + return $wiki->error('¥Ú¡¼¥¸¤¬Êݸ²Äǽ¤ÊºÇÂ祵¥¤¥º¤òĶ¤¨¤Æ¤¤¤Þ¤¹¡£'); + } + } + $time = $cgi->param("lastmodified"); + + my $mode = $wiki->get_edit_format(); + my $orig_source = undef; + if($artno eq ""){ + $orig_source = $wiki->convert_from_fswiki($wiki->get_page($pagename), $mode); + } else { + $orig_source = $wiki->convert_from_fswiki(&read_by_part($wiki->get_page($pagename), $artno), $mode); + } + my $your_source = $content; + $your_source =~ s/\r\n/\n/g; + $your_source =~ s/\r/\n/g; + + if($orig_source eq $your_source){ + $buf .= '

º¹Ê¬¤Ï¤¢¤ê¤Þ¤»¤ó¡£

'; + } else { + my $diff = plugin::core::Diff::_get_diff_html($wiki, $your_source, $orig_source); + $buf .= $diff."
"; + } + + #-------------------------------------------------------------------------- # ¥×¥ì¥Ó¥å¡¼½èÍý } elsif($cgi->param("preview") ne ""){ + if($wiki->config('page_max') ne '' && $wiki->config('page_max') > 0){ + if(length($content) > $wiki->config('page_max')){ + return $wiki->error('¥Ú¡¼¥¸¤¬Êݸ²Äǽ¤ÊºÇÂ祵¥¤¥º¤òĶ¤¨¤Æ¤¤¤Þ¤¹¡£'); + } + } $time = $cgi->param("lastmodified"); $buf = "°Ê²¼¤Î¥×¥ì¥Ó¥å¡¼¤ò³Îǧ¤·¤Æ¤è¤í¤·¤±¤ì¤Ð¡ÖÊݸ¡×¥Ü¥¿¥ó¤ò²¡¤·¤Æ¤¯¤À¤µ¤¤¡£
"; if($content eq ""){ @@ -125,7 +179,7 @@ sub do_action { if($artno eq ""){ $content = $wiki->get_page($pagename); } else { - $content = &read_by_part($wiki->get_page($pagename),$artno); + $content = &read_by_part($wiki->get_page($pagename), $artno); } } elsif($template ne ""){ #¥Æ¥ó¥×¥ì¡¼¥È¤ò»ØÄꤵ¤ì¤¿¾ì¹ç @@ -139,16 +193,16 @@ sub do_action { my $tmpl = HTML::Template->new(filename=>$wiki->config('tmpl_dir')."/editform.tmpl", die_on_bad_params => 0); - $tmpl->param({SCRIPT_NAME => $wiki->config('script_name'), + $tmpl->param({SCRIPT_NAME => $wiki->create_url(), PAGE_NAME => $pagename, - CONTENT => $wiki->convert_from_fswiki($content,$format), + CONTENT => $wiki->convert_from_fswiki($content, $format), LAST_MODIFIED => $time, ACTION => 'EDIT', EXISTS_PAGE => $wiki->page_exists($pagename), SAGE => $sage}); if($artno ne ""){ - $tmpl->param(OPTIONAL_PARAMS=>[{NAME=>'artno',VALUE=>$artno}]); + $tmpl->param(OPTIONAL_PARAMS=>[{NAME=>'artno', VALUE=>$artno}]); } $buf .= $tmpl->output(); -- 2.11.0