Subversion Repositories DevTools

Rev

Rev 1305 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1305 dpurdie 1
#!C:/Perl/bin/perl.exe -w
2
 
3
# !!!! THIS FILE IS AUTO-GENERATED by bin/install.pl !!!
4
# !!!! DO NOT EDIT !!!
5
# The base source is bin/codestriker.pl.base.
6
 
7
 
8
###############################################################################
9
# Codestriker: Copyright (c) 2001, 2002 David Sitsky.  All rights reserved.
10
# sits@users.sourceforge.net
11
#
12
# This program is free software; you can redistribute it and modify it under
13
# the terms of the GPL.
14
 
15
# This is the top level package which receives all HTTP requests, and
16
# delegates it to the appropriate Action module.
17
 
18
require 5.8.0;
19
 
20
# Set this to the location of the Codestriker libraries on your system.
21
# Ideally, this should be done in the apache configs, but trying to do this
22
# in an easy way for Apache1/Apache2 with/without mod_perl with/without taint
23
# checking turned out to be a major headache.  For mod_perl, setting this
24
# ensures the first time Codestiker is loaded, it can be compiled properly,
25
# even if @INC is blatted later.  Also note all the use declarations below
26
# effectively "pre-load" all of the Codestriker modules in the system, as the
27
# modules below load all of their supporting modules.  That is why the
28
# template plugins are "pre-loaded" here.
29
 
30
use FindBin;
31
use lib "$FindBin::Bin/../../lib";
32
 
33
use strict;
34
 
35
use CGI qw/:standard :html3/;
36
use CGI::Carp 'fatalsToBrowser';
37
 
38
use Codestriker;
39
use Codestriker::Http::Input;
40
use Codestriker::Http::Response;
41
use Codestriker::Action::CreateTopic;
42
use Codestriker::Action::EditComment;
43
use Codestriker::Action::Search;
44
use Codestriker::Action::ListTopics;
45
use Codestriker::Action::DownloadTopic;
46
use Codestriker::Action::ListProjects;
47
use Codestriker::Action::EditProject;
48
use Codestriker::Action::CreateProject;
49
use Codestriker::Action::MetricsReport;
50
use Codestriker::Action::SubmitEditTopicProperties;
51
use Codestriker::Action::SubmitEditTopicMetrics;
52
use Codestriker::Action::SubmitEditTopicsState;
53
use Codestriker::Action::SubmitEditCommentsState;
54
use Codestriker::Action::SubmitEditProject;
55
use Codestriker::Action::SubmitNewProject;
56
use Codestriker::Action::SubmitNewTopic;
57
use Codestriker::Action::SubmitNewComment;
58
use Codestriker::Action::SubmitSearch;
59
use Codestriker::Action::ViewTopicFile;
60
use Codestriker::Action::ViewTopicInfo;
61
use Codestriker::Action::ViewTopic;
62
use Codestriker::Action::ViewTopicProperties;
63
use Codestriker::Action::ViewTopicComments;
64
 
65
 
66
use Codestriker::Template::Plugin::AutomagicLinks;
67
use Codestriker::Template::Plugin::JavascriptEscape;
68
use Codestriker::Template::Plugin::StringObfuscator;
69
use Codestriker::Template::Plugin::FormatWhitespace;
70
 
71
# Set the temp file location, if one has been specified.
72
if (defined $Codestriker::tmpdir && $Codestriker::tmpdir ne '') {
73
    $CGITempFile::TMPDIRECTORY = $Codestriker::tmpdir;
74
}
75
 
76
# Set the PATH to something sane if we aren't running under windows.
77
# For a lot of annoying reasons, we can't run Codestriker in
78
# tainted mode under Win32.
79
if (Codestriker::is_windows()) {
80
    $ENV{'PATH'} = '';
81
} else {
82
    $ENV{'PATH'} = '/bin:/usr/bin';
83
}
84
 
85
# Prototypes of subroutines used in this module.
86
sub main();
87
 
88
main;
89
 
90
sub main() {
91
    # Initialise Codestriker, load up the configuration file.
92
    Codestriker->initialise("$FindBin::Bin");
93
 
94
    # Set BASEDIR to be the root of the installation
95
    $Codestriker::BASEDIR = "$FindBin::Bin/../..";
96
 
97
 
98
 
99
    # valid XML::RSS not found
100
    $Codestriker::rss_enabled = 0;
101
 
102
 
103
    # If allow_delete is defined, but topic state 'Delete' is not, add it
104
    # in.  This accounts for older configuration files.
105
    if (defined $Codestriker::allow_delete && $Codestriker::allow_delete &&
106
	(! grep /^Deleted$/, @Codestriker::topic_states)) {
107
	push @Codestriker::topic_states, 'Deleted';
108
    }
109
 
110
    # Check if the old $allow_comment_email configuration option has been
111
    # specified in the config file, rather than the new $email_send_options
112
    # setting.
113
    if (defined $Codestriker::allow_comment_email &&
114
	! defined $Codestriker::email_send_options) {
115
	$Codestriker::email_send_options = 
116
	{
117
	  comments_sent_to_topic_author => $Codestriker::allow_comment_email,
118
	  comments_sent_to_commenter => $Codestriker::allow_comment_email,
119
	  topic_state_change_sent_to_reviewers => 0
120
	};
121
    }
122
 
123
    # Limit the size of the posts that can be done.
124
    $CGI::POST_MAX=$Codestriker::DIFF_SIZE_LIMIT;
125
 
126
    # Load the CGI object, and prepare the HTTP response.
127
    my $query = new CGI;
128
    my $http_response = Codestriker::Http::Response->new($query);
129
 
130
    # Process the HTTP input to ensure it is consistent.
131
    my $http_input = Codestriker::Http::Input->new($query, $http_response);
132
    $http_input->process();
133
 
134
    # Delegate the request to the appropriate Action module.
135
    my $action = $http_input->get("action");
136
    if ($action eq "create") {
137
	Codestriker::Action::CreateTopic->process($http_input, $http_response);
138
    } elsif ($action eq "submit_new_topic") {
139
	Codestriker::Action::SubmitNewTopic->process($http_input,
140
						     $http_response);
141
    } elsif ($action eq "view") {
142
	Codestriker::Action::ViewTopic->process($http_input, $http_response);
143
    } elsif ($action eq "view_topic_properties") {
144
	Codestriker::Action::ViewTopicProperties->process($http_input,
145
							  $http_response);
146
    } elsif ($action eq "viewinfo") {
147
	Codestriker::Action::ViewTopicInfo->process($http_input,
148
						    $http_response);
149
    } elsif ($action eq "edit") {
150
	Codestriker::Action::EditComment->process($http_input, $http_response);
151
    } elsif ($action eq "submit_comment") {
152
	Codestriker::Action::SubmitNewComment->process($http_input,
153
						       $http_response);
154
    } elsif ($action eq "view_file") {
155
	Codestriker::Action::ViewTopicFile->process($http_input,
156
						    $http_response);
157
    } elsif ($action eq "search") {
158
	Codestriker::Action::Search->process($http_input, $http_response);
159
    } elsif ($action eq "submit_search") {
160
	Codestriker::Action::SubmitSearch->process($http_input,
161
						   $http_response);
162
    } elsif ($action eq "list_topics") {
163
	Codestriker::Action::ListTopics->process($http_input, $http_response);
164
    } elsif ($action eq "download") {
165
	Codestriker::Action::DownloadTopic->process($http_input,
166
						    $http_response);
167
    } elsif ($action eq "edit_topic_properties") {
168
        Codestriker::Action::SubmitEditTopicProperties->process($http_input,
169
								$http_response);
170
    } elsif ($action eq "edit_topic_metrics") {
171
        Codestriker::Action::SubmitEditTopicMetrics->process($http_input,
172
							     $http_response);
173
    } elsif ($action eq "change_topics_state") {
174
        Codestriker::Action::SubmitEditTopicsState->process($http_input,
175
							    $http_response);
176
    } elsif ($action eq "list_comments") {
177
	Codestriker::Action::ViewTopicComments->process($http_input,
178
						   $http_response);
179
    } elsif ($action eq "change_comments_state") {
180
	Codestriker::Action::SubmitEditCommentsState->process($http_input,
181
						     $http_response);
182
    } elsif ($action eq "list_projects") {
183
	Codestriker::Action::ListProjects->process($http_input,
184
						   $http_response);
185
    } elsif ($action eq "edit_project") {
186
	Codestriker::Action::EditProject->process($http_input,
187
						  $http_response);
188
    } elsif ($action eq "create_project") {
189
	Codestriker::Action::CreateProject->process($http_input,
190
						    $http_response);
191
    } elsif ($action eq "submit_project") {
192
	Codestriker::Action::SubmitNewProject->process($http_input,
193
						    $http_response);
194
    } elsif ($action eq "submit_editproject") {
195
	Codestriker::Action::SubmitEditProject->process($http_input,
196
							$http_response);
197
    } elsif ($action eq "metrics_report") {
198
	Codestriker::Action::MetricsReport->process($http_input,
199
						    $http_response);
200
    } elsif ($action eq "metrics_download") {
201
	Codestriker::Action::MetricsReport->process_download($http_input,
202
							     $http_response);
203
 
204
 
205
    } else {
206
	# Default action is to list topics that are in state open if the
207
	# list functionality is enabled, otherwise go to the create topic
208
	# screen.
209
	if ($Codestriker::allow_searchlist) {
210
	    Codestriker::Action::ListTopics->process($http_input,
211
						     $http_response);
212
        } else {
213
	    Codestriker::Action::CreateTopic->process($http_input,
214
						      $http_response);
215
	}
216
    }
217
}