summaryrefslogtreecommitdiff
path: root/modules/search.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2001-06-30 09:50:36 +0000
committerDries Buytaert <dries@buytaert.net>2001-06-30 09:50:36 +0000
commite6a67118ebfe21dcc7646676f808d1f4b2fc3a83 (patch)
tree8da776874e78d6daab8466c0b27be83008462b85 /modules/search.module
parent7c1b20fe49310c9dc36b837e56277f4cc62534fd (diff)
downloadbrdo-e6a67118ebfe21dcc7646676f808d1f4b2fc3a83.tar.gz
brdo-e6a67118ebfe21dcc7646676f808d1f4b2fc3a83.tar.bz2
- Made search.php a module, being search.module.
- Updated the permission names to be more consistent. - Small improvement to node.php.
Diffstat (limited to 'modules/search.module')
-rw-r--r--modules/search.module57
1 files changed, 57 insertions, 0 deletions
diff --git a/modules/search.module b/modules/search.module
new file mode 100644
index 000000000..7beb1e74c
--- /dev/null
+++ b/modules/search.module
@@ -0,0 +1,57 @@
+<?php
+
+function search_perm() {
+ return array("search content");
+}
+
+function search_link($type) {
+ if ($type == "page" && user_access("search content")) {
+ $links[] = "<a href=\"module.php?mod=search\">search</a>";
+ }
+
+ return $links ? $links : array();
+}
+
+function search_page() {
+ global $theme, $type, $keys, $REQUEST_URI;
+
+ if (user_access("search content")) {
+ // verify input:
+ $type = check_input($type);
+ $keys = check_input($keys);
+
+ // build options list:
+ foreach (module_list() as $name) {
+ if (module_hook($name, "search")) {
+ $options .= "<option value=\"$name\"". ($name == $type ? " selected" : "") .">$name</option>\n";
+ }
+ }
+
+ // build form:
+ $form .= "<form action=\"$REQUEST_URI\" method=\"POST\">\n";
+ $form .= " <input size=\"50\" value=\"". check_form($keys) ."\" name=\"keys\" TYPE=\"text\">\n";
+ $form .= " <select name=\"type\">$options</select>\n";
+ $form .= " <input type=\"submit\" value=\"". t("Search") ."\">\n";
+ $form .= "</form>\n";
+
+ // visualize form:
+ $theme->header();
+
+ if ($form) {
+ $theme->box(t("Search"), $form);
+ }
+
+ if ($keys) {
+ $theme->box(t("Result"), search_data($keys, $type));
+ }
+
+ $theme->footer();
+ }
+ else {
+ $theme->header();
+ $theme->box("Access denied", message_access());
+ $theme->footer();
+ }
+}
+
+?> \ No newline at end of file