1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
use XoopsModules\Statistics\Utility; |
4
|
|
|
|
5
|
|
|
require_once dirname(dirname(__DIR__)) . '/mainfile.php'; |
6
|
|
|
$GLOBALS['xoopsOption']['template_main'] = 'hits.tpl'; |
7
|
|
|
require_once XOOPS_ROOT_PATH . '/header.php'; |
8
|
|
|
//require_once __DIR__ . '/include/statutils.php'; |
9
|
|
|
|
10
|
|
|
$now = date('d-m-Y'); |
11
|
|
|
$dot = explode('-', $now); |
12
|
|
|
$nowdate = $dot[0]; |
13
|
|
|
$nowmonth = $dot[1]; |
14
|
|
|
$nowyear = $dot[2]; |
15
|
|
|
|
16
|
|
|
$xoopsTpl->assign('lang_stat_hitdetail', STATS_BHITDETAIL); |
17
|
|
|
$xoopsTpl->assign('lang_stat_thissite', $_SERVER['HTTP_HOST']); |
18
|
|
|
|
19
|
|
|
$result = $xoopsDB->queryF('SELECT count FROM ' . $xoopsDB->prefix('counter') . " WHERE type='totalblocked'"); |
20
|
|
|
[$count] = $xoopsDB->fetchRow($result); |
21
|
|
|
$xoopsTpl->assign('lang_stat_recvtotal', $count); |
22
|
|
|
|
23
|
|
|
$xoopsTpl->assign('lang_stat_werereceived', STATS_WERERECEIVED); |
24
|
|
|
$xoopsTpl->assign('lang_stat_pageviews', STATS_BLOCKEDREQUESTS); |
25
|
|
|
$xoopsTpl->assign('lang_stat_todayis', STATS_TODAYIS); |
26
|
|
|
$xoopsTpl->assign('lang_stat_nowdate', "$nowmonth/$nowdate/$nowyear"); |
27
|
|
|
|
28
|
|
|
$result = $xoopsDB->queryF('SELECT year, month, hits FROM ' . $xoopsDB->prefix('stats_blockedmonth') . ' ORDER BY hits DESC LIMIT 0,1'); |
29
|
|
|
[$year, $month, $hits] = $xoopsDB->fetchRow($result); |
30
|
|
|
$month = Utility::getMonth($month); |
31
|
|
|
$xoopsTpl->assign('lang_stat_mostmonth', STATS_MOSTMONTH); |
32
|
|
|
$xoopsTpl->assign('lang_stat_mmdata', "$month $year ($hits " . STATS_HITS . ')'); |
33
|
|
|
|
34
|
|
|
$result = $xoopsDB->queryF('SELECT year, month, date, hits FROM ' . $xoopsDB->prefix('stats_blockeddate') . ' ORDER BY hits DESC LIMIT 0,1'); |
35
|
|
|
[$year, $month, $date, $hits] = $xoopsDB->fetchRow($result); |
36
|
|
|
$month = Utility::getMonth($month); |
37
|
|
|
$xoopsTpl->assign('lang_stat_mostday', STATS_MOSTDAY); |
38
|
|
|
$xoopsTpl->assign('lang_stat_mddata', "$month $date, $year ($hits " . STATS_HITS . ')'); |
39
|
|
|
|
40
|
|
|
$result = $xoopsDB->queryF('SELECT year, month, date, hour, hits FROM ' . $xoopsDB->prefix('stats_blockedhour') . ' ORDER BY hits DESC LIMIT 0,1'); |
41
|
|
|
[$year, $month, $date, $hour, $hits] = $xoopsDB->fetchRow($result); |
42
|
|
|
$month = Utility::getMonth($month); |
43
|
|
|
$hour = ($hour < 10 ? "0$hour:00 - 0$hour:59" : "$hour:00 - $hour:59"); |
44
|
|
|
$xoopsTpl->assign('lang_stat_mosthour', STATS_MOSTHOUR); |
45
|
|
|
$xoopsTpl->assign('lang_stat_mhdata', "$hour " . STATS_ON . " $month $date, $year ($hits " . STATS_HITS . ')'); |
46
|
|
|
|
47
|
|
|
$l_size = getimagesize('assets/images/leftbar.gif'); |
48
|
|
|
$m_size = getimagesize('assets/images/mainbar.gif'); |
49
|
|
|
$r_size = getimagesize('assets/images/rightbar.gif'); |
50
|
|
|
|
51
|
|
|
// get year stats and display |
52
|
|
|
$resulttotal = $xoopsDB->queryF('SELECT sum(hits) AS totalhitsyear FROM ' . $xoopsDB->prefix('stats_blockedyear')); |
53
|
|
|
[$totalhitsyear] = $xoopsDB->fetchRow($resulttotal); |
|
|
|
|
54
|
|
|
$xoopsDB->freeRecordSet($resulttotal); |
55
|
|
|
$result = $xoopsDB->queryF('SELECT year,hits FROM ' . $xoopsDB->prefix('stats_blockedyear') . ' ORDER BY year'); |
56
|
|
|
$xoopsTpl->assign('lang_stat_yearlystats', STATS_BLOCKEDYEARLYSTATS); |
57
|
|
|
$xoopsTpl->assign('lang_stat_yearhead', STATS_YEAR); |
58
|
|
|
$xoopsTpl->assign('lang_stat_pagesviewed', STATS_BLOCKEDPAGES); |
59
|
|
|
$yearlist = []; |
60
|
|
|
$i = 0; |
61
|
|
|
while (list($year, $hits) = $xoopsDB->fetchRow($result)) { |
62
|
|
|
$yearlist[$i]['year'] = $year; |
63
|
|
|
$yearlist[$i]['hits'] = $hits; |
64
|
|
|
if ($year != $nowyear) { |
65
|
|
|
$yearlist[$i]['link'] = "<a href=\"statdetails.php?op=b_yearlystats&year=$year\">$year</a>"; |
66
|
|
|
} else { |
67
|
|
|
$yearlist[$i]['link'] = ''; |
68
|
|
|
} |
69
|
|
|
$midbarsize = mb_substr(100 * $hits / $count, 0, 5); |
70
|
|
|
$yearlist[$i]['percent'] = $midbarsize . '%'; |
71
|
|
|
$yearlist[$i]['graph'] = "<img src=\"assets/images/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" Alt=\"$year - $hits\"><img src=\"assets/images/mainbar.gif\" Alt=\"$year - $hits\" height=\"$m_size[1]\" width=\"$midbarsize\"><img src=\"assets/images/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" Alt=\"$year - $hits\">"; |
72
|
|
|
++$i; |
73
|
|
|
} |
74
|
|
|
$xoopsDB->freeRecordSet($result); |
75
|
|
|
$xoopsTpl->assign('yearlist', $yearlist); |
76
|
|
|
|
77
|
|
|
Utility::getBlockedMonthlyStats($nowyear); |
78
|
|
|
Utility::getBlockedDailyStats($nowyear, $nowmonth); |
79
|
|
|
Utility::getBlockedHourlyStats($nowyear, $nowmonth, $nowdate); |
80
|
|
|
|
81
|
|
|
require_once XOOPS_ROOT_PATH . '/footer.php'; |
82
|
|
|
|