diff options
author | Dries Buytaert <dries@buytaert.net> | 2001-06-30 09:50:36 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2001-06-30 09:50:36 +0000 |
commit | e6a67118ebfe21dcc7646676f808d1f4b2fc3a83 (patch) | |
tree | 8da776874e78d6daab8466c0b27be83008462b85 | |
parent | 7c1b20fe49310c9dc36b837e56277f4cc62534fd (diff) | |
download | brdo-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.
-rw-r--r-- | includes/common.inc | 1 | ||||
-rw-r--r-- | modules/access.module | 2 | ||||
-rw-r--r-- | modules/node.module | 2 | ||||
-rw-r--r-- | modules/node/node.module | 2 | ||||
-rw-r--r-- | modules/search.module | 57 | ||||
-rw-r--r-- | modules/search/search.module | 57 | ||||
-rw-r--r-- | modules/statistics.module | 6 | ||||
-rw-r--r-- | modules/statistics/statistics.module | 6 | ||||
-rw-r--r-- | modules/watchdog.module | 6 | ||||
-rw-r--r-- | modules/watchdog/watchdog.module | 6 | ||||
-rw-r--r-- | node.php | 2 | ||||
-rw-r--r-- | search.php | 47 | ||||
-rw-r--r-- | themes/jeroen/jeroen.theme | 2 | ||||
-rw-r--r-- | themes/yaroon/yaroon.theme | 2 |
14 files changed, 132 insertions, 66 deletions
diff --git a/includes/common.inc b/includes/common.inc index 9ef2da44f..a5cbba931 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -210,7 +210,6 @@ function field_merge($a, $b) { function link_page() { $links[] = "<a href=\"index.php\">". t("home") ."</a>"; - $links[] = "<a href=\"search.php\">". t("search") ."</a>"; $links[] = "<a href=\"submit.php\">". t("submit") ."</a>"; $links[] = "<a href=\"account.php\">". t("account") ."</a>"; diff --git a/modules/access.module b/modules/access.module index 9addd0732..e75e4474d 100644 --- a/modules/access.module +++ b/modules/access.module @@ -21,7 +21,7 @@ function access_help() { } function access_perm() { - return array("access administration pages", "access content", "search content", "post content", "administer roles and permissions"); + return array("access administration pages", "administer roles and permissions"); } function access_link($type) { diff --git a/modules/node.module b/modules/node.module index 01642e76e..001e9b351 100644 --- a/modules/node.module +++ b/modules/node.module @@ -27,7 +27,7 @@ function node_help() { } function node_perm() { - return array("administer nodes"); + return array("administer nodes", "access content", "post content"); } function node_conf_options() { diff --git a/modules/node/node.module b/modules/node/node.module index 01642e76e..001e9b351 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -27,7 +27,7 @@ function node_help() { } function node_perm() { - return array("administer nodes"); + return array("administer nodes", "access content", "post content"); } function node_conf_options() { 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 diff --git a/modules/search/search.module b/modules/search/search.module new file mode 100644 index 000000000..7beb1e74c --- /dev/null +++ b/modules/search/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 diff --git a/modules/statistics.module b/modules/statistics.module index 02fc75de1..32a7b9fb6 100644 --- a/modules/statistics.module +++ b/modules/statistics.module @@ -11,11 +11,11 @@ function statistics_cron() { } function statistics_perm() { - return array("access statistics"); + return array("administer statistics"); } function statistics_link($type) { - if ($type == "admin" && user_access("access statistics")) { + if ($type == "admin" && user_access("administer statistics")) { $links[] = "<a href=\"admin.php?mod=statistics\">statistics</a>"; } @@ -57,7 +57,7 @@ function statistics_referer() { function statistics_admin() { global $user; - if (user_access($user, "access statistics")) { + if (user_access($user, "administer statistics")) { print statistics_referer(); } } diff --git a/modules/statistics/statistics.module b/modules/statistics/statistics.module index 02fc75de1..32a7b9fb6 100644 --- a/modules/statistics/statistics.module +++ b/modules/statistics/statistics.module @@ -11,11 +11,11 @@ function statistics_cron() { } function statistics_perm() { - return array("access statistics"); + return array("administer statistics"); } function statistics_link($type) { - if ($type == "admin" && user_access("access statistics")) { + if ($type == "admin" && user_access("administer statistics")) { $links[] = "<a href=\"admin.php?mod=statistics\">statistics</a>"; } @@ -57,7 +57,7 @@ function statistics_referer() { function statistics_admin() { global $user; - if (user_access($user, "access statistics")) { + if (user_access($user, "administer statistics")) { print statistics_referer(); } } diff --git a/modules/watchdog.module b/modules/watchdog.module index fb70530ee..aa7c5553d 100644 --- a/modules/watchdog.module +++ b/modules/watchdog.module @@ -8,11 +8,11 @@ function watchdog_help() { } function watchdog_perm() { - return array("access watchdog"); + return array("administer watchdog"); } function watchdog_link($type) { - if ($type == "admin" && user_access("access watchdog")) { + if ($type == "admin" && user_access("administer watchdog")) { $links[] = "<a href=\"admin.php?mod=watchdog\">watchdog</a>"; } @@ -67,7 +67,7 @@ function watchdog_view($id) { function watchdog_admin() { global $op, $id, $type, $order; - if (user_access("access watchdog")) { + if (user_access("administer watchdog")) { print "<SMALL><A HREF=\"admin.php?mod=watchdog&type=account\">account messages</A> | <A HREF=\"admin.php?mod=watchdog&type=regular\">regular messages</A> | <A HREF=\"admin.php?mod=watchdog&type=special\">special messages</A> | <A HREF=\"admin.php?mod=watchdog&type=warning\">warning messages</A> | <A HREF=\"admin.php?mod=watchdog&type=error\">error messages</A> | <A HREF=\"admin.php?mod=watchdog&type=httpd\">httpd messages</A> | <A HREF=\"admin.php?mod=watchdog\">overview</A> | <A HREF=\"admin.php?mod=watchdog&op=help\">help</A></SMALL><HR>\n"; diff --git a/modules/watchdog/watchdog.module b/modules/watchdog/watchdog.module index fb70530ee..aa7c5553d 100644 --- a/modules/watchdog/watchdog.module +++ b/modules/watchdog/watchdog.module @@ -8,11 +8,11 @@ function watchdog_help() { } function watchdog_perm() { - return array("access watchdog"); + return array("administer watchdog"); } function watchdog_link($type) { - if ($type == "admin" && user_access("access watchdog")) { + if ($type == "admin" && user_access("administer watchdog")) { $links[] = "<a href=\"admin.php?mod=watchdog\">watchdog</a>"; } @@ -67,7 +67,7 @@ function watchdog_view($id) { function watchdog_admin() { global $op, $id, $type, $order; - if (user_access("access watchdog")) { + if (user_access("administer watchdog")) { print "<SMALL><A HREF=\"admin.php?mod=watchdog&type=account\">account messages</A> | <A HREF=\"admin.php?mod=watchdog&type=regular\">regular messages</A> | <A HREF=\"admin.php?mod=watchdog&type=special\">special messages</A> | <A HREF=\"admin.php?mod=watchdog&type=warning\">warning messages</A> | <A HREF=\"admin.php?mod=watchdog&type=error\">error messages</A> | <A HREF=\"admin.php?mod=watchdog&type=httpd\">httpd messages</A> | <A HREF=\"admin.php?mod=watchdog\">overview</A> | <A HREF=\"admin.php?mod=watchdog&op=help\">help</A></SMALL><HR>\n"; @@ -70,7 +70,7 @@ function node_render($node) { function node_failure() { global $theme; $theme->header(); - $theme->box(t("Not found"), t("The node you are looking for does not exist yet or is no longer accessible:") ."<UL><LI><A HREF=\"search.php\">". t("search node") ."</A></LI><LI><A HREF=\"submit.php\">". t("add node") ."</A></LI></UL>\n"); + $theme->box(t("Not found"), t("The node you are looking for does not exist yet or is no longer accessible.") ."\n"); $theme->footer(); } diff --git a/search.php b/search.php deleted file mode 100644 index c0c7f695b..000000000 --- a/search.php +++ /dev/null @@ -1,47 +0,0 @@ -<?php - -include_once "includes/common.inc"; - -page_header(); - -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=\"search.php\" 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(); -} - -page_footer(); - -?>
\ No newline at end of file diff --git a/themes/jeroen/jeroen.theme b/themes/jeroen/jeroen.theme index 739c7b16e..a4d0a30f7 100644 --- a/themes/jeroen/jeroen.theme +++ b/themes/jeroen/jeroen.theme @@ -56,7 +56,7 @@ $this->box("Drop where?", "<td align=\"left\" valign=\"top\"> <a href=\"index.php\">home</a><br /> <a href=\"module.php?mod=book\">handbook</a><br /> - <a href=\"search.php\">search</a> + <a href=\"module.php?mod=search\">search</a> </td> <td align=\"right\" valign=\"top\"> <a href=\"module.php?mod=diary\">diary</a><br /> diff --git a/themes/yaroon/yaroon.theme b/themes/yaroon/yaroon.theme index f0dd622a5..50c7fafb1 100644 --- a/themes/yaroon/yaroon.theme +++ b/themes/yaroon/yaroon.theme @@ -78,7 +78,7 @@ <option value="module.php?mod=book" <?php if (strstr($REQUEST_URI, "mod=book")) { echo "selected"; $true = 1; } ?>>Handbook</option> <option value="module.php?mod=cvs" <?php if (strstr($REQUEST_URI, "mod=cvs")) { echo "selected"; $true = 1; } ?>>CVS</option> <option value="submit.php" <?php if (strstr($PHP_SELF, "submit.php")) { echo "selected"; $true = 1; } ?>>Submit</option> - <option value="search.php" <?php if (strstr($PHP_SELF, "search.php")) { echo "selected"; $true = 1; } ?>>Search</option> + <option value="module.php?mod=search" <?php if (strstr($REQUEST_URI, "mod=search")) { echo "selected"; $true = 1; } ?>>Search</option> <option value="module.php?mod=rating" <?php if (strstr($REQUEST_URI, "mod=rating")) { echo "selected"; $true = 1; } ?>>Rating</option> <?php if ($REQUEST_URI == "/module.php?mod=queue") { $true = 1; echo "<option selected>Moderation</option>"; } if (!$true) { echo "<option selected>"; if($cid) echo "Node $cid"; else if($id) echo "Node $id"; else echo "Other"; echo"</option>"; } ?> |