Completed
Push — master ( 55a9f3...13acd2 )
by Alexey
05:06
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
1 ignored issue
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 17 and the first side effect is on line 12.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
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) {
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