X-Git-Url: https://git.p6c8.net/selfforum.git/blobdiff_plain/65d6cbd5043e3d211001db12bcf54efbd62a9cdb..1bc8d7a9de9ec3bcd8bd1d494449a5dcf4250b71:/selfforum-cgi/shared/Template/Archive.pm diff --git a/selfforum-cgi/shared/Template/Archive.pm b/selfforum-cgi/shared/Template/Archive.pm index ec5ee22..08d215c 100644 --- a/selfforum-cgi/shared/Template/Archive.pm +++ b/selfforum-cgi/shared/Template/Archive.pm @@ -73,7 +73,33 @@ sub print_month_as_HTML($$$) { my $template = new Template $tempfile; - my $threads = get_all_threads($mainfile, KILL_DELETED); + # + # check if XML file exists + # + unless (-e $mainfile) { + print ${$template->scrap( + $assign->{'error'}, + { + $assign->{'errorText'} => "Es existieren keine Nachrichten für diesen Monat." + } + )}; + return; + } + + # + # try locking and read/parse threads + # + my ($threads, $locked); + unless ($locked = lock_file($mainfile) and $threads = get_all_threads($mainfile, KILL_DELETED)) { + print ${$template->scrap( + $assign->{'error'}, + { + $assign->{'errorText'} => "Fehler beim Locking." + } + )}; + return; + } + unlock_file($mainfile); my $tmplparam = { $assign->{'year'} => $param->{'year'}, @@ -136,6 +162,19 @@ sub print_thread_as_HTML($$$) { my $template = new Template $tempfile; + # + # check if XML file exists + # + unless (-e $mainfile) { + print ${$template->scrap( + $assign->{'error'}, + { + $assign->{'errorText'} => "Der gewünschte Thread existiert nicht." + } + )}; + return; + } + my $view = get_view_params ({ 'adminDefault' => $param->{'adminDefault'} }); @@ -173,7 +212,8 @@ sub print_thread_as_HTML($$$) { print ${$template->scrap( $assign->{'threadDocStart'}, - $tmplparam + $tmplparam, + 1 )}; # @@ -184,7 +224,7 @@ sub print_thread_as_HTML($$$) { my $header = get_message_header($mnode); my $body = get_message_body($xml, 'm'.$_->{'mid'}); - my $text = message_field ( + my $text = message_field( $body, { 'quoteChars' => plain($view->{'quoteChars'}), @@ -206,7 +246,8 @@ sub print_thread_as_HTML($$$) { $assign->{'msgCategory'} => plain($header->{'category'}), $assign->{'msgSubject'} => plain($header->{'subject'}), $assign->{'msgBody'} => $text - } + }, + 1 )}; } @@ -215,7 +256,8 @@ sub print_thread_as_HTML($$$) { # print ${$template->scrap( $assign->{'threadDocEnd'}, - $tmplparam + $tmplparam, + 1 )}; }