forked from 99kocms/99ko-v4-v5
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathindex.php
46 lines (40 loc) · 1.27 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
<?php
/**
* @copyright (C) 2024, 299Ko, based on code (2010-2021) 99ko https://github.com/99kocms/
* @license https://www.gnu.org/licenses/gpl-3.0.en.html GPLv3
* @author Jonathan Coulet <j.coulet@gmail.com>
* @author Maxence Cauderlier <mx.koder@gmail.com>
* @author Frédéric Kaplon <frederic.kaplon@me.com>
* @author Florent Fortat <florent.fortat@maxgun.fr>
*
* @package 299Ko https://github.com/299Ko/299ko
*/
const ROOT = './';
include_once(ROOT . 'common/common.php');
if (!$core->isInstalled()) {
header('location:' . ROOT . 'install.php');
die();
}
define('IS_LOGGED', UsersManager::isLogged());
// For futures versions
define('IS_ADMIN', IS_LOGGED);
Template::addGlobal('IS_LOGGED', IS_LOGGED);
Template::addGlobal('IS_ADMIN', IS_ADMIN);
$match = $router->match();
if (is_array($match)) {
if ($runPlugin) {
$runPlugin->loadControllers();
}
list($controller, $action) = explode('#', $match['target']);
if (method_exists($controller, $action)) {
$obj = new $controller();
$core->callHook('beforeRunPlugin');
$response = call_user_func_array([$obj,$action], $match['params']);
echo $response->output();
die();
} else {
// unreachable target
$core->error404();
}
}
$core->error404();