-
Notifications
You must be signed in to change notification settings - Fork 33
/
cache_stats.php
48 lines (42 loc) · 2.51 KB
/
cache_stats.php
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
<?php
use src\Utils\Database\OcDb;
use src\Models\GeoCache\GeoCache;
use src\Models\ApplicationContainer;
require_once(__DIR__.'/lib/common.inc.php');
$loggedUser = ApplicationContainer::GetAuthorizedUser();
if (!$loggedUser) {
$target = urlencode(tpl_get_current_page());
tpl_redirect('login.php?target=' . $target);
exit;
}
// check for old-style parameters
if (isset($_REQUEST['cacheid'])) {
$cache_id = (int) $_REQUEST['cacheid'];
} else {
$cache_id = 0;
}
$geoCache = new GeoCache(array('cacheId' => $cache_id));
$tplname = 'cache_stats';
$content = "";
$cachename = $geoCache->getCacheName();
tpl_set_var('cachename', $cachename);
$cachetime = $geoCache->getDatePlaced()->format('Y');
$db = OcDb::instance();
$rsGeneralStatQuery = 'SELECT count(*) count FROM `cache_logs` WHERE cache_logs.deleted=0 AND (type=1 OR type=2) AND cache_id=:1 ';
$dbResult = $db->multiVariableQueryValue($rsGeneralStatQuery, 0, $cache_id);
if ($dbResult == 0) {
$content .= '<p> </p><p style="background-color: #FFFFFF; margin: 0px; padding: 0px; color: rgb(88,144,168); font-weight: bold; font-size: 14px;">' . $cachename . '<br /> <br />nie ma jeszcze statystyki</b></p>';
} else {
$content .='<center><p style="background-color: #FFFFFF; margin: 0px; padding: 0px; color: rgb(88,144,168); font-weight: bold; font-size: 14px;">' . tr("stat_geocache") . ': ' . $cachename . '<br /></p>';
$content .= '<p style="background-color: #FFFFFF; "><img src="graphs/PieGraphcstat.php?cacheid=' . $cache_id . '" border="0" alt="Statystyka skrzynki" width="400" height="200" /><br /><br />';
$year = date("Y");
$content .= '<img src="graphs/BarGraphcstatM.php?cacheid=' . $cache_id . '&t=csm' . $year . '" border="0" alt="" width="400" height="200" /><br /><br />';
if ($cachetime != $year) {
$yearr = $year - 1;
$content .= '<img src="graphs/BarGraphcstatM.php?cacheid=' . $cache_id . '&t=csm' . $yearr . '" border="0" alt="" width="400" height="200" /><br /><br />';
}
$content .= '<img src="graphs/BarGraphcstat.php?cacheid=' . $cache_id . '&t=csy" border="0" alt="" width="400" height="200" /><br /><br /><br /></p></center>';
}
tpl_set_var('content', $content);
tpl_set_var('bodyMod', ' bgcolor="#FFFFFF" style="border:none"');
tpl_BuildTemplate(true);