PHP Code:
<?php
/*
--------------------------------------------------------------------------------
PhpDig Version 1.6.x
This program is provided under the GNU/GPL license.
See the LICENSE file for more information.
All contributors are listed in the CREDITS file provided with this package.
PhpDig Website : [url]http://www.phpdig.net/[/url]
--------------------------------------------------------------------------------
*/
//-------------CONFIGURATION FILE-------
//-------------PHP DIG------------------
if ((isset($relative_script_path)) && ($relative_script_path != ".") && ($relative_script_path != "..")&& ($relative_script_path != "./search")) {
exit();
}
if (eregi("config.php",$_SERVER['SCRIPT_FILENAME']) || eregi("config.php",$_SERVER['REQUEST_URI'])) {
exit();
}
define('PHPDIG_VERSION','1.8.0');
$phpdig_language = "en"; // cs, da, de, en, es, fr, gr, it, nl, no, pt
if (!isset($phpdig_language)) { $phpdig_language = "en"; }
define('PHPDIG_ADM_AUTH','1'); // activates/deactivates the authentification functions
define('PHPDIG_ADM_USER','admin'); // username
define('PHPDIG_ADM_PASS','admin'); // password
//template file and style
$template = "$relative_script_path/templates/simple.html";
define('HIGHLIGHT_BACKGROUND','#FFBB00'); //Highlighting background color
//Only for classic mode
define('HIGHLIGHT_COLOR','#000000'); //Highlighting text color
//Only for classic mode
define('LINK_TARGET','_blank'); //Target for result links
define('WEIGHT_IMGSRC','./tpl_img/weight.gif'); //Baragraph image path
define('WEIGHT_HEIGHT','5'); //Baragraph height
define('WEIGHT_WIDTH','50'); //Max baragraph width
define('SEARCH_PAGE','search.php'); //The name of the search page
define('SUMMARY_DISPLAY_LENGTH',150); //Max chars displayed in summary
define('SNIPPET_DISPLAY_LENGTH',150); //Max chars displayed in each snippet
define('DISPLAY_SNIPPETS',true); //Display text snippets
define('DISPLAY_SNIPPETS_NUM',4); //Max snippets to display
define('DISPLAY_SUMMARY',true); //Display description
define('PHPDIG_DATE_FORMAT','\1-\2-\3'); // Date format for last update
// \1 is year, \2 month and \3 day
define("END_OF_LINE_MARKER","\r\n"); // End of line marker - keep double quotes
define('SEARCH_BOX_SIZE',30); // Search box size
define('SEARCH_BOX_MAXLENGTH',50); // Search box maxlength
//---------DEFAULT VALUES
define('PHPDIG_ENCODING','iso-8859-1'); // encoding for interface, search and indexing.
// iso-8859-1, iso-8859-2, iso-8859-7, and
// windows-1251 supported in this version.
// replace/edit phpdig_string_subst/phpdig_words_chars for encodings as needed
$phpdig_string_subst['iso-8859-1'] = 'A:ÀÁÂÃÄÅ,a:*áâãäå,O:ÒÓÔÕÖØ,o:òóôõöø,E:ÈÉÊË,e:èéêë,C:Ç,c:ç,I:ÌÍÎÏ,i:ì*îï,U:ÙÚÛÜ,u:ùúûü,Y:Ý,y:ÿý,N:Ñ,n:ñ';
$phpdig_string_subst['iso-8859-2'] = 'A:ÁÂÄá,C:ÇÆÈ,D:ÏÐ,E:ÉËÊÌ,I:ÍÎ,L:Å¥£,N:ÑÒ,O:ÓÔÖÕ,R:ÀØ,S:¦ª©,T:Þ«,U:ÚÜÙÛ,Y:Ý,Z:¬¯®,a:áâäã±,c:çæè,d:ïð,e:éëêì,i:*î,l:åµ³,n:ñò,o:óôöõ,r:*ø,s:¶º¹,t:þ»,u:úüùû,y:ý,z:¼¿¾';
$phpdig_string_subst['iso-8859-7'] = 'é:ßú,á:Ü,å:Ý,ç:Þ,ï:ü,õ:ýû,ù:þ';
$phpdig_string_subst['windows-1251'] = 'À:*,Á:á,Â:â,Ã:ã,Ä:ä,Å:å,Æ:æ,Ç:ç,È:è,É:é,Ê:ê,Ë:ë,Ì:ì,Í:*,Î:î,Ï:ï,Ð:ð,Ñ:ñ,Ò:ò,Ó:ó,Ô:ô,Õ:õ,Ö:ö,×:÷,Ø:ø,Ù:ù,Ú:ú,Û:û,Ü:ü,Ý:ý,Þ:þ,ß:ÿ';
$phpdig_words_chars['iso-8859-1'] = '[:alnum:]ðþßµ';
$phpdig_words_chars['iso-8859-2'] = '[:alnum:]ðþßµ';
$phpdig_words_chars['iso-8859-7'] = '[:alnum:]ÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÓÔÕÖ×ØÙ¢¸¹º¼¾¿ÚÛáâãäåæçèéêëì*îïðñóôõö÷øùÜÝÞßüýþúûÀ*';
$phpdig_words_chars['windows-1251'] = '[:alnum:]ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞß*áâãäåæçèéêëì*îïðñòóôõö÷øùúûüýþÿ';
// start is AND OPERATOR, exact is EXACT PHRASE, and any is OR OPERATOR
define('SEARCH_DEFAULT_MODE','start'); // default search mode (start|exact|any)
// in language pack make the appropriate changes to 'w_begin', 'w_whole', and 'w_part'
// 'w_begin' => 'and operator', 'w_whole' => 'exact phrase', 'w_part' => 'or operator'
define('SEARCH_DEFAULT_LIMIT',30); //results per page
define('SPIDER_MAX_LIMIT',20); //max recurse levels in spider
define('SPIDER_DEFAULT_LIMIT',3); //default value
define('RESPIDER_LIMIT',4); //recurse limit for update
define('LIMIT_DAYS',7); //default days before reindex a page
define('SMALL_WORDS_SIZE',2); //words to not index
define('MAX_WORDS_SIZE',30); //max word size
define('PHPDIG_EXCLUDE_COMMENT','<!-- phpdigExclude -->');
//comment to exclude a page part
define('PHPDIG_INCLUDE_COMMENT','<!-- phpdigInclude -->');
//comment to include a page part
define('PHPDIG_DEFAULT_INDEX',false); //phpDig considers /index or /default
//html, htm, php, asp, phtml as the
//same as '/'
define('PHPDIG_SESSID_REMOVE',true); // remove SIDS from indexed URLS
define('PHPDIG_SESSID_VAR','PHPSESSID'); // name of the SID variable
define('TITLE_WEIGHT',3); //relative title weight
define('CHUNK_SIZE',2048); //chunk size for regex processing
define('SUMMARY_LENGTH',500); //length of results summary
define('TEXT_CONTENT_PATH','text_content/'); //Text content files path
define('CONTENT_TEXT',1); //Activates/deactivates the
//storage of text content.
define('PHPDIG_IN_DOMAIN',false); //allows phpdig jump hosts in the same
//domain. If the host is "www.mydomain.tld",
//domain is "mydomain.tld"
define('PHPDIG_LOGS',true); //write logs
define('TEMP_FILENAME_LENGTH',8); //filename length of temp files
// if using external tools with extension, use 4 for filename of length 8
define('NUMBER_OF_RESULTS_PER_SITE',-1); //max number of results per site
// use -1 to display all results
define('USE_RENICE_COMMAND','1'); //use renice for process priority
//---------EXTERNAL TOOLS SETUP
// if set to true is_executable used - set to '0' if is_executable is undefined
define('USE_IS_EXECUTABLE_COMMAND','1'); //use is_executable for external binaries
// if set to true, full path to external binary required
define('PHPDIG_INDEX_MSWORD',false);
define('PHPDIG_PARSE_MSWORD','/usr/local/bin/catdoc');
define('PHPDIG_OPTION_MSWORD','-s 8859-1');
define('PHPDIG_INDEX_PDF',false);
define('PHPDIG_PARSE_PDF','/usr/local/bin/pstotext');
define('PHPDIG_OPTION_PDF','-cork');
define('PHPDIG_INDEX_MSEXCEL',false);
define('PHPDIG_PARSE_MSEXCEL','/usr/local/bin/xls2csv');
define('PHPDIG_OPTION_MSEXCEL','');
//---------EXTERNAL TOOLS EXTENSIONS
// if external binary is not STDOUT or different extension is needed
// for example, use '.txt' if external binary writes to filename.txt
define('PHPDIG_MSWORD_EXTENSION','');
define('PHPDIG_PDF_EXTENSION','');
define('PHPDIG_MSEXCEL_EXTENSION','');
//---------FTP SETTINGS
define('FTP_ENABLE',0);//enable ftp content for distant PhpDig
define('FTP_HOST','<ftp host>'); //if distant PhpDig, ftp host;
define('FTP_PORT',21); //ftp port
define('FTP_PASV',1); //passive mode
define('FTP_PATH','<path to phpdig directory>'); //distant path from the ftp root
define('FTP_TEXT_PATH','text_content');//ftp path to text-content directory
define('FTP_USER','<ftp usename>');
define('FTP_PASS','<ftp password>');
// regular expression to ban useless external links in index
define('BANNED','^ad\.|banner|doubleclick');
// regexp forbidden extensions - return sometimes text/html mime-type !!!
define('FORBIDDEN_EXTENSIONS','\.(ico|cab|swf|css|gz|z|tar|zip|tgz|msi|arj|zoo|rar|r[0-9]+|exe|bin|pkg|rpm|deb|bz2)$');
//----------HTML ENTITIES
$spec = array( "&" => "&",
"à" => "*",
"è" => "è",
"ù" => "ù",
"ó" => "ó",
"é" => "é",
"î" => "î",
"ô" => "ô",
"û" => "û",
"ê" => "ê",
"ç" => "ç",
"œ" => "oe",
">" => " ",
"<" => " ",
"°" => " ",
"&apos" => "'",
""" => " ",
"â" => "â",
"ï" => "ï",
"ë" => "ë",
"ä" => "ä",
"ö" => "ö",
"ü" => "ü",
" " => " ",
"ß" => "ß",
"í" => "*",
"®" => " ",
"©" => " ",
"á" => "á",
"Á" => "Á",
"ð" => "ð",
"Ð" => "Ð",
"É" => "É",
"Í" => "Í",
"Ó" => "Ó",
"ú" => "ú",
"Ú" => "Ú",
"Þ" => "Þ",
"þ" => "þ",
"Ö" => "Ö",
"æ" => "æ",
"&AELIG" => "Æ",
"å" => "å",
"Å" => "Å",
"ø" => "ø",
"Ø" => "Ø"
);
//month names in iso dates
$month_names = array ('jan'=>1,
'feb'=>2,
'mar'=>3,
'apr'=>4,
'may'=>5,
'jun'=>6,
'jul'=>7,
'aug'=>8,
'sep'=>9,
'oct'=>10,
'nov'=>11,
'dec'=>12
);
//apache multi indexes parameters
$apache_indexes = array ( "?N=A" => 1,
"?N=D" => 1,
"?M=A" => 1,
"?M=D" => 1,
"?S=A" => 1,
"?S=D" => 1,
"?D=A" => 1,
"?D=D" => 1,
"?C=N&O=A" => 1,
"?C=M&O=A" => 1,
"?C=S&O=A" => 1,
"?C=D&O=A" => 1,
"?C=N&O=D" => 1,
"?C=M&O=D" => 1,
"?C=S&O=D" => 1,
"?C=D&O=D" => 1);
//includes language file
if (is_file("$relative_script_path/locales/$phpdig_language-language.php")) {
include "$relative_script_path/locales/$phpdig_language-language.php";
}
elseif (is_file("$relative_script_path/locales/en-language.php")) {
include "$relative_script_path/locales/en-language.php";
}
else {
die("Unable to select language pack.\n");
}
//connection to database
if (is_file("$relative_script_path/includes/connect.php")) {
include "$relative_script_path/includes/connect.php";
}
elseif(!isset($no_connect)) {
header("location:$relative_script_path/admin/install.php");
}
//includes of libraries
if (is_file("$relative_script_path/libs/phpdig_functions.php")) {
include "$relative_script_path/libs/phpdig_functions.php";
}
else {
die ("Unable to find phpdig_functions.php file.\n");
}
if (is_file("$relative_script_path/libs/function_phpdig_form.php")) {
include "$relative_script_path/libs/function_phpdig_form.php";
}
else {
die ("Unable to find function_phpdig_form.php file.\n");
}
if (is_file("$relative_script_path/libs/mysql_functions.php")) {
include "$relative_script_path/libs/mysql_functions.php";
}
else {
die ("Unable to find mysql_functions.php file.\n");
}
if ((isset($template)) && (!is_file($template))) {
die ("Unable to locate template file.\n");
}
// parse encodings (create global $phpdigEncode);
phpdigCreateSubstArrays($phpdig_string_subst);
// send encoding if needed
if (!headers_sent()) {
header('Content-type:text/html; Charset='.PHPDIG_ENCODING);
}
// turn off magic_quotes_sybase for escaping purposes
@ini_set("magic_quotes_sybase","0");
if (!isset($no_connect)) {
phpdigCheckTables($id_connect,array('engine',
'excludes',
'keywords',
'sites',
'spider',
'tempspider',
'logs'));
}
?>