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

patrick-canterino.de