X-Git-Url: https://git.p6c8.net/selfforum.git/blobdiff_plain/311919c2fa42aaacfc531b1aa5bbd0fc02f4d238..aaff267fdddc495df3bfa2fc0eb0d20a76b6d220:/selfforum-cgi/user/fo_posting.pl diff --git a/selfforum-cgi/user/fo_posting.pl b/selfforum-cgi/user/fo_posting.pl index 86a24fa..91a21a1 100644 --- a/selfforum-cgi/user/fo_posting.pl +++ b/selfforum-cgi/user/fo_posting.pl @@ -44,12 +44,12 @@ our $assign = $show_posting -> {assign}; our $formmust = $show_posting -> {form} -> {must}; our $formdata = $show_posting -> {form} -> {data}; our $formact = $show_posting -> {form} -> {action}; -our $template = new Template "$Bin/".$show_posting -> {templateFile}; +our $template = new Template $show_posting -> {templateFile}; our $pars = {}; our ($failed, %dparam, $threads, $last_thread, $last_message, $ftid, $fmid, $flocked); -sub forum_filename () {$conf -> {wwwRoot} . $conf -> {files} -> {forum};} -sub message_path () {$conf -> {wwwRoot} . $conf -> {files} -> {messagePath};} +sub forum_filename () {$conf -> {files} -> {forum};} +sub message_path () {$conf -> {files} -> {messagePath};} ################################ @@ -104,7 +104,7 @@ sub check_reply_dupe () { $flocked = 1; - ($threads, $last_thread, $last_message, my $unids) = get_all_threads (forum_filename, 1, 0); + ($threads, $last_thread, $last_message, undef, my $unids) = get_all_threads (forum_filename, 1, 0); ($ftid,$fmid) = split /;/,$dparam{$formdata -> {followUp} -> {name}},2; # Thread existiert nicht @@ -114,7 +114,7 @@ sub check_reply_dupe () { # nur nicht geloeschte Messages beachten for ($i=0; $i < @{$threads -> {$ftid}}; $i++) { if ($threads -> {$ftid} -> [$i] -> {deleted}) { - $+=$threads -> {$ftid} -> [$i] -> {answers};} + $i+=$threads -> {$ftid} -> [$i] -> {answers};} else { $msg{$threads -> {$ftid} -> [$i] -> {mid}}=$i;}} @@ -327,12 +327,16 @@ sub print_error ($;$) { ################################ sub fetch_subject () { - unless (exists ($dparam{$formdata -> {posterCategory} -> {name}}) and - exists ($dparam{$formdata -> {posterSubject} -> {name}})) { + my %must = map {$_ => 1} @{$formmust -> {exists $dparam{$formdata -> {followUp} -> {name}}?'reply':'new'}}; + + if ( ($must{posterCategory} and not exists ($dparam{$formdata -> {posterCategory} -> {name}})) or + ($must{posterSubject} and not exists ($dparam{$formdata -> {posterSubject} -> {name}}))) + { my $filename = message_path.'t'.$ftid.'.xml'; - if (lock_file ($filename)) { + if (-f $filename and lock_file ($filename)) + { my $xml = new XML::DOM::Parser -> parsefile ($filename); violent_unlock_file($filename) unless unlock_file ($filename); @@ -340,7 +344,9 @@ sub fetch_subject () { my $header = get_message_header ($mnode); $dparam{$formdata -> {posterCategory} -> {name}} = $header -> {category}; - $dparam{$formdata -> {posterSubject} -> {name}} = $header -> {subject};}} + $dparam{$formdata -> {posterSubject} -> {name}} = $header -> {subject}; + } + } } ################################ @@ -526,4 +532,4 @@ BEGIN { # ==================================================== # end of fo_posting.pl -# ==================================================== +# ==================================================== \ No newline at end of file