@@ -9,18 +9,18 @@ |
||
9 | 9 | * @copyright 2008 by Chlorel for XNova |
10 | 10 | */ |
11 | 11 | |
12 | -define('INSIDE' , true); |
|
13 | -define('INSTALL' , false); |
|
12 | +define('INSIDE', true); |
|
13 | +define('INSTALL', false); |
|
14 | 14 | define('IN_ADMIN', true); |
15 | 15 | require_once('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
16 | 16 | |
17 | 17 | // if($user['authlevel'] < 1) |
18 | -if($user['authlevel'] < 3) |
|
18 | +if ($user['authlevel'] < 3) |
|
19 | 19 | { |
20 | 20 | AdminMessage(classLocale::$lang['adm_err_denied']); |
21 | 21 | } |
22 | 22 | |
23 | -if(SN_TIME_NOW >= classSupernova::$config->db_loadAll('var_stat_update_admin_forced') && SN_TIME_NOW >= classSupernova::$config->db_loadAll('var_stat_update_end')) |
|
23 | +if (SN_TIME_NOW >= classSupernova::$config->db_loadAll('var_stat_update_admin_forced') && SN_TIME_NOW >= classSupernova::$config->db_loadAll('var_stat_update_end')) |
|
24 | 24 | { |
25 | 25 | classSupernova::$config->db_saveItem('var_stat_update_admin_forced', SN_TIME_NOW + 120); |
26 | 26 |
@@ -8,18 +8,18 @@ discard block |
||
8 | 8 | * @copyright 2008 by ??????? for XNova |
9 | 9 | */ |
10 | 10 | |
11 | -define('INSIDE' , true); |
|
12 | -define('INSTALL' , false); |
|
11 | +define('INSIDE', true); |
|
12 | +define('INSTALL', false); |
|
13 | 13 | define('IN_ADMIN', true); |
14 | 14 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
15 | 15 | |
16 | -if($user['authlevel'] < 3) { |
|
16 | +if ($user['authlevel'] < 3) { |
|
17 | 17 | AdminMessage(classLocale::$lang['adm_err_denied']); |
18 | 18 | } |
19 | 19 | |
20 | 20 | $template = gettemplate('admin/settings', true); |
21 | 21 | |
22 | -if(sys_get_param('save')) { |
|
22 | +if (sys_get_param('save')) { |
|
23 | 23 | classSupernova::$config->game_name = sys_get_param_str_unsafe('game_name'); |
24 | 24 | classSupernova::$config->game_mode = sys_get_param_int('game_mode'); |
25 | 25 | classSupernova::$config->game_speed = sys_get_param_float('game_speed', 1); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | classSupernova::$config->url_faq = sys_get_param_str_unsafe('url_faq'); |
30 | 30 | classSupernova::$config->url_forum = sys_get_param_str_unsafe('url_forum'); |
31 | 31 | classSupernova::$config->url_rules = sys_get_param_str_unsafe('url_rules'); |
32 | - classSupernova::$config->url_purchase_metamatter = sys_get_param_str_unsafe('url_purchase_metamatter'); |
|
32 | + classSupernova::$config->url_purchase_metamatter = sys_get_param_str_unsafe('url_purchase_metamatter'); |
|
33 | 33 | classSupernova::$config->game_disable = sys_get_param_int('game_disable'); |
34 | 34 | classSupernova::$config->game_disable_reason = sys_get_param_str_unsafe('game_disable_reason'); |
35 | 35 | classSupernova::$config->server_updater_check_auto = sys_get_param_int('server_updater_check_auto'); |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | classSupernova::$config->stats_schedule = sys_get_param_str('stats_schedule'); |
97 | 97 | |
98 | 98 | classSupernova::$config->empire_mercenary_base_period = sys_get_param_int('empire_mercenary_base_period'); |
99 | - if(classSupernova::$config->empire_mercenary_temporary != sys_get_param_int('empire_mercenary_temporary')) { |
|
100 | - if(classSupernova::$config->empire_mercenary_temporary) { |
|
99 | + if (classSupernova::$config->empire_mercenary_temporary != sys_get_param_int('empire_mercenary_temporary')) { |
|
100 | + if (classSupernova::$config->empire_mercenary_temporary) { |
|
101 | 101 | db_unit_list_admin_delete_mercenaries_finished(); |
102 | 102 | } else { |
103 | 103 | db_unit_list_admin_set_mercenaries_expire_time(classSupernova::$config->empire_mercenary_base_period); |
@@ -138,21 +138,21 @@ discard block |
||
138 | 138 | 'STATS_HIDE_PM_LINK' => classSupernova::$config->stats_hide_pm_link, |
139 | 139 | )); |
140 | 140 | |
141 | -foreach(classLocale::$lang['sys_game_disable_reason'] as $id => $name) { |
|
141 | +foreach (classLocale::$lang['sys_game_disable_reason'] as $id => $name) { |
|
142 | 142 | $template->assign_block_vars('sys_game_disable_reason', array( |
143 | 143 | 'ID' => $id, |
144 | 144 | 'NAME' => $name, |
145 | 145 | )); |
146 | 146 | } |
147 | 147 | |
148 | -foreach(classLocale::$lang['sys_game_mode'] as $mode_id => $mode_name) { |
|
148 | +foreach (classLocale::$lang['sys_game_mode'] as $mode_id => $mode_name) { |
|
149 | 149 | $template->assign_block_vars('game_modes', array( |
150 | 150 | 'ID' => $mode_id, |
151 | 151 | 'NAME' => $mode_name, |
152 | 152 | )); |
153 | 153 | } |
154 | 154 | |
155 | -foreach(classLocale::$lang['adm_opt_ver_response'] as $ver_id => $ver_response) { |
|
155 | +foreach (classLocale::$lang['adm_opt_ver_response'] as $ver_id => $ver_response) { |
|
156 | 156 | $template->assign_block_vars('ver_response', array( |
157 | 157 | 'ID' => $ver_id, |
158 | 158 | 'NAME' => js_safe_string($ver_response), |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | } |
161 | 161 | |
162 | 162 | $lang_list = lng_get_list(); |
163 | -foreach($lang_list as $lang_id => $lang_data) { |
|
163 | +foreach ($lang_list as $lang_id => $lang_data) { |
|
164 | 164 | $template->assign_block_vars('game_languages', array( |
165 | 165 | 'ID' => $lang_id, |
166 | 166 | 'NAME' => "{$lang_data['LANG_NAME_NATIVE']} ({$lang_data['LANG_NAME_ENGLISH']})", |
@@ -12,10 +12,10 @@ discard block |
||
12 | 12 | . '&key=' . urlencode(classSupernova::$config->server_updater_key) |
13 | 13 | . '&id=' . urlencode(classSupernova::$config->server_updater_id); |
14 | 14 | |
15 | -switch($mode) { |
|
15 | +switch ($mode) { |
|
16 | 16 | case SNC_MODE_REGISTER: |
17 | - if(classSupernova::$config->server_updater_key || classSupernova::$config->server_updater_id) { |
|
18 | - if($ajax) { |
|
17 | + if (classSupernova::$config->server_updater_key || classSupernova::$config->server_updater_id) { |
|
18 | + if ($ajax) { |
|
19 | 19 | print(SNC_VER_REGISTER_ERROR_REGISTERED); |
20 | 20 | } |
21 | 21 | die(); |
@@ -25,18 +25,18 @@ discard block |
||
25 | 25 | } |
26 | 26 | |
27 | 27 | $check_result = sn_get_url_contents($url); |
28 | -if(!$check_result) { |
|
28 | +if (!$check_result) { |
|
29 | 29 | $version_check = SNC_VER_ERROR_CONNECT; |
30 | -} elseif(($version_check = intval($check_result)) && $version_check == $check_result) { |
|
30 | +} elseif (($version_check = intval($check_result)) && $version_check == $check_result) { |
|
31 | 31 | $version_check = $check_result; |
32 | 32 | } else { |
33 | 33 | // JSON decode if string |
34 | 34 | $check_result = json_decode($check_result, true); |
35 | 35 | $version_check = $check_result === null ? SNC_VER_UNKNOWN_RESPONSE : $check_result['version_check']; |
36 | 36 | |
37 | - switch($mode) { |
|
37 | + switch ($mode) { |
|
38 | 38 | case SNC_MODE_REGISTER: |
39 | - if($check_result['site']['site_key'] && $check_result['site']['site_id'] && $check_result['site']['result'] == SNC_VER_REGISTER_REGISTERED) { |
|
39 | + if ($check_result['site']['site_key'] && $check_result['site']['site_id'] && $check_result['site']['result'] == SNC_VER_REGISTER_REGISTERED) { |
|
40 | 40 | classSupernova::$config->db_saveItem('server_updater_key', $check_result['site']['site_key']); |
41 | 41 | classSupernova::$config->db_saveItem('server_updater_id', $check_result['site']['site_id']); |
42 | 42 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | classSupernova::$config->db_saveItem('server_updater_check_last', SN_TIME_NOW); |
50 | 50 | classSupernova::$config->db_saveItem('server_updater_check_result', $version_check); |
51 | 51 | |
52 | -if($ajax) { |
|
52 | +if ($ajax) { |
|
53 | 53 | define('IN_AJAX', true); |
54 | 54 | print($version_check); |
55 | 55 | } |
@@ -46,19 +46,19 @@ discard block |
||
46 | 46 | protected static $cacheObject; |
47 | 47 | |
48 | 48 | public function __construct($prefIn = 'CACHE_', $init_mode = false) { |
49 | - if(!($init_mode === false || $init_mode === CACHER_NO_CACHE || ($init_mode === CACHER_XCACHE && extension_loaded('xcache')))) { |
|
49 | + if (!($init_mode === false || $init_mode === CACHER_NO_CACHE || ($init_mode === CACHER_XCACHE && extension_loaded('xcache')))) { |
|
50 | 50 | throw new UnexpectedValueException('Wrong work mode or current mode does not supported on your server'); |
51 | 51 | } |
52 | 52 | |
53 | 53 | $this->prefix = $prefIn; |
54 | - if(extension_loaded('xcache') && ($init_mode === CACHER_XCACHE || $init_mode === false)) { |
|
55 | - if(self::$mode === CACHER_NOT_INIT) { |
|
54 | + if (extension_loaded('xcache') && ($init_mode === CACHER_XCACHE || $init_mode === false)) { |
|
55 | + if (self::$mode === CACHER_NOT_INIT) { |
|
56 | 56 | self::$mode = CACHER_XCACHE; |
57 | 57 | } |
58 | 58 | } else { |
59 | - if(self::$mode === CACHER_NOT_INIT) { |
|
59 | + if (self::$mode === CACHER_NOT_INIT) { |
|
60 | 60 | self::$mode = CACHER_NO_CACHE; |
61 | - if(!self::$data) { |
|
61 | + if (!self::$data) { |
|
62 | 62 | self::$data = array(); |
63 | 63 | } |
64 | 64 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | } |
67 | 67 | |
68 | 68 | public static function getInstance($prefIn = 'CACHE_', $table_name = '') { |
69 | - if(!isset(self::$cacheObject)) { |
|
69 | + if (!isset(self::$cacheObject)) { |
|
70 | 70 | $className = get_class(); |
71 | 71 | self::$cacheObject = new $className($prefIn); |
72 | 72 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | // Here comes low-level functions - those that directly works with cacher engines |
84 | 84 | // ------------------------------------------------------------------------- |
85 | 85 | public function __set($name, $value) { |
86 | - switch($name) { |
|
86 | + switch ($name) { |
|
87 | 87 | case '_MODE': |
88 | 88 | throw new UnexpectedValueException('You can not change cacher mode on-the-fly!'); |
89 | 89 | break; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | break; |
94 | 94 | |
95 | 95 | default: |
96 | - switch(self::$mode) { |
|
96 | + switch (self::$mode) { |
|
97 | 97 | case CACHER_NO_CACHE: |
98 | 98 | self::$data[$this->prefix . $name] = $value; |
99 | 99 | break; |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | } |
108 | 108 | |
109 | 109 | public function __get($name) { |
110 | - switch($name) { |
|
110 | + switch ($name) { |
|
111 | 111 | case '_MODE': |
112 | 112 | return self::$mode; |
113 | 113 | break; |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | break; |
118 | 118 | |
119 | 119 | default: |
120 | - switch(self::$mode) { |
|
120 | + switch (self::$mode) { |
|
121 | 121 | case CACHER_NO_CACHE: |
122 | 122 | return self::$data[$this->prefix . $name]; |
123 | 123 | break; |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | } |
135 | 135 | |
136 | 136 | public function __isset($name) { |
137 | - switch(self::$mode) { |
|
137 | + switch (self::$mode) { |
|
138 | 138 | case CACHER_NO_CACHE: |
139 | 139 | return isset(self::$data[$this->prefix . $name]); |
140 | 140 | break; |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | } |
149 | 149 | |
150 | 150 | public function __unset($name) { |
151 | - switch(self::$mode) { |
|
151 | + switch (self::$mode) { |
|
152 | 152 | case CACHER_NO_CACHE: |
153 | 153 | unset(self::$data[$this->prefix . $name]); |
154 | 154 | break; |
@@ -161,11 +161,11 @@ discard block |
||
161 | 161 | |
162 | 162 | public function unset_by_prefix($prefix_unset = '') { |
163 | 163 | static $array_clear; |
164 | - !$array_clear ? $array_clear = function (&$v, $k, $p) { |
|
164 | + !$array_clear ? $array_clear = function(&$v, $k, $p) { |
|
165 | 165 | strpos($k, $p) === 0 ? $v = null : false; |
166 | 166 | } : false; |
167 | 167 | |
168 | - switch(self::$mode) { |
|
168 | + switch (self::$mode) { |
|
169 | 169 | case CACHER_NO_CACHE: |
170 | 170 | // array_walk(self::$data, create_function('&$v,$k,$p', 'if(strpos($k, $p) === 0)$v = NULL;'), $this->prefix.$prefix_unset); |
171 | 171 | array_walk(self::$data, $array_clear, $this->prefix . $prefix_unset); |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | break; |
175 | 175 | |
176 | 176 | case CACHER_XCACHE: |
177 | - if(!function_exists('xcache_unset_by_prefix')) { |
|
177 | + if (!function_exists('xcache_unset_by_prefix')) { |
|
178 | 178 | return false; |
179 | 179 | } |
180 | 180 | |
@@ -191,13 +191,13 @@ discard block |
||
191 | 191 | protected function make_element_name($args, $diff = 0) { |
192 | 192 | $num_args = count($args); |
193 | 193 | |
194 | - if($num_args < 1) { |
|
194 | + if ($num_args < 1) { |
|
195 | 195 | return false; |
196 | 196 | } |
197 | 197 | |
198 | 198 | $name = ''; |
199 | 199 | $aName = array(); |
200 | - for($i = 0; $i <= $num_args - 1 - $diff; $i++) { |
|
200 | + for ($i = 0; $i <= $num_args - 1 - $diff; $i++) { |
|
201 | 201 | $name .= "[{$args[$i]}]"; |
202 | 202 | array_unshift($aName, $name); |
203 | 203 | } |
@@ -209,15 +209,15 @@ discard block |
||
209 | 209 | $args = func_get_args(); |
210 | 210 | $name = $this->make_element_name($args, 1); |
211 | 211 | |
212 | - if(!$name) { |
|
212 | + if (!$name) { |
|
213 | 213 | return null; |
214 | 214 | } |
215 | 215 | |
216 | - if($this->$name[0] === null) { |
|
217 | - for($i = count($name) - 1; $i > 0; $i--) { |
|
216 | + if ($this->$name[0] === null) { |
|
217 | + for ($i = count($name) - 1; $i > 0; $i--) { |
|
218 | 218 | $cName = "{$name[$i]}_COUNT"; |
219 | - $cName1 = "{$name[$i-1]}_COUNT"; |
|
220 | - if($this->$cName1 == null || $i == 1) { |
|
219 | + $cName1 = "{$name[$i - 1]}_COUNT"; |
|
220 | + if ($this->$cName1 == null || $i == 1) { |
|
221 | 221 | $this->$cName++; |
222 | 222 | } |
223 | 223 | } |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | |
231 | 231 | public function array_get() { |
232 | 232 | $name = $this->make_element_name(func_get_args()); |
233 | - if(!$name) { |
|
233 | + if (!$name) { |
|
234 | 234 | return null; |
235 | 235 | } |
236 | 236 | |
@@ -239,12 +239,12 @@ discard block |
||
239 | 239 | |
240 | 240 | public function array_count() { |
241 | 241 | $name = $this->make_element_name(func_get_args()); |
242 | - if(!$name) { |
|
242 | + if (!$name) { |
|
243 | 243 | return 0; |
244 | 244 | } |
245 | 245 | $cName = "{$name[0]}_COUNT"; |
246 | 246 | $retVal = $this->$cName; |
247 | - if(!$retVal) { |
|
247 | + if (!$retVal) { |
|
248 | 248 | $retVal = null; |
249 | 249 | } |
250 | 250 | |
@@ -254,18 +254,18 @@ discard block |
||
254 | 254 | public function array_unset() { |
255 | 255 | $name = $this->make_element_name(func_get_args()); |
256 | 256 | |
257 | - if(!$name) { |
|
257 | + if (!$name) { |
|
258 | 258 | return false; |
259 | 259 | } |
260 | 260 | $this->unset_by_prefix($name[0]); |
261 | 261 | |
262 | - for($i = 1; $i < count($name); $i++) { |
|
262 | + for ($i = 1; $i < count($name); $i++) { |
|
263 | 263 | $cName = "{$name[$i]}_COUNT"; |
264 | - $cName1 = "{$name[$i-1]}_COUNT"; |
|
264 | + $cName1 = "{$name[$i - 1]}_COUNT"; |
|
265 | 265 | |
266 | - if($i == 1 || $this->$cName1 === null) { |
|
266 | + if ($i == 1 || $this->$cName1 === null) { |
|
267 | 267 | $this->$cName--; |
268 | - if($this->$cName <= 0) { |
|
268 | + if ($this->$cName <= 0) { |
|
269 | 269 | unset($this->$cName); |
270 | 270 | } |
271 | 271 | } |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | } |
276 | 276 | |
277 | 277 | public function dumpData() { |
278 | - switch(self::$mode) { |
|
278 | + switch (self::$mode) { |
|
279 | 279 | case CACHER_NO_CACHE: |
280 | 280 | return dump(self::$data, $this->prefix); |
281 | 281 | break; |
@@ -326,13 +326,13 @@ discard block |
||
326 | 326 | $this->sql_index_field = "{$table_name}_name"; |
327 | 327 | $this->sql_value_field = "{$table_name}_value"; |
328 | 328 | |
329 | - if(!$this->_DB_LOADED) { |
|
329 | + if (!$this->_DB_LOADED) { |
|
330 | 330 | $this->db_loadAll(); |
331 | 331 | } |
332 | 332 | } |
333 | 333 | |
334 | 334 | public static function getInstance($gamePrefix = 'sn_', $table_name = '') { |
335 | - if(!isset(self::$cacheObject)) { |
|
335 | + if (!isset(self::$cacheObject)) { |
|
336 | 336 | $className = get_class(); |
337 | 337 | self::$cacheObject = new $className($gamePrefix, $table_name); |
338 | 338 | } |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | |
343 | 343 | public function db_loadItem($index) { |
344 | 344 | $result = null; |
345 | - if($index) { |
|
345 | + if ($index) { |
|
346 | 346 | $index_safe = db_escape($index); |
347 | 347 | $result = doquery("SELECT `{$this->sql_value_field}` FROM `{{{$this->table_name}}}` WHERE `{$this->sql_index_field}` = '{$index_safe}' FOR UPDATE", true); |
348 | 348 | // В две строки - что бы быть уверенным в порядке выполнения |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | $this->loadDefaults(); |
358 | 358 | |
359 | 359 | $query = doquery("SELECT * FROM {{{$this->table_name}}} FOR UPDATE;"); |
360 | - while($row = db_fetch($query)) { |
|
360 | + while ($row = db_fetch($query)) { |
|
361 | 361 | $this->$row[$this->sql_index_field] = $row[$this->sql_value_field]; |
362 | 362 | } |
363 | 363 | |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | } |
366 | 366 | |
367 | 367 | public function loadDefaults() { |
368 | - foreach($this->defaults as $defName => $defValue) { |
|
368 | + foreach ($this->defaults as $defName => $defValue) { |
|
369 | 369 | $this->$defName = $defValue; |
370 | 370 | } |
371 | 371 | } |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | } |
382 | 382 | |
383 | 383 | public function db_saveItem($item_list, $value = null) { |
384 | - if(empty($item_list)) { |
|
384 | + if (empty($item_list)) { |
|
385 | 385 | return; |
386 | 386 | } |
387 | 387 | |
@@ -389,8 +389,8 @@ discard block |
||
389 | 389 | |
390 | 390 | // Сначала записываем данные в базу - что бы поймать все блокировки |
391 | 391 | $qry = array(); |
392 | - foreach($item_list as $item_name => $item_value) { |
|
393 | - if($item_name) { |
|
392 | + foreach ($item_list as $item_name => $item_value) { |
|
393 | + if ($item_name) { |
|
394 | 394 | $item_value = db_escape($item_value === null ? $this->$item_name : $item_value); |
395 | 395 | $item_name = db_escape($item_name); |
396 | 396 | $qry[] = "('{$item_name}', '{$item_value}')"; |
@@ -399,8 +399,8 @@ discard block |
||
399 | 399 | doquery("REPLACE INTO `{{" . $this->table_name . "}}` (`{$this->sql_index_field}`, `{$this->sql_value_field}`) VALUES " . implode(',', $qry) . ";"); |
400 | 400 | |
401 | 401 | // И только после взятия блокировок - меняем значения в кэше |
402 | - foreach($item_list as $item_name => $item_value) { |
|
403 | - if($item_name && $item_value !== null) { |
|
402 | + foreach ($item_list as $item_name => $item_value) { |
|
403 | + if ($item_name && $item_value !== null) { |
|
404 | 404 | $this->$item_name = $item_value; |
405 | 405 | } |
406 | 406 | } |
@@ -587,9 +587,9 @@ discard block |
||
587 | 587 | 'advGoogleLeftMenuCode' => '(Place here code for banner)', |
588 | 588 | |
589 | 589 | // Alliance bonus calculations |
590 | - 'ali_bonus_algorithm' => 0, // Bonus calculation algorithm |
|
590 | + 'ali_bonus_algorithm' => 0, // Bonus calculation algorithm |
|
591 | 591 | 'ali_bonus_brackets' => 10, // Brackets count for ALI_BONUS_BY_RANK |
592 | - 'ali_bonus_brackets_divisor' => 10,// Bonus divisor for ALI_BONUS_BY_RANK |
|
592 | + 'ali_bonus_brackets_divisor' => 10, // Bonus divisor for ALI_BONUS_BY_RANK |
|
593 | 593 | 'ali_bonus_divisor' => 10000000, // Rank divisor for ALI_BONUS_BY_POINTS |
594 | 594 | 'ali_bonus_members' => 10, // Minumum alliace size to start using bonus |
595 | 595 | |
@@ -620,25 +620,25 @@ discard block |
||
620 | 620 | 'deuterium_basic_income' => 0, |
621 | 621 | 'eco_scale_storage' => 1, |
622 | 622 | 'eco_stockman_fleet' => '', // Black Market - Starting amount of s/h ship merchant to sell |
623 | - 'eco_stockman_fleet_populate' => 1, // Populate empty Stockman fleet with ships or not |
|
623 | + 'eco_stockman_fleet_populate' => 1, // Populate empty Stockman fleet with ships or not |
|
624 | 624 | 'empire_mercenary_base_period' => PERIOD_MONTH, // Base |
625 | 625 | 'empire_mercenary_temporary' => 0, // Temporary empire-wide mercenaries |
626 | 626 | 'energy_basic_income' => 0, |
627 | 627 | |
628 | 628 | // Bashing protection settings |
629 | - 'fleet_bashing_attacks' => 3, // Max amount of attack per wave - 3 by default |
|
630 | - 'fleet_bashing_interval' => 1800, // Maximum interval between attacks when they still count as one wave - 30m by default |
|
631 | - 'fleet_bashing_scope' => 86400, // Interval on which bashing waves counts - 24h by default |
|
632 | - 'fleet_bashing_war_delay' => 43200, // Delay before start bashing after declaring war to alliance - 12h by default |
|
633 | - 'fleet_bashing_waves' => 3, // Max amount of waves per day - 3 by default |
|
629 | + 'fleet_bashing_attacks' => 3, // Max amount of attack per wave - 3 by default |
|
630 | + 'fleet_bashing_interval' => 1800, // Maximum interval between attacks when they still count as one wave - 30m by default |
|
631 | + 'fleet_bashing_scope' => 86400, // Interval on which bashing waves counts - 24h by default |
|
632 | + 'fleet_bashing_war_delay' => 43200, // Delay before start bashing after declaring war to alliance - 12h by default |
|
633 | + 'fleet_bashing_waves' => 3, // Max amount of waves per day - 3 by default |
|
634 | 634 | |
635 | 635 | 'Fleet_Cdr' => 30, |
636 | 636 | 'fleet_speed' => 1, |
637 | 637 | |
638 | 638 | 'fleet_update_interval' => 4, |
639 | 639 | |
640 | - 'game_adminEmail' => 'root@localhost', // Admin's email to show to users |
|
641 | - 'game_counter' => 0, // Does built-in page hit counter is on? |
|
640 | + 'game_adminEmail' => 'root@localhost', // Admin's email to show to users |
|
641 | + 'game_counter' => 0, // Does built-in page hit counter is on? |
|
642 | 642 | // Defaults |
643 | 643 | 'game_default_language' => 'ru', |
644 | 644 | 'game_default_skin' => 'skins/EpicBlue/', |
@@ -652,13 +652,13 @@ discard block |
||
652 | 652 | 'game_maxSystem' => 199, |
653 | 653 | 'game_maxPlanet' => 15, |
654 | 654 | // Game global settings |
655 | - 'game_mode' => 0, // 0 - SuperNova, 1 - oGame |
|
655 | + 'game_mode' => 0, // 0 - SuperNova, 1 - oGame |
|
656 | 656 | 'game_name' => 'SuperNova', // Server name (would be on banners and on top of left menu) |
657 | 657 | |
658 | 658 | 'game_news_actual' => 259200, // How long announcement would be marked as "New". In seconds. Default - 3 days |
659 | - 'game_news_overview' => 3, // How much last news to show in Overview page |
|
659 | + 'game_news_overview' => 3, // How much last news to show in Overview page |
|
660 | 660 | // Noob protection |
661 | - 'game_noob_factor' => 5, // Multiplier to divide "stronger" and "weaker" users |
|
661 | + 'game_noob_factor' => 5, // Multiplier to divide "stronger" and "weaker" users |
|
662 | 662 | 'game_noob_points' => 5000, // Below this point user threated as noob. 0 to disable |
663 | 663 | |
664 | 664 | 'game_multiaccount_enabled' => 0, // 1 - allow interactions for players with same IP (multiaccounts) |
@@ -707,8 +707,8 @@ discard block |
||
707 | 707 | 'payment_currency_exchange_wmu' => 30, |
708 | 708 | 'payment_currency_exchange_wmz' => 1, |
709 | 709 | |
710 | - 'payment_lot_price' => 1, // Lot price in default currency |
|
711 | - 'payment_lot_size' => 2500, // Lot size. Also service as minimum amount of DM that could be bought with one transaction |
|
710 | + 'payment_lot_price' => 1, // Lot price in default currency |
|
711 | + 'payment_lot_size' => 2500, // Lot size. Also service as minimum amount of DM that could be bought with one transaction |
|
712 | 712 | |
713 | 713 | 'planet_teleport_cost' => 50000, // |
714 | 714 | 'planet_teleport_timeout' => 86400, // |
@@ -726,7 +726,7 @@ discard block |
||
726 | 726 | 'resource_multiplier' => 1, |
727 | 727 | |
728 | 728 | //Roleplay system |
729 | - 'rpg_bonus_divisor' => 10, // Amount of DM referral shoud get for partner have 1 DM bonus |
|
729 | + 'rpg_bonus_divisor' => 10, // Amount of DM referral shoud get for partner have 1 DM bonus |
|
730 | 730 | 'rpg_bonus_minimum' => 10000, // Minimum DM ammount for starting paying bonuses to affiliate |
731 | 731 | |
732 | 732 | // Black Market - General |
@@ -813,7 +813,7 @@ discard block |
||
813 | 813 | } |
814 | 814 | |
815 | 815 | public static function getInstance($gamePrefix = 'sn_', $table_name = 'config') { |
816 | - if(!isset(self::$cacheObject)) { |
|
816 | + if (!isset(self::$cacheObject)) { |
|
817 | 817 | $className = get_class(); |
818 | 818 | self::$cacheObject = new $className($gamePrefix, $table_name); |
819 | 819 | } |
@@ -2,19 +2,19 @@ discard block |
||
2 | 2 | |
3 | 3 | $classLocale = classLocale::$lang; |
4 | 4 | |
5 | -if(classSupernova::$config->server_updater_check_auto && classSupernova::$config->server_updater_check_last + classSupernova::$config->server_updater_check_period <= SN_TIME_NOW) { |
|
5 | +if (classSupernova::$config->server_updater_check_auto && classSupernova::$config->server_updater_check_last + classSupernova::$config->server_updater_check_period <= SN_TIME_NOW) { |
|
6 | 6 | include(SN_ROOT_PHYSICAL . 'ajax_version_check' . DOT_PHP_EX); |
7 | 7 | } |
8 | 8 | |
9 | -if(classSupernova::$config->user_birthday_gift && SN_TIME_NOW - classSupernova::$config->user_birthday_celebrate > PERIOD_DAY) { |
|
9 | +if (classSupernova::$config->user_birthday_gift && SN_TIME_NOW - classSupernova::$config->user_birthday_celebrate > PERIOD_DAY) { |
|
10 | 10 | require_once(SN_ROOT_PHYSICAL . "includes/includes/user_birthday_celebrate" . DOT_PHP_EX); |
11 | 11 | sn_user_birthday_celebrate(); |
12 | 12 | } |
13 | 13 | |
14 | -if(!classSupernova::$config->var_online_user_count || classSupernova::$config->var_online_user_time + 30 < SN_TIME_NOW) { |
|
14 | +if (!classSupernova::$config->var_online_user_count || classSupernova::$config->var_online_user_time + 30 < SN_TIME_NOW) { |
|
15 | 15 | classSupernova::$config->db_saveItem('var_online_user_count', db_user_count(true)); |
16 | 16 | classSupernova::$config->db_saveItem('var_online_user_time', SN_TIME_NOW); |
17 | - if(classSupernova::$config->server_log_online) { |
|
17 | + if (classSupernova::$config->server_log_online) { |
|
18 | 18 | db_log_online_insert(); |
19 | 19 | } |
20 | 20 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | $template_result[F_ACCOUNT_IS_AUTHORIZED] = $sys_user_logged_in = !empty($user) && isset($user['id']) && $user['id']; |
42 | 42 | //pdump($template_result[F_ACCOUNT_IS_AUTHORIZED]);die(); |
43 | 43 | |
44 | -if(!empty($user['id'])) { |
|
44 | +if (!empty($user['id'])) { |
|
45 | 45 | classSupernova::$user_options->user_change($user['id']); |
46 | 46 | } |
47 | 47 | |
@@ -54,15 +54,15 @@ discard block |
||
54 | 54 | : false |
55 | 55 | ); |
56 | 56 | |
57 | -if($template_result[F_LOGIN_STATUS] == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) { |
|
58 | - $prohibited_characters = array_map(function ($value) { |
|
57 | +if ($template_result[F_LOGIN_STATUS] == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) { |
|
58 | + $prohibited_characters = array_map(function($value) { |
|
59 | 59 | return "'" . htmlentities($value, ENT_QUOTES, 'UTF-8') . "'"; |
60 | 60 | }, str_split(LOGIN_REGISTER_CHARACTERS_PROHIBITED)); |
61 | 61 | $template_result[F_LOGIN_MESSAGE] .= implode(', ', $prohibited_characters); |
62 | 62 | } |
63 | 63 | |
64 | 64 | |
65 | -if(defined('DEBUG_AUTH') && DEBUG_AUTH && !defined('IN_AJAX')) { |
|
65 | +if (defined('DEBUG_AUTH') && DEBUG_AUTH && !defined('IN_AJAX')) { |
|
66 | 66 | pdump("Отключи отладку перед продакшном!"); |
67 | 67 | } |
68 | 68 | |
@@ -76,17 +76,17 @@ discard block |
||
76 | 76 | ? define('INSTALL_MODE', GAME_DISABLE_INSTALL) |
77 | 77 | : false; |
78 | 78 | |
79 | -if($template_result[F_GAME_DISABLE] = classSupernova::$config->game_disable) { |
|
79 | +if ($template_result[F_GAME_DISABLE] = classSupernova::$config->game_disable) { |
|
80 | 80 | $template_result[F_GAME_DISABLE_REASON] = sys_bbcodeParse( |
81 | 81 | classSupernova::$config->game_disable == GAME_DISABLE_REASON |
82 | 82 | ? classSupernova::$config->game_disable_reason |
83 | 83 | : classLocale::$lang['sys_game_disable_reason'][classSupernova::$config->game_disable] |
84 | 84 | ); |
85 | - if(defined('IN_API')) { |
|
85 | + if (defined('IN_API')) { |
|
86 | 86 | return; |
87 | 87 | } |
88 | 88 | |
89 | - if( |
|
89 | + if ( |
|
90 | 90 | ($user['authlevel'] < 1 || !(defined('IN_ADMIN') && IN_ADMIN)) |
91 | 91 | && |
92 | 92 | !(defined('INSTALL_MODE') && defined('LOGIN_LOGOUT')) |
@@ -100,8 +100,8 @@ discard block |
||
100 | 100 | |
101 | 101 | // TODO ban |
102 | 102 | // TODO $skip_ban_check |
103 | -if($template_result[F_BANNED_STATUS] && !$skip_ban_check) { |
|
104 | - if(defined('IN_API')) { |
|
103 | +if ($template_result[F_BANNED_STATUS] && !$skip_ban_check) { |
|
104 | + if (defined('IN_API')) { |
|
105 | 105 | return; |
106 | 106 | } |
107 | 107 | |
@@ -119,13 +119,13 @@ discard block |
||
119 | 119 | // pdump($allow_anonymous, '$allow_anonymous'); |
120 | 120 | // pdump($sys_user_logged_in, '$sys_user_logged_in'); |
121 | 121 | |
122 | -if($sys_user_logged_in && INITIAL_PAGE == 'login') { |
|
122 | +if ($sys_user_logged_in && INITIAL_PAGE == 'login') { |
|
123 | 123 | sys_redirect(SN_ROOT_VIRTUAL . 'overview.php'); |
124 | -} elseif($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id']) |
|
124 | +} elseif ($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id']) |
|
125 | 125 | // pdump($sn_page_name); |
126 | 126 | // pdump(INITIAL_PAGE); |
127 | 127 | // die('{Тут должна быть ваша реклама. Точнее - ввод имени игрока}'); |
128 | -} elseif(!$allow_anonymous && !$sys_user_logged_in) { |
|
128 | +} elseif (!$allow_anonymous && !$sys_user_logged_in) { |
|
129 | 129 | // sn_setcookie(SN_COOKIE, '', time() - PERIOD_WEEK, SN_ROOT_RELATIVE); |
130 | 130 | sys_redirect(SN_ROOT_VIRTUAL . 'login.php'); |
131 | 131 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | |
147 | 147 | global $skip_fleet_update; |
148 | 148 | $skip_fleet_update = $skip_fleet_update || $supernova->options['fleet_update_skip'] || defined('IN_ADMIN'); |
149 | -if( |
|
149 | +if ( |
|
150 | 150 | !$skip_fleet_update |
151 | 151 | && !(defined('IN_AJAX') && IN_AJAX === true) |
152 | 152 | && SN_TIME_NOW - strtotime(classSupernova::$config->fleet_update_last) > classSupernova::$config->fleet_update_interval |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | flt_flying_fleet_handler($skip_fleet_update); |
156 | 156 | } |
157 | 157 | |
158 | -if(!defined('IN_AJAX')) { |
|
158 | +if (!defined('IN_AJAX')) { |
|
159 | 159 | print("Scheduled processes is disabled<br />"); |
160 | 160 | } |
161 | 161 | // scheduler_process(); |
@@ -138,14 +138,14 @@ discard block |
||
138 | 138 | |
139 | 139 | // If method is not getter or setter OR property name not exists in $_properties - raising exception |
140 | 140 | // Descendants can catch this Exception to make own __call magic |
141 | - if(($left3 != 'get' && $left3 != 'set') || empty(static::$_properties[$propertyName])) { |
|
141 | + if (($left3 != 'get' && $left3 != 'set') || empty(static::$_properties[$propertyName])) { |
|
142 | 142 | throw new ExceptionPropertyNotExists('Property ' . $propertyName . ' not exists when calling getter/setter ' . get_called_class() . '::' . $name, ERR_ERROR); |
143 | 143 | } |
144 | 144 | |
145 | 145 | // TODO check for read-only |
146 | 146 | |
147 | - if($left3 == 'set') { |
|
148 | - if(!empty($this->propertiesAdjusted[$propertyName])) { |
|
147 | + if ($left3 == 'set') { |
|
148 | + if (!empty($this->propertiesAdjusted[$propertyName])) { |
|
149 | 149 | throw new PropertyAccessException('Property ' . $propertyName . ' already was adjusted so no SET is possible until dbSave in ' . get_called_class() . '::' . $name, ERR_ERROR); |
150 | 150 | } |
151 | 151 | $this->propertiesChanged[$propertyName] = 1; |
@@ -154,13 +154,13 @@ discard block |
||
154 | 154 | // Now deciding - will we call a protected setter or will we work with protected property |
155 | 155 | |
156 | 156 | // If method exists - just calling it |
157 | - if(method_exists($this, $name)) { |
|
157 | + if (method_exists($this, $name)) { |
|
158 | 158 | return call_user_func_array(array($this, $name), $arguments); |
159 | 159 | } |
160 | 160 | // No getter/setter exists - works directly with protected property |
161 | 161 | |
162 | 162 | // Is it getter? |
163 | - if($left3 === 'get') { |
|
163 | + if ($left3 === 'get') { |
|
164 | 164 | return $this->{'_' . $propertyName}; |
165 | 165 | } |
166 | 166 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | */ |
183 | 183 | public function dbLoad($dbId, $lockSkip = false) { |
184 | 184 | $dbId = idval($dbId); |
185 | - if($dbId <= 0) { |
|
185 | + if ($dbId <= 0) { |
|
186 | 186 | classSupernova::$debug->error(get_called_class() . '::dbLoad $dbId not positive = ' . $dbId); |
187 | 187 | |
188 | 188 | return; |
@@ -191,12 +191,12 @@ discard block |
||
191 | 191 | $this->_dbId = $dbId; |
192 | 192 | $this->lockSkip = $lockSkip; |
193 | 193 | // TODO - Use classSupernova::$db_records_locked |
194 | - if(false && !$lockSkip && sn_db_transaction_check(false)) { |
|
194 | + if (false && !$lockSkip && sn_db_transaction_check(false)) { |
|
195 | 195 | $this->dbGetLockById($this->_dbId); |
196 | 196 | } |
197 | 197 | |
198 | 198 | $db_row = doquery("SELECT * FROM `{{" . static::$_table . "}}` WHERE `" . static::$_dbIdFieldName . "` = " . $this->_dbId . " LIMIT 1 FOR UPDATE;", true); |
199 | - if(empty($db_row)) { |
|
199 | + if (empty($db_row)) { |
|
200 | 200 | return; |
201 | 201 | } |
202 | 202 | |
@@ -224,26 +224,26 @@ discard block |
||
224 | 224 | */ |
225 | 225 | // TODO - perform operations only if properties was changed |
226 | 226 | public function dbSave() { |
227 | - if($this->isNew()) { |
|
227 | + if ($this->isNew()) { |
|
228 | 228 | // No DB_ID - new unit |
229 | - if($this->isEmpty()) { |
|
229 | + if ($this->isEmpty()) { |
|
230 | 230 | classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - object is empty on ' . get_called_class() . '::dbSave'); |
231 | 231 | } |
232 | 232 | $this->dbInsert(); |
233 | 233 | } else { |
234 | 234 | // DB_ID is present |
235 | - if($this->isEmpty()) { |
|
235 | + if ($this->isEmpty()) { |
|
236 | 236 | $this->dbDelete(); |
237 | 237 | } else { |
238 | - if(!sn_db_transaction_check(false)) { |
|
238 | + if (!sn_db_transaction_check(false)) { |
|
239 | 239 | classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - transaction should always be started on ' . get_called_class() . '::dbUpdate'); |
240 | 240 | } |
241 | 241 | $this->dbUpdate(); |
242 | 242 | } |
243 | 243 | } |
244 | 244 | |
245 | - if(!empty($this->triggerDbOperationOn)) { |
|
246 | - foreach($this->triggerDbOperationOn as $item) { |
|
245 | + if (!empty($this->triggerDbOperationOn)) { |
|
246 | + foreach ($this->triggerDbOperationOn as $item) { |
|
247 | 247 | $item->dbSave(); |
248 | 248 | } |
249 | 249 | } |
@@ -263,12 +263,12 @@ discard block |
||
263 | 263 | */ |
264 | 264 | // TODO - protected |
265 | 265 | public function dbInsert() { |
266 | - if(!$this->isNew()) { |
|
266 | + if (!$this->isNew()) { |
|
267 | 267 | classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - record db_id is not empty on ' . get_called_class() . '::dbInsert'); |
268 | 268 | } |
269 | 269 | $this->_dbId = $this->db_field_set_create($this->dbMakeFieldSet()); |
270 | 270 | |
271 | - if(empty($this->_dbId)) { |
|
271 | + if (empty($this->_dbId)) { |
|
272 | 272 | classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - error saving record ' . get_called_class() . '::dbInsert'); |
273 | 273 | } |
274 | 274 | |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | // TODO - protected |
282 | 282 | public function dbUpdate() { |
283 | 283 | // TODO - Update |
284 | - if($this->isNew()) { |
|
284 | + if ($this->isNew()) { |
|
285 | 285 | classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - unit db_id is empty on dbUpdate'); |
286 | 286 | } |
287 | 287 | $this->db_field_update($this->dbMakeFieldSet(true)); |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | */ |
293 | 293 | // TODO - protected |
294 | 294 | public function dbDelete() { |
295 | - if($this->isNew()) { |
|
295 | + if ($this->isNew()) { |
|
296 | 296 | classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - unit db_id is empty on dbDelete'); |
297 | 297 | } |
298 | 298 | doquery("DELETE FROM {{" . static::$_table . "}} WHERE `" . static::$_dbIdFieldName . "` = " . $this->_dbId); |
@@ -334,18 +334,18 @@ discard block |
||
334 | 334 | * @param array $db_row |
335 | 335 | */ |
336 | 336 | public function dbRowParse(array $db_row) { |
337 | - foreach(static::$_properties as $property_name => &$property_data) { |
|
337 | + foreach (static::$_properties as $property_name => &$property_data) { |
|
338 | 338 | // Advanced values extraction procedure. Should be used when at least one of following rules is matched: |
339 | 339 | // - one field should translate to several properties; |
340 | 340 | // - one property should be filled according to several fields; |
341 | 341 | // - property filling requires some lookup in object values; |
342 | - if(!empty($property_data[P_METHOD_EXTRACT]) && is_callable(array($this, $property_data[P_METHOD_EXTRACT]))) { |
|
342 | + if (!empty($property_data[P_METHOD_EXTRACT]) && is_callable(array($this, $property_data[P_METHOD_EXTRACT]))) { |
|
343 | 343 | call_user_func_array(array($this, $property_data[P_METHOD_EXTRACT]), array(&$db_row)); |
344 | 344 | continue; |
345 | 345 | } |
346 | 346 | |
347 | 347 | // If property is read-only - doing nothing |
348 | - if(!empty($property_data[P_READ_ONLY])) { |
|
348 | + if (!empty($property_data[P_READ_ONLY])) { |
|
349 | 349 | continue; |
350 | 350 | } |
351 | 351 | |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | !empty($property_data[P_FUNC_INPUT]) && is_callable($property_data[P_FUNC_INPUT]) ? $value = call_user_func($property_data[P_FUNC_INPUT], $value) : false; |
357 | 357 | |
358 | 358 | // If there is setter for this field - using it. Setters is always a methods of $THIS |
359 | - if(!empty($property_data[P_METHOD_SET]) && is_callable(array($this, $property_data[P_METHOD_SET]))) { |
|
359 | + if (!empty($property_data[P_METHOD_SET]) && is_callable(array($this, $property_data[P_METHOD_SET]))) { |
|
360 | 360 | call_user_func(array($this, $property_data[P_METHOD_SET]), $value); |
361 | 361 | } else { |
362 | 362 | $this->{$property_name} = $value; |
@@ -372,21 +372,21 @@ discard block |
||
372 | 372 | protected function dbMakeFieldSet($isUpdate = false) { |
373 | 373 | $array = array(); |
374 | 374 | |
375 | - foreach(static::$_properties as $property_name => &$property_data) { |
|
375 | + foreach (static::$_properties as $property_name => &$property_data) { |
|
376 | 376 | // TODO - on isUpdate add only changed/adjusted properties |
377 | 377 | |
378 | - if(!empty($property_data[P_METHOD_INJECT]) && is_callable(array($this, $property_data[P_METHOD_INJECT]))) { |
|
378 | + if (!empty($property_data[P_METHOD_INJECT]) && is_callable(array($this, $property_data[P_METHOD_INJECT]))) { |
|
379 | 379 | call_user_func_array(array($this, $property_data[P_METHOD_INJECT]), array(&$array)); |
380 | 380 | continue; |
381 | 381 | } |
382 | 382 | |
383 | 383 | // Skipping properties which have no corresponding field in DB |
384 | - if(empty($property_data[P_DB_FIELD])) { |
|
384 | + if (empty($property_data[P_DB_FIELD])) { |
|
385 | 385 | continue; |
386 | 386 | } |
387 | 387 | |
388 | 388 | // Checking - is property was adjusted or changed |
389 | - if($isUpdate && array_key_exists($property_name, $this->propertiesAdjusted)) { |
|
389 | + if ($isUpdate && array_key_exists($property_name, $this->propertiesAdjusted)) { |
|
390 | 390 | // For adjusted property - take value from propertiesAdjusted array |
391 | 391 | // TODO - differ how treated conversion to string for changed and adjusted properties |
392 | 392 | $value = $this->propertiesAdjusted[$property_name]; |
@@ -416,17 +416,17 @@ discard block |
||
416 | 416 | */ |
417 | 417 | protected function isFieldChanged($fieldName) { |
418 | 418 | $isFieldChanged = false; |
419 | - foreach($this->propertiesChanged as $propertyName => $cork) { |
|
419 | + foreach ($this->propertiesChanged as $propertyName => $cork) { |
|
420 | 420 | $propertyScheme = static::$_properties[$propertyName]; |
421 | - if(!empty($propertyScheme[P_DB_FIELDS_LINKED])) { |
|
422 | - foreach($propertyScheme[P_DB_FIELDS_LINKED] as $linkedFieldName) { |
|
423 | - if($linkedFieldName == $fieldName) { |
|
421 | + if (!empty($propertyScheme[P_DB_FIELDS_LINKED])) { |
|
422 | + foreach ($propertyScheme[P_DB_FIELDS_LINKED] as $linkedFieldName) { |
|
423 | + if ($linkedFieldName == $fieldName) { |
|
424 | 424 | $isFieldChanged = $propertyName; |
425 | 425 | break 2; |
426 | 426 | } |
427 | 427 | } |
428 | 428 | } |
429 | - if(!empty($propertyScheme[P_DB_FIELD]) && $propertyScheme[P_DB_FIELD] == $fieldName) { |
|
429 | + if (!empty($propertyScheme[P_DB_FIELD]) && $propertyScheme[P_DB_FIELD] == $fieldName) { |
|
430 | 430 | $isFieldChanged = $propertyName; |
431 | 431 | break; |
432 | 432 | } |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | $fields = implode(',', array_keys($field_set)); |
449 | 449 | |
450 | 450 | $result = 0; |
451 | - if(classSupernova::db_query("INSERT INTO `{{" . static::$_table . "}}` ({$fields}) VALUES ({$values});")) { |
|
451 | + if (classSupernova::db_query("INSERT INTO `{{" . static::$_table . "}}` ({$fields}) VALUES ({$values});")) { |
|
452 | 452 | $result = db_insert_id(); |
453 | 453 | } |
454 | 454 | |
@@ -466,13 +466,13 @@ discard block |
||
466 | 466 | sn_db_field_set_safe_flag_clear($field_set); |
467 | 467 | |
468 | 468 | $set = array(); |
469 | - foreach($field_set as $fieldName => $value) { |
|
470 | - if(!($changedProperty = $this->isFieldChanged($fieldName))) { |
|
469 | + foreach ($field_set as $fieldName => $value) { |
|
470 | + if (!($changedProperty = $this->isFieldChanged($fieldName))) { |
|
471 | 471 | continue; |
472 | 472 | } |
473 | 473 | |
474 | 474 | // TODO - separate sets from adjusts |
475 | - if(array_key_exists($changedProperty, $this->propertiesAdjusted)) { |
|
475 | + if (array_key_exists($changedProperty, $this->propertiesAdjusted)) { |
|
476 | 476 | $value = "`{$fieldName}` + ($value)"; // braces for negative values |
477 | 477 | } |
478 | 478 |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
13 | 13 | |
14 | 14 | // if($user['authlevel'] < 1) |
15 | -if($user['authlevel'] < 3) { |
|
15 | +if ($user['authlevel'] < 3) { |
|
16 | 16 | AdminMessage(classLocale::$lang['adm_err_denied']); |
17 | 17 | } |
18 | 18 | |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function templateAssignTable($template, $str, $status) { |
27 | 27 | $template->assign_block_vars('table', classLocale::$lang['adm_tool_sql_table'][$str]); |
28 | - foreach($status as $key => $value) { |
|
28 | + foreach ($status as $key => $value) { |
|
29 | 29 | $template->assign_block_vars('table.row', array( |
30 | 30 | 'VALUE_1' => $key, |
31 | 31 | 'VALUE_2' => $value, |
@@ -33,13 +33,13 @@ discard block |
||
33 | 33 | } |
34 | 34 | } |
35 | 35 | |
36 | -switch($mode) { |
|
36 | +switch ($mode) { |
|
37 | 37 | case ADM_TOOL_CONFIG_RELOAD: |
38 | 38 | classSupernova::$config->db_loadAll(); |
39 | 39 | sys_refresh_tablelist(); |
40 | 40 | |
41 | 41 | classSupernova::$config->db_loadItem('game_watchlist'); |
42 | - if(classSupernova::$config->game_watchlist) { |
|
42 | + if (classSupernova::$config->game_watchlist) { |
|
43 | 43 | classSupernova::$config->game_watchlist_array = explode(';', classSupernova::$config->game_watchlist); |
44 | 44 | } else { |
45 | 45 | unset(classSupernova::$config->game_watchlist_array); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | defined('INSIDE') || die(); |
32 | 32 | |
33 | -if(php_sapi_name() == "cli") { |
|
33 | +if (php_sapi_name() == "cli") { |
|
34 | 34 | // In cli-mode |
35 | 35 | define('__DEBUG_CRLF', "\r\n"); |
36 | 36 | define('__DEBUG_LINE', '-------------------------------------------------' . __DEBUG_CRLF); |
@@ -50,16 +50,16 @@ discard block |
||
50 | 50 | function log_file($message, $ident_change = 0) { |
51 | 51 | static $ident = 0; |
52 | 52 | |
53 | - if(!defined('SN_DEBUG_LOG')) { |
|
53 | + if (!defined('SN_DEBUG_LOG')) { |
|
54 | 54 | return; |
55 | 55 | } |
56 | 56 | |
57 | - if($this->log_file_handler === null) { |
|
57 | + if ($this->log_file_handler === null) { |
|
58 | 58 | $this->log_file_handler = @fopen(SN_ROOT_PHYSICAL . '/.logs/supernova.log', 'a+'); |
59 | 59 | @fwrite($this->log_file_handler, "\r\n\r\n"); |
60 | 60 | } |
61 | 61 | $ident_change < 0 ? $ident += $ident_change * 2 : false; |
62 | - if($this->log_file_handler) { |
|
62 | + if ($this->log_file_handler) { |
|
63 | 63 | @fwrite($this->log_file_handler, date(FMT_DATE_TIME_SQL, time()) . str_repeat(' ', $ident + 1) . $message . "\r\n"); |
64 | 64 | } |
65 | 65 | $ident_change > 0 ? $ident += $ident_change * 2 : false; |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | $result = array(); |
91 | 91 | $transaction_id = classSupernova::db_transaction_check(false) ? classSupernova::$transaction_id : classSupernova::$transaction_id++; |
92 | 92 | $result[] = "tID {$transaction_id}"; |
93 | - foreach($backtrace as $a_trace) { |
|
94 | - if(in_array($a_trace['function'], $exclude_functions)) { |
|
93 | + foreach ($backtrace as $a_trace) { |
|
94 | + if (in_array($a_trace['function'], $exclude_functions)) { |
|
95 | 95 | continue; |
96 | 96 | } |
97 | 97 | $function = |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | // $result[] = "{$function} ({$a_trace['line']})'{$file}'"; |
109 | 109 | $result[] = "{$function} - '{$file}' Line {$a_trace['line']}"; |
110 | 110 | |
111 | - if(!$long_comment) { |
|
111 | + if (!$long_comment) { |
|
112 | 112 | break; |
113 | 113 | } |
114 | 114 | } |
@@ -122,26 +122,26 @@ discard block |
||
122 | 122 | function dump($dump = false, $force_base = false, $deadlock = false) { |
123 | 123 | global $user, $planetrow; |
124 | 124 | |
125 | - if($dump === false) { |
|
125 | + if ($dump === false) { |
|
126 | 126 | return; |
127 | 127 | } |
128 | 128 | |
129 | 129 | $error_backtrace = array(); |
130 | 130 | $base_dump = false; |
131 | 131 | |
132 | - if($force_base === true) { |
|
132 | + if ($force_base === true) { |
|
133 | 133 | $base_dump = true; |
134 | 134 | } |
135 | 135 | |
136 | - if($dump === true) { |
|
136 | + if ($dump === true) { |
|
137 | 137 | $base_dump = true; |
138 | 138 | } else { |
139 | - if(!is_array($dump)) { |
|
139 | + if (!is_array($dump)) { |
|
140 | 140 | $dump = array('var' => $dump); |
141 | 141 | } |
142 | 142 | |
143 | - foreach($dump as $dump_var_name => $dump_var) { |
|
144 | - if($dump_var_name == 'base_dump') { |
|
143 | + foreach ($dump as $dump_var_name => $dump_var) { |
|
144 | + if ($dump_var_name == 'base_dump') { |
|
145 | 145 | $base_dump = $dump_var; |
146 | 146 | } else { |
147 | 147 | $error_backtrace[$dump_var_name] = $dump_var; |
@@ -149,22 +149,21 @@ discard block |
||
149 | 149 | } |
150 | 150 | } |
151 | 151 | |
152 | - if($deadlock && ($q = db_fetch(classSupernova::$db->mysql_get_innodb_status()))) { |
|
152 | + if ($deadlock && ($q = db_fetch(classSupernova::$db->mysql_get_innodb_status()))) { |
|
153 | 153 | $error_backtrace['deadlock'] = explode("\n", $q['Status']); |
154 | 154 | $error_backtrace['locks'] = classSupernova::$locks; |
155 | 155 | $error_backtrace['cSN_data'] = classSupernova::$data; |
156 | - foreach($error_backtrace['cSN_data'] as &$location) { |
|
157 | - foreach($location as $location_id => &$location_data) { |
|
158 | - $location_data = isset($location_data['username']) ? $location_data['username'] : |
|
159 | - (isset($location_data['name']) ? $location_data['name'] : $location_id); |
|
156 | + foreach ($error_backtrace['cSN_data'] as &$location) { |
|
157 | + foreach ($location as $location_id => &$location_data) { |
|
158 | + $location_data = isset($location_data['username']) ? $location_data['username'] : (isset($location_data['name']) ? $location_data['name'] : $location_id); |
|
160 | 159 | } |
161 | 160 | } |
162 | 161 | $error_backtrace['cSN_queries'] = classSupernova::$queries; |
163 | 162 | } |
164 | 163 | |
165 | - if($base_dump) { |
|
166 | - if(is_array($this->log_array) && count($this->log_array) > 0) { |
|
167 | - foreach($this->log_array as $log) { |
|
164 | + if ($base_dump) { |
|
165 | + if (is_array($this->log_array) && count($this->log_array) > 0) { |
|
166 | + foreach ($this->log_array as $log) { |
|
168 | 167 | $error_backtrace['queries'][] = $log; |
169 | 168 | } |
170 | 169 | } |
@@ -193,14 +192,14 @@ discard block |
||
193 | 192 | function error($message = 'There is a error on page', $title = 'Internal Error', $error_code = 500, $dump = true) { |
194 | 193 | global $sys_stop_log_hit, $sys_log_disabled, $user; |
195 | 194 | |
196 | - if(empty(classSupernova::$db->connected)) { |
|
195 | + if (empty(classSupernova::$db->connected)) { |
|
197 | 196 | // TODO - писать ошибку в файл |
198 | 197 | die('SQL server currently unavailable. Please contact Administration...'); |
199 | 198 | } |
200 | 199 | |
201 | 200 | sn_db_transaction_rollback(); |
202 | 201 | |
203 | - if(classSupernova::$config->debug == 1) { |
|
202 | + if (classSupernova::$config->debug == 1) { |
|
204 | 203 | echo "<h2>{$title}</h2><br><font color=red>{$message}</font><br><hr>"; |
205 | 204 | echo "<table>{$this->log}</table>"; |
206 | 205 | } |
@@ -210,7 +209,7 @@ discard block |
||
210 | 209 | $error_text = db_escape($message); |
211 | 210 | $error_backtrace = $this->dump($dump, true, strpos($message, 'Deadlock') !== false); |
212 | 211 | |
213 | - if(!$sys_log_disabled) { |
|
212 | + if (!$sys_log_disabled) { |
|
214 | 213 | $query = "INSERT INTO `{{logs}}` SET |
215 | 214 | `log_time` = '" . time() . "', `log_code` = '" . db_escape($error_code) . "', `log_sender` = '" . db_escape($user['id']) . "', |
216 | 215 | `log_username` = '" . db_escape($user['user_name']) . "', `log_title` = '" . db_escape($title) . "', `log_text` = '" . db_escape($message) . "', |
@@ -228,7 +227,7 @@ discard block |
||
228 | 227 | ob_start(); |
229 | 228 | print("<hr>User ID {$user['id']} raised error code {$error_code} titled '{$title}' with text '{$error_text}' on page {$_SERVER['SCRIPT_NAME']}"); |
230 | 229 | |
231 | - foreach($error_backtrace as $name => $value) { |
|
230 | + foreach ($error_backtrace as $name => $value) { |
|
232 | 231 | print(__DEBUG_LINE); |
233 | 232 | pdump($value, $name); |
234 | 233 | } |
@@ -240,14 +239,14 @@ discard block |
||
240 | 239 | function warning($message, $title = 'System Message', $log_code = 300, $dump = false) { |
241 | 240 | global $user, $sys_log_disabled; |
242 | 241 | |
243 | - if(empty(classSupernova::$db->connected)) { |
|
242 | + if (empty(classSupernova::$db->connected)) { |
|
244 | 243 | // TODO - писать ошибку в файл |
245 | 244 | die('SQL server currently unavailable. Please contact Administration...'); |
246 | 245 | } |
247 | 246 | |
248 | 247 | $error_backtrace = $this->dump($dump, false); |
249 | 248 | |
250 | - if(!$sys_log_disabled) { |
|
249 | + if (!$sys_log_disabled) { |
|
251 | 250 | $query = "INSERT INTO `{{logs}}` SET |
252 | 251 | `log_time` = '" . time() . "', `log_code` = '" . db_escape($log_code) . "', `log_sender` = '" . db_escape($user['id']) . "', |
253 | 252 | `log_username` = '" . db_escape($user['user_name']) . "', `log_title` = '" . db_escape($title) . "', `log_text` = '" . db_escape($message) . "', |
@@ -265,11 +264,11 @@ discard block |
||
265 | 264 | // Dump variables nicer then var_dump() |
266 | 265 | |
267 | 266 | function dump($value, $varname = null, $level = 0, $dumper = '') { |
268 | - if(isset($varname)) { |
|
267 | + if (isset($varname)) { |
|
269 | 268 | $varname .= " = "; |
270 | 269 | } |
271 | 270 | |
272 | - if($level == -1) { |
|
271 | + if ($level == -1) { |
|
273 | 272 | $trans[' '] = '∴'; |
274 | 273 | $trans["\t"] = '⇒'; |
275 | 274 | $trans["\n"] = '¶;'; |
@@ -278,7 +277,7 @@ discard block |
||
278 | 277 | |
279 | 278 | return strtr(htmlspecialchars($value), $trans); |
280 | 279 | } |
281 | - if($level == 0) { |
|
280 | + if ($level == 0) { |
|
282 | 281 | // $dumper = '<pre>' . mt_rand(10, 99) . '|' . $varname; |
283 | 282 | $dumper = mt_rand(10, 99) . '|' . $varname; |
284 | 283 | } |
@@ -286,22 +285,22 @@ discard block |
||
286 | 285 | $type = gettype($value); |
287 | 286 | $dumper .= $type; |
288 | 287 | |
289 | - if($type == 'string') { |
|
288 | + if ($type == 'string') { |
|
290 | 289 | $dumper .= '(' . strlen($value) . ')'; |
291 | 290 | $value = dump($value, '', -1); |
292 | - } elseif($type == 'boolean') { |
|
291 | + } elseif ($type == 'boolean') { |
|
293 | 292 | $value = ($value ? 'true' : 'false'); |
294 | - } elseif($type == 'object') { |
|
293 | + } elseif ($type == 'object') { |
|
295 | 294 | $props = get_class_vars(get_class($value)); |
296 | 295 | $dumper .= '(' . count($props) . ') <u>' . get_class($value) . '</u>'; |
297 | - foreach($props as $key => $val) { |
|
296 | + foreach ($props as $key => $val) { |
|
298 | 297 | $dumper .= "\n" . str_repeat("\t", $level + 1) . $key . ' => '; |
299 | 298 | $dumper .= dump($value->$key, '', $level + 1); |
300 | 299 | } |
301 | 300 | $value = ''; |
302 | - } elseif($type == 'array') { |
|
301 | + } elseif ($type == 'array') { |
|
303 | 302 | $dumper .= '(' . count($value) . ')'; |
304 | - foreach($value as $key => $val) { |
|
303 | + foreach ($value as $key => $val) { |
|
305 | 304 | $dumper .= "\n" . str_repeat("\t", $level + 1) . dump($key, '', -1) . ' => '; |
306 | 305 | $dumper .= dump($val, '', $level + 1); |
307 | 306 | } |
@@ -321,7 +320,7 @@ discard block |
||
321 | 320 | // $backtrace = $backtrace[1]; |
322 | 321 | |
323 | 322 | $caller = ''; |
324 | - if(defined('SN_DEBUG_PDUMP_CALLER') && SN_DEBUG_PDUMP_CALLER) { |
|
323 | + if (defined('SN_DEBUG_PDUMP_CALLER') && SN_DEBUG_PDUMP_CALLER) { |
|
325 | 324 | $caller = (!empty($backtrace[1]['class']) ? $backtrace[1]['class'] : '') . |
326 | 325 | (!empty($backtrace[1]['type']) ? $backtrace[1]['type'] : '') . |
327 | 326 | $backtrace[1]['function'] . |
@@ -348,7 +347,7 @@ discard block |
||
348 | 347 | } |
349 | 348 | |
350 | 349 | function pr($prePrint = false) { |
351 | - if($prePrint) { |
|
350 | + if ($prePrint) { |
|
352 | 351 | print(__DEBUG_CRLF); |
353 | 352 | } |
354 | 353 | print(mt_rand() . __DEBUG_CRLF); |
@@ -358,7 +357,7 @@ discard block |
||
358 | 357 | global $_PRINT_COUNT_VALUE; |
359 | 358 | $_PRINT_COUNT_VALUE++; |
360 | 359 | |
361 | - if($prePrint) { |
|
360 | + if ($prePrint) { |
|
362 | 361 | print(__DEBUG_CRLF); |
363 | 362 | } |
364 | 363 | print($_PRINT_COUNT_VALUE . __DEBUG_CRLF); |
@@ -73,23 +73,23 @@ discard block |
||
73 | 73 | public function sn_db_connect($external_db_settings = null) { |
74 | 74 | $this->db_disconnect(); |
75 | 75 | |
76 | - if(!empty($external_db_settings) && is_array($external_db_settings)) { |
|
76 | + if (!empty($external_db_settings) && is_array($external_db_settings)) { |
|
77 | 77 | $this->dbsettings = $external_db_settings; |
78 | 78 | } |
79 | 79 | |
80 | - if(empty($this->dbsettings)) { |
|
80 | + if (empty($this->dbsettings)) { |
|
81 | 81 | $this->load_db_settings(); |
82 | 82 | } |
83 | 83 | |
84 | 84 | // TODO - фатальные (?) ошибки на каждом шагу. Хотя - скорее Эксепшны |
85 | - if(!empty($this->dbsettings)) { |
|
85 | + if (!empty($this->dbsettings)) { |
|
86 | 86 | $driver_name = empty($this->dbsettings['sn_driver']) ? 'db_mysql_v5' : $this->dbsettings['sn_driver']; |
87 | 87 | $this->driver = new $driver_name(); |
88 | 88 | $this->db_prefix = $this->dbsettings['prefix']; |
89 | 89 | |
90 | 90 | $this->connected = $this->connected || $this->driver_connect(); |
91 | 91 | |
92 | - if($this->connected) { |
|
92 | + if ($this->connected) { |
|
93 | 93 | $this->table_list = $this->db_get_table_list(); |
94 | 94 | // TODO Проверка на пустоту |
95 | 95 | } |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | protected function driver_connect() { |
104 | 104 | global $debug; |
105 | 105 | |
106 | - if(!is_object($this->driver)) { |
|
106 | + if (!is_object($this->driver)) { |
|
107 | 107 | $debug->error_fatal('DB Error - No driver for MySQL found!'); |
108 | 108 | } |
109 | 109 | |
110 | - if(!method_exists($this->driver, 'mysql_connect')) { |
|
110 | + if (!method_exists($this->driver, 'mysql_connect')) { |
|
111 | 111 | $debug->error_fatal('DB Error - WRONG MySQL driver!'); |
112 | 112 | } |
113 | 113 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | public function db_disconnect() { |
118 | - if($this->connected) { |
|
118 | + if ($this->connected) { |
|
119 | 119 | $this->connected = !$this->driver_disconnect(); |
120 | 120 | $this->connected = false; |
121 | 121 | } |
@@ -130,8 +130,8 @@ discard block |
||
130 | 130 | */ |
131 | 131 | public function replaceTablePlaceholders($query) { |
132 | 132 | $sql = $query; |
133 | - if(strpos($sql, '{{') !== false) { |
|
134 | - foreach($this->table_list as $tableName) { |
|
133 | + if (strpos($sql, '{{') !== false) { |
|
134 | + foreach ($this->table_list as $tableName) { |
|
135 | 135 | $sql = str_replace("{{{$tableName}}}", $this->db_prefix . $tableName, $sql); |
136 | 136 | } |
137 | 137 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * @param $fetch |
145 | 145 | */ |
146 | 146 | protected function logQuery($query, $fetch) { |
147 | - if(!classSupernova::$config->debug) { |
|
147 | + if (!classSupernova::$config->debug) { |
|
148 | 148 | return; |
149 | 149 | } |
150 | 150 | |
@@ -162,18 +162,18 @@ discard block |
||
162 | 162 | * @return void |
163 | 163 | */ |
164 | 164 | protected function commentQuery(&$sql) { |
165 | - if(!defined('DEBUG_SQL_COMMENT')) { |
|
165 | + if (!defined('DEBUG_SQL_COMMENT')) { |
|
166 | 166 | return; |
167 | 167 | } |
168 | 168 | $backtrace = debug_backtrace(); |
169 | 169 | $sql_comment = classSupernova::$debug->compact_backtrace($backtrace, defined('DEBUG_SQL_COMMENT_LONG')); |
170 | 170 | |
171 | 171 | $sql_commented = '/* ' . implode("<br />", $sql_comment) . '<br /> */ ' . preg_replace("/\s+/", ' ', $sql); |
172 | - if(defined('DEBUG_SQL_ONLINE')) { |
|
172 | + if (defined('DEBUG_SQL_ONLINE')) { |
|
173 | 173 | classSupernova::$debug->warning($sql_commented, 'SQL Debug', LOG_DEBUG_SQL); |
174 | 174 | } |
175 | 175 | |
176 | - if(defined('DEBUG_SQL_ERROR')) { |
|
176 | + if (defined('DEBUG_SQL_ERROR')) { |
|
177 | 177 | array_unshift($sql_comment, preg_replace("/\s+/", ' ', $sql)); |
178 | 178 | classSupernova::$debug->add_to_array($sql_comment); |
179 | 179 | } |
@@ -182,11 +182,11 @@ discard block |
||
182 | 182 | } |
183 | 183 | |
184 | 184 | public function doquery($query, $table = '', $fetch = false, $skip_query_check = false) { |
185 | - if(!is_string($table)) { |
|
185 | + if (!is_string($table)) { |
|
186 | 186 | $fetch = $table; |
187 | 187 | } |
188 | 188 | |
189 | - if(!$this->connected) { |
|
189 | + if (!$this->connected) { |
|
190 | 190 | $this->sn_db_connect(); |
191 | 191 | } |
192 | 192 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | protected function security_watch_user_queries($query) { |
208 | 208 | global $user; |
209 | 209 | |
210 | - if( |
|
210 | + if ( |
|
211 | 211 | !$this->isWatching // Not already watching |
212 | 212 | && !empty(classSupernova::$config->game_watchlist_array) // There is some players in watchlist |
213 | 213 | && in_array($user['id'], classSupernova::$config->game_watchlist_array) // Current player is in watchlist |
@@ -215,10 +215,10 @@ discard block |
||
215 | 215 | ) { |
216 | 216 | $this->isWatching = true; |
217 | 217 | $msg = "\$query = \"{$query}\"\n\r"; |
218 | - if(!empty($_POST)) { |
|
218 | + if (!empty($_POST)) { |
|
219 | 219 | $msg .= "\n\r" . dump($_POST, '$_POST'); |
220 | 220 | } |
221 | - if(!empty($_GET)) { |
|
221 | + if (!empty($_GET)) { |
|
222 | 222 | $msg .= "\n\r" . dump($_GET, '$_GET'); |
223 | 223 | } |
224 | 224 | classSupernova::$debug->warning($msg, "Watching user {$user['id']}", 399, array('base_dump' => true)); |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | public function security_query_check_bad_words($query) { |
231 | 231 | global $user, $dm_change_legit, $mm_change_legit; |
232 | 232 | |
233 | - switch(true) { |
|
233 | + switch (true) { |
|
234 | 234 | case stripos($query, 'RUNCATE TABL') != false: |
235 | 235 | case stripos($query, 'ROP TABL') != false: |
236 | 236 | case stripos($query, 'ENAME TABL') != false: |
@@ -292,11 +292,11 @@ discard block |
||
292 | 292 | $prefix_length = strlen($this->db_prefix); |
293 | 293 | |
294 | 294 | $tl = array(); |
295 | - while($row = $this->db_fetch($query)) { |
|
296 | - foreach($row as $table_name) { |
|
297 | - if(strpos($table_name, $this->db_prefix) === 0) { |
|
295 | + while ($row = $this->db_fetch($query)) { |
|
296 | + foreach ($row as $table_name) { |
|
297 | + if (strpos($table_name, $this->db_prefix) === 0) { |
|
298 | 298 | $table_name = substr($table_name, $prefix_length); |
299 | - } elseif($prefixed_only) { |
|
299 | + } elseif ($prefixed_only) { |
|
300 | 300 | continue; |
301 | 301 | } |
302 | 302 | // $table_name = str_replace($db_prefix, '', $table_name); |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | $result = array(); |
392 | 392 | |
393 | 393 | $status = explode(' ', $this->driver->mysql_stat()); |
394 | - foreach($status as $value) { |
|
394 | + foreach ($status as $value) { |
|
395 | 395 | $row = explode(': ', $value); |
396 | 396 | $result[$row[0]] = $row[1]; |
397 | 397 | } |
@@ -407,10 +407,10 @@ discard block |
||
407 | 407 | $result = array(); |
408 | 408 | |
409 | 409 | $query = $this->db_sql_query('SHOW STATUS;'); |
410 | - if(is_bool($query)) { |
|
410 | + if (is_bool($query)) { |
|
411 | 411 | throw new Exception('Result of SHOW STATUS command is boolean - which should never happen. Connection to DB is lost?'); |
412 | 412 | } |
413 | - while($row = db_fetch($query)) { |
|
413 | + while ($row = db_fetch($query)) { |
|
414 | 414 | $result[$row['Variable_name']] = $row['Value']; |
415 | 415 | } |
416 | 416 |