PageRenderTime 59ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 1ms

/search/inc/search.inc.php

https://bitbucket.org/molusc/sma-website
PHP | 1776 lines | 1448 code | 236 blank | 92 comment | 372 complexity | 6421fdcb131827d9811f4856a5ec165e MD5 | raw file
Possible License(s): BSD-3-Clause

Large files files are truncated, but you can click here to view the full file

  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. if ( !defined('IN_ISEARCH') )
  11. {
  12. die('Hacking attempt');
  13. }
  14. define('ISEARCH_OP_MUST', 1);
  15. define('ISEARCH_OP_MAY', 2);
  16. define('ISEARCH_OP_MUSTNOT', 3);
  17. define('ISEARCH_LINKS_ID_BASE', 0x40000000);
  18. /* Clear the iSearch search log file */
  19. function isearch_clearSearchLog()
  20. {
  21. global $isearch_table_search_log;
  22. global $isearch_db;
  23. mysql_query("DELETE FROM $isearch_table_search_log", $isearch_db);
  24. }
  25. /* Return the contents of the spider log */
  26. function isearch_getSearchLog()
  27. {
  28. global $isearch_table_search_log;
  29. global $isearch_ro_db;
  30. $log = '';
  31. $result = mysql_query("SELECT * FROM $isearch_table_search_log ORDER BY id", $isearch_ro_db);
  32. if ($result)
  33. {
  34. while ($item = mysql_fetch_object($result))
  35. {
  36. $log .= date('M d, Y, H:i:s - ', $item->time) . $item->search_term . " (" . $item->matches . " matches)\n";
  37. }
  38. }
  39. return $log;
  40. }
  41. /* Save the string in the iSearch log file */
  42. function isearch_searchLog($search_term, $matches)
  43. {
  44. global $isearch_table_search_log;
  45. global $isearch_config;
  46. global $isearch_table_info;
  47. global $isearch_db;
  48. if (($isearch_config['log_searches']) && (isset($isearch_db)))
  49. {
  50. $now = time();
  51. if (!mysql_query("INSERT INTO $isearch_table_search_log (search_term, time, matches) VALUES ('" . isearch_escape_string($search_term) . "', '$now', '$matches')", $isearch_db))
  52. {
  53. echo '<p>MySQL Error : ' . mysql_error() . ' File: ' . __FILE__ . ', Line:' . __LINE__. '</p>';
  54. }
  55. if ($isearch_config['search_log_email_days'] > 0)
  56. {
  57. $now = time();
  58. if ($isearch_config['search_log_last_emailed'] + ($isearch_config['search_log_email_days'] * 60 * 60 * 24) < $now)
  59. {
  60. /* Email the search log */
  61. $mailTo = $isearch_config['admin_email'];
  62. $mailSubject = "iSearch search log";
  63. $mailBody = "The following searches have been performed on your site:\n";
  64. $mailBody .= "\n";
  65. $mailBody .= isearch_getSearchLog();
  66. $mailBody .= "\n";
  67. $mailBody .= "This email is automatically generated by iSearch. To change how often\n";
  68. $mailBody .= "this email is sent, please use your iSearch admin control panel.\n";
  69. $mailBody .= "\n";
  70. $mailBody .= "Visit the iSearch home page at http://www.iSearchTheNet.com/isearch\n";
  71. $mailHeaders = "From: " . $isearch_config['admin_email'] . "\n";
  72. if (mail($mailTo, $mailSubject, $mailBody, $mailHeaders))
  73. {
  74. mysql_query("UPDATE $isearch_table_info SET search_log_last_emailed='$now'", $isearch_db);
  75. $isearch_config['search_log_last_emailed'] = $now;
  76. isearch_clearSearchLog();
  77. }
  78. }
  79. }
  80. }
  81. }
  82. /* Clean the search string
  83. * Parameters:
  84. * $data : Contains the string to clean
  85. */
  86. function isearch_cleanSearchString($data)
  87. {
  88. global $isearch_config;
  89. if ($isearch_config['char_set_8_bit'])
  90. {
  91. /* Convert to lower case, doing accented character conversion correctly */
  92. $data = strtr($data, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ?ÁÂ?Ä??Ç?É?Ë?ÍÎ????ÓÔ?Ö×??Ú?ÜÝ?' . chr(0x8a) . chr(0x8e) ,
  93. 'abcdefghijklmnopqrstuvwxyz?áâ?ä??ç?é?ë?íî????óô?ö÷??ú?üý?' . chr(0x9a) . chr(0x9e) );
  94. /* Strip out all characters except numeric, alpha, whitespace or quote */
  95. $data = preg_replace('/([^-\.,@0-9a-z:\\.,' . chr(0xbf) . '-' . chr(0xff) . chr(0x9a) . chr(0x9e) . '\s"\+\-])/e', '', $data);
  96. }
  97. else
  98. {
  99. $data = isearch_stripslashes($data);
  100. }
  101. /* Ensure that quotes, + and - are surrounded by spaces */
  102. $data = ereg_replace('(["+])', ' \\1 ', $data);
  103. if (($isearch_config['allow_dashes'] == 0) || ($isearch_config['allow_dashes'] == 3))
  104. {
  105. /* Strip trailing +/- words */
  106. $data = ereg_replace('([+-]|[[:space:]])+$', '', $data);
  107. /* Replace repeated +/- words */
  108. $data = ereg_replace('([+-])([+-]|[[:space:]])+', ' \\1 ', $data);
  109. /* Ensure that dashes are surrounded by spaces */
  110. $data = ereg_replace('(-)', ' \\1 ', $data);
  111. }
  112. else
  113. {
  114. /* Strip trailing + words */
  115. $data = ereg_replace('([+]|[[:space:]])+$', '', $data);
  116. /* Replace repeated + words */
  117. $data = ereg_replace('([+])([+]|[[:space:]])+', ' \\1 ', $data);
  118. if ($isearch_config['allow_colons'] == 1)
  119. {
  120. /* Allow within words */
  121. $data = ereg_replace('([^ ])- ', '\\1 ', ereg_replace(' -([^ ])', ' \\1', " $data "));
  122. }
  123. }
  124. if ($isearch_config['allow_colons'] == 0)
  125. {
  126. /* Replace with spaces */
  127. $data = str_replace(':', ' ', $data);
  128. }
  129. else if ($isearch_config['allow_colons'] == 1)
  130. {
  131. /* Allow within words */
  132. $data = str_replace(' :', ' ', str_replace(': ', ' ', $data));
  133. }
  134. else if ($isearch_config['allow_colons'] == 3)
  135. {
  136. /* Remove All */
  137. $data = str_replace(':', '', $data);
  138. }
  139. if ($isearch_config['allow_dots'] == 0)
  140. {
  141. /* Replace with spaces */
  142. $data = str_replace('.', ' ', $data);
  143. }
  144. else if ($isearch_config['allow_dots'] == 1)
  145. {
  146. /* Allow within words */
  147. $data = str_replace(' .', ' ', str_replace('. ', ' ', $data));
  148. }
  149. else if ($isearch_config['allow_dots'] == 3)
  150. {
  151. /* Remove All */
  152. $data = str_replace('.', '', $data);
  153. }
  154. if ($isearch_config['allow_commas'] == 0)
  155. {
  156. /* Replace with spaces */
  157. $data = str_replace(',', ' ', $data);
  158. }
  159. else if ($isearch_config['allow_commas'] == 1)
  160. {
  161. /* Allow within words */
  162. $data = str_replace(' ,', ' ', str_replace(', ', ' ', $data));
  163. }
  164. else if ($isearch_config['allow_commas'] == 3)
  165. {
  166. /* Remove All */
  167. $data = str_replace(',', '', $data);
  168. }
  169. if ($isearch_config['allow_underscores'] == 0)
  170. {
  171. /* Replace with spaces */
  172. $data = str_replace('_', ' ', $data);
  173. }
  174. else if ($isearch_config['allow_underscores'] == 1)
  175. {
  176. /* Allow within words */
  177. $data = str_replace(' _', ' ', str_replace('_ ', ' ', $data));
  178. }
  179. else if ($isearch_config['allow_underscores'] == 3)
  180. {
  181. /* Remove All */
  182. $data = str_replace('_', '', $data);
  183. }
  184. /* Compact all white space into a single space character */
  185. $data = ereg_replace('[[:space:]]+', ' ', $data);
  186. /* Strip white space from beginning and end of the string */
  187. $data = trim($data);
  188. return $data;
  189. }
  190. /* Add a URL to the array of search results.
  191. */
  192. function isearch_addResult($id, $ranking)
  193. {
  194. global $isearch_resultArray;
  195. global $isearch_table_urls;
  196. global $isearch_groupQuery;
  197. global $isearch_ro_db;
  198. global $isearch_highestRank;
  199. if ($isearch_groupQuery != '')
  200. {
  201. $result = mysql_query("SELECT COUNT(id) FROM $isearch_table_urls WHERE id='$id' AND ( " . $isearch_groupQuery . " )", $isearch_ro_db);
  202. if (!$result)
  203. {
  204. echo "<p>MySQL error : " . mysql_error() . ' File: ' . __FILE__ . ', Line:' . __LINE__ . "</p>\n";
  205. }
  206. else
  207. {
  208. $total = mysql_result($result, 0);
  209. if ($total == 0)
  210. {
  211. /* Do not save this result */
  212. return;
  213. }
  214. }
  215. }
  216. if ($ranking > $isearch_highestRank)
  217. {
  218. $isearch_highestRank = $ranking;
  219. }
  220. $isearch_resultArray[] = array(
  221. 'id' => $id,
  222. 'ranking' => $ranking );
  223. }
  224. function isearch_resultArrayCmp($a, $b)
  225. {
  226. if ($a['ranking'] < $b['ranking'])
  227. {
  228. return 1;
  229. }
  230. if ($a['ranking'] > $b['ranking'])
  231. {
  232. return -1;
  233. }
  234. return 0;
  235. }
  236. function isearch_microtime()
  237. {
  238. list($usec, $sec) = explode(" ", microtime());
  239. return ((float)$usec + (float)$sec);
  240. }
  241. function isearch_find_suggestion($s)
  242. {
  243. global $isearch_suggestions;
  244. global $isearch_table_alts, $isearch_ro_db;
  245. $result = mysql_query("SELECT alternative, redirect FROM $isearch_table_alts WHERE keyword='".isearch_escape_string($s)."'", $isearch_ro_db);
  246. if (!$result)
  247. {
  248. echo "<p>MySQL error : " . mysql_error() . ' File: ' . __FILE__ . ', Line:' . __LINE__ . "</p>\n";
  249. }
  250. else
  251. {
  252. while ($item = mysql_fetch_object($result))
  253. {
  254. if ($item->redirect)
  255. {
  256. $s = $item->alternative;
  257. }
  258. else
  259. {
  260. $isearch_suggestions[] = array('keyword' => $s, 'alternative' => $item->alternative);
  261. }
  262. }
  263. }
  264. return $s;
  265. }
  266. /* Search the site for a string. Returns the number of matches found. */
  267. function isearch_find($searchString, $groups='', $partial=False, $soundex=False)
  268. {
  269. global $isearch_table_words, $isearch_table_urls, $isearch_table_links_words;
  270. global $isearch_ro_db;
  271. global $isearch_config;
  272. global $isearch_searchString;
  273. global $isearch_searchGroups;
  274. global $isearch_highlightWords;
  275. global $isearch_resultArray;
  276. global $isearch_search_time;
  277. global $isearch_search_partial;
  278. global $isearch_highestRank;
  279. global $isearch_suggestions;
  280. global $isearch_lang;
  281. global $isearch_groupQuery;
  282. $isearch_search_partial = $partial;
  283. $isearch_search_time = 0;
  284. $isearch_highestRank = 0;
  285. $isearch_searchString = $searchString;
  286. $isearch_searchGroups = $groups;
  287. $isearch_highlightWords = array();
  288. $isearch_suggestions = array();
  289. /* Clear the array of results */
  290. $isearch_resultArray = array();
  291. $maxResults = $isearch_config['max_pages'] * $isearch_config['results_per_page'];
  292. if ($searchString == '')
  293. {
  294. return 0;
  295. }
  296. $time_start = isearch_microtime();
  297. /* Arrays for storing ids and scores for each of the matches */
  298. $must = array();
  299. $may = array();
  300. $mustNot = array();
  301. $links = array();
  302. if ($isearch_config['search_all'])
  303. {
  304. $firstMust = True;
  305. $mustFlag = True;
  306. $defaultOp = ISEARCH_OP_MUST;
  307. }
  308. else
  309. {
  310. $defaultOp = ISEARCH_OP_MAY;
  311. $mustFlag = False;
  312. }
  313. $op = $defaultOp;
  314. $mysqlOp = $partial ? ' REGEXP ' : '=';
  315. $words = explode(' ', isearch_find_suggestion($isearch_searchString));
  316. $wordsCount = count($words);
  317. for ($i = 0; $i < $wordsCount; $i++)
  318. {
  319. if ($words[$i] == '+')
  320. {
  321. if (!$isearch_config['search_all'])
  322. {
  323. $op = ISEARCH_OP_MUST;
  324. $firstMust = False;
  325. if (!$mustFlag)
  326. {
  327. $firstMust = True;
  328. $mustFlag = True;
  329. }
  330. }
  331. }
  332. else if ($words[$i] == '-')
  333. {
  334. $op = ISEARCH_OP_MUSTNOT;
  335. }
  336. else if ($words[$i] == '"')
  337. {
  338. $quotedWords = '';
  339. for ($j = $i+1; $j < $wordsCount; $j++)
  340. {
  341. if ($words[$j] == '"')
  342. {
  343. break;
  344. }
  345. if (($words[$j] != '+') && ($words[$j] != '-'))
  346. {
  347. if ($quotedWords != '')
  348. {
  349. $quotedWords .= ' ';
  350. }
  351. $word = isearch_find_suggestion($words[$j]);
  352. $quotedWords .= $word;
  353. if ($op != ISEARCH_OP_MUSTNOT)
  354. {
  355. if (($word != '') && (!in_array($word, $isearch_config['stop_words'])) && (strlen($word) > $isearch_config['stop_words_length']))
  356. {
  357. $isearch_highlightWords[] = $word;
  358. }
  359. }
  360. }
  361. }
  362. /* If ($j >= $wordsCount) then the quote is not matched, so just ignore it */
  363. if (($j < $wordsCount) && ($j != ($i + 1)))
  364. {
  365. $quotedWords = isearch_find_suggestion($quotedWords);
  366. $result = mysql_query("SELECT id FROM $isearch_table_urls WHERE words REGEXP ' " . $quotedWords . " '", $isearch_ro_db);
  367. if (!$result)
  368. {
  369. echo "<p>MySQL error : " . mysql_error() . ' File: ' . __FILE__ . ', Line:' . __LINE__ . "</p>\n";
  370. }
  371. else
  372. {
  373. if ($op == ISEARCH_OP_MUSTNOT)
  374. {
  375. while ($item = mysql_fetch_object($result))
  376. {
  377. $mustNot[$item->id] = 0;
  378. }
  379. }
  380. else
  381. {
  382. $scores = array();
  383. while ($item = mysql_fetch_object($result))
  384. {
  385. $score = 0;
  386. for ($k = $i + 1; $k < $j; $k++)
  387. {
  388. $result2 = mysql_query("SELECT score FROM $isearch_table_words WHERE id='".$item->id."' AND word='" . $words[$k] . "'", $isearch_ro_db);
  389. if (!$result2)
  390. {
  391. echo "<p>MySQL error : " . mysql_error() . ' File: ' . __FILE__ . ', Line:' . __LINE__ . "</p>\n";
  392. }
  393. else
  394. {
  395. if ($item2 = mysql_fetch_object($result2))
  396. {
  397. $score += $item2->score;
  398. }
  399. }
  400. }
  401. $scores[$item->id] = $score;
  402. }
  403. if ($op == ISEARCH_OP_MUST)
  404. {
  405. if ($firstMust)
  406. {
  407. foreach (array_keys($scores) as $id)
  408. {
  409. $must[$id] = $scores[$id];
  410. }
  411. }
  412. else
  413. {
  414. foreach (array_keys($must) as $id)
  415. {
  416. /* Remove entries that are not in the scores list */
  417. if (!isset($scores[$id]))
  418. {
  419. unset($must[$id]);
  420. }
  421. else
  422. {
  423. /* Add the score */
  424. $must[$id] += $scores[$id];
  425. }
  426. }
  427. }
  428. }
  429. else
  430. {
  431. /* $op == ISEARCH_OP_MAY */
  432. foreach (array_keys($scores) as $id)
  433. {
  434. if (isset($may[$id]))
  435. {
  436. $may[$id] += $scores[$id];
  437. }
  438. else
  439. {
  440. $may[$id] = $scores[$id];
  441. }
  442. }
  443. }
  444. }
  445. }
  446. $i = $j;
  447. }
  448. $op = $defaultOp;
  449. }
  450. else
  451. {
  452. $word = isearch_find_suggestion($words[$i]);
  453. if ($op != ISEARCH_OP_MUSTNOT)
  454. {
  455. $isearch_highlightWords[] = $word;
  456. }
  457. /* Could optimise this to avoid storing scores for MUST NOT list */
  458. if ($soundex)
  459. {
  460. $result = mysql_query("SELECT id, score FROM $isearch_table_words WHERE SOUNDEX(word)${mysqlOp}SOUNDEX('" . isearch_escape_string($word) . "') ORDER BY score DESC LIMIT $maxResults", $isearch_ro_db);
  461. }
  462. else
  463. {
  464. $result = mysql_query("SELECT id, score FROM $isearch_table_words WHERE word$mysqlOp'" . isearch_escape_string($word) . "' ORDER BY score DESC LIMIT $maxResults", $isearch_ro_db);
  465. }
  466. if (!$result)
  467. {
  468. echo "<p>MySQL error : " . mysql_error() . ' File: ' . __FILE__ . ', Line:' . __LINE__ . "</p>\n";
  469. }
  470. else
  471. {
  472. if ($op == ISEARCH_OP_MUSTNOT)
  473. {
  474. while ($item = mysql_fetch_object($result))
  475. {
  476. $mustNot[$item->id] = 0;
  477. }
  478. }
  479. else if ($op == ISEARCH_OP_MUST)
  480. {
  481. if ($firstMust)
  482. {
  483. while ($item = mysql_fetch_object($result))
  484. {
  485. $must[$item->id] = $item->score;
  486. }
  487. }
  488. else
  489. {
  490. $scores = array();
  491. while ($item = mysql_fetch_object($result))
  492. {
  493. $scores[$item->id] = $item->score;
  494. }
  495. foreach (array_keys($must) as $id)
  496. {
  497. /* Remove entries that are not in the scores list */
  498. if (!isset($scores[$id]))
  499. {
  500. unset($must[$id]);
  501. }
  502. else
  503. {
  504. /* Add the score */
  505. $must[$id] += $scores[$id];
  506. }
  507. }
  508. }
  509. }
  510. else
  511. {
  512. /* $op == ISEARCH_OP_MAY */
  513. if (count($may) == 0)
  514. {
  515. while ($item = mysql_fetch_object($result))
  516. {
  517. $may[$item->id] = $item->score;
  518. }
  519. }
  520. else
  521. {
  522. while ($item = mysql_fetch_object($result))
  523. {
  524. if (isset($may[$item->id]))
  525. {
  526. $may[$item->id] += $item->score;
  527. }
  528. else
  529. {
  530. $may[$item->id] = $item->score;
  531. }
  532. }
  533. }
  534. }
  535. }
  536. /* Now check for links */
  537. if (($isearch_config['extra_link_display']) && ($op != ISEARCH_OP_MUSTNOT))
  538. {
  539. if ($soundex)
  540. {
  541. $result = mysql_query("SELECT id FROM $isearch_table_links_words WHERE SOUNDEX(word)${mysqlOp}SOUNDEX('" . isearch_escape_string($word) . "')", $isearch_ro_db);
  542. }
  543. else
  544. {
  545. $result = mysql_query("SELECT id FROM $isearch_table_links_words WHERE word$mysqlOp'" . isearch_escape_string($word) . "'", $isearch_ro_db);
  546. }
  547. if (!$result)
  548. {
  549. echo "<p>MySQL error : " . mysql_error() . ' File: ' . __FILE__ . ', Line:' . __LINE__ . "</p>\n";
  550. }
  551. else
  552. {
  553. /* $op == ISEARCH_OP_MAY */
  554. while ($item = mysql_fetch_object($result))
  555. {
  556. $links[] = $item->id;
  557. }
  558. }
  559. }
  560. $op = $defaultOp;
  561. $firstMust = False;
  562. }
  563. }
  564. $isearch_groupQuery = '';
  565. if ($groups != '')
  566. {
  567. $list = explode(',', $groups);
  568. for ($i = 0; $i < count($isearch_config['groups']); $i += 3)
  569. {
  570. if (in_array($isearch_config['groups'][$i], $list))
  571. {
  572. if ($isearch_config['groups'][$i+1] != '')
  573. {
  574. if ($isearch_groupQuery != '')
  575. {
  576. $isearch_groupQuery .= ' OR ';
  577. }
  578. $isearch_groupQuery .= "url REGEXP '^" . ereg_replace('\?', '\?', ereg_replace('\+', '\+', ereg_replace('\.', '\.', $isearch_config['groups'][$i+1]))) . "'";
  579. }
  580. if ($isearch_config['groups'][$i+2] != '')
  581. {
  582. if ($isearch_groupQuery != '')
  583. {
  584. $isearch_groupQuery .= ' OR ';
  585. }
  586. $isearch_groupQuery .= "url REGEXP '" . $isearch_config['groups'][$i+2] . "'";
  587. }
  588. }
  589. }
  590. }
  591. if ($mustFlag)
  592. {
  593. foreach (array_keys($must) as $id)
  594. {
  595. /* Ignore entries in the MUST NOT list */
  596. if (!isset($mustNot[$id]))
  597. {
  598. /* Add MAY scores */
  599. if (isset($may[$id]))
  600. {
  601. isearch_addResult($id, $must[$id] + $may[$id]);
  602. }
  603. else
  604. {
  605. isearch_addResult($id, $must[$id]);
  606. }
  607. }
  608. }
  609. }
  610. else
  611. {
  612. foreach (array_keys($may) as $id)
  613. {
  614. /* Ignore entries in the MUST NOT list */
  615. if (!isset($mustNot[$id]))
  616. {
  617. isearch_addResult($id, $may[$id]);
  618. }
  619. }
  620. }
  621. $linksRank = $isearch_highestRank + 1;
  622. if (count($links) > 0)
  623. {
  624. foreach ($links as $id)
  625. {
  626. isearch_addResult($id + ISEARCH_LINKS_ID_BASE, $linksRank);
  627. }
  628. }
  629. /* Sort the result array */
  630. usort($isearch_resultArray, 'isearch_resultArrayCmp');
  631. $numResults = count($isearch_resultArray);
  632. isearch_searchLog($isearch_searchString, $numResults);
  633. $time_end = isearch_microtime();
  634. $isearch_search_time = str_replace('.', $isearch_lang['decimal_point'], sprintf("%.3f", $time_end - $time_start));
  635. return $numResults;
  636. }
  637. function isearch_html_entities($str)
  638. {
  639. global $isearch_config;
  640. if ($isearch_config['char_set_8_bit'])
  641. {
  642. if (version_compare(PHP_VERSION, '4.1.0', '>='))
  643. {
  644. $str = @htmlentities($str, ENT_QUOTES, $isearch_config['char_set']);
  645. }
  646. else
  647. {
  648. $str = @htmlentities($str);
  649. }
  650. }
  651. else
  652. {
  653. if (version_compare(PHP_VERSION, '4.1.0', '>='))
  654. {
  655. $str = @htmlspecialchars($str, ENT_QUOTES, $isearch_config['char_set']);
  656. }
  657. else
  658. {
  659. $str = @htmlspecialchars($str);
  660. }
  661. }
  662. return $str;
  663. }
  664. function isearch_googleStyleDescription($resultIndex)
  665. {
  666. global $isearch_resultArray;
  667. global $isearch_table_urls;
  668. global $isearch_ro_db;
  669. global $isearch_config;
  670. global $isearch_highlightWords;
  671. $id = $isearch_resultArray[$resultIndex]['id'];
  672. if (count($isearch_highlightWords) == 0)
  673. {
  674. $result = mysql_query("SELECT description FROM $isearch_table_urls WHERE id='$id'", $isearch_ro_db);
  675. if (($result) && ($resultItem = mysql_fetch_object($result)))
  676. {
  677. return $resultItem->description;
  678. }
  679. /* No description available */
  680. return '';
  681. }
  682. $isearch_googleMinBefore = 5;
  683. $isearch_googleMinAfter = 10;
  684. $isearch_googleMaxWordCount = 32;
  685. $result = mysql_query("SELECT stripped_body FROM $isearch_table_urls WHERE id='$id'", $isearch_ro_db);
  686. if (($result) && ($resultItem = mysql_fetch_object($result)))
  687. {
  688. $description = $resultItem->stripped_body;
  689. if ($isearch_config['hide_regexp'] != '')
  690. {
  691. $description = ereg_replace($isearch_config['hide_regexp'], '', $description);
  692. }
  693. if ($isearch_config['replace_regexp'] != '')
  694. {
  695. $description = ereg_replace($isearch_config['replace_regexp'], ' ', $description);
  696. }
  697. $words = explode(' ', $description);
  698. }
  699. else
  700. {
  701. return '';
  702. }
  703. $wordsCount = count($words);
  704. $pos = array();
  705. /* Find the position of each word to highlight */
  706. for ($j = 0; $j < $wordsCount; $j++)
  707. {
  708. for ($i = 0; $i < count($isearch_highlightWords); $i++)
  709. {
  710. if (eregi($isearch_highlightWords[$i], $words[$j]))
  711. {
  712. $pos[] = $j;
  713. break; /* Avoid multiple entries in pos[] on same word */
  714. }
  715. }
  716. }
  717. if (count($pos) == 0)
  718. {
  719. /* This should never happen ! */
  720. $pos[] = 0;
  721. $isearch_googleMinAfter = 999;
  722. }
  723. else if (count($pos) == 1)
  724. {
  725. /* Increase the number of words displayed before and after the hit word */
  726. $isearch_googleMinBefore *= 2;
  727. $isearch_googleMinAfter = 999;
  728. }
  729. if ($isearch_config['char_set_8_bit'])
  730. {
  731. $trans = get_html_translation_table(HTML_ENTITIES);
  732. }
  733. else
  734. {
  735. }
  736. $wordCount = 0;
  737. $posCount = 0;
  738. $description = '';
  739. while (($wordCount < $isearch_googleMaxWordCount) && ($posCount < count($pos)))
  740. {
  741. $startPos = $pos[$posCount] - $isearch_googleMinBefore;
  742. if ($startPos < 0)
  743. {
  744. $startPos = 0;
  745. }
  746. $endPos = $pos[$posCount] + $isearch_googleMinAfter + 1;
  747. if (($posCount == 0) && ($startPos != 0))
  748. {
  749. $description = '... ';
  750. }
  751. for ($i = $startPos; $i < $endPos; $i++)
  752. {
  753. $wordCount ++;
  754. if (($wordCount > $isearch_googleMaxWordCount) || ($i >= $wordsCount))
  755. {
  756. break;
  757. }
  758. $lastWord = $i;
  759. $description .= isearch_html_entities($words[$i]) . ' ';
  760. /* Check whether this is a matched word */
  761. if (($isearch_config['highlight_results']) && ($posCount < count($pos)) && ($i == $pos[$posCount]))
  762. {
  763. $posCount ++;
  764. if ($i + $isearch_googleMinAfter + 1 > $endPos)
  765. {
  766. $endPos = $i + $isearch_googleMinAfter + 1;
  767. }
  768. }
  769. if (($posCount+1 < count($pos)) && ($i + $isearch_googleMinBefore >= $pos[$posCount+1]))
  770. {
  771. if ($pos[$posCount + 1] > $endPos)
  772. {
  773. $endPos = $pos[$posCount + 1];
  774. }
  775. }
  776. }
  777. $description .= '... ';
  778. }
  779. if ($wordCount < $isearch_googleMaxWordCount)
  780. {
  781. $i = $lastWord + 1;
  782. while (($wordCount < $isearch_googleMaxWordCount) && ($i < $wordsCount))
  783. {
  784. $wordCount ++;
  785. $description .= isearch_html_entities($words[$i]) . ' ';
  786. $i++;
  787. }
  788. $description .= '... ';
  789. }
  790. return $description;
  791. }
  792. function isearch_highlight($in)
  793. {
  794. global $isearch_highlightWords;
  795. $words = explode(' ', $in);
  796. $wordsCount = count($words);
  797. /* Search each word, and highlight */
  798. for ($j = 0; $j < $wordsCount; $j++)
  799. {
  800. for ($i = 0; $i < count($isearch_highlightWords); $i++)
  801. {
  802. if (eregi($isearch_highlightWords[$i], $words[$j]))
  803. {
  804. $words[$j] = '<span class="isearch-highlight">' . $words[$j] . '</span>';
  805. break;
  806. }
  807. }
  808. }
  809. return implode(' ', $words);
  810. }
  811. /* Truncate a string to a manimum length */
  812. function isearch_truncate($string, $length)
  813. {
  814. if (($length > 0) && (strlen($string) > $length + 3))
  815. {
  816. return substr($string, 0, $length) . '...';
  817. }
  818. return $string;
  819. }
  820. /* Show results of a site search */
  821. function isearch_showResults($pageNumber = 1)
  822. {
  823. global $isearch_table_urls, $isearch_table_links, $isearch_ro_db;
  824. global $isearch_searchString;
  825. global $isearch_searchGroups;
  826. global $isearch_resultArray;
  827. global $isearch_config;
  828. global $isearch_lang;
  829. global $isearch_version;
  830. global $isearch_search_time;
  831. global $isearch_search_partial;
  832. global $isearch_suggestions;
  833. $resultCount = count($isearch_resultArray);
  834. if ($resultCount > $isearch_config['max_pages'] * $isearch_config['results_per_page'])
  835. {
  836. $resultCount = $isearch_config['max_pages'] * $isearch_config['results_per_page'];
  837. }
  838. $maxPage = ceil($resultCount / $isearch_config['results_per_page']);
  839. if ($maxPage > $isearch_config['max_pages'])
  840. {
  841. $maxPage = $isearch_config['max_pages'];
  842. }
  843. if ($pageNumber < 1)
  844. {
  845. $pageNumber = 1;
  846. }
  847. if ($pageNumber > $maxPage)
  848. {
  849. $pageNumber = $maxPage;
  850. }
  851. $lastResult = $pageNumber * $isearch_config['results_per_page'];
  852. $firstResult = $lastResult - $isearch_config['results_per_page'] + 1;
  853. if ($lastResult > $resultCount)
  854. {
  855. $lastResult = $resultCount;
  856. }
  857. if ($firstResult < 0)
  858. {
  859. $firstResult = 0;
  860. }
  861. if ($isearch_config['char_set_8_bit'])
  862. {
  863. $trans = get_html_translation_table(HTML_ENTITIES);
  864. }
  865. else
  866. {
  867. $trans = get_html_translation_table(HTML_SPECIALCHARS);
  868. }
  869. $htmlSearchString = isearch_html_entities($isearch_searchString);
  870. $patterns = array(
  871. '/(%s)/',
  872. '/(%f)/',
  873. '/(%l)/',
  874. '/(%t)/',
  875. '/(%e)/');
  876. $replacements = array(
  877. '<span class="isearch-search">' . $htmlSearchString . '</span>',
  878. $firstResult,
  879. $lastResult,
  880. $resultCount,
  881. $isearch_search_time);
  882. foreach (array_keys($isearch_lang) as $key)
  883. {
  884. $isearch_lang_converted[$key] = preg_replace($patterns, $replacements, $isearch_lang[$key]);
  885. }
  886. $free_pro = 'Professional';
  887. $time = $isearch_config['show_time'] ? (' '.$isearch_lang_converted['results_head4']) : '';
  888. echo '
  889. <!-- Search results generated by iSearch2 version '.$isearch_version.' '.$free_pro.' -->
  890. <!-- Visit http://www.iSearchTheNet.com/isearch -->
  891. <table class="isearch-head">
  892. <tr class="isearch-head">
  893. <td class="isearch-head">'.$isearch_lang_converted['results_head2'].'</td>
  894. <td class="isearch-head" align="right">'.$isearch_lang_converted['results_head3'].$time.'</td>
  895. </tr>
  896. </table>
  897. <br />
  898. ';
  899. if (count($isearch_suggestions) > 0)
  900. {
  901. echo '
  902. <span class="isearch-suggest-title">' . $isearch_lang_converted['suggest_title'] . '</span>
  903. <br />
  904. ';
  905. $searchStrings = array();
  906. foreach ($isearch_suggestions as $suggestion)
  907. {
  908. $searchStrings[] = str_replace($suggestion['keyword'], $suggestion['alternative'], $isearch_searchString);
  909. }
  910. sort($searchStrings);
  911. $searchStrings = array_unique($searchStrings);
  912. foreach ($searchStrings as $searchString)
  913. {
  914. $href = $_SERVER['PHP_SELF'] . '?action=search&amp;s=';
  915. if (strtolower($isearch_config['char_set']) == 'utf-8')
  916. {
  917. $href .= urlencode(utf8_encode($searchString));
  918. }
  919. else
  920. {
  921. $href .= urlencode($searchString);
  922. }
  923. $href .= '&amp;group=' . urlencode($isearch_searchGroups);
  924. if ($isearch_search_partial)
  925. {
  926. $href .= '&amp;partial=1';
  927. }
  928. echo '<a class="isearch-suggest" href="' . $href . '">' . $searchString . '</a>
  929. ';
  930. }
  931. echo '<br />
  932. ';
  933. }
  934. if ($resultCount > 0)
  935. {
  936. if ($isearch_config['prevnext_type'] == 0)
  937. {
  938. $prevNext = '';
  939. }
  940. else if (($isearch_config['prevnext_type'] > 3) || ($maxPage > 1))
  941. {
  942. /* If more than one results page, display "previous" and/or "next" links */
  943. $href = $_SERVER['PHP_SELF'] . '?action=search&amp;s=';
  944. if (strtolower($isearch_config['char_set']) == 'utf-8')
  945. {
  946. $href .= urlencode(utf8_encode($isearch_searchString));
  947. }
  948. else
  949. {
  950. $href .= urlencode($isearch_searchString);
  951. }
  952. $href .= '&amp;group=' . urlencode($isearch_searchGroups);
  953. if ($isearch_search_partial)
  954. {
  955. $href .= '&amp;partial=1';
  956. }
  957. $prevNext = '
  958. <table class="isearch-prevnext" border="0" width="100%">
  959. <col width="10%" />
  960. <col width="80%" />
  961. <col width="10%" />
  962. <tr class="isearch-prevnext">
  963. <td class="isearch-prevnext" style="text-align: left">
  964. &nbsp;';
  965. if ($pageNumber > 1)
  966. {
  967. $prevPageNumber = $pageNumber - 1;
  968. $prevNext .= '&nbsp;<a class="isearch-prevnext" href="'.$href.'&amp;page='.$prevPageNumber.'">'.$isearch_lang_converted['previous'].'</a>';
  969. }
  970. $prevNext .= '
  971. </td>
  972. <td class="isearch-prevnext" style="text-align: center">&nbsp;
  973. ';
  974. $startPage = $pageNumber - $isearch_config['prevnext_num'] + 1;
  975. if ($startPage < 1)
  976. {
  977. $startPage = 1;
  978. }
  979. $endPage = $pageNumber + $isearch_config['prevnext_num'] - 1;
  980. if ($endPage > $maxPage)
  981. {
  982. $endPage = $maxPage;
  983. }
  984. if ($isearch_config['prevnext_num'] != 0)
  985. {
  986. if ($startPage > 1)
  987. {
  988. $prevNext .= '
  989. <a class="isearch-prevnext" href="'.$href.'&amp;page=1">1</a>
  990. ';
  991. if ($startPage > 2)
  992. {
  993. $prevNext .= '&nbsp;...';
  994. }
  995. }
  996. $prevNext .= '&nbsp;';
  997. for ($i = $startPage; $i <= $endPage; $i++)
  998. {
  999. if ($i == $pageNumber)
  1000. {
  1001. $prevNext .= $i.'&nbsp;';
  1002. }
  1003. else
  1004. {
  1005. $prevNext .= '
  1006. <a class="isearch-prevnext" href="'.$href.'&amp;page='.$i.'">'.$i.'</a>&nbsp;
  1007. ';
  1008. }
  1009. }
  1010. if ($endPage < $maxPage)
  1011. {
  1012. if ($endPage < ($maxPage - 1))
  1013. {
  1014. $prevNext .= '...&nbsp;';
  1015. }
  1016. $prevNext .= '
  1017. <a class="isearch-prevnext" href="'.$href.'&amp;page='.$maxPage.'">'.$maxPage.'</a>&nbsp;
  1018. ';
  1019. }
  1020. }
  1021. $prevNext .= '
  1022. </td>
  1023. <td class="isearch-prevnext" style="text-align: right">
  1024. ';
  1025. if ($pageNumber < $maxPage)
  1026. {
  1027. $nextPageNumber = $pageNumber + 1;
  1028. $prevNext .= '
  1029. <a class="isearch-prevnext" href="'.$href.'&amp;page='.$nextPageNumber.'">'.$isearch_lang_converted['next'].'</a>&nbsp;';
  1030. }
  1031. $prevNext .= '&nbsp;
  1032. </td>
  1033. </tr>
  1034. </table>
  1035. <br />
  1036. ';
  1037. }
  1038. else
  1039. {
  1040. $prevNext = '
  1041. <table class="isearch-prevnext">
  1042. <tr class="isearch-prevnext">
  1043. <td class="isearch-prevnext">&nbsp;</td>
  1044. </tr>
  1045. </table>
  1046. <br />
  1047. ';
  1048. }
  1049. $prevNextBefore = '';
  1050. $prevNextAfter = '';
  1051. switch ($isearch_config['prevnext_type'])
  1052. {
  1053. case 1:
  1054. case 4:
  1055. $prevNextBefore = $prevNext;
  1056. break;
  1057. case 2:
  1058. case 5:
  1059. $prevNextAfter = $prevNext;
  1060. break;
  1061. case 3:
  1062. case 6:
  1063. $prevNextAfter = $prevNext;
  1064. $prevNextBefore = $prevNext;
  1065. break;
  1066. }
  1067. echo $prevNextBefore;
  1068. for ($i = $firstResult-1; $i < $lastResult; $i++)
  1069. {
  1070. $id = $isearch_resultArray[$i]['id'];
  1071. $lastIsLink = isset($isLink) ? $isLink : False;
  1072. if ($id >= ISEARCH_LINKS_ID_BASE)
  1073. {
  1074. $id -= ISEARCH_LINKS_ID_BASE;
  1075. $result = mysql_query("SELECT url, title, description FROM $isearch_table_links WHERE id='$id'", $isearch_ro_db);
  1076. $isLink = True;
  1077. }
  1078. else
  1079. {
  1080. $result = mysql_query("SELECT url, title, description, size FROM $isearch_table_urls WHERE id='$id'", $isearch_ro_db);
  1081. $isLink = False;
  1082. }
  1083. if (!$result)
  1084. {
  1085. echo "<p>MySQL error : " . mysql_error() . ' File: ' . __FILE__ . ', Line:' . __LINE__ . "</p>\n";
  1086. }
  1087. else if ($item = mysql_fetch_object($result))
  1088. {
  1089. /* Use google style results if explicitly set, or if there is no
  1090. * description for this page
  1091. */
  1092. if ($isearch_config['description_style'] == 0)
  1093. {
  1094. $description = '';
  1095. }
  1096. else if ($isLink)
  1097. {
  1098. $description = $item->description;
  1099. }
  1100. else if (($isearch_config['description_style'] == 2) || ($item->description == ''))
  1101. {
  1102. /* Use Google style */
  1103. $description = isearch_googleStyleDescription($i);
  1104. }
  1105. else
  1106. {
  1107. /* Either meta (1) or meta then google (3) or google then meta (4) */
  1108. /* Process meta description */
  1109. $description = $item->description;
  1110. if ($isearch_config['hide_regexp'] != '')
  1111. {
  1112. $description = ereg_replace($isearch_config['hide_regexp'], '', $description);
  1113. }
  1114. if ($isearch_config['replace_regexp'] != '')
  1115. {
  1116. $description = ereg_replace($isearch_config['replace_regexp'], ' ', $description);
  1117. }
  1118. if ($isearch_config['description_style'] == 3)
  1119. {
  1120. /* Meta then google */
  1121. $description = isearch_truncate($description, floor($isearch_config['max_displayed_description_length'] / 2));
  1122. $description = $description . "<br />\n" . isearch_googleStyleDescription($i);
  1123. }
  1124. else if ($isearch_config['description_style'] == 4)
  1125. {
  1126. /* google then meta */
  1127. $description = isearch_truncate($description, floor($isearch_config['max_displayed_description_length'] / 2));
  1128. $description = isearch_googleStyleDescription($i) . "<br />\n" . $description;
  1129. }
  1130. }
  1131. $description = isearch_truncate($description, $isearch_config['max_displayed_description_length']);
  1132. if ($isearch_config['highlight_results'])
  1133. {
  1134. $description = isearch_highlight($description);
  1135. }
  1136. if ($isearch_config['extra_link_display'] == 1)
  1137. {
  1138. if (($lastIsLink) && (!$isLink))
  1139. {
  1140. /* Seperate links from non-links */
  1141. echo '</div> ';
  1142. }
  1143. else if ((!$lastIsLink) && ($isLink))
  1144. {
  1145. /* Display before first link on page */
  1146. echo '<div class="isearch-link-all">';
  1147. }
  1148. if ($isLink)
  1149. {
  1150. echo '<div class="isearch-link">';
  1151. }
  1152. }
  1153. if ($isearch_config['show_title'])
  1154. {
  1155. $title = isearch_truncate($item->title, $isearch_config['max_displayed_title_length']);
  1156. if ($isearch_config['highlight_results'])
  1157. {
  1158. $title = isearch_highlight($title);
  1159. }
  1160. echo '<a class="isearch-title" href="' . $item->url . '" target="' . $isearch_config['target_frame'] . '">' . $title . '</a>';
  1161. if (($isearch_config['match_score'] == 1) && (($isearch_resultArray[0]['ranking']) > 0))
  1162. {
  1163. /* Show percentage */
  1164. $percent = ceil(($isearch_resultArray[$i]['ranking'] * 100) / $isearch_resultArray[0]['ranking']);
  1165. echo '<span class="isearch-score"> ['.$percent.' %]</span> ';
  1166. }
  1167. else if (($isearch_config['match_score'] == 2) && (($isearch_resultArray[0]['ranking']) > 0))
  1168. {
  1169. /* Show out of ten */
  1170. $outoften = ceil(($isearch_resultArray[$i]['ranking'] * 10) / $isearch_resultArray[0]['ranking']);
  1171. echo '<span class="isearch-score"> ['.$outoften.'/10]</span> ';
  1172. }
  1173. echo "<br />\n";
  1174. }
  1175. if (strlen($description) > 0)
  1176. {
  1177. echo '<span class="isearch-description">' . $description . "</span><br />\n";
  1178. }
  1179. if ($isearch_config['max_displayed_url_length'] > 1)
  1180. {
  1181. if ($isearch_config['display_strip_query'])
  1182. {
  1183. $displayedUrl = ereg_replace('\\?.*$', '', $item->url);
  1184. }
  1185. else
  1186. {
  1187. $displayedUrl = $item->url;
  1188. }
  1189. if (strlen($displayedUrl) > $isearch_config['max_displayed_url_length'])
  1190. {
  1191. $displayedUrl = substr($displayedUrl, 0, ($isearch_config['max_displayed_url_length'] / 2) - 3) . '...' .
  1192. substr($displayedUrl, -($isearch_config['max_displayed_url_length'] / 2));
  1193. }
  1194. echo '<a class="isearch-url" href="' . $item->url . '" target="' . $isearch_config['target_frame'] . '">' . $displayedUrl . '</a>';
  1195. }
  1196. if (($isearch_config['show_size']) && (isset($item->size)))
  1197. {
  1198. echo '<span class="isearch-size">&nbsp;-&nbsp;' . ceil($item->size / 1024) . 'k';
  1199. if (($isearch_config['keep_cache']) && (!$isLink))
  1200. {
  1201. echo '&nbsp;-&nbsp;';
  1202. }
  1203. echo '</span> ';
  1204. }
  1205. if (($isearch_config['keep_cache']) && (!$isLink))
  1206. {
  1207. echo '<a class="isearch-viewcache" href="viewcache.php?url=' . urlencode($item->url) . '">' . $isearch_lang_converted['cached'] . '</a>';
  1208. }
  1209. echo '<br />';
  1210. if (($isearch_config['extra_link_display'] == 1) && ($isLink))
  1211. {
  1212. echo '</div> ';
  1213. }
  1214. echo "<br />\n";
  1215. }
  1216. }
  1217. echo "<br />\n";
  1218. echo $prevNextAfter;
  1219. }
  1220. else
  1221. {
  1222. echo '<h2 class="isearch-nomatch">'.$isearch_lang_converted['nomatch'].'</h2><br /><br />';
  1223. }
  1224. if (! $isearch_config['hide_powered_by'])
  1225. {
  1226. echo '<span style="font-size: 80%">Powered&nbsp;by&nbsp;<a href="http://www.iSearchTheNet.com/isearch" target="_blank">iSearch2</a>&nbsp;from&nbsp;<a href="http://www.z-host.com/" target="_blank">Z-Host</a></span><br />';
  1227. }
  1228. }
  1229. function isearch_getSuggestionsArray()
  1230. {
  1231. global $isearch_searchString;
  1232. global $isearch_suggestions;
  1233. $searchStrings = array();
  1234. if (count($isearch_suggestions) > 0)
  1235. {
  1236. $searchStrings = array();
  1237. foreach ($isearch_suggestions as $suggestion)
  1238. {
  1239. $searchStrings[] = str_replace($suggestion['keyword'], $suggestion['alternative'], $isearch_searchString);
  1240. }
  1241. sort($searchStrings);
  1242. $searchStrings = array_unique($searchStrings);
  1243. }
  1244. return $searchStrings;
  1245. }
  1246. function isearch_getResultCount()
  1247. {
  1248. global $isearch_resultArray;
  1249. return count($isearch_resultArray);
  1250. }
  1251. function isearch_getResultArray($firstResult=1, $lastResult=1000)
  1252. {
  1253. global $isearch_table_urls, $isearch_table_links, $isearch_ro_db;
  1254. global $isearch_resultArray;
  1255. global $isearch_config;
  1256. $resultCount = count($isearch_resultArray);
  1257. if ($lastResult > $resultCount)
  1258. {
  1259. $lastResult = $resultCount;
  1260. }
  1261. if ($firstResult < 0)
  1262. {
  1263. $firstResult = 0;
  1264. }
  1265. $resultArray = array();
  1266. for ($i = $firstResult-1; $i < $lastResult; $i++)
  1267. {
  1268. $id = $isearch_resultArray[$i]['id'];
  1269. if ($id >= ISEARCH_LINKS_ID_BASE)
  1270. {
  1271. $id -= ISEARCH_LINKS_ID_BASE;
  1272. $result = mysql_query("SELECT url, title, description FROM $isearch_table_links WHERE id='$id'", $isearch_ro_db);
  1273. $isLink = True;
  1274. }
  1275. else
  1276. {
  1277. $result = mysql_query("SELECT url, title, description, size FROM $isearch_table_urls WHERE id='$id'", $isearch_ro_db);
  1278. $isLink = False;
  1279. }
  1280. if (!$result)
  1281. {
  1282. echo "<p>MySQL error : " . mysql_error() . ' File: ' . __FILE__ . ', Line:' . __LINE__ . "</p>\n";
  1283. }
  1284. else if ($item = mysql_fetch_object($result))
  1285. {
  1286. /* Use google style results if explicitly set, or if there is no
  1287. * description for this page
  1288. */
  1289. if ($isearch_config['description_style'] == 0)
  1290. {
  1291. $description = '';
  1292. }
  1293. else if ($isLink)
  1294. {
  1295. $description = $item->description;
  1296. }
  1297. else if (($isearch_config['description_style'] == 2) || ($item->description == ''))
  1298. {
  1299. /* Use Google style */
  1300. $description = isearch_googleStyleDescription($i);
  1301. }
  1302. else
  1303. {
  1304. /* Either meta (1) or meta then google (3) or google then meta (4) */
  1305. /* Process meta description */
  1306. $description = $item->description;
  1307. if ($isearch_config['hide_regexp'] != '')
  1308. {
  1309. $description = ereg_replace($isearch_config['hide_regexp'], '', $description);
  1310. }
  1311. if ($isearch_config['replace_regexp'] != '')
  1312. {
  1313. $description = ereg_replace($isearch_config['replace_regexp'], ' ', $description);
  1314. }
  1315. if ($isearch_config['description_style'] == 3)
  1316. {
  1317. /* Meta then google */
  1318. $description = isearch_truncate($description, floor($isearch_config['max_displayed_description_length'] / 2));
  1319. $description = $description . "<br />\n" . isearch_googleStyleD…

Large files files are truncated, but you can click here to view the full file