[comment] ui_template: Yes ui_template_name: leftonly [/comment] [flag type=write table=forum] [tmp page_title]Submit a forum story[/tmp] [control reset=1] [control-set] [component]search_box_small[/component] [/control-set] [control-set] [component]cart_tiny[/component] [/control-set] [control-set] [component]category_vertical[/component] [/control-set] [control reset=1] [comment] Form shamelessly stolen from Slash, thanks guys. [/comment] @_LEFTONLY_TOP_@ [perl tables="forum"] #code parent artid mod_time created username host score lastscore reason anon extended subject comment sub scrub { my ($value, $type) = @_; my @allowed = qw/ a b i u blockquote li ol ul em br tt p strong div /; my %v; my $db = $Db{forum} or return "Database error."; my $noscrub; if(! $type) { # do nothing } elsif($type eq '2') { $value = $Tag->filter('text2html', $value); } elsif($type eq '4') { unless ($value =~ m{}i) { $noscrub = 1; $value = "$value"; } } my $filter = join ".", 'restrict_html', @allowed; $value = $Tag->filter($filter,$value) unless $noscrub; return $value; } return; [/perl] [if cgi operation eq 'Preview'] This is what would go on the front page:

[if cgi additional] [/if]
[cgi name=subject filter=restrict_html]
by [either][value fname][or]Shrinking Violet[/either] on [convert-date fmt="%A, %B %e, %Y @%H:%M"][/convert-date]
[perl tables="forum"] return scrub($CGI->{comment}, $CGI->{commtype}); [/perl]
This is what goes on "Read More":

[perl tables="forum"] return scrub($CGI->{additional}, $CGI->{commtype}); [/perl]


Above is a preview of what you just entered. Use Submit to actually submit if you are satisfied. [/if]

[if cgi operation eq 'Submit'] [perl tables="forum"] #code parent artid mod_time created username host score lastscore reason anon extended subject comment my %v; delete $Scratch->{tmp_code}; my $db = $Db{forum} or return "Database error."; $v{host} = $Session->{host}; $v{score} = 0; my $noscrub; if(! $CGI->{commtype}) { # do nothing } elsif($CGI->{commtype} eq '2') { $CGI->{comment} = $Tag->filter('text2html', $CGI->{comment}); } elsif($CGI->{commtype} eq '4') { unless ($CGI->{comment} =~ m{}i) { $noscrub = 1; $CGI->{comment} = "$CGI->{comment}"; } } $v{comment} = scrub($CGI->{comment}, $CGI->{commtype}); $v{additional} = scrub($CGI->{additional}, $CGI->{commtype}); $v{username} = $Session->{username} || ''; $v{anon} = $CGI->{anon} ? 1 : 0; $v{mod_time} = $v{created} = $Tag->time( { body => "%Y-%m-%d %H:%M:%S" }); $v{subject} = $Tag->filter('encode_entities', $CGI->{subject}, 'subject'); $v{artid} = '0'; $v{parent} = '0'; $Scratch->{tmp_code} = $db->set_slice(undef, [ keys %v ], [values %v]) or return "Error submitting reply!"; $Scratch->{tmp_code} =~ s/'//g; ## This is special processing only if there is a submission email address ## is found if($Variable->{FORUM_SUBMIT_EMAIL}) { my $cc = $Variable->{FORUM_SUBMIT_EMAIL}; my $url = $Tag->area( { href => 'admin/flex_editor', form => " mv_data_table=forum item_id=$Scratch->{tmp_code} ", }); my $message = < Host: $v{host} Subject: $v{subject} Content -------- $v{comment} EOF $message .= <email( { subject => "Posting from $v{artid} forum: $v{subject}", to => $cc, body => $message, }); } return; [/perl] [if scratch tmp_code] Your story has been submitted. You will receive a response when it is handled. For questions, contact webmaster@perusion.com

[page index]Return to the Intranet home [/if] [else] [include include/forum/submit_form] [/else] [/if]

[if variable FORUM_DEFAULT_THREAD] [page forum __FORUM_DEFAULT_THREAD__]__COMPANY__ forum[/page] [/if] @_LEFTONLY_BOTTOM_@