source: main/trunk/greenstone2/cgi-bin/image-server.pl@ 24872

Last change on this file since 24872 was 24872, checked in by ak19, 12 years ago

First set of changes to do with migration of cgi-bin into common-src, so that upon make install, common-src\cgi-bin will be installed in cgi-bin\GSDLOS(GSDLARCH). After this commit (to do with the contents of the files), cgi-bin itself will be moved.

  • Property svn:executable set to *
File size: 1.2 KB
Line 
1#!/usr/bin/perl -w
2# Need to specify the full path of Perl above
3
4
5use strict;
6
7
8# Set this to 1 to work around IIS 6 craziness
9my $iis6_mode = 0;
10
11
12# IIS 6: for some reason, IIS runs this script with the working directory set to the Greenstone
13# directory rather than the cgi-bin directory, causing lots of stuff to fail
14if ($iis6_mode)
15{
16 # Change into cgi-bin\<OS> directory
17 chdir("cgi-bin");
18 if(defined $ENV{'GSDLARCH'}) {
19 chdir($ENV{'GSDLOS'}.$ENV{'GSDLARCH'});
20 } else {
21 chdir($ENV{'GSDLOS'});
22 }
23}
24
25
26# We use require and an eval here (instead of "use") to catch any errors loading the module (for IIS)
27eval("require \"gsdlCGI.pm\"");
28if ($@)
29{
30 print STDOUT "Content-type:text/plain\n\n";
31 print STDOUT "ERROR: $@\n";
32 exit 0;
33}
34
35
36
37sub main
38{
39 my $gsdl_cgi = new gsdlCGI();
40
41 # Load the Greenstone modules that we need to use
42 $gsdl_cgi->setup_gsdl();
43
44 my $gsdlhome = $ENV{'GSDLHOME'};
45 $gsdl_cgi->checked_chdir($gsdlhome);
46
47 require cgiactions::imageaction;
48
49 $gsdl_cgi->parse_cgi_args();
50
51 # We don't want the gsdlCGI module to return errors and warnings in XML
52 $gsdl_cgi->{'xml'} = 0;
53
54 my $action = new imageaction($gsdl_cgi,$iis6_mode);
55
56 $action->do_action();
57}
58
59
60
61
62&main();
Note: See TracBrowser for help on using the repository browser.