summaryrefslogtreecommitdiff
path: root/includes/search.inc
blob: f15db5ee63bd5f86409eef8dc662e2b3ee9077d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php

function search_form($keys) {
  global $REQUEST_URI;
  $output .= "<FORM ACTION=\"$REQUEST_URI\" METHOD=\"POST\">\n";
  $output .= " <INPUT SIZE=\"50\" VALUE=\"". check_form($keys) ."\" NAME=\"keys\">";
  $output .= " <INPUT TYPE=\"submit\" VALUE=\"". t("Search") ."\">\n";
  $output .= "</FORM>\n";
  return $output;
}

function search_data($keys, $type) {
  if ($keys && $type && $result = module_invoke($type, "search", check_query($keys))) {
    foreach ($result as $entry) {
      $output .= "<P>\n";
      $output .= " <B><U><A HREF=\"$entry[link]\">$entry[title]</A></U></B><BR>";
      $output .= " <SMALL>$entry[link]". ($entry[user] ? " - ". format_username($entry[user]) : "") ."". ($entry[date] ? " - ". format_date($entry[date], "small") : "") ."</SMALL>";
      $output .= "</P>\n";
    }
  }
  else {
    $output .= t("Your search yielded no results.");
  }

  return $output;
}

?>