From: ndparker <> Date: Sun, 29 Jul 2001 13:03:44 +0000 (+0000) Subject: now, if main file is master locked, fo_view.pl won't show any single message X-Git-Url: https://git.p6c8.net/selfforum.git/commitdiff_plain/7cfc9e17caf89a9b009e8fa2c65351255687706e?ds=sidebyside now, if main file is master locked, fo_view.pl won't show any single message --- 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