]> git.p6c8.net - selfforum.git/blob - selfforum-cgi/user/fo_arcview.pl
_thread.pm: If main forum view is displayed by another script than the
[selfforum.git] / selfforum-cgi / user / fo_arcview.pl
1 #!/usr/bin/perl -w
2
3 ################################################################################
4 # #
5 # File: user/fo_arcview.pl #
6 # #
7 # Authors: Frank Schönmann <fs@tower.de> #
8 # #
9 # Description: archive browser #
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/../../cgi-shared";
25 # $Config = "$Bin/../../cgi-config/forum";
26 # $Script = ($null =~ /^.*\/(.*)$/)? $1 : $null;
27
28 my $null = $0;
29 $Bin = ($null =~ /^(.*)\/.*$/)? $1 : '.';
30 $Config = "$Bin/../../cgi-config/forum";
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 000;
38
39 use lib "$Shared";
40 use CGI::Carp qw(fatalsToBrowser);
41
42 use Conf;
43 use Conf::Admin;
44 use Template::Archive qw(
45 print_overview_as_HTML
46 print_year_as_HTML
47 print_month_as_HTML
48 print_thread_as_HTML
49 );
50
51 use CGI qw(param header path_info);
52
53 ################################################################################
54 #
55 # Version check
56 #
57 # last modified:
58 # $Date$ (GMT)
59 # by $Author$
60 #
61 sub VERSION {(q$Revision$ =~ /([\d.]+)\s*$/)[0] or '0.0'}
62
63 print header(-type => 'text/html');
64
65 my $conf = read_script_conf($Config, $Shared, $Script);
66 my $show = $conf->{'show'};
67 my $cgi = $show->{'assign'}->{'cgi'};
68 my $show_archive = $show->{'Archive'};
69 my $adminDefault = read_admin_conf($conf->{'files'}->{'adminDefault'});
70
71 my ($year, $month, $tid, $mid);
72
73 # tid is thread id, mid is not used yet
74 if (my $path_info = path_info()) {
75 (undef, $year, $month, $tid, $mid) = split "/", $path_info;
76 } else {
77 ($year, $month, $tid, $mid) =
78 (param($cgi->{'year'}), param($cgi->{'month'}), param($cgi->{'thread'}), param($cgi->{'posting'}));
79 }
80
81 if ($year) {
82 if ($month) {
83 if ($tid) {
84 if ($mid) {
85 # print_msg_as_HTML();
86 } else {
87 print_thread_as_HTML(
88 $conf->{'files'}->{'archivePath'} . $year .'/'. $month .'/t'. $tid . '.xml',
89 $show_archive->{'templateFile'},
90 {
91 'assign' => $show_archive->{'assign'},
92 'adminDefault' => $adminDefault,
93 'cgi' => $cgi,
94 'year' => $year,
95 'month' => $month,
96 'thread' => $tid,
97 'posting' => $mid,
98 'tree' => $show->{'assign'}->{'thread'}
99
100 }
101 );
102 }
103 } else {
104 print_month_as_HTML(
105 $conf->{'files'}->{'archivePath'} . $year . '/' . $month . '/' . $conf->{'files'}->{'archiveIndex'},
106 $show_archive->{'templateFile'},
107 {
108 'assign' => $show_archive->{'assign'},
109 'year' => $year,
110 'month' => $month
111 }
112 );
113 }
114 } else {
115 print_year_as_HTML(
116 $conf->{'files'}->{'archivePath'} . $year . '/',
117 $show_archive->{'templateFile'},
118 {
119 'assign' => $show_archive->{'assign'},
120 'year' => $year
121 }
122 );
123 }
124 } else {
125 print_overview_as_HTML(
126 $conf->{'files'}->{'archivePath'},
127 $show_archive->{'templateFile'},
128 {
129 'assign' => $show_archive->{'assign'}
130 }
131 );
132 }
133
134 #
135 #
136 ### end of fo_view.pl ##########################################################

patrick-canterino.de