#!/bin/sh perl=/usr/local/bin/perl eval "exec $perl -x $0 $*" #!perl ## Copyright (c) 1996 Excite, Inc. ## ## This CGI script is intended as a first stop for ## administrators of Excite, Inc.'s web site search engine. ## ## This script will appear a several different web pages, ## and will check to make sure that the user has ## registered with Excite, Inc. before providing access ## to the full range of functionality. BEGIN { $root = "/usr/home/photius/excite"; die "Invalid root directory '$root'\n" unless -d $root; unshift(@INC, "$root/perllib"); } $| = 1; require 'os_functions.pl'; require 'architext.pl'; require 'architextConf.pl'; %form = &Architext'readFormArgs; %attr = &ArchitextConf'readConfig("$root/Architext.conf", $form{'db'}); if (&Architext'remoteMode($root)) { $helppath = &Architext'helpPath(); } else { $helppath = $attr{'ArchitextURL'}; } $script_suffix = &Architext'scriptSuffix(); $news_url = &Architext'newsURL(); $scriptname = "AT-admin$script_suffix"; if ($form{'Version'}) { print "Content-type: text/html\n\n"; $version = &Architext'productVersion(); print "$version\n"; exit(0); } if ($form{'register'} eq 'yes') { ## given the presence of the register attribute ## we can assume that the user has registered with ## Excite, Inc. and is visiting this page for the ## first time, so we need to update Architext.conf ## to mark the user as registered. $exit = &append_line_to_file("$attr{'ArchitextRoot'}/Architext.conf", "register yes") unless ($attr{'register'}); &Architext'exitError($attr{'ArchitextURL'}, "Unable to update configuration file with registation information. $!") if $exit; if ($form{'remote'} eq 'yes') { $exit = &create_empty_file("$attr{'ArchitextRoot'}/.remote") unless (-e "$attr{'ArchitextRoot'}/.remote"); &Architext'exitError($attr{'ArchitextURL'}, "Unable to create .remote file - $!") if $exit; } if ($form{'at_email'}) { $exit = &append_line_to_file("$attr{'ArchitextRoot'}/Architext.conf", "AdminMail $form{'at_email'}") unless ($attr{'AdminMail'}); &Architext'exitError($attr{'ArchitextURL'}, "Unable to update configuration file with admin mail address. $!") if $exit; } ## create index.html file with some interesting stuff in it %attr = &ArchitextConf'readConfig("$root/Architext.conf"); &createIndex($attr{'ConfigRoot'}); ## add ServerName, ServerPort, and ServerCgi to .conf file &append_line_to_file("$root/Architext.conf", "ServerName $ENV{'SERVER_NAME'}"); &append_line_to_file("$root/Architext.conf", "ServerPort $ENV{'SERVER_PORT'}"); $server_cgi = $ENV{'SCRIPT_NAME'}; $server_cgi =~ s/[^\/]+$//; $server_cgi =~ s/\/$//; &append_line_to_file("$root/Architext.conf", "ServerCgi $server_cgi"); } ## check for password, if one is specified in Architext.conf ## if it doesn't appear as a form arg, present password page if ($attr{'register'} =~ /yes/) { ## they are registered, so present them with the options ## and check for an admin password $password = &Architext'password($attr{'ArchitextURL'}, $scriptname, $attr{'Password'}, %form) if $attr{'Password'}; $postpass = "" if ($attr{'Password'}); $getpass = "$password=$attr{'Password'}" if $postpass; $getpass = "?" . &Architext'httpize($getpass); &createLocalSpiderFile(); ## allow user to setup file to URL mappings if ($form{'Mappings'} eq 'admin') { &Architext'printHeader($attr{'ArchitextURL'}, "Configure URL Mappings"); $htroot = $attr{'HtmlRoot'}; $htroot .= "/" unless ($htroot =~ /[\/\\]$/); print "Default Mapping: "; print "
EOF ; &Architext'Copyright($attr{'ArchitextURL'}); exit(0); } if ($form{'Mappings'} eq 'seed') { &Architext'printHeader($attr{'ArchitextURL'}, "Configure URL Mappings", " "); &Architext'Copyright($attr{'ArchitextURL'}); exit(0); } if ($form{'db'}) { ## db specific admin page &Architext'printHeader($attr{'ArchitextURL'}, "Collection Administration: $form{'db'}"); print "
Sorry, you cannot remove a collection while an index process is running for that collection"; } else { ## no index process is running, so it is safe to ## remove the collection and all associated files %attr = &ArchitextConf'readConfig("$root/Architext.conf", $form{'dbname'}); &remove_collection($form{'dbname'}, $root, $attr{'ConfigRoot'}, $attr{'CollectionRoot'}, $attr{'CgiBin'}); print "
The collection '$form{'dbname'}' has been removed.";
}
print <
EOF
;
} else {
print <
EOF
;
}
&Architext'Copyright($attr{'ArchitextURL'});
exit(0);
} elsif ($form{'automate'}) {
&Architext'printHeader($attr{'ArchitextURL'},
"Indexing Automation");
open(AUTO, "$root/AT-automate.html");
while (