forked from zorca/zorca-cms-old
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
36 lines (30 loc) · 1.42 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
<?php
/**
* @todo Сделать режимы запуска: development, production
*/
// Проверяем версию PHP
if (version_compare($ver = PHP_VERSION, $req = '5.4.0', '<')) {
throw new \RuntimeException(sprintf('You are running PHP %s, but Zorca needs at least <strong>PHP %s</strong> to run.', $ver, $req));
}
// Устанавливаем временную зону по-умолчанию, на случай, если она не установлена в php.ini
date_default_timezone_set(@date_default_timezone_get());
// Проверяем установлено ли расширение mbstring
if (!extension_loaded('mbstring')) {
throw new \RuntimeException("'mbstring' extension is not loaded. This is required for Zorca to run correctly");
}
mb_internal_encoding('UTF-8');
// Определяем базовую папку сервера
define('DS', '/');
define('BASE', str_replace(DIRECTORY_SEPARATOR, DS, __DIR__ . DS));
define('APP', BASE . 'app' . DS);
define('DATA', BASE . 'data' . DS);
define('PUB', BASE . 'pub' . DS);
// Проверяем, установлены ли необходимые библиотеки
$autoload = __DIR__ . '/vendor/autoload.php';
if (!is_file($autoload)) {
throw new \RuntimeException('Please run: <i>composer install</i>');
}
// Подгружаем библиотеки
require_once $autoload;
// Запускаем движок
$zorca = new Zorca\Zorca();