Browse Source

more counters

pull/40/head
nonmakina 3 years ago
parent
commit
7a99f5943e
  1. 15
      templates/themes/categories/news.html
  2. 17
      templates/themes/categories/theme.php

15
templates/themes/categories/news.html

@ -37,8 +37,9 @@
<th>{% trans "Board" %}</th>
<th>{% trans "PPH" %}</th>
<th>{% trans "IPs last hour" %}</th>
<th>{% trans "IPs last 24 hours (lynxchan-style)" %}</th>
<th>{% trans "IPs last 72 hours (8ch-style)" %}</th>
<th>{% trans "IPs last 24 hours <br> (lynxchan-style)" %}</th>
<th>{% trans "IPs last 48 hours" %}</th>
<th>{% trans "IPs last 72 hours <br>(8ch-style)" %}</th>
</tr>
</thead>
<tbody>
@ -50,11 +51,14 @@
<span>{{ stats.pph }}</span>
</td>
<td class="minimal">
<span>{{ stats.recent_ips }}</span>
<span>{{ stats.hourly_ips }}</span>
</td>
<td class="minimal">
<span>{{ stats.daily_ips }}</span>
</td>
<td class="minimal">
<span>{{ stats.bidaily_ips }}</span>
</td>
<td class="minimal">
<span>{{ stats.tridaily_ips }}</span>
</td>
@ -68,11 +72,14 @@
<span>{{ boardStat.pph }}</span>
</td>
<td class="minimal">
<span>{{ boardStat.recent_ips }}</span>
<span>{{ boardStat.hourly_ips }}</span>
</td>
<td class="minimal">
<span>{{ board.daily_ips }}</span>
</td>
<td class="minimal">
<span>{{ board.bidaily_ips }}</span>
</td>
<td class="minimal">
<span>{{ board.tridaily_ips }}</span>
</td>

17
templates/themes/categories/theme.php

@ -102,10 +102,11 @@
$HOUR = 3600;
$DAY = $HOUR * 24;
$BIDAY = $DAY * 2;
$TRIDAY = $DAY * 3;
$stats = [];
$unique = [];
$hourly = [];
$daily = [];
$tridaily = [];
@ -118,9 +119,10 @@
$boardStat['title'] = $_board['title'];
$boardStat['hourly_ips'] = Categories::countUniqueIps($unique, $HOUR, $_board);
$boardStat['daily_ips'] = Categories::countUniqueIps($unique, $DAY, $_board);
$boardStat['tridaily_ips'] = Categories::countUniqueIps($unique, $TRIDAY, $_board);
$boardStat['hourly_ips'] = Categories::countUniqueIps($hourly, $HOUR, $_board);
$boardStat['daily_ips'] = Categories::countUniqueIps($daily, $DAY, $_board);
$boardStat['bidaily_ips'] = Categories::countUniqueIps($bidaily, $BIDAY, $_board);
$boardStat['tridaily_ips'] = Categories::countUniqueIps($tridaily, $TRIDAY, $_board);
$pph_query = query(
sprintf("SELECT COUNT(*) AS count FROM ``posts_%s`` WHERE time > %d",
@ -133,9 +135,10 @@
$stats['boards'][] = $boardStat;
}
$stats['hourly_ips'] = count($unique);
$stats['daily_ips'] = count($unique);
$stats['tridaily_ips'] = count($unique);
$stats['hourly_ips'] = count($hourly);
$stats['daily_ips'] = count($daily);
$stats['bidaily_ips'] = count($bidaily);
$stats['tridaily_ips'] = count($tridaily);
$stats['pph'] = array_sum(array_column($stats['boards'], 'pph'));
return $stats;

Loading…
Cancel
Save