#!C:\Perl\bin\perl
use Cwd;
use LWP::Simple qw(mirror getstore is_error status_message);
#use warnings;
#perl2exe_noopt "Opcode.pm"
#perl2exe_exclude "ExtUtils/MM_MacOS.pm"
#perl2exe_exclude "VMS/Filespec.pm"
#perl2exe_exclude "vmsish.pm"
#perl2exe_exclude "Mac/MoreFiles.pm"
#perl2exe_exclude "Digest/Perl/MD5.pm"
#perl2exe_exclude "Apache2/RequestRec.pm"
#perl2exe_exclude "Apache2/RequestIO.pm"
#perl2exe_exclude "Apache2/RequestUtil.pm"
#perl2exe_exclude "APR/Pool.pm"
#perl2exe_exclude "ModPerl/Util.pm"
#perl2exe_exclude "Apache2/Response.pm"
#perl2exe_exclude "Apache2/Response.pm"
#perl2exe_exclude "Apache2/RequestRec.pm"
#perl2exe_exclude "Apache2/RequestUtil.pm"
#perl2exe_exclude "Apache2/RequestIO.pm"
#perl2exe_exclude "APR/Pool.pm"
#perl2exe_exclude "Apache2/RequestUtil.pm"
#perl2exe_exclude "APR/Table.pm"
#perl2exe_include "CGI/Session/Driver/file.pm"
#perl2exe_include "CGI/Session/Serialize/default.pm"
#perl2exe_include "bytes.pm"
#perl2exe_include "CGI/Session/ID/md5.pm"
#perl2exe_include "ExtUtils/MM_Win32.pm"
#pxerl2exe_exclude "Compress/Bzip2.pm"
#perl2exe_include "HTTP/Message.pm"
#perl2exe_exclude "Carp/Heavy.pm"
use CGI::Carp qw(fatalsToBrowser);
use ExtUtils::Installed;
###### /usr/local/bin/perl5 is an unusual name for the perl interpreter.
###### on many systems, perl is located in /usr/bin/perl, and rarely
###### carries a numeric suffix.
######
###### You can try executing "which perl" or "locate /perl"
###### to try and locate perl, if you don't know it's location
######
###### NT systems do not use this facility, but instead rely entirely
###### on the extension of the file (hence the need to name the file
###### with a .pl extension on most NT web servers)
############################################
# Library Search 1.1.0 release 1
#
# (c) copyright 1998-2000 NCP Technologies,
# At Connex Global Communication Systems Inc,
# Jaywil Software Dev. Inc. 1-800-815-8370
#
# Derived from Library Search 1.0.1 release 1, 7-Feb-2002
# by CCj/Clearline.
#
#############################################################################
# Main Program Section
# *NOTE* no changes are required in this file whatsoever.. view lib.conf
#############################################################################
# Programming # Comments
#############################################################################
# &PrintHeader1; # Print basic header info > WWW
# check to see if CGI::Session is installed for password support
my $UseSession = undef;
my $installed = ExtUtils::Installed->new();
# print "and ...";
# if (grep(/CGI::Session/,$installed->modules() )) {
$UseSession = true;
# print "found it.";
# }
# # Find all the installed packages
# print("Finding all installed modules...\n");
# my $installed2 = ExtUtils::Installed->new();
# foreach my $module ($installed2->modules) {
# my $version = $installed2->version($module) || "???";
# print("Found module $module Version $version\n");
# }
#
$libConf = "lib.conf";
# Find the configuration file.
# Original file path check for Unix-type servers & some NT servers too
($libConf = $ENV{PATH_TRANSLATED}) =~ s/[^\\]*$/lib.conf/ unless ( -e $libConf);
# Jan 20/2004 M.Whiting. Add a separate check to find lib.conf for NT servers, as
# they just don't seem to find it with the Unix check. The check has never failed on
# Unix, so we've left it alone for them.
$FileCheckCount = 0;
unless (-e $libConf) {
&FindConf;
}
&GetQueryData;
&PrintHeader1; # Print basic header info > WWW
###### $virtual and $logoImage are used to describe web content on the forms
###### generated by this script. They may be overridden by the config
###### variables VIRTUAL and LOGO_IMAGE respectively. Note the trailing
###### slash for virtual.
$virtual = "http://www.google.com/search/";
$logoImage = "logo.gif";
###### These two variables are new -- NT requires that certain types of
###### executables have certain extensions, and it also requires
###### backslashes as directory separators. These variables here are the UNIX
###### defaults. The config file variables CGISCRIPT, and DIRSEP
###### will override these defaults on any platform, and must be defined on NT.
$script = "libsearch.cgi";
$dirsep = "/";
###### $countpath defines the path to your count directory. Reads the value of
###### "pwd" to assign the correct count -- each new library created will have
###### a unique value, and this script will automatically generate a count data
###### file if it doesn't exist. Define COUNTPATH in the config file to
###### override this default. Note that on UNIX this may be a relative
###### pathname. On NT it must be a fully qualified pathname.
$countpath = "tmp";
###### Similarly these are defaults for the mail program, the organisation
###### name, and a URL to associate with the organisation's name. They
###### may be overriden by the MAILPROG, ORG_NAME, and ORG_URL config
###### vars respectively.
$mailProg = "/usr/sbin/sendmail -t";
$orgName = "Our Favourite Org, Inc.";
$orgUrl = "http://www.google.com/";
###### Defaults for the search field labels, overridden by the SEARCH_FIELD_LABEL1,
###### SEARCH_FIELD_LABEL2, etc, values in lib.conf.
$SearchFieldLabel1 = "Title";
$SearchFieldLabel2 = "Author";
$SearchFieldLabel3 = "Category";
$SearchFieldLabel4 = "Subject";
$SearchFieldLabel5 = "Dewey";
$SearchFieldLabel6 = "ISBN";
$SearchFieldLabel7 = "Publisher";
$SearchFieldLabel8 = "User1";
###### Seven more search fields added. Nov.20/2006. M.Whiting
###### ($SearchFieldDisplayed and $SearchFieldSearchable defaults not declared here,
###### code is written to effectively default to Y for both)
$SearchFieldLabel9 = "User2";
$SearchFieldLabel10 = "User3";
$SearchFieldLabel11 = "User4";
$SearchFieldLabel12 = "User5";
$SearchFieldLabel13 = "User6";
$SearchFieldLabel14 = "User7";
###### Default for whether or not to show the 'request a book' area on the search results page.
$AllowRequests = "Y";
###### New variables, may be overridden by conf.var. April 2007. M.Whiting
$ConfigIn{'SCREEN_BGCOLOR'} = 'White';
$ConfigIn{'GENERAL_FONT_TYPE'} = 'Verdana';
$ConfigIn{'GENERAL_FONT_SIZE'} = '10pt';
$ConfigIn{'GENERAL_FONT_COLOR'} = 'Black';
$ConfigIn{'GENERAL_FONT_COLOR'} = 'Black';
$ConfigIn{'SHOW_ABOUT_LINK'} = 'N';
$ConfigIn{'SHOW_LIST_LIBRARIES_LINK'} = 'N';
$ConfigIn{'SHOW_CONTACT_ADMIN_LINK'} = 'N';
$ConfigIn{'SHOW_SEARCH_LINK'} = 'Y';
$ConfigIn{'SHOW_VISITOR_NUMBER'} = 'N';
$ConfigIn{'SHOW_TOTAL_LIBRARY_DATABASES'} = 'N';
$ConfigIn{'TEXT_ABOUT_LINK'} = 'About';
$ConfigIn{'TEXT_LIST_LIBRARIES_LINK'} = 'List Libraries';
$ConfigIn{'TEXT_CONTACT_ADMIN_LINK'} = 'Contact Admin';
$ConfigIn{'TEXT_SEARCH_LINK'} = 'Search';
$ConfigIn{'TEXT_VISITOR_NUMBER'} = 'Visitor Number:';
$ConfigIn{'TEXT_TOTAL_LIBRARY_DATABASES'} = 'Total Library Databases:';
$ConfigIn{'SHOW_PASSWORD_REQUIRED'} = 'Y';
$ConfigIn{'TEXT_PASSWORD_REQUIRED'} = 'Password Required';
$ConfigIn{'TEXT_NO_PASSWORD_REQUIRED'} = 'No Password';
$ConfigIn{'PASSWORD_TIMEOUT'} = '10m';
$ConfigIn{'SHOW_NUM_DATABASE_ITEMS'} = 'Y';
$ConfigIn{'RESULTSPAGE_TEXT_PREV_BUTTON'} = 'Prev';
$ConfigIn{'RESULTSPAGE_TEXT_NEXT_BUTTON'} = 'Next';
$ConfigIn{'SEARCHPAGE_SHOW_SEARCH_LIBRARY'} = 'Y';
$ConfigIn{'SEARCHPAGE_TEXT_SEARCH'} = 'Search';
$ConfigIn{'SEARCHPAGE_TEXT_LIBRARY_NAME'} = 'Shell Point Library'; #leave blank for dynamic name generation
$ConfigIn{'SEARCHPAGE_SHOW_ENTER_FIELDS'} = 'Y';
$ConfigIn{'SEARCHPAGE_TEXT_ENTER_FIELDS'} = 'Enter field(s) to search, select the checkbox for an exact phrase match';
$ConfigIn{'SEARCHPAGE_SHOW_EXACT_PHRASE_CHECKBOX'} = 'Y';
$ConfigIn{'SEARCHPAGE_TEXT_SEARCH_BUTTON'} = 'Search';
$ConfigIn{'SEARCHPAGE_TEXT_CLEAR_BUTTON'} = 'Clear';
$ConfigIn{'RESULTSPAGE_SHOW_LIBRARY_NAME'} = 'Y';
$ConfigIn{'RESULTSPAGE_TEXT_LIBRARY_NAME'} = 'Shell Point Library'; #leave blank for dynamic name generation
$ConfigIn{'RESULTSPAGE_SHOW_YOUR_SEARCH_FOUND'} = 'Y';
$ConfigIn{'RESULTSPAGE_TEXT_YOUR_SEARCH_FOUND'} = 'Your Search Found';
$ConfigIn{'RESULTSPAGE_TEXT_MATCHES'} = 'Match(es)';
$ConfigIn{'RESULTSPAGE_TEXT_REQUEST_NAME'} = 'Name:';
$ConfigIn{'RESULTSPAGE_TEXT_REQUEST_EMAIL'} = 'Phone Number/Email Address:';
$ConfigIn{'RESULTSPAGE_TEXT_REQUEST_COMMENTS'} = 'Comments:';
$ConfigIn{'RESULTSPAGE_TEXT_REQUEST_BUTTON'} = 'Request To Borrow Checked Item(s)';
$ConfigIn{'RESULTSPAGE_TEXT_RESULT_#'} = 'Result #';
$ConfigIn{'RESULTSPAGE_SHOW_RESULT_#'} = 'Y';
$ConfigIn{'RESULTSPAGE_TEXT_FROM'} = ', from';
$ConfigIn{'RESULTSPAGE_TEXT_DATABASE'} = '';
$ConfigIn{'REQUESTPAGE_TEXT_REQUESTING'} = 'Requesting Item(s):';
$ConfigIn{'REQUESTPAGE_TEXT_THANKYOU'} = 'Your Items Have Been Requested, Thank You';
$ConfigIn{'RESULTSPAGE_TEXT_RETURN'} = "(Please press your browser's \'Back\' button Invalid Password";
}
&PrintLoginForm;
} else {
# Get the number of fields in database. Newer db's have 21 fields instead of 14.
# The extra search boxes are only displayed if fields are present on file.
foreach $LibName (@{$DbLineNames[$in{'dbNum'}]}) {
open(SEARCH, $LibDef{$LibName}[2]);
$NumDbFields = scalar(split(/\t/, Unrecognized number of data fields in database file: $NumDbFields";
print " Please contact Jaywil at info\@jaywil.com for an update or to resolve this problem. $ConfigIn{'TEXT_VISITOR_NUMBER'} "
.&getCounterValue("count-lib-$databasedata[$in{'dbNum'}*10].txt")
." $ConfigIn{'SEARCHPAGE_TEXT_SEARCH'} ";
if ($ConfigIn{'SEARCHPAGE_TEXT_LIBRARY_NAME'} eq '') {
print $databasedata[$in{'dbNum'}*10];
} else {
print $ConfigIn{'SEARCHPAGE_TEXT_LIBRARY_NAME'};
}
print " $ConfigIn{'SEARCHPAGE_TEXT_ENTER_FIELDS'} ";
if ($ConfigIn{'RESULTSPAGE_TEXT_LIBRARY_NAME'} eq '') {
print $databasedata[$in{'dbNum'}*10];
} else {
print $ConfigIn{'RESULTSPAGE_TEXT_LIBRARY_NAME'};
}
print " $ConfigIn{'RESULTSPAGE_TEXT_YOUR_SEARCH_FOUND'} $NumBooksFound $ConfigIn{'RESULTSPAGE_TEXT_MATCHES'} No search parameters given! $ConfigIn{'TEXT_VISITOR_NUMBER'} ".&getCounterValue("count-list-libs.txt")." $ConfigIn{'TEXT_TOTAL_LIBRARY_DATABASES'} $NumDbLineNames $databasedata[($a*10)+0]";
}
else {
print " $databasedata[($a*10)+0]";
}
if (($ConfigIn{'SHOW_NUM_DATABASE_ITEMS'} eq "Y") || ($ConfigIn{'SHOW_PASSWORD_REQUIRED'} eq "Y")) {
print " -";
}
if ($ConfigIn{'SHOW_PASSWORD_REQUIRED'} eq "Y") {
print " (";
if (($databasedata[($a*10)+2] ne "*") && ($databasedata[($a*10)+2] ne "")) {
print "$ConfigIn{'TEXT_PASSWORD_REQUIRED'}";
}
else {
print $ConfigIn{'TEXT_NO_PASSWORD_REQUIRED'};
}
print ")";
}
if ($ConfigIn{'SHOW_NUM_DATABASE_ITEMS'} eq "Y") {
print " [$databasedata[($a*10)+6] item(s)]";
}
}
}
############################################
# makeRequest
# Purpose: Request Item(s)
#
############################################
sub makeRequest {
if (($in{'name'} eq '') || ($in{'email'} eq '')) {
$errMsg = " Missing Email/Phone or Name Login To $databasedata[($in{'dbNum'}*10)+0] Password:
to return to Search Results)";
$ConfigIn{'EMAIL_TEXT_BORROW'} = 'Borrow Request';
$ConfigIn{'EMAIL_TEXT_TITLE1'} = '******************************************************';
$ConfigIn{'EMAIL_TEXT_TITLE2'} = ' Borrow Request Form';
$ConfigIn{'EMAIL_TEXT_TITLE3'} = ' from Library Search';
$ConfigIn{'EMAIL_TEXT_TITLE4'} = '******************************************************';
$ConfigIn{'EMAIL_TEXT_LIBRARY'} = 'Library : ';
$ConfigIn{'EMAIL_TEXT_NAME'} = 'Name Of Requestor: ';
$ConfigIn{'EMAIL_TEXT_EMAIL'} = 'Phone/Email : ';
$ConfigIn{'EMAIL_TEXT_DATE'} = 'Date/Time : ';
$ConfigIn{'EMAIL_TEXT_FOOTER1'} = '******************************************************';
$ConfigIn{'EMAIL_TEXT_COMMENTS'} = 'COMMENTS: ';
$ConfigIn{'EMAIL_TEXT_REQUESTED_ITEM'} = '***************** Requested Item *****************';
$ConfigIn{'EMAIL_FIELD_DETAIL_LINE1'} = 1;
$ConfigIn{'EMAIL_FIELD_DETAIL_LINE2'} = 2;
$ConfigIn{'EMAIL_FIELD_DETAIL_LINE3'} = 5;
$ConfigIn{'EMAIL_FIELD_DETAIL_LINE4'} = 6;
$ConfigIn{'EMAIL_FIELD_DETAIL_LINE5'} = 0;
$ConfigIn{'EMAIL_FIELD_DETAIL_LINE6'} = 0;
$ConfigIn{'EMAIL_FIELD_DETAIL_LINE7'} = 0;
$ConfigIn{'EMAIL_FIELD_DETAIL_LINE8'} = 0;
$ConfigIn{'EMAIL_FIELD_DETAIL_LINE9'} = 0;
$ConfigIn{'EMAIL_FIELD_DETAIL_LINE10'} = 0;
$ConfigIn{'EMAIL_FIELD_DETAIL_LINE11'} = 0;
$ConfigIn{'EMAIL_FIELD_DETAIL_LINE12'} = 0;
$ConfigIn{'EMAIL_FIELD_DETAIL_LINE13'} = 0;
$ConfigIn{'EMAIL_FIELD_DETAIL_LINE14'} = 0;
#
# Set up name arrays for weekdays and month names.
#
@weekdays=( "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun");
@months=( "Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
#
# Translate timezone-localized 'time' into a "struct tm" array.
#
($sec, $min, $hour, $mday, $month, $year, $wday, $yday, $ds) = localtime(time);
if ($sec < 10) {$sec = ("0$sec");} # Put a zero in front of the seconds, if needed to make 2 digits
if ($min < 10) {$min = ("0$min");} # Same with minutes
#
# Save the year for use in the copyright message.
#
$cpr_year=1900+$year;
#
# Generate a datestring for use when generating mail.
#
$mailheader_date="$weekdays[$wday], $mday $months[$month] $cpr_year " .
"$hour:$min:$sec";
&ReadConf;
&PrintLinks; # Print The Commands > WWW
&PerformAction; # perform the specified action. or default.
&PrintFooter; # Print The Footer Information > WWW
exit;
#############################################################################
# Sub Procedures ############################################################
#############################################################################
############################################
# PrintHeader
# Purpose: To print the initial html code
# at the top of the page.
############################################
sub PrintHeader1 {
print "Content-type: text/html\n\n";
print <
\n";
}
############################################
# PrintLinks
# Purpose: To Print the available commands
# to the screen.
############################################
sub PrintLinks {
print " ";
if ($ConfigIn{'SHOW_ABOUT_LINK'} =~ /^y/i) {print "[$ConfigIn{'TEXT_ABOUT_LINK'}] ";}
if ($ConfigIn{'SHOW_LIST_LIBRARIES_LINK'} =~ /^y/i) {print "[$ConfigIn{'TEXT_LIST_LIBRARIES_LINK'}] ";}
if ($ConfigIn{'SHOW_CONTACT_ADMIN_LINK'} =~ /^y/i) {print "[$ConfigIn{'TEXT_CONTACT_ADMIN_LINK'}] ";}
if ($ConfigIn{'SHOW_SEARCH_LINK'} =~ /^y/i) {
if ($in{'dbNum'} ne '') {
print "[$ConfigIn{'TEXT_SEARCH_LINK'}] ";
}
}
print "\n
\n";
}
############################################
# PerformAction
# Purpose: To perform the action requested
#
############################################
sub PerformAction {
if ($in{'action'} < 2 or $in{'action'} > 5) { &ListDatabases; return; }
if ($in{'dbNum'} eq '' or $in{'dbNum'} < 1 or $in{'dbNum'} > $NumDbLineNames) { &ListDatabases; return; }
my $LoggedIn = undef;
if ($databasedata[($in{'dbNum'}*10)+2] eq '*' or $pwd eq $databasedata[($in{'dbNum'}*10)+2]) {
$LoggedIn = 1;
}
unless ($LoggedIn) {
if (defined $in{'CGISESSID'} or defined $in{'pwd'}) {
print "
Lib Name:$LibName, Lib Filename:$LibDef{$LibName}[2] - $NumDbFields
";
#print "
$NumDbFields";
if ($NumDbFields != 14 && $NumDbFields != 21) {
print "
(Database filename: $LibDef{$LibName}[2])";
print "
NCP
for ($i=1;$i<=14;$i++) {
last if ($MaxNumDbFields == 14 && $i == 8);
if (eval("\$SearchFieldSearchable$i") ne "N") {
print " " . chr(13);
print " " . chr(13);
}
}
print <" . eval("\$SearchFieldLabel$i") . ": " . chr(13);
print "   ";
if ($ConfigIn{'SEARCHPAGE_SHOW_EXACT_PHRASE_CHECKBOX'} =~ /^y/i) {
print "";
}
print " " . chr(13);
print "
NCP
}
############################################
# SearchResults
# Purpose: To find entries..
#
############################################
sub SearchResults {
if (defined $in{'BtnNext'}) { $FirstNumDisplayed=$in{'PrevFirstNum'}+10; }
if (defined $in{'BtnPrev'}) { $FirstNumDisplayed=$in{'PrevFirstNum'}-10; }
&SearchDatabase;
if ($ConfigIn{'RESULTSPAGE_SHOW_LIBRARY_NAME'} =~ /^y/i) {
print "
(c) copyright $cpr_year Shell Point Retirement Community
Click here to return to $orgName.
\n"
}
&SearchDatabase;
$selected = 0;
for($a=1;$a<=$NumBooksFound;$a++) {
if ($in{$a} eq "on") {
$selected++;
}
}
if ($selected==0) {
$errMsg = " No Items Selected!
\n";
}
if (defined $errMsg) {
print $errMsg;
print "Please hit the back button on your browser and make the\n";
print "necessary corrections\n";
return;
}
print "$databasedata[($in{'dbNum'}*10)+0]
";
print "$ConfigIn{'REQUESTPAGE_TEXT_REQUESTING'}
";
$i=0;
for($a=1;$a<=$NumBooksFound;$a++) {
if ($in{$a} eq "on") {
print " $SearchResults[($a*22+1)]
";
}
}
foreach $LibName (@{$DbLineNames[$in{'dbNum'}]}) {
$FoundOne = "N";
for($a=1;$a<=$NumBooksFound;$a++) {
if (($in{$a} eq "on") && ($SearchResults[($a*22)] eq $LibDef{$LibName}[0])) {
$FoundOne = "Y";
#print "
Found: $a, $SearchResults[($a*22)]";
}
}
next if $FoundOne eq "N";
open (MAIL, "|$mailProg") || die "Can't create pipe to $mailProg!\n";
print MAIL "Date: $mailheader_date -0500\n";
# Print only the email address, if so requested from lib.conf. Some servers don't handle the
# presence of the person's real-life name very well. May 18/2004-M.Whiting
$recipient = $LibDef{$LibName}[1];
# delete this line if no problems April 10/08
# $recipient = $LibDef{$DbLineNames[$in{'dbNum'}][$DbLineFileNum]}[1];
# print "
sending re:$LibName to [$recipient]";
if ($SmblatEmailOnly =~ /^Y/i) {
print MAIL "To: $recipient\n";
print MAIL "From: $adminEmail\n";
}
else {
print MAIL "To: Library Admin <$recipient>\n";
print MAIL "From: $adminName <$adminEmail>\n";
}
print MAIL "Subject: $ConfigIn{'EMAIL_TEXT_BORROW'}\n";
print MAIL "Organization: $orgName\n";
# Pass an instruction to the smblat program, if requested from lib.conf
print MAIL "SMTPServer: $SMTPServer\n" if (defined $SMTPServer);
# Add a parameter to instruct the smblat program, if requested from lib.conf - May 18/2004-M.Whiting
print MAIL "SmblatDebug: $SmblatDebug\n" if (defined $SmblatDebug);
print MAIL "\n";
print MAIL "$ConfigIn{'EMAIL_TEXT_TITLE1'}\n";
print MAIL "$ConfigIn{'EMAIL_TEXT_TITLE2'}\n";
print MAIL "$ConfigIn{'EMAIL_TEXT_TITLE3'}\n";
print MAIL "$ConfigIn{'EMAIL_TEXT_TITLE4'}\n";
# print MAIL "$ConfigIn{'EMAIL_TEXT_LIBRARY'}$DbLineNames[$in{'dbNum'}][$DbLineFileNum]\n";
print MAIL "$ConfigIn{'EMAIL_TEXT_LIBRARY'}$LibDef{$LibName}[0]\n";
print MAIL "$ConfigIn{'EMAIL_TEXT_NAME'}$in{'name'}\n";
print MAIL "$ConfigIn{'EMAIL_TEXT_EMAIL'}$in{'email'}\n";
print MAIL "$ConfigIn{'EMAIL_TEXT_DATE'}$mailheader_date\n";
print MAIL "$ConfigIn{'EMAIL_TEXT_FOOTER1'}\n";
print MAIL "$ConfigIn{'EMAIL_TEXT_COMMENTS'}$in{'comm'}\n";
for($a=1;$a<=$NumBooksFound;$a++) {
if (($in{$a} eq "on") && ($SearchResults[($a*22)] eq $LibDef{$LibName}[0])) {
print MAIL "\n$ConfigIn{'EMAIL_TEXT_REQUESTED_ITEM'}\n";
for ($i=1; $i<=14; $i++) {
$FieldNum = eval("\$ConfigIn{'EMAIL_FIELD_DETAIL_LINE$i'}");
if ($FieldNum > 0) {
if ($FieldNum == 1) {$ArrayPosition = 1;}
if ($FieldNum == 2) {$ArrayPosition = 4;}
if ($FieldNum == 3) {$ArrayPosition = 8;}
if ($FieldNum == 4) {$ArrayPosition = 11;}
if ($FieldNum == 5) {$ArrayPosition = 9;}
if ($FieldNum == 6) {$ArrayPosition = 10;}
if ($FieldNum == 7) {$ArrayPosition = 7;}
if ($FieldNum >= 8) {$ArrayPosition = $FieldNum+7;}
print MAIL eval("\$SearchFieldLabel$FieldNum") . " : $SearchResults[($a*22)+$ArrayPosition]\n";
}
}
}
}
print MAIL "\n\n(c) copyright $cpr_year $orgName.\n";
close (MAIL);
}
print "
$ConfigIn{'REQUESTPAGE_TEXT_THANKYOU'}";
print "
$ConfigIn{'RESULTSPAGE_TEXT_RETURN'}
Note: This page is for debugging purposes by Jaywil Software.
";
print "Please copy and paste this page into your email program
";
print "and send it to Jaywil Software. Thank-you.
Start of Environment Variables:
"; foreach $key (sort keys(%ENV)) { print "$key = $ENV{$key}End of Environment Variables
"; exit; } ############################################ # GetQueryData # Purpose: To Get Information From The Query # String passed from The WWW ############################################ sub GetQueryData { if ($ENV{'REQUEST_METHOD'} eq "POST") { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); } else { @pairs = split(/&/, $ENV{'QUERY_STRING'}); } # Now digest the data, putting it into a more useful format. foreach $pair (@pairs) { ($key, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ tr/\cM//; # print "$key = $value(You can contact Jaywil at info\@jaywil.com if you need assistance)
"; exit; } } else { if (defined $DbLineNames[$DbLineNum][1]) { print "Please contact Jaywil Software about the multi-library version of Web Search.
"; exit; } else { # convert db name to uppercase to use as the key in the hash. Note that element 0 # of the hash is the same name in mixed case. ($Keyname = $databasedata[$DbLineNum*10]) =~ tr/a-z/A-Z/; ($LibDef{$Keyname}[0] = $databasedata[$DbLineNum*10]) =~ s/(^\s+|\s+$)//g; # library name ($LibDef{$Keyname}[1] = $databasedata[$DbLineNum*10+4]) =~ s/(^\s+|\s+$)//g; # email ($LibDef{$Keyname}[2] = $_) =~ s/(^\s+|\s+$)//g; # library data location $DbLineNames[$DbLineNum][$DbLineFileNum] = $Keyname; } } } } # Run through all the Library Definitions, downloading remote files & assigning local filenames $iTemp = 0; foreach $LibName (keys %LibDef) { $_ = $LibDef{$LibName}[2]; # put the file location into $_ if ($_ !~ /^(www|http)/i ) { #If no www/http reference, it's a local file if (!(-e $_)) { print "File not found for library named '$LibName'";
print "
(filename: $_)";
exit;
}
} else {
if ($_ =~ /^www/i ) {$_ = "http://" . $_;}
($DestFilename = $_) =~ s/^.+\///; # remove the path before the filename.
$DestFilename = $LocalDataPath."RemoteFile".++$iTemp."-".$DestFilename;
if (-e $DestFilename) {
$returncode = mirror($_, $DestFilename);
} else {
$returncode = getstore($_, $DestFilename); #one server had trouble with mirroring if file didn't already exist
}
if (is_error($returncode)) {
print "
Problem getting remote database file: $_"; print "
Transfer Error Message: ";
print status_message($returncode);
print "
(HTTP error code # $returncode)";
print "
Please contact Jaywil at info\@jaywil.com if you need assistance.
"; print exit; } #print "