@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | * Инициализация харнилища скинов |
153 | 153 | */ |
154 | 154 | protected static function init() { |
155 | - if(static::$is_init) { |
|
155 | + if (static::$is_init) { |
|
156 | 156 | return; |
157 | 157 | } |
158 | 158 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | |
166 | 166 | // Загружены ли уже данные по текущему скину? |
167 | 167 | //pdump(static::$skin_list[$ini_path], 'static'); |
168 | - if(empty(static::$skin_list[$skin_path])) { |
|
168 | + if (empty(static::$skin_list[$skin_path])) { |
|
169 | 169 | // Прогружаем текущий скин |
170 | 170 | static::$skin_list[$skin_path] = new skin($skin_path); |
171 | 171 | static::$active = static::$skin_list[$skin_path]; |
@@ -201,22 +201,22 @@ discard block |
||
201 | 201 | |
202 | 202 | $this->is_ini_present = false; |
203 | 203 | // Проверка на корректность и существование пути |
204 | - if(is_file($this->root_physical_absolute . 'skin.ini')) { |
|
204 | + if (is_file($this->root_physical_absolute . 'skin.ini')) { |
|
205 | 205 | // Пытаемся распарсить файл |
206 | 206 | |
207 | 207 | // По секциям? images и config? Что бы не копировать конфигурацию? Или просто unset(__inherit) а затем заново записать |
208 | 208 | $this->config = parse_ini_file($this->root_physical_absolute . 'skin.ini'); |
209 | - if(!empty($this->config)) { |
|
209 | + if (!empty($this->config)) { |
|
210 | 210 | |
211 | 211 | $this->is_ini_present = true; |
212 | 212 | |
213 | - if(!empty($this->config['_inherit'])) { |
|
213 | + if (!empty($this->config['_inherit'])) { |
|
214 | 214 | // Если скин наследует себя... |
215 | - if($this->config['_inherit'] == $skin_path) { |
|
215 | + if ($this->config['_inherit'] == $skin_path) { |
|
216 | 216 | // TODO - определять более сложные случаи циклических ссылок в _inherit |
217 | 217 | die('">circular skin inheritance!'); |
218 | 218 | } |
219 | - if(empty(static::$skin_list[$this->config['_inherit']])) { |
|
219 | + if (empty(static::$skin_list[$this->config['_inherit']])) { |
|
220 | 220 | static::$skin_list[$this->config['_inherit']] = new skin($this->config['_inherit']); |
221 | 221 | } |
222 | 222 | $this->parent = static::$skin_list[$this->config['_inherit']]; |
@@ -232,12 +232,12 @@ discard block |
||
232 | 232 | } |
233 | 233 | |
234 | 234 | // Пытаемся скомпилировать _no_image заранее |
235 | - if(!empty($this->config[SKIN_IMAGE_MISSED_FIELD])) { |
|
235 | + if (!empty($this->config[SKIN_IMAGE_MISSED_FIELD])) { |
|
236 | 236 | $this->container[SKIN_IMAGE_MISSED_FIELD] = $this->compile_try_path(SKIN_IMAGE_MISSED_FIELD, $this->config[SKIN_IMAGE_MISSED_FIELD]); |
237 | 237 | } |
238 | 238 | |
239 | 239 | // Если нет заглушки |
240 | - if(empty($this->container[SKIN_IMAGE_MISSED_FIELD])) { |
|
240 | + if (empty($this->container[SKIN_IMAGE_MISSED_FIELD])) { |
|
241 | 241 | $this->container[SKIN_IMAGE_MISSED_FIELD] = empty($this->parent) |
242 | 242 | // Если нет парента - берем хардкод |
243 | 243 | ? $this->container[SKIN_IMAGE_MISSED_FIELD] = SN_ROOT_VIRTUAL . SKIN_IMAGE_MISSED_FILE_PATH |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | $image_tag = $this->image_tag_parse($image_tag, $template); |
268 | 268 | |
269 | 269 | // Проверяем наличие ключа RIT в хранилища. В нём не может быть несуществующих файлов по построению |
270 | - if(!empty($this->container[$image_tag[SKIN_IMAGE_TAG_RESOLVED]])) { |
|
270 | + if (!empty($this->container[$image_tag[SKIN_IMAGE_TAG_RESOLVED]])) { |
|
271 | 271 | return $this->container[$image_tag[SKIN_IMAGE_TAG_RESOLVED]]; |
272 | 272 | } |
273 | 273 | |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | // Нет - image ID не является путём к файлу. Пора обратиться к предкам за помощью... |
286 | 286 | // Пытаемся вытащить путь из родителя и применить к нему свои параметры |
287 | 287 | // Тащим по ID изображения, а не по ТЭГУ - мало ли что там делает с путём родитель и как преобразовывает его в строку? |
288 | - if(empty($this->container[$image_id]) && !empty($this->parent)) { |
|
288 | + if (empty($this->container[$image_id]) && !empty($this->parent)) { |
|
289 | 289 | $this->container[$image_id] = $this->parent->compile_image($image_id, $template); |
290 | 290 | |
291 | 291 | // Если у родителя нет картинки - он вернет пустую строку. Тогда нам надо использовать заглушку - свою или родительскую |
@@ -306,18 +306,18 @@ discard block |
||
306 | 306 | protected function image_tag_parse($image_tag, $template) { |
307 | 307 | $image_tag_ptl_resolved = $image_tag; |
308 | 308 | // Есть переменные из темплейта ? |
309 | - if(strpos($image_tag_ptl_resolved, '[') !== false && is_object($template)) { |
|
309 | + if (strpos($image_tag_ptl_resolved, '[') !== false && is_object($template)) { |
|
310 | 310 | // Что бы лишний раз не запускать регексп |
311 | 311 | // TODO - многоуровневые вложения ?! Надо ли и где их можно применить |
312 | 312 | preg_match_all('#(\[.+?\])#', $image_tag_ptl_resolved, $matches); |
313 | - foreach($matches[0] as &$match) { |
|
313 | + foreach ($matches[0] as &$match) { |
|
314 | 314 | $var_name = str_replace(array('[', ']'), '', $match); |
315 | - if(strpos($var_name, '.') !== false) { |
|
315 | + if (strpos($var_name, '.') !== false) { |
|
316 | 316 | // Вложенная переменная темплейта - на текущем уровне |
317 | 317 | // TODO Вложенная переменная из корня через "!" |
318 | 318 | list($block_name, $block_var) = explode('.', $var_name); |
319 | 319 | isset($template->_block_value[$block_name][$block_var]) ? $image_tag_ptl_resolved = str_replace($match, $template->_block_value[$block_name][$block_var], $image_tag_ptl_resolved) : false; |
320 | - } elseif(strpos($var_name, '$') !== false) { |
|
320 | + } elseif (strpos($var_name, '$') !== false) { |
|
321 | 321 | // Корневой DEFINE |
322 | 322 | $define_name = substr($var_name, 1); |
323 | 323 | isset($template->_tpldata['DEFINE']['.'][$define_name]) ? $image_tag_ptl_resolved = str_replace($match, $template->_tpldata['DEFINE']['.'][$define_name], $image_tag_ptl_resolved) : false; |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | } |
329 | 329 | } |
330 | 330 | |
331 | - if(strpos($image_tag_ptl_resolved, '|') !== false) { |
|
331 | + if (strpos($image_tag_ptl_resolved, '|') !== false) { |
|
332 | 332 | $params = explode('|', $image_tag_ptl_resolved); |
333 | 333 | $image_id = $params[0]; |
334 | 334 | unset($params[0]); |
@@ -392,11 +392,11 @@ discard block |
||
392 | 392 | $image_string = $this->container[$image_tag]; |
393 | 393 | |
394 | 394 | // Нет параметров - просто возвращаем значение по $image_name из контейнера |
395 | - if(!empty($params) && is_array($params)) { |
|
395 | + if (!empty($params) && is_array($params)) { |
|
396 | 396 | // Здесь автоматически произойдёт упорядочивание параметров |
397 | 397 | |
398 | 398 | // Параметр 'html' - выводить изображение в виде HTML-тэга |
399 | - if(in_array('html', $params)) { |
|
399 | + if (in_array('html', $params)) { |
|
400 | 400 | $image_tag = $image_tag . '|html'; |
401 | 401 | $image_string = '<img src="' . $image_string . '" />'; |
402 | 402 | $this->container[$image_tag] = $image_string; |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if(!defined('IN_UPDATE') || IN_UPDATE !== true) |
|
3 | +if (!defined('IN_UPDATE') || IN_UPDATE !== true) |
|
4 | 4 | { |
5 | 5 | die('Hack attempt'); |
6 | 6 | } |
7 | 7 | |
8 | -switch($new_version) |
|
8 | +switch ($new_version) |
|
9 | 9 | { |
10 | 10 | case 0: |
11 | 11 | case 1: |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | ); |
35 | 35 | upd_drop_table('lunas'); |
36 | 36 | |
37 | - if($update_tables['galaxy']) |
|
37 | + if ($update_tables['galaxy']) |
|
38 | 38 | { |
39 | 39 | upd_do_query( |
40 | 40 | 'UPDATE `{{planets}}` |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | ); |
86 | 86 | upd_add_more_time(); |
87 | 87 | |
88 | - if($update_tables['users']['rpg_points']) |
|
88 | + if ($update_tables['users']['rpg_points']) |
|
89 | 89 | { |
90 | 90 | upd_do_query( |
91 | 91 | "UPDATE {{users}} AS u |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | |
147 | 147 | upd_drop_table('update'); |
148 | 148 | |
149 | - upd_check_key('fleet_speed', $config->fleet_speed/2500, $config->fleet_speed >= 2500); |
|
149 | + upd_check_key('fleet_speed', $config->fleet_speed / 2500, $config->fleet_speed >= 2500); |
|
150 | 150 | upd_check_key('game_counter', 0); |
151 | 151 | upd_check_key('game_default_language', 'ru'); |
152 | 152 | upd_check_key('game_default_skin', 'skins/EpicBlue/'); |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | upd_check_key('game_news_actual', 259200); |
156 | 156 | upd_check_key('game_noob_factor', 5, !isset($config->game_noob_factor)); |
157 | 157 | upd_check_key('game_noob_points', 5000, !isset($config->game_noob_points)); |
158 | - upd_check_key('game_speed', $config->game_speed/2500, $config->game_speed >= 2500); |
|
158 | + upd_check_key('game_speed', $config->game_speed / 2500, $config->game_speed >= 2500); |
|
159 | 159 | upd_check_key('int_format_date', 'd.m.Y'); |
160 | 160 | upd_check_key('int_format_time', 'H:i:s', true); |
161 | 161 | upd_check_key('int_banner_background', 'design/images/banner.png', true); |
@@ -179,22 +179,22 @@ discard block |
||
179 | 179 | upd_alter_table('planets', "ADD `governor_level` smallint unsigned NOT NULL DEFAULT '0' COMMENT 'Governor level'", !$update_tables['planets']['governor_level']); |
180 | 180 | upd_alter_table('planets', "ADD `que` varchar(4096) NOT NULL DEFAULT '' COMMENT 'Planet que'", !$update_tables['planets']['que']); |
181 | 181 | |
182 | - if($update_tables['planets']['b_building']) |
|
182 | + if ($update_tables['planets']['b_building']) |
|
183 | 183 | { |
184 | 184 | $planet_query = upd_do_query('SELECT * FROM {{planets}} WHERE `b_building` <> 0;'); |
185 | 185 | $const_que_structures = QUE_STRUCTURES; |
186 | - while($planet_data = db_fetch($planet_query)) |
|
186 | + while ($planet_data = db_fetch($planet_query)) |
|
187 | 187 | { |
188 | 188 | $old_que = explode(';', $planet_data['b_building_id']); |
189 | - foreach($old_que as $old_que_item_string) |
|
189 | + foreach ($old_que as $old_que_item_string) |
|
190 | 190 | { |
191 | - if(!$old_que_item_string) |
|
191 | + if (!$old_que_item_string) |
|
192 | 192 | { |
193 | 193 | continue; |
194 | 194 | } |
195 | 195 | |
196 | 196 | $old_que_item = explode(',', $old_que_item_string); |
197 | - if($old_que_item[4] == 'build') |
|
197 | + if ($old_que_item[4] == 'build') |
|
198 | 198 | { |
199 | 199 | $old_que_item[4] = BUILD_CREATE; |
200 | 200 | } |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;" |
231 | 231 | ); |
232 | 232 | |
233 | - if($update_tables['users']['urlaubs_until']) |
|
233 | + if ($update_tables['users']['urlaubs_until']) |
|
234 | 234 | { |
235 | 235 | upd_alter_table('users', "ADD `vacation` int(11) NOT NULL DEFAULT '0' COMMENT 'Time when user can leave vacation mode'", !$update_tables['users']['vacation']); |
236 | 236 | upd_do_query('UPDATE {{users}} SET `vacation` = `urlaubs_until` WHERE `urlaubs_modus` <> 0;'); |
@@ -281,10 +281,10 @@ discard block |
||
281 | 281 | ), !$update_tables['logs']['log_timestamp']); |
282 | 282 | upd_do_query('DELETE FROM `{{logs}}` WHERE `log_code` = 303;'); |
283 | 283 | |
284 | - if($update_tables['errors']) |
|
284 | + if ($update_tables['errors']) |
|
285 | 285 | { |
286 | 286 | upd_do_query('INSERT INTO `{{logs}}` (`log_code`, `log_sender`, `log_title`, `log_text`, `log_page`, `log_time`) SELECT 500, `error_sender`, `error_type`, `error_text`, `error_page`, `error_time` FROM `{{errors}}`;'); |
287 | - if($update_tables['errors_backup']) |
|
287 | + if ($update_tables['errors_backup']) |
|
288 | 288 | { |
289 | 289 | upd_drop_table('errors_backup'); |
290 | 290 | } |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | |
351 | 351 | upd_alter_table('users', 'CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci'); |
352 | 352 | |
353 | - if(!$update_tables['shortcut']) |
|
353 | + if (!$update_tables['shortcut']) |
|
354 | 354 | { |
355 | 355 | upd_create_table('shortcut', |
356 | 356 | "( |
@@ -375,12 +375,12 @@ discard block |
||
375 | 375 | $temp_planet_types = array(PT_PLANET, PT_DEBRIS, PT_MOON); |
376 | 376 | |
377 | 377 | $query = upd_do_query("SELECT id, fleet_shortcut FROM {{users}} WHERE fleet_shortcut > '';"); |
378 | - while($user_data = db_fetch($query)) |
|
378 | + while ($user_data = db_fetch($query)) |
|
379 | 379 | { |
380 | 380 | $shortcuts = explode("\r\n", $user_data['fleet_shortcut']); |
381 | - foreach($shortcuts as $shortcut) |
|
381 | + foreach ($shortcuts as $shortcut) |
|
382 | 382 | { |
383 | - if(!$shortcut) |
|
383 | + if (!$shortcut) |
|
384 | 384 | { |
385 | 385 | continue; |
386 | 386 | } |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | $shortcut[3] = intval($shortcut[3]); |
393 | 393 | $shortcut[4] = intval($shortcut[4]); |
394 | 394 | |
395 | - if($shortcut[0] && $shortcut[1] && $shortcut[2] && $shortcut[3] && in_array($shortcut[4], $temp_planet_types)) |
|
395 | + if ($shortcut[0] && $shortcut[1] && $shortcut[2] && $shortcut[3] && in_array($shortcut[4], $temp_planet_types)) |
|
396 | 396 | { |
397 | 397 | upd_do_query("INSERT INTO {$config->db_prefix}shortcut (shortcut_user_id, shortcut_galaxy, shortcut_system, shortcut_planet, shortcut_planet_type, shortcut_text) VALUES ({$user_data['id']}, {$shortcut[1]}, {$shortcut[2]}, {$shortcut[3]}, {$shortcut[4]}, '{$shortcut[0]}');", true); |
398 | 398 | } |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | |
547 | 547 | upd_check_key('quest_total', 0, !isset($config->quest_total)); |
548 | 548 | |
549 | - for($i = 0; $i < 25; $i++) |
|
549 | + for ($i = 0; $i < 25; $i++) |
|
550 | 550 | { |
551 | 551 | upd_alter_table('alliance', array("DROP INDEX `id_{$i}`",), $update_indexes['alliance']["id_{$i}"]); |
552 | 552 | upd_alter_table('users', array("DROP INDEX `id_{$i}`",), $update_indexes['users']["id_{$i}"]); |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | "ADD `msg_admin` bigint(11) unsigned DEFAULT '0' AFTER mnl_buildlist" |
576 | 576 | ), !$update_tables['users']['msg_admin']); |
577 | 577 | |
578 | - if(!$update_foreigns['users']['FK_users_ally_id']) |
|
578 | + if (!$update_foreigns['users']['FK_users_ally_id']) |
|
579 | 579 | { |
580 | 580 | upd_alter_table('users', array( |
581 | 581 | 'MODIFY COLUMN `ally_name` VARCHAR(32) DEFAULT NULL', |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | ), strtoupper($update_tables['planets']['debris_metal']['Type']) != 'BIGINT(20) UNSIGNED'); |
599 | 599 | |
600 | 600 | $illegal_moon_query = upd_do_query("SELECT id FROM `{{planets}}` WHERE `id_owner` <> 0 AND `planet_type` = 3 AND `parent_planet` <> 0 AND `parent_planet` NOT IN (SELECT `id` FROM {{planets}} WHERE `planet_type` = 1);"); |
601 | - while($illegal_moon_row = db_fetch($illegal_moon_query)) |
|
601 | + while ($illegal_moon_row = db_fetch($illegal_moon_query)) |
|
602 | 602 | { |
603 | 603 | upd_do_query("DELETE FROM {{planets}} WHERE id = {$illegal_moon_row['id']} LIMIT 1;", true); |
604 | 604 | } |
@@ -613,8 +613,8 @@ discard block |
||
613 | 613 | upd_log_version_update(); |
614 | 614 | |
615 | 615 | upd_check_key('game_email_pm', 0, !isset($config->game_email_pm)); |
616 | - upd_check_key('player_vacation_time', 2*24*60*60, !isset($config->player_vacation_time)); |
|
617 | - upd_check_key('player_delete_time', 45*24*60*60, !isset($config->player_delete_time)); |
|
616 | + upd_check_key('player_vacation_time', 2 * 24 * 60 * 60, !isset($config->player_vacation_time)); |
|
617 | + upd_check_key('player_delete_time', 45 * 24 * 60 * 60, !isset($config->player_delete_time)); |
|
618 | 618 | |
619 | 619 | upd_create_table('log_dark_matter', |
620 | 620 | "( |
@@ -636,18 +636,18 @@ discard block |
||
636 | 636 | upd_do_query('COMMIT;', true); |
637 | 637 | |
638 | 638 | $records = 1; |
639 | - while($records) |
|
639 | + while ($records) |
|
640 | 640 | { |
641 | 641 | upd_do_query('START TRANSACTION;', true); |
642 | 642 | $query = upd_do_query("SELECT * FROM {{logs}} WHERE log_code = 102 order by log_id LIMIT 1000;"); |
643 | 643 | $records = db_num_rows($query); |
644 | - while($row = db_fetch($query)) |
|
644 | + while ($row = db_fetch($query)) |
|
645 | 645 | { |
646 | 646 | $result = preg_match('/^Player ID (\d+) Dark Matter was adjusted with (\-?\d+). Reason: (.+)$/', $row['log_text'], $matches); |
647 | 647 | |
648 | 648 | $reason = RPG_NONE; |
649 | 649 | $comment = $matches[3]; |
650 | - switch($matches[3]) |
|
650 | + switch ($matches[3]) |
|
651 | 651 | { |
652 | 652 | case 'Level Up For Structure Building': |
653 | 653 | $reason = RPG_STRUCTURE; |
@@ -664,21 +664,21 @@ discard block |
||
664 | 664 | break; |
665 | 665 | |
666 | 666 | default: |
667 | - if(preg_match('/^Using Black Market page (\d+)$/', $comment, $matches2)) |
|
667 | + if (preg_match('/^Using Black Market page (\d+)$/', $comment, $matches2)) |
|
668 | 668 | { |
669 | 669 | $reason = RPG_MARKET; |
670 | 670 | } |
671 | - elseif(preg_match('/^Spent for officer (.+) ID (\d+)$/', $comment, $matches2)) |
|
671 | + elseif (preg_match('/^Spent for officer (.+) ID (\d+)$/', $comment, $matches2)) |
|
672 | 672 | { |
673 | 673 | $reason = RPG_MERCENARY; |
674 | 674 | $comment = "Spent for mercenary {$matches2[1]} GUID {$matches2[2]}"; |
675 | 675 | } |
676 | - elseif(preg_match('/^Incoming From Referral ID\ ?(\d+)$/', $comment, $matches2)) |
|
676 | + elseif (preg_match('/^Incoming From Referral ID\ ?(\d+)$/', $comment, $matches2)) |
|
677 | 677 | { |
678 | 678 | $reason = RPG_REFERRAL; |
679 | 679 | $comment = "Incoming from referral ID {$matches[1]}"; |
680 | 680 | } |
681 | - elseif(preg_match('/^Through admin interface for user .* ID \d+ (.*)$/', $comment, $matches2)) |
|
681 | + elseif (preg_match('/^Through admin interface for user .* ID \d+ (.*)$/', $comment, $matches2)) |
|
682 | 682 | { |
683 | 683 | $reason = RPG_ADMIN; |
684 | 684 | $comment = $matches2[1]; |
@@ -686,7 +686,7 @@ discard block |
||
686 | 686 | break; |
687 | 687 | } |
688 | 688 | |
689 | - if($matches[2]) |
|
689 | + if ($matches[2]) |
|
690 | 690 | { |
691 | 691 | $row['log_username'] = db_escape($row['log_username']); |
692 | 692 | $row['log_page'] = db_escape($row['log_page']); |
@@ -706,14 +706,14 @@ discard block |
||
706 | 706 | upd_do_query('COMMIT;', true); |
707 | 707 | } |
708 | 708 | |
709 | - foreach($update_tables as $table_name => $cork) |
|
709 | + foreach ($update_tables as $table_name => $cork) |
|
710 | 710 | { |
711 | 711 | $row = db_fetch(upd_do_query("SELECT * FROM information_schema.TABLES WHERE TABLE_SCHEMA = '" . db_escape(classSupernova::$db_name) . "' AND TABLE_NAME = '{$config->db_prefix}{$table_name}';", true)); |
712 | - if($row['ENGINE'] != 'InnoDB') |
|
712 | + if ($row['ENGINE'] != 'InnoDB') |
|
713 | 713 | { |
714 | 714 | upd_alter_table($table_name, 'ENGINE=InnoDB', true); |
715 | 715 | } |
716 | - if($row['TABLE_COLLATION'] != 'utf8_general_ci') |
|
716 | + if ($row['TABLE_COLLATION'] != 'utf8_general_ci') |
|
717 | 717 | { |
718 | 718 | upd_alter_table($table_name, 'CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci', true); |
719 | 719 | } |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | "CHANGE COLUMN `governor_level` `PLANET_GOVERNOR_LEVEL` SMALLINT(5) NOT NULL DEFAULT 0", |
735 | 735 | ), !$update_tables['planets']['PLANET_GOVERNOR_ID']); |
736 | 736 | |
737 | - if($update_tables['users']['rpg_geologue']) |
|
737 | + if ($update_tables['users']['rpg_geologue']) |
|
738 | 738 | { |
739 | 739 | doquery("UPDATE {{users}} SET `dark_matter` = `dark_matter` + (`rpg_geologue` + `rpg_ingenieur` + `rpg_constructeur` + `rpg_technocrate` + `rpg_scientifique` + `rpg_defenseur`) * 3;"); |
740 | 740 | |
@@ -748,7 +748,7 @@ discard block |
||
748 | 748 | ), $update_tables['users']['rpg_geologue']); |
749 | 749 | } |
750 | 750 | |
751 | - if($update_tables['users']['rpg_bunker']) |
|
751 | + if ($update_tables['users']['rpg_bunker']) |
|
752 | 752 | { |
753 | 753 | doquery("UPDATE {{users}} SET `dark_matter` = `dark_matter` + (`rpg_bunker`) * 3;"); |
754 | 754 | |
@@ -799,7 +799,7 @@ discard block |
||
799 | 799 | ), !isset($update_tables['alliance']['total_rank'])); |
800 | 800 | doquery("UPDATE {{alliance}} AS a JOIN {{statpoints}} AS sp ON sp.id_owner = a.id AND sp.stat_code = 1 AND sp.stat_type = 2 SET a.total_rank = sp.total_rank, a.total_points = sp.total_points;"); |
801 | 801 | |
802 | - if(!isset($update_tables['users']['ally_tag'])) |
|
802 | + if (!isset($update_tables['users']['ally_tag'])) |
|
803 | 803 | { |
804 | 804 | upd_alter_table('users', array( |
805 | 805 | "ADD COLUMN `ally_tag` varchar(8) DEFAULT NULL AFTER `ally_id`", |
@@ -815,7 +815,7 @@ discard block |
||
815 | 815 | "ADD COLUMN `player_artifact_list` TEXT", |
816 | 816 | ), !isset($update_tables['users']['player_artifact_list'])); |
817 | 817 | |
818 | - if(!isset($update_tables['users']['player_rpg_tech_xp'])) |
|
818 | + if (!isset($update_tables['users']['player_rpg_tech_xp'])) |
|
819 | 819 | { |
820 | 820 | upd_check_key('eco_scale_storage', 1, !isset($config->eco_scale_storage)); |
821 | 821 | |
@@ -846,7 +846,7 @@ discard block |
||
846 | 846 | "MODIFY COLUMN `ally_owner` BIGINT(20) UNSIGNED DEFAULT NULL", |
847 | 847 | ), strtoupper($update_tables['alliance']['ally_owner']['Type']) != 'BIGINT(20) UNSIGNED'); |
848 | 848 | |
849 | - if(strtoupper($update_tables['alliance_diplomacy']['alliance_diplomacy_ally_id']['Type']) != 'BIGINT(20) UNSIGNED') |
|
849 | + if (strtoupper($update_tables['alliance_diplomacy']['alliance_diplomacy_ally_id']['Type']) != 'BIGINT(20) UNSIGNED') |
|
850 | 850 | { |
851 | 851 | upd_alter_table('alliance_diplomacy', array( |
852 | 852 | "DROP FOREIGN KEY `FK_diplomacy_ally_id`", |
@@ -862,7 +862,7 @@ discard block |
||
862 | 862 | ), true); |
863 | 863 | } |
864 | 864 | |
865 | - if(strtoupper($update_tables['alliance_negotiation']['alliance_negotiation_ally_id']['Type']) != 'BIGINT(20) UNSIGNED') |
|
865 | + if (strtoupper($update_tables['alliance_negotiation']['alliance_negotiation_ally_id']['Type']) != 'BIGINT(20) UNSIGNED') |
|
866 | 866 | { |
867 | 867 | upd_alter_table('alliance_negotiation', array( |
868 | 868 | "DROP FOREIGN KEY `FK_negotiation_ally_id`", |
@@ -879,7 +879,7 @@ discard block |
||
879 | 879 | ), true); |
880 | 880 | } |
881 | 881 | |
882 | - if(strtoupper($update_tables['alliance_requests']['id_user']['Type']) != 'BIGINT(20) UNSIGNED') |
|
882 | + if (strtoupper($update_tables['alliance_requests']['id_user']['Type']) != 'BIGINT(20) UNSIGNED') |
|
883 | 883 | { |
884 | 884 | upd_do_query('DELETE FROM {{alliance_requests}} WHERE id_user NOT IN (SELECT id FROM {{users}}) OR id_ally NOT IN (SELECT id FROM {{alliance}});', true); |
885 | 885 | |
@@ -894,7 +894,7 @@ discard block |
||
894 | 894 | ), true); |
895 | 895 | } |
896 | 896 | |
897 | - if(strtoupper($update_tables['annonce']['id']['Type']) != 'BIGINT(20) UNSIGNED') |
|
897 | + if (strtoupper($update_tables['annonce']['id']['Type']) != 'BIGINT(20) UNSIGNED') |
|
898 | 898 | { |
899 | 899 | upd_do_query('DELETE FROM {{annonce}} WHERE user NOT IN (SELECT username FROM {{users}});', true); |
900 | 900 | |
@@ -908,7 +908,7 @@ discard block |
||
908 | 908 | ), true); |
909 | 909 | } |
910 | 910 | |
911 | - if(strtoupper($update_tables['bashing']['bashing_user_id']['Type']) != 'BIGINT(20) UNSIGNED') |
|
911 | + if (strtoupper($update_tables['bashing']['bashing_user_id']['Type']) != 'BIGINT(20) UNSIGNED') |
|
912 | 912 | { |
913 | 913 | upd_alter_table('bashing', array( |
914 | 914 | "DROP FOREIGN KEY `FK_bashing_user_id`", |
@@ -924,7 +924,7 @@ discard block |
||
924 | 924 | ), true); |
925 | 925 | } |
926 | 926 | |
927 | - if(strtoupper($update_tables['buddy']['id']['Type']) != 'BIGINT(20) UNSIGNED') |
|
927 | + if (strtoupper($update_tables['buddy']['id']['Type']) != 'BIGINT(20) UNSIGNED') |
|
928 | 928 | { |
929 | 929 | upd_do_query('DELETE FROM {{buddy}} WHERE sender NOT IN (SELECT id FROM {{users}}) OR owner NOT IN (SELECT id FROM {{users}});', true); |
930 | 930 | |
@@ -963,7 +963,7 @@ discard block |
||
963 | 963 | "MODIFY COLUMN `fleet_resource_deuterium` DECIMAL(65,0) DEFAULT '0'", |
964 | 964 | ), strtoupper($update_tables['fleets']['fleet_resource_metal']['Type']) != 'DECIMAL(65,0)'); |
965 | 965 | |
966 | - if(strtoupper($update_tables['iraks']['fleet_owner']['Type']) != 'BIGINT(20) UNSIGNED') |
|
966 | + if (strtoupper($update_tables['iraks']['fleet_owner']['Type']) != 'BIGINT(20) UNSIGNED') |
|
967 | 967 | { |
968 | 968 | upd_do_query('DELETE FROM {{iraks}} WHERE owner NOT IN (SELECT id FROM {{users}}) OR zielid NOT IN (SELECT id FROM {{users}});', true); |
969 | 969 | |
@@ -988,7 +988,7 @@ discard block |
||
988 | 988 | ), true); |
989 | 989 | } |
990 | 990 | |
991 | - if(strtoupper($update_tables['notes']['owner']['Type']) != 'BIGINT(20) UNSIGNED') |
|
991 | + if (strtoupper($update_tables['notes']['owner']['Type']) != 'BIGINT(20) UNSIGNED') |
|
992 | 992 | { |
993 | 993 | upd_do_query('DELETE FROM {{notes}} WHERE owner NOT IN (SELECT id FROM {{users}});', true); |
994 | 994 | |
@@ -1114,7 +1114,7 @@ discard block |
||
1114 | 1114 | "DROP COLUMN `b_hangar_plus`", |
1115 | 1115 | ), isset($update_tables['planets']['b_hangar_plus'])); |
1116 | 1116 | |
1117 | - if(strtoupper($update_tables['referrals']['id_partner']['Type']) != 'BIGINT(20) UNSIGNED') |
|
1117 | + if (strtoupper($update_tables['referrals']['id_partner']['Type']) != 'BIGINT(20) UNSIGNED') |
|
1118 | 1118 | { |
1119 | 1119 | upd_do_query('DELETE FROM {{referrals}} WHERE id NOT IN (SELECT id FROM {{users}}) OR id_partner NOT IN (SELECT id FROM {{users}});', true); |
1120 | 1120 | |
@@ -1134,7 +1134,7 @@ discard block |
||
1134 | 1134 | "MODIFY COLUMN `id_owner2` BIGINT(20) UNSIGNED", |
1135 | 1135 | ), strtoupper($update_tables['rw']['id_owner1']['Type']) != 'BIGINT(20) UNSIGNED'); |
1136 | 1136 | |
1137 | - if(strtoupper($update_tables['shortcut']['shortcut_user_id']['Type']) != 'BIGINT(20) UNSIGNED') |
|
1137 | + if (strtoupper($update_tables['shortcut']['shortcut_user_id']['Type']) != 'BIGINT(20) UNSIGNED') |
|
1138 | 1138 | { |
1139 | 1139 | upd_do_query('DELETE FROM {{shortcut}} WHERE shortcut_user_id NOT IN (SELECT id FROM {{users}}) OR shortcut_planet_id NOT IN (SELECT id FROM {{planets}});', true); |
1140 | 1140 | |
@@ -1150,7 +1150,7 @@ discard block |
||
1150 | 1150 | ), true); |
1151 | 1151 | } |
1152 | 1152 | |
1153 | - if(strtoupper($update_tables['statpoints']['id_owner']['Type']) != 'BIGINT(20) UNSIGNED') |
|
1153 | + if (strtoupper($update_tables['statpoints']['id_owner']['Type']) != 'BIGINT(20) UNSIGNED') |
|
1154 | 1154 | { |
1155 | 1155 | upd_do_query('DELETE FROM {{statpoints}} WHERE id_owner NOT IN (SELECT id FROM {{users}}) OR id_ally NOT IN (SELECT id FROM {{alliance}});', true); |
1156 | 1156 | |
@@ -1305,7 +1305,7 @@ discard block |
||
1305 | 1305 | "DROP COLUMN `settings_allylogo`", |
1306 | 1306 | ), isset($update_tables['users']['settings_allylogo'])); |
1307 | 1307 | |
1308 | - if(!isset($update_tables['powerup'])) |
|
1308 | + if (!isset($update_tables['powerup'])) |
|
1309 | 1309 | { |
1310 | 1310 | upd_do_query("DROP TABLE IF EXISTS {$config->db_prefix}mercenaries;"); |
1311 | 1311 | |
@@ -1336,13 +1336,13 @@ discard block |
||
1336 | 1336 | |
1337 | 1337 | $update_query_template = "UPDATE {{users}} SET id = id %s WHERE id = %d LIMIT 1;"; |
1338 | 1338 | $user_list = upd_do_query("SELECT * FROM {{users}};"); |
1339 | - while($user_row = db_fetch($user_list)) |
|
1339 | + while ($user_row = db_fetch($user_list)) |
|
1340 | 1340 | { |
1341 | 1341 | $update_query_str = ''; |
1342 | - foreach(sn_get_groups('mercenaries') as $mercenary_id) |
|
1342 | + foreach (sn_get_groups('mercenaries') as $mercenary_id) |
|
1343 | 1343 | { |
1344 | 1344 | $mercenary_data_name = get_unit_param($mercenary_id, P_NAME); |
1345 | - if($mercenary_level = $user_row[$mercenary_data_name]) |
|
1345 | + if ($mercenary_level = $user_row[$mercenary_data_name]) |
|
1346 | 1346 | { |
1347 | 1347 | $update_query_str = ", `{$mercenary_data_name}` = 0"; |
1348 | 1348 | upd_do_query("DELETE FROM {{powerup}} WHERE powerup_user_id = {$user_row['id']} AND powerup_unit_id = {$mercenary_id} LIMIT 1;"); |
@@ -1350,14 +1350,14 @@ discard block |
||
1350 | 1350 | } |
1351 | 1351 | } |
1352 | 1352 | |
1353 | - if($update_query_str) |
|
1353 | + if ($update_query_str) |
|
1354 | 1354 | { |
1355 | 1355 | upd_do_query(sprintf($update_query_template, $update_query_str, $user_row['id'])); |
1356 | 1356 | } |
1357 | 1357 | } |
1358 | 1358 | } |
1359 | 1359 | |
1360 | - if(!isset($update_tables['universe'])) |
|
1360 | + if (!isset($update_tables['universe'])) |
|
1361 | 1361 | { |
1362 | 1362 | upd_create_table('universe', |
1363 | 1363 | "( |
@@ -1381,7 +1381,7 @@ discard block |
||
1381 | 1381 | |
1382 | 1382 | // ------------------------------------------------------------------------ |
1383 | 1383 | // Modifying tables |
1384 | - if(strtoupper($update_tables['users']['user_as_ally']['Type']) != 'BIGINT(20) UNSIGNED') |
|
1384 | + if (strtoupper($update_tables['users']['user_as_ally']['Type']) != 'BIGINT(20) UNSIGNED') |
|
1385 | 1385 | { |
1386 | 1386 | upd_alter_table('users', array( |
1387 | 1387 | "ADD COLUMN user_as_ally BIGINT(20) UNSIGNED DEFAULT NULL", |
@@ -1403,7 +1403,7 @@ discard block |
||
1403 | 1403 | // ------------------------------------------------------------------------ |
1404 | 1404 | // Creating players for allies |
1405 | 1405 | $ally_row_list = doquery("SELECT `id`, `ally_tag` FROM {{alliance}} WHERE ally_user_id IS NULL;"); |
1406 | - while($ally_row = db_fetch($ally_row_list)) |
|
1406 | + while ($ally_row = db_fetch($ally_row_list)) |
|
1407 | 1407 | { |
1408 | 1408 | $ally_user_name = db_escape("[{$ally_row['ally_tag']}]"); |
1409 | 1409 | doquery("INSERT INTO {{users}} SET `username` = '{$ally_user_name}', `register_time` = " . SN_TIME_NOW . ", `user_as_ally` = {$ally_row['id']};"); |
@@ -1418,7 +1418,7 @@ discard block |
||
1418 | 1418 | // ------------------------------------------------------------------------ |
1419 | 1419 | // Creating planets for allies |
1420 | 1420 | $ally_user_list = doquery("SELECT `id`, `username` FROM {{users}} WHERE `user_as_ally` IS NOT NULL AND `id_planet` = 0;"); |
1421 | - while($ally_user_row = db_fetch($ally_user_list)) |
|
1421 | + while ($ally_user_row = db_fetch($ally_user_list)) |
|
1422 | 1422 | { |
1423 | 1423 | $ally_planet_name = db_escape($ally_user_row['username']); |
1424 | 1424 | doquery("INSERT INTO {{planets}} SET `name` = '{$ally_planet_name}', `last_update` = " . SN_TIME_NOW . ", `id_owner` = {$ally_user_row['id']};"); |
@@ -1450,10 +1450,10 @@ discard block |
||
1450 | 1450 | // Adding db field |
1451 | 1451 | upd_alter_table('users', "ADD `que` varchar(4096) NOT NULL DEFAULT '' COMMENT 'User que'", !$update_tables['users']['que']); |
1452 | 1452 | // Converting old data to new one and dropping old fields |
1453 | - if($update_tables['users']['b_tech_planet']) |
|
1453 | + if ($update_tables['users']['b_tech_planet']) |
|
1454 | 1454 | { |
1455 | 1455 | $query = doquery("SELECT * FROM {{planets}} WHERE `b_tech_id` <> 0;"); |
1456 | - while($planet_row = db_fetch($query)) |
|
1456 | + while ($planet_row = db_fetch($query)) |
|
1457 | 1457 | { |
1458 | 1458 | $que_item_string = "{$planet_row['b_tech_id']},1," . max(0, $planet_row['b_tech'] - SN_TIME_NOW) . "," . BUILD_CREATE . "," . QUE_RESEARCH; |
1459 | 1459 | doquery("UPDATE {{users}} SET `que` = '{$que_item_string}' WHERE `id` = {$planet_row['id_owner']} LIMIT 1;"); |
@@ -1467,7 +1467,7 @@ discard block |
||
1467 | 1467 | upd_alter_table('users', "DROP COLUMN `b_tech_planet`", $update_tables['users']['b_tech_planet']); |
1468 | 1468 | } |
1469 | 1469 | |
1470 | - if(!$update_tables['powerup']['powerup_category']) |
|
1470 | + if (!$update_tables['powerup']['powerup_category']) |
|
1471 | 1471 | { |
1472 | 1472 | upd_alter_table('powerup', "ADD COLUMN `powerup_category` SMALLINT NOT NULL DEFAULT 0 AFTER `powerup_planet_id`", !$update_tables['powerup']['powerup_category']); |
1473 | 1473 | |
@@ -1489,7 +1489,7 @@ discard block |
||
1489 | 1489 | upd_check_key('ali_bonus_brackets', 10, !isset($config->ali_bonus_brackets)); |
1490 | 1490 | upd_check_key('ali_bonus_brackets_divisor', 50, !isset($config->ali_bonus_brackets_divisor)); |
1491 | 1491 | |
1492 | - if(!$config->db_loadItem('rpg_flt_explore')) |
|
1492 | + if (!$config->db_loadItem('rpg_flt_explore')) |
|
1493 | 1493 | { |
1494 | 1494 | $inflation_rate = 1000; |
1495 | 1495 | |
@@ -1507,20 +1507,20 @@ discard block |
||
1507 | 1507 | doquery("UPDATE {{users}} SET `dark_matter` = `dark_matter` * {$inflation_rate};"); |
1508 | 1508 | |
1509 | 1509 | $query = doquery("SELECT * FROM {{quest}}"); |
1510 | - while($row = db_fetch($query)) |
|
1510 | + while ($row = db_fetch($query)) |
|
1511 | 1511 | { |
1512 | 1512 | $query_add = ''; |
1513 | 1513 | $quest_reward_list = explode(';', $row['quest_rewards']); |
1514 | - foreach($quest_reward_list as &$quest_reward) |
|
1514 | + foreach ($quest_reward_list as &$quest_reward) |
|
1515 | 1515 | { |
1516 | 1516 | list($reward_resource, $reward_amount) = explode(',', $quest_reward); |
1517 | - if($reward_resource == RES_DARK_MATTER) |
|
1517 | + if ($reward_resource == RES_DARK_MATTER) |
|
1518 | 1518 | { |
1519 | 1519 | $quest_reward = "{$reward_resource}," . $reward_amount * 1000; |
1520 | 1520 | } |
1521 | 1521 | } |
1522 | 1522 | $new_rewards = implode(';', $quest_reward_list); |
1523 | - if($new_rewards != $row['quest_rewards']) |
|
1523 | + if ($new_rewards != $row['quest_rewards']) |
|
1524 | 1524 | { |
1525 | 1525 | doquery("UPDATE {{quest}} SET `quest_rewards` = '{$new_rewards}' WHERE quest_id = {$row['quest_id']} LIMIT 1;"); |
1526 | 1526 | } |
@@ -1551,7 +1551,7 @@ discard block |
||
1551 | 1551 | upd_check_key('user_birthday_range', 30, !isset($config->user_birthday_range)); |
1552 | 1552 | upd_check_key('user_birthday_celebrate', 0, !isset($config->user_birthday_celebrate)); |
1553 | 1553 | |
1554 | - if(!isset($update_tables['payment'])) |
|
1554 | + if (!isset($update_tables['payment'])) |
|
1555 | 1555 | { |
1556 | 1556 | upd_alter_table('users', array( |
1557 | 1557 | "ADD KEY `I_user_id_name` (`id`, `username`)", |
@@ -1603,7 +1603,7 @@ discard block |
||
1603 | 1603 | ), !$update_tables['iraks']['fleet_start_type']); |
1604 | 1604 | |
1605 | 1605 | |
1606 | - if(!$update_tables['payment']['payment_status']) |
|
1606 | + if (!$update_tables['payment']['payment_status']) |
|
1607 | 1607 | { |
1608 | 1608 | upd_alter_table('payment', array( |
1609 | 1609 | "ADD COLUMN `payment_status` INT DEFAULT 0 COMMENT 'Payment status' AFTER `payment_id`", |
@@ -1688,7 +1688,7 @@ discard block |
||
1688 | 1688 | "ADD INDEX `I_owner_priority_time` (`owner`, `priority`, `time`)", |
1689 | 1689 | ), !$update_indexes['notes']['I_owner_priority_time']); |
1690 | 1690 | |
1691 | - if(!$update_tables['buddy']['BUDDY_ID']) |
|
1691 | + if (!$update_tables['buddy']['BUDDY_ID']) |
|
1692 | 1692 | { |
1693 | 1693 | upd_alter_table('buddy', array( |
1694 | 1694 | "CHANGE COLUMN `id` `BUDDY_ID` SERIAL COMMENT 'Buddy table row ID'", |
@@ -1710,10 +1710,10 @@ discard block |
||
1710 | 1710 | |
1711 | 1711 | $query = upd_do_query("SELECT `BUDDY_ID`, `BUDDY_SENDER_ID`, `BUDDY_OWNER_ID` FROM {{buddy}} ORDER BY `BUDDY_ID`;"); |
1712 | 1712 | $found = $lost = array(); |
1713 | - while($row = db_fetch($query)) |
|
1713 | + while ($row = db_fetch($query)) |
|
1714 | 1714 | { |
1715 | 1715 | $index = min($row['BUDDY_SENDER_ID'], $row['BUDDY_OWNER_ID']) . ';' . max($row['BUDDY_SENDER_ID'], $row['BUDDY_OWNER_ID']); |
1716 | - if(!isset($found[$index])) |
|
1716 | + if (!isset($found[$index])) |
|
1717 | 1717 | { |
1718 | 1718 | $found[$index] = $row['BUDDY_ID']; |
1719 | 1719 | } |
@@ -1723,7 +1723,7 @@ discard block |
||
1723 | 1723 | } |
1724 | 1724 | } |
1725 | 1725 | $lost = implode(',', $lost); |
1726 | - if($lost) |
|
1726 | + if ($lost) |
|
1727 | 1727 | { |
1728 | 1728 | upd_do_query("DELETE FROM {{buddy}} WHERE `BUDDY_ID` IN ({$lost})"); |
1729 | 1729 | } |
@@ -1745,7 +1745,7 @@ discard block |
||
1745 | 1745 | |
1746 | 1746 | upd_do_query("UPDATE {{users}} SET `ally_name` = null, `ally_tag` = null, ally_register_time = 0, ally_rank_id = 0 WHERE `ally_id` IS NULL"); |
1747 | 1747 | |
1748 | - if(!$update_tables['ube_report']) |
|
1748 | + if (!$update_tables['ube_report']) |
|
1749 | 1749 | { |
1750 | 1750 | upd_create_table('ube_report', |
1751 | 1751 | "( |
@@ -1787,7 +1787,7 @@ discard block |
||
1787 | 1787 | ); |
1788 | 1788 | } |
1789 | 1789 | |
1790 | - if(!$update_tables['ube_report_player']) |
|
1790 | + if (!$update_tables['ube_report_player']) |
|
1791 | 1791 | { |
1792 | 1792 | upd_create_table('ube_report_player', |
1793 | 1793 | "( |
@@ -1809,7 +1809,7 @@ discard block |
||
1809 | 1809 | ); |
1810 | 1810 | } |
1811 | 1811 | |
1812 | - if(!$update_tables['ube_report_fleet']) |
|
1812 | + if (!$update_tables['ube_report_fleet']) |
|
1813 | 1813 | { |
1814 | 1814 | upd_create_table('ube_report_fleet', |
1815 | 1815 | "( |
@@ -1840,7 +1840,7 @@ discard block |
||
1840 | 1840 | ); |
1841 | 1841 | } |
1842 | 1842 | |
1843 | - if(!$update_tables['ube_report_unit']) |
|
1843 | + if (!$update_tables['ube_report_unit']) |
|
1844 | 1844 | { |
1845 | 1845 | // TODO: Сохранять так же имя корабля - на случай конструкторов - не, хуйня. Конструктор может давать имена разные на разных языках |
1846 | 1846 | // Может сохранять имена удаленных кораблей долго? |
@@ -1878,7 +1878,7 @@ discard block |
||
1878 | 1878 | ); |
1879 | 1879 | } |
1880 | 1880 | |
1881 | - if(!$update_tables['ube_report_outcome_fleet']) |
|
1881 | + if (!$update_tables['ube_report_outcome_fleet']) |
|
1882 | 1882 | { |
1883 | 1883 | upd_create_table('ube_report_outcome_fleet', |
1884 | 1884 | "( |
@@ -1908,7 +1908,7 @@ discard block |
||
1908 | 1908 | ); |
1909 | 1909 | } |
1910 | 1910 | |
1911 | - if(!$update_tables['ube_report_outcome_unit']) |
|
1911 | + if (!$update_tables['ube_report_outcome_unit']) |
|
1912 | 1912 | { |
1913 | 1913 | upd_create_table('ube_report_outcome_unit', |
1914 | 1914 | "( |
@@ -1930,7 +1930,7 @@ discard block |
||
1930 | 1930 | ); |
1931 | 1931 | } |
1932 | 1932 | |
1933 | - if(!$update_tables['unit']) |
|
1933 | + if (!$update_tables['unit']) |
|
1934 | 1934 | { |
1935 | 1935 | upd_create_table('unit', |
1936 | 1936 | "( |
@@ -1950,7 +1950,7 @@ discard block |
||
1950 | 1950 | ); |
1951 | 1951 | } |
1952 | 1952 | |
1953 | - if(!$update_tables['captain']) |
|
1953 | + if (!$update_tables['captain']) |
|
1954 | 1954 | { |
1955 | 1955 | upd_create_table('captain', |
1956 | 1956 | "( |
@@ -1971,7 +1971,7 @@ discard block |
||
1971 | 1971 | ); |
1972 | 1972 | } |
1973 | 1973 | |
1974 | - if(!$update_tables['fleets']['fleet_start_planet_id']) |
|
1974 | + if (!$update_tables['fleets']['fleet_start_planet_id']) |
|
1975 | 1975 | { |
1976 | 1976 | upd_alter_table('fleets', array( |
1977 | 1977 | "ADD `fleet_start_planet_id` BIGINT(20) UNSIGNED DEFAULT NULL COMMENT 'Fleet start planet ID' AFTER `fleet_start_time`", |
@@ -1994,7 +1994,7 @@ discard block |
||
1994 | 1994 | |
1995 | 1995 | upd_alter_table('fleets', array("DROP COLUMN `processing_start`"), $update_tables['fleets']['processing_start']); |
1996 | 1996 | |
1997 | - if(!$update_tables['chat_player']) |
|
1997 | + if (!$update_tables['chat_player']) |
|
1998 | 1998 | { |
1999 | 1999 | upd_create_table('chat_player', |
2000 | 2000 | "( |
@@ -2057,7 +2057,7 @@ discard block |
||
2057 | 2057 | "DROP FOREIGN KEY `FK_payment_user`", |
2058 | 2058 | ), $update_foreigns['payment']['FK_payment_user']); |
2059 | 2059 | |
2060 | - if($update_foreigns['chat']['FK_chat_message_sender_user_id'] != 'chat_message_sender_id,users,id;') |
|
2060 | + if ($update_foreigns['chat']['FK_chat_message_sender_user_id'] != 'chat_message_sender_id,users,id;') |
|
2061 | 2061 | { |
2062 | 2062 | upd_alter_table('chat', array( |
2063 | 2063 | "DROP FOREIGN KEY `FK_chat_message_sender_user_id`", |
@@ -2091,7 +2091,7 @@ discard block |
||
2091 | 2091 | "ADD KEY `I_ube_report_time_combat` (`ube_report_time_combat`)", |
2092 | 2092 | ), !$update_indexes['ube_report']['I_ube_report_time_combat']); |
2093 | 2093 | |
2094 | - if(!$update_tables['unit']['unit_time_start']) |
|
2094 | + if (!$update_tables['unit']['unit_time_start']) |
|
2095 | 2095 | { |
2096 | 2096 | upd_alter_table('unit', array( |
2097 | 2097 | "ADD COLUMN `unit_time_start` DATETIME NULL DEFAULT NULL COMMENT 'Unit activation start time'", |
@@ -2108,7 +2108,7 @@ discard block |
||
2108 | 2108 | ); |
2109 | 2109 | } |
2110 | 2110 | |
2111 | - if(!$update_tables['que']) |
|
2111 | + if (!$update_tables['que']) |
|
2112 | 2112 | { |
2113 | 2113 | upd_create_table('que', |
2114 | 2114 | "( |
@@ -2141,15 +2141,15 @@ discard block |
||
2141 | 2141 | } |
2142 | 2142 | |
2143 | 2143 | // Конвертирум очередь исследований |
2144 | - if($update_tables['users']['que']) |
|
2144 | + if ($update_tables['users']['que']) |
|
2145 | 2145 | { |
2146 | 2146 | $que_lines = array(); |
2147 | 2147 | $que_query = upd_do_query("SELECT * FROM {{users}} WHERE `que`"); |
2148 | - while($que_row = db_fetch($que_query)) |
|
2148 | + while ($que_row = db_fetch($que_query)) |
|
2149 | 2149 | { |
2150 | 2150 | $que_data = explode(',', $que_row['que']); |
2151 | 2151 | |
2152 | - if(!in_array($que_data[QI_UNIT_ID], sn_get_groups('tech'))) |
|
2152 | + if (!in_array($que_data[QI_UNIT_ID], sn_get_groups('tech'))) |
|
2153 | 2153 | { |
2154 | 2154 | continue; |
2155 | 2155 | } |
@@ -2157,14 +2157,14 @@ discard block |
||
2157 | 2157 | $que_data[QI_TIME] = $que_data[QI_TIME] >= 0 ? $que_data[QI_TIME] : 0; |
2158 | 2158 | // Если планета пустая - ставим главку |
2159 | 2159 | $que_data[QI_PLANET_ID] = $que_data[QI_PLANET_ID] ? $que_data[QI_PLANET_ID] : $que_row['id_planet']; |
2160 | - if($que_data[QI_PLANET_ID]) |
|
2160 | + if ($que_data[QI_PLANET_ID]) |
|
2161 | 2161 | { |
2162 | 2162 | $que_planet_check = db_fetch(upd_do_query("SELECT `id` FROM {{planets}} WHERE `id` = {$que_data[QI_PLANET_ID]}")); |
2163 | - if(!$que_planet_check['id']) |
|
2163 | + if (!$que_planet_check['id']) |
|
2164 | 2164 | { |
2165 | 2165 | $que_data[QI_PLANET_ID] = $que_row['id_planet']; |
2166 | 2166 | $que_planet_check = db_fetch(upd_do_query("SELECT `id` FROM {{planets}} WHERE `id` = {$que_data[QI_PLANET_ID]}")); |
2167 | - if(!$que_planet_check['id']) |
|
2167 | + if (!$que_planet_check['id']) |
|
2168 | 2168 | { |
2169 | 2169 | $que_data[QI_PLANET_ID] = 'NULL'; |
2170 | 2170 | } |
@@ -2181,9 +2181,9 @@ discard block |
||
2181 | 2181 | $price_increase = pow($unit_factor, $unit_level); |
2182 | 2182 | $unit_level++; |
2183 | 2183 | $unit_cost = array(); |
2184 | - foreach($unit_info[P_COST] as $resource_id => $resource_amount) |
|
2184 | + foreach ($unit_info[P_COST] as $resource_id => $resource_amount) |
|
2185 | 2185 | { |
2186 | - if($resource_id === P_FACTOR || $resource_id == RES_ENERGY || !($resource_cost = $resource_amount * $price_increase)) |
|
2186 | + if ($resource_id === P_FACTOR || $resource_id == RES_ENERGY || !($resource_cost = $resource_amount * $price_increase)) |
|
2187 | 2187 | { |
2188 | 2188 | continue; |
2189 | 2189 | } |
@@ -2195,7 +2195,7 @@ discard block |
||
2195 | 2195 | BUILD_CREATE . ",{$unit_level},{$que_data[QI_TIME]},'{$unit_cost}')"; |
2196 | 2196 | } |
2197 | 2197 | |
2198 | - if(!empty($que_lines)) |
|
2198 | + if (!empty($que_lines)) |
|
2199 | 2199 | { |
2200 | 2200 | upd_do_query('INSERT INTO `{{que}}` (`que_player_id`,`que_planet_id_origin`,`que_type`,`que_time_left`,`que_unit_id`,`que_unit_amount`,`que_unit_mode`,`que_unit_level`,`que_unit_time`,`que_unit_price`) VALUES ' . implode(',', $que_lines)); |
2201 | 2201 | } |
@@ -2210,7 +2210,7 @@ discard block |
||
2210 | 2210 | |
2211 | 2211 | |
2212 | 2212 | // Ковертируем технологии в таблицы |
2213 | - if($update_tables['users']['graviton_tech']) |
|
2213 | + if ($update_tables['users']['graviton_tech']) |
|
2214 | 2214 | { |
2215 | 2215 | upd_do_query("DELETE FROM {{unit}} WHERE unit_type = " . UNIT_TECHNOLOGIES); |
2216 | 2216 | |
@@ -2218,18 +2218,18 @@ discard block |
||
2218 | 2218 | $user_query = upd_do_query("SELECT * FROM {{users}}"); |
2219 | 2219 | upd_add_more_time(300); |
2220 | 2220 | $sn_group_tech = sn_get_groups('tech'); |
2221 | - while($user_row = db_fetch($user_query)) |
|
2221 | + while ($user_row = db_fetch($user_query)) |
|
2222 | 2222 | { |
2223 | - foreach($sn_group_tech as $tech_id) |
|
2223 | + foreach ($sn_group_tech as $tech_id) |
|
2224 | 2224 | { |
2225 | - if($tech_level = intval($user_row[get_unit_param($tech_id, P_NAME)])) |
|
2225 | + if ($tech_level = intval($user_row[get_unit_param($tech_id, P_NAME)])) |
|
2226 | 2226 | { |
2227 | 2227 | $que_lines[] = "({$user_row['id']}," . LOC_USER . ",{$user_row['id']}," . UNIT_TECHNOLOGIES . ",{$tech_id},{$tech_level})"; |
2228 | 2228 | } |
2229 | 2229 | } |
2230 | 2230 | } |
2231 | 2231 | |
2232 | - if(!empty($que_lines)) |
|
2232 | + if (!empty($que_lines)) |
|
2233 | 2233 | { |
2234 | 2234 | upd_do_query("INSERT INTO {{unit}} (unit_player_id, unit_location_type, unit_location_id, unit_type, unit_snid, unit_level) VALUES " . implode(',', $que_lines)); |
2235 | 2235 | } |
@@ -2239,30 +2239,30 @@ discard block |
||
2239 | 2239 | ), $update_tables['users']['graviton_tech']); |
2240 | 2240 | } |
2241 | 2241 | |
2242 | - if(!$update_indexes['unit']['I_unit_record_search']) |
|
2242 | + if (!$update_indexes['unit']['I_unit_record_search']) |
|
2243 | 2243 | { |
2244 | 2244 | upd_alter_table('unit', array( |
2245 | 2245 | "ADD KEY `I_unit_record_search` (`unit_snid`,`unit_player_id`,`unit_level` DESC,`unit_id`)", |
2246 | 2246 | ), !$update_indexes['unit']['I_unit_record_search']); |
2247 | 2247 | |
2248 | - foreach(sn_get_groups(array('structures', 'fleet', 'defense')) as $unit_id) |
|
2248 | + foreach (sn_get_groups(array('structures', 'fleet', 'defense')) as $unit_id) |
|
2249 | 2249 | { |
2250 | 2250 | $planet_units[get_unit_param($unit_id, P_NAME)] = 1; |
2251 | 2251 | } |
2252 | 2252 | $drop_index = array(); |
2253 | 2253 | $create_index = &$drop_index; // array(); |
2254 | - foreach($planet_units as $unit_name => $unit_create) |
|
2254 | + foreach ($planet_units as $unit_name => $unit_create) |
|
2255 | 2255 | { |
2256 | - if($update_indexes['planets']['I_' . $unit_name]) |
|
2256 | + if ($update_indexes['planets']['I_' . $unit_name]) |
|
2257 | 2257 | { |
2258 | 2258 | $drop_index[] = "DROP KEY I_{$unit_name}"; |
2259 | 2259 | } |
2260 | - if($update_indexes['planets']['i_' . $unit_name]) |
|
2260 | + if ($update_indexes['planets']['i_' . $unit_name]) |
|
2261 | 2261 | { |
2262 | 2262 | $drop_index[] = "DROP KEY i_{$unit_name}"; |
2263 | 2263 | } |
2264 | 2264 | |
2265 | - if($unit_create) |
|
2265 | + if ($unit_create) |
|
2266 | 2266 | { |
2267 | 2267 | $create_index[] = "ADD KEY `I_{$unit_name}` (`id_owner`, {$unit_name} DESC)"; |
2268 | 2268 | } |
@@ -2274,7 +2274,7 @@ discard block |
||
2274 | 2274 | "ADD `user_time_utc_offset` INT(11) DEFAULT NULL COMMENT 'User time difference with server time' AFTER `user_time_diff`", |
2275 | 2275 | ), !$update_tables['users']['user_time_utc_offset']); |
2276 | 2276 | |
2277 | - if(!$update_foreigns['alliance']['FK_alliance_owner']) |
|
2277 | + if (!$update_foreigns['alliance']['FK_alliance_owner']) |
|
2278 | 2278 | { |
2279 | 2279 | upd_do_query("UPDATE {{alliance}} SET ally_owner = null WHERE ally_owner not in (select id from {{users}})"); |
2280 | 2280 | |
@@ -2295,7 +2295,7 @@ discard block |
||
2295 | 2295 | |
2296 | 2296 | upd_check_key('chat_highlight_developer', '<span class="nick_developer">$1</span>', !$config->chat_highlight_developer); |
2297 | 2297 | |
2298 | - if(!$update_tables['player_name_history']) |
|
2298 | + if (!$update_tables['player_name_history']) |
|
2299 | 2299 | { |
2300 | 2300 | upd_check_key('game_user_changename_cost', 100000, !$config->game_user_changename_cost); |
2301 | 2301 | upd_check_key('game_user_changename', SERVER_PLAYER_NAME_CHANGE_PAY, $config->game_user_changename != SERVER_PLAYER_NAME_CHANGE_PAY); |
@@ -2325,7 +2325,7 @@ discard block |
||
2325 | 2325 | "ADD `density_index` TINYINT NOT NULL DEFAULT " . PLANET_DENSITY_STANDARD . " COMMENT 'Planet cached density index'", |
2326 | 2326 | ), !$update_tables['planets']['density_index']); |
2327 | 2327 | |
2328 | - if($update_tables['users']['player_artifact_list']) |
|
2328 | + if ($update_tables['users']['player_artifact_list']) |
|
2329 | 2329 | { |
2330 | 2330 | upd_alter_table('unit', "DROP KEY `unit_id`", $update_indexes['unit']['unit_id']); |
2331 | 2331 | |
@@ -2336,17 +2336,17 @@ discard block |
||
2336 | 2336 | $db_changeset = array(); |
2337 | 2337 | |
2338 | 2338 | $query = upd_do_query("SELECT `id`, `player_artifact_list` FROM {{users}} WHERE `player_artifact_list` IS NOT NULL AND `player_artifact_list` != '' FOR UPDATE"); |
2339 | - while($row = db_fetch($query)) |
|
2339 | + while ($row = db_fetch($query)) |
|
2340 | 2340 | { |
2341 | 2341 | $artifact_list = explode(';', $row['player_artifact_list']); |
2342 | - if(!$row['player_artifact_list'] || empty($artifact_list)) |
|
2342 | + if (!$row['player_artifact_list'] || empty($artifact_list)) |
|
2343 | 2343 | { |
2344 | 2344 | continue; |
2345 | 2345 | } |
2346 | - foreach($artifact_list as $key => &$value) |
|
2346 | + foreach ($artifact_list as $key => &$value) |
|
2347 | 2347 | { |
2348 | 2348 | $value = explode(',', $value); |
2349 | - if(!isset($value[1]) || $value[1] <= 0 || !isset($sn_data_artifacts[$value[0]])) |
|
2349 | + if (!isset($value[1]) || $value[1] <= 0 || !isset($sn_data_artifacts[$value[0]])) |
|
2350 | 2350 | { |
2351 | 2351 | unset($artifact_list[$key]); |
2352 | 2352 | continue; |
@@ -2378,14 +2378,14 @@ discard block |
||
2378 | 2378 | "DROP COLUMN `colonisation_tech`", |
2379 | 2379 | ), $update_tables['users']['spy_tech']); |
2380 | 2380 | |
2381 | - upd_check_key('payment_currency_exchange_dm_', 2500, !$config->payment_currency_exchange_dm_ || $config->payment_currency_exchange_dm_ == 1000); |
|
2381 | + upd_check_key('payment_currency_exchange_dm_', 2500, !$config->payment_currency_exchange_dm_ || $config->payment_currency_exchange_dm_ == 1000); |
|
2382 | 2382 | upd_check_key('payment_currency_exchange_eur', 0.09259259259259, !$config->payment_currency_exchange_eur); |
2383 | - upd_check_key('payment_currency_exchange_rub', 4.0, !$config->payment_currency_exchange_rub); |
|
2384 | - upd_check_key('payment_currency_exchange_usd', 0.125, !$config->payment_currency_exchange_usd); |
|
2385 | - upd_check_key('payment_currency_exchange_wme', 0.0952380952381, !$config->payment_currency_exchange_usd); |
|
2386 | - upd_check_key('payment_currency_exchange_wmr', 4.1, !$config->payment_currency_exchange_wmr); |
|
2387 | - upd_check_key('payment_currency_exchange_wmu', 1.05, !$config->payment_currency_exchange_wmu); |
|
2388 | - upd_check_key('payment_currency_exchange_wmz', 0.126582278481, !$config->payment_currency_exchange_wmz); |
|
2383 | + upd_check_key('payment_currency_exchange_rub', 4.0, !$config->payment_currency_exchange_rub); |
|
2384 | + upd_check_key('payment_currency_exchange_usd', 0.125, !$config->payment_currency_exchange_usd); |
|
2385 | + upd_check_key('payment_currency_exchange_wme', 0.0952380952381, !$config->payment_currency_exchange_usd); |
|
2386 | + upd_check_key('payment_currency_exchange_wmr', 4.1, !$config->payment_currency_exchange_wmr); |
|
2387 | + upd_check_key('payment_currency_exchange_wmu', 1.05, !$config->payment_currency_exchange_wmu); |
|
2388 | + upd_check_key('payment_currency_exchange_wmz', 0.126582278481, !$config->payment_currency_exchange_wmz); |
|
2389 | 2389 | |
2390 | 2390 | upd_do_query('COMMIT;', true); |
2391 | 2391 | $new_version = 37; |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | // $same_user = false; |
54 | 54 | // } |
55 | 55 | |
56 | - if(!$user_data) { |
|
56 | + if (!$user_data) { |
|
57 | 57 | message($lang['imp_imperator_none'], $lang['sys_error'], 'index.php', 10); |
58 | 58 | die(); |
59 | 59 | } |
@@ -64,15 +64,15 @@ discard block |
||
64 | 64 | $stat_array = array(); |
65 | 65 | $query = doquery("SELECT * FROM {{statpoints}} WHERE `stat_type` = 1 AND `id_owner` = {$user_id} ORDER BY `stat_code` DESC;"); |
66 | 66 | $stat_count = classSupernova::$db->db_affected_rows(); |
67 | - while($row = db_fetch($query)) { |
|
68 | - foreach($stat_fields as $field_db_name => $field_template_name) { |
|
67 | + while ($row = db_fetch($query)) { |
|
68 | + foreach ($stat_fields as $field_db_name => $field_template_name) { |
|
69 | 69 | // $stat_count - $row['stat_code'] - для реверсирования ID статы в JS |
70 | 70 | $stat_array[$field_template_name]['DATA'][$stat_count - $row['stat_code']] = $row[$field_db_name]; |
71 | 71 | } |
72 | 72 | } |
73 | 73 | |
74 | 74 | $stat_array_date = $stat_array['STAT_DATE']; |
75 | - foreach($stat_array_date['DATA'] as $key => $value) { |
|
75 | + foreach ($stat_array_date['DATA'] as $key => $value) { |
|
76 | 76 | $template->assign_block_vars('stat_date', array( |
77 | 77 | 'ID' => $key, |
78 | 78 | 'VALUE' => $value, |
@@ -85,17 +85,17 @@ discard block |
||
85 | 85 | |
86 | 86 | unset($stat_array['STAT_DATE']); |
87 | 87 | $template_data = array(); |
88 | - foreach($stat_array as $stat_type => &$stat_type_data) { |
|
88 | + foreach ($stat_array as $stat_type => &$stat_type_data) { |
|
89 | 89 | $reverse_min_max = strpos($stat_type, '_RANK') !== false; |
90 | 90 | $stat_type_data['MIN'] = $reverse_min_max ? max($stat_type_data['DATA']) : min($stat_type_data['DATA']); |
91 | 91 | $stat_type_data['MAX'] = $reverse_min_max ? min($stat_type_data['DATA']) : max($stat_type_data['DATA']); |
92 | 92 | $stat_type_data['AVG'] = average($stat_type_data['DATA']); |
93 | - foreach($stat_type_data['DATA'] as $key => $value) { |
|
93 | + foreach ($stat_type_data['DATA'] as $key => $value) { |
|
94 | 94 | // $stat_type_data['PERCENT'][$key] = $stat_type_data['MAX'] - $value ? ($stat_type_data['MAX'] - $stat_type_data['MIN']) / ($stat_type_data['MAX'] - $value) : 100; |
95 | 95 | $stat_type_data['PERCENT'][$key] = ($stat_type_data['MAX'] - $value ? ($value - $stat_type_data['MIN']) / ($stat_type_data['MAX'] - $stat_type_data['MIN']) : 1) * 100; |
96 | 96 | $template_data[$stat_type][$key]['ID'] = $key; |
97 | 97 | $template_data[$stat_type][$key]['VALUE'] = $value; |
98 | - $template_data[$stat_type][$key]['DELTA'] = ($reverse_min_max ? $stat_type_data['MIN'] - $value : $value - $stat_type_data['MAX']); |
|
98 | + $template_data[$stat_type][$key]['DELTA'] = ($reverse_min_max ? $stat_type_data['MIN'] - $value : $value - $stat_type_data['MAX']); |
|
99 | 99 | $template_data[$stat_type][$key]['PERCENT'] = $stat_type_data['PERCENT'][$key]; |
100 | 100 | |
101 | 101 | //$template_data[$stat_type][$key]['PERCENT'] = $key ? $stat_type_data['PERCENT'][$key] : 50; // TODO DEBUG |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | } |
104 | 104 | // pdump($stat_array['RES_POINTS']); |
105 | 105 | |
106 | - foreach($template_data as $stat_type => $stat_type_data) { |
|
106 | + foreach ($template_data as $stat_type => $stat_type_data) { |
|
107 | 107 | $template->assign_block_vars('stat', array( |
108 | 108 | 'TYPE' => $stat_type, |
109 | 109 | 'TEXT' => $lang['imp_stat_types'][$stat_type], |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | 'MAX' => $stat_array[$stat_type]['MAX'], |
112 | 112 | 'AVG' => $stat_array[$stat_type]['AVG'], |
113 | 113 | )); |
114 | - foreach($stat_type_data as $stat_entry) { |
|
114 | + foreach ($stat_type_data as $stat_entry) { |
|
115 | 115 | $template->assign_block_vars('stat.entry', $stat_entry); |
116 | 116 | } |
117 | 117 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | |
120 | 120 | // pdump($template_data); |
121 | 121 | |
122 | - if($same_user) { |
|
122 | + if ($same_user) { |
|
123 | 123 | rpg_level_up($user, RPG_STRUCTURE); |
124 | 124 | rpg_level_up($user, RPG_RAID); |
125 | 125 | rpg_level_up($user, RPG_TECH); |
@@ -153,29 +153,29 @@ discard block |
||
153 | 153 | 'builder_xp' => pretty_number($user_data['xpminier']), |
154 | 154 | 'builder_lvl' => pretty_number($user_data['lvl_minier']), |
155 | 155 | 'builder_lvl_st' => pretty_number(rpg_get_miner_xp($user_data['lvl_minier'])), |
156 | - 'builder_lvl_up' => pretty_number(rpg_get_miner_xp($user_data['lvl_minier']+1)), |
|
156 | + 'builder_lvl_up' => pretty_number(rpg_get_miner_xp($user_data['lvl_minier'] + 1)), |
|
157 | 157 | 'raid_xp' => pretty_number($user_data['xpraid']), |
158 | 158 | 'raid_lvl' => pretty_number($user_data['lvl_raid']), |
159 | - 'raid_lvl_up' => pretty_number(rpg_get_raider_xp($user_data['lvl_raid']+1)), |
|
159 | + 'raid_lvl_up' => pretty_number(rpg_get_raider_xp($user_data['lvl_raid'] + 1)), |
|
160 | 160 | 'raids' => pretty_number($user_data['raids']), |
161 | 161 | 'raidswin' => pretty_number($user_data['raidswin']), |
162 | 162 | 'raidsloose' => pretty_number($user_data['raidsloose']), |
163 | 163 | 'tech_xp' => pretty_number($user_data['player_rpg_tech_xp']), |
164 | 164 | 'tech_lvl' => pretty_number($user_data['player_rpg_tech_level']), |
165 | 165 | 'tech_lvl_st' => pretty_number(rpg_get_tech_xp($user_data['player_rpg_tech_level'])), |
166 | - 'tech_lvl_up' => pretty_number(rpg_get_tech_xp($user_data['player_rpg_tech_level']+1)), |
|
166 | + 'tech_lvl_up' => pretty_number(rpg_get_tech_xp($user_data['player_rpg_tech_level'] + 1)), |
|
167 | 167 | |
168 | 168 | 'explore_xp' => pretty_number($user_data['player_rpg_explore_xp']), |
169 | 169 | 'explore_lvl' => pretty_number($user_data['player_rpg_explore_level']), |
170 | 170 | 'explore_lvl_st' => pretty_number(rpg_get_explore_xp($user_data['player_rpg_explore_level'])), |
171 | - 'explore_lvl_up' => pretty_number(rpg_get_explore_xp($user_data['player_rpg_explore_level']+1)), |
|
172 | - |
|
173 | - 'build_points' => pretty_number( $StatRecord['build_points'] ), |
|
174 | - 'tech_points' => pretty_number( $StatRecord['tech_points'] ), |
|
175 | - 'fleet_points' => pretty_number( $StatRecord['fleet_points'] ), |
|
176 | - 'defs_points' => pretty_number( $StatRecord['defs_points'] ), |
|
177 | - 'res_points' => pretty_number( $StatRecord['res_points'] ), |
|
178 | - 'total_points' => pretty_number( $StatRecord['total_points'] ), |
|
171 | + 'explore_lvl_up' => pretty_number(rpg_get_explore_xp($user_data['player_rpg_explore_level'] + 1)), |
|
172 | + |
|
173 | + 'build_points' => pretty_number($StatRecord['build_points']), |
|
174 | + 'tech_points' => pretty_number($StatRecord['tech_points']), |
|
175 | + 'fleet_points' => pretty_number($StatRecord['fleet_points']), |
|
176 | + 'defs_points' => pretty_number($StatRecord['defs_points']), |
|
177 | + 'res_points' => pretty_number($StatRecord['res_points']), |
|
178 | + 'total_points' => pretty_number($StatRecord['total_points']), |
|
179 | 179 | 'user_rank' => $StatRecord['total_rank'], |
180 | 180 | 'RANK_DIFF' => $StatRecord['total_old_rank'] - $StatRecord['total_rank'], |
181 | 181 |
@@ -14,14 +14,14 @@ |
||
14 | 14 | global $lang, $user, $planetrow; |
15 | 15 | |
16 | 16 | $tech_tree = array(); |
17 | - foreach(get_unit_param('techtree') as $unit_group_id => $unit_list) |
|
17 | + foreach (get_unit_param('techtree') as $unit_group_id => $unit_list) |
|
18 | 18 | { |
19 | 19 | $tech_tree[] = array( |
20 | 20 | 'NAME' => $lang['tech'][$unit_group_id], |
21 | 21 | 'GROUP_ID' => $unit_group_id, |
22 | 22 | ); |
23 | 23 | |
24 | - foreach($unit_list as $unit_id) |
|
24 | + foreach ($unit_list as $unit_id) |
|
25 | 25 | { |
26 | 26 | $sn_data_unit = get_unit_param($unit_id); |
27 | 27 | $level_basic = $sn_data_unit[P_STACKABLE] ? 0 : mrc_get_level($user, $planetrow, $unit_id, false, true); |
@@ -18,7 +18,7 @@ |
||
18 | 18 | $query = db_user_list("`authlevel` > 0 ORDER BY `authlevel` ASC"); |
19 | 19 | |
20 | 20 | // while($row = db_fetch($query)) |
21 | - foreach($query as $row) |
|
21 | + foreach ($query as $row) |
|
22 | 22 | { |
23 | 23 | $template_result['.']['contact'][] = array( |
24 | 24 | 'NAME' => $row['username'], |
@@ -22,17 +22,17 @@ discard block |
||
22 | 22 | $sn_group_factories = sn_get_groups('factories'); |
23 | 23 | $planet_density = sn_get_groups('planet_density'); |
24 | 24 | |
25 | - if(sys_get_param('save_production')) { |
|
25 | + if (sys_get_param('save_production')) { |
|
26 | 26 | $production = sys_get_param('percent'); |
27 | - if(is_array($production) && !empty($production)) { |
|
27 | + if (is_array($production) && !empty($production)) { |
|
28 | 28 | // sn_db_transaction_start(); |
29 | 29 | $query = array(); |
30 | 30 | $planet_row_list = db_planet_list_sorted($user, false, '*'); |
31 | 31 | // while($planet = db_fetch($planet_row_list)) |
32 | - foreach($planet_row_list as $planet) { |
|
33 | - foreach($sn_group_factories as $factory_unit_id) { |
|
32 | + foreach ($planet_row_list as $planet) { |
|
33 | + foreach ($sn_group_factories as $factory_unit_id) { |
|
34 | 34 | $unit_db_name_porcent = pname_factory_production_field_name($factory_unit_id); |
35 | - if( |
|
35 | + if ( |
|
36 | 36 | get_unit_param($factory_unit_id, P_MINING_IS_MANAGED) |
37 | 37 | && isset($production[$factory_unit_id][$planet['id']]) |
38 | 38 | && ($actual_porcent = intval($production[$factory_unit_id][$planet['id']] / 10)) >= 0 |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | } |
44 | 44 | } |
45 | 45 | } |
46 | - foreach($query as $planet_id => $query_data) { |
|
46 | + foreach ($query as $planet_id => $query_data) { |
|
47 | 47 | db_planet_set_by_id($planet_id, implode(',', $query_data)); |
48 | 48 | } |
49 | 49 | // sn_db_transaction_commit(); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | $planet_row_list = db_planet_list_sorted($user); |
54 | 54 | // while ($planet = db_fetch($planet_row_list)) |
55 | - foreach($planet_row_list as $planet) { |
|
55 | + foreach ($planet_row_list as $planet) { |
|
56 | 56 | sn_db_transaction_start(); |
57 | 57 | $global_data = sys_o_get_updated($user, $planet['id'], SN_TIME_NOW, false, true); |
58 | 58 | $planets[$planet['id']] = $global_data['planet']; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $template = gettemplate('imperium', $template); |
65 | 65 | $template->assign_var('amount', count($planets) + 2); |
66 | 66 | |
67 | - for($i = 100; $i >= 0; $i -= 10) { |
|
67 | + for ($i = 100; $i >= 0; $i -= 10) { |
|
68 | 68 | $template->assign_block_vars('percent', array('PERCENT' => $i)); |
69 | 69 | } |
70 | 70 | |
@@ -79,8 +79,8 @@ discard block |
||
79 | 79 | $planet_template = tpl_parse_planet($planet); |
80 | 80 | |
81 | 81 | $planet_fleet_id = 0; |
82 | - $fleet_list = $planet_template['fleet_list'];//flt_get_fleets_to_planet($planet); |
|
83 | - if($fleet_list['own']['count']) |
|
82 | + $fleet_list = $planet_template['fleet_list']; //flt_get_fleets_to_planet($planet); |
|
83 | + if ($fleet_list['own']['count']) |
|
84 | 84 | { |
85 | 85 | $planet_fleet_id = "p{$fleet_id}"; |
86 | 86 | $fleets[] = tpl_parse_fleet_sn($fleet_list['own']['total'], $planet_fleet_id); |
@@ -142,19 +142,19 @@ discard block |
||
142 | 142 | UNIT_DEFENCE => 'defense', |
143 | 143 | ); |
144 | 144 | |
145 | - foreach($show_groups as $unit_group_id => $mode) |
|
145 | + foreach ($show_groups as $unit_group_id => $mode) |
|
146 | 146 | { |
147 | 147 | $template->assign_block_vars('prods', array( |
148 | 148 | 'NAME' => $lang['tech'][$unit_group_id], |
149 | 149 | )); |
150 | 150 | $unit_group = get_unit_param('techtree', $unit_group_id); |
151 | - foreach($unit_group as $unit_id) |
|
151 | + foreach ($unit_group as $unit_id) |
|
152 | 152 | { |
153 | 153 | $unit_count = $unit_count_abs = 0; |
154 | 154 | $block_vars = array(); |
155 | 155 | $unit_is_factory = in_array($unit_id, $sn_group_factories) && get_unit_param($unit_id, P_MINING_IS_MANAGED); |
156 | 156 | // $unit_db_name = pname_resource_name($unit_id); |
157 | - foreach($planets as $planet) |
|
157 | + foreach ($planets as $planet) |
|
158 | 158 | { |
159 | 159 | $unit_level_plain = mrc_get_level($user, $planet, $unit_id, false, true); |
160 | 160 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | $level_plus['LEVEL_PLUS_GREEN'] = 0; |
164 | 164 | |
165 | 165 | $level_plus['PERCENT'] = $unit_is_factory ? ($unit_level_plain ? $planet[pname_factory_production_field_name($unit_id)] * 10 : -1) : -1; |
166 | - switch($mode) |
|
166 | + switch ($mode) |
|
167 | 167 | { |
168 | 168 | /* |
169 | 169 | case 'structures': |
@@ -178,13 +178,13 @@ discard block |
||
178 | 178 | |
179 | 179 | /** @noinspection PhpMissingBreakStatementInspection */ |
180 | 180 | case 'fleet': |
181 | - $level_plus['LEVEL_PLUS_YELLOW'] = $planet['fleet_list']['own']['total'][$unit_id]<=0 ? $planet['fleet_list']['own']['total'][$unit_id] : "+{$planet['fleet_list']['own']['total'][$unit_id]}"; |
|
181 | + $level_plus['LEVEL_PLUS_YELLOW'] = $planet['fleet_list']['own']['total'][$unit_id] <= 0 ? $planet['fleet_list']['own']['total'][$unit_id] : "+{$planet['fleet_list']['own']['total'][$unit_id]}"; |
|
182 | 182 | $total['units'][$unit_id]['LEVEL_PLUS_YELLOW'] += $level_plus['LEVEL_PLUS_YELLOW']; |
183 | 183 | |
184 | 184 | case 'structures': |
185 | 185 | case 'defense': |
186 | 186 | $level_plus_build = $ques[$planet['id']]['in_que'][que_get_unit_que($unit_id)][$user['id']][$planet['id']][$unit_id]; |
187 | - if($level_plus_build) |
|
187 | + if ($level_plus_build) |
|
188 | 188 | { |
189 | 189 | $level_plus['LEVEL_PLUS_GREEN'] = $level_plus_build < 0 ? $level_plus_build : "+{$level_plus_build}"; |
190 | 190 | // $level_plus['LEVEL_PLUS_GREEN'] = "+{$level_plus_build}"; |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | $unit_count_abs += $unit_level_plain + abs($level_plus['LEVEL_PLUS_YELLOW']) + abs($level_plus['LEVEL_PLUS_GREEN']); |
206 | 206 | } |
207 | 207 | |
208 | - if($unit_count_abs) |
|
208 | + if ($unit_count_abs) |
|
209 | 209 | { |
210 | 210 | $template->assign_block_vars('prods', array( |
211 | 211 | 'ID' => $unit_id, |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | 'MODE' => $mode, |
215 | 215 | )); |
216 | 216 | |
217 | - foreach($block_vars as $block_var) |
|
217 | + foreach ($block_vars as $block_var) |
|
218 | 218 | { |
219 | 219 | $template->assign_block_vars('prods.planet', $block_var); |
220 | 220 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * que esperabas!!! soy newbie!!! D':< |
25 | 25 | */ |
26 | 26 | |
27 | -if(!defined('INSIDE')) { |
|
27 | +if (!defined('INSIDE')) { |
|
28 | 28 | die("attemp hacking"); |
29 | 29 | } |
30 | 30 | |
@@ -37,16 +37,16 @@ discard block |
||
37 | 37 | function log_file($message, $ident_change = 0) { |
38 | 38 | static $ident = 0; |
39 | 39 | |
40 | - if(!defined('SN_DEBUG_LOG')) { |
|
40 | + if (!defined('SN_DEBUG_LOG')) { |
|
41 | 41 | return; |
42 | 42 | } |
43 | 43 | |
44 | - if($this->log_file_handler === null) { |
|
44 | + if ($this->log_file_handler === null) { |
|
45 | 45 | $this->log_file_handler = @fopen(SN_ROOT_PHYSICAL . '/.logs/supernova.log', 'a+'); |
46 | 46 | @fwrite($this->log_file_handler, "\r\n\r\n"); |
47 | 47 | } |
48 | 48 | $ident_change < 0 ? $ident += $ident_change * 2 : false; |
49 | - if($this->log_file_handler) { |
|
49 | + if ($this->log_file_handler) { |
|
50 | 50 | @fwrite($this->log_file_handler, date(FMT_DATE_TIME_SQL, time()) . str_repeat(' ', $ident + 1) . $message . "\r\n"); |
51 | 51 | } |
52 | 52 | $ident_change > 0 ? $ident += $ident_change * 2 : false; |
@@ -77,8 +77,8 @@ discard block |
||
77 | 77 | $result = array(); |
78 | 78 | $transaction_id = classSupernova::db_transaction_check(false) ? classSupernova::$transaction_id : classSupernova::$transaction_id++; |
79 | 79 | $result[] = "tID {$transaction_id}"; |
80 | - foreach($backtrace as $a_trace) { |
|
81 | - if(in_array($a_trace['function'], $exclude_functions)) { |
|
80 | + foreach ($backtrace as $a_trace) { |
|
81 | + if (in_array($a_trace['function'], $exclude_functions)) { |
|
82 | 82 | continue; |
83 | 83 | } |
84 | 84 | $function = |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | // $result[] = "{$function} ({$a_trace['line']})'{$file}'"; |
96 | 96 | $result[] = "{$function} - '{$file}' Line {$a_trace['line']}"; |
97 | 97 | |
98 | - if(!$long_comment) { |
|
98 | + if (!$long_comment) { |
|
99 | 99 | break; |
100 | 100 | } |
101 | 101 | } |
@@ -107,26 +107,26 @@ discard block |
||
107 | 107 | } |
108 | 108 | |
109 | 109 | function dump($dump = false, $force_base = false, $deadlock = false) { |
110 | - if($dump === false) { |
|
110 | + if ($dump === false) { |
|
111 | 111 | return; |
112 | 112 | } |
113 | 113 | |
114 | 114 | $error_backtrace = array(); |
115 | 115 | $base_dump = false; |
116 | 116 | |
117 | - if($force_base === true) { |
|
117 | + if ($force_base === true) { |
|
118 | 118 | $base_dump = true; |
119 | 119 | } |
120 | 120 | |
121 | - if($dump === true) { |
|
121 | + if ($dump === true) { |
|
122 | 122 | $base_dump = true; |
123 | 123 | } else { |
124 | - if(!is_array($dump)) { |
|
124 | + if (!is_array($dump)) { |
|
125 | 125 | $dump = array('var' => $dump); |
126 | 126 | } |
127 | 127 | |
128 | - foreach($dump as $dump_var_name => $dump_var) { |
|
129 | - if($dump_var_name == 'base_dump') { |
|
128 | + foreach ($dump as $dump_var_name => $dump_var) { |
|
129 | + if ($dump_var_name == 'base_dump') { |
|
130 | 130 | $base_dump = $dump_var; |
131 | 131 | } else { |
132 | 132 | $error_backtrace[$dump_var_name] = $dump_var; |
@@ -135,26 +135,25 @@ discard block |
||
135 | 135 | } |
136 | 136 | |
137 | 137 | // if($deadlock && ($q = db_fetch(classSupernova::$db->__db_query('SHOW ENGINE INNODB STATUS')))) { |
138 | - if($deadlock && ($q = db_fetch(classSupernova::$db->mysql_get_innodb_status()))) { |
|
138 | + if ($deadlock && ($q = db_fetch(classSupernova::$db->mysql_get_innodb_status()))) { |
|
139 | 139 | $error_backtrace['deadlock'] = explode("\n", $q['Status']); |
140 | 140 | $error_backtrace['locks'] = classSupernova::$locks; |
141 | 141 | $error_backtrace['cSN_data'] = classSupernova::$data; |
142 | - foreach($error_backtrace['cSN_data'] as &$location) { |
|
143 | - foreach($location as $location_id => &$location_data) // $location_data = $location_id; |
|
142 | + foreach ($error_backtrace['cSN_data'] as &$location) { |
|
143 | + foreach ($location as $location_id => &$location_data) // $location_data = $location_id; |
|
144 | 144 | { |
145 | - $location_data = isset($location_data['username']) ? $location_data['username'] : |
|
146 | - (isset($location_data['name']) ? $location_data['name'] : $location_id); |
|
145 | + $location_data = isset($location_data['username']) ? $location_data['username'] : (isset($location_data['name']) ? $location_data['name'] : $location_id); |
|
147 | 146 | } |
148 | 147 | } |
149 | 148 | $error_backtrace['cSN_queries'] = classSupernova::$queries; |
150 | 149 | } |
151 | 150 | |
152 | - if($base_dump) { |
|
153 | - if(is_array($this->log_array) && count($this->log_array) > 0) { |
|
151 | + if ($base_dump) { |
|
152 | + if (is_array($this->log_array) && count($this->log_array) > 0) { |
|
154 | 153 | ; |
155 | 154 | } |
156 | 155 | { |
157 | - foreach($this->log_array as $log) { |
|
156 | + foreach ($this->log_array as $log) { |
|
158 | 157 | $error_backtrace['queries'][] = $log; |
159 | 158 | } |
160 | 159 | } |
@@ -185,14 +184,14 @@ discard block |
||
185 | 184 | function error($message = 'There is a error on page', $title = 'Internal Error', $error_code = 500, $dump = true) { |
186 | 185 | global $config, $sys_stop_log_hit, $lang, $sys_log_disabled, $user; |
187 | 186 | |
188 | - if(empty(classSupernova::$db->connected)) { |
|
187 | + if (empty(classSupernova::$db->connected)) { |
|
189 | 188 | // TODO - писать ошибку в файл |
190 | 189 | die('SQL server currently unavailable. Please contact Administration...'); |
191 | 190 | } |
192 | 191 | |
193 | 192 | sn_db_transaction_rollback(); |
194 | 193 | |
195 | - if($config->debug == 1) { |
|
194 | + if ($config->debug == 1) { |
|
196 | 195 | echo "<h2>{$title}</h2><br><font color=red>{$message}</font><br><hr>"; |
197 | 196 | echo "<table>{$this->log}</table>"; |
198 | 197 | } |
@@ -202,7 +201,7 @@ discard block |
||
202 | 201 | $error_text = db_escape($message); |
203 | 202 | $error_backtrace = $this->dump($dump, true, strpos($message, 'Deadlock') !== false); |
204 | 203 | |
205 | - if(!$sys_log_disabled) { |
|
204 | + if (!$sys_log_disabled) { |
|
206 | 205 | $query = "INSERT INTO `{{logs}}` SET |
207 | 206 | `log_time` = '" . time() . "', `log_code` = '" . db_escape($error_code) . "', `log_sender` = '" . db_escape($user['id']) . "', |
208 | 207 | `log_username` = '" . db_escape($user['user_name']) . "', `log_title` = '" . db_escape($title) . "', `log_text` = '" . db_escape($message) . "', |
@@ -220,7 +219,7 @@ discard block |
||
220 | 219 | ob_start(); |
221 | 220 | print("<hr>User ID {$user['id']} raised error code {$error_code} titled '{$title}' with text '{$error_text}' on page {$_SERVER['SCRIPT_NAME']}"); |
222 | 221 | |
223 | - foreach($error_backtrace as $name => $value) { |
|
222 | + foreach ($error_backtrace as $name => $value) { |
|
224 | 223 | print('<hr>'); |
225 | 224 | pdump($value, $name); |
226 | 225 | } |
@@ -232,14 +231,14 @@ discard block |
||
232 | 231 | function warning($message, $title = 'System Message', $log_code = 300, $dump = false) { |
233 | 232 | global $user, $lang, $sys_log_disabled; |
234 | 233 | |
235 | - if(empty(classSupernova::$db->connected)) { |
|
234 | + if (empty(classSupernova::$db->connected)) { |
|
236 | 235 | // TODO - писать ошибку в файл |
237 | 236 | die('SQL server currently unavailable. Please contact Administration...'); |
238 | 237 | } |
239 | 238 | |
240 | 239 | $error_backtrace = $this->dump($dump, false); |
241 | 240 | |
242 | - if(!$sys_log_disabled) { |
|
241 | + if (!$sys_log_disabled) { |
|
243 | 242 | $query = "INSERT INTO `{{logs}}` SET |
244 | 243 | `log_time` = '" . time() . "', `log_code` = '" . db_escape($log_code) . "', `log_sender` = '" . db_escape($user['id']) . "', |
245 | 244 | `log_username` = '" . db_escape($user['user_name']) . "', `log_title` = '" . db_escape($title) . "', `log_text` = '" . db_escape($message) . "', |
@@ -257,11 +256,11 @@ discard block |
||
257 | 256 | // Dump variables nicer then var_dump() |
258 | 257 | |
259 | 258 | function dump($value, $varname = null, $level = 0, $dumper = '') { |
260 | - if(isset($varname)) { |
|
259 | + if (isset($varname)) { |
|
261 | 260 | $varname .= " = "; |
262 | 261 | } |
263 | 262 | |
264 | - if($level == -1) { |
|
263 | + if ($level == -1) { |
|
265 | 264 | $trans[' '] = '∴'; |
266 | 265 | $trans["\t"] = '⇒'; |
267 | 266 | $trans["\n"] = '¶;'; |
@@ -270,7 +269,7 @@ discard block |
||
270 | 269 | |
271 | 270 | return strtr(htmlspecialchars($value), $trans); |
272 | 271 | } |
273 | - if($level == 0) { |
|
272 | + if ($level == 0) { |
|
274 | 273 | // $dumper = '<pre>' . mt_rand(10, 99) . '|' . $varname; |
275 | 274 | $dumper = mt_rand(10, 99) . '|' . $varname; |
276 | 275 | } |
@@ -278,22 +277,22 @@ discard block |
||
278 | 277 | $type = gettype($value); |
279 | 278 | $dumper .= $type; |
280 | 279 | |
281 | - if($type == 'string') { |
|
280 | + if ($type == 'string') { |
|
282 | 281 | $dumper .= '(' . strlen($value) . ')'; |
283 | 282 | $value = dump($value, '', -1); |
284 | - } elseif($type == 'boolean') { |
|
283 | + } elseif ($type == 'boolean') { |
|
285 | 284 | $value = ($value ? 'true' : 'false'); |
286 | - } elseif($type == 'object') { |
|
285 | + } elseif ($type == 'object') { |
|
287 | 286 | $props = get_class_vars(get_class($value)); |
288 | 287 | $dumper .= '(' . count($props) . ') <u>' . get_class($value) . '</u>'; |
289 | - foreach($props as $key => $val) { |
|
288 | + foreach ($props as $key => $val) { |
|
290 | 289 | $dumper .= "\n" . str_repeat("\t", $level + 1) . $key . ' => '; |
291 | 290 | $dumper .= dump($value->$key, '', $level + 1); |
292 | 291 | } |
293 | 292 | $value = ''; |
294 | - } elseif($type == 'array') { |
|
293 | + } elseif ($type == 'array') { |
|
295 | 294 | $dumper .= '(' . count($value) . ')'; |
296 | - foreach($value as $key => $val) { |
|
295 | + foreach ($value as $key => $val) { |
|
297 | 296 | $dumper .= "\n" . str_repeat("\t", $level + 1) . dump($key, '', -1) . ' => '; |
298 | 297 | $dumper .= dump($val, '', $level + 1); |
299 | 298 | } |
@@ -313,7 +312,7 @@ discard block |
||
313 | 312 | // $backtrace = $backtrace[1]; |
314 | 313 | |
315 | 314 | $caller = ''; |
316 | - if(defined('SN_DEBUG_PDUMP_CALLER') && SN_DEBUG_PDUMP_CALLER) { |
|
315 | + if (defined('SN_DEBUG_PDUMP_CALLER') && SN_DEBUG_PDUMP_CALLER) { |
|
317 | 316 | $caller = (!empty($backtrace[1]['class']) ? $backtrace[1]['class'] : '') . |
318 | 317 | (!empty($backtrace[1]['type']) ? $backtrace[1]['type'] : '') . |
319 | 318 | $backtrace[1]['function'] . |
@@ -340,7 +339,7 @@ discard block |
||
340 | 339 | } |
341 | 340 | |
342 | 341 | function pr($prePrint = false) { |
343 | - if($prePrint) { |
|
342 | + if ($prePrint) { |
|
344 | 343 | print("<br>"); |
345 | 344 | } |
346 | 345 | print(mt_rand() . "<br>"); |
@@ -350,7 +349,7 @@ discard block |
||
350 | 349 | global $_PRINT_COUNT_VALUE; |
351 | 350 | $_PRINT_COUNT_VALUE++; |
352 | 351 | |
353 | - if($prePrint) { |
|
352 | + if ($prePrint) { |
|
354 | 353 | print("<br>"); |
355 | 354 | } |
356 | 355 | print($_PRINT_COUNT_VALUE . "<br>"); |
@@ -15,8 +15,8 @@ discard block |
||
15 | 15 | 'factor' => 1.5, |
16 | 16 | ), |
17 | 17 | P_UNIT_PRODUCTION => array( |
18 | - RES_METAL => function ($level, $production_factor, $user, $planet_row) {return 40 * $level * pow(1.1, $level) * (0.1 * $production_factor);}, |
|
19 | - RES_ENERGY => function ($level, $production_factor, $user, $planet_row) {return -13 * $level * pow(1.1, $level) * (0.1 * $production_factor);}, |
|
18 | + RES_METAL => function($level, $production_factor, $user, $planet_row) {return 40 * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
19 | + RES_ENERGY => function($level, $production_factor, $user, $planet_row) {return -13 * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
20 | 20 | ), |
21 | 21 | P_MINING_IS_MANAGED => true, |
22 | 22 | ), |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | 'factor' => 1.6, |
34 | 34 | ), |
35 | 35 | P_UNIT_PRODUCTION => array( |
36 | - RES_CRYSTAL => function ($level, $production_factor, $user, $planet_row) {return 32 * $level * pow(1.1, $level) * (0.1 * $production_factor);}, |
|
37 | - RES_ENERGY => function ($level, $production_factor, $user, $planet_row) {return -16 * $level * pow(1.1, $level) * (0.1 * $production_factor);}, |
|
36 | + RES_CRYSTAL => function($level, $production_factor, $user, $planet_row) {return 32 * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
37 | + RES_ENERGY => function($level, $production_factor, $user, $planet_row) {return -16 * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
38 | 38 | ), |
39 | 39 | P_MINING_IS_MANAGED => true, |
40 | 40 | ), |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | 'factor' => 1.5, |
52 | 52 | ), |
53 | 53 | P_UNIT_PRODUCTION => array( |
54 | - RES_DEUTERIUM => function ($level, $production_factor, $user, $planet_row) {return 10 * $level * pow(1.1, $level) * (0.1 * $production_factor) * (-0.002 * $planet_row["temp_max"] + 1.28);}, |
|
55 | - RES_ENERGY => function ($level, $production_factor, $user, $planet_row) {return -20 * $level * pow(1.1, $level) * (0.1 * $production_factor);}, |
|
54 | + RES_DEUTERIUM => function($level, $production_factor, $user, $planet_row) {return 10 * $level * pow(1.1, $level) * (0.1 * $production_factor) * (-0.002 * $planet_row["temp_max"] + 1.28); }, |
|
55 | + RES_ENERGY => function($level, $production_factor, $user, $planet_row) {return -20 * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
56 | 56 | ), |
57 | 57 | P_MINING_IS_MANAGED => true, |
58 | 58 | ), |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | 'factor' => 1.5, |
70 | 70 | ), |
71 | 71 | P_UNIT_PRODUCTION => array( |
72 | - RES_ENERGY => function ($level, $production_factor, $user, $planet_row) {return ($planet_row["temp_max"] / 5 + 15) * $level * pow(1.1, $level) * (0.1 * $production_factor);}, |
|
72 | + RES_ENERGY => function($level, $production_factor, $user, $planet_row) {return ($planet_row["temp_max"] / 5 + 15) * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
73 | 73 | ), |
74 | 74 | P_MINING_IS_MANAGED => true, |
75 | 75 | ), |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | 'factor' => 1.8, |
88 | 88 | ), |
89 | 89 | P_UNIT_PRODUCTION => array( |
90 | - RES_DEUTERIUM => function ($level, $production_factor, $user, $planet_row) {return -10 * $level * pow(1.1, $level) * (0.1 * $production_factor);}, |
|
91 | - RES_ENERGY => function ($level, $production_factor, $user, $planet_row) {return 30 * $level * pow(1.05 + 0.01 * mrc_get_level($user, "", TECH_ENERGY), $level) * (0.1 * $production_factor);}, |
|
90 | + RES_DEUTERIUM => function($level, $production_factor, $user, $planet_row) {return -10 * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
91 | + RES_ENERGY => function($level, $production_factor, $user, $planet_row) {return 30 * $level * pow(1.05 + 0.01 * mrc_get_level($user, "", TECH_ENERGY), $level) * (0.1 * $production_factor); }, |
|
92 | 92 | ), |
93 | 93 | P_MINING_IS_MANAGED => true, |
94 | 94 | ), |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | 'factor' => 2, |
106 | 106 | ), |
107 | 107 | 'storage' => array( |
108 | - RES_METAL => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level);}, |
|
108 | + RES_METAL => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level); }, |
|
109 | 109 | ), |
110 | 110 | ), |
111 | 111 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | 'factor' => 2, |
122 | 122 | ), |
123 | 123 | 'storage' => array( |
124 | - RES_CRYSTAL => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level);}, |
|
124 | + RES_CRYSTAL => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level); }, |
|
125 | 125 | ), |
126 | 126 | ), |
127 | 127 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | 'factor' => 2, |
138 | 138 | ), |
139 | 139 | 'storage' => array( |
140 | - RES_DEUTERIUM => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level);}, |
|
140 | + RES_DEUTERIUM => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level); }, |
|
141 | 141 | ), |
142 | 142 | ), |
143 | 143 |
@@ -2,25 +2,25 @@ discard block |
||
2 | 2 | |
3 | 3 | // ------------------------------------------------------------------------------------------------------------------------------ |
4 | 4 | function sn_sys_load_php_files($dir_name, $load_extension = 'php', $modules = false) { |
5 | - if(file_exists($dir_name)) { |
|
5 | + if (file_exists($dir_name)) { |
|
6 | 6 | $dir = opendir($dir_name); |
7 | - while(($file = readdir($dir)) !== false) { |
|
8 | - if($file == '..' || $file == '.') { |
|
7 | + while (($file = readdir($dir)) !== false) { |
|
8 | + if ($file == '..' || $file == '.') { |
|
9 | 9 | continue; |
10 | 10 | } |
11 | 11 | |
12 | 12 | $full_filename = $dir_name . $file; |
13 | - if($modules && is_dir($full_filename)) { |
|
14 | - if(file_exists($full_filename = "{$full_filename}/{$file}.{$load_extension}")) { |
|
13 | + if ($modules && is_dir($full_filename)) { |
|
14 | + if (file_exists($full_filename = "{$full_filename}/{$file}.{$load_extension}")) { |
|
15 | 15 | require_once($full_filename); |
16 | 16 | // Registering module |
17 | - if(class_exists($file)) { |
|
17 | + if (class_exists($file)) { |
|
18 | 18 | new $file($full_filename); |
19 | 19 | } |
20 | 20 | } |
21 | 21 | } else { |
22 | 22 | $extension = substr($full_filename, -strlen($load_extension)); |
23 | - if($extension == $load_extension) { |
|
23 | + if ($extension == $load_extension) { |
|
24 | 24 | require_once($full_filename); |
25 | 25 | } |
26 | 26 | } |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | */ |
40 | 40 | function init_update(&$config) { |
41 | 41 | $update_file = SN_ROOT_PHYSICAL . "includes/update" . DOT_PHP_EX; |
42 | - if(file_exists($update_file)) { |
|
43 | - if(filemtime($update_file) > $config->db_loadItem('var_db_update') || $config->db_loadItem('db_version') < DB_VERSION) { |
|
44 | - if(defined('IN_ADMIN')) { |
|
42 | + if (file_exists($update_file)) { |
|
43 | + if (filemtime($update_file) > $config->db_loadItem('var_db_update') || $config->db_loadItem('db_version') < DB_VERSION) { |
|
44 | + if (defined('IN_ADMIN')) { |
|
45 | 45 | sn_db_transaction_start(); // Для защиты от двойного запуска апдейта - начинаем транзакцию. Так запись в базе будет блокирована |
46 | - if(SN_TIME_NOW >= $config->db_loadItem('var_db_update_end')) { |
|
46 | + if (SN_TIME_NOW >= $config->db_loadItem('var_db_update_end')) { |
|
47 | 47 | $config->db_saveItem('var_db_update_end', SN_TIME_NOW + ($config->upd_lock_time ? $config->upd_lock_time : 300)); |
48 | 48 | sn_db_transaction_commit(); |
49 | 49 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $current_time = time(); |
54 | 54 | $config->db_saveItem('var_db_update', $current_time); |
55 | 55 | $config->db_saveItem('var_db_update_end', $current_time); |
56 | - } elseif(filemtime($update_file) > $config->var_db_update) { |
|
56 | + } elseif (filemtime($update_file) > $config->var_db_update) { |
|
57 | 57 | $timeout = $config->var_db_update_end - SN_TIME_NOW; |
58 | 58 | die( |
59 | 59 | "Обновляется база данных. Рассчетное время окончания - {$timeout} секунд (время обновления может увеличиваться). Пожалуйста, подождите...<br /> |