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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
|
<?php
# This file is part of BBClone (The PHP web counter on steroids)
# $Header: /cvs/bbclone/show_detailed.php,v 1.77 2005/02/21 00:31:16 olliver Exp $
# Copyright (C) 2001-2005, the BBClone Team (see file doc/authors.txt
# distributed with this library)
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# See doc/copying.txt for details
# Check for PHP 4.0.3 or older
if (!function_exists("array_sum")) exit("<hr /><b>Error:</b> PHP ".PHP_VERSION." is too old for BBClone.");
elseif (is_readable("constants.php")) require_once("constants.php");
else return;
foreach (array($BBC_CONFIG_FILE, $BBC_LIB_PATH."selectlang.php", $BBC_LAST_FILE) as $i) {
if (is_readable($i)) require_once($i);
else exit(bbc_msg($i));
}
# Functions
# returns the full name and icon from a given cat/item combination
function bbc_finger_cat($cat, $name) {
global $BBC_LIB_PATH;
if (is_readable($BBC_LIB_PATH.$cat.".php")) require($BBC_LIB_PATH.$cat.".php");
else return bbc_msg($BBC_LIB_PATH.$cat.".php");
for ($i = 0, $j = count($$cat); $i < $j; $i++) {
$line = explode("%", ${$cat}[$i]);
if ($name === $line[0]) return array($line[1], $line[2]);
}
return false;
}
# generates the contents of each field in the detailed stats
function bbc_show_connect_field($connect, $field, $lng, $titles = false) {
global $BBC_IMAGES_PATH, $_;
$id = empty($connect['id']) ? 0 : $connect['id'];
switch ($field) {
case "id":
return "<div align=\"right\">".$connect[$field]." </div>\n";
case "time":
return "<div align=\"right\">".str_replace(" ", " ", date("j M, H:i:s", $connect[$field]))." </div>\n";
case "visits":
return "<div align=\"right\"><a href=\"show_views.php?id=$id&lng=$lng\" target=\"_blank\">".$connect[$field]
."</a> </div>\n";
case "ext":
return "<div align=\"left\"> <img src=\"".$BBC_IMAGES_PATH."ext_".$connect[$field].".png\" height=\"14\" "
."width=\"14\" alt=\"".$_[$connect['ext']]."\" title=\"".$_[($connect[$field])]."\" /> "
.$_[($connect[$field])]."</div>";
case "dns":
if (strlen($connect[$field]) > 50) $connect[$field] = "...".substr($connect[$field], -47);
return "<div align=\"left\"> ".$connect[$field]."</div>";
case "referer":
if ($connect[$field] == "ignored") return " ".$_['misc_ignored'];
if (strpos($connect[$field], "://") === false) return " ";
$url = substr(strstr($connect[$field], "://"), 3);
$str = (($slash = strpos($url, "/")) !== false) ? substr($url, 0, $slash) : $url;
$str = (strlen($str) > 50) ? "...".substr($str, -47) : $str;
return "<div align=\"left\"> <a href=\"redir.php?rd=".rawurlencode($url)."\" rel=\"nofollow\" "
."target=\"_blank\" title=\"".$connect[$field]."\">$str</a></div>";
case "browser":
if (!empty($connect['robot'])) return bbc_show_connect_field($connect, "robot", $lng);
if (!$type = bbc_finger_cat("browser", $connect[$field])) return " ";
$type[1] = ($type[1] == "other") ? str_replace("other", $_['misc_other'], $type[1]) : $type[1];
return "<div align=\"left\"> "
."<img src=\"".$BBC_IMAGES_PATH."browser_".$type[0].".png\" height=\"14\" width=\"14\" alt=\"".$type[1]
."\" title=\"".$type[1]."\" />"
." ".str_replace(" ", " ", $type[1]).(empty($connect['browser_note']) ? "" : " "
.$connect['browser_note'])."</div>";
case "os":
if (!empty($connect['robot'])) return bbc_show_connect_field($connect,"robot", $lng);
if (!$type = bbc_finger_cat("os", $connect[$field])) return " ";
$type[1] = ($type[1] == "other") ? str_replace("other", $_['misc_other'], $type[1]) : $type[1];
return "<div align=\"left\"> "
."<img src=\"".$BBC_IMAGES_PATH."os_".$type[0].".png\" height=\"14\" width=\"14\" alt=\"".$type[1]
."\" title=\"".$type[1]."\" />"
." ".str_replace(" ", " ", $type[1]).(empty($connect['os_note']) ? "" : " "
.$connect['os_note'])."</div>";
case "robot":
if (!$type = bbc_finger_cat("robot", $connect[$field])) return " ";
return "<div align=\"left\"> "
."<img src=\"".$BBC_IMAGES_PATH."robot_".$type[0].".png\" height=\"14\" width=\"14\" alt=\"".$type[1]
."\" title=\"".$type[1]."\" />"
." ".str_replace(" ", " ", $type[1]).(empty($connect['robot_note']) ? "" : " "
.$connect['robot_note'])."</div>";
case "page":
if (!isset($connect[$field])) return " ";
$last_page = $titles[($connect[$field])];
$last_page = ($last_page == "index") ? $_["navbar_Main_Site"] : $last_page;
return "<div align=\"left\"> $last_page</div>";
default:
if (!isset($connect[$field]) || ($connect[$field] == "-")) return " ";
return "<div align=\"left\"> ".$connect[$field]."</div>";
}
}
# generates each row of the detailed stats
function bbc_rows_gen() {
global $_, $BBC_DETAILED_STAT_FIELDS, $BBC_MAXVISIBLE, $bbc_html, $last;
$fields_title = array(
"browser" => $_['dstat_browser'],
"dns" => $_['dstat_dns'],
"ext" => $_['dstat_extension'],
"id" => $_['dstat_id'],
"ip" => $_['dstat_ip'],
"os" => $_['dstat_os'],
"page" => $_['dstat_last_page'],
"prx_ip" => $_['dstat_prx'],
"referer" => $_['dstat_from'],
"search" => $_['dstat_search'],
"time" => $_['dstat_time'],
"visits" => $_['dstat_visits'],
);
$fields = explode(",", str_replace(" ", "", $BBC_DETAILED_STAT_FIELDS));
$nb_access = isset($last['traffic']) ? count($last['traffic']) : 0;
$str = "<tr>\n";
foreach ($fields as $val) $str .= "<td class=\"head\">".$fields_title[$val]."</td>\n";
$str .= "</tr>\n";
for ($k = $nb_access - 1; $k >= max(0, $nb_access - $BBC_MAXVISIBLE); $k--) {
$hex = $bbc_html->connect_code_color($last['traffic'][$k]);
$str .= "<tr style=\"background-color: $hex\" onmouseover=\"this.style.backgroundColor='#ffffff'\" "
."onmouseout=\"this.style.backgroundColor='$hex'\">\n";
reset($fields);
while (list(, $val) = each($fields)) {
$cell = bbc_show_connect_field($last['traffic'][$k], $val, $bbc_html->lng, $last['pages']);
$str .= "<td class=\"rows\">".(empty($cell) ? " " : $cell)."</td>\n";
}
$str .= "</tr>\n";
}
return $str;
}
# MAIN
echo $bbc_html->html_begin()
.$bbc_html->topbar()
.$bbc_html->color_explain()
."<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\" width=\"100%\">\n"
."<tr>\n<td class=\"detbox\" align=\"center\" valign=\"middle\">\n"
."<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\" width=\"100%\">\n"
.bbc_rows_gen()
."</table>\n"
."</td>\n</tr>\n</table>\n"
.$bbc_html->copyright()
.$bbc_html->topbar(0, 1)
.$bbc_html->html_end();
?>
|