The FTP Indexer's Configuration Guide

FTP Indexer v. 2.0.1
Doc V. 1.1
Doc Modified Date: 01.30.2003

TOC
I. authentication.php
II. backup.php
III. display.php
IV. indexer.php
V. mysql.php
VI. search.php
VII. templates.php

I. authentication.php
 ########################################################################################
 # The administrators username, used for the administration sections of the ftp indexer #
$AdminUser="admin";######################################################################

 ########################################################################################
 # The administrators password (yes, in clear text)                                     #
$AdminPass="default";####################################################################

 ########################################################################################
 # Do you require a username and a password to allow people to add ftp's to the queue?  #
 # 0 means "no" 1 means "yes"                                                           #
$RequireQueuePass=0;#####################################################################

 ########################################################################################
 # If $RequireQueuePass is set to 1, then what is the username to allow access to queue #
 # new ftps for the indexer?                                                            #
$QueueUser="queue";######################################################################

 ########################################################################################
 # If $RequireQueuePass is set to 1, then whats the queue users password?               #
$QueuePass="default";####################################################################

 ########################################################################################
 # Do you want to require usernames and passwords to allow searching? 1 means that only #
 # a valid user may search, 0 means that no credentials will be asked                   #
$RequireSearchPass=0;####################################################################

 ########################################################################################
 # now we need an array of all of the usernames and passwords that have access to       #
 # search through our archives.  Usernames and passwords are specified on a single line #
 # per set (as shown below.) By default i've made 2 users "search" who's password is    #
 # "default" and "joe" who's password is "bob"                                          #
$SearchUser['search']="default";                                                        #
$SearchUser['joe']   ="bob";#############################################################

II. backup.php
 ########################################################################################
 # This is the executable that will be called when running the backup from the admin-   #
 # istration panel.  It is expected to dump its output to stdout.  Unless you have a    #
 # good reason, and know what you're doing, you shouldnt change this from mysqldump,    #
 # only specify the right path and filename...                                          #
$backup_cmd='/usr/bin/mysqldump';########################################################

 ########################################################################################
 # $backup_arg should only be changed if you have a particular reason for doing so...   #
 # it's really not meant to be messed with unless you know what you're doing, and have  #
 # a good reason..                                                                      #
$backup_arg=' --host='.$mysql['host'].                                                  #
            ' --user='.$mysql['user'].                                                  #
            ' --pass='.$mysql['pass'].                                                  #
            ' '.$mysql['dbas'].                                                         #
            ' -a --add-drop-table';######################################################

 ########################################################################################
 # Unless you know what you are doing you should leave this alone. this is the command  #
 # that the indexer will use to backup your mysql database... it's made from $backup_cmd#
 # and $backup_arg.  Unless you have a good reason... stick to editing those two things #
$do_backup=$backup_cmd.$backup_arg;######################################################

III. display.php
 ########################################################################################
 # $Defaults['intropage'] is the part of the indexer you want people to see when they   #
 # first come to your indexer web interface.  Right now the options are fairly limited  #
 # but as more functions get added to the indexer this may attain a larger list of      #
 # choices.  "search" will present your users with the search page, "queue" presents    #
 # users with the queueing page, and "admin" would present your users with the admin    #
 # interface (i have no idea why you would want to do this...) this does NOT circumvent #
 # password protections                                                                 #
$Defaults['intropage'] = "search";#######################################################

 ########################################################################################
 # The default page background color                                                    #
$Display['BgColor']    = "#000000";######################################################

 ########################################################################################
 # The default text color                                                               #
$Display['TextColor']  = "#AAAAAA";######################################################

 ########################################################################################
 # The default link color                                                               #
$Display['LinkColor']  = "#FFFFFF";######################################################

 ########################################################################################
 # The default color for the currently active link                                      #
$Display['AlinkColor'] = "#BBBBBB";######################################################

 ########################################################################################
 # The default color for visited links                                                  #
$Display['VlinkColor'] = "#DDDDDD";######################################################

 ########################################################################################
 # The table header background color                                                    #
$Display['TableBg1']   = "#333333";######################################################

 ########################################################################################
 # the regular table background color                                                   #
$Display['TableBg2']   = "#222222";######################################################

 ########################################################################################
 # the default number of search results to display                                      #
$Display['DefaultSearchLimit']   = "10";#################################################

IV. indexer.php
 ########################################################################################
 # $indexer['debug'] turns debugging output iether on, or off (1, or 0)  Unless you     #
 # really want 4 million lines of debugging information, you probably wan to set this   #
 # to 0. P.S. -- sorry, i forgot to add this in the first official 2.0 release...       #
$indexer['debug']=0;#####################################################################

 ########################################################################################
 # The $indexer[timeout] is used to tell php how long to let the indexer live.  this    #
 # number gets boosted through every loop (by $indexer[timeoutinc] below.) So if (for   #
 # some reason) the indexer stops working properly php will time the script out and end #
 # its execution (rather than letting it run errantly for the rest of eternity          #
$indexer[timeout]    = 300;##############################################################

 ########################################################################################
 # The number of "pseudo threads" the indexer script will use... if this number is set  #
 # too high some connections to ftps may be dropped (because of inactivity timeouts)    #
$indexer[threads]    = 2;################################################################

 ########################################################################################
 # Here you can induce 'fake lag' into the indexer. you force the indexer to slow down  #
 # which should make the sysadmins who work for your provider happier with my work :D   #
 # this number is measuerd in microseconts (so a setting of 1000000 will cause the      #
 # the script to wait one second after certain actions)                                 #
$indexer[lag]        = 0;################################################################

 ########################################################################################
 # As mentioned above we are increasing the time that php should let this script live.. #
 # so each time a loop action has been completed php will let the script live (by de-   #
 # fault) an extra 90 seconds.  This is to prevent the indexer from being terminated by #
 # php when it's still fuctioning properly                                              #
$indexer[timeoutinc] = 90;###############################################################

 ########################################################################################
 # After the indexer has finished with its current batch of ftps it shuts down for a    #
 # while and takes a nap (no use annoying your sysadmins) this options defines, in a    #
 # number of seconds, how long that nap is to take                                      #
$indexer[sleep]      = 10;###############################################################

 ########################################################################################
 # There are two modes that the indexer itself may be run in.  My preferred mode of     #
 # opertion is in "daemon" mode (a daemon is a program that sits in the background doing#
 # its thing when nessecary on its own), the alternative method of operation is "cron"  #
 # mode, where the script runs when called, and terminates as soon as it's done.  Each  #
 # has its uses as described in the users manual.  1 means "Daemon", 0 means "Cron"     #
$indexer[daemon]     = 1;################################################################

 ########################################################################################
 # Time (in seconds) an ftp's index lasts by default.  after which it will be  ellige-  #
 # able for reindexing                                                                  #
$indexer[lifespan]   = 259200;###########################################################

 ########################################################################################
 # The number of seconds to wait before trying to reconnect to an FTP site that we have #
 # lost communications to.                                                              #
$indexer['sleepretry'] = 30;#############################################################

 ########################################################################################
 # The number of times to attempt to reconnect to an FTP that we've lost comminucation  #
 # to.  Remember that during these retries (and the wait between retries) we are NOT    #
 # processing other threads... so... use with caution                                   #
$indexer['retry'] = 5;###################################################################

 ########################################################################################
 # $indexer['notify'] is used to hard code e-mail notifications.  when an FTP is first  #
 # submitted, the user who submitted it can pick a place for their notification to go   #
 # but this will allow you, as an administrator to specify as many e-mail addresses as  #
 # you wish to recieve notifications upon a successful indexing venture as you wish     #
 # $indexer['notify'][] = 'ftp-announce-list@apokalyptik.com';                          #
 # $indexer['notify'][] = 'interested_party@apokalyptik.com';                           #
$indexer['notify'][]    = 'apokalyptik@apokalyptik.com';#################################

 ########################################################################################
 # setting $indexer['matchfiles'] to 1 requires the indexer to run a series of checks   #
 # (configurable below) before adding a file to the index.  If the file fails any of    #
 # the checks, then it is skipped over, and never added to the database.  set this opt- #
 # ion to 0 to disable this filtering feature                                           #
$indexer['matchfiles']  = 0;#############################################################

 ########################################################################################
 # setting $indexer['matchdirs'] to one tells the indexer to match against directory    #
 # names on the ftp servers that it connects to.  if a directory name is matched, then  #
 # ALL files inside it will be skipped over.  it's important to note that unless the    #
 # $indexer['matchwild'] is set to 1 this is an EXACT match (except that it is case in- #
 # sensitive).  so a match for '/tmp/' would stop files in /tmp/ from being indexed,    #
 # but /tpm/moretemp/ would be fair game.  also note that a preceeding and trailing '/' #
 # is REQUIRED to match a directory if $indexer['matchwild'] is set to 0                #
$indexer['matchdirs']   = 0;#############################################################

 ########################################################################################
 # setting $indexer['matchwild?'] to 1 will cause the configured matches to be matched  #
 # wildcards.  This means that a "gz" match will match "/gz/directory/" or "gzip.Z".    #
 # setting this option to 0 causes complete matches ONLY to be matched. So - a match    #
 # for porn.jpg would only match porn.jpg, not more-porn.jpg (case insensitive), and    #
 # /tmp/ would only match the /tmp/ directory, and not /files/tmp/scratch/              #
 # $indexer['matchwildf'] sets wildcard matching on files, and $indexer['matchwildd']   #
 # sets wildcard matching on directories.                                               #
$indexer['matchwildf']   = 0;                                                           #
$indexer['matchwildd']   = 0;############################################################

 ########################################################################################
 # $indexer['match'] is an array of strings to be used by the indexer to discard files  #
 # that the site-admin deams to be "innapropriate."  Depending on how the options above #
 # have been configured, these will behave in certain ways.  This list matches against  #
 # both directories and file names                                                      #
$indexer['match'][]     = 'gz';                                                         #
$indexer['match'][]     = 'tmp';#########################################################

V. mysql.php
 ############################################################################################
 # Defined in this file are the settings nessecary to connect to your MYSQL server.  'host' #
 # should be set to the host name or ip address of the server running your mysql database,  #
 # user is your MYSQL username, pass is the password for your MYSQL username, and 'dbas' is #
 # the name of the database you are storing your data inside of                             #
 ############################################################################################

        $mysql['host']='localhost';
        $mysql['user']='mysqluser';
        $mysql['pass']='mysqlpass';
        $mysql['dbas']='mysqldbas';


VI. search.php
 ########################################################################################
 # This option limits the number of directories to display for a file. e.g. if we set   #
 # this to 5, and the file is located in "/i/am/in/a/long/dir/name/for/you/to/find" you #
 # would only see "name/for/you/to/find" as the directory that is displayed. on the     #
 # search page                                                                          #
$search_cutdn_depth      =5;#############################################################

 ########################################################################################
 # if the directory name (after being limited by the variable above) is longer than this#
 # many characters long we will want to cut it down.  To disable this optiont just set  #
 # it to some ridiculously high number (e.g. 10000)                                     #
$search_truncdn_iflength =28;############################################################

 ########################################################################################
 # if we need to cut the directory name, how many characters should we trim it down to  #
 # (the characters will be trimmed off the beginning of the directory name)             #
$search_truncdn_tolength =25;############################################################

 ########################################################################################
 # if we have to trim a directory name this is the string we would put in front of it   #
 # (so that your searching users have some signifier telling them that it has been cut) #
$search_truncdn_prefix   ='...';#########################################################

 ########################################################################################
 # if we have to trim a directory name this is the string we would put in back of it    #
 # (so that your searching users have some signifier telling them that it has been cut) #
$search_truncdn_suffix   ='';############################################################

 ########################################################################################
 # if a filename is longer than this many characters we will trim it (in the same       #
 # fashion as we did the directories)                                                   #
$search_truncfn_iflength =28;############################################################

 ########################################################################################
 # how many characters to trim the filename down to                                     #
$search_truncfn_tolength =25;############################################################

 ########################################################################################
 # if we have to trim a directory name this is the string we would put in front of it   #
 # (so that your searching users have some signifier telling them that it has been cut) #
$search_truncfn_prefix   ='...';#########################################################

 ########################################################################################
 # place this string at the end of any filename that has been trimmed down because it   #
 # is too long                                                                          #
$search_truncfn_suffix   ='';############################################################

 ########################################################################################
 # you shouldnt change this unless you're mean and evil and want to purposely confuse   #
 # your users by starting their search results somewhere in the middle. why do i have   #
 # it here as an option? because i'm too lazy to take it out!                           #
$search_default_offset   =0;#############################################################

 ########################################################################################
 # the default fileize units to display.  valid options are kb (kilobyte), mb (megabyte #
 # gb (gigabyte), and tb (terrbyte) (yea, right...) any other seting will results in    #
 # the usage of bytes.  This setting is NOT always going to be accurate.  It depends    #
 # on the remote FTP server representing the filesize correctly, and in bytes           #
$search_display_units    ='kb';##########################################################

 ########################################################################################
 # should the searching mechanism filter out words specified as bad? 0=no 1=yes.  See   #
 # $search_censor_word to set the list of excluded words                                #
$search_censor           =0;#############################################################

 ########################################################################################
 # a list of words which a user will not be allowed to search for.  If a search is sub- #
 # mitted with any of these words in it the word will, quite simply, be removed from    #
 # the search query.  It just dissappears. Add as many of these as you like... (this    #
 # setting has _NO_ effect unless $search_censor is set to 1.  This is by NO MEANS 100% #
 # effective due to simplistic and literal matching... "amn" will retrieve results with #
 # the word "damn" even though "damn" might be censored by this setting... this also    #
 # censors part of a word... so searching for "sexual" when "sex" is censored would     #
 # result in searching for "ual".  This setting is also case INsensative. meaning that  #
 # "warez" == "Warez" == "WAREZ" == "wArEz".                                            #
$search_censor_word[] ='porn';                                                          # 
$search_censor_word[] ='sex';                                                           #
$search_censor_word[] ='warez';                                                         #
$search_censor_word[] ='mp3';############################################################

VII. templates.php
 ##########################################################################################
 # Here i've defined my templates... you probably do not want to be in this file changing #
 # things around... What you're probably looking for the the .tpl files that control how  #
 # this search engine works.  you may want to close this file now and go find them...     #
 ##########################################################################################

$Templates['header']            = "header.tpl";
$Templates['footer']            = "footer.tpl";
$Templates['queue']             = "queue.tpl";
$Templates['queue-result']      = "queue-result.tpl";
$Templates['queue-fail']        = "queue-fail.tpl";
$Templates['search']            = "search.tpl";
$Templates['search-result1']    = "search-result1.tpl";
$Templates['search-result2']    = "search-result2.tpl";
$Templates['search-result3']    = "search-result3.tpl";
$Templates['search-noresults']  = "search-noresults.tpl";
$Templates['search-fail']       = "search-fail.tpl";
$Templates['admin']             = "admin.tpl";
$Templates['browse-result']     = "browse-result.tpl";
$Templates['redirect']          = "redirect.tpl";
$Templates['notification']      = "notification.tpl";
$Templates['notification-fail'] = "notification-fail.tpl";
$Templates['admin-ftpmod1'] 	= "admin-ftpmod1.tpl";
$Templates['admin-ftpmod2'] 	= "admin-ftpmod2.tpl";
$Templates['admin-ftpmod3'] 	= "admin-ftpmod3.tpl";
$Templates['admin-fileremove'] 	= "admin-fileremove.tpl";
$Templates['admin-doftpmod'] 	= "admin-doftpmod.tpl";