config.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442
  1. <?php
  2. /*
  3. ----------------------------------------------------------------------------------
  4. PhpDig Version 1.8.x - See the config file for the full version number.
  5. This program is provided WITHOUT warranty under the GNU/GPL license.
  6. See the LICENSE file for more information about the GNU/GPL license.
  7. Contributors are listed in the CREDITS and CHANGELOG files in this package.
  8. Developer from inception to and including PhpDig v.1.6.2: Antoine Bajolet
  9. Developer from PhpDig v.1.6.3 to and including current version: Charter
  10. Copyright (C) 2001 - 2003, Antoine Bajolet, http://www.toiletoine.net/
  11. Copyright (C) 2003 - current, Charter, http://www.phpdig.net/
  12. Contributors hold Copyright (C) to their code submissions.
  13. Do NOT edit or remove this copyright or licence information upon redistribution.
  14. If you modify code and redistribute, you may ADD your copyright to this notice.
  15. ----------------------------------------------------------------------------------
  16. */
  17. //---------DEFAULT VALUES
  18. // error_reporting(E_ALL);
  19. // @ini_set('error_reporting',E_ALL);
  20. //-------------CONFIGURATION FILE-------
  21. //-------------PHP DIG------------------
  22. // NOTE: If you want a different path, you need to add that path (relative path up to the
  23. // admin directory: ../dir or full path up to the admin directory: /full/path/to/dir) in
  24. // the first if statement in this config.php file - for example:
  25. // && ($relative_script_path != "../dir") // relative path
  26. // && ($relative_script_path != "/full/path/to/dir") // full path
  27. // You may also need to set $relative_script_path to this path in search.php, clickstats.php,
  28. // and function_phpdig_form.php depending on what files you are calling from where
  29. // NOTE: double dot means go back one and single dot means stay in same directory
  30. // NOTE: the path should be UP TO but NOT INCLUDING the admin directory - NO ending slash
  31. /***** Example
  32. * PhpDig installed at: http://www.domain.com/phpdig/
  33. * Want search page at: http://www.domain.com/search.php
  34. * Copy http://www.domain.com/phpdig/search.php to http://www.domain.com/search.php
  35. * Copy http://www.domain.com/phpdig/clickstats.php to http://www.domain.com/clickstats.php
  36. * Set $relative_script_path = './phpdig'; in search.php, clickstats.php, and function_phpdig_form.php
  37. * Add ($relative_script_path != "./phpdig") && to if statement
  38. *****/
  39. define('ABSOLUTE_SCRIPT_PATH','/full/path/to/dir'); // full path up to but not including admin dir, no end slash
  40. if ((!isset($relative_script_path)) || (($relative_script_path != ".") &&
  41. ($relative_script_path != "..") && ($relative_script_path != ABSOLUTE_SCRIPT_PATH))) {
  42. // echo "\n\nPath $relative_script_path not recognized!\n\n";
  43. exit();
  44. }
  45. // NOTE: If you receive an "undefined index" message that means that your server is not recognizing
  46. // one or some of the $_SERVER variables so check your PHP info and set the $_SERVER variables to
  47. // those recognized by your server: See http://www.php.net/reserved.variables for a list
  48. // If using RSS (config vars below) there are $_SERVER variables in the custom_search_page.php file too
  49. if ((isset($_SERVER['SCRIPT_FILENAME'])) && (eregi("config.php",$_SERVER['SCRIPT_FILENAME']))) {
  50. exit();
  51. }
  52. if ((isset($_SERVER['SCRIPT_URI'])) && (eregi("config.php",$_SERVER['SCRIPT_URI']))) {
  53. exit();
  54. }
  55. if ((isset($_SERVER['SCRIPT_URL'])) && (eregi("config.php",$_SERVER['SCRIPT_URL']))) {
  56. exit();
  57. }
  58. if ((isset($_SERVER['REQUEST_URI'])) && (eregi("config.php",$_SERVER['REQUEST_URI']))) {
  59. exit();
  60. }
  61. if ((isset($_SERVER['SCRIPT_NAME'])) && (eregi("config.php",$_SERVER['SCRIPT_NAME']))) {
  62. exit();
  63. }
  64. if ((isset($_SERVER['PATH_TRANSLATED'])) && (eregi("config.php",$_SERVER['PATH_TRANSLATED']))) {
  65. exit();
  66. }
  67. if ((isset(api_get_self())) && (eregi("config.php",api_get_self()))) {
  68. exit();
  69. }
  70. define('PHPDIG_VERSION','1.8.6');
  71. $phpdig_language = "en"; // ca, cs, da, de, en, es, fr, gr, it, nl, no, pt
  72. if (!isset($phpdig_language)) { $phpdig_language = "en"; }
  73. define('PHPDIG_ADM_AUTH','1'); //Activates/deactivates the authentification functions
  74. define('PHPDIG_ADM_USER','admin'); //Username
  75. define('PHPDIG_ADM_PASS','secret');
  76. // template file and style - checks to see that template is set to a valid value
  77. if (isset($_REQUEST['template_demo'])) { $template_demo = $_REQUEST['template_demo']; }
  78. $templates_array = array('black.html','bluegrey.html','corporate.html','green.html','grey.html','lightgreen.html','linear.html','newspaper.html','phpdig.html','simple.html','terminal.html','yellow.html','gaagle.html');
  79. if(isset($template_demo) && in_array($template_demo, $templates_array)) {
  80. $template = "$relative_script_path/templates/$template_demo";
  81. } else {
  82. $template = "$relative_script_path/templates/phpdig.html";
  83. }
  84. $template = "array"; // RH: overrides the above
  85. // template file and style - alternatively force the template value
  86. // $template = "$relative_script_path/templates/phpdig.html";
  87. // if using array, set $template = "array";
  88. // if using classic, set $template = "classic";
  89. // now set $template_demo to clean $template filename or empty string
  90. if (($template != "array") && ($template != "classic")) {
  91. $template_demo = substr($template,strrpos($template,"/")+1); // get filename.ext from $template variable
  92. } else {
  93. $template_demo = "";
  94. }
  95. define('HIGHLIGHT_BACKGROUND','#FFBB00'); //Highlighting background color
  96. //Only for classic mode
  97. define('HIGHLIGHT_COLOR','#000000'); //Highlighting text color
  98. //Only for classic mode
  99. define('LINK_TARGET','_blank'); //Target for result links
  100. define('WEIGHT_IMGSRC','./tpl_img/weight.gif'); //Baragraph image path
  101. define('WEIGHT_HEIGHT','5'); //Baragraph height
  102. define('WEIGHT_WIDTH','50'); //Max baragraph width
  103. define('SEARCH_PAGE','search.php'); //The name of the search page
  104. define('DISPLAY_DROPDOWN',true); //Display dropdown on search page
  105. define('DROPDOWN_URLS',true); //Always URLs in dropdown: DISPLAY_DROPDOWN needs to be true
  106. define('SUMMARY_DISPLAY_LENGTH',700); // RH: was 150 //Max chars displayed in summary
  107. define('SNIPPET_DISPLAY_LENGTH',150); //Max chars displayed in each snippet
  108. define('DISPLAY_SNIPPETS',true); //Display text snippets
  109. define('DISPLAY_SNIPPETS_NUM',4); //Max snippets to display
  110. define('DISPLAY_SUMMARY',false); //Display description
  111. define('PHPDIG_DATE_FORMAT','\1-\2-\3'); // Date format for last update
  112. // \1 is year, \2 month and \3 day
  113. // if using rss, use date format \1-\2-\3
  114. define("END_OF_LINE_MARKER","\r\n"); // End of line marker - keep double quotes
  115. define('SEARCH_BOX_SIZE',15); // Search box size
  116. define('SEARCH_BOX_MAXLENGTH',50); // Search box maxlength
  117. define('PHPDIG_ENCODING','iso-8859-1'); // encoding for interface, search and indexing.
  118. // iso-8859-1, iso-8859-2, iso-8859-7, tis-620,
  119. // and windows-1251 supported in this version.
  120. // replace/edit phpdig_string_subst/phpdig_words_chars for encodings as needed
  121. // note: you may need to alter table keywords modify keyword varchar(64) binary; for certain encodings
  122. $phpdig_string_subst['iso-8859-1'] = 'A:ÀÁÂÃÄÅ,a:àáâãäå,O:ÒÓÔÕÖØ,o:òóôõöø,E:ÈÉÊË,e:èéêë,C:Ç,c:ç,I:ÌÍÎÏ,i:ìíîï,U:ÙÚÛÜ,u:ùúûü,Y:Ý,y:ÿý,N:Ñ,n:ñ';
  123. $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:¼¿¾';
  124. $phpdig_string_subst['iso-8859-6'] = 'Q:Q,q:q';
  125. //$phpdig_string_subst['iso-8859-7'] = 'é:ßú,á:Ü,å:Ý,ç:Þ,ï:ü,õ:ýû,ù:þ';
  126. $phpdig_string_subst['iso-8859-7'] = 'á:Á¶Ü,â:Â,ã:Ã,ä:Ä,å:ŸÝ,æ:Æ,ç:Þǹ,è:è,é:ßúɺ,ê:Ê,ë:Ë,ì:Ì,í:Í,î:Î,ï:ü¼Ï,ð:Ð,ñ:Ñ,ó:Óò,ô:Ô,õ:ýûÕ¾,ö:Ö,÷:×,ø:Ø,ù:þÙ¿';
  127. $phpdig_string_subst['tis-620'] = 'Q:Q,q:q';
  128. $phpdig_string_subst['windows-1251'] = 'À:à,Á:á,Â:â,Ã:ã,Ä:ä,Å:å,Æ:æ,Ç:ç,È:è,É:é,Ê:ê,Ë:ë,Ì:ì,Í:í,Î:î,Ï:ï,Ð:ð,Ñ:ñ,Ò:ò,Ó:ó,Ô:ô,Õ:õ,Ö:ö,×:÷,Ø:ø,Ù:ù,Ú:ú,Û:û,Ü:ü,Ý:ý,Þ:þ,ß:ÿ';
  129. $phpdig_words_chars['iso-8859-1'] = '[:alnum:]ðþßµ';
  130. $phpdig_words_chars['iso-8859-2'] = '[:alnum:]ðþßµ';
  131. $phpdig_words_chars['iso-8859-6'] = '[:alnum:]¤¬»¿ÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚàáâãäåæçèéêëìíîïðñò';
  132. $phpdig_words_chars['iso-8859-7'] = '[:alnum:]ÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÓÔÕÖ×ØÙ¢¸¹º¼¾¿ÚÛáâãäåæçèéêëìíîïðñóôõö÷øùÜÝÞßüýþúûÀà';
  133. $phpdig_words_chars['tis-620'] = '[:alnum:]¡¢£¤¥¦§¨©ª«¬_®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÜßàáâãäåæçèéêëìíîïðñòóôõö÷øùúû';
  134. $phpdig_words_chars['windows-1251'] = '[:alnum:]ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ';
  135. // start is AND OPERATOR, exact is EXACT PHRASE, and any is OR OPERATOR
  136. define('SEARCH_DEFAULT_MODE','start'); // default search mode (start|exact|any)
  137. // in language pack make the appropriate changes to 'w_begin', 'w_whole', and 'w_part'
  138. // 'w_begin' => 'and operator', 'w_whole' => 'exact phrase', 'w_part' => 'or operator'
  139. define('SEARCH_DEFAULT_LIMIT',10); //results per page
  140. define('SPIDER_MAX_LIMIT',20); //max recurse levels in spider
  141. define('RESPIDER_LIMIT',5); //recurse respider limit for update
  142. define('LINKS_MAX_LIMIT',20); //max links per each level
  143. define('RELINKS_LIMIT',5); //recurse links limit for an update
  144. //for limit to directory, URL format must either have file at end or ending slash at end
  145. //e.g., http://www.domain.com/dirs/ (WITH ending slash) or http://www.domain.com/dirs/dirs/index.php
  146. define('LIMIT_TO_DIRECTORY',true); //limit index to given (sub)directory, no sub dirs of dirs are indexed
  147. define('LIMIT_DAYS',0); //default days before reindex a page
  148. define('SMALL_WORDS_SIZE',2); //words to not index - must be 2 or more
  149. define('MAX_WORDS_SIZE',50); // RH: was 30 //max word size
  150. define('PHPDIG_EXCLUDE_COMMENT','<!-- phpdigExclude -->'); //comment to exclude a page part
  151. define('PHPDIG_INCLUDE_COMMENT','<!-- phpdigInclude -->'); //comment to include a page part
  152. // must be on own lines in HTML source
  153. // text within comments not indexed
  154. // links within comments still indexed
  155. define('PHPDIG_DEFAULT_INDEX',false); //phpDig considers /index or /default
  156. //html, htm, php, asp, phtml as the
  157. //same as '/'
  158. define('ALLOW_RSS_FEED',false); // Do RSS and display link - if true, set rss dir to 777
  159. $theenc = PHPDIG_ENCODING; // needs to be same encoding used in index
  160. $theurl = "http://www.phpdig.net/"; // site offering the RSS feed
  161. $thetitle = "PhpDig.net"; // title for site offering the RSS feed
  162. $thedesc = "PhpDig :: Web Spider and Search Engine"; // description of site offering the RSS feed
  163. $thedir = "./rss"; // the rss directory name, no ending slash
  164. $thefile = "search.rss"; // used in rss filenames
  165. define('PHPDIG_SESSID_REMOVE',true); // remove SIDS or vars from indexed URLS
  166. define('PHPDIG_SESSID_VAR','PHPSESSID,s'); // name of SID or variable to remove
  167. // can be 's' or comma delimited 's,id,var,foo,etc'
  168. define('APPEND_TITLE_META',false); //append title and meta information to results
  169. define('TITLE_WEIGHT',3); //relative title weight: APPEND_TITLE_META needs to be true
  170. define('CHUNK_SIZE',1024); //chunk size for regex processing
  171. define('SUMMARY_LENGTH',500); //length of results summary
  172. define('TEXT_CONTENT_PATH','text_content/'); //Text content files path
  173. define('CONTENT_TEXT',0); // RH: was 1 //Activates/deactivates the
  174. //storage of text content.
  175. define('PHPDIG_IN_DOMAIN',false); //allows phpdig jump hosts in the same
  176. //domain. If the host is "www.mydomain.tld",
  177. //domain is "mydomain.tld"
  178. define('PHPDIG_LOGS',true); //write logs
  179. define('SILENCE_404S',true); //silence 404 output
  180. define('TEMP_FILENAME_LENGTH',8); //filename length of temp files
  181. // if using external tools with extension, use 4 for filename of length 8
  182. define('NUMBER_OF_RESULTS_PER_SITE',-1); //max number of results per site
  183. // use -1 to display all results
  184. define('USE_RENICE_COMMAND','1'); //use renice for process priority
  185. //---------EXTERNAL TOOLS SETUP
  186. // if set to true is_executable used - set to '0' if is_executable is undefined
  187. define('USE_IS_EXECUTABLE_COMMAND','0'); // RH: was 1 //use is_executable for external binaries
  188. // if set to true, full path to external binary required
  189. define('PHPDIG_INDEX_MSWORD',false);
  190. define('PHPDIG_PARSE_MSWORD','/usr/local/bin/catdoc');
  191. define('PHPDIG_OPTION_MSWORD','-s 8859-1');
  192. define('PHPDIG_INDEX_PDF',false);
  193. define('PHPDIG_PARSE_PDF','/usr/local/bin/pstotext');
  194. define('PHPDIG_OPTION_PDF','-cork');
  195. define('PHPDIG_INDEX_MSEXCEL',false);
  196. define('PHPDIG_PARSE_MSEXCEL','/usr/local/bin/xls2csv');
  197. define('PHPDIG_OPTION_MSEXCEL','');
  198. define('PHPDIG_INDEX_MSPOWERPOINT',false);
  199. define('PHPDIG_PARSE_MSPOWERPOINT','/usr/local/bin/ppt2text');
  200. define('PHPDIG_OPTION_MSPOWERPOINT','');
  201. //---------EXTERNAL TOOLS EXTENSIONS
  202. // if external binary is not STDOUT or different extension is needed
  203. // for example, use '.txt' if external binary writes to filename.txt
  204. define('PHPDIG_MSWORD_EXTENSION','');
  205. define('PHPDIG_PDF_EXTENSION','');
  206. define('PHPDIG_MSEXCEL_EXTENSION','');
  207. define('PHPDIG_MSPOWERPOINT_EXTENSION','');
  208. //---------FTP SETTINGS
  209. define('FTP_ENABLE',0);//enable ftp content for distant PhpDig
  210. define('FTP_HOST','<ftp host>'); //if distant PhpDig, ftp host;
  211. define('FTP_PORT',21); //ftp port
  212. define('FTP_PASV',1); //passive mode
  213. define('FTP_PATH','<path to phpdig directory>'); //distant path from the ftp root
  214. define('FTP_TEXT_PATH','text_content');//ftp path to text-content directory
  215. define('FTP_USER','<ftp usename>');
  216. define('FTP_PASS','<ftp password>');
  217. //--------CRON SETTINGS
  218. define('CRON_ENABLE',false);
  219. define('CRON_EXEC_FILE','/usr/bin/crontab');
  220. define('CRON_CONFIG_FILE',ABSOLUTE_SCRIPT_PATH.'/admin/temp/cronfile.txt');
  221. define('PHPEXEC','/usr/local/bin/php');
  222. // NOTE: make sure ABSOLUTE_SCRIPT_PATH is the full path up to but not including the admin dir, no ending slash
  223. // NOTE: CRON_ENABLE set to true writes a file at CRON_CONFIG_FILE containing the cron job information
  224. // The CRON_CONFIG_FILE must be 777 permissions if applicable to your OS/setup
  225. // You still need to call the CRON_CONFIG_FILE to run the cron job!!!
  226. // From shell: crontab CRON_CONFIG_FILE to set the cron job: replace CRON_CONFIG_FILE with actual file
  227. // From shell: crontab -l to list and crontab -d to delete
  228. // regular expression to ban useless external links in index
  229. define('BANNED','^ad\.|banner|doubleclick');
  230. // regexp forbidden extensions - return sometimes text/html mime-type !!!
  231. define('FORBIDDEN_EXTENSIONS','\.(rm|ico|cab|swf|css|gz|z|tar|zip|tgz|msi|arj|zoo|rar|r[0-9]+|exe|bin|pkg|rpm|deb|bz2)$');
  232. //----------HTML ENTITIES
  233. $spec = array( "&amp" => "&",
  234. "&agrave" => "à",
  235. "&egrave" => "è",
  236. "&ugrave" => "ù",
  237. "&oacute;" => "ó",
  238. "&eacute" => "é",
  239. "&icirc" => "î",
  240. "&ocirc" => "ô",
  241. "&ucirc" => "û",
  242. "&ecirc" => "ê",
  243. "&ccedil" => "ç",
  244. "&#156" => "oe",
  245. "&gt" => " ",
  246. "&lt" => " ",
  247. "&deg" => " ",
  248. "&apos" => "'",
  249. "&quot" => " ",
  250. "&acirc" => "â",
  251. "&iuml" => "ï",
  252. "&euml" => "ë",
  253. "&auml" => "ä",
  254. "&Auml" => "Ä",
  255. "&Euml" => "Ë",
  256. "&Iuml" => "Ï",
  257. "&Uuml" => "Ü",
  258. "&ouml" => "ö",
  259. "&uuml" => "ü",
  260. "&nbsp" => " ",
  261. "&szlig" => "ß",
  262. "&iacute" => "í",
  263. "&reg" => " ",
  264. "&copy" => " ",
  265. "&aacute" => "á",
  266. "&Aacute" => "Á",
  267. "&eth" => "ð",
  268. "&ETH" => "Ð",
  269. "&Eacute" => "É",
  270. "&Iacute" => "Í",
  271. "&Oacute" => "Ó",
  272. "&uacute" => "ú",
  273. "&Uacute" => "Ú",
  274. "&THORN" => "Þ",
  275. "&thorn" => "þ",
  276. "&Ouml" => "Ö",
  277. "&aelig" => "æ",
  278. "&AELIG" => "Æ",
  279. "&aring" => "å",
  280. "&Aring" => "Å",
  281. "&oslash" => "ø",
  282. "&Oslash" => "Ø"
  283. );
  284. //month names in iso dates
  285. $month_names = array ('jan'=>1,
  286. 'feb'=>2,
  287. 'mar'=>3,
  288. 'apr'=>4,
  289. 'may'=>5,
  290. 'jun'=>6,
  291. 'jul'=>7,
  292. 'aug'=>8,
  293. 'sep'=>9,
  294. 'oct'=>10,
  295. 'nov'=>11,
  296. 'dec'=>12
  297. );
  298. //apache multi indexes parameters
  299. $apache_indexes = array ( "?N=A" => 1,
  300. "?N=D" => 1,
  301. "?M=A" => 1,
  302. "?M=D" => 1,
  303. "?S=A" => 1,
  304. "?S=D" => 1,
  305. "?D=A" => 1,
  306. "?D=D" => 1,
  307. "?C=N&amp;O=A" => 1,
  308. "?C=M&amp;O=A" => 1,
  309. "?C=S&amp;O=A" => 1,
  310. "?C=D&amp;O=A" => 1,
  311. "?C=N&amp;O=D" => 1,
  312. "?C=M&amp;O=D" => 1,
  313. "?C=S&amp;O=D" => 1,
  314. "?C=D&amp;O=D" => 1);
  315. //includes language file
  316. define('PHPDIG_LANG_CONSTANT',$phpdig_language); // this line for classic
  317. if (is_file("$relative_script_path/locales/$phpdig_language-language.php")) {
  318. include "$relative_script_path/locales/$phpdig_language-language.php";
  319. }
  320. elseif (is_file("$relative_script_path/locales/en-language.php")) {
  321. include "$relative_script_path/locales/en-language.php";
  322. }
  323. else {
  324. die("Unable to select language pack.\n");
  325. }
  326. //connection to database
  327. if ((!isset($no_connect)) || ($no_connect != 1)) {
  328. if (is_file("$relative_script_path/includes/connect.php")) {
  329. include "$relative_script_path/includes/connect.php";
  330. }
  331. else {
  332. die("Unable to find connect.php file.\n");
  333. }
  334. }
  335. //includes of libraries
  336. if (is_file("$relative_script_path/libs/phpdig_functions.php")) {
  337. include "$relative_script_path/libs/phpdig_functions.php";
  338. }
  339. else {
  340. die ("Unable to find phpdig_functions.php file.\n");
  341. }
  342. if (is_file("$relative_script_path/libs/function_phpdig_form.php")) {
  343. include "$relative_script_path/libs/function_phpdig_form.php";
  344. }
  345. else {
  346. die ("Unable to find function_phpdig_form.php file.\n");
  347. }
  348. if (is_file("$relative_script_path/libs/mysql_functions.php")) {
  349. include "$relative_script_path/libs/mysql_functions.php";
  350. }
  351. else {
  352. die ("Unable to find mysql_functions.php file.\n");
  353. }
  354. if ((!isset($template)) || ((!is_file($template)) && ($template != "array") && ($template != "classic"))) {
  355. die ("Unable to render template file.\n");
  356. }
  357. if (!defined('CONFIG_CHECK')) {
  358. exit();
  359. }
  360. // parse encodings (create global $phpdigEncode);
  361. phpdigCreateSubstArrays($phpdig_string_subst);
  362. // send encoding if needed
  363. if (!headers_sent()) {
  364. header('Content-type:text/html; Charset='.PHPDIG_ENCODING);
  365. }
  366. // turn off magic_quotes_runtime for escaping purposes
  367. @ini_set('magic_quotes_runtime',false);
  368. // turn off magic_quotes_sybase for escaping purposes
  369. @ini_set('magic_quotes_sybase',false);
  370. if ((!isset($no_connect)) || ($no_connect != 1)) {
  371. phpdigCheckTables($id_connect,array('engine',
  372. 'excludes',
  373. 'keywords',
  374. 'sites',
  375. 'spider',
  376. 'tempspider',
  377. 'logs',
  378. 'clicks',
  379. 'site_page',
  380. 'includes'));
  381. }
  382. ?>