]> git.p6c8.net - selfforum.git/blob - selfforum-cgi/user/fo_view.pl
added version check
[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 );
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 # Version check
53 #
54 $VERSION = do { my @r =(q$Revision$ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
55
56 print header(
57 -type => 'text/html',
58 -expires => '+10m'
59 );
60
61 my $conf = read_script_conf ($Config, $Shared, $Script);
62
63 my $show = $conf -> {show};
64 my $show_forum = $show -> {Forum};
65 my $show_posting = $show -> {Posting};
66 my $cgi = $show -> {assign} -> {cgi};
67 my $tree = $show -> {assign} -> {thread};
68 my $adminDefault = read_admin_conf ($conf -> {files} -> {adminDefault});
69
70 my $forum_file = $conf -> {files} -> {forum};
71 my $message_path = $conf -> {files} -> {messagePath};
72
73 my ($tid, $mid) = (param ($cgi -> {thread}), param ($cgi -> {posting}));
74
75 if (defined ($tid) and defined ($mid)) {
76 print_posting_as_HTML (
77 $message_path,
78 $show_posting -> {templateFile},
79 { assign => $show_posting -> {assign},
80 thread => $tid,
81 posting => $mid,
82 adminDefault => $adminDefault,
83 messages => $conf -> {template} -> {messages},
84 form => $show_posting -> {form},
85 cgi => $cgi,
86 tree => $tree,
87 firsttime => 1,
88 cachepath => $conf -> {files} -> {cachePath}
89 }
90 );
91 }
92
93 else {
94 print_forum_as_HTML (
95 $forum_file,
96 $show_forum -> {templateFile},
97 { assign => $show_forum -> {assign},
98 adminDefault => $adminDefault,
99 cgi => $cgi,
100 tree => $tree
101 }
102 );
103 }
104
105 #
106 #
107 ### end of fo_view.pl ##########################################################

patrick-canterino.de