1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* You may not change or alter any portion of this comment or credits |
4
|
|
|
* of supporting developers from this source code or any supporting source code |
5
|
|
|
* which is considered copyrighted (c) material of the original comment or credit authors. |
6
|
|
|
* |
7
|
|
|
* This program is distributed in the hope that it will be useful, |
8
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
9
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* @copyright {@link https://xoops.org/ XOOPS Project} |
14
|
|
|
* @license {@link https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later} |
15
|
|
|
* @package |
16
|
|
|
* @since |
17
|
|
|
* @author XOOPS Development Team |
18
|
|
|
*/ |
19
|
|
|
|
20
|
|
|
|
21
|
|
|
use XoopsModules\Statistics\Utility; |
22
|
|
|
|
23
|
|
|
/** @var Helper $helper */ |
24
|
|
|
|
25
|
|
|
require_once dirname(dirname(__DIR__)) . '/mainfile.php'; |
26
|
|
|
$GLOBALS['xoopsOption']['template_main'] = 'hits.tpl'; |
27
|
|
|
require_once XOOPS_ROOT_PATH . '/header.php'; |
28
|
|
|
//require_once __DIR__ . '/include/statutils.php'; |
29
|
|
|
|
30
|
|
|
$now = date('d-m-Y'); |
31
|
|
|
$dot = explode('-', $now); |
32
|
|
|
$nowdate = $dot[0]; |
33
|
|
|
$nowmonth = $dot[1]; |
34
|
|
|
$nowyear = $dot[2]; |
35
|
|
|
|
36
|
|
|
$xoopsTpl->assign('lang_stat_hitdetail', STATS_HITDETAIL); |
37
|
|
|
$xoopsTpl->assign('lang_stat_thissite', $_SERVER['HTTP_HOST']); |
38
|
|
|
|
39
|
|
|
$result = $xoopsDB->queryF('SELECT count FROM ' . $xoopsDB->prefix('counter') . " WHERE type='total'"); |
40
|
|
|
[$count] = $xoopsDB->fetchRow($result); |
41
|
|
|
$xoopsTpl->assign('lang_stat_recvtotal', $count); |
42
|
|
|
|
43
|
|
|
$xoopsTpl->assign('lang_stat_werereceived', STATS_WERERECEIVED); |
44
|
|
|
$xoopsTpl->assign('lang_stat_pageviews', STATS_PAGEVIEWS); |
45
|
|
|
$xoopsTpl->assign('lang_stat_todayis', STATS_TODAYIS); |
46
|
|
|
$xoopsTpl->assign('lang_stat_nowdate', "$nowmonth/$nowdate/$nowyear"); |
47
|
|
|
|
48
|
|
|
$result = $xoopsDB->queryF('SELECT year, month, hits FROM ' . $xoopsDB->prefix('stats_month') . ' ORDER BY hits DESC LIMIT 0,1'); |
49
|
|
|
[$year, $month, $hits] = $xoopsDB->fetchRow($result); |
50
|
|
|
$month = Utility::getMonth($month); |
51
|
|
|
$xoopsTpl->assign('lang_stat_mostmonth', STATS_MOSTMONTH); |
52
|
|
|
$xoopsTpl->assign('lang_stat_mmdata', "$month $year ($hits " . STATS_HITS . ')'); |
53
|
|
|
|
54
|
|
|
$result = $xoopsDB->queryF('SELECT year, month, date, hits FROM ' . $xoopsDB->prefix('stats_date') . ' ORDER BY hits DESC LIMIT 0,1'); |
55
|
|
|
[$year, $month, $date, $hits] = $xoopsDB->fetchRow($result); |
56
|
|
|
$month = Utility::getMonth($month); |
57
|
|
|
$xoopsTpl->assign('lang_stat_mostday', STATS_MOSTDAY); |
58
|
|
|
$xoopsTpl->assign('lang_stat_mddata', "$month $date, $year ($hits " . STATS_HITS . ')'); |
59
|
|
|
|
60
|
|
|
$result = $xoopsDB->queryF('SELECT year, month, date, hour, hits FROM ' . $xoopsDB->prefix('stats_hour') . ' ORDER BY hits DESC LIMIT 0,1'); |
61
|
|
|
[$year, $month, $date, $hour, $hits] = $xoopsDB->fetchRow($result); |
62
|
|
|
$month = Utility::getMonth($month); |
63
|
|
|
$hour = ($hour < 10 ? "0$hour:00 - 0$hour:59" : "$hour:00 - $hour:59"); |
64
|
|
|
$xoopsTpl->assign('lang_stat_mosthour', STATS_MOSTHOUR); |
65
|
|
|
$xoopsTpl->assign('lang_stat_mhdata', "$hour " . STATS_ON . " $month $date, $year ($hits " . STATS_HITS . ')'); |
66
|
|
|
|
67
|
|
|
$l_size = getimagesize('assets/images/leftbar.gif'); |
68
|
|
|
$m_size = getimagesize('assets/images/mainbar.gif'); |
69
|
|
|
$r_size = getimagesize('assets/images/rightbar.gif'); |
70
|
|
|
|
71
|
|
|
// get year stats and display |
72
|
|
|
$resulttotal = $xoopsDB->queryF('SELECT sum(hits) AS totalhitsyear FROM ' . $xoopsDB->prefix('stats_year')); |
73
|
|
|
[$totalhitsyear] = $xoopsDB->fetchRow($resulttotal); |
|
|
|
|
74
|
|
|
$xoopsDB->freeRecordSet($resulttotal); |
75
|
|
|
$result = $xoopsDB->queryF('SELECT year,hits FROM ' . $xoopsDB->prefix('stats_year') . ' ORDER BY year'); |
76
|
|
|
$xoopsTpl->assign('lang_stat_yearlystats', STATS_YEARLYSTATS); |
77
|
|
|
$xoopsTpl->assign('lang_stat_yearhead', STATS_YEAR); |
78
|
|
|
$xoopsTpl->assign('lang_stat_pagesviewed', STATS_PAGESVIEWED); |
79
|
|
|
$yearlist = []; |
80
|
|
|
$i = 0; |
81
|
|
|
while (list($year, $hits) = $xoopsDB->fetchRow($result)) { |
82
|
|
|
$yearlist[$i]['year'] = $year; |
83
|
|
|
$yearlist[$i]['hits'] = $hits; |
84
|
|
|
if ($year != $nowyear) { |
85
|
|
|
$yearlist[$i]['link'] = "<a href=\"statdetails.php?op=yearlystats&year=$year\">$year</a>"; |
86
|
|
|
} else { |
87
|
|
|
$yearlist[$i]['link'] = ''; |
88
|
|
|
} |
89
|
|
|
$midbarsize = mb_substr(100 * $hits / $count, 0, 5); |
90
|
|
|
$yearlist[$i]['percent'] = $midbarsize . '%'; |
91
|
|
|
$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\">"; |
92
|
|
|
++$i; |
93
|
|
|
} |
94
|
|
|
$xoopsDB->freeRecordSet($result); |
95
|
|
|
$xoopsTpl->assign('yearlist', $yearlist); |
96
|
|
|
|
97
|
|
|
Utility::getMonthlyStats($nowyear); |
98
|
|
|
Utility::getDailyStats($nowyear, $nowmonth); |
99
|
|
|
Utility::getHourlyStats($nowyear, $nowmonth, $nowdate); |
100
|
|
|
|
101
|
|
|
require_once XOOPS_ROOT_PATH . '/footer.php'; |
102
|
|
|
|