forked from rivets/framework2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
executable file
·36 lines (32 loc) · 1.3 KB
/
index.php
File metadata and controls
executable file
·36 lines (32 loc) · 1.3 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
<?php
/**
* Main entry point of the system
*
* @author Lindsay Marshall <lindsay.marshall@ncl.ac.uk>
* @copyright 2012-2020 Newcastle University
*/
/**
* See the information at
*
* @link https://catless.ncl.ac.uk/framework/
*/
define('REDBEAN_MODEL_PREFIX', '\\Model\\');
include 'class/config/framework.php';
\Config\Framework::initialise();
\Config\Config::setup(); // add default headers etc. - anything that the user choses to add to the code.
$local = \Framework\Local::getinstance()->setup(__DIR__, FALSE, TRUE, TRUE, TRUE); // Not Ajax, developer mode on, load twig, load RB
$context = \Support\Context::getinstance()->setup();
$local->enabledebug(); // turn debugging on
$mfl = $local->makebasepath('maintenance'); // maintenance mode indicator file
if (file_exists($mfl) && !$context->hasadmin())
{ // only let administrators in as we are doing maintenance. Could have a similar feature for other roles
$context->web()->sendtemplate('support/maintenance.twig', \Framework\Web\StatusCodes::HTTP_OK, 'text/html', ['msg' => file_get_contents($mfl)]);
exit;
}
$action = $context->action();
if ($action === '')
{ // default to home if there is nothing
$action = 'home';
}
\Framework\Dispatch::handle($context, $action);
?>