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

patrick-canterino.de