summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2001-06-29 22:08:57 +0000
committerDries Buytaert <dries@buytaert.net>2001-06-29 22:08:57 +0000
commit9c43e8fc7a192dfe768c76a539373915bddaa0aa (patch)
tree32dfe7f04171c2600be4164ca529d7f42766ec32
parent124694ee4dbcc1df5dfc2d419ed2393619883071 (diff)
downloadbrdo-9c43e8fc7a192dfe768c76a539373915bddaa0aa.tar.gz
brdo-9c43e8fc7a192dfe768c76a539373915bddaa0aa.tar.bz2
Extremely large commit:
- Fixed tiny quote problem in account.php. - Fixed tiny bug in comment.inc. - Fixed tiny bug in comment.module. - Fixed tiny bug in meta.module. - Simplified user_access() API. - Rewrote link system: still needs fine-tuning and testing so don't upgrade if you are running a production site. ;) Updated all modules and themes to reflect this change. All other themes and modules need updating too!
-rw-r--r--account.php2
-rw-r--r--admin.php15
-rw-r--r--includes/comment.inc16
-rw-r--r--includes/common.inc27
-rw-r--r--includes/module.inc2
-rw-r--r--includes/node.inc11
-rw-r--r--includes/theme.inc57
-rw-r--r--includes/user.inc10
-rw-r--r--index.php2
-rw-r--r--modules/access.module14
-rw-r--r--modules/account.module17
-rw-r--r--modules/aggregator.module14
-rw-r--r--modules/aggregator/aggregator.module14
-rw-r--r--modules/block.module14
-rw-r--r--modules/block/block.module14
-rw-r--r--modules/book.module33
-rw-r--r--modules/book/book.module33
-rw-r--r--modules/box.module14
-rw-r--r--modules/comment.module16
-rw-r--r--modules/comment/comment.module16
-rw-r--r--modules/cvs.module16
-rw-r--r--modules/diary.module29
-rw-r--r--modules/forum.module13
-rw-r--r--modules/forum/forum.module13
-rw-r--r--modules/help.module8
-rw-r--r--modules/help/help.module8
-rw-r--r--modules/import.module14
-rw-r--r--modules/locale.module14
-rw-r--r--modules/locale/locale.module14
-rw-r--r--modules/meta.module17
-rw-r--r--modules/moderate.module12
-rw-r--r--modules/node.module37
-rw-r--r--modules/node/node.module37
-rw-r--r--modules/poll.module13
-rw-r--r--modules/poll/poll.module13
-rw-r--r--modules/queue.module20
-rw-r--r--modules/rating.module12
-rw-r--r--modules/statistics.module8
-rw-r--r--modules/statistics/statistics.module8
-rw-r--r--modules/story.module4
-rw-r--r--modules/story/story.module4
-rw-r--r--modules/system.module14
-rw-r--r--modules/system/system.module14
-rw-r--r--modules/watchdog.module12
-rw-r--r--modules/watchdog/watchdog.module12
-rw-r--r--node.php4
-rw-r--r--search.php2
-rw-r--r--submit.php2
-rw-r--r--themes/example/example.theme8
-rw-r--r--themes/goofy/goofy.theme6
-rw-r--r--themes/jeroen/jeroen.theme8
-rw-r--r--themes/marvin/marvin.theme12
-rw-r--r--themes/unconed/unconed.theme10
-rw-r--r--themes/yaroon/yaroon.theme6
54 files changed, 502 insertions, 263 deletions
diff --git a/account.php b/account.php
index ff9bf3dd3..a3b0d0899 100644
--- a/account.php
+++ b/account.php
@@ -152,7 +152,7 @@ function account_content_edit() {
// construct form:
$result = db_query("SELECT * FROM blocks WHERE status = 1 ORDER BY module");
while ($block = db_fetch_object($result)) {
- $entry = db_fetch_object(db_query("SELECT * FROM layout WHERE block = '$block->name' AND user = '$user->id'"));
+ $entry = db_fetch_object(db_query("SELECT * FROM layout WHERE block = '". check_input($block->name) ."' AND user = '$user->id'"));
$options .= "<INPUT TYPE=\"checkbox\" NAME=\"edit[$block->name]\"". ($entry->user ? " CHECKED" : "") ."> ". t($block->name) ."<BR>\n";
}
diff --git a/admin.php b/admin.php
index ffc4cdfcc..830f86662 100644
--- a/admin.php
+++ b/admin.php
@@ -7,13 +7,7 @@ function status($message) {
}
function admin_page($mod) {
- global $menu, $user;
-
- function module($name) {
- global $menu, $user;
- if (module_hook($name, "admin")) $output .= "<A HREF=\"admin.php?mod=$name\">$name</A> | ";
- $menu .= $output;
- }
+ global $user;
?>
<html>
@@ -31,10 +25,11 @@ function admin_page($mod) {
<body bgcolor="#FFFFFF" link="#005599" vlink="#004499" alink="#FF0000">
<h1>Administration</h1>
<?php
+
+ $links[] = "<a href=\index.php\">home</a>";
foreach (module_list() as $name) {
- if (module_hook($name, "admin")) $links[] = "<a href=\"admin.php?mod=$name\">$name</a>";
+ if (module_hook($name, "link")) $links = array_merge($links, module_invoke($name, "link", "admin"));
}
- $links[] = "<a href=\"index.php\">home</a>";
print implode(" | ", $links) ."<hr />";
@@ -45,7 +40,7 @@ function admin_page($mod) {
<?php
}
-if (user_access($user, "access administration pages")) {
+if (user_access("access administration pages")) {
user_rehash();
admin_page($mod);
}
diff --git a/includes/comment.inc b/includes/comment.inc
index 9bbc0c259..dc5bbd48a 100644
--- a/includes/comment.inc
+++ b/includes/comment.inc
@@ -87,7 +87,7 @@ function comment_reply($pid, $id) {
$pid = 0;
}
- if (user_access($user, "post comments")) {
+ if (user_access("post comments")) {
$theme->box(t("Reply"), comment_form(array(pid=>$pid, id=>$id)));
}
else {
@@ -107,7 +107,7 @@ function comment_preview($edit) {
function comment_post($edit) {
global $theme, $user;
- if (user_access($user, "post comments")) {
+ if (user_access("post comments")) {
// check comment submission rate:
throttle("post comment", variable_get(max_comment_rate, 60));
@@ -213,7 +213,7 @@ function comment_uri($args = 0) {
else return ($mod) ? "module.php?mod=$mod" : "node.php";
}
-function comment_link($comment, $return = 1) {
+function comment_links($comment, $return = 1) {
global $theme;
if ($return) return "<A HREF=\"". comment_uri("id=$comment->lid#$comment->cid") ."\"><FONT COLOR=\"$theme->type\">". t("return") ."</FONT></A> | <A HREF=\"". comment_uri("op=reply&id=$comment->lid&pid=$comment->cid") ."\"><FONT COLOR=\"$theme->type\">". t("reply to this comment") ."</FONT></A>";
else return "<A HREF=\"". comment_uri("op=reply&id=$comment->lid&pid=$comment->cid") ."\"><FONT COLOR=\"$theme->type\">". t("reply to this comment") ."</FONT></A>";
@@ -250,7 +250,7 @@ function comment_thread_max($cid, $mode, $threshold, $level = 0, $dummy = 0) {
while ($comment = db_fetch_object($result)) {
print "<UL>";
- comment_view($comment, (comment_visible($comment, $threshold) ? comment_link($comment, 0) : 0));
+ comment_view($comment, (comment_visible($comment, $threshold) ? comment_links($comment, 0) : 0));
comment_thread_max($comment->cid, $mode, $threshold, $level + 1, $dummy + 1);
print "</UL>";
}
@@ -259,7 +259,7 @@ function comment_thread_max($cid, $mode, $threshold, $level = 0, $dummy = 0) {
function comment_render($lid, $cid) {
global $user, $theme, $REQUEST_URI;
- if (user_access($user, "view comments")) {
+ if (user_access("access comments")) {
// Pre-process variables:
$lid = empty($lid) ? 0 : $lid;
@@ -279,7 +279,7 @@ function comment_render($lid, $cid) {
if ($cid > 0) {
$result = db_query("SELECT c.*, u.* FROM comments c LEFT JOIN users u ON c.author = u.id WHERE cid = '$cid'");
if ($comment = db_fetch_object($result)) {
- comment_view($comment, comment_link($comment));
+ comment_view($comment, comment_links($comment));
}
}
else {
@@ -297,7 +297,7 @@ function comment_render($lid, $cid) {
else if ($mode == 2) {
$result = comment_query($lid, $order);
while ($comment = db_fetch_object($result)) {
- comment_view($comment, (comment_visible($comment, $threshold) ? comment_link($comment, 0) : 0));
+ comment_view($comment, (comment_visible($comment, $threshold) ? comment_links($comment, 0) : 0));
}
}
else if ($mode == 3) {
@@ -310,7 +310,7 @@ function comment_render($lid, $cid) {
else {
$result = comment_query($lid, $order, 0);
while ($comment = db_fetch_object($result)) {
- comment_view($comment, (comment_visible($comment, $threshold) ? comment_link($comment, 0) : 0));
+ comment_view($comment, (comment_visible($comment, $threshold) ? comment_links($comment, 0) : 0));
comment_thread_max($comment->cid, $mode, $threshold, $level + 1);
}
}
diff --git a/includes/common.inc b/includes/common.inc
index a5b82357c..9ef2da44f 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -24,8 +24,7 @@ function watchdog($type, $message) {
}
function throttle($type, $rate) {
- global $user;
- if (!user_access($user, "access administration pages")) {
+ if (!user_access("access administration pages")) {
if ($throttle = db_fetch_object(db_query("SELECT * FROM watchdog WHERE type = '$type' AND hostname = '". getenv("REMOTE_ADDR") ."' AND ". time() ." - timestamp < $rate"))) {
watchdog("warning", "throttle: '". getenv("REMOTE_ADDR") ."' exceeded submission rate - $throttle->type");
die(message_throttle());
@@ -135,8 +134,7 @@ function format_date($timestamp, $type = "medium", $format = "") {
}
function format_username($username) {
- global $user;
- if ($username) return (user_access($user, "add and edit user accounts") ? "<A HREF=\"admin.php?mod=account&op=view&name=". urlencode($username) ."\">$username</A>" : "<A HREF=\"account.php?op=view&name=". urlencode($username) ."\">$username</A>");
+ if ($username) return (user_access("administer accounts") ? "<A HREF=\"admin.php?mod=account&op=view&name=". urlencode($username) ."\">$username</A>" : "<A HREF=\"account.php?op=view&name=". urlencode($username) ."\">$username</A>");
else return variable_get(anonymous, "Anonymous");
}
@@ -209,6 +207,27 @@ function field_merge($a, $b) {
return $a;
}
+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>";
+
+ foreach (module_list() as $name) {
+ if (module_hook($name, "link")) {
+ $links = array_merge($links, module_invoke($name, "link", "page"));
+ }
+ }
+
+
+ return $links;
+}
+
+function link_node($node) {
+ return module_invoke("node", "link", array("node", $node));
+}
+
function timer_start() {
global $timer;
$timer = explode(" ", microtime());
diff --git a/includes/module.inc b/includes/module.inc
index 2843e5547..cbbb1b18d 100644
--- a/includes/module.inc
+++ b/includes/module.inc
@@ -11,7 +11,7 @@ function module_iterate($function, $argument = "") {
}
// invoke hook $hook of module $name with optional arguments:
-function module_invoke($name, $hook, $argument = "") {
+function module_invoke($name, $hook, $argument = 0) {
$function = $name ."_". $hook;
return function_exists($function) ? $function($argument) : $argument;
}
diff --git a/includes/node.inc b/includes/node.inc
index affb44371..47a317547 100644
--- a/includes/node.inc
+++ b/includes/node.inc
@@ -236,20 +236,11 @@ function node_index($node) {
function node_visible($node) {
global $user, $status;
- return ($node->status == $status[posted]) || ($node->status == $status[queued] && $user->id) || user_access($user, $node->type) || user_access($user, "add and edit nodes");
+ return ($node->status == $status[posted]) || ($node->status == $status[queued] && $user->id) || user_access("administer nodes");
}
function node_access($account, $node) {
return strstr($node->moderate, $account->userid);
}
-function node_links(&$links, &$node, $main = 0) {
- if ($main) {
- if ($node->body) $_links[] = array("node.php?id=$node->nid", t("read more"));
- if ($node->comment) $_links[] = array("node.php?id=$node->nid", format_plural(node_get_comments($node->nid), "comment", "comments"));
- }
- $links = ($links ? array_merge($_links, $links) : $_links);
- return count($links) ? $links : 0;
-}
-
?> \ No newline at end of file
diff --git a/includes/theme.inc b/includes/theme.inc
index b01638d60..9530c60b1 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -1,16 +1,8 @@
<?php
class BaseTheme {
- function links(&$links, $state = 0) {
- // $state = 0 : default behaviour
- // $state = 1 : main page
- // $state = 2 : theme_link()
- // Subject to change coz its messy
- foreach ($links as $link) {
- if ($link[0]) $_links[] = count($link) == 2 ? "<A HREF=\"$link[0]\"><FONT COLOR=\"$theme->link\">". t($link[1]) ."</FONT></A>" : t($link[0]);
- }
-
- return ($_links ? implode(" | ", $_links) : "");
+ function links($links, $delimiter = " | ") {
+ return implode($delimiter, $links);
}
}
@@ -26,21 +18,6 @@ function theme_init() {
return new Theme();
}
-function theme_link() {
- global $user, $theme;
- $links[] = array("index.php", t("home"));
- $links[] = array("search.php", t("search"));
- $links[] = array("submit.php", t("submit"));
- $links[] = array("account.php", t("account"));
-
- foreach (module_list() as $name) {
- if (module_hook($name, "page")) $links[] = array("module.php?mod=$name", t($name));
- }
-
- return $theme->links($links, 2);
-}
-
-
function theme_account($theme) {
global $user;
@@ -55,13 +32,14 @@ function theme_account($theme) {
$content .= "<A HREF=\"account.php?op=edit&topic=content\">". t("edit your content") ."</A><BR>\n";
$content .= "<P>\n";
- if (user_access($user, "access administration pages")) {
+ if (user_access("access administration pages")) {
$content .= "<A HREF=\"admin.php\">". strtr(t("administer %a"), array("%a" => variable_get("site_name", "drupal"))) ."</A><BR>\n";
$content .= "<P>\n";
}
foreach (module_list() as $name) {
- if ($links = module_invoke($name, "menu")) {
+ if (module_hook($name, "link")) {
+ $links = module_invoke($name, "link", "menu");
foreach ($links as $link) $content .= "$link<BR>\n";
}
}
@@ -119,29 +97,4 @@ function theme_moderation_results($theme, $node) {
$theme->box(t("Moderation results"), ($output ? $output : t("This node has not been moderated yet.")));
}
-/*
-//
-// depricated -> new block strategy
-//
-function theme_new_headlines($theme, $num = 10) {
- $result = db_query("SELECT nid, title FROM node WHERE status = 2 AND type = 'story' ORDER BY nid DESC LIMIT $num");
- while ($node = db_fetch_object($result)) $content .= "<LI><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></LI>\n";
- $theme->box(t("Latest headlines"), $content);
-}
-
-function theme_old_headlines($theme, $num = 10) {
- global $user;
-
- $result = db_query("SELECT id, subject, timestamp FROM story WHERE status = 2 ORDER BY timestamp DESC LIMIT ". ($user->nodes ? $user->nodes : $num) .", $num");
- while ($node = db_fetch_object($result)) {
- if ($time != date("F jS", $node->timestamp)) {
- $content .= "<P><B>". date("l, M jS", $node->timestamp) ."</B></P>\n";
- $time = date("F jS", $node->timestamp);
- }
- $content .= "<LI><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></LI>\n";
- }
- $theme->box(t("Older headlines"), $content);
-}
-*/
-
?>
diff --git a/includes/user.inc b/includes/user.inc
index 5e0bf2274..9e1370f6b 100644
--- a/includes/user.inc
+++ b/includes/user.inc
@@ -52,12 +52,14 @@ function user_save($account, $array) {
return user_load(($account->userid ? $account->userid : $array[userid]));
}
-function user_access($account, $perm) {
- if ($account->id == 1) {
+function user_access($perm) {
+ global $user;
+
+ if ($user->id == 1) {
return 1;
}
- else if ($account->perm) {
- return strstr($account->perm, $perm);
+ else if ($user->perm) {
+ return strstr($user->perm, $perm);
}
else {
return db_fetch_object(db_query("SELECT * FROM role WHERE name = 'anonymous user' AND perm LIKE '%$perm%'"));
diff --git a/index.php b/index.php
index 980756098..25f02b1e7 100644
--- a/index.php
+++ b/index.php
@@ -7,7 +7,7 @@ page_header();
$theme->header();
-if (user_access($user, "view content")) {
+if (user_access("view content")) {
$result = db_query("SELECT nid, type FROM node WHERE ". ($meta ? "attributes LIKE '%". check_input($meta) ."%' AND " : "") ." promote = '1' AND status = '". node_status("posted") ."' AND timestamp <= '". ($date > 0 ? check_input($date) : time()) ."' ORDER BY timestamp DESC LIMIT ". ($user->nodes ? $user->nodes : variable_get(default_nodes_main, 10)));
while ($node = db_fetch_object($result)) {
node_view(node_get_object(array("nid" => $node->nid, "type" => $node->type)), 1);
diff --git a/modules/access.module b/modules/access.module
index 7126d4584..9addd0732 100644
--- a/modules/access.module
+++ b/modules/access.module
@@ -21,7 +21,15 @@ function access_help() {
}
function access_perm() {
- return array("access administration pages", "view content", "search content", "post content", "edit roles and permissions");
+ return array("access administration pages", "access content", "search content", "post content", "administer roles and permissions");
+}
+
+function access_link($type) {
+ if ($type == "admin" && user_access("administer roles and permissions")) {
+ $links[] = "<a href=\"admin.php?mod=access\">roles and permissions</a>";
+ }
+
+ return $links ? $links : array();
}
function access_get_role($rid) {
@@ -125,9 +133,9 @@ function access_init() {
}
function access_admin() {
- global $user, $edit, $op, $id;
+ global $edit, $op, $id;
- if (user_access($user, "edit roles and permissions")) {
+ if (user_access("administer roles and permissions")) {
print "<SMALL><A HREF=\"admin.php?mod=access&op=add\">add new role</A> | <A HREF=\"admin.php?mod=access&op=role\">role overview</A> | <A HREF=\"admin.php?mod=access&op=perm\">permission overview</A> | <A HREF=\"admin.php?mod=access&op=help\">help</A></SMALL><HR>\n";
diff --git a/modules/account.module b/modules/account.module
index db464623f..117c71433 100644
--- a/modules/account.module
+++ b/modules/account.module
@@ -33,7 +33,15 @@ function account_help() {
}
function account_perm() {
- return array("add and edit user accounts");
+ return array("administer users");
+}
+
+function account_link($type) {
+ if ($type == "admin" && user_access("administer users")) {
+ $links[] = "<a href=\"admin.php?mod=account\">user accounts</a>";
+ }
+
+ return $links ? $links : array();
}
function account_conf_options() {
@@ -42,10 +50,9 @@ function account_conf_options() {
}
function account_search($keys) {
- global $user;
$result = db_query("SELECT * FROM users WHERE userid LIKE '%$keys%' LIMIT 20");
while ($account = db_fetch_object($result)) {
- $find[$i++] = array("title" => $account->userid, "link" => (user_access($user, "add and edit user accounts") ? "admin.php?mod=account&op=view&name=". urlencode($account->userid) : "account.php?op=view&name=". urlencode($account->userid)), "user" => $account->userid);
+ $find[$i++] = array("title" => $account->userid, "link" => (user_access("administer users") ? "admin.php?mod=account&op=view&name=". urlencode($account->userid) : "account.php?op=view&name=". urlencode($account->userid)), "user" => $account->userid);
}
return $find;
}
@@ -248,9 +255,9 @@ function account_query($type = "") {
}
function account_admin() {
- global $user, $op, $edit, $id, $mod, $keys, $order, $name, $query;
+ global $op, $edit, $id, $mod, $keys, $order, $name, $query;
- if (user_access($user, "add and edit user accounts")) {
+ if (user_access("administer users")) {
print "<SMALL><A HREF=\"admin.php?mod=account&op=access\">access control</A> | <A HREF=\"admin.php?mod=account&op=add\">add new account</A> | <A HREF=\"admin.php?mod=account&op=listing\">account listings</A> | <A HREF=\"admin.php?mod=account&op=search\">search account</A> | <A HREF=\"admin.php?mod=account\">overview</A> | <A HREF=\"admin.php?mod=account&op=help\">help</A></SMALL><HR>";
$query = $query ? $query : 0;
diff --git a/modules/aggregator.module b/modules/aggregator.module
index 447090738..44f0b480a 100644
--- a/modules/aggregator.module
+++ b/modules/aggregator.module
@@ -12,7 +12,15 @@ function import_help() {
}
function import_perm() {
- return array("add and edit news feeds");
+ return array("administer news feeds");
+}
+
+function import_link($type) {
+ if ($type == "admin") {
+ $links[] = "<a href=\"admin.php?mod=import\">news feeds</a>";
+ }
+
+ return $links ? $links : array();
}
function import_cron() {
@@ -241,9 +249,9 @@ function import_view_item() {
}
function import_admin() {
- global $user, $op, $id, $type, $edit;
+ global $op, $id, $type, $edit;
- if (user_access($user, "add and edit news feeds")) {
+ if (user_access("administer news feeds")) {
print "<SMALL><A HREF=\"admin.php?mod=import&type=bundle&op=add\">add new bundle</A> | <A HREF=\"admin.php?mod=import&type=feed&op=add\">add new feed</A> | <A HREF=\"admin.php?mod=import&type=bundle&op=view\">available bundles</A> | <A HREF=\"admin.php?mod=import&type=item&op=view\">available items</A> | <A HREF=\"admin.php?mod=import&op=view\">overview</A> | <A HREF=\"admin.php?mod=import&op=help\">help</A></SMALL><HR>";
diff --git a/modules/aggregator/aggregator.module b/modules/aggregator/aggregator.module
index 447090738..44f0b480a 100644
--- a/modules/aggregator/aggregator.module
+++ b/modules/aggregator/aggregator.module
@@ -12,7 +12,15 @@ function import_help() {
}
function import_perm() {
- return array("add and edit news feeds");
+ return array("administer news feeds");
+}
+
+function import_link($type) {
+ if ($type == "admin") {
+ $links[] = "<a href=\"admin.php?mod=import\">news feeds</a>";
+ }
+
+ return $links ? $links : array();
}
function import_cron() {
@@ -241,9 +249,9 @@ function import_view_item() {
}
function import_admin() {
- global $user, $op, $id, $type, $edit;
+ global $op, $id, $type, $edit;
- if (user_access($user, "add and edit news feeds")) {
+ if (user_access("administer news feeds")) {
print "<SMALL><A HREF=\"admin.php?mod=import&type=bundle&op=add\">add new bundle</A> | <A HREF=\"admin.php?mod=import&type=feed&op=add\">add new feed</A> | <A HREF=\"admin.php?mod=import&type=bundle&op=view\">available bundles</A> | <A HREF=\"admin.php?mod=import&type=item&op=view\">available items</A> | <A HREF=\"admin.php?mod=import&op=view\">overview</A> | <A HREF=\"admin.php?mod=import&op=help\">help</A></SMALL><HR>";
diff --git a/modules/block.module b/modules/block.module
index 07b078dd7..97139035f 100644
--- a/modules/block.module
+++ b/modules/block.module
@@ -10,7 +10,15 @@ function block_help() {
}
function block_perm() {
- return array("add and edit blocks");
+ return array("administer blocks");
+}
+
+function block_link($type) {
+ if ($type == "admin" && user_access("adminsiter blocks")) {
+ $links[] = "<a href=\"admin.php?mod=block\">blocks</a>";
+ }
+
+ return $links ? $links : array();
}
function block_admin_save($edit) {
@@ -114,9 +122,9 @@ function block_init() {
}
function block_admin() {
- global $user, $op, $edit;
+ global $op, $edit;
- if (user_access($user, "add and edit blocks")) {
+ if (user_access("administer blocks")) {
print "<SMALL><A HREF=\"admin.php?mod=block\">configure</A> | <A HREF=\"admin.php?mod=block&op=preview\">preview</A> | <A HREF=\"admin.php?mod=block&op=help\">help</A></SMALL><HR>\n";
diff --git a/modules/block/block.module b/modules/block/block.module
index 07b078dd7..97139035f 100644
--- a/modules/block/block.module
+++ b/modules/block/block.module
@@ -10,7 +10,15 @@ function block_help() {
}
function block_perm() {
- return array("add and edit blocks");
+ return array("administer blocks");
+}
+
+function block_link($type) {
+ if ($type == "admin" && user_access("adminsiter blocks")) {
+ $links[] = "<a href=\"admin.php?mod=block\">blocks</a>";
+ }
+
+ return $links ? $links : array();
}
function block_admin_save($edit) {
@@ -114,9 +122,9 @@ function block_init() {
}
function block_admin() {
- global $user, $op, $edit;
+ global $op, $edit;
- if (user_access($user, "add and edit blocks")) {
+ if (user_access("administer blocks")) {
print "<SMALL><A HREF=\"admin.php?mod=block\">configure</A> | <A HREF=\"admin.php?mod=block&op=preview\">preview</A> | <A HREF=\"admin.php?mod=block&op=help\">help</A></SMALL><HR>\n";
diff --git a/modules/book.module b/modules/book.module
index 0365e9833..b8d3f9c81 100644
--- a/modules/book.module
+++ b/modules/book.module
@@ -10,7 +10,19 @@ class Book {
}
function book_perm() {
- return array("edit book");
+ return array("administer book");
+}
+
+function book_link($type) {
+ if ($type == "admin" && user_access("administer book")) {
+ $links[] = "<a href=\"admin.php?mod=book\">". t("collaborative book") ."</a>";
+ }
+
+ if ($type == "page" && user_access("access content")) {
+ $links[] = "<a href=\"module.php?mod=book\">". t("collaborative book") ."</a>";
+ }
+
+ return $links ? $links : array();
}
function book_status() {
@@ -70,10 +82,10 @@ function book_view($node, $main = 0) {
}
function book_search($keys) {
- global $status, $user;
+ global $status;
$result = db_query("SELECT n.*, u.userid FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid LEFT JOIN users u ON n.author = u.id WHERE n.type = 'book' AND n.status = '$status[posted]' AND (n.title LIKE '%". check_input($keys) ."%' OR b.body LIKE '%". check_input($keys) ."%') ORDER BY n.timestamp DESC LIMIT 20");
while ($node = db_fetch_object($result)) {
- $find[$i++] = array("title" => check_output($node->title), "link" => (user_access($user, "add and edit nodes") ? "admin.php?mod=node&type=book&op=edit&id=$node->nid" : "node.php?id=$node->nid"), "user" => $node->userid, "date" => $node->timestamp);
+ $find[$i++] = array("title" => check_output($node->title), "link" => (user_access("administer nodes") ? "admin.php?mod=node&type=book&op=edit&id=$node->nid" : "node.php?id=$node->nid"), "user" => $node->userid, "date" => $node->timestamp);
}
return $find;
}
@@ -90,13 +102,13 @@ function book_parent_query($parent) {
}
function book_toc($parent = "", $indent = "", $toc = array()) {
- global $status, $user;
+ global $status;
// select all child nodes:
$result = db_query("SELECT n.*, b.* FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid WHERE n.type = 'book' AND n.status = '$status[posted]' AND ". book_parent_query($parent) ." ORDER BY b.weight");
// add root node:
- if (user_access($user, "add and edit nodes")) {
+ if (user_access("administer nodes")) {
$toc[0] = "<root>";
}
@@ -125,7 +137,7 @@ function book_form($edit = array()) {
$form .= form_textarea(t("Content"), "body", $edit[body], 70, 20, t("Allowed HTML tags") .": ". htmlspecialchars(variable_get("allowed_html", "")));
$form .= form_textarea(t("Log message"), "log", $edit[log], 70, 5, t("An explanation of the additions or updates being made to help the group understand your motivations."));
- if (user_access($user, "add and edit nodes")) {
+ if (user_access("administer nodes")) {
$form .= form_select(t("Weight"), "weight", $edit[weight], array(0, 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), t("The heavier nodes will sink and the lighter nodes will be positioned nearer the top."));
}
@@ -155,7 +167,7 @@ function book_save($edit) {
if (!$edit[nid]) {
node_save($edit, array(author => $user->id, body, comment => variable_get("book_comment", 0), log, moderate => variable_get("book_moderate", ""), parent, pid, promote => variable_get("book_promote", 0), score => 0, status => variable_get("book_status", $status[queued]), timestamp => time(), title, type => "book", votes => 0, weight));
}
- else if (user_access($user, "add and edit nodes")) {
+ else if (user_access("administer nodes")) {
node_save($edit, array(body, log, parent, title, type => "book", weight));
}
}
@@ -207,8 +219,7 @@ function book_tree($parent = "", $depth = 0) {
}
function book_admin() {
- global $user;
- if (user_access($user, "edit book")) {
+ if (user_access("administer book")) {
print book_tree();
}
else {
@@ -217,9 +228,9 @@ function book_admin() {
}
function book_page() {
- global $user, $status, $theme;
+ global $status, $theme;
- if (user_access($user, "view content")) {
+ if (user_access("access content")) {
$result = db_query("SELECT n.*, b.* FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid WHERE b.parent = 0 AND n.status = $status[posted] ORDER BY b.weight");
while ($node = db_fetch_object($result)) {
diff --git a/modules/book/book.module b/modules/book/book.module
index 0365e9833..b8d3f9c81 100644
--- a/modules/book/book.module
+++ b/modules/book/book.module
@@ -10,7 +10,19 @@ class Book {
}
function book_perm() {
- return array("edit book");
+ return array("administer book");
+}
+
+function book_link($type) {
+ if ($type == "admin" && user_access("administer book")) {
+ $links[] = "<a href=\"admin.php?mod=book\">". t("collaborative book") ."</a>";
+ }
+
+ if ($type == "page" && user_access("access content")) {
+ $links[] = "<a href=\"module.php?mod=book\">". t("collaborative book") ."</a>";
+ }
+
+ return $links ? $links : array();
}
function book_status() {
@@ -70,10 +82,10 @@ function book_view($node, $main = 0) {
}
function book_search($keys) {
- global $status, $user;
+ global $status;
$result = db_query("SELECT n.*, u.userid FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid LEFT JOIN users u ON n.author = u.id WHERE n.type = 'book' AND n.status = '$status[posted]' AND (n.title LIKE '%". check_input($keys) ."%' OR b.body LIKE '%". check_input($keys) ."%') ORDER BY n.timestamp DESC LIMIT 20");
while ($node = db_fetch_object($result)) {
- $find[$i++] = array("title" => check_output($node->title), "link" => (user_access($user, "add and edit nodes") ? "admin.php?mod=node&type=book&op=edit&id=$node->nid" : "node.php?id=$node->nid"), "user" => $node->userid, "date" => $node->timestamp);
+ $find[$i++] = array("title" => check_output($node->title), "link" => (user_access("administer nodes") ? "admin.php?mod=node&type=book&op=edit&id=$node->nid" : "node.php?id=$node->nid"), "user" => $node->userid, "date" => $node->timestamp);
}
return $find;
}
@@ -90,13 +102,13 @@ function book_parent_query($parent) {
}
function book_toc($parent = "", $indent = "", $toc = array()) {
- global $status, $user;
+ global $status;
// select all child nodes:
$result = db_query("SELECT n.*, b.* FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid WHERE n.type = 'book' AND n.status = '$status[posted]' AND ". book_parent_query($parent) ." ORDER BY b.weight");
// add root node:
- if (user_access($user, "add and edit nodes")) {
+ if (user_access("administer nodes")) {
$toc[0] = "<root>";
}
@@ -125,7 +137,7 @@ function book_form($edit = array()) {
$form .= form_textarea(t("Content"), "body", $edit[body], 70, 20, t("Allowed HTML tags") .": ". htmlspecialchars(variable_get("allowed_html", "")));
$form .= form_textarea(t("Log message"), "log", $edit[log], 70, 5, t("An explanation of the additions or updates being made to help the group understand your motivations."));
- if (user_access($user, "add and edit nodes")) {
+ if (user_access("administer nodes")) {
$form .= form_select(t("Weight"), "weight", $edit[weight], array(0, 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), t("The heavier nodes will sink and the lighter nodes will be positioned nearer the top."));
}
@@ -155,7 +167,7 @@ function book_save($edit) {
if (!$edit[nid]) {
node_save($edit, array(author => $user->id, body, comment => variable_get("book_comment", 0), log, moderate => variable_get("book_moderate", ""), parent, pid, promote => variable_get("book_promote", 0), score => 0, status => variable_get("book_status", $status[queued]), timestamp => time(), title, type => "book", votes => 0, weight));
}
- else if (user_access($user, "add and edit nodes")) {
+ else if (user_access("administer nodes")) {
node_save($edit, array(body, log, parent, title, type => "book", weight));
}
}
@@ -207,8 +219,7 @@ function book_tree($parent = "", $depth = 0) {
}
function book_admin() {
- global $user;
- if (user_access($user, "edit book")) {
+ if (user_access("administer book")) {
print book_tree();
}
else {
@@ -217,9 +228,9 @@ function book_admin() {
}
function book_page() {
- global $user, $status, $theme;
+ global $status, $theme;
- if (user_access($user, "view content")) {
+ if (user_access("access content")) {
$result = db_query("SELECT n.*, b.* FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid WHERE b.parent = 0 AND n.status = $status[posted] ORDER BY b.weight");
while ($node = db_fetch_object($result)) {
diff --git a/modules/box.module b/modules/box.module
index c8e4330e2..8bac56138 100644
--- a/modules/box.module
+++ b/modules/box.module
@@ -30,7 +30,15 @@ function box_help() {
}
function box_perm() {
- return array("add and edit boxes");
+ return array("administer boxes");
+}
+
+function box_link($type) {
+ if ($type == "admin" && user_access("administer boxes")) {
+ $links[] = "<a href=\"admin.php?mod=box\">boxes</a>";
+ }
+
+ return $links ? $links : array();
}
function box_block() {
@@ -142,9 +150,9 @@ function box_admin_save($id, $subject, $content, $info, $link, $type) {
}
function box_admin() {
- global $user, $op, $id, $subject, $content, $info, $link, $type;
+ global $op, $id, $subject, $content, $info, $link, $type;
- if (user_access($user, "add and edit boxes")) {
+ if (user_access("administer boxes")) {
print "<SMALL><A HREF=\"admin.php?mod=box&op=add\">add new box</A> | <A HREF=\"admin.php?mod=box\">overview</A> | <A HREF=\"admin.php?mod=box&op=help\">help</A></SMALL><HR>\n";
diff --git a/modules/comment.module b/modules/comment.module
index ad9924603..5f4dd09fd 100644
--- a/modules/comment.module
+++ b/modules/comment.module
@@ -4,13 +4,21 @@ function comment_search($keys) {
global $user;
$result = db_query("SELECT c.*, u.userid FROM comments c LEFT JOIN users u ON c.author = u.id WHERE c.subject LIKE '%$keys%' OR c.comment LIKE '%$keys%' ORDER BY c.timestamp DESC LIMIT 20");
while ($comment = db_fetch_object($result)) {
- $find[$i++] = array("title" => check_output($comment->subject), "link" => (user_access($user, "edit user comments") ? "admin.php?mod=comment&op=edit&id=$comment->cid" : "node.php?id=$comment->lid&cid=$comment->cid"), "user" => $comment->userid, "date" => $comment->timestamp);
+ $find[$i++] = array("title" => check_output($comment->subject), "link" => (user_access("administer comments") ? "admin.php?mod=comment&op=edit&id=$comment->cid" : "node.php?id=$comment->lid&cid=$comment->cid"), "user" => $comment->userid, "date" => $comment->timestamp);
}
return $find;
}
function comment_perm() {
- return array("view comments", "post comments", "edit comments");
+ return array("access comments", "post comments", "administer comments");
+}
+
+function comment_link($type) {
+ if ($type == "admin" and user_access("administer comments")) {
+ $links[] = "<a href=\"admin.php?mod=comment\">comments</a>";
+ }
+
+ return $links ? $links : array();
}
function comment_edit($id) {
@@ -46,9 +54,9 @@ function comment_overview() {
}
function comment_admin() {
- global $user, $op, $id, $edit, $mod, $keys, $order;
+ global $op, $id, $edit, $mod, $keys, $order;
- if (user_access($user, "edit comments")) {
+ if (user_access("administer comments")) {
print "<SMALL><A HREF=\"admin.php?mod=comment\">overview</A> | <A HREF=\"admin.php?mod=comment&op=search\">search comment</A></SMALL><HR>\n";
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index ad9924603..5f4dd09fd 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -4,13 +4,21 @@ function comment_search($keys) {
global $user;
$result = db_query("SELECT c.*, u.userid FROM comments c LEFT JOIN users u ON c.author = u.id WHERE c.subject LIKE '%$keys%' OR c.comment LIKE '%$keys%' ORDER BY c.timestamp DESC LIMIT 20");
while ($comment = db_fetch_object($result)) {
- $find[$i++] = array("title" => check_output($comment->subject), "link" => (user_access($user, "edit user comments") ? "admin.php?mod=comment&op=edit&id=$comment->cid" : "node.php?id=$comment->lid&cid=$comment->cid"), "user" => $comment->userid, "date" => $comment->timestamp);
+ $find[$i++] = array("title" => check_output($comment->subject), "link" => (user_access("administer comments") ? "admin.php?mod=comment&op=edit&id=$comment->cid" : "node.php?id=$comment->lid&cid=$comment->cid"), "user" => $comment->userid, "date" => $comment->timestamp);
}
return $find;
}
function comment_perm() {
- return array("view comments", "post comments", "edit comments");
+ return array("access comments", "post comments", "administer comments");
+}
+
+function comment_link($type) {
+ if ($type == "admin" and user_access("administer comments")) {
+ $links[] = "<a href=\"admin.php?mod=comment\">comments</a>";
+ }
+
+ return $links ? $links : array();
}
function comment_edit($id) {
@@ -46,9 +54,9 @@ function comment_overview() {
}
function comment_admin() {
- global $user, $op, $id, $edit, $mod, $keys, $order;
+ global $op, $id, $edit, $mod, $keys, $order;
- if (user_access($user, "edit comments")) {
+ if (user_access("administer comments")) {
print "<SMALL><A HREF=\"admin.php?mod=comment\">overview</A> | <A HREF=\"admin.php?mod=comment&op=search\">search comment</A></SMALL><HR>\n";
diff --git a/modules/cvs.module b/modules/cvs.module
index cc81a12e6..bc1206898 100644
--- a/modules/cvs.module
+++ b/modules/cvs.module
@@ -1,7 +1,15 @@
<?php
function cvs_perm() {
- return array("view CVS messages");
+ return array("access cvs messages");
+}
+
+function cvs_link($type) {
+ if ($type == "page" && user_access("access cvs messages")) {
+ $links[] = "<a href=\"module.php?mod=cvs\">cvs messages</a>";
+ }
+
+ return $links ? $links : array();
}
function cvs_cron() {
@@ -14,7 +22,7 @@ function cvs_cron() {
}
$result = db_query("UPDATE cvs SET status = '1'");
- if ($body) mail(variable_get(cvs_mail, "root@localhost"), "CVS log messages", $body, "From: no-reply");
+ if ($body) mail(variable_get(cvs_mail, "root@localhost"), "cvs log messages", $body, "From: no-reply");
}
}
@@ -26,9 +34,9 @@ function cvs_conf_options() {
}
function cvs_page() {
- global $user, $theme;
+ global $theme;
- if (user_access($user, "view CVS messages")) {
+ if (user_access("access cvs messages")) {
$result = db_query("SELECT * FROM cvs ORDER BY timestamp DESC LIMIT 50");
while ($cvs = db_fetch_object($result)) {
diff --git a/modules/diary.module b/modules/diary.module
index a186161ce..6008c344f 100644
--- a/modules/diary.module
+++ b/modules/diary.module
@@ -1,14 +1,13 @@
<?php
function diary_perm() {
- return array("view diary entries", "edit diary entries");
+ return array("administer diary entries", "access diary entries", "post diary entries");
}
function diary_search($keys) {
- global $user;
$result = db_query("SELECT d.*, u.userid FROM diaries d LEFT JOIN users u ON d.author = u.id WHERE d.text LIKE '%$keys%' ORDER BY d.timestamp DESC LIMIT 20");
while ($diary = db_fetch_object($result)) {
- $find[$i++] = array("title" => "$diary->userid's diary", "link" => (user_access($user, "edit diary entries") ? "admin.php?mod=diary&op=edit&id=$diary->id" : "module.php?mod=diary&op=view&name=$diary->userid"), "user" => $diary->userid, "date" => $diary->timestamp);
+ $find[$i++] = array("title" => "$diary->userid's diary", "link" => (user_access("administer diary entries") ? "admin.php?mod=diary&op=edit&id=$diary->id" : "module.php?mod=diary&op=view&name=$diary->userid"), "user" => $diary->userid, "date" => $diary->timestamp);
}
return $find;
@@ -17,7 +16,7 @@ function diary_search($keys) {
function diary_page_overview($num = 20) {
global $theme, $user;
- if (user_access($user, "view diary entries")) {
+ if (user_access("access diary entries")) {
$result = db_query("SELECT d.*, u.userid FROM diaries d LEFT JOIN users u ON d.author = u.id ORDER BY d.timestamp DESC LIMIT $num");
while ($diary = db_fetch_object($result)) {
@@ -212,8 +211,22 @@ function diary_help() {
<?php
}
-function diary_menu() {
- return array("<A HREF=\"module.php?mod=diary&op=add\">". t("edit your diary") ."</A>", "<A HREF=\"module.php?mod=diary&op=view\">". t("view your diary") ."</A>");
+function diary_link($type) {
+
+ if ($type == "admin" && user_access("adminsiter diary entries")) {
+ $links[] = "<a href=\"admin.php?mod=diary\">online diaries</a>";
+ }
+
+ if ($type == "page" && user_access("access diary entries")) {
+ $links[] = "<a href=\"module.php?mod=diary\">". t("online diaries") ."</a>";
+ }
+
+ if ($type == "menu" && user_access("post diary entries")) {
+ $links[] = "<a href=\"module.php?mod=diary&op=add\">". t("edit your diary") ."</a>";
+ $links[] = "<a href=\"module.php?mod=diary&op=view\">". t("view your diary") ."</a>";
+ }
+
+ return $links ? $links : array();
}
function diary_block() {
@@ -309,9 +322,9 @@ function diary_admin_display($order = "date") {
function diary_admin() {
- global $user, $op, $id, $mod, $keys, $text, $order;
+ global $op, $id, $mod, $keys, $text, $order;
- if (user_access($user, "edit diary entries")) {
+ if (user_access("administer diary entries")) {
print "<SMALL><A HREF=\"admin.php?mod=diary\">overview</A> | <A HREF=\"admin.php?mod=diary&op=search\">search diary</A> | <A HREF=\"admin.php?mod=diary&op=help\">help</A></SMALL><HR>\n";
diff --git a/modules/forum.module b/modules/forum.module
index cdbe9ce4f..ecf0f52bd 100644
--- a/modules/forum.module
+++ b/modules/forum.module
@@ -4,6 +4,15 @@ function forum_status() {
return array(dumped, posted);
}
+
+function forum_link($type) {
+ if ($type == "page" && user_access("access content")) {
+ $links[] = "<a href=\"module.php?mod=forum\">". t("forum") ."</a>";
+ }
+
+ return $links ? $links : array();
+}
+
function forum_view($node) {
global $theme;
$output .= "<P><A HREF=\"module.php?mod=forum\">". t("Forum") ."</A> / <B><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></B>:</P><P>". check_output($node->body) ."</P>";
@@ -38,9 +47,9 @@ function forum_last_comment($nid) {
}
function forum_page() {
- global $user, $theme;
+ global $theme;
- if (user_access($user, "view content")) {
+ if (user_access("access content")) {
$result = db_query("SELECT nid FROM node WHERE type = 'forum' ORDER BY title");
$output .= "<TABLE BORDER=\"0\" CELLSPACING=\"4\" CELLPADDING=\"4\">\n";
diff --git a/modules/forum/forum.module b/modules/forum/forum.module
index cdbe9ce4f..ecf0f52bd 100644
--- a/modules/forum/forum.module
+++ b/modules/forum/forum.module
@@ -4,6 +4,15 @@ function forum_status() {
return array(dumped, posted);
}
+
+function forum_link($type) {
+ if ($type == "page" && user_access("access content")) {
+ $links[] = "<a href=\"module.php?mod=forum\">". t("forum") ."</a>";
+ }
+
+ return $links ? $links : array();
+}
+
function forum_view($node) {
global $theme;
$output .= "<P><A HREF=\"module.php?mod=forum\">". t("Forum") ."</A> / <B><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></B>:</P><P>". check_output($node->body) ."</P>";
@@ -38,9 +47,9 @@ function forum_last_comment($nid) {
}
function forum_page() {
- global $user, $theme;
+ global $theme;
- if (user_access($user, "view content")) {
+ if (user_access("access content")) {
$result = db_query("SELECT nid FROM node WHERE type = 'forum' ORDER BY title");
$output .= "<TABLE BORDER=\"0\" CELLSPACING=\"4\" CELLPADDING=\"4\">\n";
diff --git a/modules/help.module b/modules/help.module
index 254432a7b..1b26fd7ad 100644
--- a/modules/help.module
+++ b/modules/help.module
@@ -1,5 +1,13 @@
<?php
+function help_link($type) {
+ if ($type == "admin") {
+ $links[] = "<a href=\"admin.php?mod=help\">help</a>";
+ }
+
+ return $links ? $links : array();
+}
+
function help_admin() {
foreach (module_list() as $name) {
if (module_hook($name, "help")) {
diff --git a/modules/help/help.module b/modules/help/help.module
index 254432a7b..1b26fd7ad 100644
--- a/modules/help/help.module
+++ b/modules/help/help.module
@@ -1,5 +1,13 @@
<?php
+function help_link($type) {
+ if ($type == "admin") {
+ $links[] = "<a href=\"admin.php?mod=help\">help</a>";
+ }
+
+ return $links ? $links : array();
+}
+
function help_admin() {
foreach (module_list() as $name) {
if (module_hook($name, "help")) {
diff --git a/modules/import.module b/modules/import.module
index 447090738..44f0b480a 100644
--- a/modules/import.module
+++ b/modules/import.module
@@ -12,7 +12,15 @@ function import_help() {
}
function import_perm() {
- return array("add and edit news feeds");
+ return array("administer news feeds");
+}
+
+function import_link($type) {
+ if ($type == "admin") {
+ $links[] = "<a href=\"admin.php?mod=import\">news feeds</a>";
+ }
+
+ return $links ? $links : array();
}
function import_cron() {
@@ -241,9 +249,9 @@ function import_view_item() {
}
function import_admin() {
- global $user, $op, $id, $type, $edit;
+ global $op, $id, $type, $edit;
- if (user_access($user, "add and edit news feeds")) {
+ if (user_access("administer news feeds")) {
print "<SMALL><A HREF=\"admin.php?mod=import&type=bundle&op=add\">add new bundle</A> | <A HREF=\"admin.php?mod=import&type=feed&op=add\">add new feed</A> | <A HREF=\"admin.php?mod=import&type=bundle&op=view\">available bundles</A> | <A HREF=\"admin.php?mod=import&type=item&op=view\">available items</A> | <A HREF=\"admin.php?mod=import&op=view\">overview</A> | <A HREF=\"admin.php?mod=import&op=help\">help</A></SMALL><HR>";
diff --git a/modules/locale.module b/modules/locale.module
index 8450746f5..73d531c85 100644
--- a/modules/locale.module
+++ b/modules/locale.module
@@ -35,7 +35,15 @@ function locale_help() {
}
function locale_perm() {
- return array("add and edit locales");
+ return array("administer locales");
+}
+
+function locale_link($type) {
+ if ($type == "admin" && user_access("administer locales")) {
+ $links[] = "<a href=\"admin.php?mod=locale\">locales</a>";
+ }
+
+ return $links ? $links : array();
}
function locale_conf_options() {
@@ -97,9 +105,9 @@ function locale_overview() {
}
function locale_admin() {
- global $user, $id, $edit, $op;
+ global $id, $edit, $op;
- if (user_access($user, "add and edit locales")) {
+ if (user_access("administer locales")) {
print "<SMALL><A HREF=\"admin.php?mod=locale\">overview</A> | <A HREF=\"admin.php?mod=locale&op=help\">help</A></SMALL><HR>\n";
switch ($op) {
diff --git a/modules/locale/locale.module b/modules/locale/locale.module
index 8450746f5..73d531c85 100644
--- a/modules/locale/locale.module
+++ b/modules/locale/locale.module
@@ -35,7 +35,15 @@ function locale_help() {
}
function locale_perm() {
- return array("add and edit locales");
+ return array("administer locales");
+}
+
+function locale_link($type) {
+ if ($type == "admin" && user_access("administer locales")) {
+ $links[] = "<a href=\"admin.php?mod=locale\">locales</a>";
+ }
+
+ return $links ? $links : array();
}
function locale_conf_options() {
@@ -97,9 +105,9 @@ function locale_overview() {
}
function locale_admin() {
- global $user, $id, $edit, $op;
+ global $id, $edit, $op;
- if (user_access($user, "add and edit locales")) {
+ if (user_access("administer locales")) {
print "<SMALL><A HREF=\"admin.php?mod=locale\">overview</A> | <A HREF=\"admin.php?mod=locale&op=help\">help</A></SMALL><HR>\n";
switch ($op) {
diff --git a/modules/meta.module b/modules/meta.module
index 092bf1d4c..207123b80 100644
--- a/modules/meta.module
+++ b/modules/meta.module
@@ -6,10 +6,19 @@ function meta_help() {
<?php
}
-function meta_conf() {
- return array("add and edit meta tags");
+function meta_perm() {
+ return array("administer meta tags");
}
+function meta_link($type) {
+ if ($type == "admin" && user_access("administer meta tags")) {
+ $links[] = "<a href=\"admin.php?mod=meta\">meta tags</a>";
+ }
+
+ return $links ? $links : array();
+}
+
+
function meta_form($type, $edit = array()) {
$c = db_query("SELECT * FROM collection WHERE types LIKE '%". check_input($type) ."%'");
while ($collection = db_fetch_object($c)) {
@@ -129,9 +138,9 @@ function meta_overview() {
}
function meta_admin() {
- global $user, $edit, $type, $op, $id;
+ global $edit, $type, $op, $id;
- if (user_access($user, "add and edit meta tags")) {
+ if (user_access("administer meta tags")) {
print "<SMALL><A HREF=\"admin.php?mod=meta&type=collection&op=add\">add new collection</A> | <A HREF=\"admin.php?mod=meta&type=tag&op=add\">add new meta-tag</A> | <A HREF=\"admin.php?mod=meta&op=preview\">preview node forms</A> | <A HREF=\"admin.php?mod=meta\">overview</A> | <A HREF=\"admin.php?mod=meta&op=help\">help</A></SMALL><HR>\n";
diff --git a/modules/moderate.module b/modules/moderate.module
index a75402c3a..bbb3f9489 100644
--- a/modules/moderate.module
+++ b/modules/moderate.module
@@ -4,6 +4,14 @@ function moderate_perm() {
return array("access moderation pages");
}
+function moderate_link($type) {
+ if ($type == "admin") {
+ $links[] = "<a href=\"admin.php?mod=moderate\">moderate content</a>";
+ }
+
+ return $links ? $links : array();
+}
+
function moderate_comment_access($cid) {
global $user;
return db_fetch_object(db_query("SELECT n.moderate FROM comments c LEFT JOIN node n ON c.lid = n.nid WHERE c.cid = '". check_input($cid) ."' AND n.moderate LIKE '%$user->userid%'"));
@@ -72,9 +80,9 @@ function moderate_comment_save($id, $edit) {
}
function moderate_admin() {
- global $user, $op, $id, $edit, $type;
+ global $op, $id, $edit, $type;
- if (user_access($user, "access moderation pages")) {
+ if (user_access("access moderation pages")) {
switch ($type) {
case "comment":
diff --git a/modules/node.module b/modules/node.module
index 7bc148177..01642e76e 100644
--- a/modules/node.module
+++ b/modules/node.module
@@ -27,7 +27,7 @@ function node_help() {
}
function node_perm() {
- return array("add and edit nodes");
+ return array("administer nodes");
}
function node_conf_options() {
@@ -69,7 +69,26 @@ function node_cron() {
db_query("UPDATE node SET status = '". node_status("dumped") ."', timestamp_hidden = '' WHERE timestamp_hidden > 0 AND timestamp_hidden < ". time());
}
-function node_link($nid, $type) {
+function node_link($context) {
+
+ if ($context == "admin" && user_access("administer nodes")) {
+ $links[] = "<a href=\"admin.php?mod=node\">content</a>";
+ }
+
+ if ($context[0] && $context[1]) {
+ $node = $context[1];
+ if ($node->body) {
+ $links[] = "<a href=\"node.php?id=". $node->nid ."\">". t("read more") ."</a>";
+ }
+ if ($node->comment) {
+ $links[] = "<a href=\"node.php?id=". $node->nid ."\">". format_plural(node_get_comments($node->nid), "comment", "comments") ."</a>";
+ }
+ }
+
+ return $links ? $links : array();
+}
+
+function node_links($nid, $type) {
global $op;
$link[] = ($op == "view") ? "view node" : "<A HREF=\"node.php?id=$nid\">view node</A>";
@@ -97,7 +116,7 @@ function node_overview($query) {
$bg = $color[$i++ % sizeof($color)];
$output .= " <TR BGCOLOR=\"$bg\"><TD><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></TD><TD ALIGN=\"center\">$node->type</TD><TD>". node_status($node->status) ."</TD><TD>". check_output($node->attributes) ."</TD><TD>". format_username($node->userid) ."</TD><TD>". format_date($node->timestamp, "small") ."</TD></TR>\n";
- $output .= " <TR BGCOLOR=\"$bg\"><TD ALIGN=\"right\" COLSPAN=\"6\"><SMALL>". implode(", ", node_link($node->nid, $node->type)) ."</SMALL></TD>\n";
+ $output .= " <TR BGCOLOR=\"$bg\"><TD ALIGN=\"right\" COLSPAN=\"6\"><SMALL>". implode(", ", node_links($node->nid, $node->type)) ."</SMALL></TD>\n";
}
$output .= "</TABLE>\n";
@@ -110,7 +129,7 @@ function node_edit_option($id) {
$node = node_get_object(array("nid" => $id));
$form .= form_item("Title", check_output($node->title));
- $form .= form_item("Operations", implode("<br />", node_link($node->nid, $node->type)));
+ $form .= form_item("Operations", implode("<br />", node_links($node->nid, $node->type)));
$form .= form_select("Comment", "comment", $node->comment, node_comment_status(), "Allow users to post comments to this node.");
$form .= form_select("Promote", "promote", $node->promote, node_promote_status(), "Promote this node on the main page.");
$form .= form_textfield("Moderate", "moderate", $node->moderate, 35, 255, t("A comma-seperated list of the moderators their usernames."));
@@ -126,7 +145,7 @@ function node_edit_attribute($id) {
$node = node_get_object(array("nid" => $id));
$form .= form_item("Title", check_output($node->title));
- $form .= form_item("Operations", implode("<br />", node_link($node->nid, $node->type)));
+ $form .= form_item("Operations", implode("<br />", node_links($node->nid, $node->type)));
$form .= form_textfield("Attributes", "attributes", $node->attributes, 64, 128, "A comma-seperated list of attributes. Example: 'Software, Webserver, Apache'.");
$form .= form_hidden("nid", $node->nid);
$form .= form_submit("Save node");
@@ -140,7 +159,7 @@ function node_edit_status($id) {
$node = node_get_object(array("nid" => $id));
$form .= form_item("Title", check_output($node->title));
- $form .= form_item("Operations", implode("<br />", node_link($node->nid, $node->type)));
+ $form .= form_item("Operations", implode("<br />", node_links($node->nid, $node->type)));
$form .= form_select("Current status", "status", $node->status, node_status($node->type));
$form .= form_textfield("Automatically post document", "timestamp_posted", ($node->timestamp_posted ? format_date($node->timestamp_posted) : ""), 30, 55, "The date at which your document will be automatically posted. Leave empty if you don't want to schedule this document, or fill out a string containing an English date format. Example input: '". date("j F Y G:i") ."', '". date("m/d/y H:i") ."', '". date("F j, Y H:i") ."', ...");
$form .= form_textfield("Automatically queue document", "timestamp_queued", ($node->timestamp_queued ? format_date($node->timestamp_queued) : ""), 30, 55, "The date at which your document will be automatically queued. Leave empty if you don't want to schedule this document, or fill out a string containing an English date format. Example input: '". date("j F Y G:i") ."', '". date("m/d/y H:i") ."', '". date("F j, Y H:i") ."', ...");
@@ -259,14 +278,14 @@ function node_module_find() {
function node_edit($node) {
$output .= form_item("Title", $node->title);
- $output .= form_item("Operations", implode("<br />", node_link($node->nid, $node->type)));
+ $output .= form_item("Operations", implode("<br />", node_links($node->nid, $node->type)));
return $output;
}
function node_admin() {
- global $user, $op, $id, $edit, $query, $type, $keys;
+ global $op, $id, $edit, $query, $type, $keys;
- if (user_access($user, "add and edit nodes")) {
+ if (user_access("administer nodes")) {
foreach (module_list() as $name) {
if (module_hook($name, "status") && $name != "node") {
diff --git a/modules/node/node.module b/modules/node/node.module
index 7bc148177..01642e76e 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -27,7 +27,7 @@ function node_help() {
}
function node_perm() {
- return array("add and edit nodes");
+ return array("administer nodes");
}
function node_conf_options() {
@@ -69,7 +69,26 @@ function node_cron() {
db_query("UPDATE node SET status = '". node_status("dumped") ."', timestamp_hidden = '' WHERE timestamp_hidden > 0 AND timestamp_hidden < ". time());
}
-function node_link($nid, $type) {
+function node_link($context) {
+
+ if ($context == "admin" && user_access("administer nodes")) {
+ $links[] = "<a href=\"admin.php?mod=node\">content</a>";
+ }
+
+ if ($context[0] && $context[1]) {
+ $node = $context[1];
+ if ($node->body) {
+ $links[] = "<a href=\"node.php?id=". $node->nid ."\">". t("read more") ."</a>";
+ }
+ if ($node->comment) {
+ $links[] = "<a href=\"node.php?id=". $node->nid ."\">". format_plural(node_get_comments($node->nid), "comment", "comments") ."</a>";
+ }
+ }
+
+ return $links ? $links : array();
+}
+
+function node_links($nid, $type) {
global $op;
$link[] = ($op == "view") ? "view node" : "<A HREF=\"node.php?id=$nid\">view node</A>";
@@ -97,7 +116,7 @@ function node_overview($query) {
$bg = $color[$i++ % sizeof($color)];
$output .= " <TR BGCOLOR=\"$bg\"><TD><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></TD><TD ALIGN=\"center\">$node->type</TD><TD>". node_status($node->status) ."</TD><TD>". check_output($node->attributes) ."</TD><TD>". format_username($node->userid) ."</TD><TD>". format_date($node->timestamp, "small") ."</TD></TR>\n";
- $output .= " <TR BGCOLOR=\"$bg\"><TD ALIGN=\"right\" COLSPAN=\"6\"><SMALL>". implode(", ", node_link($node->nid, $node->type)) ."</SMALL></TD>\n";
+ $output .= " <TR BGCOLOR=\"$bg\"><TD ALIGN=\"right\" COLSPAN=\"6\"><SMALL>". implode(", ", node_links($node->nid, $node->type)) ."</SMALL></TD>\n";
}
$output .= "</TABLE>\n";
@@ -110,7 +129,7 @@ function node_edit_option($id) {
$node = node_get_object(array("nid" => $id));
$form .= form_item("Title", check_output($node->title));
- $form .= form_item("Operations", implode("<br />", node_link($node->nid, $node->type)));
+ $form .= form_item("Operations", implode("<br />", node_links($node->nid, $node->type)));
$form .= form_select("Comment", "comment", $node->comment, node_comment_status(), "Allow users to post comments to this node.");
$form .= form_select("Promote", "promote", $node->promote, node_promote_status(), "Promote this node on the main page.");
$form .= form_textfield("Moderate", "moderate", $node->moderate, 35, 255, t("A comma-seperated list of the moderators their usernames."));
@@ -126,7 +145,7 @@ function node_edit_attribute($id) {
$node = node_get_object(array("nid" => $id));
$form .= form_item("Title", check_output($node->title));
- $form .= form_item("Operations", implode("<br />", node_link($node->nid, $node->type)));
+ $form .= form_item("Operations", implode("<br />", node_links($node->nid, $node->type)));
$form .= form_textfield("Attributes", "attributes", $node->attributes, 64, 128, "A comma-seperated list of attributes. Example: 'Software, Webserver, Apache'.");
$form .= form_hidden("nid", $node->nid);
$form .= form_submit("Save node");
@@ -140,7 +159,7 @@ function node_edit_status($id) {
$node = node_get_object(array("nid" => $id));
$form .= form_item("Title", check_output($node->title));
- $form .= form_item("Operations", implode("<br />", node_link($node->nid, $node->type)));
+ $form .= form_item("Operations", implode("<br />", node_links($node->nid, $node->type)));
$form .= form_select("Current status", "status", $node->status, node_status($node->type));
$form .= form_textfield("Automatically post document", "timestamp_posted", ($node->timestamp_posted ? format_date($node->timestamp_posted) : ""), 30, 55, "The date at which your document will be automatically posted. Leave empty if you don't want to schedule this document, or fill out a string containing an English date format. Example input: '". date("j F Y G:i") ."', '". date("m/d/y H:i") ."', '". date("F j, Y H:i") ."', ...");
$form .= form_textfield("Automatically queue document", "timestamp_queued", ($node->timestamp_queued ? format_date($node->timestamp_queued) : ""), 30, 55, "The date at which your document will be automatically queued. Leave empty if you don't want to schedule this document, or fill out a string containing an English date format. Example input: '". date("j F Y G:i") ."', '". date("m/d/y H:i") ."', '". date("F j, Y H:i") ."', ...");
@@ -259,14 +278,14 @@ function node_module_find() {
function node_edit($node) {
$output .= form_item("Title", $node->title);
- $output .= form_item("Operations", implode("<br />", node_link($node->nid, $node->type)));
+ $output .= form_item("Operations", implode("<br />", node_links($node->nid, $node->type)));
return $output;
}
function node_admin() {
- global $user, $op, $id, $edit, $query, $type, $keys;
+ global $op, $id, $edit, $query, $type, $keys;
- if (user_access($user, "add and edit nodes")) {
+ if (user_access("administer nodes")) {
foreach (module_list() as $name) {
if (module_hook($name, "status") && $name != "node") {
diff --git a/modules/poll.module b/modules/poll.module
index af7f918f7..7d6be5461 100644
--- a/modules/poll.module
+++ b/modules/poll.module
@@ -75,10 +75,10 @@ function poll_status() {
}
function poll_search($keys) {
- global $status, $user;
+ global $status;
$result = db_query("SELECT n.*, p.* FROM poll p LEFT JOIN node n ON n.nid = p.nid AND n.lid = p.lid WHERE n.status = '$status[posted]' AND (n.title LIKE '%$keys%') LIMIT 20");
while ($poll = db_fetch_object($result)) {
- $find[$i++] = array("title" => check_output($poll->title), "link" => (user_access($user, "add and edit nodes") ? "admin.php?mod=poll&op=edit&id=$poll->nid" : "node.php?id=$poll->nid"), "user" => $poll->userid, "date" => $poll->timestamp);
+ $find[$i++] = array("title" => check_output($poll->title), "link" => (user_access("administer nodes") ? "admin.php?mod=poll&op=edit&id=$poll->nid" : "node.php?id=$poll->nid"), "user" => $poll->userid, "date" => $poll->timestamp);
}
return $find;
}
@@ -170,13 +170,10 @@ function poll_view($node, $main = 0, $block = 0) {
function poll_form($edit = array(), $nocheck = 0) {
global $REQUEST_URI, $user;
- $duration = array(0 => t("Unlimited"), 86400 => t("1 day"), 172800 => t("2 days"), 345600 => t("4 days"),
- 604800 => t("1 week"), 1209600 => t("2 weeks"), 2678400 => t("1 month"), 5356800 => t("2 months"),
- 10713600 => t("4 months"), 31536000 => t("1 year"));
-
+ $duration = array(0 => t("Unlimited"), 86400 => t("1 day"), 172800 => t("2 days"), 345600 => t("4 days"), 604800 => t("1 week"), 1209600 => t("2 weeks"), 2678400 => t("1 month"), 5356800 => t("2 months"), 10713600 => t("4 months"), 31536000 => t("1 year"));
$active = array(0 => "Closed", 1 => "Active");
- $admin = ($edit[nid] && user_access($user, "add and edit nodes")) ? 1 : 0;
+ $admin = ($edit[nid] && user_access("administer nodes")) ? 1 : 0;
if ($edit[title]) {
$form .= poll_view(new Poll(node_preview($edit)));
@@ -234,7 +231,7 @@ function poll_save($edit) {
if (!$edit[nid]) {
$nid = node_save($edit, array(active => 1, attributes => node_attributes_save("poll", $edit), author => $user->id, comment => variable_get("poll_comment", 0), moderate => variable_get("poll_moderate", ""), promote => variable_get("poll_promote", 0), runtime, score => 0, status => variable_get("poll_status", $status[queued]), timestamp => time(), title, type => "poll", votes => 0, voters => ""));
}
- else if (user_access($user, "add and edit nodes")) {
+ else if (user_access("administer nodes")) {
$nid = node_save($edit, array(active, attributes => node_attributes_save("poll", $edit), runtime, title, type => "poll"));
db_query("DELETE FROM poll_choices WHERE nid='" . $nid . "'");
}
diff --git a/modules/poll/poll.module b/modules/poll/poll.module
index af7f918f7..7d6be5461 100644
--- a/modules/poll/poll.module
+++ b/modules/poll/poll.module
@@ -75,10 +75,10 @@ function poll_status() {
}
function poll_search($keys) {
- global $status, $user;
+ global $status;
$result = db_query("SELECT n.*, p.* FROM poll p LEFT JOIN node n ON n.nid = p.nid AND n.lid = p.lid WHERE n.status = '$status[posted]' AND (n.title LIKE '%$keys%') LIMIT 20");
while ($poll = db_fetch_object($result)) {
- $find[$i++] = array("title" => check_output($poll->title), "link" => (user_access($user, "add and edit nodes") ? "admin.php?mod=poll&op=edit&id=$poll->nid" : "node.php?id=$poll->nid"), "user" => $poll->userid, "date" => $poll->timestamp);
+ $find[$i++] = array("title" => check_output($poll->title), "link" => (user_access("administer nodes") ? "admin.php?mod=poll&op=edit&id=$poll->nid" : "node.php?id=$poll->nid"), "user" => $poll->userid, "date" => $poll->timestamp);
}
return $find;
}
@@ -170,13 +170,10 @@ function poll_view($node, $main = 0, $block = 0) {
function poll_form($edit = array(), $nocheck = 0) {
global $REQUEST_URI, $user;
- $duration = array(0 => t("Unlimited"), 86400 => t("1 day"), 172800 => t("2 days"), 345600 => t("4 days"),
- 604800 => t("1 week"), 1209600 => t("2 weeks"), 2678400 => t("1 month"), 5356800 => t("2 months"),
- 10713600 => t("4 months"), 31536000 => t("1 year"));
-
+ $duration = array(0 => t("Unlimited"), 86400 => t("1 day"), 172800 => t("2 days"), 345600 => t("4 days"), 604800 => t("1 week"), 1209600 => t("2 weeks"), 2678400 => t("1 month"), 5356800 => t("2 months"), 10713600 => t("4 months"), 31536000 => t("1 year"));
$active = array(0 => "Closed", 1 => "Active");
- $admin = ($edit[nid] && user_access($user, "add and edit nodes")) ? 1 : 0;
+ $admin = ($edit[nid] && user_access("administer nodes")) ? 1 : 0;
if ($edit[title]) {
$form .= poll_view(new Poll(node_preview($edit)));
@@ -234,7 +231,7 @@ function poll_save($edit) {
if (!$edit[nid]) {
$nid = node_save($edit, array(active => 1, attributes => node_attributes_save("poll", $edit), author => $user->id, comment => variable_get("poll_comment", 0), moderate => variable_get("poll_moderate", ""), promote => variable_get("poll_promote", 0), runtime, score => 0, status => variable_get("poll_status", $status[queued]), timestamp => time(), title, type => "poll", votes => 0, voters => ""));
}
- else if (user_access($user, "add and edit nodes")) {
+ else if (user_access("administer nodes")) {
$nid = node_save($edit, array(active, attributes => node_attributes_save("poll", $edit), runtime, title, type => "poll"));
db_query("DELETE FROM poll_choices WHERE nid='" . $nid . "'");
}
diff --git a/modules/queue.module b/modules/queue.module
index 3776ee2a3..4a42ec358 100644
--- a/modules/queue.module
+++ b/modules/queue.module
@@ -2,11 +2,19 @@
function queue_conf_options() {
$period = array(3600 => format_interval(3600), 10800 => format_interval(10800), 21600 => format_interval(21600), 32400 => format_interval(32400), 43200 => format_interval(43200), 86400 => format_interval(86400), 172800 => format_interval(172800), 259200 => format_interval(259200), 604800 => format_interval(604800), 1209600 => format_interval(1209600), 2419200 => format_interval(2419200), 1000000000 => t("Never"));
- $output .= form_select(t("Discard entries older than"), "queue_clear", variable_get("queue_clear", 604800), $period, t("The time nodes should be kept in the moderation queue. Older entries will be automatically discarded. Requires crontab.")); return $output;
+ $output .= form_select(t("Discard entries older than"), "queue_clear", variable_get("queue_clear", 604800), $period, t("The time nodes should be kept in the submission queue. Older entries will be automatically discarded. Requires crontab.")); return $output;
}
function queue_perm() {
- return array("access moderation queue");
+ return array("access submission queue");
+}
+
+function queue_link($type) {
+ if ($type == "menu" && user_access("access submission queue")) {
+ $links[] = "<a href=\"module.php?mod=queue\">". t("submission queue") ."</a> (<FONT COLOR=\"red\">". queue_count() ."</FONT>)";
+ }
+
+ return $links ? $links : array();
}
function queue_cron() {
@@ -14,10 +22,6 @@ function queue_cron() {
db_query("UPDATE node SET status = '$status[dumped]' WHERE status = '$status[queued]' AND ". time() ." - timestamp > ". variable_get("queue_clear", 604800));
}
-function queue_menu() {
- return array("<A HREF=\"module.php?mod=queue\">". t("moderation queue") ."</A> (<FONT COLOR=\"red\">". queue_count() ."</FONT>)");
-}
-
function queue_count() {
global $status;
$result = db_query("SELECT COUNT(nid) FROM node WHERE status = '$status[queued]'");
@@ -112,9 +116,9 @@ function queue_node($id) {
}
function queue_page() {
- global $id, $op, $theme, $user, $vote;
+ global $id, $op, $theme, $vote;
- if ($user->id && user_access($user, "access moderation queue")) {
+ if ($user->id && user_access("access submission queue")) {
switch($op) {
case "Vote";
queue_vote(check_input($id), check_input($vote));
diff --git a/modules/rating.module b/modules/rating.module
index 164b1ecca..4b9daa1a7 100644
--- a/modules/rating.module
+++ b/modules/rating.module
@@ -1,7 +1,15 @@
<?php
function rating_perm() {
- return array("view user ratings");
+ return array("access user ratings");
+}
+
+function rating_link($type) {
+ if ($type == "page" && user_access("access user ratings")) {
+ $links[] = "<a href=\"module.php?mod=rating\">". t("user ratings") ."</a>";
+ }
+
+ return $links ? $links : array();
}
function rating_conf_options() {
@@ -85,7 +93,7 @@ function rating_list($limit) {
function rating_page() {
global $user, $theme;
- if (user_access($user, "view user ratings")) {
+ if (user_access($user, "access user ratings")) {
$theme->header();
$theme->box(t("Top 100 users"), rating_list(100));
$theme->footer();
diff --git a/modules/statistics.module b/modules/statistics.module
index 3cd41d06f..02fc75de1 100644
--- a/modules/statistics.module
+++ b/modules/statistics.module
@@ -14,6 +14,14 @@ function statistics_perm() {
return array("access statistics");
}
+function statistics_link($type) {
+ if ($type == "admin" && user_access("access statistics")) {
+ $links[] = "<a href=\"admin.php?mod=statistics\">statistics</a>";
+ }
+
+ return $links ? $links : array();
+}
+
function statistics_conf_options() {
$period = array(3600 => format_interval(3600), 10800 => format_interval(10800), 21600 => format_interval(21600), 32400 => format_interval(32400), 43200 => format_interval(43200), 86400 => format_interval(86400), 172800 => format_interval(172800), 259200 => format_interval(259200), 604800 => format_interval(604800), 1209600 => format_interval(1209600), 2419200 => format_interval(2419200), 1000000000 => t("Never"));
$output .= form_select(t("Track referers"), "referer", variable_get("referer", 0), array("Disabled", "Enabled"), "If enabled, Drupal will count how many times your website is referred to by other websites.");
diff --git a/modules/statistics/statistics.module b/modules/statistics/statistics.module
index 3cd41d06f..02fc75de1 100644
--- a/modules/statistics/statistics.module
+++ b/modules/statistics/statistics.module
@@ -14,6 +14,14 @@ function statistics_perm() {
return array("access statistics");
}
+function statistics_link($type) {
+ if ($type == "admin" && user_access("access statistics")) {
+ $links[] = "<a href=\"admin.php?mod=statistics\">statistics</a>";
+ }
+
+ return $links ? $links : array();
+}
+
function statistics_conf_options() {
$period = array(3600 => format_interval(3600), 10800 => format_interval(10800), 21600 => format_interval(21600), 32400 => format_interval(32400), 43200 => format_interval(43200), 86400 => format_interval(86400), 172800 => format_interval(172800), 259200 => format_interval(259200), 604800 => format_interval(604800), 1209600 => format_interval(1209600), 2419200 => format_interval(2419200), 1000000000 => t("Never"));
$output .= form_select(t("Track referers"), "referer", variable_get("referer", 0), array("Disabled", "Enabled"), "If enabled, Drupal will count how many times your website is referred to by other websites.");
diff --git a/modules/story.module b/modules/story.module
index ee5b8cecf..a941ff307 100644
--- a/modules/story.module
+++ b/modules/story.module
@@ -16,7 +16,7 @@ function story_search($keys) {
global $status, $user;
$result = db_query("SELECT n.*, s.* FROM story s LEFT JOIN node n ON n.nid = s.nid AND n.lid = s.lid WHERE n.status = '$status[posted]' AND (n.title LIKE '%$keys%' OR s.abstract LIKE '%$keys%' OR s.body LIKE '%$keys%') ORDER BY n.timestamp DESC LIMIT 20");
while ($story = db_fetch_object($result)) {
- $find[$i++] = array("title" => check_output($story->title), "link" => (user_access($user, "add and edit nodes") ? "admin.php?mod=node&type=story&op=edit&id=$story->nid" : "node.php?id=$story->nid"), "user" => $story->userid, "date" => $story->timestamp);
+ $find[$i++] = array("title" => check_output($story->title), "link" => (user_access("administer nodes") ? "admin.php?mod=node&type=story&op=edit&id=$story->nid" : "node.php?id=$story->nid"), "user" => $story->userid, "date" => $story->timestamp);
}
return $find;
}
@@ -75,7 +75,7 @@ function story_save($edit) {
if (!$edit[nid]) {
node_save($edit, array(abstract, attributes => node_attributes_save("story", $edit), author => $user->id, body, comment => variable_get("story_comment", 0), moderate => variable_get("story_moderate", ""), promote => variable_get("story_promote", 0), score => 0, status => variable_get("story_status", $status[queued]), timestamp => time(), title, type => "story", votes => 0));
}
- else if (user_access($user, "add and edit nodes")) {
+ else if (user_access("administer nodes")) {
node_save($edit, array(abstract, attributes => node_attributes_save("story", $edit), body, title, type => "story"));
}
}
diff --git a/modules/story/story.module b/modules/story/story.module
index ee5b8cecf..a941ff307 100644
--- a/modules/story/story.module
+++ b/modules/story/story.module
@@ -16,7 +16,7 @@ function story_search($keys) {
global $status, $user;
$result = db_query("SELECT n.*, s.* FROM story s LEFT JOIN node n ON n.nid = s.nid AND n.lid = s.lid WHERE n.status = '$status[posted]' AND (n.title LIKE '%$keys%' OR s.abstract LIKE '%$keys%' OR s.body LIKE '%$keys%') ORDER BY n.timestamp DESC LIMIT 20");
while ($story = db_fetch_object($result)) {
- $find[$i++] = array("title" => check_output($story->title), "link" => (user_access($user, "add and edit nodes") ? "admin.php?mod=node&type=story&op=edit&id=$story->nid" : "node.php?id=$story->nid"), "user" => $story->userid, "date" => $story->timestamp);
+ $find[$i++] = array("title" => check_output($story->title), "link" => (user_access("administer nodes") ? "admin.php?mod=node&type=story&op=edit&id=$story->nid" : "node.php?id=$story->nid"), "user" => $story->userid, "date" => $story->timestamp);
}
return $find;
}
@@ -75,7 +75,7 @@ function story_save($edit) {
if (!$edit[nid]) {
node_save($edit, array(abstract, attributes => node_attributes_save("story", $edit), author => $user->id, body, comment => variable_get("story_comment", 0), moderate => variable_get("story_moderate", ""), promote => variable_get("story_promote", 0), score => 0, status => variable_get("story_status", $status[queued]), timestamp => time(), title, type => "story", votes => 0));
}
- else if (user_access($user, "add and edit nodes")) {
+ else if (user_access("administer nodes")) {
node_save($edit, array(abstract, attributes => node_attributes_save("story", $edit), body, title, type => "story"));
}
}
diff --git a/modules/system.module b/modules/system.module
index 6a2504d6a..b31a9dcad 100644
--- a/modules/system.module
+++ b/modules/system.module
@@ -13,7 +13,15 @@ function system_help() {
}
function system_perm() {
- return array("edit configuration options");
+ return array("administer site options");
+}
+
+function system_link($type) {
+ if ($type == "admin" && user_access("administer site options")) {
+ $links[] = "<a href=\"admin.php?mod=system\">configuration options</a>";
+ }
+
+ return $links ? $links : array();
}
function system_view_options() {
@@ -112,9 +120,9 @@ function system_modules() {
}
function system_admin() {
- global $user, $edit, $op, $type;
+ global $edit, $op, $type;
- if (user_access($user, "edit configuration options")) {
+ if (user_access("administer site options")) {
print "<SMALL><A HREF=\"admin.php?mod=system&type=options\">site settings</A> | <A HREF=\"admin.php?mod=system&type=filter\">content filters</A> | <A HREF=\"admin.php?mod=system&op=modules\">modules</A> | <A HREF=\"admin.php?mod=system&op=help\">help</A></SMALL><HR>\n";
diff --git a/modules/system/system.module b/modules/system/system.module
index 6a2504d6a..b31a9dcad 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -13,7 +13,15 @@ function system_help() {
}
function system_perm() {
- return array("edit configuration options");
+ return array("administer site options");
+}
+
+function system_link($type) {
+ if ($type == "admin" && user_access("administer site options")) {
+ $links[] = "<a href=\"admin.php?mod=system\">configuration options</a>";
+ }
+
+ return $links ? $links : array();
}
function system_view_options() {
@@ -112,9 +120,9 @@ function system_modules() {
}
function system_admin() {
- global $user, $edit, $op, $type;
+ global $edit, $op, $type;
- if (user_access($user, "edit configuration options")) {
+ if (user_access("administer site options")) {
print "<SMALL><A HREF=\"admin.php?mod=system&type=options\">site settings</A> | <A HREF=\"admin.php?mod=system&type=filter\">content filters</A> | <A HREF=\"admin.php?mod=system&op=modules\">modules</A> | <A HREF=\"admin.php?mod=system&op=help\">help</A></SMALL><HR>\n";
diff --git a/modules/watchdog.module b/modules/watchdog.module
index 23d4c8d28..fb70530ee 100644
--- a/modules/watchdog.module
+++ b/modules/watchdog.module
@@ -11,6 +11,14 @@ function watchdog_perm() {
return array("access watchdog");
}
+function watchdog_link($type) {
+ if ($type == "admin" && user_access("access watchdog")) {
+ $links[] = "<a href=\"admin.php?mod=watchdog\">watchdog</a>";
+ }
+
+ return $links ? $links : array();
+}
+
function watchdog_conf_options() {
$period = array(3600 => format_interval(3600), 10800 => format_interval(10800), 21600 => format_interval(21600), 32400 => format_interval(32400), 43200 => format_interval(43200), 86400 => format_interval(86400), 172800 => format_interval(172800), 259200 => format_interval(259200), 604800 => format_interval(604800), 1209600 => format_interval(1209600), 2419200 => format_interval(2419200), 1000000000 => t("Never"));
$output .= form_select(t("Discard entries older than"), "watchdog_clear", variable_get("watchdog_clear", 604800), $period, t("The time watchdog entries should be kept. Older entries will be automatically discarded. Requires crontab."));
@@ -57,9 +65,9 @@ function watchdog_view($id) {
}
function watchdog_admin() {
- global $user, $op, $id, $type, $order;
+ global $op, $id, $type, $order;
- if (user_access($user, "access watchdog")) {
+ if (user_access("access 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 23d4c8d28..fb70530ee 100644
--- a/modules/watchdog/watchdog.module
+++ b/modules/watchdog/watchdog.module
@@ -11,6 +11,14 @@ function watchdog_perm() {
return array("access watchdog");
}
+function watchdog_link($type) {
+ if ($type == "admin" && user_access("access watchdog")) {
+ $links[] = "<a href=\"admin.php?mod=watchdog\">watchdog</a>";
+ }
+
+ return $links ? $links : array();
+}
+
function watchdog_conf_options() {
$period = array(3600 => format_interval(3600), 10800 => format_interval(10800), 21600 => format_interval(21600), 32400 => format_interval(32400), 43200 => format_interval(43200), 86400 => format_interval(86400), 172800 => format_interval(172800), 259200 => format_interval(259200), 604800 => format_interval(604800), 1209600 => format_interval(1209600), 2419200 => format_interval(2419200), 1000000000 => t("Never"));
$output .= form_select(t("Discard entries older than"), "watchdog_clear", variable_get("watchdog_clear", 604800), $period, t("The time watchdog entries should be kept. Older entries will be automatically discarded. Requires crontab."));
@@ -57,9 +65,9 @@ function watchdog_view($id) {
}
function watchdog_admin() {
- global $user, $op, $id, $type, $order;
+ global $op, $id, $type, $order;
- if (user_access($user, "access watchdog")) {
+ if (user_access("access 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/node.php b/node.php
index 09e9622e1..45fd14162 100644
--- a/node.php
+++ b/node.php
@@ -5,9 +5,9 @@ include_once "includes/common.inc";
page_header();
function node_render($node) {
- global $user, $id, $cid, $op, $moderate, $pid, $edit, $theme, $mode, $order, $threshold, $PHP_SELF;
+ global $id, $cid, $op, $moderate, $pid, $edit, $theme, $mode, $order, $threshold, $PHP_SELF;
- if (user_access($user, "view content")) {
+ if (user_access("access content")) {
if ($node->comment) {
switch($op) {
diff --git a/search.php b/search.php
index 9d5b118e2..c0c7f695b 100644
--- a/search.php
+++ b/search.php
@@ -4,7 +4,7 @@ include_once "includes/common.inc";
page_header();
-if (user_access($user, "search content")) {
+if (user_access("search content")) {
// verify input:
$type = check_input($type);
$keys = check_input($keys);
diff --git a/submit.php b/submit.php
index 02b6f8959..b1cfaa320 100644
--- a/submit.php
+++ b/submit.php
@@ -6,7 +6,7 @@ page_header();
$theme->header();
-if (user_access($user, "post content")) {
+if (user_access("post content")) {
if ($mod) {
module_invoke($mod, "user");
}
diff --git a/themes/example/example.theme b/themes/example/example.theme
index e53496b68..3f4889685 100644
--- a/themes/example/example.theme
+++ b/themes/example/example.theme
@@ -30,7 +30,7 @@
<TD ALIGN="right" COLSPAN="2">
<?php
- print theme_link();
+ print $this->links(link_page());
?>
</TD>
@@ -50,7 +50,7 @@
} // close header function
- function node($node, $main = 0, $links = 0) {
+ function node($node, $main = 0) {
?>
<TABLE BORDER="1" CELLSPACING="0" CELLPADDING="3" WIDTH="100%">
@@ -83,7 +83,7 @@
<TR>
<TD COLSPAN="2">
<?php
- if (node_links($links, $node, $main)) echo $this->links($links, $main);
+ if ($main) echo $this->links(link_node($node));
?>
</TD>
@@ -178,7 +178,7 @@
</TR>
<TR>
<TD ALIGN="center" COLSPAN="3">
- <P><?php print theme_link(" | "); ?></P>
+ <P><?php print $this->links(link_page()); ?></P>
<P><SMALL><?php print variable_get(site_footer, ""); ?></SMALL></P>
</TD>
</TR>
diff --git a/themes/goofy/goofy.theme b/themes/goofy/goofy.theme
index 9cb913975..9444db289 100644
--- a/themes/goofy/goofy.theme
+++ b/themes/goofy/goofy.theme
@@ -86,7 +86,7 @@ function c(subject,mod,author,date,body) {document.writeln("<table border=\"0\"
</tr>
<tr>
<td class="lgl"><img src="themes/goofy/images/null.gif" alt=""></td>
- <td class="lgcnt" width="100%" valign="top"><div align="center"><big><?php print theme_link(); ?></big></div></td>
+ <td class="lgcnt" width="100%" valign="top"><div align="center"><big><?php print $this->links(link_page()); ?></big></div></td>
<td class="lgr"><img src="themes/goofy/images/null.gif" alt=""></td>
</tr>
<tr>
@@ -99,12 +99,12 @@ function c(subject,mod,author,date,body) {document.writeln("<table border=\"0\"
} // close linksbar function
- function node($node, $main = 0, $links = 0) {
+ function node($node, $main = 0) {
echo "\n<!-- node: \"$node->title\" -->\n";
$title = check_output($node->title);
$subleft = strtr(t("Submitted by %a on %b"), array("%a" => format_username($node->userid), "%b" => format_date($node->timestamp, "large")));
$subright = node_index($node);
- $body = check_output($node->body, 1) . (node_links($links, $node, $main) ? "<hr color=\"#404040\" size=\"1\"><div align=\"right\">[ " . $this->links($links, $main) . " ]</div>" : "");
+ $body = check_output($node->body, 1) . ($main ? "<hr color=\"#404040\" size=\"1\"><div align=\"right\">[ " . $this->links(link_node($node)) . " ]</div>" : "");
print "<script language=\"JavaScript\"><!--\ns(\"". $this->stripbreaks(addslashes($title)) ."\",\"". $this->stripbreaks(addslashes($subleft)) ."\",\"". $this->stripbreaks(addslashes($subright)) ."\",\"". $this->stripbreaks(addslashes($body)) ."\"); // -->\n</script>\n";
} // close node function
diff --git a/themes/jeroen/jeroen.theme b/themes/jeroen/jeroen.theme
index c5685f326..739c7b16e 100644
--- a/themes/jeroen/jeroen.theme
+++ b/themes/jeroen/jeroen.theme
@@ -84,7 +84,7 @@
} // close header function
- function node($node, $main = 0, $links = 0) {
+ function node($node, $main = 0) {
?>
@@ -138,8 +138,8 @@
<tr>
<td colspan="2" align="right">
<?php
- if (node_links($links, $node, $main))
- echo $this->links($links, $main);
+ if ($main)
+ echo $this->links(node_link($node));
?>
</td>
@@ -310,7 +310,7 @@
<tr>
<td align="left" width="20" height="20" background="themes/jeroen/images/footerleft.gif" nowrap>&nbsp;</td>
<td width="100%" background="themes/jeroen/images/footer.gif" align="center" valign="middle">
- <FONT COLOR="#E09226" SIZE="2">[ <?php print theme_link(); ?> ] </FONT>
+ <FONT COLOR="#E09226" SIZE="2">[ <?php print $this->links(link_page()); ?> ] </FONT>
</td>
<td align="right" width="20" background="themes/jeroen/images/footerright.gif" nowrap>&nbsp;</td>
</tr>
diff --git a/themes/marvin/marvin.theme b/themes/marvin/marvin.theme
index c24cb68f3..583011daf 100644
--- a/themes/marvin/marvin.theme
+++ b/themes/marvin/marvin.theme
@@ -1,4 +1,4 @@
-<?php
+<?
/*********************************************************************
@@ -41,7 +41,7 @@
<tr>
<td align="right" colspan="2">
<?php
- print "<small>". theme_link() ."</small>\n";
+ print "<small>". $this->links(link_page()) ."</small>\n";
?>
</td>
</tr>
@@ -50,7 +50,7 @@
<?php
}
- function node($node, $main = 0, $links = 0) {
+ function node($node, $main = 0) {
print "\n<!-- node: \"$node->title\" -->\n";
print "<table border=\"0\" cellpadding=\"0\" cellspacing=\"2\" width=\"100%\">\n";
print " <tr><td colspan=\"2\"><img src=\"themes/marvin/images/drop.gif\" alt=\"\" /> &nbsp; <b>". check_output($node->title) ."</b></td></tr>\n";
@@ -59,9 +59,7 @@
print " <tr><td colspan=\"2\">&nbsp;</td></tr>\n";
print " <tr><td colspan=\"2\"><p>". check_output($node->body, 1) ."</p></td></tr>\n";
print " <tr><td colspan=\"2\">&nbsp;</tr></tr>\n";
- if (node_links($links, $node, $main)) {
- print " <tr><td colspan=\"2\">". $this->links($links, $main) ."</td></tr>\n";
- }
+ if ($main) print " <tr><td colspan=\"2\">". $this->links(link_node($node)) ."</td></tr>\n";
print "</table>\n";
print "<br /><br />\n\n";
}
@@ -145,7 +143,7 @@
<tr>
<td align="center" colspan="2">
<?php
- print "<p><small>[ ". theme_link() ." ]</small></p><p>". variable_get("site_footer", "") ."</p>\n";
+ print "<p><small>[ ". $this->links(link_page()) ." ]</small></p><p>". variable_get("site_footer", "") ."</p>\n";
?>
</td>
</tr>
diff --git a/themes/unconed/unconed.theme b/themes/unconed/unconed.theme
index a51f6222f..0eeb72e7b 100644
--- a/themes/unconed/unconed.theme
+++ b/themes/unconed/unconed.theme
@@ -63,7 +63,7 @@
</TR>
<TR>
<TD COLSPAN="2" ALIGN="CENTER">
- <TABLE BORDER="0" WIDTH="100%" CELLSPACING="0" CELLPADDING="0" BGCOLOR="<?php echo $this->brcolor1; ?>"><TR><TD ALIGN="CENTER"><TABLE BORDER="0" WIDTH="100%" CELLSPACING="1" CELLPADDING="4"><TR><TD ALIGN="CENTER" BGCOLOR="<?php echo $this->bgcolor2; ?>"><BIG><?php print theme_link(); ?></BIG></TD></TR></TABLE></TD></TR></TABLE>
+ <TABLE BORDER="0" WIDTH="100%" CELLSPACING="0" CELLPADDING="0" BGCOLOR="<?php echo $this->brcolor1; ?>"><TR><TD ALIGN="CENTER"><TABLE BORDER="0" WIDTH="100%" CELLSPACING="1" CELLPADDING="4"><TR><TD ALIGN="CENTER" BGCOLOR="<?php echo $this->bgcolor2; ?>"><BIG><?php print $this->links(link_page()); ?></BIG></TD></TR></TABLE></TD></TR></TABLE>
</TD>
</TR>
<TR><TD COLSPAN="2"><?php
@@ -79,7 +79,7 @@
<?php
}
- function node($node, $main = 0, $links = 0) {
+ function node($node, $main = 0) {
print "\n<!-- node: \"$node->title\" -->\n";
?>
@@ -101,8 +101,8 @@
</TD>
</TR>
<?php
- if (node_links($links, $node, $main))
- echo "<TR BGCOLOR=\"". $this->bgcolor3 ."\"><TD BGCOLOR=\"". $this->bgcolor3 ."\" ALIGN=\"right\" COLSPAN=\"2\">[ ". $this->links($links, $main) ." ]</TD></TR>";
+ if ($main)
+ echo "<TR BGCOLOR=\"". $this->bgcolor3 ."\"><TD BGCOLOR=\"". $this->bgcolor3 ."\" ALIGN=\"right\" COLSPAN=\"2\">[ ". $this->links(link_node($node)) ." ]</TD></TR>";
?>
</TABLE></TD></TR></TABLE><BR>
<?php
@@ -202,7 +202,7 @@
?></TD></TR>
<TR>
<TD COLSPAN="2">
- <TABLE BORDER="0" WIDTH="100%" CELLSPACING="0" CELLPADDING="0" BGCOLOR="<?php echo $this->brcolor1; ?>"><TR><TD ALIGN="CENTER"><TABLE BORDER="0" WIDTH="100%" CELLSPACING="1" CELLPADDING="4"><TR><TD ALIGN="CENTER" BGCOLOR="<?php echo $this->bgcolor2; ?>"><BIG><?php print theme_link(); ?></BIG></TD></TR></TABLE></TD></TR></TABLE>
+ <TABLE BORDER="0" WIDTH="100%" CELLSPACING="0" CELLPADDING="0" BGCOLOR="<?php echo $this->brcolor1; ?>"><TR><TD ALIGN="CENTER"><TABLE BORDER="0" WIDTH="100%" CELLSPACING="1" CELLPADDING="4"><TR><TD ALIGN="CENTER" BGCOLOR="<?php echo $this->bgcolor2; ?>"><BIG><?php print $this->links(link_page()); ?></BIG></TD></TR></TABLE></TD></TR></TABLE>
</TD>
</TR>
</TABLE>
diff --git a/themes/yaroon/yaroon.theme b/themes/yaroon/yaroon.theme
index 66280be8b..f0dd622a5 100644
--- a/themes/yaroon/yaroon.theme
+++ b/themes/yaroon/yaroon.theme
@@ -112,7 +112,7 @@
} // close header function
- function node($node, $main = 0, $links = 0) {
+ function node($node, $main = 0) {
switch ($node->tid) {
case 0: $color = "#c4a2a2"; $img = "square2.gif"; break;
@@ -145,8 +145,8 @@
<tr>
<td align=\"right\">
<font color=\"". $color ."\">";
- if (node_links($links, $node, $main))
- echo $this->links($links, $main);
+ if ($main)
+ echo $this->links(node_link($node));
echo"</font>";
?>