summaryrefslogtreecommitdiff
path: root/modules/statistics.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2004-04-21 13:56:38 +0000
committerDries Buytaert <dries@buytaert.net>2004-04-21 13:56:38 +0000
commit7231c88a326f92bdc2b1579ac6afb8f7f568170b (patch)
treeb7586493410910be188d97440dbdf1d44b084b91 /modules/statistics.module
parent7976678719f6e04ecda315a6088ee0eb3cfb0318 (diff)
downloadbrdo-7231c88a326f92bdc2b1579ac6afb8f7f568170b.tar.gz
brdo-7231c88a326f92bdc2b1579ac6afb8f7f568170b.tar.bz2
- Added support for 403 handling. Patch by JonBob. As a side benefit,
administrators will be able to define a custom 403 page, just as they can define 404 pages now. This needs to be documented in the "Changes since / migrating to ..." pages.
Diffstat (limited to 'modules/statistics.module')
-rw-r--r--modules/statistics.module44
1 files changed, 21 insertions, 23 deletions
diff --git a/modules/statistics.module b/modules/statistics.module
index f79f24553..333f27c73 100644
--- a/modules/statistics.module
+++ b/modules/statistics.module
@@ -119,46 +119,44 @@ function statistics_perm() {
return array("administer statistics module", "administer statistics", "access statistics");
}
-/* Link hook, defines module's links */
+/**
+ * Implementation of hook_link().
+ */
function statistics_link($type, $node = 0, $main = 0) {
global $id;
$links = array();
- if ($type == "node" && user_access("access statistics") && variable_get("statistics_display_counter", 0)) {
+ if ($type == 'node' && user_access('access statistics') && variable_get('statistics_display_counter', 0)) {
$statistics = statistics_get($node->nid);
if ($statistics) {
- if (user_access("administer statistics")) {
- $links[] = l(format_plural($statistics["totalcount"], "1 read", "%count reads"), "admin/logs/access/node/$node->nid");
+ if (user_access('administer statistics')) {
+ $links[] = l(format_plural($statistics['totalcount'], '1 read', '%count reads'), "admin/logs/access/node/$node->nid");
}
else {
- $links[] = format_plural($statistics["totalcount"], "1 read", "%count reads");
+ $links[] = format_plural($statistics['totalcount'], '1 read', '%count reads');
}
}
}
- if ($type == "page" && user_access("access content")) {
- $userlink = variable_get("statistics_userpage_link", "");
+ if ($type == 'page' && user_access('access content')) {
+ $userlink = variable_get('statistics_userpage_link', '');
if ($userlink) {
- $links[] = l(t($userlink), "statistics", array("title" => t("View this site's most popular content.")));
+ $links[] = l(t($userlink), 'statistics', array('title' => t("View this site's most popular content.")));
}
}
- if ($type == "system") {
- if ((user_access("administer statistics module") || (user_access("administer statistics")))) {
- menu("admin/logs/topnodes", t("top nodes"), "statistics_admin", 1);
- menu("admin/logs/referrer", t("referrer"), "statistics_admin", 2);
- menu("admin/logs/referrer/internal", t("internal referrers only"), "statistics_admin");
- menu("admin/logs/referrer/external", t("external referrers only"), "statistics_admin");
- menu("admin/logs/access", t("access"), "statistics_admin", 3);
- menu("admin/logs/access/node", t("track node"), "statistics_admin", 0, MENU_HIDE);
- menu("admin/logs/access/user", t("track user"), "statistics_admin", 0, MENU_HIDE);
- menu("admin/logs/access/host", t("track host"), "statistics_admin", 0, MENU_HIDE);
- }
-
- if (user_access("access content")) {
- menu("statistics", t("view most popular content"), "statistics_page", 0, MENU_HIDE);
- }
+ if ($type == 'system') {
+ $access = user_access('administer statistics module') || user_access('administer statistics');
+
+ menu('admin/logs/topnodes', t('top nodes'), $access ? 'statistics_admin' : MENU_DENIED, 1);
+ menu('admin/logs/referrer', t('referrer'), $access ? 'statistics_admin' : MENU_DENIED, 2);
+ menu('admin/logs/referrer/internal', t('internal referrers only'), $access ? 'statistics_admin' : MENU_DENIED);
+ menu('admin/logs/referrer/external', t('external referrers only'), $access ? 'statistics_admin' : MENU_DENIED);
+ menu('admin/logs/access', t('access'), $access ? 'statistics_admin' : MENU_DENIED, 3);
+ menu('admin/logs/access/node', t('track node'), $access ? 'statistics_admin' : MENU_DENIED, 0, MENU_HIDE);
+ menu('admin/logs/access/user', t('track user'), $access ? 'statistics_admin' : MENU_DENIED, 0, MENU_HIDE);
+ menu('admin/logs/access/host', t('track host'), $access ? 'statistics_admin' : MENU_DENIED, 0, MENU_HIDE);
}
return $links;