8
|
1 |
<?php
|
|
2 |
require('../stats-fe.php');
|
|
3 |
require('../timezone.php');
|
|
4 |
require('../config.php');
|
|
5 |
|
|
6 |
$channels = array_keys($stats_data['messages']);
|
|
7 |
$first_channel = $channels[0];
|
|
8 |
$channel = ( isset($_REQUEST['channel']) && isset($stats_data['messages'][$_REQUEST['channel']]) ) ? $_REQUEST['channel'] : $first_channel;
|
|
9 |
?>
|
|
10 |
|
|
11 |
<html>
|
|
12 |
<head>
|
|
13 |
<title><?php echo $nick; ?> - Statistics</title>
|
|
14 |
<style type="text/css">
|
|
15 |
div.footer {
|
|
16 |
font-size: smaller;
|
|
17 |
padding-top: 10px;
|
|
18 |
margin-top: 10px;
|
|
19 |
border-top: 1px solid #aaa;
|
|
20 |
}
|
|
21 |
</style>
|
|
22 |
</head>
|
|
23 |
<body>
|
|
24 |
<div style="float: right;">
|
|
25 |
<p>
|
|
26 |
<?php
|
|
27 |
$tz_display = str_replace('_', ' ', str_replace('/', ': ', $tz));
|
|
28 |
echo 'Time zone: ' . $tz_display . ' [<a href="changetz.php">change</a>]<br />';
|
15
|
29 |
echo '<small>The time now is ' . date('H:i:s') . '.<br />Statistics last written to disk at ' . date('H:i:s', stats_last_updated()) . '.</small>';
|
8
|
30 |
?>
|
|
31 |
</p>
|
|
32 |
<p>
|
|
33 |
<big><b>Channels:</b></big><br />
|
|
34 |
<?php
|
|
35 |
foreach ( $channels as $i => $c )
|
|
36 |
{
|
|
37 |
$bold = ( $c == $channel );
|
|
38 |
echo $bold ? '<b>' : '';
|
|
39 |
echo $bold ? '' : '<a href="index.php?channel=' . urlencode($c) . '">';
|
|
40 |
echo $c;
|
|
41 |
echo $bold ? '' : '</a>';
|
|
42 |
echo $bold ? '</b>' : '';
|
|
43 |
echo $i == count($channels) - 1 ? '' : ' | ';
|
|
44 |
}
|
|
45 |
?>
|
|
46 |
</p>
|
|
47 |
</div>
|
|
48 |
<h1>Active members</h1>
|
|
49 |
<p>For the last 1, 5, and 15 minutes:
|
|
50 |
<?php echo count(stats_activity_percent($channel, 1)) . ', ' .
|
|
51 |
count(stats_activity_percent($channel, 5)) . ', ' .
|
|
52 |
count(stats_activity_percent($channel, 15)) . ' (respectively)';
|
|
53 |
?>
|
|
54 |
</p>
|
|
55 |
<h1>Currently active members:</h1>
|
|
56 |
<p>These people have posted in the last 3 minutes:</p>
|
|
57 |
<ul>
|
|
58 |
<?php
|
|
59 |
$datum = stats_activity_percent($channel, 3);
|
|
60 |
$count = stats_message_count($channel, 3);
|
|
61 |
if ( empty($datum) )
|
|
62 |
echo '<li>No recent posts.</li>';
|
11
|
63 |
foreach ( $datum as $usernick => $pct )
|
8
|
64 |
{
|
|
65 |
$total = round($pct * $count);
|
|
66 |
$pct = round(100 * $pct, 1);
|
11
|
67 |
echo "<li>$usernick - $pct% ($total)</li>\n";
|
8
|
68 |
}
|
|
69 |
?>
|
|
70 |
</ul>
|
|
71 |
<p>Last 20 minutes:</p>
|
|
72 |
<ul>
|
|
73 |
<?php
|
|
74 |
$datum = stats_activity_percent($channel, 20);
|
|
75 |
$count = stats_message_count($channel, 20);
|
|
76 |
if ( empty($datum) )
|
|
77 |
echo '<li>No recent posts.</li>';
|
11
|
78 |
foreach ( $datum as $usernick => $pct )
|
8
|
79 |
{
|
|
80 |
$total = round($pct * $count);
|
|
81 |
$pct = round(100 * $pct, 1);
|
11
|
82 |
echo "<li>$usernick - $pct% ($total)</li>\n";
|
8
|
83 |
}
|
|
84 |
?>
|
|
85 |
</ul>
|
|
86 |
<h1>Last 24 hours</h1>
|
|
87 |
<img alt="Graph image" src="24hours.php?channel=<?php echo urlencode($channel); ?>" />
|
|
88 |
|
|
89 |
<div class="footer">
|
|
90 |
<b><?php echo $nick; ?> is a privacy-respecting bot.</b> <a href="privacy.php">Read about what information <?php echo $nick; ?> collects</a>
|
|
91 |
</div>
|
|
92 |
</body>
|
|
93 |
</head>
|