Commit e6a67118 authored by Dries's avatar Dries

- Made search.php a module, being search.module.

- Updated the permission names to be more consistent.

- Small improvement to node.php.
parent 7c1b20fe
......@@ -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>";
......
......@@ -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) {
......
......@@ -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() {
......
......@@ -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() {
......
<?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
<?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
......@@ -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();
}
}
......
......@@ -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();
}
}
......
......@@ -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";
......
......@@ -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();
}
......
<?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
......@@ -56,7 +56,7 @@ function header() {
$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 />
......
......@@ -78,7 +78,7 @@ function do_nav() {
<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>"; } ?>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment