Completed
Push — master ( 9db94b...c8aa88 )
by Alexey
07:41
created

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
/**
4
 * INJI CMS 4.0.0 dev
5
 *
6
 * @author Alexey Krupskiy <[email protected]>
7
 * @link http://inji.ru/
8
 * @copyright 2015 Alexey Krupskiy
9
 * @license https://github.com/injitools/cms-Inji/blob/master/LICENSE
10
 */
11
//set locale
12
setlocale(LC_ALL, 'ru_RU.UTF-8', 'rus_RUS.UTF-8', 'Russian_Russia.65001');
13
setlocale(LC_NUMERIC, 'C');
14
//default timezone
15
date_default_timezone_set('Asia/Krasnoyarsk');
16
// time start
17
define('INJI_TIME_START', microtime(true));
18
// system files dir
19
define('INJI_SYSTEM_DIR', __DIR__ . '/system');
20
// sites files dir
21
define('INJI_PROGRAM_DIR', __DIR__ . '/program');
22
23
// check base config
24
if (!file_exists(INJI_SYSTEM_DIR) || !is_dir(INJI_SYSTEM_DIR)) {
25
    INJI_SYSTEM_ERROR('Error in base config: INJI_SYSTEM_DIR not correct', true);
26
}
27
if (!file_exists(INJI_PROGRAM_DIR) || !is_dir(INJI_PROGRAM_DIR)) {
28
    INJI_SYSTEM_ERROR('Error in base config: INJI_PROGRAM_DIR not correct', true);
29
}
30
foreach ($_SERVER as $key => $item) {
31
    if (strpos($key, 'HTTP_AUTHORIZATION') != false) {
0 ignored issues
show
Bug Best Practice introduced by
It seems like you are loosely comparing strpos($key, 'HTTP_AUTHORIZATION') of type integer to the boolean false. If you are specifically checking for non-zero, consider using something more explicit like > 0 or !== 0 instead.
Loading history...
32
        $auth = explode(':', base64_decode(substr($item, 6)));
33
        $_SERVER['PHP_AUTH_USER'] = $auth[0];
34
        $_SERVER['PHP_AUTH_PW'] = isset($auth[1]) ? $auth[1] : '';
35
    }
36
}
37
38
require_once( INJI_SYSTEM_DIR . '/init.php' );
39
/**
40
 * System error messages
41
 */
42
function INJI_SYSTEM_ERROR($msg, $fatal = false)
43
{
44
    if ($fatal) {
45
        exit("<div style = 'text-align:center;font-size:20px;margin-top:25%;'>{$msg}</div>");
46
    } else {
47
        echo "<div style = 'text-align:center;font-size:20px;margin-top:25%;'>{$msg}</div>";
48
    }
49
}
50