]> git.p6c8.net - selfforum.git/blob - selfforum-cgi/user/fo_view.pl
fo_delete.pl needed access to this configuration file.
[selfforum.git] / selfforum-cgi / user / fo_view.pl
1 #!/usr/bin/perl -w
2
3 ################################################################################
4 # #
5 # File: user/fo_view.pl #
6 # #
7 # Authors: André Malo <nd@o3media.de> #
8 # #
9 # Description: display the forum main file or a single posting #
10 # #
11 ################################################################################
12
13 use strict;
14 use vars qw(
15 $Bin
16 $Shared
17 $Script
18 $Config
19 );
20
21 BEGIN {
22 my $null = $0; $null =~ s/\\/\//g; # for win :-(
23 $Bin = ($null =~ /^(.*)\/.*$/)? $1 : '.';
24 $Shared = "$Bin/../shared";
25 $Config = "$Bin/config";
26 $Script = ($null =~ /^.*\/(.*)$/)? $1 : $null;
27
28 # my $null = $0;
29 # $Bin = ($null =~ /^(.*)\/.*$/)? $1 : '.';
30 # $Config = "$Bin/../../daten/forum/config";
31 # $Shared = "$Bin/../../cgi-shared";
32 # $Script = ($null =~ /^.*\/(.*)$/)? $1 : $null;
33 }
34
35 # setting umask, remove or comment it, if you don't need
36 #
37 umask 006;
38
39 use lib "$Shared";
40 use CGI::Carp qw(fatalsToBrowser);
41
42 use Conf;
43 use Conf::Admin;
44 use Template::Forum;
45 use Template::Posting;
46
47 use CGI qw(
48 param
49 header
50 );
51
52 ################################################################################
53 #
54 # Version check
55 #
56 # last modified:
57 # $Date$ (GMT)
58 # by $Author$
59 #
60 sub VERSION {(q$Revision$ =~ /([\d.]+)\s*$/)[0] or '0.0'}
61
62 print header(
63 -type => 'text/html',
64 -expires => '+10m'
65 );
66
67 my $conf = read_script_conf ($Config, $Shared, $Script);
68
69 my $show = $conf -> {show};
70 my $show_forum = $show -> {Forum};
71
72 my $forum_file = $conf -> {files} -> {forum};
73
74 # check on closed forum
75 #
76 my $main = new Lock($forum_file);
77 if ($main -> masterlocked) {
78
79 my $template = new Template $show_forum -> {templateFile};
80
81 $template -> printscrap (
82 $show_forum -> {assign} -> {errorDoc},
83 { $show_forum -> {assign} -> {errorText} => $template -> insert ($show_forum -> {assign} -> {'notAvailable'}) }
84 );
85 }
86
87 else {
88 my $cgi = $show -> {assign} -> {cgi};
89 my $tree = $show -> {assign} -> {thread};
90 my $adminDefault = read_admin_conf ($conf -> {files} -> {adminDefault});
91
92 my ($tid, $mid) = (param ($cgi -> {thread}), param ($cgi -> {posting}));
93
94 if (defined ($tid) and defined ($mid)) {
95 my $show_posting = $show -> {Posting};
96
97 print_posting_as_HTML (
98 $conf -> {files} -> {messagePath},
99 $show_posting -> {templateFile},
100 { assign => $show_posting -> {assign},
101 thread => $tid,
102 posting => $mid,
103 adminDefault => $adminDefault,
104 messages => $conf -> {template} -> {messages},
105 form => $show_posting -> {form},
106 cgi => $cgi,
107 tree => $tree,
108 firsttime => 1,
109 cachepath => $conf -> {files} -> {cachePath}
110 }
111 );
112 }
113
114 else {
115 print_forum_as_HTML (
116 $forum_file,
117 $show_forum -> {templateFile},
118 { assign => $show_forum -> {assign},
119 adminDefault => $adminDefault,
120 cgi => $cgi,
121 tree => $tree
122 }
123 );
124 }
125 }
126
127
128 #
129 #
130 ### end of fo_view.pl ##########################################################

patrick-canterino.de