use strict; package SuikaWiki::Plugin::Registry; our %Info; $Info{q#WikiFormBBS#}->{Name} = q#WikiFormBBS#; $Info{q#WikiFormBBS#}->{q#Version#} = q#2004.0831.0328#; $Info{q#WikiFormBBS#}->{q#InterfaceVersion#} = q#2.9.1#; $Info{q#WikiFormBBS#}->{q#mkpluginVersion#} = q#2.1.19#; $Info{q#WikiFormBBS#}->{q#module_name#} = q#SuikaWiki::Plugin::plugin::WikiFormBBS1040731032807Gyb5#; $Info{q#WikiFormBBS#}->{q#Date.RCS#} = q#$Date: 2010/05/16 23:05:49 $#; $Info{q#WikiFormBBS#}->{RequiredPlugin} = [q#WikiFormCore#]; $Info{q#WikiFormBBS#}->{RequiredModule} = [q#Digest::MD5#]; $Info{q#WikiFormBBS#}->{Description} = [[q#WikiFormBBS WikiPlugin module implements some features well-supported in Web BBS systems, such as "sage", "ID", and so on.#, q#en#, q##]]; $Info{q#WikiFormBBS#}->{License} = [[q#%%Perl%%#, q##, q##]]; $Info{q#WikiFormBBS#}->{Author} = [[[], [q##], [q##]]]; package SuikaWiki::Plugin::plugin::WikiFormBBS1040731032807Gyb5; #line 1 "(WikiPlugin module source bbs.wp2, block Plugin/Use)" require Digest::MD5; my $WIKIRESOURCE; #line 1 "(WikiPlugin module WikiFormBBS, chunk 1)" $SuikaWiki::Plugin::Rule{form_template}->{bbs__check_sage} = {q#after#, sub {my ($f, $rule_name, $p, $o, %opt) = @_; #line 1 "(WikiPlugin module source bbs.wp2, block FormattingRule[name()='[q#form-template#]/bbs__check_sage']/After)" my $name = $o->{wiki}->{input}->parameter ('wikiform__'.($p->{source} || 'mail')); if ($name =~ /sage/) { $o->{form}->{output}->{bbs__sage} = 1; }}, q#Parameter#, {q#source#, {q#Type#, q#ID#, q#Default#, q#"mail"#, q#Description#, [[q#Input field name#, q#en#, q##]]}}, q#Description#, [[q#Check whether "sage" is in input and disable updating Last-Modified date-time feature if it is.#, q#en#, q##]]} #line 1 "(WikiPlugin module WikiFormBBS, chunk 2)" ; $SuikaWiki::Plugin::Rule{form_template}->{bbs__2ch_id} = {q#after#, sub {my ($f, $rule_name, $p, $o, %opt) = @_; #line 1 "(WikiPlugin module source bbs.wp2, block FormattingRule[name()='[q#form-template#]/bbs__2ch_id']/After)" if ($p->{sage}) { if ($o->{wiki}->{input}->parameter ('wikiform__'.$p->{sage}) =~ /sage/) { $p->{-result} .= '???'; return; } } my $name = $p->{name} || $o->{wiki}->{var}->{page} ->stringify (wiki => $o->{wiki}); my @time = gmtime; my $rand = substr sprintf ('%02d%02d%04d%02d%02d%04d', @time[3,4,5,3,4,5]), 0, 16; my $host = $o->{wiki}->{input} ? $o->{wiki}->{input}->meta_variable ('REMOTE_HOST') || $o->{wiki}->{input}->meta_variable ('REMOTE_ADDR') : 'unknown.invalid'; my $md5 = new Digest::MD5; $md5->add (substr Digest::MD5::md5_hex ($host), -4); $md5->add ($name); $md5->add ($time[3]); $md5->add ($rand); $p->{-result} .= substr $md5->b64digest, 0, 8;}, q#Parameter#, {q#sage#, {q#Type#, q#ID#, q#Default#, q#(none)#, q#Description#, [[q#WikiForm field name in which "sage" check is done. If missing, hiding IDs by "sage" is not allowed.#, q#en #, q##]]}, q#name#, {q#Type#, q#string#, q#Default#, q#(auto)#, q#Description#, [[q#Board name (aka bbskey). If missing, defaulted to current WikiName.#, q#en#, q##]]}}, q#Description#, [[q#This rule inserts 2ch style "ID" string. Note that ID generating algorithm implemented by this rule is not exact same as one implemented by 2ch or other "ID" implementing BBSes.#, q#en#, q##]]} #line 1 "(WikiPlugin module WikiFormBBS, chunk 4)" ; $SuikaWiki::Plugin::Rule{form_template}->{bbs__2ch_trip} = {q#after#, sub {my ($f, $rule_name, $p, $o, %opt) = @_; #line 1 "(WikiPlugin module source bbs.wp2, block FormattingRule[name()='[q#form-template#]/bbs__2ch_trip']/After)" my $key = $o->{wiki}->{input}->parameter ('wikiform__'.$p->{source}); $p->{-result} .= SuikaWiki::Plugin::plugin::WikiFormBBS1040731032807Gyb5->key2trip (key => $key);}, q#Parameter#, {q#source#, {q#Type#, q#ID#, q#Default#, q#(required)#, q#Description#, [[q#WikiForm field in which trip key is inputed#, q#en#, q##]]}}, q#Description#, [[q#Inserts 2ch style trip. Note that algorithm generating trip is not exact same as that of 2ch. Only basic latin alphabets should be used for compatibility.#, q#en#, q##]]} #line 1 "(WikiPlugin module WikiFormBBS, chunk 6)" ; $SuikaWiki::Plugin::Rule{form_template}->{bbs__2ch_name} = {q#after#, sub {my ($f, $rule_name, $p, $o, %opt) = @_; #line 1 "(WikiPlugin module source bbs.wp2, block FormattingRule[name()='[q#form-template#]/bbs__2ch_name']/After)" my $name = $o->{wiki}->{input}->parameter ('wikiform__'.($p->{source} || 'name')); my $trip; if ($name =~ s/\#(.*)$//g) { $trip = SuikaWiki::Plugin::plugin::WikiFormBBS1040731032807Gyb5->key2trip (key => $1); } if ($name =~ /fusianasan/) { my $host = $o->{wiki}->{input}->meta_variable ('REMOTE_HOST') || $o->{wiki}->{input}->meta_variable ('REMOTE_ADDR') || 'unknown.invalid'; $name =~ s/fusianasan/$host/g; } unless (length $name) { WHOLETREE: for (@{$o->{var}->{sw09__document_tree}->child_nodes}) { if ($_->node_type eq '#element' and $_->local_name eq 'head') { for (@{$_->child_nodes}) { if ($_->node_type eq '#element' and $_->local_name eq 'parameter') { if ($_->get_attribute_value ('name', default => '') eq 'default-name') { for (@{$_->child_nodes}) { if ($_->node_type eq '#element' and $_->local_name eq 'value') { $name = $_->inner_text; last WHOLETREE; } } last WHOLETREE; } } } } } } unless (length $name) { $name = ($WIKIRESOURCE ||= SuikaWiki::Plugin->module_package ('WikiResource'))->get (name => 'WikiForm:WikiComment:DefaultName', o => $o, wiki => $o->{wiki}); } if ($name =~ />>\d/ or $name =~ /^\d+$/) { $p->{-result} .= $name; } else { $p->{-result} .= "[[$name]]"; } $p->{-result} .= ' #' . $trip if $trip;}, q#Parameter#, {q#source#, {q#Type#, q#ID#, q#Default#, q#"name"#, q#Description#, [[q#Input field name#, q#en#, q##]]}}, q#Description#, [[q#Inserting "name" with SuikaWiki/0.9 emphasis and link, as well as 2ch style trip and fusianasan.#, q#en#, q##]]} #line 1 "(WikiPlugin module WikiFormBBS, chunk 8)" ; sub key2trip { #line 1 "(WikiPlugin module source bbs.wp2, block Function[Name='key2trip']/Main)" my (undef, %opt) = @_; my $salt = substr substr ($opt{key}, 1, 2) . 'H.', 0, 2; $salt =~ tr/:;<=>?\@[\\]^_`/ABCDEFGabcdefg/; $salt =~ s{[^./0-9A-Za-z]}{.}g; return substr crypt ($opt{key}, $salt), -10; } #line 1 "(WikiPlugin module WikiFormBBS, chunk 10)" package SuikaWiki::Plugin::Registry; $Info{q#WikiFormBBS#}->{provide} = {q#rule#, {q#form_template#, [q#bbs__check_sage#, q#bbs__2ch_id#, q#bbs__2ch_trip#, q#bbs__2ch_name#]}}; 1;