forked from hollpee-builder/builder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
executable file
·66 lines (55 loc) · 2.07 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
<?php
ob_start();
//подключаем константы
include_once $_SERVER['DOCUMENT_ROOT'].'/application/cons.php';
header('Content-Type: text/html; charset=utf-8');
//запускаем сессию
session_start();
/********************************************************************************/
$LANGUAGES = 'ru';
$FILE_NAME = preg_match( "/^\/editor/", $_SERVER['REQUEST_URI']) ? 'editor' : 'admin';
$FILE_NAME .= '_' . $LANGUAGES;
$FILE_LANGUAGES_DIR = '/languages/' . $LANGUAGES;
$FILE_LANGUAGES_PATH = $FILE_LANGUAGES_DIR . '/' . $FILE_NAME;
$FILE_LANGUAGES_PATH_PHP = $_SERVER['DOCUMENT_ROOT'] . $FILE_LANGUAGES_PATH . '.php';
if (!file_exists($FILE_LANGUAGES_PATH_PHP)) {
$FILE_LANGUAGES_PATH = '/languages/eng/' . $FILE_NAME;
$FILE_LANGUAGES_PATH_PHP = $_SERVER['DOCUMENT_ROOT'] . $FILE_LANGUAGES_PATH . '.php';
}
require_once $FILE_LANGUAGES_PATH_PHP;
define("FILE_LANGUAGES_MAIN", $FILE_LANGUAGES_DIR . '/main_' . $LANGUAGES . '.js');
define("FILE_LANGUAGES_JS", $FILE_LANGUAGES_PATH . '.js');
/*********************************************************************************/
//список папок
$list_path = array(
'/application/controllers/',
'/application/models/',
'/application/views/',
'/application/models/main/',
'/application/models/db/',
'/application/models/formatPage/',
);
//подключение файла
function __autoload($class)
{
global $list_path;
foreach ($list_path as $v) {
//путь файла
$pathFile = $_SERVER['DOCUMENT_ROOT'].$v.$class.'.php';
//подключаем фаил
if (file_exists($pathFile)) {
require_once $pathFile;
//ставим статус для окончания циклов
$status_break = 1;
break;
}
}
}
// создаем объект
$front = FrontController::getInstance();
// разбираем url и запускаем класс с методом
$front->route();
// выводим результат
echo $front->getBody();
$result = ob_get_clean();
echo trim($result);