]> git.p6c8.net - selfforum.git/blob - selfforum-cgi/user/fo_view.pl
Conf.pm: turned $Bin into $Config (we're now interested in config path not longer...
[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($Bin $Shared $Script $Config);
15
16 BEGIN {
17 my $null = $0; $null =~ s/\\/\//g; # for win :-(
18 $Bin = ($null =~ /^(.*)\/.*$/)? $1 : '.';
19 $Shared = "$Bin/../shared";
20 $Config = "$Bin/config";
21 $Script = ($null =~ /^.*\/(.*)$/)? $1 : $null;
22 }
23
24 use lib "$Shared";
25 use CGI::Carp qw(fatalsToBrowser);
26
27 use Conf;
28 use Conf::Admin;
29 use Template::Forum;
30 use Template::Posting;
31
32 use CGI qw(param header);
33
34 print header(-type => 'text/html');
35
36 my $conf = read_script_conf ($Config, $Shared, $Script);
37
38 my $show = $conf -> {show};
39 my $show_forum = $show -> {Forum};
40 my $show_posting = $show -> {Posting};
41 my $cgi = $show -> {assign} -> {cgi};
42 my $tree = $show -> {assign} -> {thread};
43 my $adminDefault = read_admin_conf ($conf -> {files} -> {adminDefault});
44
45 my $forum_file = $conf -> {files} -> {forum};
46 my $message_path = $conf -> {files} -> {messagePath};
47
48 my ($tid, $mid) = (param ($cgi -> {thread}), param ($cgi -> {posting}));
49
50 if (defined ($tid) and defined ($mid)) {
51 print_posting_as_HTML (
52 $message_path,
53 $show_posting -> {templateFile},
54 { assign => $show_posting -> {assign},
55 thread => $tid,
56 posting => $mid,
57 adminDefault => $adminDefault,
58 messages => $conf -> {template} -> {messages},
59 form => $show_posting -> {form},
60 cgi => $cgi,
61 tree => $tree
62 }
63 );
64 }
65
66 else {
67 print_forum_as_HTML (
68 $forum_file,
69 $show_forum -> {templateFile},
70 { assign => $show_forum -> {assign},
71 adminDefault => $adminDefault,
72 cgi => $cgi,
73 tree => $tree
74 }
75 );
76 }
77
78 #
79 #
80 ### end of fo_view.pl ##########################################################

patrick-canterino.de