-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
50 lines (42 loc) · 1.12 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
<?php
session_start();
$_SESSION['Auth']=1;
require_once __DIR__ . '/config/_global.php';
require_once __DIR__ . '/autoload.php';
require_once __DIR__ . '/vendor/autoload.php';
try {
\App\Core\Auth::checkAuth();
} catch (Exception $e) {
echo $e->getMessage();
return 0;
}
$route = explode('/',$_GET['__route']);
$controller = $route[0];
$method = $route[1];
if (true == empty($controller)) {
$controller = 'App\\Controllers\\HelpDesk';
$method = 'startPoint';
}
elseif ('Login' == $controller) {
$controller = 'App\\Controllers\\Login';
if ($method == '') {
$method = 'startPoint';
}
}
elseif ('Vkauth' == $controller) {
$controller = 'App\\Controllers\\Vkauth';
$method = 'startPoint';
}
else {
$controller = 'App\\Controllers\\' . $controller;
}
try {
if (false == method_exists($controller, $method)) {
throw new Exception('<br>index:<br>Метод "'. $method. '" класса "'. $controller .'" не найден.');
}
$ctrl = new $controller();
$ctrl->$method();
}
catch (Exception $e) {
echo $e->getMessage();
}