-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtotal.php
More file actions
71 lines (54 loc) · 1.87 KB
/
total.php
File metadata and controls
71 lines (54 loc) · 1.87 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
/*----Import libs----*/
require_once dirname(__FILE__)."/Html.php";
require_once dirname(__FILE__)."/Stier.php";
require_once dirname(__FILE__)."/lib/SiteContext.php";
require_once dirname(__FILE__)."/lib/StatSite.php";
require_once dirname(__FILE__)."/lib/Localizer.php";
/*----Init vars----*/
//Paths and options.
$settings = new Stier();
//Get site parameters.
$http_vars = Html::setPostOrGetVars($_POST, $_GET);
//Instantierer klassen med standardkode
$datasource = DataSource::createCollectiveReader($settings);
$lib = new Html($http_vars, $datasource);
//Make a SiteContext (in da=danish)
$siteContext = new SiteContext($lib, $settings, $http_vars, 'da');
$lib->setSiteContext($siteContext);
$lib->setStier($settings);
//Sets the code lib in the site context
$siteContext->setCodeLib($lib);
//Show index or stat site?
$dateInfo = Html::getDateFromPathinfo();
if (count($dateInfo) === 0) {
//instantiate the stat site with the default type.
$indexSite = new CollectiveIndex($siteContext, '');
//Generate HTML
$pageHtml = $indexSite->generateSiteCached();
$indexSite->outputHeaders();
//Tell the browser much there is.
header("Content-Length: ".strlen($pageHtml));
//And send it.
echo $pageHtml;
exit(0);
} else {
//Make a general useable stat request.
$unique = 0; //Show non unique visits.
$startTime = $dateInfo['time'];
$endTime = $dateInfo['end'];
$statReq = new CollectiveStatRequest('', $unique, $startTime, $endTime);
//Currently this class only supports data from total
$statReq->setGroupby('total');
//instantiate the stat site with the default type.
$statSite = new CollectiveStatSite($siteContext, '');
//Generate HTML
$pageHtml = $statSite->generateSiteCached($statReq);
$statSite->outputHeaders();
//Tell the browser much there is.
header("Content-Length: ".strlen($pageHtml));
//And send it.
echo $pageHtml;
exit(0);
}
?>