diff options
author | Dries Buytaert <dries@buytaert.net> | 2001-06-30 10:05:54 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2001-06-30 10:05:54 +0000 |
commit | cab3ac83f8bf215b3d0abfbd698c670e0b6b33b4 (patch) | |
tree | 612a78fafe5bc69429802877735988e7c292f40e /modules/statistics/statistics.module | |
parent | e6a67118ebfe21dcc7646676f808d1f4b2fc3a83 (diff) | |
download | brdo-cab3ac83f8bf215b3d0abfbd698c670e0b6b33b4.tar.gz brdo-cab3ac83f8bf215b3d0abfbd698c670e0b6b33b4.tar.bz2 |
- statistics.module:
+ fixed small glitch
+ improved interface
Diffstat (limited to 'modules/statistics/statistics.module')
-rw-r--r-- | modules/statistics/statistics.module | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/modules/statistics/statistics.module b/modules/statistics/statistics.module index 32a7b9fb6..e06bbba4d 100644 --- a/modules/statistics/statistics.module +++ b/modules/statistics/statistics.module @@ -28,12 +28,11 @@ function statistics_conf_options() { $output .= form_select(t("Discard referers older than"), "referer_clear", variable_get("referer_clear", 604800), $period, "The time referer entries should be kept. Older entries will be automatically discarded. Requires crontab."); return $output; } -function statistics_referer() { - $result = db_query("SELECT url, COUNT(url) AS count FROM referer WHERE url NOT LIKE '". path_uri() ."%' GROUP BY url ORDER BY count DESC"); +function statistics_referer_internal() { + $result = db_query("SELECT url, COUNT(url) AS count FROM referer WHERE url LIKE '". path_uri() ."%' GROUP BY url ORDER BY count DESC"); - $output .= "<P>Referers of the last ". format_interval(variable_get("referer_clear", 604800)) .":</P>\n"; + $output .= "<P>Internal referers of the last ". format_interval(variable_get("referer_clear", 604800)) .":</P>\n"; - $output .= "<H3>External referers</H3>\n"; $output .= "<TABLE BORDER=\"1\" CELLPADDING=\"3\" CELLSPACING=\"0\">\n"; $output .= " <TR><TH>URL</TH><TH>number</TH></TR>\n"; while ($referer = db_fetch_object($result)) { @@ -41,9 +40,14 @@ function statistics_referer() { } $output .= "</TABLE>\n"; - $result = db_query("SELECT url, COUNT(url) AS count FROM referer WHERE url LIKE '". path_uri() ."%' GROUP BY url ORDER BY count DESC"); + return $output; +} + +function statistics_referer_external() { + $result = db_query("SELECT url, COUNT(url) AS count FROM referer WHERE url NOT LIKE '". path_uri() ."%' GROUP BY url ORDER BY count DESC"); + + $output .= "<P>External referers of the last ". format_interval(variable_get("referer_clear", 604800)) .":</P>\n"; - $output .= "<H3>Internal referers</H3>\n"; $output .= "<TABLE BORDER=\"1\" CELLPADDING=\"3\" CELLSPACING=\"0\">\n"; $output .= " <TR><TH>URL</TH><TH>number</TH></TR>\n"; while ($referer = db_fetch_object($result)) { @@ -55,10 +59,21 @@ function statistics_referer() { } function statistics_admin() { - global $user; + global $type; + + if (user_access("administer statistics")) { + + print "<SMALL><A HREF=\"admin.php?mod=statistics&type=internal+referer\">internal referers</A> | <A HREF=\"admin.php?mod=statistics&type=external+referer\">external referers</A></SMALL><HR>\n"; - if (user_access($user, "administer statistics")) { - print statistics_referer(); + switch ($type) { + case "internal referer": + print statistics_referer_internal(); + break; + case "external referer": + // fall through: + default: + print statistics_referer_external(); + } } } |