summaryrefslogtreecommitdiff
path: root/includes/search.inc
blob: cf47ebda8d6d56924391fb00ff525b5479f4749b (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
29
30
<?php

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

function search_data($keys, $type) {
  if ($keys && $type) {
    $result = module_execute($type, "find", check_input($keys));
    foreach ($result as $entry) {
      $output .= "<P>\n";
      $output .= " <B><U><A HREF=\"$entry[link]\">$entry[title]</A></U></B><BR>";
      $output .= " <SMALL>$site_url$entry[link]". ($entry[user] ? " - ". format_username($entry[user]) : "") ."". ($entry[date] ? " - ". format_date($entry[date], "small") : "") ."</SMALL>";
      $output .= "</P>\n";
    }
  }

  if (!$output) {
    $output .= t("Your search yielded no results.");
  }

  return $output;
}

?>