forked from PeeHaa/OpCacheGUI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.php
102 lines (87 loc) · 2.05 KB
/
bootstrap.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?php
/**
* Bootstrap the project
*
* PHP version 5.5
*
* @author Pieter Hordijk <[email protected]>
* @copyright Copyright (c) 2013 Pieter Hordijk <https://github.com/PeeHaa>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 1.0.0
*/
use OpCacheGUI\I18n\Translator,
OpCacheGUI\Format\Byte as ByteFormatter,
OpCacheGUI\Security\CsrfToken;
/**
* Bootstrap the library
*/
require_once __DIR__ . '/src/OpCacheGUI/bootstrap.php';
/**
* Setup error reporting
*/
error_reporting(E_ALL);
ini_set('display_errors', 1);
ini_set('log_errors', 0);
/**
* Start the session
*/
session_start();
/**
* Setup timezone
*/
ini_set('date.timezone', 'Europe/Amsterdam');
/**
* Setup the translator
*/
$translator = new Translator('en');
/**
* Setup formatters
*/
$byteFormatter = new ByteFormatter;
/**
* Setup CSRF token
*/
$csrfToken = new CsrfToken;
/**
* Setup routing
*/
$request = explode('/', $_SERVER['REQUEST_URI']);
switch(end($request)) {
case 'configuration':
ob_start();
require __DIR__ . '/template/configuration.phtml';
$content = ob_get_contents();
$active = 'config';
ob_end_clean();
break;
case 'cached-scripts':
ob_start();
require __DIR__ . '/template/cached.phtml';
$content = ob_get_contents();
$active = 'cached';
ob_end_clean();
break;
case 'graphs':
ob_start();
require __DIR__ . '/template/graphs.phtml';
$content = ob_get_contents();
$active = 'graphs';
ob_end_clean();
break;
case 'reset':
ob_start();
require __DIR__ . '/template/reset.pjson';
return;
case 'invalidate':
ob_start();
require __DIR__ . '/template/invalidate.pjson';
return;
default:
ob_start();
require __DIR__ . '/template/status.phtml';
$content = ob_get_contents();
$active = 'status';
ob_end_clean();
break;
}
require __DIR__ . '/template/page.phtml';