PageRenderTime 66ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/search/admin/index.php

https://bitbucket.org/molusc/sma-website
PHP | 2997 lines | 2698 code | 229 blank | 70 comment | 298 complexity | df8f3f097cc0f76328ce904e84482fe9 MD5 | raw file
Possible License(s): BSD-3-Clause
  1. <?php
  2. /******************************************************************************
  3. * iSearch2 - website search engine *
  4. * *
  5. * Visit the iSearch homepage at http://www.iSearchTheNet.com/isearch *
  6. * *
  7. * Copyright (C) 2002-2007 Z-Host. All rights reserved. *
  8. * *
  9. ******************************************************************************/
  10. $isearch_path = dirname(__FILE__).'/..';
  11. define('IN_ISEARCH', true);
  12. require_once "$isearch_path/inc/core.inc.php";
  13. isearch_open();
  14. isearch_createTables();
  15. require_once "$isearch_path/inc/admin_auth.inc.php";
  16. require_once "$isearch_path/inc/search.inc.php";
  17. require_once "$isearch_path/inc/spider.inc.php";
  18. require_once "$isearch_path/lang/config.inc.php";
  19. require_once "$isearch_path/style/config.inc.php";
  20. $isearch_action = isset($_REQUEST['isearch_action']) ? $_REQUEST['isearch_action'] : '';
  21. $isearch_tab = isset($_REQUEST['isearch_tab']) ? $_REQUEST['isearch_tab'] : '0';
  22. $isearch_pro = False;
  23. $isearch_pro = True;
  24. $base_url = ereg_replace('/admin((/)|(/index.php))?$', '', $PHP_SELF);
  25. if ($isearch_config['base_url'] != $base_url)
  26. {
  27. if (!mysql_query("UPDATE $isearch_table_info SET base_url='" . isearch_escape_string($base_url) . "' WHERE id='1'", $isearch_db))
  28. {
  29. echo "<P>MySQL Error : " . mysql_error() . " File: " . __FILE__ . " Line: " . __LINE__;
  30. }
  31. $isearch_config['base_url'] = $base_url;
  32. }
  33. $only_available = $isearch_pro ? '' : '<DIV style="color: red;">Only available in the professional version.</DIV><BR>';
  34. /* Array of controls on various tabs */
  35. $tabData =
  36. array(
  37. array(
  38. 'name' => 'Basic',
  39. 'description' => 'Basic configuration options',
  40. 'controls' =>
  41. array(
  42. array(
  43. 'name' => 'Site Administrator Email Address',
  44. 'description' => 'Used for emailing search log and statistics and automatic update notification. Your email address is never shared or sent from your own server.',
  45. 'varname' => 'admin_email',
  46. 'type' => 'text',
  47. 'size' => '40',
  48. 'maxlength' => '255',
  49. ),
  50. array(
  51. 'name' => 'Start URL(s)',
  52. 'description' => 'A list of URLs that spidering should start from. Multiple start sites can be specified on seperate lines.<P>This is normally your home page (e.g. "http://www.yoursite.com/"). Start&nbsp;URL(s) are always included in the search index regardless of the Allowed&nbsp;URL(s)/Exclude&nbsp;URL(s) lists. If entries in this list begin with an "@" symbol they are treated as a file containing entries.',
  53. 'varname' => 'start_urls',
  54. 'type' => 'textarea',
  55. ),
  56. array(
  57. 'name' => 'Allow URL(s) Beginning',
  58. 'description' => 'A URL must match an entry in this list or "Allow URL(s) Regexp" to be included in the search index. Multiple entries are allowed on seperate lines.<P>This should normally allow URLS from your website to be included (e.g. "http://www.yoursite.com"). If entries in this list begin with an "@" symbol they are treated as a file containing entries.',
  59. 'varname' => 'allowed_urls_beginning',
  60. 'type' => 'textarea',
  61. ),
  62. array(
  63. 'name' => 'Exclude URL(s) Beginning',
  64. 'description' => 'A URL will not be added to the search index if it begins with one of the entries in this list. Multiple entries are allowed on seperate lines.<P>This allows you to exclude certain URLs from the search index. URLs that match both the allowed list and disallowed list are not included in the search index. (e.g. "http://www.yoursite.com/private/"). This does not affect URLs already in the search index (use "Reset URL Index" then "Spider" after changing this setting). If entries in this list begin with an "@" symbol they are treated as a file containing entries.',
  65. 'varname' => 'exclude_urls_beginning',
  66. 'type' => 'textarea',
  67. ),
  68. array(
  69. 'name' => 'Test Mode',
  70. 'description' => '<UL><LI>Disabled - Test mode is disabled.<LI>Follow Links Only - The spider will follow links, but will not create a search index.</UL>',
  71. 'varname' => 'test_mode',
  72. 'type' => 'combo',
  73. 'items' =>
  74. array(
  75. array('value' => '0', 'description' => 'Disabled'),
  76. array('value' => '1', 'description' => 'Follow Links Only'),
  77. ),
  78. ),
  79. array(
  80. 'name' => 'Update Notification',
  81. 'description' => 'Periodically check for updates to iSearch and send you an email if a newer version is available.',
  82. 'varname' => 'notify_updates',
  83. 'type' => 'checkbox',
  84. ),
  85. ),
  86. ),
  87. array(
  88. 'name' => 'Spider Basic',
  89. 'description' => 'Basic settings for the spider engine',
  90. 'controls' =>
  91. array(
  92. array(
  93. 'name' => 'Allowed File Extension(s)',
  94. 'description' => 'Only files with the file extensions specified will be spidered. Multiple entries are seperated by spaces. (e.g. "php&nbsp;htm&nbsp;html"). In addition, URLs without file extensions will be treated as directories (see the "Allow Directories" configuration option).',
  95. 'varname' => 'allowed_ext',
  96. 'type' => 'text',
  97. 'size' => '40',
  98. 'maxlength' => '255',
  99. ),
  100. array(
  101. 'name' => 'Directory Handling',
  102. 'description' => 'Specify how directories (URLs without a "." in the filename) are handled. Normally you should allow them and add a trailing slash.',
  103. 'varname' => 'directory_handling',
  104. 'type' => 'combo',
  105. 'items' =>
  106. array(
  107. array('value' => '0', 'description' => 'Directories are Excluded'),
  108. array('value' => '1', 'description' => 'Allow Directories'),
  109. array('value' => '2', 'description' => 'Allow and Add Trailing Slash'),
  110. array('value' => '3', 'description' => 'Allow and Strip Trailing Slash'),
  111. ),
  112. ),
  113. array(
  114. 'name' => 'Strip Default Filenames',
  115. 'description' => 'A list of default filenames that will be removed from URLs. If a URL ends in one of these filenames, the filename will be stripped from the URL.',
  116. 'varname' => 'strip_defaults',
  117. 'type' => 'text',
  118. 'size' => '40',
  119. 'maxlength' => '255',
  120. ),
  121. array(
  122. 'name' => 'Keep Cached Copies',
  123. 'description' => 'Keeps a cached copy of the page contents when it was spidered. This can be useful for dynamic pages that update frequently.',
  124. 'varname' => 'keep_cache',
  125. 'type' => 'checkbox',
  126. ),
  127. array(
  128. 'name' => 'www subdomain handling',
  129. 'description' => 'Select whether you want the www subdomain to be left as it is, stripped off or always added when spidering pages. If you select "Leave as is" you may end up with multiple copies of the same page in the search index, e.g. <I>http://www.yourdomain.com/index.php</I> and <I>http://yourdomain.com/index.php</I>. If you do not use subdomains of your main domain, it is suggested to use the "Add www subdomain" option.',
  130. 'varname' => 'www_option',
  131. 'type' => 'combo',
  132. 'items' =>
  133. array(
  134. array('value' => '1', 'description' => 'Leave as is'),
  135. array('value' => '2', 'description' => 'Strip www subdomains'),
  136. array('value' => '3', 'description' => 'Add www subdomain'),
  137. ),
  138. ),
  139. array(
  140. 'name' => 'Max File Size',
  141. 'description' => 'Maximum number of bytes to read from each file that we index. If a file is larger than this, only the first part of it will be read.' . $isearch_pro ? ' If you index PDF or MS Word documents, you should probably increase this setting to 1048576 (1MB). Note that the limit for online conversion is 1048576 bytes.' : '',
  142. 'varname' => 'max_file_size',
  143. 'type' => 'text',
  144. 'size' => '7',
  145. 'maxlength' => '7',
  146. 'min' => '4096',
  147. 'max' => '9999999',
  148. ),
  149. array(
  150. 'name' => 'Stop Word Length',
  151. 'description' => 'Words of this number of characters or less will be ignored during spidering. Suggested value is 2 or 3. Set to 0 to disable this feature.',
  152. 'varname' => 'stop_words_length',
  153. 'type' => 'text',
  154. 'size' => '2',
  155. 'maxlength' => '2',
  156. 'min' => '0',
  157. 'max' => '10',
  158. ),
  159. array(
  160. 'name' => 'Stop Words',
  161. 'description' => 'Define a list of words to ignore during searching. Searching for these words will not match anything.',
  162. 'varname' => 'stop_words',
  163. 'type' => 'textarea',
  164. ),
  165. array(
  166. 'name' => 'Spider Echo Level',
  167. 'description' => 'Level of information displayed on screen when spidering. 0 is silent, 1 logs only errors, 10 is very verbose. Suggested value is 3.',
  168. 'varname' => 'log_echo_level',
  169. 'type' => 'text',
  170. 'size' => '2',
  171. 'maxlength' => '2',
  172. 'min' => '0',
  173. 'max' => '10',
  174. ),
  175. ),
  176. ),
  177. array(
  178. 'name' => 'Spider Advanced',
  179. 'description' => 'Advanced settings for the spider engine',
  180. 'notes' => '<UL><LI>For more information about using regular expressions (regexps), <A HREF="http://www.phpbuilder.com/columns/dario19990616.php3" TARGET="_blank">click here</A>.</LI></UL>',
  181. 'controls' =>
  182. array(
  183. array(
  184. 'name' => 'Allow URL(s) Regexp',
  185. 'description' => 'A list regular expressions for URLs that are allowed in the search index. Multiple entries are allowed on seperate lines. These normally start with your website (e.g. "^http://(www\.)?yoursite\.com"). The "^" character matches a start of string, "$" matches an end of string, "." matches a single character, "\\." matches a dot, "(www\.)?" matches an optional "www." subdomain, ".*" matches any string. If entries in this list begin with an "@" symbol they are treated as a file containing entries.',
  186. 'varname' => 'allowed_urls',
  187. 'type' => 'textarea',
  188. ),
  189. array(
  190. 'name' => 'Exclude URL(s) Regexp',
  191. 'description' => 'A list regular expressions for URLs that will not be added to the search index. This allows more powerful pattern matching for URL exclusion. (e.g. "^http://(www\.)?yoursite\.com/private/"). This does not affect URLs already in the search index (use "Reset URL Index" then "Spider" after changing this setting). If entries in this list begin with an "@" symbol they are treated as a file containing entries.',
  192. 'varname' => 'exclude_urls',
  193. 'type' => 'textarea',
  194. ),
  195. array(
  196. 'name' => 'Follow Frames',
  197. 'description' => 'Causes the spider engine to index any sub-frames that it finds. Note that many major search engines (including Google) do not do this. It is much better to author your site to support legacy browsers using the &lt;NOFRAMES&gt; tag.',
  198. 'varname' => 'follow_frames',
  199. 'type' => 'checkbox',
  200. ),
  201. array(
  202. 'name' => 'Aggressive Link Search',
  203. 'description' => 'Aggressive link search attempts to find links to other pages that are not HTML anchors. Any complete URLs will be found anywhere on your page (they must include the "http://" part), including within comments and HTML &lt;head&gt; section.',
  204. 'varname' => 'aggressive_link_search',
  205. 'type' => 'checkbox',
  206. ),
  207. array(
  208. 'name' => 'Javascript Link Search',
  209. 'description' => 'Attempts to find links to pages that within JavaScript. It searches for JavaScript window.open() calls in indexed pages. If you do not use JavaScript menus, then select "None". If you use embedded JavaScipt menus (i.e. the JavaScript is in the HTML file) then select "Embedded*quot;. If your JavaScript menus are in seperate (.js) files, then select "Embedded and External".',
  210. 'varname' => 'javascript_link_search',
  211. 'type' => 'combo',
  212. 'items' =>
  213. array(
  214. array('value' => '0', 'description' => 'None'),
  215. array('value' => '1', 'description' => 'Embedded'),
  216. array('value' => '2', 'description' => 'Embedded and External'),
  217. ),
  218. ),
  219. array(
  220. 'name' => 'Remove GET variables',
  221. 'description' => 'A list of variable names that will be removed from the query part (after a ?) of URLs. This can be used to strip variables using for storing session information. e.g. "PHPSESSID". If your site does not have dynamic content, you could set this to "*" to remove all GET variables (everything after the "?" will be stripped.',
  222. 'varname' => 'remove_get_vars',
  223. 'type' => 'text',
  224. 'size' => '40',
  225. 'maxlength' => '255',
  226. ),
  227. array(
  228. 'name' => 'Additional Spider Delay',
  229. 'description' => 'Inserts an additional delay (in seconds) between spidering of each page. This reduces the load on your server, but increases the times it takes to spider your site. Set to 0 to disable.',
  230. 'varname' => 'spider_delay',
  231. 'type' => 'text',
  232. 'size' => '4',
  233. 'maxlength' => '4',
  234. 'min' => '0',
  235. 'max' => '9999',
  236. ),
  237. array(
  238. 'name' => 'Url Search',
  239. 'description' => 'This option allows parts of a URL to be replaced using a regexp before it is opened. If your site is hosted by Lycos, you may be unable to use url file opens. Set <I>Url Search</I> to "^http://members\\.lycos\\.co\\.uk/username/" and <I>Url Replace</I> to "/data/members/free/tripod/uk/u/s/e/username/htdocs/" (ensure that path names are correct for your site). Leave empty to disable this option.',
  240. 'varname' => 'url_search',
  241. 'type' => 'text',
  242. 'size' => '40',
  243. 'maxlength' => '255',
  244. ),
  245. array(
  246. 'name' => 'Url Replace',
  247. 'description' => 'See <I>URL Search</I> above.',
  248. 'varname' => 'url_replace',
  249. 'type' => 'text',
  250. 'size' => '40',
  251. 'maxlength' => '255',
  252. ),
  253. array(
  254. 'name' => 'Basic Authorization',
  255. 'description' => 'If your site uses HTTP Basic Authorization (.htaccess files) for user login, enter a username and password (seperated by a colon) for iSearch, so that password protected pages on your site can be read, e.g. "username:password". <B>WARNING: THIS IS SENT ON ALL URL REQUESTS THAT ISEARCH MAKES</B>. Check your "Allowed URL(s)" carefull to make sure that you do not give you password to other sites.',
  256. 'varname' => 'basic_authorization',
  257. 'type' => 'text',
  258. 'size' => '40',
  259. 'maxlength' => '255',
  260. ),
  261. array(
  262. 'name' => 'Follow Meta Refresh',
  263. 'description' => 'Causes the spider engine to index any pages that are redirected to using an HTML &quot;META REFRESH&quot; tag.',
  264. 'varname' => 'follow_meta_refresh',
  265. 'type' => 'checkbox',
  266. ),
  267. array(
  268. 'name' => 'File Redirect Handling',
  269. 'description' => 'Determine the handling of File redirects (i.e. HTTP "Location" headers)',
  270. 'varname' => 'file_redirect_handling',
  271. 'type' => 'combo',
  272. 'items' =>
  273. array(
  274. array('value' => '0', 'description' => 'Do Not Follow File Redirects'),
  275. array('value' => '1', 'description' => 'Follow All File Redirects'),
  276. array('value' => '2', 'description' => 'Follow Redirects within Current Domain'),
  277. array('value' => '3', 'description' => 'Follow Redirects within Allowed URLs'),
  278. ),
  279. ),
  280. array(
  281. 'name' => 'Directory Redirect Handling',
  282. 'description' => 'Determine the handling of directory redirects (i.e. HTTP "Location" headers)',
  283. 'varname' => 'dir_redirect_handling',
  284. 'type' => 'combo',
  285. 'items' =>
  286. array(
  287. array('value' => '0', 'description' => 'Do Not Follow Directory Redirects'),
  288. array('value' => '1', 'description' => 'Follow All Directory Redirects'),
  289. array('value' => '2', 'description' => 'Follow Redirects within Current Domain'),
  290. array('value' => '3', 'description' => 'Follow Redirects within Allowed URLs'),
  291. ),
  292. ),
  293. array(
  294. 'name' => 'Ignore Image Alt Tags',
  295. 'description' => 'Causes iSearch to ignore the &lt;alt&gt; tag taxt of images in the spider index.',
  296. 'varname' => 'ignore_image_alt_tags',
  297. 'type' => 'checkbox',
  298. ),
  299. array(
  300. 'name' => 'Reading Mechanism',
  301. 'description' => 'Determine how iSearch reads files that it is spidering.<UL>' .
  302. '<LI>"Auto Detect" will automatically detect a mechnism that should work.<BR>'.
  303. '<LI>"fopen" uses PHP fopen wrappers ('.($isearch_url_fopen_detected ? '' : 'NOT ').'OK).<BR>'.
  304. '<LI>"sockets" uses native sockets (http only) ('.($isearch_sockets_detected ? '' : 'NOT ').'OK).<BR>'.
  305. '<LI>"curl" uses libcurl, which must be compiled into your PHP executable ('.($isearch_curl_detected ? '' : 'NOT ').'OK).</UL>',
  306. 'varname' => 'reading_mechanism',
  307. 'type' => 'combo',
  308. 'items' =>
  309. array(
  310. array('value' => '0', 'description' => 'Auto Detect'),
  311. array('value' => '1', 'description' => 'fopen'),
  312. array('value' => '2', 'description' => 'sockets'),
  313. array('value' => '3', 'description' => 'curl'),
  314. ),
  315. ),
  316. ),
  317. ),
  318. array(
  319. 'name' => 'Proxy',
  320. 'description' => 'Enable spidering of sites using a proxy server.',
  321. 'controls' =>
  322. array(
  323. array(
  324. 'name' => 'Proxy Enable',
  325. 'description' => 'Enable use of a proxy server for spidering pages.',
  326. 'varname' => 'proxy_enable',
  327. 'type' => 'checkbox',
  328. ),
  329. array(
  330. 'name' => 'Proxy Host',
  331. 'description' => 'Host name of the proxy server. This can be a name or an IP address.',
  332. 'varname' => 'proxy_host',
  333. 'type' => 'text',
  334. 'size' => '20',
  335. 'maxlength' => '128',
  336. ),
  337. array(
  338. 'name' => 'Proxy Port',
  339. 'description' => 'Port number of the proxy server.',
  340. 'varname' => 'proxy_port',
  341. 'type' => 'text',
  342. 'size' => '5',
  343. 'maxlength' => '5',
  344. 'min' => '0',
  345. 'max' => '65535',
  346. ),
  347. array(
  348. 'name' => 'Proxy Username',
  349. 'description' => 'Username to use for proxy authentication. Leave blank to disable proxy authentication.',
  350. 'varname' => 'proxy_user',
  351. 'type' => 'text',
  352. 'size' => '20',
  353. 'maxlength' => '40',
  354. ),
  355. array(
  356. 'name' => 'Proxy Pasword',
  357. 'description' => 'Password to use for proxy authentication. Note this is stored in plain text format in the MySQL database.',
  358. 'varname' => 'proxy_pass',
  359. 'type' => 'text',
  360. 'size' => '20',
  361. 'maxlength' => '40',
  362. ),
  363. ),
  364. ),
  365. array(
  366. 'name' => 'Character Set',
  367. 'description' => 'Character set settings for your site',
  368. 'controls' =>
  369. array(
  370. array(
  371. 'name' => 'Character Set',
  372. 'description' => 'Select the character set that will be used in the content-type meta tag of the results page. This should be set to the character set used throughout the rest of your site. Examples settings are "iso-8859-1" for ISO 8859-1 Western European, "shift-jis" for Japanese language, "utf-8" for international languages.',
  373. 'varname' => 'char_set',
  374. 'type' => 'text',
  375. 'tolower' => true,
  376. 'size' => '20',
  377. 'maxlength' => '255',
  378. ),
  379. array(
  380. 'name' => '8 Bit',
  381. 'description' => 'Set to true if your character set can be represented as 8 bits. This includes ISO-8859 charsets (containing accented characters). If you use a multi-byte character set (such as for Chinese or Japanese languages), change this to False. This causes less manipulation of character data stored and searched for.',
  382. 'varname' => 'char_set_8_bit',
  383. 'type' => 'checkbox',
  384. ),
  385. array(
  386. 'name' => 'Language',
  387. 'description' => 'Select the language that you want to use to display search results.',
  388. 'varname' => 'lang_name',
  389. 'type' => 'combo',
  390. 'itemvar' => 'isearch_lang_config', /* read items from $isearch_lang_config */
  391. ),
  392. ),
  393. ),
  394. array(
  395. 'name' => 'Search',
  396. 'description' => 'Change how searches are performed and what options are available to visitors.',
  397. 'controls' =>
  398. array(
  399. array(
  400. 'name' => 'Partial Matches',
  401. 'description' => 'The default setting for partial matches. If this is not enabled, then exact word matches will be performed. With this enabled partial word matches will be performed. The user can override this on the "Advanced Search" form.',
  402. 'varname' => 'search_partial',
  403. 'type' => 'combo',
  404. 'items' =>
  405. array(
  406. array('value' => '0', 'description' => 'Always Use Exact Matching'),
  407. array('value' => '1', 'description' => 'Always Use Partial Matching'),
  408. array('value' => '2', 'description' => 'Use Partial if Exact Match Fails'),
  409. ),
  410. ),
  411. array(
  412. 'name' => 'Must Match All',
  413. 'description' => 'Determines the default behaviour when the user enters multiple words as a search term. If disabled, then pages matching ANY of the entered words will be displayed. If enabled, only pages that match ALL of the entered words will be displayed.',
  414. 'varname' => 'search_all',
  415. 'type' => 'checkbox',
  416. ),
  417. array(
  418. 'name' => 'Allow Dashes',
  419. 'description' => 'Allows the user to search for hyphenated words in the search box. <P><B>-</B> When set to &quot;Replace With Space&quot;, a dash within a word is replaced by a space character, so the hyphenated word is treated as 2 seperate words.<BR><B>-</B> When set to &quot;Allow Within Words&quot; a dash within a word will be left as is. Dashes before or after words will be removed.<BR><B>-</B> When set to &quot;Allow Anywhere&quot; dashes anywhere are left as they are.<BR><B>-</B> When set to &quot;Remove All&quot; all dashes will be removed. <P>To enable search words exclusion, the dash must be surrounded by spaces. You should respider your site after changing this option.',
  420. 'varname' => 'allow_dashes',
  421. 'type' => 'combo',
  422. 'items' =>
  423. array(
  424. array('value' => '0', 'description' => 'Replace With Space'),
  425. array('value' => '1', 'description' => 'Allow Within Words'),
  426. array('value' => '2', 'description' => 'Allow Anywhere'),
  427. array('value' => '3', 'description' => 'Remove All'),
  428. ),
  429. ),
  430. array(
  431. 'name' => 'Allow Colons',
  432. 'description' => 'When enabled allows the user to search for words containing a colon (&quot;:&quot;) in the search box. You should respider your site after changing this option.',
  433. 'description' => 'Allows the user to search for words containing a colon (&quot;:&quot;) in the search box.<P><B>-</B> When set to &quot;Replace With Space&quot;, a colon within a word is replaced by a space character, so the word is treated as 2 seperate words.<BR><B>-</B> When set to &quot;Allow Within Words&quot; a colon within a word will be left as is. Colons before or after words will be removed.<BR><B>-</B> When set to &quot;Allow Anywhere&quot; colons anywhere are left as they are.<BR><B>-</B> When set to &quot;Remove All&quot; all colons will be removed.<P>You should respider your site after changing this option.',
  434. 'varname' => 'allow_colons',
  435. 'type' => 'combo',
  436. 'items' =>
  437. array(
  438. array('value' => '0', 'description' => 'Replace With Space'),
  439. array('value' => '1', 'description' => 'Allow Within Words'),
  440. array('value' => '2', 'description' => 'Allow Anywhere'),
  441. array('value' => '3', 'description' => 'Remove All'),
  442. ),
  443. ),
  444. array(
  445. 'name' => 'Allow Dots',
  446. 'description' => 'Allows the user to search for words containing a dot (&quot;.&quot;) in the search box.<P><B>-</B> When set to &quot;Replace With Space&quot;, a dot within a word is replaced by a space character, so the word is treated as 2 seperate words.<BR><B>-</B> When set to &quot;Allow Within Words&quot; a dot within a word will be left as is. Dots before or after words will be removed.<BR><B>-</B> When set to &quot;Allow Anywhere&quot; dots anywhere are left as they are.<BR><B>-</B> When set to &quot;Remove All&quot; all dots will be removed.<P>You should respider your site after changing this option.',
  447. 'varname' => 'allow_dots',
  448. 'type' => 'combo',
  449. 'items' =>
  450. array(
  451. array('value' => '0', 'description' => 'Replace With Space'),
  452. array('value' => '1', 'description' => 'Allow Within Words'),
  453. array('value' => '2', 'description' => 'Allow Anywhere'),
  454. array('value' => '3', 'description' => 'Remove All'),
  455. ),
  456. ),
  457. array(
  458. 'name' => 'Allow Commas',
  459. 'description' => 'Allows the user to search for words containing a comma (&quot;,&quot;) in the search box.<P><B>-</B> When set to &quot;Replace With Space&quot;, a comma within a word is replaced by a space character, so the word is treated as 2 seperate words.<BR><B>-</B> When set to &quot;Allow Within Words&quot; a comma within a word will be left as is. Commas before or after words will be removed.<BR><B>-</B> When set to &quot;Allow Anywhere&quot; commas anywhere are left as they are.<BR><B>-</B> When set to &quot;Remove All&quot; all commas will be removed.<P>You should respider your site after changing this option.',
  460. 'varname' => 'allow_commas',
  461. 'type' => 'combo',
  462. 'items' =>
  463. array(
  464. array('value' => '0', 'description' => 'Replace With Space'),
  465. array('value' => '1', 'description' => 'Allow Within Words'),
  466. array('value' => '2', 'description' => 'Allow Anywhere'),
  467. array('value' => '3', 'description' => 'Remove All'),
  468. ),
  469. ),
  470. array(
  471. 'name' => 'Allow Underscores',
  472. 'description' => 'Allows the user to search for words containing an underscore (&quot;_&quot;) in the search box.<P><B>-</B> When set to &quot;Replace With Space&quot;, an underscore within a word is replaced by a space character, so the word is treated as 2 seperate words.<BR><B>-</B> When set to &quot;Allow Within Words&quot; an underscore within a word will be left as is. Underscores before or after words will be removed.<BR><B>-</B> When set to &quot;Allow Anywhere&quot; underscores anywhere are left as they are.<BR><B>-</B> When set to &quot;Remove All&quot; all underscores will be removed.<P>You should respider your site after changing this option.',
  473. 'varname' => 'allow_underscores',
  474. 'type' => 'combo',
  475. 'items' =>
  476. array(
  477. array('value' => '0', 'description' => 'Replace With Space'),
  478. array('value' => '1', 'description' => 'Allow Within Words'),
  479. array('value' => '2', 'description' => 'Allow Anywhere'),
  480. array('value' => '3', 'description' => 'Remove All'),
  481. ),
  482. ),
  483. array(
  484. 'name' => 'Body Word Rank',
  485. 'description' => 'Words found in the main body add a score of <I>Body Word Rank</I> to the page rank. Takes effect next time the site is spidered.',
  486. 'varname' => 'word_rank',
  487. 'type' => 'text',
  488. 'size' => '7',
  489. 'maxlength' => '7',
  490. 'min' => '0',
  491. 'max' => '1000000',
  492. ),
  493. array(
  494. 'name' => 'Body Heading Word Rank',
  495. 'description' => 'If a word with the body is in an HTML heading the page score is increased by <I>Heading Word Rank</I>. Takes effect next time the site is spidered.',
  496. 'varname' => 'heading_rank',
  497. 'type' => 'text',
  498. 'size' => '7',
  499. 'maxlength' => '7',
  500. 'min' => '0',
  501. 'max' => '1000000',
  502. ),
  503. array(
  504. 'name' => 'Keyword Rank',
  505. 'description' => 'Keywords found in the keywords meta tag add a score of <I>Keyword Rank</I> to the page rank. Set this to 0 to ignore keywords. Takes effect next time the site is spidered.',
  506. 'varname' => 'keyword_rank',
  507. 'type' => 'text',
  508. 'size' => '7',
  509. 'maxlength' => '7',
  510. 'min' => '0',
  511. 'max' => '1000000',
  512. ),
  513. array(
  514. 'name' => 'Title Rank',
  515. 'description' => 'Words within the page title add a score of <I>Title Rank</I> to the page rank. Set this to 0 to ignore page titles. Takes effect next time the site is spidered.',
  516. 'varname' => 'title_rank',
  517. 'type' => 'text',
  518. 'size' => '7',
  519. 'maxlength' => '7',
  520. 'min' => '0',
  521. 'max' => '1000000',
  522. ),
  523. array(
  524. 'name' => 'URL Rank',
  525. 'description' => 'Words within the page URL add a score of <I>URL Rank</I> to the page rank. Set this to 0 to ignore URLs when scoring. Takes effect next time the site is spidered.',
  526. 'varname' => 'url_rank',
  527. 'type' => 'text',
  528. 'size' => '7',
  529. 'maxlength' => '7',
  530. 'min' => '0',
  531. 'max' => '1000000',
  532. ),
  533. array(
  534. 'name' => 'Search Box Width',
  535. 'description' => 'Width in characters of the search box on the results page.',
  536. 'varname' => 'search_box_width',
  537. 'type' => 'text',
  538. 'size' => '3',
  539. 'maxlength' => '3',
  540. 'min' => '0',
  541. 'max' => '999',
  542. ),
  543. array(
  544. 'name' => 'Search Internet',
  545. 'description' => 'Include a "Search Internet" button on the simple search form.',
  546. 'varname' => 'search_internet',
  547. 'type' => 'checkbox',
  548. ),
  549. array(
  550. 'name' => 'Help Link',
  551. 'description' => 'Include a "Help" link on the simple search form.',
  552. 'varname' => 'search_help_link',
  553. 'type' => 'checkbox',
  554. ),
  555. array(
  556. 'name' => 'Partial Matches',
  557. 'description' => 'Include a "Partial" checkbox on the simple search form. This allows partial words to be searched for (e.g. "cat" will find pages containing "va<B>cat</B>ion").',
  558. 'varname' => 'form_show_partial',
  559. 'type' => 'checkbox',
  560. ),
  561. array(
  562. 'name' => 'Sounds Like',
  563. 'description' => 'Matching can be performed by the phonetic sound of words, rather than their exact spelling. This often allows misspelled words to be matched.',
  564. 'varname' => 'soundex',
  565. 'type' => 'combo',
  566. 'items' =>
  567. array(
  568. array('value' => '0', 'description' => 'Never Use Sounds Like'),
  569. array('value' => '1', 'description' => 'Always Use Sounds Like'),
  570. array('value' => '2', 'description' => 'Use Sounds Like if Exact Match Fails'),
  571. ),
  572. ),
  573. array(
  574. 'name' => 'Advanced Link',
  575. 'description' => 'Include an "Advanced" link on the simple search form. This allows access to advanced search options.',
  576. 'varname' => 'form_show_advanced',
  577. 'type' => 'checkbox',
  578. ),
  579. array(
  580. 'name' => 'Check For Empty Search Term',
  581. 'description' => 'Includes javascript checking for empty search term and displays an error message to the user.',
  582. 'varname' => 'check_empty_search',
  583. 'type' => 'checkbox',
  584. ),
  585. ),
  586. ),
  587. array(
  588. 'name' => 'Display',
  589. 'description' => 'Displaying Results',
  590. 'notes' => '<UL><LI>For more information about using regular expressions (regexps), <A HREF="http://www.phpbuilder.com/columns/dario19990616.php3" TARGET="_blank">click here</A>.</LI></UL>',
  591. 'controls' =>
  592. array(
  593. array(
  594. 'name' => 'Results Per Page',
  595. 'description' => 'Maximum number of search results to be displayed on each results page. If there are more than this many matches, they will be displayed on multiple pages.',
  596. 'varname' => 'results_per_page',
  597. 'type' => 'text',
  598. 'size' => '3',
  599. 'maxlength' => '3',
  600. 'min' => '1',
  601. 'max' => '100',
  602. ),
  603. array(
  604. 'name' => 'Max Pages',
  605. 'description' => 'Maximum number of result pages to be displayed.',
  606. 'varname' => 'max_pages',
  607. 'type' => 'text',
  608. 'size' => '4',
  609. 'maxlength' => '4',
  610. 'min' => '1',
  611. 'max' => '1000',
  612. ),
  613. array(
  614. 'name' => 'Description Style',
  615. 'description' => 'URL description shown below each URL in the search results. This can be the description meta tag, Google style extract from the body text of matched pages or both. Google style results are automatically used when a matched page does not have a description meta tag.',
  616. 'varname' => 'description_style',
  617. 'type' => 'combo',
  618. 'items' =>
  619. array(
  620. array('value' => '0', 'description' => 'No Description is Shown'),
  621. array('value' => '1', 'description' => 'Description Meta Tags'),
  622. array('value' => '2', 'description' => 'Google Style Extraction'),
  623. array('value' => '3', 'description' => 'Meta Tag then Google Style'),
  624. array('value' => '4', 'description' => 'Google Style then Meta Tag'),
  625. ),
  626. ),
  627. array(
  628. 'name' => 'Match Score Style',
  629. 'description' => 'Search results can optionally show a score next to them. This option defines which mechanism is used to display that score.',
  630. 'varname' => 'match_score',
  631. 'type' => 'combo',
  632. 'items' =>
  633. array(
  634. array('value' => '0', 'description' => 'No Score Is Displayed'),
  635. array('value' => '1', 'description' => 'Percentage Score Displayed'),
  636. array('value' => '2', 'description' => 'Out Of Ten Score Displayed'),
  637. ),
  638. ),
  639. array(
  640. 'name' => 'Highlight Searched Words',
  641. 'description' => 'Highlight words that were searched for in descriptions shown on the results page.',
  642. 'varname' => 'highlight_results',
  643. 'type' => 'checkbox',
  644. ),
  645. array(
  646. 'name' => 'Hide Powered By Message',
  647. 'description' => 'Hides the "Powered By iSearch2" messages.',
  648. 'enabled' => $isearch_pro,
  649. 'varname' => 'hide_powered_by',
  650. 'type' => 'checkbox',
  651. ),
  652. array(
  653. 'name' => 'Page Opening Target Frame',
  654. 'description' => 'Sets the target frame when the user clicks on one of the search results or entries in the site map. If your site uses frames, set this to the name of the frame to open page into. If you do not use frames, set this to "_self". Set it to "_blank" to open the page in a new browser window.',
  655. 'varname' => 'target_frame',
  656. 'type' => 'text',
  657. 'size' => '20',
  658. 'maxlength' => '255',
  659. ),
  660. array(
  661. 'name' => 'Strip Query',
  662. 'description' => 'Set this to prevent the display of the query part of a URL (the part after the "?").',
  663. 'varname' => 'display_strip_query',
  664. 'type' => 'checkbox',
  665. ),
  666. array(
  667. 'name' => 'Max Title Length',
  668. 'description' => 'Maximum length (in characters) of titles that will be displayed. If a title longer than this is displayed, it will be truncated. If 0 any length title will be displayed.',
  669. 'varname' => 'max_displayed_title_length',
  670. 'type' => 'text',
  671. 'size' => '4',
  672. 'maxlength' => '4',
  673. 'min' => '0',
  674. 'max' => '9999',
  675. ),
  676. array(
  677. 'name' => 'Max Description Length',
  678. 'description' => 'Maximum length (in characters) of description that will be displayed. If a description longer than this is displayed, it will be truncated. If 0 any length description will be displayed.',
  679. 'varname' => 'max_displayed_description_length',
  680. 'type' => 'text',
  681. 'size' => '4',
  682. 'maxlength' => '4',
  683. 'min' => '0',
  684. 'max' => '9999',
  685. ),
  686. array(
  687. 'name' => 'Max Url Length',
  688. 'description' => 'Maximum length of URLs that will be displayed. If a URL longer than this is displayed, it will be shortened so that the beginning and end are displayed. If this is 0 the URL will not be displayed.',
  689. 'varname' => 'max_displayed_url_length',
  690. 'type' => 'text',
  691. 'size' => '4',
  692. 'maxlength' => '4',
  693. 'min' => '0',
  694. 'max' => '9999',
  695. ),
  696. array(
  697. 'name' => 'Style',
  698. 'description' => 'Select the style that you want to use to display search results.',
  699. 'varname' => 'style_name',
  700. 'type' => 'combo',
  701. 'itemvar' => 'isearch_style_config', /* read items from $isearch_style_config */
  702. ),
  703. array(
  704. 'name' => 'Sitemap Format',
  705. 'description' => 'Set the default display used to generate the sitemap page. Grouped sitemaps are only available in the professional version.',
  706. 'varname' => 'sitemap_type',
  707. 'type' => 'combo',
  708. 'items' =>
  709. array(
  710. array('value' => '0', 'description' => 'Link Hierarchy'),
  711. array('value' => '1', 'description' => 'Flat Unordered'),
  712. array('value' => '2', 'description' => 'Flat Sorted By URL'),
  713. array('value' => '3', 'description' => 'Flat Sorted By Title'),
  714. array('value' => '4', 'description' => 'Directory Hierarchy'),
  715. array('value' => '5', 'description' => 'Grouped Unordered'),
  716. array('value' => '6', 'description' => 'Grouped Sorted By URL'),
  717. array('value' => '7', 'description' => 'Grouped Sorted By Title'),
  718. ),
  719. ),
  720. array(
  721. 'name' => 'Hide Regexp',
  722. 'description' => 'Hide characters matching this regular expression from being displayed in the results descriptions. Normally this should be left blank.',
  723. 'varname' => 'hide_regexp',
  724. 'type' => 'text',
  725. 'size' => '20',
  726. 'maxlength' => '255',
  727. ),
  728. array(
  729. 'name' => 'Space-Replace Regexp',
  730. 'description' => 'Replace matches for this regular expression with spaces when they are displayed in the results descriptions. Normally this should be left blank.',
  731. 'varname' => 'replace_regexp',
  732. 'type' => 'text',
  733. 'size' => '20',
  734. 'maxlength' => '255',
  735. ),
  736. array(
  737. 'name' => 'Show Time',
  738. 'description' => 'Show the time (number of seconds) that the search took to execute.',
  739. 'varname' => 'show_time',
  740. 'type' => 'checkbox',
  741. ),
  742. array(
  743. 'name' => 'Show Title',
  744. 'description' => 'Show page titles in search results.',
  745. 'varname' => 'show_title',
  746. 'type' => 'checkbox',
  747. ),
  748. array(
  749. 'name' => 'Show Size',
  750. 'description' => 'Show the size of pages in the search results.',
  751. 'varname' => 'show_size',
  752. 'type' => 'checkbox',
  753. ),
  754. array(
  755. 'name' => 'Previous and Next',
  756. 'description' => 'Determine where previous and next page links are displayed. If you set this to "Nowhere" you will only be able see 1 page of results. If you select an "Optional" setting the previous and next bars will only be shown when there are previous and next links to display. If you select "Always" they will always be shown, and empty if there is only 1 page of results.',
  757. 'varname' => 'prevnext_type',
  758. 'type' => 'combo',
  759. 'items' =>
  760. array(
  761. array('value' => '0', 'description' => 'Nowhere'),
  762. array('value' => '1', 'description' => 'Above Results - Optional'),
  763. array('value' => '2', 'description' => 'Below Results - Optional'),
  764. array('value' => '3', 'description' => 'Above and Below - Optional'),
  765. array('value' => '4', 'description' => 'Above Results - Always'),
  766. array('value' => '5', 'description' => 'Below Results - Always'),
  767. array('value' => '6', 'description' => 'Above and Below - Always'),
  768. ),
  769. ),
  770. array(
  771. 'name' => 'Prev/Next Num Pages',
  772. 'description' => 'Determine how many pages can be directly jumped to from previous and next links. This affects the number of digits displayed on the previous and next link line. Set to 0 to prevent any being displayed.',
  773. 'varname' => 'prevnext_num',
  774. 'type' => 'text',
  775. 'size' => '2',
  776. 'maxlength' => '2',
  777. 'min' => '0',
  778. 'max' => '99',
  779. ),
  780. ),
  781. ),
  782. array(
  783. 'name' => 'Advanced',
  784. 'description' => 'Advanced options that do not normally need modification',
  785. 'controls' =>
  786. array(
  787. array(
  788. 'name' => 'Maximum Execution Time',
  789. 'description' => 'PHP maximum execution time when running iSearch. If you get the error message "Fatal error: Maximum execution time of xx seconds exceeded", then increase this value.',
  790. 'varname' => 'max_execution_time',
  791. 'type' => 'text',
  792. 'size' => '7',
  793. 'maxlength' => '7',
  794. 'min' => '0',
  795. 'max' => '1000000',
  796. ),
  797. array(
  798. 'name' => 'PHP Error Reporting',
  799. 'description' => 'Sets the level of error reporting provided by PHP. The recommended setting is "Disable notices". See the PHP error_reporting function documentation for more details of the different levels.',
  800. 'varname' => 'error_reporting',
  801. 'type' => 'combo',
  802. 'items' =>
  803. array(
  804. array('value' => '1', 'description' => 'Disable notices'),
  805. array('value' => '2', 'description' => 'Disable notices and warnings'),
  806. array('value' => '3', 'description' => 'Show all errors'),
  807. array('value' => '4', 'description' => 'Turn off all error reporting'),
  808. ),
  809. ),
  810. array(
  811. 'name' => 'PDF Support',
  812. 'description' => 'Determine whether PDF files are handled by iSearch. For "Executable PDF Support" the Xpdf pdftotext executable must be run on your server. Your PHP installation must be configured to allow this.</A>',
  813. 'enabled' => $isearch_pro,
  814. 'varname' => 'pdf_support',
  815. 'type' => 'combo',
  816. 'items' =>
  817. array(
  818. array('value' => '0', 'description' => 'No PDF Support'),
  819. array('value' => '1', 'description' => 'Executable PDF Support'),
  820. array('value' => '2', 'description' => 'Online PDF Support'),
  821. ),
  822. ),
  823. array(
  824. 'name' => 'PDF Executable Path',
  825. 'description' => 'If the "PDF Support" setting is set to "Executable PDF Support", then this setting defines the full path to the xpdf pdftotext executable. You can download Xpdf from www.foolabs.com/xpdf',
  826. 'enabled' => $isearch_pro,
  827. 'varname' => 'pdf_exec',
  828. 'type' => 'text',
  829. 'size' => '40',
  830. 'maxlength' => '255',
  831. ),
  832. array(
  833. 'name' => 'Microsoft Word Support',
  834. 'description' => 'Determine whether MS Word documents are handled by iSearch. For "Executable Word Support" the antiword executable must be run on your server. Your PHP installation must be configured to allow this.',
  835. 'enabled' => $isearch_pro,
  836. 'varname' => 'msword_support',
  837. 'type' => 'combo',
  838. 'items' =>
  839. array(
  840. array('value' => '0', 'description' => 'No Word Support'),
  841. array('value' => '1', 'description' => 'Executable Word Support'),
  842. array('value' => '2', 'description' => 'Online Word Support'),
  843. ),
  844. ),
  845. array(
  846. 'name' => 'Word Executable Path',
  847. 'description' => 'If the "Word Support" setting is set to "Executable Word Support", then this setting defines the full path to the antiword executable. You can download antiword from http://www.winfield.demon.nl/',
  848. 'enabled' => $isearch_pro,
  849. 'varname' => 'msword_exec',
  850. 'type' => 'text',
  851. 'size' => '40',
  852. 'maxlength' => '255',
  853. ),
  854. array(
  855. 'name' => 'Temporary Directory',
  856. 'description' => 'If the "PDF Support" or "Word Support" settings are set to "Executable PDF/Word Support", then you must enter a temporary directory name that is writable by PHP scripts.',
  857. 'enabled' => $isearch_pro,
  858. 'varname' => 'tmpdir',
  859. 'type' => 'text',
  860. 'size' => '40',
  861. 'maxlength' => '255',
  862. ),
  863. array(
  864. 'name' => 'Online Conversion ID',
  865. 'description' => 'If the "PDF Support" or "Word Support" settings are set to "Online PDF/Word Support", then you must enter your ID from the iSearch website.',
  866. 'enabled' => $isearch_pro,
  867. 'varname' => 'online_id',
  868. 'type' => 'text',
  869. 'size' => '40',
  870. 'maxlength' => '255',
  871. ),
  872. array(
  873. 'name' => 'Show Admin Tooltips',
  874. 'description' => 'Show tooltips on the iSearch admin pages.',
  875. 'varname' => 'show_admin_tooltips',
  876. 'type' => 'checkbox',
  877. ),
  878. ),
  879. ),
  880. array(
  881. 'name' => 'Groups',
  882. 'description' => 'Allows you to group related pages together for ease of searching. A visitor to your site can search in a single group, or multiple groups. Using groups you can make it easier for visitors to find what they want.',
  883. 'enabled' => $isearch_pro,
  884. 'controls' =>
  885. array(
  886. array(
  887. 'name' => 'Show On Search Form',
  888. 'description' => 'How groups are shown on the search form.',
  889. 'varname' => 'form_show_groups',
  890. 'type' => 'combo',
  891. 'items' =>
  892. array(
  893. array('value' => '0', 'description' => 'No Groups Shown'),
  894. array('value' => '1', 'description' => 'Single Combo Box'),
  895. array('value' => '2', 'description' => 'Multi-Select'),
  896. ),
  897. ),
  898. /* Other controls are dynamically generated */
  899. ),
  900. ),
  901. array(
  902. 'name' => 'Links',
  903. 'description' => 'Allows you to add extra links related to specific keywords. Using Links you can add extra links to be displayed above or at the top of the links your spider found.',
  904. 'enabled' => $isearch_pro,
  905. 'controls' =>
  906. array(
  907. array(
  908. 'name' => 'Extra Link Display',
  909. 'description' => 'Determines how extra links are displayed. "Show Above" causes link results to be shown seperately from indexed results, "Show At Top" causes linked results to be shown first in the results, indistinguishable from indexed results.',
  910. 'varname' => 'extra_link_display',
  911. 'type' => 'combo',
  912. 'items' =>
  913. array(
  914. array('value' => '0', 'description' => 'No Extra Links Shown'),
  915. array('value' => '1', 'description' => 'Shown Above Results'),
  916. array('value' => '2', 'description' => 'Shown At Top Of Results'),
  917. ),
  918. ),
  919. /* Other controls are dynamically generated */
  920. ),
  921. ),
  922. array(
  923. 'name' => 'Suggestions',
  924. 'description' => 'Allows you to specify alternative words that will be used for a given search, or suggested to the user when they search for a specific term.',
  925. 'enabled' => $isearch_pro,
  926. 'controls' =>
  927. array(
  928. array(
  929. 'name' => 'Enable Suggestions',
  930. 'description' => 'Determines how suggestions are handled.',
  931. 'varname' => 'suggestions',
  932. 'type' => 'combo',
  933. 'items' =>
  934. array(
  935. array('value' => '0', 'description' => 'Disable Suggestions'),
  936. array('value' => '1', 'description' => 'Enable Suggestions'),
  937. array('value' => '2', 'description' => 'Always Suggest'),
  938. array('value' => '3', 'description' => 'Always Redirect'),
  939. ),
  940. ),
  941. /* Other controls are dynamically generated */
  942. ),
  943. ),
  944. array(
  945. 'name' => 'Smart Log',
  946. 'description' => 'Allows you to analyse log contents intelligently and take action to help your visitors find what they want, such as suggest alternatives, provide alternative results, or provide a redirect.',
  947. 'enabled' => $isearch_pro,
  948. 'controls' =>
  949. array(
  950. // Other controls are dynamically generated
  951. ),
  952. ),
  953. array(
  954. 'name' => 'Logging',
  955. 'description' => 'Logging and statistics configuration and display.',
  956. 'controls' =>
  957. array(
  958. array(
  959. 'name' => 'Spider Log Level',
  960. 'description' => 'Log level of information saved in the spider log. 0 is silent, 1 logs only errors, 10 is very verbose. Suggested value is 5.',
  961. 'varname' => 'log_level',
  962. 'type' => 'text',
  963. 'size' => '2',
  964. 'maxlength' => '2',
  965. 'min' => '0',
  966. 'max' => '10',
  967. ),
  968. array(
  969. 'name' => 'Keep Search Log',
  970. 'description' => 'Logs each search that is performed. The log is used to generate statistics and can also be emailed to the site administrator.',
  971. 'varname' => 'log_searches',
  972. 'type' => 'checkbox',
  973. ),
  974. array(
  975. 'name' => 'Email Log Period (days)',
  976. 'description' => 'Sends an email report of searches performed on your web site. Each search is logged, and the list of search made emailed to you. Set this to 0 to disable this feature (no emails will be sent).',
  977. 'varname' => 'search_log_email_days',
  978. 'type' => 'text',
  979. 'size' => '4',
  980. 'maxlength' => '4',
  981. 'min' => '0',
  982. 'max' => '999',
  983. ),
  984. array(
  985. 'name' => 'Total Searches',
  986. 'description' => 'Display the total number of searches on the statistics page.',
  987. 'varname' => 'total_searches',
  988. 'type' => 'checkbox',
  989. ),
  990. array(
  991. 'name' => 'Top Searches',
  992. 'description' => 'The number of top searches that are displayed on the statistics page. Set to 0 to disable.',
  993. 'varname' => 'top_searches',
  994. 'type' => 'text',
  995. 'size' => '4',
  996. 'maxlength' => '4',
  997. 'min' => '0',
  998. 'max' => '999',
  999. ),
  1000. array(
  1001. 'name' => 'Last Searches',
  1002. 'description' => 'The number of last searches that are displayed on the statistics page. Set to 0 to disable.',
  1003. 'varname' => 'last_searches',
  1004. 'type' => 'text',
  1005. 'size' => '4',
  1006. 'maxlength' => '4',
  1007. 'min' => '0',
  1008. 'max' => '999',
  1009. ),
  1010. // Other controls are dynamically generated
  1011. ),
  1012. ),
  1013. array(
  1014. 'name' => 'Backup Settings',
  1015. 'description' => 'Backup or restore the current iSearch settings.',
  1016. 'url' => $PHP_SELF.'?isearch_action=backup_restore',
  1017. 'target' => '_self',
  1018. ),
  1019. array(
  1020. 'name' => 'Browse Index',
  1021. 'description' => 'Browse information about the pages that are stored in the search index.',
  1022. 'url' => $PHP_SELF.'?isearch_action=browse',
  1023. 'target' => '_self',
  1024. ),
  1025. array(
  1026. 'name' => 'Add/Remove/Respider Pages',
  1027. 'description' => 'Add new pages to the search index, or remove/respider existing pages.',
  1028. 'url' => $PHP_SELF.'?isearch_action=add_remove_respider',
  1029. 'target' => '_self',
  1030. ),
  1031. array(
  1032. 'name' => 'PHP Info',
  1033. 'description' => 'Show PHP configuration information.',
  1034. 'url' => 'phpinfo.php',
  1035. 'target' => '_blank',
  1036. ),
  1037. array(
  1038. 'name' => 'Support',
  1039. 'description' => 'Get help and support with iSearch from the iSearch web site.',
  1040. 'url' => 'http://www.iSearchTheNet.com/isearch/support.php',
  1041. 'target' => '_blank',
  1042. ),
  1043. );
  1044. $tabCount = count($tabData);
  1045. $free_pro = $isearch_pro ? 'Professional' : 'Free';
  1046. echo <<<EOF
  1047. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  1048. <HTML lang="en">
  1049. <HEAD>
  1050. <TITLE>iSearch Configuration</TITLE>
  1051. <META HTTP-EQUIV="Content-Type" content="text/html; charset=utf-8">
  1052. <META HTTP-EQUIV="Content-Language" CONTENT="EN-GB">
  1053. <META HTTP-EQUIV="Pragma" content="no-cache">
  1054. <META HTTP-EQUIV="Expires" content="Fri, 01 Jan 1999 00:00:01 GMT">
  1055. <META NAME="author" CONTENT="Ian Willis">
  1056. <META NAME="copyright" CONTENT="Copyright Z-Host. All rights reserved.">
  1057. <META NAME="robots" CONTENT="noindex,nofollow">
  1058. <LINK REL=StyleSheet HREF="admin.css" TYPE="text/css">
  1059. <SCRIPT LANGUAGE="JavaScript">
  1060. <!--
  1061. var checkflag = "false";
  1062. function checkall(field)
  1063. {
  1064. if (checkflag == "false")
  1065. {
  1066. for (i = 0; i < field.length; i++)
  1067. {
  1068. field[i].checked = true;
  1069. }
  1070. checkflag = "true";
  1071. return "Uncheck All";
  1072. }
  1073. else
  1074. {
  1075. for (i = 0; i < field.length; i++)
  1076. {
  1077. field[i].checked = false;
  1078. }
  1079. checkflag = "false";
  1080. return "Check All";
  1081. }
  1082. }
  1083. // -->
  1084. </script>
  1085. </HEAD>
  1086. <BODY onClick="stopTooltip()">
  1087. <LAYER name="nstooltip" BGCOLOR="#cccccc" WIDTH=0 HEIGHT=0 STYLE="border-width:thin;z-index:1"></LAYER>
  1088. <DIV ID="tooltip"></DIV>
  1089. <SCRIPT LANGUAGE="JavaScript1.2" TYPE="text/javascript" SRC="tooltip.js"></script>
  1090. <CENTER><H1>iSearch $free_pro $isearch_version Configuration</H1></CENTER>
  1091. EOF;
  1092. function showTooltip($title, $tooltip)
  1093. {
  1094. global $isearch_config;
  1095. if ($isearch_config['show_admin_tooltips'])
  1096. {
  1097. $tooltip = '<B>'.$title.'</B><BR>' . str_replace("'", '&#39;', str_replace('"', '&quot;', $tooltip));
  1098. return ' onMouseOver="showTooltip(\''.$tooltip.'\')" onMouseOut="hideTooltip()" ';
  1099. }
  1100. return '';
  1101. }
  1102. function showTooltipIcon($title, $tooltip)
  1103. {
  1104. global $isearch_config;
  1105. if ($isearch_config['show_admin_tooltips'])
  1106. {
  1107. $tooltip = '<B>'.$title.'</B><BR>' . str_replace("'", '&#39;', str_replace('"', '&quot;', $tooltip));
  1108. return '<A HREF="#" onMouseover="window.status=\' \';showTooltip(\''.$tooltip.'\'); return true;" onMouseout="hideTooltip()"><img border="0" src="images/i_13x13.png" width="13" height="13"></A>
  1109. ';
  1110. }
  1111. return '';
  1112. }
  1113. function isearch_createIndex($table, $col)
  1114. {
  1115. global $isearch_db;
  1116. $needToCreate = True;
  1117. $result = mysql_query("SHOW INDEX FROM $table", $isearch_db);
  1118. while ($item = mysql_fetch_array($result))
  1119. {
  1120. if ($item['Key_name'] == $col)
  1121. {
  1122. $needToCreate = False;
  1123. }
  1124. else if ($item['Key_name'] != "PRIMARY")
  1125. {
  1126. mysql_query("ALTER TABLE $table DROP INDEX " . $item['Key_name'], $isearch_db);
  1127. }
  1128. }
  1129. if ($needToCreate)
  1130. {
  1131. if (! mysql_query("ALTER TABLE $table ADD INDEX $col ($col)", $isearch_db))
  1132. {
  1133. echo "<P>MySQL Error : " . mysql_error() . " File: " . __FILE__ . " Line: " . __LINE__;
  1134. }
  1135. }
  1136. }
  1137. function isearch_createTables()
  1138. {
  1139. global $isearch_table_info, $isearch_table_urls, $isearch_table_urls_new;
  1140. global $isearch_table_words, $isearch_table_words_new;
  1141. global $isearch_table_search_log, $isearch_table_spider_log, $isearch_table_admin_log;
  1142. global $isearch_table_links, $isearch_table_alts, $isearch_table_links_words;
  1143. global $isearch_db;
  1144. global $isearch_version;
  1145. global $isearch_config;
  1146. $changed = False;
  1147. /* Check whether tables exist and create if necesary */
  1148. if (! mysql_query("DESCRIBE $isearch_table_info", $isearch_db))
  1149. {
  1150. $query = "CREATE TABLE $isearch_table_info (" .
  1151. "id INT NOT NULL primary key, " .
  1152. "admin_email VARCHAR(255), " .
  1153. "aggressive_link_search BOOL DEFAULT 0, " .
  1154. "allow_colons BOOL DEFAULT 0, " .
  1155. "allow_commas BOOL DEFAULT 0, " .
  1156. "allow_dashes BOOL DEFAULT 0, " .
  1157. "allow_dots BOOL DEFAULT 0, " .
  1158. "allow_underscores BOOL DEFAULT 0, " .
  1159. "dir_redirect_handling INT DEFAULT 1, " .
  1160. "directory_handling INT DEFAULT 2, " .
  1161. "basic_authorization VARCHAR(255), " .
  1162. "char_set VARCHAR(255), " .
  1163. "char_set_8_bit BOOL DEFAULT 1, " .
  1164. "check_empty_search TINYINT DEFAULT 1, " .
  1165. "description_style TINYINT DEFAULT 1, " .
  1166. "display_strip_query BOOL DEFAULT 0, " .
  1167. "error_reporting INT DEFAULT 1, " .
  1168. "extra_link_display TINYINT DEFAULT 1, " .
  1169. "follow_frames BOOL DEFAULT 1, " .
  1170. "follow_meta_refresh BOOL DEFAULT 1, " .
  1171. "form_show_advanced TINYINT DEFAULT 1, " .
  1172. "form_show_groups TINYINT DEFAULT 1, " .
  1173. "form_show_partial TINYINT DEFAULT 1, " .
  1174. "file_redirect_handling INT DEFAULT 1, " .
  1175. "heading_rank INT DEFAULT 3, " .
  1176. "hide_powered_by BOOL DEFAULT 0, " .
  1177. "hide_regexp VARCHAR(255) DEFAULT '' NOT NULL, " .
  1178. "highlight_results BOOL DEFAULT 1, " .
  1179. "javascript_link_search TINYINT DEFAULT 0, " .
  1180. "ignore_image_alt_tags TINYINT DEFAULT 0, " .
  1181. "keep_cache BOOL DEFAULT 0, " .
  1182. "keyword_rank INT DEFAULT 10, " .
  1183. "lang_name VARCHAR(255), " .
  1184. "log_echo_level INT DEFAULT 3, " .
  1185. "log_level INT DEFAULT 3, " .
  1186. "log_searches BOOL DEFAULT 1, " .
  1187. "match_score INT DEFAULT 2, " .
  1188. "max_displayed_description_length INT DEFAULT 0, " .
  1189. "max_displayed_title_length INT DEFAULT 0, " .
  1190. "max_displayed_url_length INT DEFAULT 40, " .
  1191. "max_execution_time INT DEFAULT 300, " .
  1192. "max_file_size INT DEFAULT 65536, " .
  1193. "max_pages INT DEFAULT 20, " .
  1194. "msword_exec VARCHAR(255), " .
  1195. "msword_support INT DEFAULT 0, " .
  1196. "notify_updates BOOL DEFAULT 0, " .
  1197. "online_id VARCHAR(255), " .
  1198. "pdf_exec VARCHAR(255), " .
  1199. "pdf_support INT DEFAULT 0, " .
  1200. "prevnext_type INT DEFAULT 2, " .
  1201. "prevnext_num INT DEFAULT 10, " .
  1202. "proxy_enable TINYINT DEFAULT 0, " .
  1203. "proxy_host VARCHAR(255) DEFAULT '' NOT NULL, " .
  1204. "proxy_pass VARCHAR(255) DEFAULT '' NOT NULL, " .
  1205. "proxy_port INT DEFAULT 8080, " .
  1206. "proxy_user VARCHAR(255) DEFAULT '' NOT NULL, " .
  1207. "reading_mechanism TINYINT DEFAULT 0, " .
  1208. "replace_regexp VARCHAR(255) DEFAULT '' NOT NULL, " .
  1209. "results_frame VARCHAR(255), " .
  1210. "results_per_page INT DEFAULT 10, " .
  1211. "search_all TINYINT DEFAULT 0, " .
  1212. "search_box_width INT DEFAULT 40, " .
  1213. "search_help_link TINYINT DEFAULT 1, " .
  1214. "search_internet TINYINT DEFAULT 1, " .
  1215. "search_log_email_days INT DEFAULT 0, " .
  1216. "search_partial TINYINT DEFAULT 0, " .
  1217. "show_admin_tooltips TINYINT DEFAULT 1, " .
  1218. "show_size BOOL DEFAULT 1, " .
  1219. "show_time BOOL DEFAULT 1, " .
  1220. "show_title BOOL DEFAULT 1, " .
  1221. "sitemap_type TINYINT DEFAULT 4, " .
  1222. "spider_delay INT DEFAULT 1, " .
  1223. "soundex TINYINT DEFAULT 0, " .
  1224. "start_urls LONGTEXT, " .
  1225. "stop_words_length TINYINT DEFAULT 2, " .
  1226. "style_name VARCHAR(255), " .
  1227. "suggestions TINYINT DEFAULT 1, " .
  1228. "tmpdir VARCHAR(255), " .
  1229. "target_frame VARCHAR(255), " .
  1230. "test_mode TINYINT DEFAULT 0, " .
  1231. "title_rank INT DEFAULT 10, " .
  1232. "url_rank INT DEFAULT 0, " .
  1233. "url_replace VARCHAR(255), " .
  1234. "url_search VARCHAR(255), " .
  1235. "word_rank INT DEFAULT 1, " .
  1236. "www_option TINYINT DEFAULT 1, " .
  1237. "search_log_last_emailed INT DEFAULT 0, " .
  1238. "update_last_checked INT DEFAULT 0, " .
  1239. "update_last_version VARCHAR(255), " .
  1240. "allowed_ext TEXT, " .
  1241. "allowed_urls LONGTEXT, " .
  1242. "allowed_urls_beginning LONGTEXT, " .
  1243. "exclude_urls LONGTEXT, " .
  1244. "exclude_urls_beginning LONGTEXT, " .
  1245. "groups LONGTEXT, " .
  1246. "remove_get_vars LONGTEXT, " .
  1247. "stop_words LONGTEXT, " .
  1248. "strip_defaults TEXT, " .
  1249. "top_searches INT DEFAULT 20," .
  1250. "total_searches TINYINT DEFAULT 1," .
  1251. "last_searches INT DEFAULT 20," .
  1252. "robots_domains LONGTEXT, " .
  1253. "robots_excludes LONGTEXT, " .
  1254. "base_url VARCHAR(255) DEFAULT '', " .
  1255. "last_update INT DEFAULT 0" .
  1256. ")";
  1257. if (!mysql_query($query, $isearch_db))
  1258. {
  1259. echo "<P>MySQL Error : " . mysql_error() . " ($query) File: " . __FILE__ . " Line: " . __LINE__;
  1260. }
  1261. $siteName = strtolower($_SERVER['SERVER_NAME']);
  1262. $siteDomain = str_replace('www.', '', $siteName);
  1263. $startWith = "http://$siteName";
  1264. if ($siteName != $siteDomain)
  1265. {
  1266. $startWith .= " http://$siteDomain";
  1267. }
  1268. if (!mysql_query ("INSERT INTO $isearch_table_info (id, admin_email, start_urls, allowed_urls_beginning, exclude_urls_beginning, allowed_ext, remove_get_vars, lang_name, style_name, target_frame, results_frame, tmpdir, update_last_version, char_set) VALUES ('1', 'webmaster@$siteDomain', 'http://$siteName/', '$startWith', 'http://$siteName/private/', 'php php3 php4 html htm shtml dhtml asp pl cgi', 'PHPSESSID', 'english', 'default', 'isearch', '_self', '/tmp', '$isearch_version', 'utf-8')", $isearch_db))
  1269. {
  1270. echo "<P>MySQL Error : " . mysql_error() . " ($query) File: " . __FILE__ . " Line: " . __LINE__;
  1271. }
  1272. $changed = True;
  1273. }
  1274. else
  1275. {
  1276. /* Check whether fields introduced with version 2.1 are present in the table and add them if not. */
  1277. if (!isset($isearch_config['hide_regexp']))
  1278. {
  1279. $query = "ALTER TABLE $isearch_table_info " .
  1280. "ADD hide_regexp VARCHAR(255) DEFAULT '' NOT NULL, " .
  1281. "ADD replace_regexp VARCHAR(255) DEFAULT '' NOT NULL";
  1282. if (!mysql_query($query, $isearch_db))
  1283. {
  1284. echo "<P>MySQL Error : " . mysql_error() . " ($query) File: " . __FILE__ . " Line: " . __LINE__;
  1285. }
  1286. /* Reread the configuration settings */
  1287. $changed = True;
  1288. }
  1289. /* Check whether fields introduced with version 2.4 are present in the table and add them if not. */
  1290. if (!isset($isearch_config['stop_words_length']))
  1291. {
  1292. $query = "ALTER TABLE $isearch_table_info " .
  1293. "ADD stop_words_length TINYINT DEFAULT 2, ".
  1294. "ADD form_show_groups TINYINT DEFAULT 1, ".
  1295. "ADD search_internet TINYINT DEFAULT 1, ".
  1296. "ADD results_frame VARCHAR(255), ".
  1297. "ADD search_help_link TINYINT DEFAULT 1, ".
  1298. "ADD search_box_width INT DEFAULT 40, ".
  1299. "ADD show_size BOOL DEFAULT 1, ".
  1300. "ADD show_title BOOL DEFAULT 1, ".
  1301. "ADD error_reporting INT DEFAULT 1";
  1302. if (!mysql_query($query, $isearch_db))
  1303. {
  1304. echo "<P>MySQL Error : " . mysql_error() . " ($query) File: " . __FILE__ . " Line: " . __LINE__;
  1305. }
  1306. else if (!mysql_query("UPDATE $isearch_table_info SET results_frame='_self' WHERE id='1'", $isearch_db))
  1307. {
  1308. echo "<P>MySQL Error : " . mysql_error() . " ($query) File: " . __FILE__ . " Line: " . __LINE__;
  1309. }
  1310. $query = "ALTER TABLE $isearch_table_info CHANGE strip_defaults strip_defaults TEXT NOT NULL";
  1311. if (!mysql_query($query, $isearch_db))
  1312. {
  1313. echo "<P>MySQL Error : " . mysql_error() . " ($query) File: " . __FILE__ . " Line: " . __LINE__;
  1314. }
  1315. /* Reread the configuration settings */
  1316. $changed = True;
  1317. }
  1318. /* Check whether fields introduced with version 2.5 are present in the table and add them if not. */
  1319. if (!isset($isearch_config['javascript_link_search']))
  1320. {
  1321. $query = "ALTER TABLE $isearch_table_info ".
  1322. "ADD javascript_link_search TINYINT DEFAULT 0";
  1323. if (!mysql_query($query, $isearch_db))
  1324. {
  1325. echo "<P>MySQL Error : " . mysql_error() . " ($query) File: " . __FILE__ . " Line: " . __LINE__;
  1326. }
  1327. /* Reread the configuration settings */
  1328. $changed = True;
  1329. }
  1330. /* Check whether fields introduced with version 2.7 are present in the table and add them if not. */
  1331. if (!isset($isearch_config['title_rank']))
  1332. {
  1333. $query = "ALTER TABLE $isearch_table_info ".
  1334. "ADD title_rank INT DEFAULT 10, ".
  1335. "ADD search_all TINYINT DEFAULT 0, ".
  1336. "ADD search_partial TINYINT DEFAULT 0, ".
  1337. "ADD form_show_advanced TINYINT DEFAULT 1, ".
  1338. "ADD form_show_partial TINYINT DEFAULT 1";
  1339. if (!mysql_query($query, $isearch_db))
  1340. {
  1341. echo "<P>MySQL Error : " . mysql_error() . " ($query) File: " . __FILE__ . " Line: " . __LINE__;
  1342. }
  1343. /* Reread the configuration settings */
  1344. $changed = True;
  1345. }
  1346. /* Check whether fields introduced with version 2.7a are present in the table and add them if not. */
  1347. if (!isset($isearch_config['allow_dashes']))
  1348. {
  1349. $query = "ALTER TABLE $isearch_table_info ".
  1350. "ADD allow_dashes TINYINT DEFAULT 0";
  1351. if (!mysql_query($query, $isearch_db))
  1352. {
  1353. echo "<P>MySQL Error : " . mysql_error() . " ($query) File: " . __FILE__ . " Line: " . __LINE__;
  1354. }
  1355. /* Reread the configuration settings */
  1356. $changed = True;
  1357. }
  1358. /* Check whether fields introduced with version 2.8 are present in the table and add them if not. */
  1359. if (!isset($isearch_config['extra_link_display']))
  1360. {
  1361. $query = "ALTER TABLE $isearch_table_info ".
  1362. "ADD extra_link_display TINYINT DEFAULT 1";
  1363. if (!mysql_query($query, $isearch_db))
  1364. {
  1365. echo "<P>MySQL Error : " . mysql_error() . " ($query) File: " . __FILE__ . " Line: " . __LINE__;
  1366. }
  1367. /* Reread the configuration settings */
  1368. $changed = True;
  1369. }
  1370. /* Check whether fields introduced with version 2.9 are present in the table and add them if not. */
  1371. if (!isset($isearch_config['suggestions']))
  1372. {
  1373. $query = "ALTER TABLE $isearch_table_info ".
  1374. "ADD url_rank INT DEFAULT 0, ".
  1375. "ADD max_displayed_description_length INT DEFAULT 0, ".
  1376. "ADD max_displayed_title_length INT DEFAULT 0, ".
  1377. "ADD suggestions TINYINT DEFAULT 1";
  1378. if (!mysql_query($query, $isearch_db))
  1379. {
  1380. echo "<P>MySQL Error : " . mysql_error() . " ($query) File: " . __FILE__ . " Line: " . __LINE__;
  1381. }
  1382. /* Reread the configuration settings */
  1383. $changed = True;
  1384. }
  1385. /* Check whether fields introduced with version 2.10 are present in the table and add them if not. */
  1386. if (!isset($isearch_config['ignore_image_alt_tags']))
  1387. {
  1388. $query = "ALTER TABLE $isearch_table_info " .
  1389. "ADD prevnext_type INT DEFAULT 2, " .
  1390. "ADD reading_mechanism TINYINT DEFAULT 0, " .
  1391. "ADD ignore_image_alt_tags TINYINT DEFAULT 0";
  1392. if (!mysql_query($query, $isearch_db))
  1393. {
  1394. echo "<P>MySQL Error : " . mysql_error() . " ($query) File: " . __FILE__ . " Line: " . __LINE__;
  1395. }
  1396. /* Reread the configuration settings */
  1397. $changed = True;
  1398. }
  1399. /* Check whether fields introduced with version 2.12 are present in the table and add them if not. */
  1400. if (!isset($isearch_config['test_mode']))
  1401. {
  1402. $query = "ALTER TABLE $isearch_table_info " .
  1403. "ADD prevnext_num INT DEFAULT 10, " .
  1404. "ADD show_time BOOL DEFAULT 1, " .
  1405. "ADD test_mode TINYINT DEFAULT 0";
  1406. if (!mysql_query($query, $isearch_db))
  1407. {
  1408. echo "<P>MySQL Error : " . mysql_error() . " ($query) File: " . __FILE__ . " Line: " . __LINE__;
  1409. }
  1410. /* Reread the configuration settings */
  1411. $changed = True;
  1412. }
  1413. /* Check whether fields introduced with version 2.13 are present in the table and add them if not. */
  1414. if (!isset($isearch_config['soundex']))
  1415. {
  1416. $query = "ALTER TABLE $isearch_table_info " .
  1417. "ADD soundex TINYINT DEFAULT 0," .
  1418. "ADD allow_colons TINYINT DEFAULT 0, " .
  1419. "ADD proxy_enable TINYINT DEFAULT 0, " .
  1420. "ADD proxy_host VARCHAR(255) DEFAULT '' NOT NULL, " .
  1421. "ADD proxy_pass VARCHAR(255) DEFAULT '' NOT NULL, " .
  1422. "ADD proxy_port INT DEFAULT 8080, " .
  1423. "ADD proxy_user VARCHAR(255) DEFAULT '' NOT NULL, " .
  1424. "ADD total_searches TINYINT DEFAULT 1";
  1425. if (!mysql_query($query, $isearch_db))
  1426. {
  1427. echo "<P>MySQL Error : " . mysql_error() . " ($query) File: " . __FILE__ . " Line: " . __LINE__;
  1428. }
  1429. /* Reread the configuration settings */
  1430. $changed = True;
  1431. }
  1432. /* Check whether fields introduced with version 2.14 are present in the table and add them if not. */
  1433. if (!isset($isearch_config['check_empty_search']))
  1434. {
  1435. $query = "ALTER TABLE $isearch_table_info " .
  1436. "ADD check_empty_search TINYINT DEFAULT 1, " .
  1437. "ADD show_admin_tooltips TINYINT DEFAULT 1";
  1438. if (!mysql_query($query, $isearch_db))
  1439. {
  1440. echo "<P>MySQL Error : " . mysql_error() . " ($query) File: " . __FILE__ . " Line: " . __LINE__;
  1441. }
  1442. /* Reread the configuration settings */
  1443. $changed = True;
  1444. }
  1445. /* Check whether fields introduced with version 2.16 are present in the table and add them if not. */
  1446. if (!isset($isearch_config['allow_commas']))
  1447. {
  1448. $query = "ALTER TABLE $isearch_table_info " .
  1449. "ADD allow_commas TINYINT DEFAULT 0, " .
  1450. "ADD allow_dots TINYINT DEFAULT 0, " .
  1451. "ADD follow_meta_refresh BOOL DEFAULT 1, " .
  1452. "ADD base_url VARCHAR(255) DEFAULT ''";
  1453. if (!mysql_query($query, $isearch_db))
  1454. {
  1455. echo "<P>MySQL Error : " . mysql_error() . " ($query) File: " . __FILE__ . " Line: " . __LINE__;
  1456. }
  1457. /* Reread the configuration settings */
  1458. $changed = True;
  1459. }
  1460. /* Check whether fields introduced with version 2.17 are present in the table and add them if not. */
  1461. if (!isset($isearch_config['allow_underscores']))
  1462. {
  1463. $query = "ALTER TABLE $isearch_table_info " .
  1464. "ADD allow_underscores TINYINT DEFAULT 0";
  1465. if (!mysql_query($query, $isearch_db))
  1466. {
  1467. echo "<P>MySQL Error : " . mysql_error() . " ($query) File: " . __FILE__ . " Line: " . __LINE__;
  1468. }
  1469. /* Reread the configuration settings */
  1470. $changed = True;
  1471. if ($result = mysql_query("SELECT char_set FROM $isearch_table_info WHERE id='1'", $isearch_db))
  1472. {
  1473. if ($item = mysql_fetch_object($result))
  1474. {
  1475. mysql_query("UPDATE $isearch_table_info SET char_set='" . isearch_escape_string(strtolower($item->char_set)) . "' WHERE id='1'", $isearch_db);
  1476. }
  1477. }
  1478. }
  1479. }
  1480. if ($changed)
  1481. {
  1482. /* Tables have changed. Close and reopen the component */
  1483. isearch_close();
  1484. isearch_open();
  1485. }
  1486. $query_body = "id INT NOT NULL primary key auto_increment, " .
  1487. "url VARCHAR(255), " .
  1488. "description LONGTEXT, " .
  1489. "stripped_body LONGTEXT, " .
  1490. "words LONGTEXT, " .
  1491. "title TEXT, " .
  1492. "state VARCHAR(255), " .
  1493. "temp_referrer_id INT, " .
  1494. "referrer_id INT DEFAULT 0, " .
  1495. "cache LONGTEXT, " .
  1496. "size INT DEFAULT 0, " .
  1497. "base VARCHAR(255), " .
  1498. "sig VARCHAR(255), " .
  1499. "priority FLOAT DEFAULT -1, " .
  1500. "lastmod INT, " .
  1501. "changefreq VARCHAR(255) ";
  1502. /* Check whether tables exist and create if necesary */
  1503. if (! mysql_query("DESCRIBE $isearch_table_urls", $isearch_db))
  1504. {
  1505. $query = "CREATE TABLE $isearch_table_urls ($query_body)";
  1506. if (!mysql_query($query, $isearch_db))
  1507. {
  1508. echo "<P>MySQL Error : " . mysql_error() . " ($query) File: " . __FILE__ . " Line: " . __LINE__;
  1509. }
  1510. }
  1511. else
  1512. {
  1513. mysql_query("ALTER TABLE $isearch_table_urls " .
  1514. "ADD priority FLOAT DEFAULT -1, " .
  1515. "ADD lastmod INT, " .
  1516. "ADD changefreq VARCHAR(255) ", $isearch_db);
  1517. }
  1518. /* Check whether tables exist and create if necesary */
  1519. if (! mysql_query("DESCRIBE $isearch_table_urls_new", $isearch_db))
  1520. {
  1521. $query = "CREATE TABLE $isearch_table_urls_new ($query_body)";
  1522. if (!mysql_query($query, $isearch_db))
  1523. {
  1524. echo "<P>MySQL Error : " . mysql_error() . " ($query) File: " . __FILE__ . " Line: " . __LINE__;
  1525. }
  1526. }
  1527. else
  1528. {
  1529. mysql_query("ALTER TABLE $isearch_table_urls_new " .
  1530. "ADD priority FLOAT DEFAULT -1, " .
  1531. "ADD lastmod INT, " .
  1532. "ADD changefreq VARCHAR(255) ", $isearch_db);
  1533. }
  1534. isearch_createIndex($isearch_table_urls, 'url');
  1535. isearch_createIndex($isearch_table_urls_new, 'url');
  1536. /* Check whether tables exist and create if necesary */
  1537. if (! mysql_query("DESCRIBE $isearch_table_words", $isearch_db))
  1538. {
  1539. $query = "(" .
  1540. "word VARCHAR(255), " .
  1541. "score INT4, " .
  1542. "id INT4, " .
  1543. "KEY(word))";
  1544. if (!mysql_query("CREATE TABLE $isearch_table_words $query", $isearch_db))
  1545. {
  1546. echo "<P>MySQL Error : " . mysql_error() . " ($query) File: " . __FILE__ . " Line: " . __LINE__;
  1547. }
  1548. if (!mysql_query("CREATE TABLE $isearch_table_words_new $query", $isearch_db))
  1549. {
  1550. echo "<P>MySQL Error : " . mysql_error() . " ($query) File: " . __FILE__ . " Line: " . __LINE__;
  1551. }
  1552. }
  1553. isearch_createIndex($isearch_table_words, 'word');
  1554. isearch_createIndex($isearch_table_words_new, 'word');
  1555. /* Check whether tables exist and create if necesary */
  1556. if (! mysql_query("DESCRIBE $isearch_table_spider_log", $isearch_db))
  1557. {
  1558. $query = "CREATE TABLE $isearch_table_spider_log (" .
  1559. "id INT4 NOT NULL primary key auto_increment, " .
  1560. "msg TEXT" .
  1561. ")";
  1562. if (!mysql_query($query, $isearch_db))
  1563. {
  1564. echo "<P>MySQL Error : " . mysql_error() . " ($query) File: " . __FILE__ . " Line: " . __LINE__;
  1565. }
  1566. }
  1567. /* Check whether tables exist and create if necesary */
  1568. if (! mysql_query("DESCRIBE $isearch_table_search_log", $isearch_db))
  1569. {
  1570. $query = "CREATE TABLE $isearch_table_search_log (" .
  1571. "id INT4 NOT NULL primary key auto_increment, " .
  1572. "search_term TEXT, " .
  1573. "time INT4, " .
  1574. "matches INT4" .
  1575. ")";
  1576. if (!mysql_query($query, $isearch_db))
  1577. {
  1578. echo "<P>MySQL Error : " . mysql_error() . " ($query) File: " . __FILE__ . " Line: " . __LINE__;
  1579. }
  1580. }
  1581. mysql_query("ALTER TABLE $isearch_table_search_log ADD checked INT DEFAULT 0", $isearch_db);
  1582. /* Check whether tables exist and create if necesary */
  1583. if (! mysql_query("DESCRIBE $isearch_table_links", $isearch_db))
  1584. {
  1585. $query = "CREATE TABLE $isearch_table_links (" .
  1586. "id INT4 NOT NULL primary key auto_increment, " .
  1587. "url VARCHAR(255), " .
  1588. "keywords TEXT, " .
  1589. "description TEXT, " .
  1590. "title TEXT" .
  1591. ")";
  1592. if (!mysql_query($query, $isearch_db))
  1593. {
  1594. echo "<P>MySQL Error : " . mysql_error() . " ($query) File: " . __FILE__ . " Line: " . __LINE__;
  1595. }
  1596. }
  1597. /* Check whether tables exist and create if necesary */
  1598. if (! mysql_query("DESCRIBE $isearch_table_links_words", $isearch_db))
  1599. {
  1600. $query = "CREATE TABLE $isearch_table_links_words (" .
  1601. "id INT4, " .
  1602. "word VARCHAR(255), " .
  1603. "score INT4, " .
  1604. "KEY(word))";
  1605. if (!mysql_query($query, $isearch_db))
  1606. {
  1607. echo "<P>MySQL Error : " . mysql_error() . " ($query) File: " . __FILE__ . " Line: " . __LINE__;
  1608. }
  1609. }
  1610. isearch_createIndex($isearch_table_links_words, 'word');
  1611. /* Check whether tables exist and create if necesary */
  1612. if (! mysql_query("DESCRIBE $isearch_table_alts", $isearch_db))
  1613. {
  1614. $query = "CREATE TABLE $isearch_table_alts (" .
  1615. "id INT4 NOT NULL primary key auto_increment, " .
  1616. "keyword VARCHAR(255), " .
  1617. "alternative VARCHAR(255), " .
  1618. "redirect TINYINT DEFAULT 0" .
  1619. ")";
  1620. if (!mysql_query($query, $isearch_db))
  1621. {
  1622. echo "<P>MySQL Error : " . mysql_error() . " ($query) File: " . __FILE__ . " Line: " . __LINE__;
  1623. }
  1624. }
  1625. isearch_createIndex($isearch_table_links_words, 'word');
  1626. /* Check whether table exists and create if necesary */
  1627. if (! mysql_query("DESCRIBE $isearch_table_admin_log", $isearch_db))
  1628. {
  1629. $query = "CREATE TABLE $isearch_table_admin_log (" .
  1630. "id INT4 NOT NULL primary key auto_increment, " .
  1631. "msg TEXT, " .
  1632. "time INT4" .
  1633. ")";
  1634. if (!mysql_query($query, $isearch_db))
  1635. {
  1636. echo "<P>MySQL Error : " . mysql_error() . " ($query) File: " . __FILE__ . " Line: " . __LINE__;
  1637. }
  1638. }
  1639. }
  1640. if ($isearch_action == 'update')
  1641. {
  1642. if ($tabData[$isearch_tab]['name'] == 'Groups')
  1643. {
  1644. $new_isearch_groups = '';
  1645. for ($i = 0; $i < $_POST['isearch_num_groups']; $i++)
  1646. {
  1647. $name = str_replace(' ', '+', trim(isearch_stripslashes($_POST['new_isearch_group_name' . $i])));
  1648. if ($name != '')
  1649. {
  1650. $url = str_replace(' ', '+', trim(isearch_stripslashes($_POST['new_isearch_group_url' . $i])));
  1651. $regexp = str_replace(' ', '+', trim(isearch_stripslashes($_POST['new_isearch_group_regexp' . $i])));
  1652. if ($new_isearch_groups != '')
  1653. {
  1654. $new_isearch_groups .= ' ';
  1655. }
  1656. $new_isearch_groups .= $name . ' ' . $url . ' ' . $regexp;
  1657. }
  1658. }
  1659. if (!mysql_query("UPDATE $isearch_table_info SET groups='" . isearch_escape_string($new_isearch_groups) . "' WHERE id='1'", $isearch_db))
  1660. {
  1661. isearch_adminLog('ERROR: MySQL error : ' . mysql_error() . " in " . __FILE__ . " line " . __LINE__, 1);
  1662. }
  1663. isearch_adminLog('Updated group settings');
  1664. }
  1665. if (isset($_POST['isearch_num_links']))
  1666. {
  1667. if (!isset($_POST['isearch_links_add']))
  1668. {
  1669. /* Delete the table. */
  1670. if (!mysql_query("DELETE FROM $isearch_table_links", $isearch_db))
  1671. {
  1672. isearch_adminLog('ERROR: MySQL error : ' . mysql_error() . " in " . __FILE__ . " line " . __LINE__, 1);
  1673. }
  1674. if (!mysql_query("DELETE FROM $isearch_table_links_words", $isearch_db))
  1675. {
  1676. isearch_adminLog('ERROR: MySQL error : ' . mysql_error() . " in " . __FILE__ . " line " . __LINE__, 1);
  1677. }
  1678. }
  1679. for ($i = 0; $i < $_POST['isearch_num_links']; $i++)
  1680. {
  1681. $url = str_replace(' ', '+', trim(isearch_stripslashes($_POST['new_isearch_links_url' . $i])));
  1682. $keywords = isearch_cleanString(isearch_stripslashes($_POST['new_isearch_links_keywords' . $i]), 'utf-8');
  1683. $title = ereg_replace('[ ,]+', ' ', trim(isearch_stripslashes($_POST['new_isearch_links_title' . $i])));
  1684. $description = ereg_replace('[ ,]+', ' ', trim(isearch_stripslashes($_POST['new_isearch_links_description' . $i])));
  1685. /* Convert from source charset to charset used on results page */
  1686. if ((function_exists('iconv')) && ('utf-8' != $isearch_config['char_set']) && ($isearch_config['char_set'] != ''))
  1687. {
  1688. $title = iconv('utf-8', $isearch_config['char_set'], $title);
  1689. $description = iconv('utf-8', $isearch_config['char_set'], $description);
  1690. }
  1691. if ($url != '')
  1692. {
  1693. /* Add new entry. */
  1694. if (!mysql_query ("INSERT INTO $isearch_table_links (url, keywords, description, title) VALUES ('".isearch_escape_string($url)."', '".isearch_escape_string($keywords)."', '".isearch_escape_string($description)."', '".isearch_escape_string($title)."')", $isearch_db))
  1695. {
  1696. isearch_adminLog('ERROR: MySQL error : ' . mysql_error() . " in " . __FILE__ . " line " . __LINE__, 1);
  1697. }
  1698. $query = "INSERT INTO $isearch_table_links_words (word, id, score) VALUES ";
  1699. $needComma = False;
  1700. $id = mysql_insert_id($isearch_db);
  1701. $words = split('[[:space:]]+', $keywords);
  1702. foreach ($words as $word)
  1703. {
  1704. if ($needComma)
  1705. {
  1706. $query .= ',';
  1707. }
  1708. $needComma = True;
  1709. $query .= "('$word', '$id', '100')";
  1710. }
  1711. if (!mysql_query($query, $isearch_db))
  1712. {
  1713. isearch_adminLog('ERROR: MySQL error : ' . mysql_error() . " in " . __FILE__ . " line " . __LINE__, 1);
  1714. }
  1715. }
  1716. }
  1717. isearch_adminLog('Updated link settings', 7);
  1718. }
  1719. if (isset($_POST['isearch_num_alts']))
  1720. {
  1721. if (!isset($_POST['isearch_alts_add']))
  1722. {
  1723. /* Delete the table. */
  1724. if (!mysql_query("DELETE FROM $isearch_table_alts", $isearch_db))
  1725. {
  1726. isearch_adminLog('ERROR: MySQL error : ' . mysql_error() . " in " . __FILE__ . " line " . __LINE__, 1);
  1727. }
  1728. }
  1729. for ($i = 0; $i < $_POST['isearch_num_alts']; $i++)
  1730. {
  1731. $keyword = isearch_cleanString(isearch_stripslashes($_POST['new_isearch_alts_keyword' . $i]), 'utf-8');
  1732. $alt = isearch_cleanString(isearch_stripslashes($_POST['new_isearch_alts_alt' . $i]), 'utf-8');
  1733. $redirect = isset($_POST['new_isearch_alts_redirect'.$i]) ? 1 : 0;
  1734. if ($keyword != '')
  1735. {
  1736. /* Add new entry. */
  1737. if (!mysql_query ("INSERT INTO $isearch_table_alts (keyword, alternative, redirect) VALUES ('".isearch_escape_string($keyword)."', '".isearch_escape_string($alt)."', '$redirect')", $isearch_db))
  1738. {
  1739. isearch_adminLog('ERROR: MySQL error : ' . mysql_error() . " in " . __FILE__ . " line " . __LINE__, 1);
  1740. }
  1741. }
  1742. }
  1743. isearch_adminLog('Updated suggestion settings', 7);
  1744. }
  1745. if (isset($new_isearch_remove_get_vars))
  1746. {
  1747. $new_isearch_remove_get_vars = ereg_replace("[,\.[:space:]]+", " ", $new_isearch_remove_get_vars);
  1748. }
  1749. for ($j = 0; $j < count($tabData[$isearch_tab]['controls']); $j ++)
  1750. {
  1751. $varname = $tabData[$isearch_tab]['controls'][$j]['varname'];
  1752. $isearch_varname = "isearch_$varname";
  1753. $new_isearch_varname = "new_$isearch_varname";
  1754. if ($tabData[$isearch_tab]['controls'][$j]['type'] == 'checkbox')
  1755. {
  1756. $$new_isearch_varname = isset($_POST[$new_isearch_varname]) ? 1 : 0;
  1757. }
  1758. else
  1759. {
  1760. $$new_isearch_varname = isset($_POST[$new_isearch_varname]) ? isearch_stripslashes($_POST[$new_isearch_varname]) : '';
  1761. }
  1762. if (isset($tabData[$isearch_tab]['controls'][$j]['min']))
  1763. {
  1764. if ($$new_isearch_varname < $tabData[$isearch_tab]['controls'][$j]['min'])
  1765. {
  1766. $$new_isearch_varname = $tabData[$isearch_tab]['controls'][$j]['min'];
  1767. }
  1768. }
  1769. if (isset($tabData[$isearch_tab]['controls'][$j]['max']))
  1770. {
  1771. if ($$new_isearch_varname > $tabData[$isearch_tab]['controls'][$j]['max'])
  1772. {
  1773. $$new_isearch_varname = $tabData[$isearch_tab]['controls'][$j]['max'];
  1774. }
  1775. }
  1776. if (is_array($isearch_config[$varname]))
  1777. {
  1778. $$new_isearch_varname = ereg_replace("[[:cntrl:][:space:]]+", " ", $$new_isearch_varname);
  1779. }
  1780. $$new_isearch_varname = trim($$new_isearch_varname);
  1781. if (isset($tabData[$isearch_tab]['controls'][$j]['tolower']))
  1782. {
  1783. $$new_isearch_varname = strtolower($$new_isearch_varname);
  1784. }
  1785. $allowedExtChanged = False;
  1786. if ($varname == 'pdf_support')
  1787. {
  1788. if (($isearch_config['pdf_support'] == '0') && ($$new_isearch_varname != '0'))
  1789. {
  1790. if (!in_array('pdf', $isearch_config['allowed_ext']))
  1791. {
  1792. $isearch_config['allowed_ext'][] = 'pdf';
  1793. $allowedExtChanged = True;
  1794. }
  1795. }
  1796. else if (($isearch_config['pdf_support'] != '0') && ($$new_isearch_varname == '0'))
  1797. {
  1798. foreach (array_keys($isearch_config['allowed_ext']) as $key)
  1799. {
  1800. if ($isearch_config['allowed_ext'][$key] == 'pdf')
  1801. {
  1802. unset($isearch_config['allowed_ext'][$key]);
  1803. $allowedExtChanged = True;
  1804. }
  1805. }
  1806. }
  1807. }
  1808. if ($varname == 'msword_support')
  1809. {
  1810. if (($isearch_config['msword_support'] == '0') && ($$new_isearch_varname != '0'))
  1811. {
  1812. if (!in_array('doc', $isearch_config['allowed_ext']))
  1813. {
  1814. $isearch_config['allowed_ext'][] = 'doc';
  1815. $allowedExtChanged = True;
  1816. }
  1817. }
  1818. else if (($isearch_config['msword_support'] != '0') && ($$new_isearch_varname == '0'))
  1819. {
  1820. foreach (array_keys($isearch_config['allowed_ext']) as $key)
  1821. {
  1822. if ($isearch_config['allowed_ext'][$key] == 'doc')
  1823. {
  1824. unset($isearch_config['allowed_ext'][$key]);
  1825. $allowedExtChanged = True;
  1826. }
  1827. }
  1828. }
  1829. }
  1830. if ($allowedExtChanged)
  1831. {
  1832. $value = implode(" ", $isearch_config['allowed_ext']);
  1833. if (!mysql_query("UPDATE $isearch_table_info SET allowed_ext='" . isearch_escape_string($value) . "' WHERE id='1'", $isearch_db))
  1834. {
  1835. echo "<P>MySQL Error : " . mysql_error() . " File: " . __FILE__ . " Line: " . __LINE__;
  1836. }
  1837. isearch_adminLog('Automatically updated allowed extension setting', 7);
  1838. }
  1839. /* Query the old value */
  1840. if (!$result = mysql_query("SELECT ".mysql_escape_string($varname)." FROM $isearch_table_info WHERE id='1'", $isearch_db))
  1841. {
  1842. echo "<P>MySQL Error : " . mysql_error() . " File: " . __FILE__ . " Line: " . __LINE__;
  1843. }
  1844. if ($item = mysql_fetch_object($result))
  1845. {
  1846. if ($item->$varname != $$new_isearch_varname)
  1847. {
  1848. if (!mysql_query("UPDATE $isearch_table_info SET $varname='" . isearch_escape_string($$new_isearch_varname) . "' WHERE id='1'", $isearch_db))
  1849. {
  1850. echo "<P>MySQL Error : " . mysql_error() . " File: " . __FILE__ . " Line: " . __LINE__;
  1851. }
  1852. isearch_adminLog("Updated $varname => " . $$new_isearch_varname, 7);
  1853. }
  1854. }
  1855. }
  1856. /* Since configuration has changed, ensure that all pages will be spidered
  1857. * again.
  1858. */
  1859. if (!mysql_query("UPDATE $isearch_table_urls SET sig='' WHERE 1", $isearch_db))
  1860. {
  1861. echo "<P>MySQL Error : " . mysql_error() . " File: " . __FILE__ . " Line: " . __LINE__;
  1862. }
  1863. isearch_close();
  1864. isearch_open();
  1865. }
  1866. /* Output header tabs */
  1867. $tabsPerRow = ceil($tabCount / 2);
  1868. $tabCellWidth = floor(100 / $tabsPerRow) . "%";
  1869. echo '
  1870. <TABLE CLASS="tab_names" WIDTH="100%">
  1871. <TR>
  1872. ';
  1873. for ($i = 0; $i < $tabCount; $i++)
  1874. {
  1875. if ($i == $tabsPerRow)
  1876. {
  1877. echo '</TR><TR>
  1878. ';
  1879. }
  1880. if (isset($tabData[$i]['target']))
  1881. {
  1882. $target = $tabData[$i]['target'];
  1883. }
  1884. else
  1885. {
  1886. $target = "_self";
  1887. }
  1888. if (isset($tabData[$i]['url']))
  1889. {
  1890. $url = $tabData[$i]['url'];
  1891. if ($target == '_self')
  1892. {
  1893. $url .= '&isearch_tab='.$i;
  1894. }
  1895. }
  1896. else
  1897. {
  1898. $url = $PHP_SELF.'?isearch_tab='.$i;
  1899. }
  1900. $windowStatus = strip_tags($tabData[$i]['description']);
  1901. $tooltip = $tabData[$i]['description'];
  1902. $enabled = True;
  1903. echo '<TD ';
  1904. if ($i == $isearch_tab)
  1905. {
  1906. echo 'CLASS="selected_tab" ';
  1907. }
  1908. else if (isset($tabData[$i]['enabled']) && (! $tabData[$i]['enabled']))
  1909. {
  1910. echo 'CLASS="disabled_tab" ';
  1911. $tooltip = '<DIV style="color: red;">Only available in the professional version.</DIV><BR>' . $tooltip;
  1912. $windowStatus = 'Only available in the professional version.';
  1913. $enabled = False;
  1914. }
  1915. echo 'WIDTH="'.$tabCellWidth.'" ALIGN=CENTER>';
  1916. echo $enabled ? '<A TARGET="'.$target.'" HREF="'.$url.'" ' : '<DIV ';
  1917. echo 'CLASS="tab" '.showTooltip($tabData[$i]['name'], $tooltip).'>'.$tabData[$i]['name'].'';
  1918. echo $enabled ? '</A>' : '</DIV>';
  1919. echo '</TD>
  1920. ';
  1921. }
  1922. if (($i % 2) == 1)
  1923. {
  1924. echo "<TD WIDTH=\"$tabCellWidth\">&nbsp;</TD>";
  1925. }
  1926. echo '</TR>
  1927. </TABLE>
  1928. ';
  1929. if ($isearch_action == "reset_config")
  1930. {
  1931. if (!mysql_query("DROP TABLE $isearch_table_info", $isearch_db))
  1932. {
  1933. echo "<P>MySQL Error : " . mysql_error() . " File: " . __FILE__ . " Line: " . __LINE__;
  1934. }
  1935. isearch_createTables();
  1936. }
  1937. else if ($isearch_action == "reset_urls")
  1938. {
  1939. if (!mysql_query("DROP TABLE $isearch_table_urls", $isearch_db))
  1940. {
  1941. echo "<P>MySQL Error : " . mysql_error() . " File: " . __FILE__ . " Line: " . __LINE__;
  1942. }
  1943. if (!mysql_query("DROP TABLE $isearch_table_urls_new", $isearch_db))
  1944. {
  1945. echo "<P>MySQL Error : " . mysql_error() . " File: " . __FILE__ . " Line: " . __LINE__;
  1946. }
  1947. if (!mysql_query("DROP TABLE $isearch_table_words", $isearch_db))
  1948. {
  1949. echo "<P>MySQL Error : " . mysql_error() . " File: " . __FILE__ . " Line: " . __LINE__;
  1950. }
  1951. if (!mysql_query("DROP TABLE $isearch_table_words_new", $isearch_db))
  1952. {
  1953. echo "<P>MySQL Error : " . mysql_error() . " File: " . __FILE__ . " Line: " . __LINE__;
  1954. }
  1955. isearch_createTables();
  1956. }
  1957. else if ($isearch_action == 'google_ping')
  1958. {
  1959. $url = 'www.google.com/webmasters/sitemaps/ping?sitemap=http://'.$_SERVER['HTTP_HOST'];
  1960. $url .= str_replace('admin/index.php', 'google_sitemap.php', $PHP_SELF);
  1961. isearch_readFile($url);
  1962. }
  1963. else if ($isearch_action == 'clear_search_log')
  1964. {
  1965. echo "<P>Search log cleared.";
  1966. isearch_clearSearchLog();
  1967. }
  1968. else if ($isearch_action == 'clear_admin_log')
  1969. {
  1970. echo "<P>Admin log cleared.";
  1971. isearch_clearAdminLog();
  1972. }
  1973. else if ($isearch_action == 'clear_spider_log')
  1974. {
  1975. echo "<P>Spider log cleared.";
  1976. isearch_clearLog();
  1977. }
  1978. else if ($isearch_action == 'browse')
  1979. {
  1980. $isearch_browse_action = isearch_getPostVar("isearch_browse_action");
  1981. $isearch_browse_start = isearch_getPostVar("isearch_browse_start", 0);
  1982. $isearch_browse_num_per_page = 20;
  1983. if ($isearch_browse_action == 'words')
  1984. {
  1985. /* Show list of words */
  1986. $result = mysql_query("SELECT DISTINCT word, score, count(word) AS num FROM $isearch_table_words GROUP BY word ORDER BY num DESC");
  1987. if (!$result)
  1988. {
  1989. echo "<P>MySQL Error : " . mysql_error() . " File: " . __FILE__ . " Line: " . __LINE__;
  1990. }
  1991. else
  1992. {
  1993. echo '<P>All words and the number of pages containing that word.
  1994. <P><TABLE BORDER=1>
  1995. <TR><TH>Word</TH><TH>Matching Pages</TH></TR>
  1996. ';
  1997. while ($item = mysql_fetch_object($result))
  1998. {
  1999. echo "<TR><TD><A HREF=\"$PHP_SELF?isearch_action=browse&isearch_browse_action=word&isearch_browse_word=$item->word\">$item->word</A></TD><TD>$item->num</TD></TR>";
  2000. }
  2001. echo '</TABLE>';
  2002. }
  2003. }
  2004. else if ($isearch_browse_action == 'word')
  2005. {
  2006. /* Show a single word */
  2007. $isearch_browse_word = isearch_getPostVar("isearch_browse_word", 0);
  2008. echo "<P>Pages containing the word '$isearch_browse_word'";
  2009. $result = mysql_query("SELECT word, score, id FROM $isearch_table_words WHERE word='$isearch_browse_word' ORDER BY score DESC");
  2010. if (!$result)
  2011. {
  2012. echo "<P>MySQL Error : " . mysql_error() . " File: " . __FILE__ . " Line: " . __LINE__;
  2013. }
  2014. else
  2015. {
  2016. echo '<P><TABLE BORDER=1>
  2017. <TR><TH>URL</TH><TH>Score</TH><TH>&nbsp;</TH></TR>
  2018. ';
  2019. while ($item = mysql_fetch_object($result))
  2020. {
  2021. $result2 = mysql_query("SELECT url FROM $isearch_table_urls WHERE id='$item->id'");
  2022. $item2 = mysql_fetch_object($result2);
  2023. echo "<TR><TD><A TARGET=\"_blank\" HREF=\"$item2->url\">$item2->url</A></TD><TD>$item->score</TD><TD><A HREF=\"$PHP_SELF?isearch_action=browse&isearch_browse_action=url&isearch_browse_id=$item->id\">Details</A></TD></TR>";
  2024. }
  2025. echo '</TABLE>';
  2026. }
  2027. }
  2028. else if ($isearch_browse_action == 'url')
  2029. {
  2030. /* Show a single URL */
  2031. $isearch_browse_id = isearch_getPostVar("isearch_browse_id", 0);
  2032. $result = mysql_query("SELECT id, url, title FROM $isearch_table_urls WHERE id='$isearch_browse_id'");
  2033. if (!$result)
  2034. {
  2035. echo "<P>MySQL Error : " . mysql_error() . " File: " . __FILE__ . " Line: " . __LINE__;
  2036. }
  2037. else
  2038. {
  2039. echo "<P>Details of words found on the page:\n";
  2040. while ($item = mysql_fetch_object($result))
  2041. {
  2042. echo " <A TARGET=\"_blank\" HREF=\"$item->url\">$item->url</A> : $item->title";
  2043. }
  2044. }
  2045. $result = mysql_query("SELECT word, score FROM $isearch_table_words WHERE id='$isearch_browse_id' ORDER BY word");
  2046. if (!$result)
  2047. {
  2048. echo "<P>MySQL Error : " . mysql_error() . " File: " . __FILE__ . " Line: " . __LINE__;
  2049. }
  2050. else
  2051. {
  2052. echo '<P><TABLE BORDER=1>
  2053. <TR><TH>Word</TH><TH>Score</TH></TR>
  2054. ';
  2055. while ($item = mysql_fetch_object($result))
  2056. {
  2057. echo "<TR><TD><A HREF=\"$PHP_SELF?isearch_action=browse&isearch_browse_action=word&isearch_browse_word=$item->word\">$item->word</A></TD><TD>$item->score</TD></TR>";
  2058. }
  2059. echo '</TABLE>';
  2060. }
  2061. }
  2062. else
  2063. {
  2064. /* Show list of URLs */
  2065. $result = mysql_query("SELECT id, url, title FROM $isearch_table_urls ORDER BY URL LIMIT $isearch_browse_start, $isearch_browse_num_per_page");
  2066. if (!$result)
  2067. {
  2068. echo "<P>MySQL Error : " . mysql_error() . " File: " . __FILE__ . " Line: " . __LINE__;
  2069. }
  2070. else
  2071. {
  2072. echo "<P>Showing URLs ".($isearch_browse_start + 1)." to " . ($isearch_browse_start + mysql_num_rows($result)) .":<P><TABLE BORDER=1>\n";
  2073. $count = 0;
  2074. while ($item = mysql_fetch_object($result))
  2075. {
  2076. $count ++;
  2077. echo "<TR><TD><A TARGET=\"_blank\" HREF=\"$item->url\">$item->url</A></TD><TD>$item->title</TD><TD><A HREF=\"$PHP_SELF?isearch_action=browse&isearch_browse_action=url&isearch_browse_id=$item->id\">Details</A></TD></TR>";
  2078. }
  2079. echo "</TABLE>\n<P>\n";
  2080. if ($isearch_browse_start > 0)
  2081. {
  2082. echo '<A HREF="'.$PHP_SELF.'?isearch_action=browse&isearch_browse_action=urls&isearch_browse_start='.($isearch_browse_start-$isearch_browse_num_per_page).'">Previous Page</A><BR>';
  2083. }
  2084. if ($count == $isearch_browse_num_per_page)
  2085. {
  2086. echo '<A HREF="'.$PHP_SELF.'?isearch_action=browse&isearch_browse_action=urls&isearch_browse_start='.($isearch_browse_start+$isearch_browse_num_per_page).'">Next Page</A>';
  2087. }
  2088. }
  2089. }
  2090. echo <<<EOF
  2091. <CENTER>
  2092. <HR>
  2093. <H2><A HREF="$PHP_SELF?isearch_action=browse">Browse URLs</A></H2>
  2094. <H2><A HREF="$PHP_SELF?isearch_action=browse&isearch_browse_action=words">Browse Words</A></H2>
  2095. <H2><A HREF="$PHP_SELF">Back to Configuration</A></H2></CENTER>
  2096. </BODY>
  2097. </HTML>
  2098. EOF;
  2099. exit;
  2100. }
  2101. else if (($isearch_action == 'add_remove_respider'))
  2102. {
  2103. $isearch_add_remove_respider_action = isearch_getPostVar('isearch_add_remove_respider_action');
  2104. $isearch_show_combo = isearch_getPostVar('isearch_show_combo', (isearch_getUrlCount() < 100) ? '1' : '0');
  2105. if (isearch_getUrlCount(True) == 0)
  2106. {
  2107. isearch_copyUrlTables(True);
  2108. }
  2109. if ($isearch_add_remove_respider_action == 'save')
  2110. {
  2111. $isearch_add = trim(isearch_stripslashes(isearch_getPostVar('isearch_add')));
  2112. $isearch_add = ($isearch_add == '') ? array() : split('[[:space:]]+', $isearch_add);
  2113. $isearch_delete = trim(isearch_stripslashes(isearch_getPostVar('isearch_delete')));
  2114. $isearch_delete = ($isearch_delete == '') ? array() : split('[[:space:]]+', $isearch_delete);
  2115. foreach ($isearch_add as $url)
  2116. {
  2117. $result = mysql_query("SELECT id FROM $isearch_table_urls_new WHERE url='".isearch_escape_string($url)."'", $isearch_db);
  2118. if (!$result)
  2119. {
  2120. echo 'ERROR: MySQL error : ' . mysql_error() . " in " . __FILE__ . " line " . __LINE__;
  2121. }
  2122. else if ($item = mysql_fetch_object($result))
  2123. {
  2124. /* Already in database */
  2125. mysql_query("UPDATE $isearch_table_urls_new SET state='new' WHERE id='".$item->id."'", $isearch_db);
  2126. mysql_query("DELETE $isearch_table_words_new SET state='new' WHERE id='".$item->id."'", $isearch_db);
  2127. }
  2128. else
  2129. {
  2130. mysql_query("INSERT INTO $isearch_table_urls_new (url, temp_referrer_id, state) VALUES ('".isearch_escape_string($url)."', '-1', 'new')", $isearch_db);
  2131. }
  2132. }
  2133. foreach ($isearch_delete as $url)
  2134. {
  2135. $result = mysql_query("SELECT id FROM $isearch_table_urls_new WHERE url='".isearch_escape_string($url)."'", $isearch_db);
  2136. if (!$result)
  2137. {
  2138. echo 'ERROR: MySQL error : ' . mysql_error() . " in " . __FILE__ . " line " . __LINE__;
  2139. }
  2140. else if ($item = mysql_fetch_object($result))
  2141. {
  2142. /* Already in database */
  2143. mysql_query("DELETE FROM $isearch_table_urls_new WHERE id='".$item->id."'", $isearch_db);
  2144. mysql_query("DELETE FROM $isearch_table_words_new WHERE id='".$item->id."'", $isearch_db);
  2145. }
  2146. }
  2147. }
  2148. echo '
  2149. <P>Using this page you can add new URLs to the search index, remove existing
  2150. URLs from the search index or cause exising URLs to be respidered. Any other
  2151. URLs in the search index will not be affected. This allows you to make changes
  2152. without having to respider your whole site.
  2153. <P>Note that URLs added or deleted here will not be added or deleted
  2154. automatically next time your site is fully spidered.
  2155. <P>Use the text areas below to enter a list of URLs (space or line seperated) to
  2156. add/respider or remove. URLs must be absolute and should begin with
  2157. &quot;http://&quot;. Once you have entered the URLs, click &quot;Save&quot;, then
  2158. click &quot;Spider Changes&quot;
  2159. <P>
  2160. <CENTER>
  2161. <TABLE>
  2162. <FORM method="post" action="'.$PHP_SELF.'" name="form1">
  2163. <TR><TD ALIGN="center" COLSPAN=2>
  2164. ';
  2165. if ($isearch_show_combo)
  2166. {
  2167. echo '<SELECT NAME="combo">';
  2168. $result = mysql_query("SELECT url FROM $isearch_table_urls_new");
  2169. if (!$result)
  2170. {
  2171. echo "<P>MySQL Error : " . mysql_error() . " File: " . __FILE__ . " Line: " . __LINE__;
  2172. }
  2173. else
  2174. {
  2175. while ($item = mysql_fetch_object($result))
  2176. {
  2177. echo '<OPTION VALUE="'.$item->url.'">'.$item->url.'</option>'."\n";
  2178. }
  2179. }
  2180. echo '</SELECT>
  2181. <script language="JavaScript" type="text/javascript">
  2182. <!--
  2183. function copyUrl(targetField)
  2184. {
  2185. srcVal = document.form1.combo.options[document.form1.combo.selectedIndex].value;
  2186. if (targetField.value != "")
  2187. {
  2188. targetField.value = targetField.value + "\n";
  2189. }
  2190. targetField.value = targetField.value + srcVal;
  2191. }
  2192. -->
  2193. </script>
  2194. <A HREF="javascript:copyUrl(document.form1.isearch_add)" onMouseOver="window.status=\'Add URL to index\';return true;">Add/Respider</A>
  2195. <A HREF="javascript:copyUrl(document.form1.isearch_delete)" onMouseOver="window.status=\'Delete URL from index\';return true;">Delete</A>
  2196. ';
  2197. }
  2198. else
  2199. {
  2200. echo '<A HREF="'.$PHP_SELF.'?isearch_action=add_remove_respider&isearch_show_combo=1">Show URLs</A>';
  2201. }
  2202. echo '
  2203. </TD></TR>
  2204. <TR><TD>Add/Respider URLs:<TD><TEXTAREA COLS="60" NAME="isearch_add" ROWS="10"></TEXTAREA></TD></TR>
  2205. <TR><TD>Delete URLs:<TD><TEXTAREA COLS="60" NAME="isearch_delete" ROWS="10"></TEXTAREA></TD></TR>
  2206. <TR><TD COLSPAN=2 ALIGN="center"><INPUT TYPE="submit" VALUE="Save"></TD></TR>
  2207. <INPUT TYPE="hidden" NAME="isearch_action" VALUE="add_remove_respider">
  2208. <INPUT TYPE="hidden" NAME="isearch_add_remove_respider_action" VALUE="save">
  2209. <INPUT TYPE="hidden" NAME="isearch_show_combo" VALUE="'.$isearch_show_combo.'">
  2210. </FORM>
  2211. <FORM method="get" action="reindex_frame.php" target="isearch_reindex_frame">
  2212. <TR><TD ALIGN="center"><INPUT TYPE="submit" VALUE="Spider Changes"></TD></TR>
  2213. <INPUT TYPE="hidden" NAME="reset" VALUE="false">
  2214. </FORM>
  2215. </TABLE>
  2216. <HR>
  2217. <H2><A HREF="'.$PHP_SELF.'">Back to Configuration</A></H2></CENTER>
  2218. </BODY>
  2219. </HTML>
  2220. ';
  2221. exit;
  2222. }
  2223. else if (($isearch_action == 'backup_restore') || ($isearch_action == 'restore'))
  2224. {
  2225. $isearch_backup_data = isearch_getPostVar('isearch_backup_data');
  2226. if ($isearch_action == 'restore')
  2227. {
  2228. $query = "UPDATE $isearch_table_info SET " . preg_replace("/\\s+/", ' ', isearch_stripslashes($isearch_backup_data)) . " WHERE id='1'";
  2229. if (!mysql_query($query, $isearch_db))
  2230. {
  2231. echo "<P>MySQL Error : " . mysql_error() . " File: " . __FILE__ . " Line: " . __LINE__;
  2232. }
  2233. }
  2234. $resultInfo = mysql_query ("SELECT * FROM $isearch_table_info", $isearch_db);
  2235. $config = mysql_fetch_array($resultInfo, MYSQL_ASSOC);
  2236. $backup = '';
  2237. foreach (array_keys($config) as $key)
  2238. {
  2239. if ($backup != '')
  2240. {
  2241. $backup .= ",\n";
  2242. }
  2243. $backup .= $key."='".isearch_escape_string($config[$key])."'";
  2244. }
  2245. echo <<<EOF
  2246. <P>The text box below shows the current settings. You can copy these to a text file.
  2247. <P>To restore the settings, simply copy the saved settings, then paste into the text field below, then click &quot;Restore&quot;.
  2248. <P><CENTER>
  2249. <TABLE>
  2250. <TR>
  2251. <TD>
  2252. <FORM method="post" action="$PHP_SELF">
  2253. <TEXTAREA COLS="40" NAME="isearch_backup_data" ROWS="20">$backup</TEXTAREA>
  2254. <INPUT TYPE="hidden" NAME="isearch_action" VALUE="restore">
  2255. <INPUT TYPE="submit" VALUE="Restore">
  2256. </FORM>
  2257. </TD>
  2258. </TR>
  2259. </TABLE>
  2260. <HR>
  2261. <H2><A HREF="$PHP_SELF">Back to Configuration</A></H2></CENTER>
  2262. </BODY>
  2263. </HTML>
  2264. EOF;
  2265. exit;
  2266. }
  2267. /* Force re-read of configuration */
  2268. isearch_close();
  2269. isearch_open();
  2270. /* Output the configuration form */
  2271. $tabName = $tabData[$isearch_tab]['name'];
  2272. $tabDescription= $tabData[$isearch_tab]['description'];
  2273. echo '
  2274. <P>
  2275. <CENTER>
  2276. <TABLE CLASS="tab_header" WIDTH="100%">
  2277. <TR>
  2278. <TD><B>'.$tabName.' - '.$tabDescription.'</B></TD>
  2279. </TR>
  2280. </TABLE>
  2281. <P>
  2282. <TABLE WIDTH="100%">
  2283. <TR>
  2284. <TD colspan=3>
  2285. <TABLE BORDER=0 WIDTH=100%>
  2286. <TR>
  2287. <FORM method="post" action="'.$PHP_SELF.'" name="mainform">
  2288. <INPUT TYPE="hidden" NAME="isearch_action" VALUE="reset_urls">
  2289. <TD WIDTH="25%" ALIGN="center"><INPUT OnClick="return confirm(\'Are you sure you want to remove all spidered pages?\');" TYPE="submit" VALUE="Reset URL Index" '.showTooltip('Reset URL Index', 'Clears the index of pages that you have spidered.').'></TD>
  2290. </FORM>
  2291. <FORM method="get" action="reindex_frame.php" target="isearch_reindex_frame">
  2292. <TD WIDTH="25%" ALIGN="center"><INPUT TYPE="submit" VALUE="Spider" '.showTooltip('Spider', 'Spiders your site and builds an index of search words and pages.').'></TD>
  2293. <INPUT TYPE="hidden" NAME="reset" VALUE="true">
  2294. </FORM>
  2295. <FORM method="post" action="'.$PHP_SELF.'">
  2296. <INPUT TYPE="hidden" NAME="isearch_action" VALUE="reset_config">
  2297. <TD WIDTH="25%" ALIGN="center"><INPUT OnClick="return confirm(\'Are you sure you want to reset all settings?\');"TYPE="submit" VALUE="Reset Settings" '.showTooltip('Reset Settings', 'Resets all settings to their default values.').'></TD>
  2298. </FORM>
  2299. <FORM method="post" action="'.$PHP_SELF.'">
  2300. <TD WIDTH="25%" ALIGN="center"><INPUT TYPE="submit" NAME="isearch_submit" VALUE="Save" '.showTooltip('Save', 'Saves any changes that you have made to the configuration options.').'></TD>
  2301. </TR>
  2302. </TABLE>
  2303. </TR>
  2304. ';
  2305. for ($j = 0; $j < count($tabData[$isearch_tab]['controls']); $j ++)
  2306. {
  2307. echo "<TR>\n";
  2308. $name = $tabData[$isearch_tab]['controls'][$j]['name'];
  2309. $varname = $tabData[$isearch_tab]['controls'][$j]['varname'];
  2310. $description = $tabData[$isearch_tab]['controls'][$j]['description'];
  2311. if (is_array($isearch_config[$varname]))
  2312. {
  2313. $value = implode(" ", $isearch_config[$varname]);
  2314. }
  2315. else
  2316. {
  2317. $value = $isearch_config[$varname];
  2318. }
  2319. echo "<TD><B>$name</B> ".showTooltipIcon($name, $description)."</TD>\n";
  2320. switch ($tabData[$isearch_tab]['controls'][$j]['type'])
  2321. {
  2322. case 'text':
  2323. $size = $tabData[$isearch_tab]['controls'][$j]['size'];
  2324. $maxlength = $tabData[$isearch_tab]['controls'][$j]['maxlength'];
  2325. echo "<TD><INPUT MAXLENGTH=\"$maxlength\" NAME=\"new_isearch_$varname\" SIZE=\"$size\" VALUE=\"$value\"></TD>\n";
  2326. break;
  2327. case 'textarea':
  2328. echo "<TD><TEXTAREA COLS=\"40\" NAME=\"new_isearch_$varname\" ROWS=\"5\">$value</TEXTAREA></TD>\n";
  2329. break;
  2330. case 'checkbox':
  2331. $checked = $isearch_config[$varname] ? ' checked' : '' ;
  2332. echo "<TD><INPUT TYPE=\"checkbox\" NAME=\"new_isearch_$varname\"$checked></TD>\n";
  2333. break;
  2334. case "combo":
  2335. echo "<TD><SELECT NAME=\"new_isearch_$varname\">\n";
  2336. if (isset($tabData[$isearch_tab]['controls'][$j]['items']))
  2337. {
  2338. foreach ($tabData[$isearch_tab]['controls'][$j]['items'] as $item)
  2339. {
  2340. echo "<option value=\"" . $item['value'] . "\"";
  2341. if ($isearch_config[$varname] == $item['value'])
  2342. {
  2343. echo " selected";
  2344. }
  2345. echo ">" . $item['description'] . "</option>\n";
  2346. }
  2347. }
  2348. else
  2349. {
  2350. $itemvar = $tabData[$isearch_tab]['controls'][$j]['itemvar'];
  2351. foreach ($$itemvar as $item)
  2352. {
  2353. echo "<option value=\"" . $item . "\"";
  2354. if ($isearch_config[$varname] == $item)
  2355. {
  2356. echo " selected";
  2357. }
  2358. echo ">" . $item . "</option>\n";
  2359. }
  2360. }
  2361. echo "</SELECT></TD>\n";
  2362. break;
  2363. default:
  2364. echo "<H1>ERROR - Unknown type " . $tabData[$isearch_tab]['controls'][$j]['type'] . "</H1>\n";
  2365. break;
  2366. }
  2367. if ($isearch_config['show_admin_tooltips'])
  2368. {
  2369. echo "<NOSCRIPT><TD><SMALL>$description</SMALL></TD></NOSCRIPT>\n";
  2370. }
  2371. else
  2372. {
  2373. echo "<TD><SMALL>$description</SMALL></TD>\n";
  2374. }
  2375. echo "</TR>\n\n";
  2376. }
  2377. if ($tabName == 'Groups')
  2378. {
  2379. echo '<TR><TD COLSPAN=3>Each group has a name, a &quot;URL beginning&quot; setting and a &quot;URL regexp&quot; setting.
  2380. Any URLs that match a groups parameters will be included in that group. A URL can belong to multple groups.
  2381. All URLs belong to the &quot;All&quot; group.
  2382. <P>To use groups you must enter a group name, followed by either/both the beginning of the URL that matches that group or a regexp of the URL that matches that group.
  2383. Any page that begins the with the &quot;URL beginning&quot; setting or matches the &quot;URL regexp&quot; setting will be in the group.
  2384. <P>To delete a group, delete the name and click &quot;Save&quot;. Once you have filled all rows below, click &quot;Save&quot; to create more blank rows.</TD></TR>
  2385. ';
  2386. echo '<TR><TH>Group Name</TH><TH>Group URL beginning</TH><TH>Group URL regexp</TH></TR>';
  2387. $numGroups = floor(count($isearch_config['groups']) / 3);
  2388. for ($i = 0; $i < $numGroups + 5; $i++)
  2389. {
  2390. echo "<TR>\n";
  2391. if ($i < $numGroups)
  2392. {
  2393. $name = str_replace('+', ' ', $isearch_config['groups'][$i * 3]);
  2394. $url_beginning = $isearch_config['groups'][($i * 3)+1];
  2395. $url_regexp = $isearch_config['groups'][($i * 3)+2];
  2396. }
  2397. else
  2398. {
  2399. $name = '';
  2400. $url_beginning = '';
  2401. $url_regexp = '';
  2402. }
  2403. echo '<TD><INPUT MAXLENGTH="255" NAME="new_isearch_group_name' . $i . '" SIZE="20" VALUE="' . $name . '"></TD>' . "\n";
  2404. echo '<TD><INPUT MAXLENGTH="255" NAME="new_isearch_group_url' . $i . '" SIZE="40" VALUE="' . $url_beginning . '"></TD>' . "\n";
  2405. echo '<TD><INPUT MAXLENGTH="255" NAME="new_isearch_group_regexp' . $i . '" SIZE="40" VALUE="' . $url_regexp . '"></TD>' . "\n";
  2406. echo "</TR>\n\n";
  2407. }
  2408. echo '<INPUT TYPE="hidden" NAME="isearch_num_groups" VALUE="' . $i . '">' . "\n";
  2409. }
  2410. else if ($tabName == 'Links')
  2411. {
  2412. echo '<TR><TD COLSPAN=3>To use links you must enter a URL, keywords that display that URL, a title and a description.
  2413. <P>To delete a link delete the URL and click &quot;Save&quot;. Once you have filled all rows below, click &quot;Save&quot; to create more blank rows.</TD></TR>
  2414. ';
  2415. echo '<TR>
  2416. <TD COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLPADDING="0">
  2417. <TR>
  2418. <TH>Link URL</TH>
  2419. <TH>Keywords</TH>
  2420. <TH>Title</TH>
  2421. <TH>Description</TH>
  2422. </TR>
  2423. ';
  2424. $result = mysql_query("SELECT * FROM $isearch_table_links ORDER BY id");
  2425. if (!$result)
  2426. {
  2427. echo "<P>MySQL Error : " . mysql_error() . " File: " . __FILE__ . " Line: " . __LINE__;
  2428. }
  2429. else
  2430. {
  2431. $numLinks = mysql_num_rows($result);
  2432. for ($i = 0; $i < $numLinks + 5; $i++)
  2433. {
  2434. echo "<TR>\n";
  2435. if ($i < $numLinks)
  2436. {
  2437. $item = mysql_fetch_object($result);
  2438. $url = $item->url;
  2439. $keywords = $item->keywords;
  2440. $title = $item->title;
  2441. $description = $item->description;
  2442. }
  2443. else
  2444. {
  2445. $url = '';
  2446. $keywords = '';
  2447. $title = '';
  2448. $description = '';
  2449. }
  2450. echo '<TD><INPUT MAXLENGTH="255" NAME="new_isearch_links_url'.$i.'" SIZE="25" VALUE="' . $url . '"></TD>' . "\n";
  2451. echo '<TD><TEXTAREA COLS="20" NAME="new_isearch_links_keywords'.$i.'" ROWS="5">'.$keywords.'</TEXTAREA></TD>'."\n";
  2452. echo '<TD><TEXTAREA COLS="20" NAME="new_isearch_links_title'.$i.'" ROWS="5">'.$title.'</TEXTAREA></TD>'."\n";
  2453. echo '<TD><TEXTAREA COLS="20" NAME="new_isearch_links_description'.$i.'" ROWS="5">'.$description.'</TEXTAREA></TD>'."\n";
  2454. echo "</TR>\n\n";
  2455. }
  2456. echo '<INPUT TYPE="hidden" NAME="isearch_num_links" VALUE="' . $i . '">' . "\n";
  2457. while ($item = mysql_fetch_object($result))
  2458. {
  2459. echo "<TR><TD><A HREF=\"$item->url\">$item->word</A></TD><TD>$item->num</TD></TR>";
  2460. }
  2461. }
  2462. echo "</TABLE></TD></TR>\n";
  2463. if (!$isearch_pro) echo "<TR><TD COLSPAN=3><B>Only available in the <A HREF=\"http://www.iSearchTheNet.com/pro\" TARGET=\"_blank\">professional version</A>.</B></TD></TR>";
  2464. }
  2465. else if ($tabName == 'Suggestions')
  2466. {
  2467. echo "<TR>\n";
  2468. echo '<TD COLSPAN=3>Suggestions allow you to suggest alternative options to your visitors when they search for specific terms. You could use this for common mispellings.
  2469. <P>If the redirect column is checked, the search will automatically replace the keyword with the alternative. If it is not checked, the user will be presented with a message giving the option to repeat the search with the alternative.
  2470. <P>To delete an alternative, delete the keyword and click &quot;Save&quot;. Once you have filled all rows below, click &quot;Save&quot; to create more blank rows.
  2471. </TD>
  2472. ';
  2473. echo "</TR>\n";
  2474. echo '<TR><TD COLSPAN=3></TD></TR>
  2475. <TR>
  2476. <TD COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLPADDING="0">
  2477. <TR>
  2478. <TH ALIGN=center>Keyword</TH>
  2479. <TH ALIGN=center>Alternative</TH>
  2480. <TH ALIGN=center>Redirect</TH>
  2481. </TR>
  2482. ';
  2483. $result = mysql_query("SELECT * FROM $isearch_table_alts ORDER BY keyword");
  2484. if (!$result)
  2485. {
  2486. echo "<P>MySQL Error : " . mysql_error() . " File: " . __FILE__ . " Line: " . __LINE__;
  2487. }
  2488. else
  2489. {
  2490. $numLinks = mysql_num_rows($result);
  2491. for ($i = 0; $i < $numLinks + 5; $i++)
  2492. {
  2493. echo "<TR>\n";
  2494. if ($i < $numLinks)
  2495. {
  2496. $item = mysql_fetch_object($result);
  2497. $keyword = $item->keyword;
  2498. $alternative = $item->alternative;
  2499. $redirect = $item->redirect ? ' checked' : '';
  2500. }
  2501. else
  2502. {
  2503. $keyword = '';
  2504. $alternative = '';
  2505. $redirect = '';
  2506. }
  2507. echo '<TD ALIGN=center><INPUT MAXLENGTH="255" NAME="new_isearch_alts_keyword'.$i.'" SIZE="25" VALUE="'.$keyword.'"></TD>
  2508. <TD ALIGN=center><INPUT MAXLENGTH="255" NAME="new_isearch_alts_alt'.$i.'" SIZE="25" VALUE="'.$alternative.'"></TD>
  2509. <TD ALIGN=center><INPUT TYPE="checkbox" NAME="new_isearch_alts_redirect'.$i.'"'.$redirect.'></TD>
  2510. </TR>
  2511. ';
  2512. }
  2513. echo '<INPUT TYPE="hidden" NAME="isearch_num_alts" VALUE="' . $i . '">' . "\n";
  2514. while ($item = mysql_fetch_object($result))
  2515. {
  2516. echo "<TR><TD><A HREF=\"$item->url\">$item->word</A></TD><TD>$item->num</TD></TR>";
  2517. }
  2518. }
  2519. echo "</TABLE></TD></TR>\n";
  2520. if (!$isearch_pro) echo "<TR><TD COLSPAN=3><B>Only available in the <A HREF=\"http://www.iSearchTheNet.com/pro\" TARGET=\"_blank\">professional version</A>.</B></TD></TR>";
  2521. }
  2522. else if ($tabName == 'Smart Log')
  2523. {
  2524. echo "<TR>\n";
  2525. echo '<TD COLSPAN=3>Allows you to make intelligent decisions about searches that users have performed that did not return any results.
  2526. </TD>
  2527. ';
  2528. echo "</TR>\n";
  2529. echo "<TR><TD COLSPAN=3></TD></TR>\n";
  2530. foreach (array_keys($_POST) as $key)
  2531. {
  2532. if (ereg('^new_isearch_checked[0-9]+$', $key))
  2533. {
  2534. $result2 = mysql_query("UPDATE $isearch_table_search_log SET checked='1' WHERE search_term='".isearch_escape_string(urldecode($_POST[$key]))."'");
  2535. if (!$result2)
  2536. {
  2537. echo "<P>MySQL Error : " . mysql_error() . " File: " . __FILE__ . " Line: " . __LINE__;
  2538. }
  2539. }
  2540. }
  2541. if ($isearch_action == 'prompt_suggestion')
  2542. {
  2543. $keywords = $_REQUEST['keywords'];
  2544. echo '<TR><TD COLSPAN=3>Enter a new suggestion for the keyword(s) '.$keywords.'<P>
  2545. <TABLE BORDER=1>
  2546. <TR>
  2547. <TH ALIGN=center>Keyword</TH>
  2548. <TH ALIGN=center>Alternative</TH>
  2549. <TH ALIGN=center>Redirect</TH>
  2550. </TR>
  2551. <TR>
  2552. <TD ALIGN=center><INPUT MAXLENGTH="255" NAME="new_isearch_alts_keyword0" SIZE="25" VALUE="'.$keywords.'"></TD>
  2553. <TD ALIGN=center><INPUT MAXLENGTH="255" NAME="new_isearch_alts_alt0" SIZE="25" VALUE=""></TD>
  2554. <TD ALIGN=center><INPUT TYPE="checkbox" NAME="new_isearch_alts_redirect0"></TD>
  2555. </TR>
  2556. </TABLE>
  2557. <INPUT NAME="isearch_num_alts" VALUE="1" TYPE="hidden">
  2558. <INPUT NAME="isearch_alts_add" VALUE="1" TYPE="hidden">
  2559. </TD></TR>
  2560. ';
  2561. }
  2562. else if ($isearch_action == 'prompt_link')
  2563. {
  2564. $keywords = $_REQUEST['keywords'];
  2565. echo '<TR><TD COLSPAN=3>Enter a new link for the keywords(s) '.$keywords.'<P>
  2566. <TABLE BORDER=1>
  2567. <TR>
  2568. <TH>Link URL</TH>
  2569. <TH>Keywords</TH>
  2570. <TH>Title</TH>
  2571. <TH>Description</TH>
  2572. </TR>
  2573. <TR><TD><INPUT MAXLENGTH="255" NAME="new_isearch_links_url0" SIZE="25" VALUE=""></TD>
  2574. <TD><TEXTAREA COLS="20" NAME="new_isearch_links_keywords0" ROWS="5">'.$keywords.'</TEXTAREA></TD>
  2575. <TD><TEXTAREA COLS="20" NAME="new_isearch_links_title0" ROWS="5"></TEXTAREA></TD>
  2576. <TD><TEXTAREA COLS="20" NAME="new_isearch_links_description0" ROWS="5"></TEXTAREA></TD>
  2577. </TABLE>
  2578. <INPUT NAME="isearch_num_links" VALUE="1" TYPE="hidden">
  2579. <INPUT NAME="isearch_links_add" VALUE="1" TYPE="hidden">
  2580. </TD></TR>
  2581. ';
  2582. }
  2583. echo "<TR>\n";
  2584. echo '<TD COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLPADDING="0">' . "\n";
  2585. echo "<TR>\n";
  2586. echo "<TH ALIGN=center>Keyword(s)</TH>\n";
  2587. echo "<TH ALIGN=center>Actions</TH>\n";
  2588. echo "<TH ALIGN=center>Remove</TH>\n";
  2589. echo "</TR>\n\n";
  2590. $result = mysql_query("SELECT COUNT(DISTINCT search_term) AS c FROM $isearch_table_search_log WHERE matches='0' AND checked='0'");
  2591. if (!$result)
  2592. {
  2593. echo "<P>MySQL Error : " . mysql_error() . " File: " . __FILE__ . " Line: " . __LINE__;
  2594. $count = 0;
  2595. }
  2596. else
  2597. {
  2598. $item = mysql_fetch_object($result);
  2599. $count = $item->c;
  2600. }
  2601. $maxCount = 100;
  2602. $result = mysql_query("SELECT DISTINCT search_term FROM $isearch_table_search_log WHERE matches='0' AND checked='0' ORDER BY search_term LIMIT $maxCount");
  2603. if (!$result)
  2604. {
  2605. echo "<P>MySQL Error : " . mysql_error() . " File: " . __FILE__ . " Line: " . __LINE__;
  2606. }
  2607. else
  2608. {
  2609. $terms = array();
  2610. while ($item = mysql_fetch_object($result))
  2611. {
  2612. $term = $item->search_term;
  2613. if ($isearch_config['allow_dashes'])
  2614. {
  2615. $term = ereg_replace('[+"]', ' ', $term);
  2616. $term = str_replace('- ', ' ', $term);
  2617. $term = str_replace(' -', ' ', $term);
  2618. }
  2619. else
  2620. {
  2621. $term = ereg_replace('[-+"]', ' ', $term);
  2622. }
  2623. $term = ereg_replace('[[:space:]]+', ' ', $term);
  2624. $term = trim($term);
  2625. $terms[] = $term;
  2626. }
  2627. $terms = array_unique($terms);
  2628. $i = 0;
  2629. foreach ($terms as $term)
  2630. {
  2631. $words = split('[[:space:]]+', $term);
  2632. $found = False;
  2633. foreach ($words as $word)
  2634. {
  2635. $result2 = mysql_query("SELECT id FROM $isearch_table_alts WHERE keyword='".isearch_escape_string($word)."'");
  2636. if (!$result2)
  2637. {
  2638. echo "<P>MySQL Error : " . mysql_error() . " File: " . __FILE__ . " Line: " . __LINE__;
  2639. }
  2640. if (mysql_num_rows($result2) > 0)
  2641. {
  2642. $found = True;
  2643. break;
  2644. }
  2645. $result2 = mysql_query("SELECT id FROM $isearch_table_links_words WHERE word='".isearch_escape_string($word)."'");
  2646. if (!$result2)
  2647. {
  2648. echo "<P>MySQL Error : " . mysql_error() . " File: " . __FILE__ . " Line: " . __LINE__;
  2649. }
  2650. if (mysql_num_rows($result2) > 0)
  2651. {
  2652. $found = True;
  2653. break;
  2654. }
  2655. }
  2656. if ($found)
  2657. {
  2658. $result2 = mysql_query("UPDATE $isearch_table_search_log SET checked='1' WHERE search_term='".isearch_escape_string($term)."'");
  2659. if (!$result2)
  2660. {
  2661. echo "<P>MySQL Error : " . mysql_error() . " File: " . __FILE__ . " Line: " . __LINE__;
  2662. }
  2663. }
  2664. else
  2665. {
  2666. echo '<TR>
  2667. <TD ALIGN=center>'.$term.'</TD>
  2668. <TD ALIGN=center><A TARGET="_blank" HREF="../index.php?s='.urlencode($term).'">Search</A>&nbsp;|&nbsp;<A HREF="'.$PHP_SELF.'?isearch_action=prompt_suggestion&isearch_tab='.$isearch_tab.'&keywords='.urlencode($term).'">Add&nbsp;Suggestion</A>&nbsp;|&nbsp;<A HREF="'.$PHP_SELF.'?isearch_action=prompt_link&isearch_tab='.$isearch_tab.'&keywords='.urlencode($term).'">Add&nbsp;Link</A></TD>
  2669. <TD ALIGN=center><INPUT TYPE="checkbox" NAME="new_isearch_checked'.$i++.'" VALUE="'.urlencode($term).'"></TD>
  2670. </TR>
  2671. ';
  2672. }
  2673. }
  2674. }
  2675. echo '<tr><td></td><td></td><td align=center><input type=button value="Check All" onClick="this.value=checkall(this.form)"></td></tr>
  2676. ';
  2677. echo "</TABLE></TD></TR>\n";
  2678. if (!$isearch_pro) echo "<TR><TD COLSPAN=3><B>Only available in the <A HREF=\"http://www.iSearchTheNet.com/pro\" TARGET=\"_blank\">professional version</A>.</B></TD></TR>";
  2679. }
  2680. else if ($tabName == 'Character Set')
  2681. {
  2682. if (! function_exists('iconv'))
  2683. {
  2684. echo "<TR>\n";
  2685. echo '<TD COLSPAN=3><B>NOTE: iconv is not installed on your server.</B> iSearch uses the &quot;iconv&quot; function to perform character set conversions. You may experience problems translating pages which do not use the character set specified above. To avoid this, ask your system administrator to recompile PHP with the &quot;--with-iconv&quot; flag.
  2686. </TD>
  2687. ';
  2688. echo "</TR>\n";
  2689. }
  2690. }
  2691. echo '
  2692. <TR>
  2693. <TD COLSPAN=3 ALIGN=CENTER>
  2694. <INPUT TYPE="submit" NAME="isearch_submit" VALUE="Save" '.showTooltip('Save', 'Saves any changes that you have made to the configuration options.').'>
  2695. </TD>
  2696. </TR>
  2697. <INPUT TYPE="hidden" NAME="isearch_action" VALUE="update">
  2698. <INPUT TYPE="hidden" NAME="isearch_tab" VALUE="' . $isearch_tab . '">
  2699. </FORM>
  2700. </TABLE>
  2701. </CENTER>
  2702. ';
  2703. if ($tabName == 'Logging')
  2704. {
  2705. echo '
  2706. <P>iSearch maintains three logs:
  2707. <UL>
  2708. <LI>The spider log keeps a log of messages generated when pages are spidered.
  2709. <LI>The search log records searches that have been performed on your site.
  2710. <LI>The admin log records admin actions.
  2711. </UL>
  2712. <P>The spider log is cleared automatically whenever spidering is restarted. The
  2713. search log and admin log are only cleared when the &quot;Clear Search Log&quot; or &quot;Clear Admin Log&quot; button below is pressed.
  2714. <P>
  2715. <CENTER>
  2716. <TABLE>
  2717. <TR>
  2718. <TD><A HREF="log.php" target="isearch_spider_log">View Spider Log</A></TD>
  2719. <TD><A HREF="'.$PHP_SELF.'?isearch_action=clear_spider_log">Clear Spider Log</A></TD>
  2720. </TR>
  2721. <TR>
  2722. <TD><A HREF="search_log.php" target="isearch_search_log">View Search Log</A></TD>
  2723. <TD><A HREF="'.$PHP_SELF.'?isearch_action=clear_search_log">Clear Search Log</A></TD>
  2724. </TR>
  2725. <TR>
  2726. <TD><A HREF="admin_log.php" target="isearch_admin_log">View Admin Log</A></TD>
  2727. <TD><A HREF="'.$PHP_SELF.'?isearch_action=clear_admin_log">Clear Admin Log</A></TD>
  2728. </TR>
  2729. </TABLE>
  2730. </CENTER>
  2731. ';
  2732. }
  2733. if (isset($tabData[$isearch_tab]['notes']))
  2734. {
  2735. echo '<H3>Notes</H3>'.$tabData[$isearch_tab]['notes'];
  2736. }
  2737. if ($isearch_admin_password != '')
  2738. {
  2739. echo <<<EOF
  2740. <CENTER>
  2741. <P><SMALL><A HREF="$PHP_SELF?isearch_password">Logout</A></SMALL>
  2742. </CENTER>
  2743. EOF;
  2744. }
  2745. isearch_close();
  2746. echo <<<EOF
  2747. </BODY>
  2748. </HTML>
  2749. EOF;
  2750. ?>