@@ -10,11 +10,11 @@ discard block |
||
| 10 | 10 | $time_server = $time_local - $time_diff |
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | -if($font_size = sys_get_param_str('font_size')) { |
|
| 14 | - if(strpos($font_size, '%') !== false) { |
|
| 13 | +if ($font_size = sys_get_param_str('font_size')) { |
|
| 14 | + if (strpos($font_size, '%') !== false) { |
|
| 15 | 15 | // Размер шрифта в процентах |
| 16 | 16 | $font_size = min(max(floatval($font_size), FONT_SIZE_PERCENT_MIN), FONT_SIZE_PERCENT_MAX) . '%'; |
| 17 | - } elseif(strpos($font_size, 'px') !== false) { |
|
| 17 | + } elseif (strpos($font_size, 'px') !== false) { |
|
| 18 | 18 | // Размер шрифта в пикселях |
| 19 | 19 | $font_size = min(max(floatval($font_size), FONT_SIZE_PIXELS_MIN), FONT_SIZE_PIXELS_MAX) . 'px'; |
| 20 | 20 | } else { |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | SN::$user_options[PLAYER_OPTION_BASE_FONT_SIZE] = $font_size; |
| 27 | 27 | } else { |
| 28 | 28 | $user_time_diff = playerTimeDiff::user_time_diff_get(); |
| 29 | - if($user_time_diff[PLAYER_OPTION_TIME_DIFF_FORCED]) { |
|
| 29 | + if ($user_time_diff[PLAYER_OPTION_TIME_DIFF_FORCED]) { |
|
| 30 | 30 | $time_diff = intval($user_time_diff[PLAYER_OPTION_TIME_DIFF]); |
| 31 | 31 | } else { |
| 32 | 32 | $user_time_diff = playerTimeDiff::user_time_diff_probe(); |
@@ -419,7 +419,8 @@ discard block |
||
| 419 | 419 | $location_info = &static::$location_info[$location_type]; |
| 420 | 420 | $id_field = $location_info[P_ID]; |
| 421 | 421 | $table_name = $location_info[P_TABLE_NAME]; |
| 422 | - if ($result = static::db_query_update("UPDATE {{{$table_name}}} SET {$set} WHERE `{$id_field}` = {$record_id}")) // TODO Как-то вернуть может быть LIMIT 1 ? |
|
| 422 | + if ($result = static::db_query_update("UPDATE {{{$table_name}}} SET {$set} WHERE `{$id_field}` = {$record_id}")) { |
|
| 423 | + // TODO Как-то вернуть может быть LIMIT 1 ? |
|
| 423 | 424 | { |
| 424 | 425 | if (static::$db->db_affected_rows()) { |
| 425 | 426 | // Обновляем данные только если ряд был затронут |
@@ -427,6 +428,7 @@ discard block |
||
| 427 | 428 | |
| 428 | 429 | // Тут именно так, а не cache_unset - что бы в кэшах автоматически обновилась запись. Будет нужно на будущее |
| 429 | 430 | _SnCacheInternal::$data[$location_type][$record_id] = null; |
| 431 | + } |
|
| 430 | 432 | // Вытаскиваем обновленную запись |
| 431 | 433 | static::db_get_record_by_id($location_type, $record_id); |
| 432 | 434 | _SnCacheInternal::cache_clear($location_type, false); // Мягкий сброс - только $queries |
@@ -460,9 +462,11 @@ discard block |
||
| 460 | 462 | $set = trim($set); |
| 461 | 463 | $table_name = static::$location_info[$location_type][P_TABLE_NAME]; |
| 462 | 464 | if ($result = static::db_query_insert("INSERT INTO `{{{$table_name}}}` SET {$set}")) { |
| 463 | - if (static::$db->db_affected_rows()) // Обновляем данные только если ряд был затронут |
|
| 465 | + if (static::$db->db_affected_rows()) { |
|
| 466 | + // Обновляем данные только если ряд был затронут |
|
| 464 | 467 | { |
| 465 | 468 | $record_id = db_insert_id(); |
| 469 | + } |
|
| 466 | 470 | // Вытаскиваем запись целиком, потому что в $set могли быть "данные по умолчанию" |
| 467 | 471 | $result = static::db_get_record_by_id($location_type, $record_id); |
| 468 | 472 | // Очищаем второстепенные кэши - потому что вставленная запись могла повлиять на результаты запросов или локация или еще чего |
@@ -483,10 +487,12 @@ discard block |
||
| 483 | 487 | $id_field = $location_info[P_ID]; |
| 484 | 488 | $table_name = $location_info[P_TABLE_NAME]; |
| 485 | 489 | if ($result = static::db_query_delete("DELETE FROM `{{{$table_name}}}` WHERE `{$id_field}` = {$safe_record_id}")) { |
| 486 | - if (static::$db->db_affected_rows()) // Обновляем данные только если ряд был затронут |
|
| 490 | + if (static::$db->db_affected_rows()) { |
|
| 491 | + // Обновляем данные только если ряд был затронут |
|
| 487 | 492 | { |
| 488 | 493 | _SnCacheInternal::cache_unset($location_type, $safe_record_id); |
| 489 | 494 | } |
| 495 | + } |
|
| 490 | 496 | } |
| 491 | 497 | |
| 492 | 498 | return $result; |
@@ -500,11 +506,13 @@ discard block |
||
| 500 | 506 | $table_name = static::$location_info[$location_type][P_TABLE_NAME]; |
| 501 | 507 | |
| 502 | 508 | if ($result = static::db_query_delete("DELETE FROM `{{{$table_name}}}` WHERE {$condition}")) { |
| 503 | - if (static::$db->db_affected_rows()) // Обновляем данные только если ряд был затронут |
|
| 509 | + if (static::$db->db_affected_rows()) { |
|
| 510 | + // Обновляем данные только если ряд был затронут |
|
| 504 | 511 | { |
| 505 | 512 | // Обнуление кэша, потому что непонятно, что поменялось |
| 506 | 513 | _SnCacheInternal::cache_clear($location_type); |
| 507 | 514 | } |
| 515 | + } |
|
| 508 | 516 | } |
| 509 | 517 | |
| 510 | 518 | return $result; |
@@ -12,24 +12,24 @@ discard block |
||
| 12 | 12 | global $debug, $template_result, $user, $lang, $planetrow; |
| 13 | 13 | |
| 14 | 14 | // Напоминание для Администрации, что игра отключена |
| 15 | -if($template_result[F_GAME_DISABLE]) { |
|
| 15 | +if ($template_result[F_GAME_DISABLE]) { |
|
| 16 | 16 | echo '<div class="global_admin_warning">', $template_result[F_GAME_DISABLE_REASON], '</div>'; |
| 17 | 17 | } |
| 18 | 18 | unset($disable_reason); |
| 19 | 19 | |
| 20 | 20 | |
| 21 | -if(defined('IN_ADMIN') && IN_ADMIN === true) { |
|
| 21 | +if (defined('IN_ADMIN') && IN_ADMIN === true) { |
|
| 22 | 22 | lng_include('admin'); |
| 23 | -} elseif($sys_user_logged_in) { |
|
| 23 | +} elseif ($sys_user_logged_in) { |
|
| 24 | 24 | sys_user_vacation($user); |
| 25 | 25 | |
| 26 | 26 | $planet_id = SetSelectedPlanet($user); |
| 27 | 27 | |
| 28 | 28 | // TODO НЕ НУЖНО АЛЬЯНС КАЖДЫЙ РАЗ ОБНОВЛЯТЬ!!! |
| 29 | - if($user['ally_id']) { |
|
| 29 | + if ($user['ally_id']) { |
|
| 30 | 30 | sn_db_transaction_start(); |
| 31 | 31 | \Alliance\Alliance::sn_ali_fill_user_ally($user); |
| 32 | - if(!$user['ally']['player']['id']) { |
|
| 32 | + if (!$user['ally']['player']['id']) { |
|
| 33 | 33 | // sn_sys_logout(false, true); |
| 34 | 34 | // core_auth::logout(false); |
| 35 | 35 | SN::$auth->logout(false); |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | sn_db_transaction_commit(); |
| 49 | 49 | |
| 50 | 50 | $planetrow = $global_data['planet']; |
| 51 | - if(!($planetrow && isset($planetrow['id']) && $planetrow['id'])) { |
|
| 51 | + if (!($planetrow && isset($planetrow['id']) && $planetrow['id'])) { |
|
| 52 | 52 | // sn_sys_logout(false, true); |
| 53 | 53 | // core_auth::logout(false); |
| 54 | 54 | SN::$auth->logout(false); |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | sys_user_options_unpack($user); |
| 64 | 64 | |
| 65 | 65 | global $sn_page_name, $sn_mvc; |
| 66 | -if(!empty($sn_mvc['pages'][INITIAL_PAGE][PAGE_OPTION_EARLY_HEADER])) { |
|
| 66 | +if (!empty($sn_mvc['pages'][INITIAL_PAGE][PAGE_OPTION_EARLY_HEADER])) { |
|
| 67 | 67 | $title = !empty($sn_mvc['pages'][INITIAL_PAGE][PAGE_OPTION_TITLE]) ? $sn_mvc['pages'][INITIAL_PAGE][PAGE_OPTION_TITLE] : ''; |
| 68 | 68 | renderHeader($page, $title, $template_result, false, $user, SN::$config, $lang, $planetrow); |
| 69 | 69 | } |
@@ -21,8 +21,8 @@ |
||
| 21 | 21 | $mode = sys_get_param_escaped('mode'); |
| 22 | 22 | $mode = (!$mode || $mode == 'buildings') ? QUE_STRUCTURES : ($mode == 'fleet' ? SUBQUE_FLEET : ($mode == 'defense' ? SUBQUE_DEFENSE : ($mode == 'research' ? QUE_RESEARCH : $mode))); |
| 23 | 23 | |
| 24 | -if($building_sort = sys_get_param_id('sort_elements')) { |
|
| 25 | - if(!empty($lang['player_option_building_sort'][$building_sort])) { |
|
| 24 | +if ($building_sort = sys_get_param_id('sort_elements')) { |
|
| 25 | + if (!empty($lang['player_option_building_sort'][$building_sort])) { |
|
| 26 | 26 | SN::$user_options[array(PLAYER_OPTION_BUILDING_SORT, $mode)] = $building_sort; |
| 27 | 27 | SN::$user_options[array(PLAYER_OPTION_BUILDING_SORT_INVERSE, $mode)] = sys_get_param_id('sort_elements_inverse', 0); |
| 28 | 28 | } |
@@ -15,34 +15,34 @@ discard block |
||
| 15 | 15 | $template = gettemplate('notes', true); |
| 16 | 16 | |
| 17 | 17 | $result = array(); |
| 18 | -if(($result_message = sys_get_param_str('MESSAGE')) && isset($lang[$result_message])) { |
|
| 18 | +if (($result_message = sys_get_param_str('MESSAGE')) && isset($lang[$result_message])) { |
|
| 19 | 19 | $result[] = array('STATUS' => sys_get_param_int('STATUS'), 'MESSAGE' => $lang[$result_message]); |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | $note_id_edit = sys_get_param_id('note_id_edit'); |
| 23 | -if(sys_get_param('note_delete')) { |
|
| 23 | +if (sys_get_param('note_delete')) { |
|
| 24 | 24 | try { |
| 25 | 25 | $not = ''; |
| 26 | 26 | $query_where = ''; |
| 27 | - switch(sys_get_param_str('note_delete_range')) { |
|
| 27 | + switch (sys_get_param_str('note_delete_range')) { |
|
| 28 | 28 | case 'all': |
| 29 | 29 | break; |
| 30 | 30 | |
| 31 | 31 | case 'marked_not': |
| 32 | 32 | $not = 'NOT'; |
| 33 | 33 | case 'marked': |
| 34 | - if(!is_array($notes_marked = sys_get_param('note'))) { |
|
| 34 | + if (!is_array($notes_marked = sys_get_param('note'))) { |
|
| 35 | 35 | throw new exception('note_err_none_selected', ERR_WARNING); |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | $notes_marked_filtered = array(); |
| 39 | - foreach($notes_marked as $note_id => $note_select) { |
|
| 40 | - if($note_select == 'on' && $note_id = idval($note_id)) { |
|
| 39 | + foreach ($notes_marked as $note_id => $note_select) { |
|
| 40 | + if ($note_select == 'on' && $note_id = idval($note_id)) { |
|
| 41 | 41 | $notes_marked_filtered[] = $note_id; |
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - if(empty($notes_marked_filtered)) { |
|
| 45 | + if (empty($notes_marked_filtered)) { |
|
| 46 | 46 | throw new exception('note_err_none_selected', ERR_WARNING); |
| 47 | 47 | } |
| 48 | 48 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | doquery("DELETE FROM {{notes}} WHERE `owner` = {$user['id']} {$query_where};"); |
| 60 | 60 | sn_db_transaction_commit(); |
| 61 | 61 | throw new exception($note_id_edit ? 'note_err_none_changed' : 'note_err_none_added', ERR_NONE); |
| 62 | - } catch(exception $e) { |
|
| 62 | + } catch (exception $e) { |
|
| 63 | 63 | $note_id_edit = 0; |
| 64 | 64 | sn_db_transaction_rollback(); |
| 65 | 65 | $result[] = array( |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | 'MESSAGE' => $lang[$e->getMessage()], |
| 68 | 68 | ); |
| 69 | 69 | } |
| 70 | -} elseif(($note_title = sys_get_param_str('note_title')) || ($note_text = sys_get_param_str('note_text'))) { |
|
| 70 | +} elseif (($note_title = sys_get_param_str('note_title')) || ($note_text = sys_get_param_str('note_text'))) { |
|
| 71 | 71 | $note_title == db_escape($lang['note_new_title']) ? $note_title = '' : false; |
| 72 | 72 | ($note_text = sys_get_param_str('note_text')) == db_escape($lang['note_new_text']) ? $note_text = '' : false; |
| 73 | 73 | |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | $note_system = max(0, min(sys_get_param_id('note_system'), SN::$config->game_maxSystem)); |
| 77 | 77 | $note_planet = max(0, min(sys_get_param_id('note_planet'), SN::$config->game_maxPlanet + 1)); |
| 78 | 78 | |
| 79 | - if(!$note_text && !$note_title && !$note_galaxy && !$note_system && !$note_planet) { |
|
| 79 | + if (!$note_text && !$note_title && !$note_galaxy && !$note_system && !$note_planet) { |
|
| 80 | 80 | throw new exception('note_err_note_empty', ERR_WARNING); |
| 81 | 81 | } |
| 82 | 82 | |
@@ -85,15 +85,15 @@ discard block |
||
| 85 | 85 | $note_sticky = intval(sys_get_param_id('note_sticky')) ? 1 : 0; |
| 86 | 86 | |
| 87 | 87 | sn_db_transaction_start(); |
| 88 | - if($note_id_edit) { |
|
| 88 | + if ($note_id_edit) { |
|
| 89 | 89 | $check_note_id = doquery("SELECT `id`, `owner` FROM {{notes}} WHERE `id` = {$note_id_edit} LIMIT 1 FOR UPDATE", true); |
| 90 | - if(!$check_note_id) { |
|
| 90 | + if (!$check_note_id) { |
|
| 91 | 91 | throw new exception('note_err_note_not_found', ERR_ERROR); |
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - if($note_id_edit) { |
|
| 96 | - if($check_note_id['owner'] != $user['id']) { |
|
| 95 | + if ($note_id_edit) { |
|
| 96 | + if ($check_note_id['owner'] != $user['id']) { |
|
| 97 | 97 | throw new exception('note_err_owner_wrong', ERR_ERROR); |
| 98 | 98 | } |
| 99 | 99 | |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | sn_db_transaction_commit(); |
| 109 | 109 | sys_redirect('notes.php?STATUS=' . ERR_NONE . '&MESSAGE=' . ($note_id_edit ? 'note_err_none_changed' : 'note_err_none_added')); |
| 110 | 110 | // throw new exception($note_id_edit ? 'note_err_none_changed' : 'note_err_none_added', ERR_NONE); |
| 111 | - } catch(exception $e) { |
|
| 111 | + } catch (exception $e) { |
|
| 112 | 112 | $note_id_edit = 0; |
| 113 | 113 | sn_db_transaction_rollback(); |
| 114 | 114 | $result[] = array( |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | } |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | -if(!$note_id_edit) { |
|
| 121 | +if (!$note_id_edit) { |
|
| 122 | 122 | \Note\Note::note_assign($template, array( |
| 123 | 123 | 'id' => 0, |
| 124 | 124 | 'time' => SN_TIME_NOW, |
@@ -131,13 +131,13 @@ discard block |
||
| 131 | 131 | |
| 132 | 132 | $note_exist = false; |
| 133 | 133 | $notes_query = doquery("SELECT * FROM {{notes}} WHERE owner={$user['id']} ORDER BY priority DESC, galaxy ASC, system ASC, planet ASC, planet_type ASC, `time` DESC"); |
| 134 | -while($note_row = db_fetch($notes_query)) { |
|
| 134 | +while ($note_row = db_fetch($notes_query)) { |
|
| 135 | 135 | \Note\Note::note_assign($template, $note_row); |
| 136 | 136 | $note_exist = $note_exist || $note_row['id'] == $note_id_edit; |
| 137 | 137 | } |
| 138 | 138 | $note_id_edit = $note_exist ? $note_id_edit : 0; |
| 139 | 139 | |
| 140 | -foreach($note_priority_classes as $note_priority_id => $note_priority_class) { |
|
| 140 | +foreach ($note_priority_classes as $note_priority_id => $note_priority_class) { |
|
| 141 | 141 | $template->assign_block_vars('note_priority', array( |
| 142 | 142 | 'ID' => $note_priority_id, |
| 143 | 143 | 'CLASS' => $note_priority_classes[$note_priority_id], |
@@ -145,14 +145,14 @@ discard block |
||
| 145 | 145 | )); |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | -foreach($lang['sys_planet_type'] as $planet_type_id => $planet_type_string) { |
|
| 148 | +foreach ($lang['sys_planet_type'] as $planet_type_id => $planet_type_string) { |
|
| 149 | 149 | $template->assign_block_vars('planet_type', array( |
| 150 | 150 | 'ID' => $planet_type_id, |
| 151 | 151 | 'TEXT' => $planet_type_string, |
| 152 | 152 | )); |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | -foreach($result as $result_data) { |
|
| 155 | +foreach ($result as $result_data) { |
|
| 156 | 156 | $template->assign_block_vars('result', $result_data); |
| 157 | 157 | } |
| 158 | 158 | |
@@ -18,10 +18,10 @@ discard block |
||
| 18 | 18 | function sn_eco_build($que_type, &$auser, &$planet) { |
| 19 | 19 | global $lang, $config, $template_result; |
| 20 | 20 | |
| 21 | - if($ally_id = sys_get_param_id('ally_id')) { |
|
| 21 | + if ($ally_id = sys_get_param_id('ally_id')) { |
|
| 22 | 22 | define('SN_IN_ALLY', true); |
| 23 | 23 | $ranks = \Alliance\Alliance::ally_get_ranks($auser['ally']); |
| 24 | - if($ranks[$auser['ally_rank_id']]['admin'] || $auser['ally']['ally_owner'] == $auser['id']) { |
|
| 24 | + if ($ranks[$auser['ally_rank_id']]['admin'] || $auser['ally']['ally_owner'] == $auser['id']) { |
|
| 25 | 25 | $user = &$auser['ally']['player']; |
| 26 | 26 | $planet = array( |
| 27 | 27 | 'metal' => $user['metal'], |
@@ -31,11 +31,11 @@ discard block |
||
| 31 | 31 | } |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - if(!$user) { |
|
| 34 | + if (!$user) { |
|
| 35 | 35 | $user = &$auser; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - switch($action = sys_get_param_escaped('action')) { |
|
| 38 | + switch ($action = sys_get_param_escaped('action')) { |
|
| 39 | 39 | case 'create': // Add unit to que for build |
| 40 | 40 | case 'create_autoconvert': // Add unit to que for build |
| 41 | 41 | case 'destroy': // Add unit to que for remove |
@@ -52,23 +52,23 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | $group_missile = sn_get_groups('missile'); |
| 54 | 54 | $silo_capacity_free = 0; |
| 55 | - if($que_type == QUE_STRUCTURES) { |
|
| 55 | + if ($que_type == QUE_STRUCTURES) { |
|
| 56 | 56 | $build_unit_list = sn_get_groups('build_allow'); |
| 57 | 57 | $build_unit_list = $build_unit_list[$planet['planet_type']]; |
| 58 | 58 | $artifact_id = ART_NANO_BUILDER; |
| 59 | 59 | $page_header = $lang['tech'][UNIT_STRUCTURES]; |
| 60 | - } elseif($que_type == QUE_RESEARCH) { |
|
| 61 | - if(!mrc_get_level($user, $planet, STRUC_LABORATORY)) { |
|
| 60 | + } elseif ($que_type == QUE_RESEARCH) { |
|
| 61 | + if (!mrc_get_level($user, $planet, STRUC_LABORATORY)) { |
|
| 62 | 62 | messageBox($lang['no_laboratory'], $lang['tech'][UNIT_TECHNOLOGIES]); |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - if(eco_unit_busy($user, $planet, UNIT_TECHNOLOGIES)) { |
|
| 65 | + if (eco_unit_busy($user, $planet, UNIT_TECHNOLOGIES)) { |
|
| 66 | 66 | messageBox($lang['eco_bld_msg_err_laboratory_upgrading'], $lang['tech'][UNIT_TECHNOLOGIES]); |
| 67 | 67 | } |
| 68 | 68 | $build_unit_list = sn_get_groups('tech'); |
| 69 | 69 | $artifact_id = ART_HEURISTIC_CHIP; |
| 70 | 70 | $page_header = $lang['eco_bld_research_page_name'] . ($user['user_as_ally'] ? " {$lang['sys_of_ally']} {$user['username']}" : ''); |
| 71 | - } elseif($que_type == QUE_MERCENARY) { |
|
| 71 | + } elseif ($que_type == QUE_MERCENARY) { |
|
| 72 | 72 | // if(!mrc_get_level($user, $planet, STRUC_LABORATORY)) { |
| 73 | 73 | // messageBox($lang['no_laboratory'], $lang['tech'][UNIT_TECHNOLOGIES]); |
| 74 | 74 | // } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | $artifact_id = 0; |
| 81 | 81 | $page_header = $lang['tech'][UNIT_MERCENARIES] . ($user['user_as_ally'] ? " {$lang['sys_of_ally']} {$user['username']}" : ''); |
| 82 | 82 | } else { |
| 83 | - if(mrc_get_level($user, $planet, STRUC_FACTORY_HANGAR) == 0) { |
|
| 83 | + if (mrc_get_level($user, $planet, STRUC_FACTORY_HANGAR) == 0) { |
|
| 84 | 84 | messageBox($lang['need_hangar'], $lang['tech'][STRUC_FACTORY_HANGAR]); |
| 85 | 85 | } |
| 86 | 86 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | $artifact_id = 0; |
| 90 | 90 | |
| 91 | 91 | $silo_capacity_free = mrc_get_level($user, $planet, STRUC_SILO) * get_unit_param(STRUC_SILO, P_CAPACITY); |
| 92 | - foreach($group_missile as $unit_id) { |
|
| 92 | + foreach ($group_missile as $unit_id) { |
|
| 93 | 93 | $silo_capacity_free -= (mrc_get_level($user, $planet, $unit_id, false, true) + (isset($in_que[$unit_id]) && $in_que[$unit_id] ? $in_que[$unit_id] : 0)) * get_unit_param($unit_id, P_UNIT_SIZE); |
| 94 | 94 | } |
| 95 | 95 | $silo_capacity_free = max(0, $silo_capacity_free); |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | |
| 108 | 108 | $template = gettemplate('buildings_builds', true); |
| 109 | - if(!empty($operation_result)) { |
|
| 109 | + if (!empty($operation_result)) { |
|
| 110 | 110 | $template_result['.']['result'][] = $operation_result; |
| 111 | 111 | } |
| 112 | 112 | |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | |
| 137 | 137 | $record_index = 0; |
| 138 | 138 | |
| 139 | - foreach($build_unit_list as $unit_id) { |
|
| 139 | + foreach ($build_unit_list as $unit_id) { |
|
| 140 | 140 | $level_base = mrc_get_level($user, $planet, $unit_id, false, true); |
| 141 | 141 | $level_effective = mrc_get_level($user, $planet, $unit_id); |
| 142 | 142 | $level_in_que = $in_que[$unit_id]; |
@@ -159,12 +159,12 @@ discard block |
||
| 159 | 159 | $can_build = $unit_info[P_MAX_STACK] ? max(0, $unit_info[P_MAX_STACK] - $level_in_que - $level_effective) : $build_data['CAN'][BUILD_CREATE]; |
| 160 | 160 | // Restricting $can_build by free silo capacity |
| 161 | 161 | $can_build = ($unit_is_missile = in_array($unit_id, $group_missile)) ? min($can_build, floor($silo_capacity_free / $unit_info[P_UNIT_SIZE])) : $can_build; |
| 162 | - if(!$can_build) { |
|
| 163 | - if(!$build_data['CAN'][BUILD_CREATE]) { |
|
| 162 | + if (!$can_build) { |
|
| 163 | + if (!$build_data['CAN'][BUILD_CREATE]) { |
|
| 164 | 164 | $build_data['RESULT'][BUILD_CREATE] = BUILD_NO_RESOURCES; |
| 165 | - } elseif($unit_is_missile && $silo_capacity_free < $unit_info[P_UNIT_SIZE]) { |
|
| 165 | + } elseif ($unit_is_missile && $silo_capacity_free < $unit_info[P_UNIT_SIZE]) { |
|
| 166 | 166 | $build_data['RESULT'][BUILD_CREATE] = BUILD_SILO_FULL; |
| 167 | - } elseif($unit_info[P_MAX_STACK]) { |
|
| 167 | + } elseif ($unit_info[P_MAX_STACK]) { |
|
| 168 | 168 | $build_data['RESULT'][BUILD_CREATE] = BUILD_MAX_REACHED; |
| 169 | 169 | } |
| 170 | 170 | } |
@@ -232,14 +232,14 @@ discard block |
||
| 232 | 232 | 'MAP_IS_RESOURCE' => !empty($unit_info[P_UNIT_PRODUCTION]), |
| 233 | 233 | ); |
| 234 | 234 | |
| 235 | - if($unit_stackable) { |
|
| 235 | + if ($unit_stackable) { |
|
| 236 | 236 | $level_production_base = array( |
| 237 | 237 | 'ACTUAL_SHIELD' => HelperString::numberFloorAndFormat(mrc_modify_value($user, false, array(MRC_ADMIRAL, TECH_SHIELD), $unit_info['shield'])), |
| 238 | 238 | 'ACTUAL_ARMOR' => HelperString::numberFloorAndFormat(mrc_modify_value($user, false, array(MRC_ADMIRAL, TECH_ARMOR), $unit_info['armor'])), |
| 239 | 239 | 'ACTUAL_WEAPON' => HelperString::numberFloorAndFormat(mrc_modify_value($user, false, array(MRC_ADMIRAL, TECH_WEAPON), $unit_info['attack'])), |
| 240 | 240 | ); |
| 241 | 241 | |
| 242 | - if($unit_info[P_UNIT_TYPE] == UNIT_SHIPS) { |
|
| 242 | + if ($unit_info[P_UNIT_TYPE] == UNIT_SHIPS) { |
|
| 243 | 243 | $ship_data = get_ship_data($unit_id, $user); |
| 244 | 244 | |
| 245 | 245 | $level_production_base += array( |
@@ -249,9 +249,9 @@ discard block |
||
| 249 | 249 | ); |
| 250 | 250 | } |
| 251 | 251 | |
| 252 | - if($unit_info[P_UNIT_PRODUCTION]) { |
|
| 253 | - foreach($unit_info[P_UNIT_PRODUCTION] as $resource_id => $resource_calc) { |
|
| 254 | - if($resource_income = |
|
| 252 | + if ($unit_info[P_UNIT_PRODUCTION]) { |
|
| 253 | + foreach ($unit_info[P_UNIT_PRODUCTION] as $resource_id => $resource_calc) { |
|
| 254 | + if ($resource_income = |
|
| 255 | 255 | floor(mrc_modify_value($user, $planet, $sn_modifiers_resource, $resource_calc(1, 10, $user, $planet) |
| 256 | 256 | * ($resource_id == RES_ENERGY ? $config_resource_multiplier_plain : $config_resource_multiplier) |
| 257 | 257 | * (isset($density_info[$resource_id]) ? $density_info[$resource_id] : 1))) |
@@ -261,11 +261,11 @@ discard block |
||
| 261 | 261 | } |
| 262 | 262 | } |
| 263 | 263 | $production['.']['resource'][] = $level_production_base; |
| 264 | - } elseif($unit_info[P_UNIT_PRODUCTION]) { |
|
| 264 | + } elseif ($unit_info[P_UNIT_PRODUCTION]) { |
|
| 265 | 265 | $level_production_base = array(); |
| 266 | 266 | $element_level_start = $level_effective + $in_que[$unit_id]; |
| 267 | - foreach($unit_info[P_UNIT_PRODUCTION] as $resource_id => $resource_calc) { |
|
| 268 | - if($resource_income = |
|
| 267 | + foreach ($unit_info[P_UNIT_PRODUCTION] as $resource_id => $resource_calc) { |
|
| 268 | + if ($resource_income = |
|
| 269 | 269 | floor(mrc_modify_value($user, $planet, $sn_modifiers_resource, $resource_calc($element_level_start, 10, $user, $planet) |
| 270 | 270 | * ($resource_id == RES_ENERGY ? $config_resource_multiplier_plain : $config_resource_multiplier) |
| 271 | 271 | * (isset($density_info[$resource_id]) ? $density_info[$resource_id] : 1))) |
@@ -275,24 +275,24 @@ discard block |
||
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | $level_start = $level_base_and_que > 1 ? $level_effective + $level_in_que - 1 : 1; |
| 278 | - for($i = 0; $i < 6; $i++) { |
|
| 278 | + for ($i = 0; $i < 6; $i++) { |
|
| 279 | 279 | $level_production = array('LEVEL' => $level_start + $i); |
| 280 | - foreach($unit_info[P_UNIT_PRODUCTION] as $resource_id => $resource_calc) { |
|
| 281 | - if( |
|
| 280 | + foreach ($unit_info[P_UNIT_PRODUCTION] as $resource_id => $resource_calc) { |
|
| 281 | + if ( |
|
| 282 | 282 | $resource_income = floor(mrc_modify_value($user, $planet, $sn_modifiers_resource, $resource_calc($level_start + $i, 10, $user, $planet) |
| 283 | 283 | * ($resource_id == RES_ENERGY ? $config_resource_multiplier_plain : $config_resource_multiplier) |
| 284 | 284 | * (isset($density_info[$resource_id]) ? $density_info[$resource_id] : 1))) |
| 285 | 285 | ) { |
| 286 | 286 | $level_production['R' . $resource_id] = $resource_income; |
| 287 | 287 | $level_production['D' . $resource_id] = $resource_income - $level_production_base[$resource_id]; |
| 288 | - if($level_production['D' . $resource_id] == 0) { |
|
| 288 | + if ($level_production['D' . $resource_id] == 0) { |
|
| 289 | 289 | $level_production['D' . $resource_id] = '-'; |
| 290 | 290 | } |
| 291 | 291 | } |
| 292 | 292 | } |
| 293 | 293 | $production['.']['resource'][] = $level_production; |
| 294 | 294 | } |
| 295 | - } elseif($unit_id == TECH_ASTROTECH) { |
|
| 295 | + } elseif ($unit_id == TECH_ASTROTECH) { |
|
| 296 | 296 | $element_level_start = $level_effective + $in_que[$unit_id]; |
| 297 | 297 | $level_production_base = array( |
| 298 | 298 | UNIT_PLAYER_EXPEDITIONS_MAX => get_player_max_expeditons($user, $element_level_start), |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | ); |
| 301 | 301 | |
| 302 | 302 | $level_start = $level_base_and_que > 1 ? $level_effective + $level_in_que - 1 : 1; |
| 303 | - for($i = 0; $i < 6; $i++) { |
|
| 303 | + for ($i = 0; $i < 6; $i++) { |
|
| 304 | 304 | $level_production = array('LEVEL' => $level_start + $i); |
| 305 | 305 | $level_production['R' . UNIT_PLAYER_EXPEDITIONS_MAX] = get_player_max_expeditons($user, $level_start + $i); |
| 306 | 306 | $level_production['D' . UNIT_PLAYER_EXPEDITIONS_MAX] = $level_production['R' . UNIT_PLAYER_EXPEDITIONS_MAX] - $level_production_base[UNIT_PLAYER_EXPEDITIONS_MAX]; |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | $template_result['.']['production'][] = $production; |
| 322 | 322 | } |
| 323 | 323 | |
| 324 | - foreach($lang['player_option_building_sort'] as $sort_id => $sort_text) { |
|
| 324 | + foreach ($lang['player_option_building_sort'] as $sort_id => $sort_text) { |
|
| 325 | 325 | $template->assign_block_vars('sort_values', array( |
| 326 | 326 | 'VALUE' => $sort_id, |
| 327 | 327 | 'TEXT' => $sort_text, |
@@ -330,8 +330,8 @@ discard block |
||
| 330 | 330 | |
| 331 | 331 | $sort_option = SN::$user_options[array(PLAYER_OPTION_BUILDING_SORT, $que_type)]; |
| 332 | 332 | $sort_option_inverse = SN::$user_options[array(PLAYER_OPTION_BUILDING_SORT_INVERSE, $que_type)]; |
| 333 | - if($sort_option || $sort_option_inverse != PLAYER_OPTION_SORT_ORDER_PLAIN) { |
|
| 334 | - switch($sort_option) { |
|
| 333 | + if ($sort_option || $sort_option_inverse != PLAYER_OPTION_SORT_ORDER_PLAIN) { |
|
| 334 | + switch ($sort_option) { |
|
| 335 | 335 | case PLAYER_OPTION_SORT_NAME: |
| 336 | 336 | $sort_option_field = 'NAME'; |
| 337 | 337 | break; |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | break; |
| 347 | 347 | } |
| 348 | 348 | $sort_option_inverse_closure = $sort_option_inverse ? -1 : 1; |
| 349 | - usort($template_result['.']['production'], function ($a, $b) use ($sort_option_field, $sort_option_inverse_closure) { |
|
| 349 | + usort($template_result['.']['production'], function($a, $b) use ($sort_option_field, $sort_option_inverse_closure) { |
|
| 350 | 350 | return $a[$sort_option_field] < $b[$sort_option_field] ? -1 * $sort_option_inverse_closure : ( |
| 351 | 351 | $a[$sort_option_field] > $b[$sort_option_field] ? 1 * $sort_option_inverse_closure : 0 |
| 352 | 352 | ); |
@@ -5,9 +5,9 @@ discard block |
||
| 5 | 5 | // @version 1.0 |
| 6 | 6 | // @copyright 2008 by Chlorel for XNova |
| 7 | 7 | |
| 8 | -if($fleet_ship_sort = sys_get_param_id('sort_elements')) { |
|
| 8 | +if ($fleet_ship_sort = sys_get_param_id('sort_elements')) { |
|
| 9 | 9 | define('IN_AJAX', true); |
| 10 | - if(!empty($lang['player_option_fleet_ship_sort'][$fleet_ship_sort])) { |
|
| 10 | + if (!empty($lang['player_option_fleet_ship_sort'][$fleet_ship_sort])) { |
|
| 11 | 11 | // player_save_option($user, PLAYER_OPTION_FLEET_SHIP_SORT, $fleet_ship_sort); |
| 12 | 12 | // player_save_option($user, PLAYER_OPTION_FLEET_SHIP_SORT_INVERSE, sys_get_param_id('fleet_ship_sort_inverse', 0)); |
| 13 | 13 | SN::$user_options[PLAYER_OPTION_FLEET_SHIP_SORT] = $fleet_ship_sort; |
@@ -16,13 +16,13 @@ discard block |
||
| 16 | 16 | die(); |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | -if(SN_IN_FLEET !== true) { |
|
| 19 | +if (SN_IN_FLEET !== true) { |
|
| 20 | 20 | $debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403); |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | lng_include('overview'); |
| 24 | 24 | |
| 25 | -if(!$planetrow) { |
|
| 25 | +if (!$planetrow) { |
|
| 26 | 26 | messageBox($lang['fl_noplanetrow'], $lang['fl_error']); |
| 27 | 27 | } |
| 28 | 28 | |
@@ -30,9 +30,9 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | $record_index = 0; |
| 32 | 32 | $ship_list = array(); |
| 33 | -foreach(sn_get_groups('fleet') as $n => $unit_id) { |
|
| 33 | +foreach (sn_get_groups('fleet') as $n => $unit_id) { |
|
| 34 | 34 | $unit_level = mrc_get_level($user, $planetrow, $unit_id, false, true); |
| 35 | - if($unit_level > 0) { |
|
| 35 | + if ($unit_level > 0) { |
|
| 36 | 36 | $ship_data = get_ship_data($unit_id, $user); |
| 37 | 37 | $ship_list[$unit_id] = array( |
| 38 | 38 | '__INDEX' => $record_index++, |
@@ -52,8 +52,8 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | $fleet_ship_sort = SN::$user_options[PLAYER_OPTION_FLEET_SHIP_SORT]; |
| 54 | 54 | $fleet_ship_sort_inverse = SN::$user_options[PLAYER_OPTION_FLEET_SHIP_SORT_INVERSE]; |
| 55 | -if($fleet_ship_sort || $fleet_ship_sort_inverse != PLAYER_OPTION_SORT_ORDER_PLAIN) { |
|
| 56 | - switch($fleet_ship_sort) { |
|
| 55 | +if ($fleet_ship_sort || $fleet_ship_sort_inverse != PLAYER_OPTION_SORT_ORDER_PLAIN) { |
|
| 56 | + switch ($fleet_ship_sort) { |
|
| 57 | 57 | case PLAYER_OPTION_SORT_NAME: $fleet_ship_sort_field = 'NAME'; break; |
| 58 | 58 | case PLAYER_OPTION_SORT_SPEED: $fleet_ship_sort_field = 'SPEED'; break; |
| 59 | 59 | case PLAYER_OPTION_SORT_COUNT: $fleet_ship_sort_field = 'AMOUNT'; break; |
@@ -68,11 +68,11 @@ discard block |
||
| 68 | 68 | }); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | -foreach($ship_list as $ship_data) { |
|
| 71 | +foreach ($ship_list as $ship_data) { |
|
| 72 | 72 | $template->assign_block_vars('ships', $ship_data); |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | -foreach($lang['player_option_fleet_ship_sort'] as $sort_id => $sort_text) { |
|
| 75 | +foreach ($lang['player_option_fleet_ship_sort'] as $sort_id => $sort_text) { |
|
| 76 | 76 | $template->assign_block_vars('ship_sort_list', array( |
| 77 | 77 | 'VALUE' => $sort_id, |
| 78 | 78 | 'TEXT' => $sort_text, |
@@ -2,12 +2,12 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
| 4 | 4 | |
| 5 | -if($user['authlevel'] < AUTH_LEVEL_DEVELOPER) { |
|
| 5 | +if ($user['authlevel'] < AUTH_LEVEL_DEVELOPER) { |
|
| 6 | 6 | $error_message = SN::$config->game_mode == GAME_BLITZ ? 'sys_blitz_page_disabled' : ( |
| 7 | 7 | !SN::$config->game_blitz_register ? 'sys_blitz_registration_disabled' : '' |
| 8 | 8 | ); |
| 9 | 9 | |
| 10 | - if($error_message) { |
|
| 10 | + if ($error_message) { |
|
| 11 | 11 | messageBox($lang[$error_message], $lang['sys_error'], 'overview.php', 10); |
| 12 | 12 | die(); |
| 13 | 13 | } |
@@ -17,12 +17,12 @@ discard block |
||
| 17 | 17 | $current_round = intval(SN::$config->db_loadItem('game_blitz_register_round')); |
| 18 | 18 | $current_price = intval(SN::$config->db_loadItem('game_blitz_register_price')); |
| 19 | 19 | |
| 20 | -if(SN::$config->db_loadItem('game_blitz_register') == BLITZ_REGISTER_OPEN && (sys_get_param_str('register_me') || sys_get_param_str('register_me_not'))) { |
|
| 20 | +if (SN::$config->db_loadItem('game_blitz_register') == BLITZ_REGISTER_OPEN && (sys_get_param_str('register_me') || sys_get_param_str('register_me_not'))) { |
|
| 21 | 21 | sn_db_transaction_start(); |
| 22 | 22 | $user = db_user_by_id($user['id'], true); |
| 23 | 23 | $is_registered = doquery("SELECT `id` FROM {{blitz_registrations}} WHERE `user_id` = {$user['id']} AND `round_number` = {$current_round} FOR UPDATE;", true); |
| 24 | - if(sys_get_param_str('register_me')) { |
|
| 25 | - if(empty($is_registered) && mrc_get_level($user, null, RES_METAMATTER) >= $current_price) { |
|
| 24 | + if (sys_get_param_str('register_me')) { |
|
| 25 | + if (empty($is_registered) && mrc_get_level($user, null, RES_METAMATTER) >= $current_price) { |
|
| 26 | 26 | doquery("INSERT IGNORE INTO {{blitz_registrations}} SET `user_id` = {$user['id']}, `round_number` = {$current_round};"); |
| 27 | 27 | //mm_points_change($user['id'], RPG_BLITZ_REGISTRATION, -$current_price, "Регистрация в раунде {$current_round} Блица"); |
| 28 | 28 | SN::$auth->account->metamatter_change(RPG_BLITZ_REGISTRATION, -$current_price, "Регистрация в раунде {$current_round} Блица"); |
@@ -43,17 +43,17 @@ discard block |
||
| 43 | 43 | $blitz_players = 0; |
| 44 | 44 | $blitz_prize_dark_matter = 0; |
| 45 | 45 | $blitz_prize_places = 0; |
| 46 | -if($user['authlevel'] >= AUTH_LEVEL_DEVELOPER) { |
|
| 47 | - if(sys_get_param_str('generate')) { |
|
| 46 | +if ($user['authlevel'] >= AUTH_LEVEL_DEVELOPER) { |
|
| 47 | + if (sys_get_param_str('generate')) { |
|
| 48 | 48 | $next_id = 0; |
| 49 | 49 | $query = doquery("SELECT `id` FROM {{blitz_registrations}} WHERE `round_number` = {$current_round} ORDER BY RAND();"); |
| 50 | - while($row = db_fetch($query)) { |
|
| 50 | + while ($row = db_fetch($query)) { |
|
| 51 | 51 | $next_id++; |
| 52 | 52 | $blitz_name = 'Игрок' . $next_id; |
| 53 | 53 | $blitz_password = sys_random_string(8); |
| 54 | 54 | doquery("UPDATE {{blitz_registrations}} SET blitz_name = '{$blitz_name}', blitz_password = '{$blitz_password}' WHERE `id` = {$row['id']} AND `round_number` = {$current_round};"); |
| 55 | 55 | } |
| 56 | - } elseif(sys_get_param_str('import_generated')) { |
|
| 56 | + } elseif (sys_get_param_str('import_generated')) { |
|
| 57 | 57 | // ЭТО НА БЛИЦЕ!!! |
| 58 | 58 | doquery("DELETE FROM {{users}} WHERE username like 'Игрок%';"); |
| 59 | 59 | doquery("DELETE FROM {{planets}} WHERE id_owner not in (SELECT `id` FROM {{users}});"); |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | $system = $system_step; |
| 76 | 76 | $planet = round(SN::$config->game_maxPlanet / 2); |
| 77 | 77 | |
| 78 | - foreach($imported_string as &$string_data) { |
|
| 78 | + foreach ($imported_string as &$string_data) { |
|
| 79 | 79 | $string_data = explode(',', $string_data); |
| 80 | 80 | $username_safe = $string_data[0]; |
| 81 | 81 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | $moon_row = uni_create_moon($galaxy, $system, $planet, $user_new['id'], Universe::MOON_MAX_SIZE, false); |
| 91 | 91 | |
| 92 | - if(($system += $system_step) >= SN::$config->game_maxSystem) { |
|
| 92 | + if (($system += $system_step) >= SN::$config->game_maxSystem) { |
|
| 93 | 93 | $galaxy++; |
| 94 | 94 | $system = $system_step; |
| 95 | 95 | } |
@@ -98,13 +98,13 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | SN::$config->db_saveItem('users_amount', SN::$config->users_amount + $new_players); |
| 100 | 100 | // generated_string |
| 101 | - } elseif(sys_get_param_str('import_result') && ($blitz_result_string = sys_get_param_str('blitz_result_string'))) { |
|
| 101 | + } elseif (sys_get_param_str('import_result') && ($blitz_result_string = sys_get_param_str('blitz_result_string'))) { |
|
| 102 | 102 | $blitz_result = explode(';', $blitz_result_string); |
| 103 | 103 | $blitz_last_update = $blitz_result[0]; // Пока не используется |
| 104 | 104 | unset($blitz_result[0]); |
| 105 | - foreach($blitz_result as $blitz_result_data) { |
|
| 105 | + foreach ($blitz_result as $blitz_result_data) { |
|
| 106 | 106 | $blitz_result_data = explode(',', $blitz_result_data); |
| 107 | - if(count($blitz_result_data) == 5) { |
|
| 107 | + if (count($blitz_result_data) == 5) { |
|
| 108 | 108 | $blitz_result_data[1] = db_escape($blitz_result_data[1]); |
| 109 | 109 | doquery( |
| 110 | 110 | "UPDATE `{{blitz_registrations}}` SET |
@@ -118,15 +118,15 @@ discard block |
||
| 118 | 118 | $blitz_result = array(); |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - if(SN::$config->game_mode == GAME_BLITZ) { |
|
| 121 | + if (SN::$config->game_mode == GAME_BLITZ) { |
|
| 122 | 122 | $blitz_result = array(SN::$config->db_loadItem('var_stat_update')); |
| 123 | 123 | $query = doquery("SELECT id, username, total_rank, total_points, onlinetime FROM {{users}} ORDER BY `id`;"); |
| 124 | - while($row = db_fetch($query)) { |
|
| 124 | + while ($row = db_fetch($query)) { |
|
| 125 | 125 | $blitz_result[] = "{$row['id']},{$row['username']},{$row['onlinetime']},{$row['total_rank']},{$row['total_points']}"; |
| 126 | 126 | } |
| 127 | 127 | } else { |
| 128 | 128 | $query = doquery("SELECT blitz_name, blitz_password, blitz_online FROM {{blitz_registrations}} WHERE `round_number` = {$current_round} ORDER BY `id`;"); |
| 129 | - while($row = db_fetch($query)) { |
|
| 129 | + while ($row = db_fetch($query)) { |
|
| 130 | 130 | $blitz_generated[] = "{$row['blitz_name']},{$row['blitz_password']}"; |
| 131 | 131 | $row['blitz_online'] ? $blitz_prize_players_active++ : false; |
| 132 | 132 | $blitz_players++; |
@@ -141,13 +141,13 @@ discard block |
||
| 141 | 141 | 'Игрок40' |
| 142 | 142 | */ |
| 143 | 143 | |
| 144 | - if(sys_get_param_str('prize_calculate') && $blitz_prize_players_active && ($blitz_prize_dark_matter_actual = sys_get_param_int('blitz_prize_dark_matter'))) { |
|
| 144 | + if (sys_get_param_str('prize_calculate') && $blitz_prize_players_active && ($blitz_prize_dark_matter_actual = sys_get_param_int('blitz_prize_dark_matter'))) { |
|
| 145 | 145 | // $blitz_prize_dark_matter_actual = sys_get_param_int('blitz_prize_dark_matter'); |
| 146 | 146 | $blitz_prize_places_actual = sys_get_param_int('blitz_prize_places'); |
| 147 | 147 | sn_db_transaction_start(); |
| 148 | 148 | $query = doquery("SELECT * FROM {{blitz_registrations}} WHERE `round_number` = {$current_round} ORDER BY `blitz_place` FOR UPDATE;"); |
| 149 | - while($row = db_fetch($query)) { |
|
| 150 | - if(!$row['blitz_place']) { |
|
| 149 | + while ($row = db_fetch($query)) { |
|
| 150 | + if (!$row['blitz_place']) { |
|
| 151 | 151 | continue; |
| 152 | 152 | } |
| 153 | 153 | |
@@ -155,15 +155,15 @@ discard block |
||
| 155 | 155 | $blitz_prize_places_actual--; |
| 156 | 156 | |
| 157 | 157 | $reward = $blitz_prize_dark_matter_actual - $row['blitz_reward_dark_matter']; |
| 158 | -pdump("{{$row['id']}} {$row['blitz_name']}, Place {$row['blitz_place']}, Prize places {$blitz_prize_places_actual}, Prize {$reward}",$row['id']); |
|
| 159 | - if($reward) { |
|
| 158 | +pdump("{{$row['id']}} {$row['blitz_name']}, Place {$row['blitz_place']}, Prize places {$blitz_prize_places_actual}, Prize {$reward}", $row['id']); |
|
| 159 | + if ($reward) { |
|
| 160 | 160 | rpg_points_change($row['user_id'], RPG_BLITZ, $reward, sprintf( |
| 161 | 161 | $lang['sys_blitz_reward_log_message'], $row['blitz_place'], $row['blitz_name'] |
| 162 | 162 | )); |
| 163 | 163 | doquery("UPDATE {{blitz_registrations}} SET blitz_reward_dark_matter = blitz_reward_dark_matter + ($reward) WHERE id = {$row['id']} AND `round_number` = {$current_round};"); |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - if(!$blitz_prize_places_actual || $blitz_prize_dark_matter_actual < 1000) { |
|
| 166 | + if (!$blitz_prize_places_actual || $blitz_prize_dark_matter_actual < 1000) { |
|
| 167 | 167 | break; |
| 168 | 168 | } |
| 169 | 169 | } |
@@ -183,12 +183,12 @@ discard block |
||
| 183 | 183 | JOIN {{users}} AS u ON u.id = br.user_id |
| 184 | 184 | WHERE br.`round_number` = {$current_round} |
| 185 | 185 | order by `blitz_place`, `timestamp`;"); |
| 186 | -while($row = db_fetch($query)) { |
|
| 186 | +while ($row = db_fetch($query)) { |
|
| 187 | 187 | $tpl_player_data = array( |
| 188 | 188 | 'NAME' => player_nick_render_to_html($row, array('icons' => true, 'color' => true, 'ally' => true)), |
| 189 | 189 | ); |
| 190 | 190 | |
| 191 | - if(SN::$config->game_blitz_register == BLITZ_REGISTER_DISCLOSURE_NAMES) { |
|
| 191 | + if (SN::$config->game_blitz_register == BLITZ_REGISTER_DISCLOSURE_NAMES) { |
|
| 192 | 192 | // Вот так хитро, что бы не было не единого шанса попадания на страницу данных об игроках Блиц-сервера до закрытия раунда |
| 193 | 193 | $tpl_player_data = array_merge($tpl_player_data, array( |
| 194 | 194 | 'ID' => $row['id'], |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | $template->assign_block_vars('registrations', $tpl_player_data); |
| 204 | - if($row['id'] == $user['id']) { |
|
| 204 | + if ($row['id'] == $user['id']) { |
|
| 205 | 205 | $player_registered = $row; |
| 206 | 206 | } |
| 207 | 207 | } |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | unset($player_options[PLAYER_OPTION_TUTORIAL_CURRENT]); |
| 402 | 402 | } |
| 403 | 403 | |
| 404 | - array_walk($player_options, function (&$value) { |
|
| 404 | + array_walk($player_options, function(&$value) { |
|
| 405 | 405 | // TODO - Когда будет больше параметров - сделать больше проверок |
| 406 | 406 | $value = intval($value); |
| 407 | 407 | }); |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | $user['id'], |
| 451 | 451 | RPG_NAME_CHANGE, |
| 452 | 452 | -$config->game_user_changename_cost, |
| 453 | - vsprintf('Пользователь ID %1$d сменил имя с "%2$s" на "%3$s"', [$user['id'], $user['username'], $username,]) |
|
| 453 | + vsprintf('Пользователь ID %1$d сменил имя с "%2$s" на "%3$s"', [$user['id'], $user['username'], $username, ]) |
|
| 454 | 454 | ); |
| 455 | 455 | |
| 456 | 456 | case SERVER_PLAYER_NAME_CHANGE_FREE: |