projects
/
infodrom.org
/
service.infodrom.org
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
bc35f32
)
Support lists of URLs and referers
author
Joey Schulze
<joey@infodrom.org>
Sat, 6 Oct 2007 18:57:58 +0000
(18:57 +0000)
committer
Joey Schulze
<joey@infodrom.org>
Sat, 6 Oct 2007 18:57:58 +0000
(18:57 +0000)
src/Infodrom/webstats/referer.wml
patch
|
blob
|
history
diff --git
a/src/Infodrom/webstats/referer.wml
b/src/Infodrom/webstats/referer.wml
index
3c6aad6
..
287e589
100644
(file)
--- a/
src/Infodrom/webstats/referer.wml
+++ b/
src/Infodrom/webstats/referer.wml
@@
-4,10
+4,13
@@
<?
define(OVERVIEW,0);
<?
define(OVERVIEW,0);
- define(DETAILS,1);
+ define(REFERER,1);
+ define(DETAILS,2);
if (isset($_GET["site"]) && isset($_GET["details"]))
$mode = DETAILS;
if (isset($_GET["site"]) && isset($_GET["details"]))
$mode = DETAILS;
+ elseif (isset($_GET["referer"]))
+ $mode = REFERER;
else
$mode = OVERVIEW;
else
$mode = OVERVIEW;
@@
-19,6
+22,14
@@
# overview
$tabhead[] =
'<table class="font height border" width="100%" cellspacing="0">
# overview
$tabhead[] =
'<table class="font height border" width="100%" cellspacing="0">
+<tr bgcolor="#<colh>"><th width="10%">Count</th><th width="90%">URLs</th></tr>';
+ $tabfoot[] = '</table>';
+ $tabrow[] = '<tr bgcolor="#%s"><td width="10%%" align="center">%d</td><td width="90%%"><a href="<get-var WML_SRC_BASENAME>.php?site=%d&details=1&url=%d">http://%s%s</a></td></tr>';
+ $refcut[] = 80;
+
+ # referer
+ $tabhead[] =
+'<table class="font height border" width="100%" cellspacing="0">
<tr bgcolor="#<colh>"><th width="10%">Count</th><th width="90%">Referer</th></tr>';
$tabfoot[] = '</table>';
$tabrow[] = '<tr bgcolor="#%s"><td width="10%%" align="center">%d</td><td width="90%%"><a href="<get-var WML_SRC_BASENAME>.php?site=%d&details=1&origin=%d" title="%s">%s</a></td></tr>';
<tr bgcolor="#<colh>"><th width="10%">Count</th><th width="90%">Referer</th></tr>';
$tabfoot[] = '</table>';
$tabrow[] = '<tr bgcolor="#%s"><td width="10%%" align="center">%d</td><td width="90%%"><a href="<get-var WML_SRC_BASENAME>.php?site=%d&details=1&origin=%d" title="%s">%s</a></td></tr>';
@@
-46,26
+57,35
@@
$site = pg_fetch_array ($sth, $nr);
if (isset($_GET["details"]) && $_GET["details"] == 1)
printf ('<h3 class="bar">%s</h3>', $site["name"]);
$site = pg_fetch_array ($sth, $nr);
if (isset($_GET["details"]) && $_GET["details"] == 1)
printf ('<h3 class="bar">%s</h3>', $site["name"]);
- else {
- if (isset($_GET["site"]))
- printf ('<h3 class="bar"><a href="<get-var WML_SRC_BASENAME>.php?site=%d&details=1">%s</a></h3>',
+ elseif (isset($_GET["referer"]) && !isset($_GET["site"]))
+ printf ('<h3 class="bar"><a href="<get-var WML_SRC_BASENAME>.php?referer=1&site=%d">%s</a></h3>',
$site["id"], $site["name"]);
$site["id"], $site["name"]);
- else
- printf ('<h3 class="bar"><a href="<get-var WML_SRC_BASENAME>.php?site=%d">%s</a></h3>',
+ elseif (isset($_GET["site"]))
+ printf ('<h3 class="bar"><a href="<get-var WML_SRC_BASENAME>.php?site=%d&details=1">%s</a></h3>',
+ $site["id"], $site["name"]);
+ else
+ printf ('<h3 class="bar"><a href="<get-var WML_SRC_BASENAME>.php?site=%d">%s</a></h3>',
$site["id"], $site["name"]);
$site["id"], $site["name"]);
- }
$color = "<coln>";
echo $tabhead[$mode];
if ($mode == OVERVIEW)
$query = sprintf (
$color = "<coln>";
echo $tabhead[$mode];
if ($mode == OVERVIEW)
$query = sprintf (
+"SELECT count(*) AS count,ref_log.url,ref_url.path
+ FROM ref_log,ref_url
+ WHERE ref_log.url = ref_url.id
+ AND ref_url.site = %d
+ GROUP BY ref_log.url,path
+ ORDER BY count DESC,path", $site["id"]);
+ elseif ($mode == REFERER)
+ $query = sprintf (
"SELECT count(*) AS count,ref_origin.url,ref_origin.title,origin
FROM ref_origin,ref_url,ref_log
WHERE ref_log.url = ref_url.id
AND ref_log.origin = ref_origin.id
AND ref_url.site = %d
GROUP BY ref_origin.url,title,origin
"SELECT count(*) AS count,ref_origin.url,ref_origin.title,origin
FROM ref_origin,ref_url,ref_log
WHERE ref_log.url = ref_url.id
AND ref_log.origin = ref_origin.id
AND ref_url.site = %d
GROUP BY ref_origin.url,title,origin
- ORDER BY count DESC", $site["id"]);
+ ORDER BY count DESC
,title
", $site["id"]);
else {
$query = sprintf (
"SELECT occurrence,ref_origin.url,title,path,ref_log.url AS urlid
else {
$query = sprintf (
"SELECT occurrence,ref_origin.url,title,path,ref_log.url AS urlid
@@
-92,9
+112,14
@@
} else {
$title = htmlentities(substr($row["url"], 0, $refcut[$mode]));
}
} else {
$title = htmlentities(substr($row["url"], 0, $refcut[$mode]));
}
+
$color = $color == "<cold>"?"<coln>" : "<cold>";
if ($mode == OVERVIEW)
$color = $color == "<cold>"?"<coln>" : "<cold>";
if ($mode == OVERVIEW)
- printf ($tabrow[$mode], $color, $row["count"], $site["id"], $row["origin"], htmlentities($row["url"]), $title);
+ printf ($tabrow[$mode], $color, $row["count"], $site["id"], $row["url"],
+ $site["name"], htmlentities($row["path"]));
+ elseif ($mode == REFERER)
+ printf ($tabrow[$mode], $color, $row["count"], $site["id"], $row["origin"],
+ htmlentities($row["url"]), $title);
else {
$date = substr($row["occurrence"], 0, 16);
if (isset($_GET["url"]))
else {
$date = substr($row["occurrence"], 0, 16);
if (isset($_GET["url"]))