]> git.p6c8.net - selfforum.git/blob - selfforum-cgi/user/fo_view.pl
added version check and comments
[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>, 2001-04-01 #
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 $VERSION
20 );
21
22 BEGIN {
23 my $null = $0; $null =~ s/\\/\//g; # for win :-(
24 $Bin = ($null =~ /^(.*)\/.*$/)? $1 : '.';
25 $Shared = "$Bin/../shared";
26 $Config = "$Bin/config";
27 $Script = ($null =~ /^.*\/(.*)$/)? $1 : $null;
28
29 # my $null = $0;
30 # $Bin = ($null =~ /^(.*)\/.*$/)? $1 : '.';
31 # $Config = "$Bin/../../daten/forum/config";
32 # $Shared = "$Bin/../../cgi-shared";
33 # $Script = ($null =~ /^.*\/(.*)$/)? $1 : $null;
34 }
35
36 # setting umask, remove or comment it, if you don't need
37 #
38 umask 006;
39
40 use lib "$Shared";
41 use CGI::Carp qw(fatalsToBrowser);
42
43 use Conf;
44 use Conf::Admin;
45 use Template::Forum;
46 use Template::Posting;
47
48 use CGI qw(
49 param
50 header
51 );
52
53 # Version check
54 #
55 $VERSION = do { my @r =(q$Revision$ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
56
57 print header(
58 -type => 'text/html',
59 -expires => '+10m'
60 );
61
62 my $conf = read_script_conf ($Config, $Shared, $Script);
63
64 my $show = $conf -> {show};
65 my $show_forum = $show -> {Forum};
66 my $show_posting = $show -> {Posting};
67 my $cgi = $show -> {assign} -> {cgi};
68 my $tree = $show -> {assign} -> {thread};
69 my $adminDefault = read_admin_conf ($conf -> {files} -> {adminDefault});
70
71 my $forum_file = $conf -> {files} -> {forum};
72 my $message_path = $conf -> {files} -> {messagePath};
73
74 my ($tid, $mid) = (param ($cgi -> {thread}), param ($cgi -> {posting}));
75
76 if (defined ($tid) and defined ($mid)) {
77 print_posting_as_HTML (
78 $message_path,
79 $show_posting -> {templateFile},
80 { assign => $show_posting -> {assign},
81 thread => $tid,
82 posting => $mid,
83 adminDefault => $adminDefault,
84 messages => $conf -> {template} -> {messages},
85 form => $show_posting -> {form},
86 cgi => $cgi,
87 tree => $tree,
88 firsttime => 1,
89 cachepath => $conf -> {files} -> {cachePath}
90 }
91 );
92 }
93
94 else {
95 print_forum_as_HTML (
96 $forum_file,
97 $show_forum -> {templateFile},
98 { assign => $show_forum -> {assign},
99 adminDefault => $adminDefault,
100 cgi => $cgi,
101 tree => $tree
102 }
103 );
104 }
105
106 #
107 #
108 ### end of fo_view.pl ##########################################################

patrick-canterino.de