diff options
Diffstat (limited to 'modules')
-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 |
9 files changed, 129 insertions, 15 deletions
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"; |