#!/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 ""; print "Additional Mappings: Save the mappings described above.
$postpass Don't save, go back to the main administration page.
EOF ; &Architext'Copyright($attr{'ArchitextURL'}); exit(0); } if ($form{'Mappings'} eq 'save') { &Architext'printHeader($attr{'ArchitextURL'}, "Save URL Mappings", " "); ##write the mappings to the URL mapping file, and make sure ##the format is cool unlink("$root/url.map"); open(MFILE, ">$root/url.map") || &Architext'exitFileError($attr{'ArchitextURL'}, "$root/url.map", "could not be opened for writing."); @maps = split('\s+', $form{'maps'}); while ($file = pop(@maps)) { $url = pop(@maps); $file .= "/" unless ($file =~ /[\/\\]$/); $url .= "/" unless ($url =~ /[\/\\]$/); print MFILE "$url\t$file\n"; } close(MFILE) || &Architext'exitError($attr{'ArchitextURL'}, "Error writing to file '$root/url.map'"); print < Update of URL Mappings was successful.

$postpass Go back to the main administration page.
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 "
Collection Status
"; print <Possible Actions"; print "
Collection Characteristics\n"; &Architext'collectionCharacteristics($form{'db'}, $helppath, %attr); } elsif ($form{'Support'} && (! $form{'Confirm'})) { ## get confirmation and problem description from user ## before actually generating info &Architext'printHeader($attr{'ArchitextURL'}, "Create Support Information"); print < If you are having a problem with this software, you can use this form to mail a message to excite that will contain a description of the problem and some additional information that might be useful in diagnosing your problem.
$postpass Send support information to ewssupport\@excite.com. If you do not want the information automatically emailed to excite, uncheck this box, and a file containing the support information will be created, but not emailed.

Please describe the problem you are having in the space provided below:

Provide an email address for correspondence:

OK, send the information.

$postpass Go back to the main administration page.

EOF ; &Architext'Copyright($attr{'ArchitextURL'}); exit 0; } elsif ($form{'Support'} && $form{'Confirm'}) { ## send support information to Architext &Architext'printHeader($attr{'ArchitextURL'}, "Done Creating Support Information"); $version = &Architext'productVersion(); &create_support_info($root, $attr{'ConfigRoot'}, $version, $form{'email'}, $form{'Description'}); if ($form{'email'}) { $email = ", and has been sent via email to ewssupport\@excite.com."; } else { $email = "."; } print < Your support information has been recorded in the file $root/support.out$email If your system is not configured to send email to outside locations, please send the contents of the above file to ewssupport\@excite.com. Thank you.

$postpass

EOF ; &Architext'Copyright($attr{'ArchitextURL'}); exit 0; } elsif ($form{'Remove'}) { ## remove collection verb &Architext'printHeader($attr{'ArchitextURL'}, "Remove Collection: $form{'dbname'}"); if ($form{'verify'}) { if (-e "$root/collections/$form{'dbname'}.pid") { 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 <

$postpass Go back to the main administration page.

EOF ; } else { print <
$postpass Remove all files associated with this collection.

$postpass Don't remove files, go back to the administration page for this collection.

EOF ; } &Architext'Copyright($attr{'ArchitextURL'}); exit(0); } elsif ($form{'automate'}) { &Architext'printHeader($attr{'ArchitextURL'}, "Indexing Automation"); open(AUTO, "$root/AT-automate.html"); while () { print; } close(AUTO); print < Next step:
$postpass Go back to the main administration page. EOF ; &Architext'Copyright($attr{'ArchitextURL'}); exit(0); } else { ## main admin page &Architext'printHeader($attr{'ArchitextURL'}, "Excite for Web Servers Administration", " "); opendir(CONF, "$root/collections"); @dbconf = grep(/\.conf$/, readdir(CONF)); %pubs = &Architext'pubList("$root/collections") if (&Architext'notifyMode()); print "Existing Document Collections
    "; if ($#dbconf > -1) { for (@dbconf) { s|\.conf$||; if ($getpass) { $getdb = "&db=$_"; } else { $getdb = "?db=$_"; } $notify_icon = &Architext'notifyBlankTag($attr{'ArchitextURL'}); $notify_icon = &Architext'notifyTag($attr{'ArchitextURL'}) if $pubs{$_}; print qq(
    $notify_icon $_\n); $status = &Architext'getStatusString($root, $_, $attr{'ConfigRoot'}, $attr{'ArchitextURL'}, $attr{'CgiBin'}, $getpass); print " -- $status \n"; } print "
"; ## if use of notfier is enabled, present options ## to publish or unpublish a collection if (&Architext'notifyMode()) { $notify_icon = &Architext'notifyTag($attr{'ArchitextURL'}); print <Collections marked with a $notify_icon are excite notifier enabled. EOF ; } } else { print "

(No document collections found)

\n"; } print "


"; print "New Collection
    "; print < Enter a name for a new collection:
    $postpass
    EOF ; print "

"; print < New Password
    Change the password used to access this page. $postpass

Configure URL Mappings
    Change, add, or remove URL to filename mappings. $postpass
EOF ; if ($getpass) { $amper = '&'; } else { $amper = '?'; } if (!($ews_port eq 'NT')) { print < Automation Information Click here for information about scheduling a recurring indexing process. EOF ; } print < News Check here for up-to-the-minute information about Excite for Web Servers.
Admin Info Page. This page is simply a list of the options you chose at install time; you can check here to find out where certain files are located in case you have forgotten. EOF ; &Architext'Copyright($attr{'ArchitextURL'}); exit 0; } } else { ## not yet registered, so print out screen to send user ## back to AT-starthere.html to get them registered and ## happy before they start using the admin tools &Architext'printHeader($attr{'ArchitextURL'}, "Excite for Web Servers Administration"); print <

Not yet registered.

Apparently, you have not yet registered your copy of this software with Excite, Inc. To do this, please go to the getting started page and follow the instructions presented there.
Thanks!
EOF ; } &Architext'Copyright($attr{'ArchitextURL'}); sub createIndex { local($location) = @_; open(INDEX, ">$location/index.html"); print INDEX qq(Excite for Web Servers Administration); $banner = &Architext'adminBanner(); print INDEX qq(

); print INDEX qq(

Excite for Web Servers

); print INDEX qq(

Welcome to the Excite for Web Servers administration directory.\n); print INDEX qq(From here, you can:); print INDEX qq(

Go to the main\n); print INDEX qq(administration page.
\n); print INDEX qq(Go to the Excite, Inc.); print INDEX qq( home page); print INDEX qq(

TIP: Make a bookmark for this page, so you can easily get back to the administration page.); close(INDEX); &make_files_readwriteable("$location/index.html"); } sub createLocalSpiderFile { return if (-e "$root/.first"); ## create a file for local spiders to find $server_cgi = $ENV{'SCRIPT_NAME'}; $server_cgi =~ s/[^\/]+$//; $server_cgi =~ s/\/$//; open(LSF, ">$root/ews"); print LSF "$server_cgi\n####EXCLUSIONS####\n"; close(LSF); if (-e "$attr{'HtmlRoot'}/ews") { open(TMP, "$attr{'HtmlRoot'}/ews"); $hasit = 0; while ($str = ) { last if ($str =~ /####EXCLUSIONS####/); if ($str eq $server_cgi) { $hasit = 1; last; } } close(TMP); if (!$hasit) { rename("$attr{'HtmlRoot'}/ews", "$attr{'HtmlRoot'}/ews.old"); open(TMP, "$attr{'HtmlRoot'}/ews.old"); open(NTMP, ">$attr{'HtmlRoot'}/ews"); print NTMP "$server_cgi\n"; while ($str = ) { print NTMP $str; } close(NTMP); close(TMP); unlink "$attr{'HtmlRoot'}/ews.old"; } } else { ©_files("$root/ews", "$attr{'HtmlRoot'}/ews"); } &create_empty_file("$root/.first") unless (-e "$root/.first"); }