X-Git-Url: https://git.p6c8.net/selfforum.git/blobdiff_plain/42e7ab8a13679442f2cd7524ab7fa38bb2166951..50e402c3d55ff3c8d220e95e12c545e6d0e86c5a:/selfforum-cgi/user/fo_posting.pl diff --git a/selfforum-cgi/user/fo_posting.pl b/selfforum-cgi/user/fo_posting.pl index c78cab7..1fe42a9 100644 --- a/selfforum-cgi/user/fo_posting.pl +++ b/selfforum-cgi/user/fo_posting.pl @@ -21,17 +21,17 @@ use vars qw( # locate the script # BEGIN { -# my $null = $0; $null =~ s/\\/\//g; # for win :-( -# $Bin = ($null =~ /^(.*)\/.*$/)? $1 : '.'; -# $Shared = "$Bin/../shared"; -# $Config = "$Bin/config"; -# $Script = ($null =~ /^.*\/(.*)$/)? $1 : $null; - - my $null = $0; #$null =~ s/\\/\//g; # for win :-( + my $null = $0; $null =~ s/\\/\//g; # for win :-( $Bin = ($null =~ /^(.*)\/.*$/)? $1 : '.'; - $Config = "$Bin/../../../cgi-config/devforum"; - $Shared = "$Bin/../../../cgi-shared"; + $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"; @@ -62,6 +62,10 @@ $request -> handle_error or $request -> save; # $request -> response; +# shorten the main file? +# +$request -> severance; + # # ### main end ################################################################### @@ -70,6 +74,7 @@ $request -> response; ### Posting::Request ########################################################### package Posting::Request; +use Arc::Archive; use CheckRFC; use Encode::Plain; $Encode::Plain::utf8 = 1; # generally convert from UTF-8 use Encode::Posting; @@ -124,6 +129,21 @@ sub new { bless $self, $class; } +sub severance { + my $self = shift; + + my $stat = cut_tail ({ + forumFile => $self -> {conf} -> {forum_file_name}, + messagePath => $self -> {conf} -> {message_path}, + archivePath => $self -> {conf} -> {original} -> {files} -> {archivePath}, + lockFile => $self -> {conf} -> {original} -> {files} -> {sev_lock}, + adminDefault => $self -> {conf} -> {admin}, + cachePath => $self -> {conf} -> {original} -> {files} -> {cachePath} + }); +# die $stat->{(keys %$stat)[0]} if (%$stat); + +} + ### sub response ############################################################### # # print the response to STDOUT @@ -430,7 +450,7 @@ sub save { }; } else { - my $cache = new Posting::Cache ($self->{conf}->{original}->{files}->{cacheFile}); + my $cache = new Posting::Cache ($self->{conf}->{original}->{files}->{cachePath}); $cache -> add_posting ( { thread => ($tid =~ /(\d+)/)[0], posting => ($mid =~ /(\d+)/)[0] @@ -763,7 +783,7 @@ sub check_cgi { # my ($ftid, $fmid) = split /;/ => $q -> param ($formdata -> {followUp} -> {name}) => 2; - unless ($ftid =~ /\d+/ and $fmid =~ /\d+/) { + unless ($ftid =~ /^\d+$/ and $fmid =~ /^\d+$/) { $self -> {error} = { spec => 'unknown_followup', type => 'fatal' @@ -817,6 +837,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', @@ -857,6 +880,16 @@ sub check_cgi { }; $self -> kill_param or return; } + + elsif ($formdata -> {$name {$_}} -> {type} eq 'unique-id' and not may_id $val) { + $self -> {error} = { + spec => 'wrong_unique_id', + desc => $name{$_}, + type => $formdata -> {$name {$_}} -> {errorType} + }; + print STDERR "Manipuliert!"; + $self -> kill_param or return; + } } if (exists ($formdata -> {$name {$_}} -> {values})