]> git.p6c8.net - selfforum.git/blob - selfforum-cgi/user/fo_view.pl
37260e3278e766ab0073c1687877d0caec6eb0f0
[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; #$null =~ s/\\/\//g; # for win :-(
29 $Bin = ($null =~ /^(.*)\/.*$/)? $1 : '.';
30 $Config = "$Bin/../../../cgi-config/devforum";
31 $Shared = "$Bin/../../../cgi-shared";
32 $Script = ($null =~ /^.*\/(.*)$/)? $1 : $null;
33 }
34
35 use lib "$Shared";
36 use CGI::Carp qw(fatalsToBrowser);
37
38 use Conf;
39 use Conf::Admin;
40 use Template::Forum;
41 use Template::Posting;
42
43 use CGI qw(param header);
44
45 print header(-type => 'text/html');
46
47 my $conf = read_script_conf ($Config, $Shared, $Script);
48
49 my $show = $conf -> {show};
50 my $show_forum = $show -> {Forum};
51 my $show_posting = $show -> {Posting};
52 my $cgi = $show -> {assign} -> {cgi};
53 my $tree = $show -> {assign} -> {thread};
54 my $adminDefault = read_admin_conf ($conf -> {files} -> {adminDefault});
55
56 my $forum_file = $conf -> {files} -> {forum};
57 my $message_path = $conf -> {files} -> {messagePath};
58
59 my ($tid, $mid) = (param ($cgi -> {thread}), param ($cgi -> {posting}));
60
61 if (defined ($tid) and defined ($mid)) {
62 print_posting_as_HTML (
63 $message_path,
64 $show_posting -> {templateFile},
65 { assign => $show_posting -> {assign},
66 thread => $tid,
67 posting => $mid,
68 adminDefault => $adminDefault,
69 messages => $conf -> {template} -> {messages},
70 form => $show_posting -> {form},
71 cgi => $cgi,
72 tree => $tree,
73 firsttime => 1,
74 cachefile => $conf -> {files} -> {cacheFile}
75 }
76 );
77 }
78
79 else {
80 print_forum_as_HTML (
81 $forum_file,
82 $show_forum -> {templateFile},
83 { assign => $show_forum -> {assign},
84 adminDefault => $adminDefault,
85 cgi => $cgi,
86 tree => $tree
87 }
88 );
89 }
90
91 #
92 #
93 ### end of fo_view.pl ##########################################################

patrick-canterino.de