X-Git-Url: https://git.p6c8.net/selfforum.git/blobdiff_plain/489e7846289d4fb66eb4b9fab0fed4af719b98ee..6fc8c0f3c87e9aaf59aa414a0641db2ac7601d7e:/selfforum-cgi/user/fo_posting.pl?ds=sidebyside diff --git a/selfforum-cgi/user/fo_posting.pl b/selfforum-cgi/user/fo_posting.pl index 111f045..180233c 100644 --- a/selfforum-cgi/user/fo_posting.pl +++ b/selfforum-cgi/user/fo_posting.pl @@ -11,15 +11,27 @@ ################################################################################ use strict; -use vars qw($Bin $Shared $Script); +use vars qw( + $Bin + $Shared + $Script + $Config +); # locate the script # BEGIN { my $null = $0; $null =~ s/\\/\//g; # for win :-( - ($Bin) = ($null =~ /^(.*)\/.*$/)? $1 : '.'; - $Shared = "$Bin/../shared"; - ($Script) = ($null =~ /^.*\/(.*)$/)? $1 : $null; + $Bin = ($null =~ /^(.*)\/.*$/)? $1 : '.'; + $Shared = "$Bin/../shared"; + $Config = "$Bin/config"; + $Script = ($null =~ /^.*\/(.*)$/)? $1 : $null; + +# my $null = $0; #$null =~ s/\\/\//g; # for win :-( +# $Bin = ($null =~ /^(.*)\/.*$/)? $1 : '.'; +# $Config = "$Bin/../../../cgi-config/devforum"; +# $Shared = "$Bin/../../../cgi-shared"; +# $Script = ($null =~ /^.*\/(.*)$/)? $1 : $null; } use lib "$Shared"; @@ -27,10 +39,11 @@ use CGI::Carp qw(fatalsToBrowser); use Conf; use Conf::Admin; +use Posting::Cache; # load script configuration and admin default conf. # -my $conf = read_script_conf ($Bin, $Shared, $Script); +my $conf = read_script_conf ($Config, $Shared, $Script); my $adminDefault = read_admin_conf ($conf -> {files} -> {adminDefault}); # Initialize the request @@ -396,17 +409,17 @@ sub save { if (defined $q -> param ($formdata -> {$may{$_}} -> {name})); } - my ($stat, $xml, $mid); + my ($stat, $xml, $mid, $tid); # we've got a fup if it's a reply # if ($self -> {response} -> {reply}) { $pars -> {parentMessage} = $self -> {fup_mid}; $pars -> {thread} = $self -> {fup_tid}; - ($stat, $xml, $mid) = write_reply_posting ($pars); + ($stat, $xml, $mid, $tid) = write_reply_posting ($pars); } else { - ($stat, $xml, $mid) = write_new_thread ($pars); + ($stat, $xml, $mid, $tid) = write_new_thread ($pars); } if ($stat) { @@ -417,6 +430,13 @@ sub save { }; } else { + my $cache = new Posting::Cache ($self->{conf}->{original}->{files}->{cacheFile}); + $cache -> add_posting ( + { thread => ($tid =~ /(\d+)/)[0], + posting => ($mid =~ /(\d+)/)[0] + } + ); + $self -> {check_success} = 1; my $thx = $self -> {conf} -> {show_posting} -> {thanx}; @@ -797,6 +817,9 @@ sub check_cgi { # (my $val_ww = $val) =~ s/\s+//g; + $val_ww =~ y/a-zA-Z//cd + if (exists ($formdata -> {$name {$_}} -> {type}) and $formdata -> {$name {$_}} -> {type} eq 'name'); + if (length $val_ww < $formdata -> {$name {$_}} -> {minlength}) { $self -> {error} = { spec => 'too_short',