From 7cfc9e17caf89a9b009e8fa2c65351255687706e Mon Sep 17 00:00:00 2001 From: ndparker <> Date: Sun, 29 Jul 2001 13:03:44 +0000 Subject: [PATCH] now, if main file is master locked, fo_view.pl won't show any single message --- selfforum-cgi/user/fo_view.pl | 101 ++++++++++++++++++++-------------- 1 file changed, 59 insertions(+), 42 deletions(-) diff --git a/selfforum-cgi/user/fo_view.pl b/selfforum-cgi/user/fo_view.pl index e010f37..6cd424d 100644 --- a/selfforum-cgi/user/fo_view.pl +++ b/selfforum-cgi/user/fo_view.pl @@ -19,22 +19,22 @@ use vars qw( ); 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; + my $null = $0; $null =~ s/\\/\//g; # for win :-( $Bin = ($null =~ /^(.*)\/.*$/)? $1 : '.'; - $Config = "$Bin/../../cgi-config/forum"; - $Shared = "$Bin/../../cgi-shared"; + $Shared = "$Bin/../shared"; + $Config = "$Bin/config"; $Script = ($null =~ /^.*\/(.*)$/)? $1 : $null; + +# my $null = $0; +# $Bin = ($null =~ /^(.*)\/.*$/)? $1 : '.'; +# $Config = "$Bin/../../daten/forum/config"; +# $Shared = "$Bin/../../cgi-shared"; +# $Script = ($null =~ /^.*\/(.*)$/)? $1 : $null; } # setting umask, remove or comment it, if you don't need # -umask 000; +umask 006; use lib "$Shared"; use CGI::Carp qw(fatalsToBrowser); @@ -68,46 +68,63 @@ my $conf = read_script_conf ($Config, $Shared, $Script); my $show = $conf -> {show}; my $show_forum = $show -> {Forum}; -my $show_posting = $show -> {Posting}; -my $cgi = $show -> {assign} -> {cgi}; -my $tree = $show -> {assign} -> {thread}; -my $adminDefault = read_admin_conf ($conf -> {files} -> {adminDefault}); my $forum_file = $conf -> {files} -> {forum}; -my $message_path = $conf -> {files} -> {messagePath}; - -my ($tid, $mid) = (param ($cgi -> {thread}), param ($cgi -> {posting})); - -if (defined ($tid) and defined ($mid)) { - print_posting_as_HTML ( - $message_path, - $show_posting -> {templateFile}, - { assign => $show_posting -> {assign}, - thread => $tid, - posting => $mid, - adminDefault => $adminDefault, - messages => $conf -> {template} -> {messages}, - form => $show_posting -> {form}, - cgi => $cgi, - tree => $tree, - firsttime => 1, - cachepath => $conf -> {files} -> {cachePath} - } + +# check on closed forum +# +my $main = new Lock($forum_file); +if ($main -> masterlocked) { + + my $template = new Template $show_forum -> {templateFile}; + + $template -> printscrap ( + $show_forum -> {assign} -> {errorDoc}, + { $show_forum -> {assign} -> {errorText} => $template -> insert ($show_forum -> {assign} -> {'notAvailable'}) } ); } else { - print_forum_as_HTML ( - $forum_file, - $show_forum -> {templateFile}, - { assign => $show_forum -> {assign}, - adminDefault => $adminDefault, - cgi => $cgi, - tree => $tree - } - ); + my $cgi = $show -> {assign} -> {cgi}; + my $tree = $show -> {assign} -> {thread}; + my $adminDefault = read_admin_conf ($conf -> {files} -> {adminDefault}); + + my ($tid, $mid) = (param ($cgi -> {thread}), param ($cgi -> {posting})); + + if (defined ($tid) and defined ($mid)) { + my $show_posting = $show -> {Posting}; + + print_posting_as_HTML ( + $conf -> {files} -> {messagePath}, + $show_posting -> {templateFile}, + { assign => $show_posting -> {assign}, + thread => $tid, + posting => $mid, + adminDefault => $adminDefault, + messages => $conf -> {template} -> {messages}, + form => $show_posting -> {form}, + cgi => $cgi, + tree => $tree, + firsttime => 1, + cachepath => $conf -> {files} -> {cachePath} + } + ); + } + + else { + print_forum_as_HTML ( + $forum_file, + $show_forum -> {templateFile}, + { assign => $show_forum -> {assign}, + adminDefault => $adminDefault, + cgi => $cgi, + tree => $tree + } + ); + } } + # # ### end of fo_view.pl ########################################################## \ No newline at end of file -- 2.34.1