';
echo _AT('back_to_contents');
echo '';
if ($_GET['query']) {
$_GET['query'] = str_replace(',', ' ', $_GET['query']);
$_GET['query'] = str_replace('"', '', $_GET['query']);
if (strlen($_GET['query']) > 3) {
$_GET['query'] = strtolower($_GET['query']);
$search_terms = explode(' ', $_GET['query']);
$results = array();
$languageTextDAO = new LanguageTextDAO();
$final_match_rows = array();
foreach ($search_terms as $term)
{
$match_rows = $languageTextDAO->getHelpByMatchingText($addslashes($term), $_SESSION['lang']);
if (is_array($match_rows)) $final_match_rows = array_merge($final_match_rows, $match_rows);
}
if (is_array($final_match_rows))
{
foreach ($final_match_rows as $match)
{
if (is_array($result))
$all_match_terms = array_keys($result);
else
$all_match_terms = array();
if (!in_array($match['term'], $all_match_terms))
{
$count = 0;
$contents = strtolower($match['text']);
foreach ($search_terms as $term)
{
$term = trim($term);
if ($term) {
$count += substr_count($contents, $term);
}
}
if ($count)
{
$results[$match['term']] = $count;
}
}
}
}
// replace term in match array with script name
if ($results)
{
arsort($results);
echo '';
foreach ($results as $term => $count)
{
foreach ($_pages as $this_page => $page_def)
{
if (strcmp($page_def['guide'], $term) == 0)
echo '- '._AT($page_def['title_var']).'
';
}
}
echo '
';
} else {
echo '';
echo _AT('no_results_found');
echo '
';
}
} else {
echo '';
echo _AT('search_term_longer_3_chars');
echo '
';
}
}
?>