|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
use Vector\Vector; |
|
4
|
|
|
|
|
5
|
|
|
use Common\GlobalContainer; |
|
6
|
|
|
|
|
7
|
|
|
class classSupernova { |
|
8
|
|
|
/** |
|
9
|
|
|
* @var GlobalContainer $gc |
|
10
|
|
|
*/ |
|
11
|
|
|
public static $gc; |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* @var array $sn_mvc |
|
15
|
|
|
*/ |
|
16
|
|
|
public static $sn_mvc = array(); |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* @var array $functions |
|
20
|
|
|
*/ |
|
21
|
|
|
public static $functions = array(); |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* @var array[] $design |
|
25
|
|
|
*/ |
|
26
|
|
|
public static $design = array( |
|
27
|
|
|
'bbcodes' => array(), |
|
28
|
|
|
'smiles' => array(), |
|
29
|
|
|
); |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* Основная БД для доступа к данным |
|
33
|
|
|
* |
|
34
|
|
|
* @var db_mysql $db |
|
35
|
|
|
*/ |
|
36
|
|
|
public static $db; |
|
37
|
|
|
public static $db_name = ''; |
|
38
|
|
|
/** |
|
39
|
|
|
* @var \DBAL\DbTransaction $transaction |
|
40
|
|
|
*/ |
|
41
|
|
|
public static $transaction; |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* Настройки из файла конфигурации |
|
45
|
|
|
* |
|
46
|
|
|
* @var string $cache_prefix |
|
47
|
|
|
*/ |
|
48
|
|
|
public static $cache_prefix = ''; |
|
49
|
|
|
public static $sn_secret_word = ''; |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* Конфигурация игры |
|
53
|
|
|
* |
|
54
|
|
|
* @var classConfig $config |
|
55
|
|
|
*/ |
|
56
|
|
|
public static $config; |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* External cache |
|
60
|
|
|
* |
|
61
|
|
|
* @var classCache $cache |
|
62
|
|
|
*/ |
|
63
|
|
|
public static $cache; |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* @var core_auth $auth |
|
67
|
|
|
*/ |
|
68
|
|
|
public static $auth = null; |
|
69
|
|
|
|
|
70
|
|
|
|
|
71
|
|
|
public static $user = array(); |
|
72
|
|
|
/** |
|
73
|
|
|
* @var userOptions $user_options |
|
74
|
|
|
*/ |
|
75
|
|
|
public static $user_options; |
|
76
|
|
|
|
|
77
|
|
|
/** |
|
78
|
|
|
* @var debug $debug |
|
79
|
|
|
*/ |
|
80
|
|
|
public static $debug = null; |
|
81
|
|
|
|
|
82
|
|
|
public static $options = array(); |
|
83
|
|
|
|
|
84
|
|
|
public static function log_file($message, $spaces = 0) { |
|
85
|
|
|
if (self::$debug) { |
|
86
|
|
|
self::$debug->log_file($message, $spaces); |
|
87
|
|
|
} |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
public static function init_0_prepare() { |
|
91
|
|
|
static::$gc = new GlobalContainer(); |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
public static function init_3_load_config_file() { |
|
95
|
|
|
$dbsettings = array(); |
|
96
|
|
|
require(SN_ROOT_PHYSICAL . "config" . DOT_PHP_EX); |
|
97
|
|
|
self::$cache_prefix = !empty($dbsettings['cache_prefix']) ? $dbsettings['cache_prefix'] : $dbsettings['prefix']; |
|
98
|
|
|
self::$db_name = $dbsettings['name']; |
|
99
|
|
|
self::$sn_secret_word = $dbsettings['secretword']; |
|
100
|
|
|
unset($dbsettings); |
|
101
|
|
|
} |
|
102
|
|
|
|
|
103
|
|
|
public static function init_global_objects() { |
|
104
|
|
|
self::$debug = self::$gc->debug; |
|
|
|
|
|
|
105
|
|
|
self::$db = self::$gc->db; |
|
|
|
|
|
|
106
|
|
|
self::$user_options = new userOptions(0); |
|
107
|
|
|
|
|
108
|
|
|
// Initializing global 'cacher' object |
|
109
|
|
|
self::$cache = self::$gc->cache; |
|
|
|
|
|
|
110
|
|
|
|
|
111
|
|
|
empty(static::$cache->tables) ? sys_refresh_tablelist() : false; |
|
112
|
|
|
empty(static::$cache->tables) ? die('DB error - cannot find any table. Halting...') : false; |
|
113
|
|
|
|
|
114
|
|
|
// Initializing global "config" object |
|
115
|
|
|
static::$config = self::$gc->config; |
|
|
|
|
|
|
116
|
|
|
|
|
117
|
|
|
// Initializing statics |
|
118
|
|
|
Vector::_staticInit(static::$config); |
|
|
|
|
|
|
119
|
|
|
} |
|
120
|
|
|
|
|
121
|
|
|
public static function init_debug_state() { |
|
122
|
|
|
if ($_SERVER['SERVER_NAME'] == 'localhost' && !defined('BE_DEBUG')) { |
|
123
|
|
|
define('BE_DEBUG', true); |
|
124
|
|
|
} |
|
125
|
|
|
// define('DEBUG_SQL_ONLINE', true); // Полный дамп запросов в рил-тайме. Подойдет любое значение |
|
|
|
|
|
|
126
|
|
|
define('DEBUG_SQL_ERROR', true); // Выводить в сообщении об ошибке так же полный дамп запросов за сессию. Подойдет любое значение |
|
127
|
|
|
define('DEBUG_SQL_COMMENT_LONG', true); // Добавлять SQL запрос длинные комментарии. Не зависим от всех остальных параметров. Подойдет любое значение |
|
128
|
|
|
define('DEBUG_SQL_COMMENT', true); // Добавлять комментарии прямо в SQL запрос. Подойдет любое значение |
|
129
|
|
|
// Включаем нужные настройки |
|
130
|
|
|
defined('DEBUG_SQL_ONLINE') && !defined('DEBUG_SQL_ERROR') ? define('DEBUG_SQL_ERROR', true) : false; |
|
131
|
|
|
defined('DEBUG_SQL_ERROR') && !defined('DEBUG_SQL_COMMENT') ? define('DEBUG_SQL_COMMENT', true) : false; |
|
132
|
|
|
defined('DEBUG_SQL_COMMENT_LONG') && !defined('DEBUG_SQL_COMMENT') ? define('DEBUG_SQL_COMMENT', true) : false; |
|
133
|
|
|
|
|
134
|
|
|
if (defined('BE_DEBUG') || static::$config->debug) { |
|
135
|
|
|
@define('BE_DEBUG', true); |
|
136
|
|
|
@ini_set('display_errors', 1); |
|
137
|
|
|
@error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED); |
|
138
|
|
|
} else { |
|
139
|
|
|
@define('BE_DEBUG', false); |
|
140
|
|
|
@ini_set('display_errors', 0); |
|
141
|
|
|
} |
|
142
|
|
|
|
|
143
|
|
|
} |
|
144
|
|
|
|
|
145
|
|
|
} |
|
146
|
|
|
|
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.
For example, imagine you have a variable
$accountIdthat can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to theidproperty of an instance of theAccountclass. This class holds a proper account, so the id value must no longer be false.Either this assignment is in error or a type check should be added for that assignment.