summaryrefslogtreecommitdiff
path: root/includes/common.inc
diff options
context:
space:
mode:
Diffstat (limited to 'includes/common.inc')
-rw-r--r--includes/common.inc27
1 files changed, 23 insertions, 4 deletions
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());