Changeset 15170 for gsdl/trunk
- Timestamp:
- 2008-04-02T18:23:41+13:00 (16 years ago)
- Location:
- gsdl/trunk/cgi-bin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/cgi-bin/gliserver.pl
r14260 r15170 1 #!/usr/bin/perl -w 1 2 #!perl -w 2 3 # Need to specify the full path of Perl above … … 36 37 my $mail_smtp_server = "smtp.server"; # Set this appropriately 37 38 38 39 39 sub main 40 40 { … … 121 121 elsif ($cmd eq "upload-collection-file") { 122 122 &upload_collection_file($gsdl_cgi, $username, $timestamp); 123 } 123 } 124 elsif ($cmd eq "file-exists") { 125 &file_exists($gsdl_cgi); 126 } 124 127 else { 125 128 $gsdl_cgi->generate_error("Unrecognised command: '$cmd'"); 126 129 } 127 130 } 128 129 131 130 132 sub authenticate_user … … 511 513 } 512 514 515 # Method that will check if the given file exists 516 # No error message: all messages generated are OK messages 517 # This method will simply state whether the file exists or does not exist. 518 sub file_exists 519 { 520 my ($gsdl_cgi, $username, $timestamp) = @_; 521 522 my ($gsdl_cgi) = @_; 523 524 my $collection = $gsdl_cgi->clean_param("c"); 525 if ((!defined $collection) || ($collection =~ m/^\s*$/)) { 526 $gsdl_cgi->generate_error("No collection specified."); 527 } 528 my $file = $gsdl_cgi->clean_param("file"); 529 if ((!defined $file) || ($file =~ m/^\s*$/)) { 530 $gsdl_cgi->generate_error("No file specified."); 531 } 532 $file =~ s/\|/&util::get_dirsep()/eg; # Convert the '|' characters into whatever is right for this OS 533 534 # Not necessary: checking whether the user is authenticated to query existance of the file 535 #&authenticate_user($gsdl_cgi, $username, $collection); 536 537 my $gsdlhome = $ENV{'GSDLHOME'}; 538 my $collection_directory = &util::filename_cat($gsdlhome, "collect", $collection); 539 $gsdl_cgi->checked_chdir($collection_directory); 540 541 # Check that the collection file exists 542 if (-e $file) { 543 $gsdl_cgi->generate_ok_message("File $file exists."); 544 } else { 545 $gsdl_cgi->generate_ok_message("File $file does not exist."); 546 } 547 } 513 548 514 549 sub download_collection_file … … 746 781 &lock_collection($gsdl_cgi, $username, $collection) unless ($script eq "mkcol.pl"); 747 782 748 # Last argument is the collection name, except for explode_metadata_database.pl 783 # Last argument is the collection name, except for explode_metadata_database.pl and 784 # replace_srcdoc_with_html (where there's a "file" option followed by the filename. These two preceed the collection name) 749 785 my $perl_args = $collection; 750 if ($script eq "explode_metadata_database.pl" ) {786 if ($script eq "explode_metadata_database.pl" || $script eq "replace_srcdoc_with_html.pl") { 751 787 # Last argument is the file to be exploded 752 788 my $file = $gsdl_cgi->clean_param("file"); … … 755 791 } 756 792 $gsdl_cgi->delete("file"); 757 $perl_args = $file; 793 $file =~ s/ /\\ /g; # escape all spaces in filename with a backslash, i.e. "\ " 794 $perl_args = $file; 758 795 } 759 796 -
gsdl/trunk/cgi-bin/gsdlsite.cfg
r14026 r15170 4 4 5 5 # points to the GSDLHOME directory 6 gsdlhome **GSDLHOME**6 gsdlhome "/research/ak19/Greenstone2SVN/gsdl" 7 7 8 8 # this is the http address of GSDLHOME 9 9 # if your webservers DocumentRoot is set to $GSDLHOME 10 10 # then httpprefix can remain commented out 11 #httpprefix /gsdl 11 httpprefix /gsdlsvn 12 12 13 13 # this is the http address of the directory which … … 15 15 # if your webservers DocumentRoot is set to $GSDLHOME 16 16 # then httpimg will be /images 17 httpimg / images17 httpimg /gsdlsvn/images 18 18 19 19 # should contain the http address of this cgi script. This
Note:
See TracChangeset
for help on using the changeset viewer.