forked from e-dimensionz/Todoyu-PHP7.x
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
78 lines (64 loc) · 2.14 KB
/
index.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
<?php
/****************************************************************************
* todoyu is published under the BSD License:
* http://www.opensource.org/licenses/bsd-license.php
*
* Copyright (c) 2012, snowflake productions GmbH, Switzerland
* All rights reserved.
*
* This script is part of the todoyu project.
* The todoyu project is free software; you can redistribute it and/or modify
* it under the terms of the BSD License.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the BSD License
* for more details.
*
* This copyright notice MUST APPEAR in all copies of the script.
*****************************************************************************/
// Measure processing time
define('TIME_START', microtime(true));
try {
// Include global include file
require_once('core/inc/global.php');
// Load default init script
require_once('core/inc/init.php');
// Send "no cache" header
TodoyuHeader::sendNoCacheHeaders();
TodoyuHeader::sendTypeHTML();
// Start output buffering
ob_start();
// Load all boot.php files of the installed extensions
TodoyuExtensions::loadAllBoot();
// Define request vars as constants
TodoyuRequest::initRequest();
// Load all init.php files of the installed extensions
TodoyuExtensions::initExtensions();
// Process sharing token if any
if( TodoyuTokenManager::hasRequestToken() ) {
$hash = TodoyuTokenManager::geTokenHashValueFromRequest();
die(TodoyuTokenCallbackManager::getCallbackResultByHash($hash));
}
// Dispatch request to selected controller
TodoyuActionDispatcher::dispatch();
// Measure processing time
define('TIME_END', microtime(true));
define('TIME_TOTAL', TIME_END - TIME_START);
// Send output
ob_end_flush();
} catch(TodoyuException $e) {
ob_end_clean();
TodoyuDebug::printFatalExceptionPage($e);
exit();
} catch(Exception $e) {
// Remove all generated content
ob_end_clean();
if( TodoyuDebug::isActive() ) {
throw $e;
} else {
echo "Oops. A fatal error occurred. Please enable debugging to see more details";
exit();
}
}
?>