@@ -452,11 +452,13 @@ discard block |
||
452 | 452 | $location_info = &static::$location_info[$location_type]; |
453 | 453 | $id_field = $location_info[P_ID]; |
454 | 454 | $table_name = $location_info[P_TABLE_NAME]; |
455 | - if ($result = static::db_query_update("UPDATE {{{$table_name}}} SET {$set} WHERE `{$id_field}` = {$record_id}")) // TODO Как-то вернуть может быть LIMIT 1 ? |
|
455 | + if ($result = static::db_query_update("UPDATE {{{$table_name}}} SET {$set} WHERE `{$id_field}` = {$record_id}")) { |
|
456 | + // TODO Как-то вернуть может быть LIMIT 1 ? |
|
456 | 457 | { |
457 | 458 | if (static::$db->db_affected_rows()) { |
458 | 459 | // Обновляем данные только если ряд был затронут |
459 | 460 | DBStaticUnit::cache_clear(); |
461 | + } |
|
460 | 462 | } |
461 | 463 | } |
462 | 464 | |
@@ -486,9 +488,11 @@ discard block |
||
486 | 488 | $set = trim($set); |
487 | 489 | $table_name = static::$location_info[$location_type][P_TABLE_NAME]; |
488 | 490 | if ($result = static::db_query_insert("INSERT INTO `{{{$table_name}}}` SET {$set}")) { |
489 | - if (static::$db->db_affected_rows()) // Обновляем данные только если ряд был затронут |
|
491 | + if (static::$db->db_affected_rows()) { |
|
492 | + // Обновляем данные только если ряд был затронут |
|
490 | 493 | { |
491 | 494 | $record_id = SN::$db->db_insert_id(); |
495 | + } |
|
492 | 496 | // Вытаскиваем запись целиком, потому что в $set могли быть "данные по умолчанию" |
493 | 497 | $result = static::db_get_record_by_id($location_type, $record_id); |
494 | 498 | // Очищаем второстепенные кэши - потому что вставленная запись могла повлиять на результаты запросов или локация или еще чего |
@@ -508,10 +512,12 @@ discard block |
||
508 | 512 | $id_field = $location_info[P_ID]; |
509 | 513 | $table_name = $location_info[P_TABLE_NAME]; |
510 | 514 | if ($result = static::db_query_delete("DELETE FROM `{{{$table_name}}}` WHERE `{$id_field}` = {$safe_record_id}")) { |
511 | - if (static::$db->db_affected_rows()) // Обновляем данные только если ряд был затронут |
|
515 | + if (static::$db->db_affected_rows()) { |
|
516 | + // Обновляем данные только если ряд был затронут |
|
512 | 517 | { |
513 | 518 | DBStaticUnit::cache_clear(); |
514 | 519 | } |
520 | + } |
|
515 | 521 | } |
516 | 522 | |
517 | 523 | return $result; |
@@ -525,11 +531,13 @@ discard block |
||
525 | 531 | $table_name = static::$location_info[$location_type][P_TABLE_NAME]; |
526 | 532 | |
527 | 533 | if ($result = static::db_query_delete("DELETE FROM `{{{$table_name}}}` WHERE {$condition}")) { |
528 | - if (static::$db->db_affected_rows()) // Обновляем данные только если ряд был затронут |
|
534 | + if (static::$db->db_affected_rows()) { |
|
535 | + // Обновляем данные только если ряд был затронут |
|
529 | 536 | { |
530 | 537 | // Обнуление кэша, потому что непонятно, что поменялось |
531 | 538 | DBStaticUnit::cache_clear(); |
532 | 539 | } |
540 | + } |
|
533 | 541 | } |
534 | 542 | |
535 | 543 | return $result; |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * que esperabas!!! soy newbie!!! D':< |
26 | 26 | */ |
27 | 27 | |
28 | -if(!defined('INSIDE')) { |
|
28 | +if (!defined('INSIDE')) { |
|
29 | 29 | die("attemp hacking"); |
30 | 30 | } |
31 | 31 | |
@@ -84,8 +84,8 @@ discard block |
||
84 | 84 | $result = array(); |
85 | 85 | $transaction_id = SN::db_transaction_check(false) ? SN::$transaction_id : SN::$transaction_id++; |
86 | 86 | $result[] = "tID {$transaction_id}"; |
87 | - foreach($backtrace as $a_trace) { |
|
88 | - if(in_array($a_trace['function'], $exclude_functions)) { |
|
87 | + foreach ($backtrace as $a_trace) { |
|
88 | + if (in_array($a_trace['function'], $exclude_functions)) { |
|
89 | 89 | continue; |
90 | 90 | } |
91 | 91 | $function = |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | $line = !empty($a_trace['line']) ? $a_trace['line'] : '_UNDEFINED_'; |
103 | 103 | $result[] = "{$function} - '{$file}' Line {$line}"; |
104 | 104 | |
105 | - if(!$long_comment) { |
|
105 | + if (!$long_comment) { |
|
106 | 106 | break; |
107 | 107 | } |
108 | 108 | } |
@@ -111,26 +111,26 @@ discard block |
||
111 | 111 | } |
112 | 112 | |
113 | 113 | function dump($dump = false, $force_base = false, $deadlock = false) { |
114 | - if($dump === false) { |
|
114 | + if ($dump === false) { |
|
115 | 115 | return []; |
116 | 116 | } |
117 | 117 | |
118 | 118 | $error_backtrace = array(); |
119 | 119 | $base_dump = false; |
120 | 120 | |
121 | - if($force_base === true) { |
|
121 | + if ($force_base === true) { |
|
122 | 122 | $base_dump = true; |
123 | 123 | } |
124 | 124 | |
125 | - if($dump === true) { |
|
125 | + if ($dump === true) { |
|
126 | 126 | $base_dump = true; |
127 | 127 | } else { |
128 | - if(!is_array($dump)) { |
|
128 | + if (!is_array($dump)) { |
|
129 | 129 | $dump = array('var' => $dump); |
130 | 130 | } |
131 | 131 | |
132 | - foreach($dump as $dump_var_name => $dump_var) { |
|
133 | - if($dump_var_name == 'base_dump') { |
|
132 | + foreach ($dump as $dump_var_name => $dump_var) { |
|
133 | + if ($dump_var_name == 'base_dump') { |
|
134 | 134 | $base_dump = $dump_var; |
135 | 135 | } else { |
136 | 136 | $error_backtrace[$dump_var_name] = $dump_var; |
@@ -138,22 +138,21 @@ discard block |
||
138 | 138 | } |
139 | 139 | } |
140 | 140 | |
141 | - if($deadlock && ($q = SN::$db->mysql_get_innodb_status())) { |
|
141 | + if ($deadlock && ($q = SN::$db->mysql_get_innodb_status())) { |
|
142 | 142 | $error_backtrace['deadlock'] = explode("\n", $q['Status']); |
143 | - foreach($error_backtrace['cSN_data'] as &$location) { |
|
144 | - foreach($location as $location_id => &$location_data) // $location_data = $location_id; |
|
143 | + foreach ($error_backtrace['cSN_data'] as &$location) { |
|
144 | + foreach ($location as $location_id => &$location_data) // $location_data = $location_id; |
|
145 | 145 | { |
146 | - $location_data = isset($location_data['username']) ? $location_data['username'] : |
|
147 | - (isset($location_data['name']) ? $location_data['name'] : $location_id); |
|
146 | + $location_data = isset($location_data['username']) ? $location_data['username'] : (isset($location_data['name']) ? $location_data['name'] : $location_id); |
|
148 | 147 | } |
149 | 148 | } |
150 | 149 | } |
151 | 150 | |
152 | - if($base_dump) { |
|
153 | - if(!is_array($this->log_array) || empty($this->log_array)) { |
|
151 | + if ($base_dump) { |
|
152 | + if (!is_array($this->log_array) || empty($this->log_array)) { |
|
154 | 153 | $this->log_array = []; |
155 | 154 | } else { |
156 | - foreach($this->log_array as $log) { |
|
155 | + foreach ($this->log_array as $log) { |
|
157 | 156 | $error_backtrace['queries'][] = $log; |
158 | 157 | } |
159 | 158 | } |
@@ -165,17 +164,17 @@ discard block |
||
165 | 164 | // Converting object instances to object names |
166 | 165 | |
167 | 166 | foreach ($error_backtrace['backtrace'] as &$backtrace) { |
168 | - if(is_object($backtrace['object'])) { |
|
167 | + if (is_object($backtrace['object'])) { |
|
169 | 168 | $backtrace['object'] = get_class($backtrace['object']); |
170 | 169 | } |
171 | 170 | |
172 | - if(empty($backtrace['args'])) { |
|
171 | + if (empty($backtrace['args'])) { |
|
173 | 172 | continue; |
174 | 173 | } |
175 | 174 | |
176 | 175 | // Doing same conversion for backtrace params |
177 | - foreach($backtrace['args'] as &$arg) { |
|
178 | - if(is_object($arg)) { |
|
176 | + foreach ($backtrace['args'] as &$arg) { |
|
177 | + if (is_object($arg)) { |
|
179 | 178 | $arg = 'object::' . get_class($arg); |
180 | 179 | } |
181 | 180 | } |
@@ -204,14 +203,14 @@ discard block |
||
204 | 203 | function error($message = 'There is a error on page', $title = 'Internal Error', $httpCode = 500, $dump = true) { |
205 | 204 | global $config, $sys_stop_log_hit, $lang, $sys_log_disabled, $user; |
206 | 205 | |
207 | - if(empty(SN::$db->connected)) { |
|
206 | + if (empty(SN::$db->connected)) { |
|
208 | 207 | // TODO - писать ошибку в файл |
209 | 208 | die('SQL server currently unavailable. Please contact Administration...'); |
210 | 209 | } |
211 | 210 | |
212 | 211 | SN::db_transaction_rollback(); |
213 | 212 | |
214 | - if(SN::$config->debug == 1) { |
|
213 | + if (SN::$config->debug == 1) { |
|
215 | 214 | /** @noinspection HtmlDeprecatedTag */ |
216 | 215 | /** @noinspection XmlDeprecatedElement */ |
217 | 216 | /** @noinspection HtmlDeprecatedAttribute */ |
@@ -224,7 +223,7 @@ discard block |
||
224 | 223 | $error_text = SN::$db->db_escape($message); |
225 | 224 | $error_backtrace = $this->dump($dump, true, strpos($message, 'Deadlock') !== false); |
226 | 225 | |
227 | - if(!$sys_log_disabled) { |
|
226 | + if (!$sys_log_disabled) { |
|
228 | 227 | $this->_writeLogMessage($httpCode, $user, $title, $message, $error_backtrace, $fatal_error); |
229 | 228 | |
230 | 229 | $message = "Пожалуйста, свяжитесь с админом, если ошибка повторится. Ошибка №: <b>" . SN::$db->db_insert_id() . "</b>"; |
@@ -237,7 +236,7 @@ discard block |
||
237 | 236 | ob_start(); |
238 | 237 | print("<hr>User ID {$user['id']} raised error code {$httpCode} titled '{$title}' with text '{$error_text}' on page {$_SERVER['SCRIPT_NAME']}"); |
239 | 238 | |
240 | - foreach($error_backtrace as $name => $value) { |
|
239 | + foreach ($error_backtrace as $name => $value) { |
|
241 | 240 | print('<hr>'); |
242 | 241 | pdump($value, $name); |
243 | 242 | } |
@@ -249,7 +248,7 @@ discard block |
||
249 | 248 | function warning($message, $title = 'System Message', $httpCode = 300, $dump = false) { |
250 | 249 | global $user, $lang, $sys_log_disabled; |
251 | 250 | |
252 | - if(empty(SN::$db->connected)) { |
|
251 | + if (empty(SN::$db->connected)) { |
|
253 | 252 | // TODO - писать ошибку в файл |
254 | 253 | die('SQL server currently unavailable. Please contact Administration...'); |
255 | 254 | } |
@@ -258,7 +257,7 @@ discard block |
||
258 | 257 | |
259 | 258 | $error_backtrace = $this->dump($dump, false); |
260 | 259 | |
261 | - if(empty($sys_log_disabled)) { |
|
260 | + if (empty($sys_log_disabled)) { |
|
262 | 261 | $this->_writeLogMessage($httpCode, $user, $title, $message, $error_backtrace, $fatal_error); |
263 | 262 | } else { |
264 | 263 | // // TODO Здесь надо писать в файло |
@@ -295,11 +294,11 @@ discard block |
||
295 | 294 | // Dump variables nicer then var_dump() |
296 | 295 | |
297 | 296 | function dump($value, $varname = null, $level = 0, $dumper = '') { |
298 | - if(isset($varname)) { |
|
297 | + if (isset($varname)) { |
|
299 | 298 | $varname .= " = "; |
300 | 299 | } |
301 | 300 | |
302 | - if($level == -1) { |
|
301 | + if ($level == -1) { |
|
303 | 302 | $trans[' '] = '∴'; |
304 | 303 | $trans["\t"] = '⇒'; |
305 | 304 | $trans["\n"] = '¶;'; |
@@ -308,7 +307,7 @@ discard block |
||
308 | 307 | |
309 | 308 | return strtr(htmlspecialchars($value), $trans); |
310 | 309 | } |
311 | - if($level == 0) { |
|
310 | + if ($level == 0) { |
|
312 | 311 | // $dumper = '<pre>' . mt_rand(10, 99) . '|' . $varname; |
313 | 312 | $dumper = mt_rand(10, 99) . '|' . $varname; |
314 | 313 | } |
@@ -316,22 +315,22 @@ discard block |
||
316 | 315 | $type = gettype($value); |
317 | 316 | $dumper .= $type; |
318 | 317 | |
319 | - if($type == 'string') { |
|
318 | + if ($type == 'string') { |
|
320 | 319 | $dumper .= '(' . strlen($value) . ')'; |
321 | 320 | $value = dump($value, '', -1); |
322 | - } elseif($type == 'boolean') { |
|
321 | + } elseif ($type == 'boolean') { |
|
323 | 322 | $value = ($value ? 'true' : 'false'); |
324 | - } elseif($type == 'object') { |
|
323 | + } elseif ($type == 'object') { |
|
325 | 324 | $props = get_class_vars(get_class($value)); |
326 | 325 | $dumper .= '(' . count($props) . ') <u>' . get_class($value) . '</u>'; |
327 | - foreach($props as $key => $val) { |
|
326 | + foreach ($props as $key => $val) { |
|
328 | 327 | $dumper .= "\n" . str_repeat("\t", $level + 1) . $key . ' => '; |
329 | 328 | $dumper .= dump($value->$key, '', $level + 1); |
330 | 329 | } |
331 | 330 | $value = ''; |
332 | - } elseif($type == 'array') { |
|
331 | + } elseif ($type == 'array') { |
|
333 | 332 | $dumper .= '(' . count($value) . ')'; |
334 | - foreach($value as $key => $val) { |
|
333 | + foreach ($value as $key => $val) { |
|
335 | 334 | $dumper .= "\n" . str_repeat("\t", $level + 1) . dump($key, '', -1) . ' => '; |
336 | 335 | $dumper .= dump($val, '', $level + 1); |
337 | 336 | } |
@@ -351,7 +350,7 @@ discard block |
||
351 | 350 | // $backtrace = $backtrace[1]; |
352 | 351 | |
353 | 352 | $caller = ''; |
354 | - if(defined('SN_DEBUG_PDUMP_CALLER') && SN_DEBUG_PDUMP_CALLER) { |
|
353 | + if (defined('SN_DEBUG_PDUMP_CALLER') && SN_DEBUG_PDUMP_CALLER) { |
|
355 | 354 | $caller = (!empty($backtrace[1]['class']) ? $backtrace[1]['class'] : '') . |
356 | 355 | (!empty($backtrace[1]['type']) ? $backtrace[1]['type'] : '') . |
357 | 356 | $backtrace[1]['function'] . |
@@ -386,7 +385,7 @@ discard block |
||
386 | 385 | } |
387 | 386 | |
388 | 387 | function pr($prePrint = false) { |
389 | - if($prePrint) { |
|
388 | + if ($prePrint) { |
|
390 | 389 | print("<br>"); |
391 | 390 | } |
392 | 391 | print(mt_rand() . "<br>"); |
@@ -396,7 +395,7 @@ discard block |
||
396 | 395 | global $_PRINT_COUNT_VALUE; |
397 | 396 | $_PRINT_COUNT_VALUE++; |
398 | 397 | |
399 | - if($prePrint) { |
|
398 | + if ($prePrint) { |
|
400 | 399 | print("<br>"); |
401 | 400 | } |
402 | 401 | print($_PRINT_COUNT_VALUE . "<br>"); |
@@ -141,11 +141,13 @@ discard block |
||
141 | 141 | if($deadlock && ($q = SN::$db->mysql_get_innodb_status())) { |
142 | 142 | $error_backtrace['deadlock'] = explode("\n", $q['Status']); |
143 | 143 | foreach($error_backtrace['cSN_data'] as &$location) { |
144 | - foreach($location as $location_id => &$location_data) // $location_data = $location_id; |
|
144 | + foreach($location as $location_id => &$location_data) { |
|
145 | + // $location_data = $location_id; |
|
145 | 146 | { |
146 | 147 | $location_data = isset($location_data['username']) ? $location_data['username'] : |
147 | 148 | (isset($location_data['name']) ? $location_data['name'] : $location_id); |
148 | 149 | } |
150 | + } |
|
149 | 151 | } |
150 | 152 | } |
151 | 153 | |
@@ -276,8 +278,7 @@ discard block |
||
276 | 278 | * |
277 | 279 | * @return void |
278 | 280 | */ |
279 | - function _writeLogMessage($httpCode, $user, $title, $message, array $error_backtrace, $fatal_error) |
|
280 | - { |
|
281 | + function _writeLogMessage($httpCode, $user, $title, $message, array $error_backtrace, $fatal_error) { |
|
281 | 282 | /** @noinspection SqlResolve */ |
282 | 283 | $query = "INSERT INTO `{{logs}}` SET |
283 | 284 | `log_time` = '" . time() . "', `log_code` = '" . SN::$db->db_escape($httpCode) . "', " . |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | $unit_snid = intval($unit_snid); |
46 | 46 | |
47 | - $resultOld = $unit_snid ? (isset($allUnits[$unit_snid]) ? $allUnits[$unit_snid] : null ) : $allUnits; |
|
47 | + $resultOld = $unit_snid ? (isset($allUnits[$unit_snid]) ? $allUnits[$unit_snid] : null) : $allUnits; |
|
48 | 48 | |
49 | 49 | return $resultOld; |
50 | 50 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | } |
88 | 88 | |
89 | 89 | public static function db_unit_count_by_user_and_type_and_snid($user_id, $unit_type = 0, $unit_snid = 0) { |
90 | - $query = doquery( |
|
90 | + $query = doquery( |
|
91 | 91 | "SELECT unit_snid, sum(unit_level) as `qty` FROM {{unit}} WHERE `unit_player_id` = {$user_id} " . |
92 | 92 | ($unit_type ? "AND `unit_type` = {$unit_type} " : '') . |
93 | 93 | ($unit_snid ? "AND `unit_snid` = {$unit_snid} " : '') . |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | * @return bool |
237 | 237 | */ |
238 | 238 | protected static function dbAdd($playerId, $planetId, $unitSnId, $amount) { |
239 | - if (!in_array($unitSnId, sn_get_groups([UNIT_SHIPS_STR, UNIT_DEFENCE_STR, UNIT_ARTIFACTS_STR, UNIT_STRUCTURES_STR,]))) { |
|
239 | + if (!in_array($unitSnId, sn_get_groups([UNIT_SHIPS_STR, UNIT_DEFENCE_STR, UNIT_ARTIFACTS_STR, UNIT_STRUCTURES_STR, ]))) { |
|
240 | 240 | return false; |
241 | 241 | } |
242 | 242 | |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | // 'unit_level' => $level, |
270 | 270 | // ]); |
271 | 271 | |
272 | - $fields += [ |
|
272 | + $fields += [ |
|
273 | 273 | 'unit_type' => get_unit_param($unitSnId, P_UNIT_TYPE), |
274 | 274 | 'unit_level' => $amount, |
275 | 275 | ]; |
@@ -237,9 +237,9 @@ discard block |
||
237 | 237 | 'advGoogleLeftMenuCode' => '(Place here code for banner)', |
238 | 238 | |
239 | 239 | // Alliance bonus calculations |
240 | - 'ali_bonus_algorithm' => 0, // Bonus calculation algorithm |
|
240 | + 'ali_bonus_algorithm' => 0, // Bonus calculation algorithm |
|
241 | 241 | 'ali_bonus_brackets' => 10, // Brackets count for ALI_BONUS_BY_RANK |
242 | - 'ali_bonus_brackets_divisor' => 10,// Bonus divisor for ALI_BONUS_BY_RANK |
|
242 | + 'ali_bonus_brackets_divisor' => 10, // Bonus divisor for ALI_BONUS_BY_RANK |
|
243 | 243 | 'ali_bonus_divisor' => 10000000, // Rank divisor for ALI_BONUS_BY_POINTS |
244 | 244 | 'ali_bonus_members' => 10, // Minimum alliance size to start using bonus |
245 | 245 | |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | |
282 | 282 | 'eco_scale_storage' => 1, |
283 | 283 | 'eco_stockman_fleet' => '', // Black Market - Starting amount of s/h ship merchant to sell |
284 | - 'eco_stockman_fleet_populate' => 1, // Populate empty Stockman fleet with ships or not |
|
284 | + 'eco_stockman_fleet_populate' => 1, // Populate empty Stockman fleet with ships or not |
|
285 | 285 | 'empire_mercenary_base_period' => PERIOD_MONTH, // Base |
286 | 286 | 'empire_mercenary_temporary' => 0, // Temporary empire-wide mercenaries |
287 | 287 | |
@@ -292,21 +292,21 @@ discard block |
||
292 | 292 | 'energy_basic_income' => 0, |
293 | 293 | |
294 | 294 | // Bashing protection settings |
295 | - 'fleet_bashing_attacks' => 3, // Max amount of attack per wave - 3 by default |
|
296 | - 'fleet_bashing_interval' => 1800, // Maximum interval between attacks when they still count as one wave - 30m by default |
|
297 | - 'fleet_bashing_scope' => 86400, // Interval on which bashing waves counts - 24h by default |
|
298 | - 'fleet_bashing_war_delay' => 43200, // Delay before start bashing after declaring war to alliance - 12h by default |
|
299 | - 'fleet_bashing_waves' => 3, // Max amount of waves per day - 3 by default |
|
295 | + 'fleet_bashing_attacks' => 3, // Max amount of attack per wave - 3 by default |
|
296 | + 'fleet_bashing_interval' => 1800, // Maximum interval between attacks when they still count as one wave - 30m by default |
|
297 | + 'fleet_bashing_scope' => 86400, // Interval on which bashing waves counts - 24h by default |
|
298 | + 'fleet_bashing_war_delay' => 43200, // Delay before start bashing after declaring war to alliance - 12h by default |
|
299 | + 'fleet_bashing_waves' => 3, // Max amount of waves per day - 3 by default |
|
300 | 300 | |
301 | 301 | 'Fleet_Cdr' => 30, |
302 | 302 | 'fleet_speed' => 1, |
303 | 303 | |
304 | - self::FLEET_UPDATE_MAX_RUN_TIME => 30, // Maximum length in seconds for single fleet dispatch run |
|
304 | + self::FLEET_UPDATE_MAX_RUN_TIME => 30, // Maximum length in seconds for single fleet dispatch run |
|
305 | 305 | 'fleet_update_interval' => 4, |
306 | 306 | 'fleet_update_lock' => '', // SQL time when lock was acquired |
307 | 307 | |
308 | - 'game_adminEmail' => 'root@localhost', // Admin email to show to users |
|
309 | - 'game_counter' => 0, // Does built-in page hit counter is on? |
|
308 | + 'game_adminEmail' => 'root@localhost', // Admin email to show to users |
|
309 | + 'game_counter' => 0, // Does built-in page hit counter is on? |
|
310 | 310 | // Defaults |
311 | 311 | 'game_default_language' => 'ru', |
312 | 312 | 'game_default_skin' => 'skins/EpicBlue/', |
@@ -320,14 +320,14 @@ discard block |
||
320 | 320 | 'game_maxSystem' => 199, |
321 | 321 | 'game_maxPlanet' => 15, |
322 | 322 | // Game global settings |
323 | - 'game_mode' => 0, // 0 - SuperNova, 1 - oGame |
|
323 | + 'game_mode' => 0, // 0 - SuperNova, 1 - oGame |
|
324 | 324 | 'game_name' => 'SuperNova', // Server name (would be on banners and on top of left menu) |
325 | 325 | |
326 | 326 | 'game_news_actual' => PERIOD_DAY_3, // How long announcement would be marked as "New". In seconds. Default - 3 days |
327 | - 'game_news_overview' => 3, // How much last news to show in Overview page |
|
328 | - 'game_news_overview_show' => PERIOD_WEEK_2, // How long news will be shown in Overview page in seconds. Default - 2 weeks |
|
327 | + 'game_news_overview' => 3, // How much last news to show in Overview page |
|
328 | + 'game_news_overview_show' => PERIOD_WEEK_2, // How long news will be shown in Overview page in seconds. Default - 2 weeks |
|
329 | 329 | // Noob protection |
330 | - 'game_noob_factor' => 5, // Multiplier to divide "stronger" and "weaker" users |
|
330 | + 'game_noob_factor' => 5, // Multiplier to divide "stronger" and "weaker" users |
|
331 | 331 | 'game_noob_points' => 5000, // Below this point user treated as noob. 0 to disable |
332 | 332 | |
333 | 333 | 'game_multiaccount_enabled' => 0, // 1 - allow interactions for players with same IP (multiaccount) |
@@ -382,12 +382,12 @@ discard block |
||
382 | 382 | 'payment_currency_exchange_wmz' => 1, |
383 | 383 | 'payment_currency_exchange_pln' => 3.86, |
384 | 384 | |
385 | - 'payment_lot_price' => 1, // Lot's price in default currency |
|
386 | - 'payment_lot_size' => 2500, // Lot size. Also service as minimum amount of DM that could be bought with one transaction |
|
385 | + 'payment_lot_price' => 1, // Lot's price in default currency |
|
386 | + 'payment_lot_size' => 2500, // Lot size. Also service as minimum amount of DM that could be bought with one transaction |
|
387 | 387 | |
388 | 388 | 'planet_capital_cost' => 25000, // Cost in DM to move Capital to current planet |
389 | - 'planet_capital_mining_rate' => 2.0, // Capital Mining rates |
|
390 | - 'planet_capital_building_rate' => 2.0, // Capital Building rates |
|
389 | + 'planet_capital_mining_rate' => 2.0, // Capital Mining rates |
|
390 | + 'planet_capital_building_rate' => 2.0, // Capital Building rates |
|
391 | 391 | 'planet_teleport_cost' => 50000, // Cost of planet teleportation |
392 | 392 | 'planet_teleport_timeout' => 86400, // Timeout for next teleportation |
393 | 393 | |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | 'resource_multiplier' => 1, |
410 | 410 | |
411 | 411 | //Role play system |
412 | - 'rpg_bonus_divisor' => 10, // Amount of DM referral should get for partner have 1 DM bonus |
|
412 | + 'rpg_bonus_divisor' => 10, // Amount of DM referral should get for partner have 1 DM bonus |
|
413 | 413 | 'rpg_bonus_minimum' => 10000, // Minimum DM amount for starting paying bonuses to affiliate |
414 | 414 | |
415 | 415 | // Black Market - General |
@@ -474,12 +474,12 @@ discard block |
||
474 | 474 | 'url_purchase_metamatter' => '', |
475 | 475 | 'url_rules' => '', |
476 | 476 | |
477 | - 'users_amount' => 1, // Total users count |
|
477 | + 'users_amount' => 1, // Total users count |
|
478 | 478 | 'game_users_online_timeout' => PERIOD_MINUTE_15, // Seconds, How long user should consider ONLINE for online counter |
479 | - 'game_users_update_online' => 30, // How often user online should be refreshed (seconds) |
|
480 | - 'var_online_user_time' => 0, // When last time user online was refreshed |
|
481 | - 'var_online_user_count' => 0, // Last calculated online user count |
|
482 | - 'server_log_online' => 0, // Log online user count |
|
479 | + 'game_users_update_online' => 30, // How often user online should be refreshed (seconds) |
|
480 | + 'var_online_user_time' => 0, // When last time user online was refreshed |
|
481 | + 'var_online_user_count' => 0, // Last calculated online user count |
|
482 | + 'server_log_online' => 0, // Log online user count |
|
483 | 483 | |
484 | 484 | 'user_birthday_celebrate' => 0, // When last time celebrations (i.e. gift-giving) was made - timestamp |
485 | 485 | 'user_birthday_gift' => 0, // User birthday gift - Dark Matter points |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $insert_position = $is_positioned == '-' ? 0 : count($menu); |
129 | 129 | } |
130 | 130 | |
131 | - $insert_position += $is_positioned == '+' ? 1 : 0; |
|
131 | + $insert_position += $is_positioned == '+' ? 1 : 0; |
|
132 | 132 | $spliced = array_splice($menu, $insert_position, count($menu) - $insert_position); |
133 | 133 | $menu[$menu_item_id] = $menu_item; |
134 | 134 | |
@@ -541,11 +541,11 @@ discard block |
||
541 | 541 | * @return array |
542 | 542 | */ |
543 | 543 | public static function addFileName($fileNames, $anArray, $ext = '.css') { |
544 | - if(!is_array($fileNames)) { |
|
544 | + if (!is_array($fileNames)) { |
|
545 | 545 | $fileNames = [$fileNames]; |
546 | 546 | } |
547 | 547 | |
548 | - foreach($fileNames as $fileName) { |
|
548 | + foreach ($fileNames as $fileName) { |
|
549 | 549 | if (file_exists(SN_ROOT_PHYSICAL . $fileName . '.min' . $ext)) { |
550 | 550 | $anArray[$fileName . '.min' . $ext] = ''; |
551 | 551 | } elseif (file_exists(SN_ROOT_PHYSICAL . $fileName . '.css' . $ext)) { |
@@ -676,7 +676,7 @@ discard block |
||
676 | 676 | 'LANG' => $language ? $language : '', |
677 | 677 | 'referral' => $id_ref ? '&id_ref=' . $id_ref : '', |
678 | 678 | |
679 | - 'REQUEST_PARAMS' => !empty($url_params) ? '?' . implode('&', $url_params) : '',// "?lang={$language}" . ($id_ref ? "&id_ref={$id_ref}" : ''), |
|
679 | + 'REQUEST_PARAMS' => !empty($url_params) ? '?' . implode('&', $url_params) : '', // "?lang={$language}" . ($id_ref ? "&id_ref={$id_ref}" : ''), |
|
680 | 680 | 'FILENAME' => basename($_SERVER['PHP_SELF']), |
681 | 681 | )); |
682 | 682 | |
@@ -909,7 +909,7 @@ discard block |
||
909 | 909 | 'QUE_ID' => QUE_RESEARCH, |
910 | 910 | 'QUE_HTML' => 'topnav', |
911 | 911 | |
912 | - 'RESEARCH_ONGOING' => (boolean)$user['que'], |
|
912 | + 'RESEARCH_ONGOING' => (boolean) $user['que'], |
|
913 | 913 | |
914 | 914 | 'TIME_TEXT' => sprintf($str_date_format, $time_now_parsed['year'], $lang['months'][$time_now_parsed['mon']], $time_now_parsed['mday'], |
915 | 915 | $time_now_parsed['hours'], $time_now_parsed['minutes'], $time_now_parsed['seconds'] |
@@ -1199,7 +1199,7 @@ discard block |
||
1199 | 1199 | SnTemplate::renderFooter($page, $template_result); |
1200 | 1200 | } |
1201 | 1201 | |
1202 | - $user['authlevel'] >= 3 && $config->debug ? $debug->echo_log() : false;; |
|
1202 | + $user['authlevel'] >= 3 && $config->debug ? $debug->echo_log() : false; ; |
|
1203 | 1203 | |
1204 | 1204 | SN::$db->db_disconnect(); |
1205 | 1205 |
@@ -99,7 +99,7 @@ |
||
99 | 99 | $images = []; |
100 | 100 | |
101 | 101 | foreach (scandir($dirRealPath) as $fileNameOnly) { |
102 | - if (in_array($fileNameOnly, ['.', '..',]) || is_dir($fullPath = "$dirRealPath/$fileNameOnly")) { |
|
102 | + if (in_array($fileNameOnly, ['.', '..', ]) || is_dir($fullPath = "$dirRealPath/$fileNameOnly")) { |
|
103 | 103 | continue; |
104 | 104 | } |
105 | 105 | $images = self::tryReadFile($fullPath, $images); |
@@ -54,7 +54,7 @@ |
||
54 | 54 | } |
55 | 55 | |
56 | 56 | public function __get($property) { |
57 | - if (in_array($property, ['height', 'width',]) && ($this->$property === -1)) { |
|
57 | + if (in_array($property, ['height', 'width', ]) && ($this->$property === -1)) { |
|
58 | 58 | if (isset($this->image)) { |
59 | 59 | $this->width = imagesx($this->image); |
60 | 60 | $this->height = imagesy($this->image); |
@@ -50,7 +50,7 @@ |
||
50 | 50 | } |
51 | 51 | |
52 | 52 | public function __get($property) { |
53 | - if (in_array($property, ['height', 'width',])) { |
|
53 | + if (in_array($property, ['height', 'width', ])) { |
|
54 | 54 | return $this->getImageContainer() ? $this->getImageContainer()->$property : 0; |
55 | 55 | } |
56 | 56 |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public static function createGridSquare($images, $layout) { |
48 | 48 | $gridSize = ceil(sqrt(count($images))); |
49 | - usort($images, function (ImageFile $a, ImageFile $b) { return $b->height - $a->height; }); |
|
49 | + usort($images, function(ImageFile $a, ImageFile $b) { return $b->height - $a->height; }); |
|
50 | 50 | |
51 | 51 | $sprite = new static($gridSize); |
52 | 52 | foreach ($images as $image) { |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | $line->generate($this->height, $scaleToPx); |
95 | 95 | |
96 | 96 | $this->height += $line->height; |
97 | - $this->width = max($this->width, $line->width); |
|
97 | + $this->width = max($this->width, $line->width); |
|
98 | 98 | |
99 | 99 | // $line->image2->savePng($dirOut . count($breakpoints) . '.png'); // TODO remove debug |
100 | 100 | } |