chiark / gitweb /
Merge branch 'master' of ../live-urcm
[modbot-mtm.git] / webstump / scripts / webstump.pl
1 #!/usr/bin/perl
2 #
3 # This is the main webstump cgi script.
4 #
5 # Figure out the home directory
6 #
7
8 if( !($0 =~ /\/scripts\/webstump\.pl$/) ) {
9   die "This script can only be called with full path name!!!";
10 }
11
12 $webstump_home = $0;
13 $webstump_home =~ s/\/scripts\/webstump\.pl$//;
14
15 my $logfile= "$webstump_home/../errs";
16 open STDERR, ">> $logfile" or die "$logfile $!";
17
18 $webstump_home =~ /(^.*$)/;
19 $webstump_home = $1;
20
21 require "$webstump_home/config/webstump.cfg";
22 require "$webstump_home/scripts/webstump.lib.pl";
23 require "$webstump_home/scripts/filter.lib.pl";
24 require "$webstump_home/scripts/html_output.pl";
25 #require "$webstump_home/scripts/gatekeeper.lib";
26 require "$webstump_home/scripts/mime-parsing.lib";
27
28 $html_mode = "yes";
29
30 &init_webstump;
31
32 ######################################################################
33
34 %request = &readWebRequest;
35
36 $command = "";
37
38 if( defined %request ) {
39   &disinfect_request;
40   $command = $request{'action'} if( defined $request{'action'} );
41 }
42
43 if( ! $command ) {
44   &html_welcome_page;
45 } else {
46   &processWebRequest( $command );
47 }