#!/usr/bin/perl # 4/13/96 Michael Smith # for WebGlimpse # see http://glimpse.cs.arizona.edu/webglimpse for more information # returns full search box (with preference to the referring page) ######################################################################### # The following variables are changed by wginstall $WEBGLIMPSE_HOME = "/home/bugs/bugstopper-www"; $CGIBIN = "cgi-bin"; $GLIMPSE_LOC = "/home/bugs/bugstopper-www/glimpse-4.1-bin-Linux-2.0.30-i486/bin/glimpse"; $CONVERT_LOC = "/home/bugs/bugstopper-www/glimpse-4.1-bin-Linux-2.0.30-i486/bin/wgconvert"; # End list of changed variables # lib directory $WEBGLIMPSE_LIB = "$WEBGLIMPSE_HOME/lib"; # we don't need to know the settings; all done by webglimpse $nh_pre=".nh."; $REMOTEDIR = ".remote"; $MAPFILE = ".wgmapfile"; # name of config file $CONFIGFILE = "archive.cfg"; # start the header print "Content-type: text/html\n\n"; # ENV variables # path info contains the archive directory $archivepwd = $ENV{'PATH_INFO'}; if ($archivepwd =~ m/^\s*\&/) { # Don't let anybody open specific descriptors. &err_file ($archivepwd); die ("UNREACHABLE REACHED"); } # Get virtual host if any $vhost = ""; open (F, "<$archivepwd/$CONFIGFILE") || &err_file ("$archivepwd/$CONFIGFILE"); while (($_ = ) && ($vhost == "")) { if (/^vhost/) { ($nullvar, $vhost) = split(/\s/); } } close(F); if ($vhost eq "default") { $vhost = ""; } ######################################################################### ######################################################################### ### SITE CONF STUFF ######################################################################### ######################################################################### $wgConfPath = "$WEBGLIMPSE_HOME/$vhost.wgsiteconf"; $prefix = "^DirectoryIndex|^UserDir|^Alias|^ScriptAlias|^DocumentRoot"; $DirectoryIndex=""; $UserDir=""; $DocumentRoot=""; # @AliasList=(); # @ScriptAliasList=(); # @ServerCache=(); $Port=""; $Server=""; $ServerAddress=""; ######################################################################### ### END SITE CONF STUFF ######################################################################### #--------------------------------- # make my libraries more important unshift(@INC, "$WEBGLIMPSE_LIB"); require "config.pl"; &siteconf_ReadConf(); print "\n"; # Check that a query has been made $query = $ENV{'QUERY_STRING'}; # Strip the variables out from the query string, # and assign them into variables, prefixed by 'QS_' foreach $pspec (split (/\&/, $query)) { $pname = ''; $pvalue = ''; ($pname, $pvalue) = (split (/=/, $pspec)); # Decode form results (hex characters, spaces etc) $pvalue = &www_form_urldecode($pvalue); $pname = &www_form_urldecode($pname); if ($pname =~ /^[a-zA-Z0-9_]*$/ ) { $varname = "QS_$pname"; $$varname = $pvalue; } } # query is the file $file = $QS_file; $file =~ s/\'//g; # print "file: $file
\n"; $show_neighborhood=0; if($QS_shownh){ $show_neighborhood=$QS_shownh; } # go read the config file in the archive if(&TestConfig($archivepwd)==0){ &err_conf; } ($title, $archiveurl, $traverse_type, $explicit_only, $numhops, $nhhops, $local_limit, $remote_limit, $addboxes, @urllist) = ReadConfig($archivepwd); # look for the title for this page $thistitle = &lookup_title($file); ### TO DO -- error if we can't find the file's title; all indexed files should ### have at least 'No title' if($file ne ""){ print "Full search from $thistitle\n"; }else{ print "Full search\n"; } print "\n\n"; print "
\n"; print "\n"; print "\n"; print "\n"; print "\n\n"; print "\n\n"; print "\n"; print "\n"; print "
\n"; print "\n"; print "\n"; print "\n"; print "WebGlimpse Search
\n"; print "
\n"; if($file ne ""){ $link = &siteconf_LocalFile2Url($file); print "\n"; print "Search:\n"; print "\n"; print "The neighborhood of $thistitle\n"; print "The full archive: $title\n"; }else{ print "
Search on the entire archive.
\n"; } print "
\n"; print "String to search for: \n"; print "\n"; print "
\n"; print "
\n"; print "Case sensitive\n"; print "   \n"; # print "       \n"; print "Partial match\n"; print "   \n"; print "Jump to line\n"; print "   \n"; print "\n"; print "misspellings allowed\n"; print "
\n"; print "
\n"; print "Return only files modified within the last \n"; print "days.\n"; print "
\n"; print "Maximum number of files returned:\n"; print "\n"; print "
Maximum number of matches per file returned:\n"; print "\n"; print "
\n"; print "\n"; print "
\n"; print "
\n"; print "\n"; print "Glimpse and \n"; print "WebGlimpse, Copyright © 1996, \n"; print "University of Arizona\n"; print "
\n"; print "
\n"; print "\n\n

"; $path_info = $ENV{'PATH_INFO'}; if($file ne ""){ if($show_neighborhood!=0){ # now add the files in that neighborhood print "



Pages in the neighborhood of $file:\n"; $neighborhood="$file"; # add the prefix $neighborhood=~ s/([^\/]+)$/$nh_pre$1/; #CALL CONVERT HERE BEFORE OPENING NEIGHBOURHOOD FILE --> bgopal oct/6/96 #$cmd = "$CONVERT_LOC -U -in -H $path_info < $neighborhood 2>&1 |"; #DON'T USE -U SINCE I WANT ALL INFORMATION... $cmd = "$CONVERT_LOC -in -H $path_info < $neighborhood 2>&1 |"; if (!open(NH, $cmd )) { print "No neighborhood file found.\n"; } else { print "