forked from AppStateESS/canopy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
65 lines (56 loc) · 1.98 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
<?php
/**
* Main file for loading Canopy. Loads configuration
* and creates inital object to start execution.
*
* @link http://Canopy.appstate.edu/
* @package phpws
* @author Matthew McNaney <mcnaneym dot appstate dot edu>,
* @author Hilmar Runge <hi at dc4db dot net>
* @author Jeremy Booker <jbooker at tux dot appstate dot edu>
* @license http://opensource.org/licenses/gpl-3.0.html GNU GPLv3
* @copyright Copyright 2013, Appalachian State University & Contributors
*/
/* * **
* Begin output buffering right away.
* This is important to prevent stray output
* from being included in AJAX/JSON responses.
*/
ob_start();
/**
* Include the defines used in Global library
*/
if (is_file('config/core/config.php')) {
require_once 'config/core/config.php';
} else {
$url = 'http://' . $_SERVER['HTTP_HOST'] . str_replace('index.php', '', $_SERVER['PHP_SELF']) . 'setup/index.php';
echo 'Configuration file not found. <a href="' . $url . '">Continue to setup</a>.';
exit();
}
require_once(PHPWS_SOURCE_DIR . 'src/Bootstrap.php');
if (!defined('PHPWS_SOURCE_HTTP')) {
require_once PHPWS_SOURCE_DIR . 'config/core/source.php';
}
if (!\phpws\PHPWS_Core::checkBranch()) {
throw new \Exception('Unknown branch called');
}
\phpws\PHPWS_Core::checkOverpost();
\phpws\PHPWS_Core::setLastPost();
\Canopy\Log::loadTimeZone();
$request = \Canopy\Server::getCurrentRequest();
$controller = new \Canopy\CanopyController();
$controller->execute($request);
/**
* "BG Mode" - Used to echo raw output from the session,
* usually for AJAX requests contaning JSON.
* @deprecated - Will be removed in the next *major* release (version 2.0.0).
* @see ModuleController
*/
if (isset($_SESSION['BG'])) {
ob_end_clean(); // Stop output buffering and clear the buffer, without outputting anything
echo $_SESSION['BG']; // Echo any json data from the session
unset($_SESSION['BG']); // Clear the session'd data (for next request)
} else {
ob_end_flush();
}
PHPWS_unBootstrap();