@@ -1,14 +1,12 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | // ---------------------------------------------------------------------------------------------------------------- |
| 4 | -function lng_try_filepath($path, $file_path_relative) |
|
| 5 | -{ |
|
| 4 | +function lng_try_filepath($path, $file_path_relative) { |
|
| 6 | 5 | $file_path = SN_ROOT_PHYSICAL . ($path && file_exists(SN_ROOT_PHYSICAL . $path . $file_path_relative) ? $path : '') . $file_path_relative; |
| 7 | 6 | return file_exists($file_path) ? $file_path : false; |
| 8 | 7 | } |
| 9 | 8 | |
| 10 | -function lng_die_not_an_object() |
|
| 11 | -{ |
|
| 9 | +function lng_die_not_an_object() { |
|
| 12 | 10 | print('Ошибка - $lang не объект! Сообщите Администратору сервера и приложите содержимое страницы'); |
| 13 | 11 | $trace = debug_backtrace(); |
| 14 | 12 | unset($trace[0]); |
@@ -17,32 +15,27 @@ discard block |
||
| 17 | 15 | } |
| 18 | 16 | |
| 19 | 17 | // ---------------------------------------------------------------------------------------------------------------- |
| 20 | -function lng_include($filename, $path = '', $ext = '.mo.php') |
|
| 21 | -{ |
|
| 18 | +function lng_include($filename, $path = '', $ext = '.mo.php') { |
|
| 22 | 19 | global $lang; |
| 23 | 20 | return is_object($lang) ? $lang->lng_include($filename, $path, $ext) : lng_die_not_an_object(); |
| 24 | 21 | } |
| 25 | 22 | |
| 26 | -function lng_get_list() |
|
| 27 | -{ |
|
| 23 | +function lng_get_list() { |
|
| 28 | 24 | global $lang; |
| 29 | 25 | return is_object($lang) ? $lang->lng_get_list() : lng_die_not_an_object(); |
| 30 | 26 | } |
| 31 | 27 | |
| 32 | -function lng_get_info($entry) |
|
| 33 | -{ |
|
| 28 | +function lng_get_info($entry) { |
|
| 34 | 29 | global $lang; |
| 35 | 30 | return is_object($lang) ? $lang->lng_get_info($entry) : lng_die_not_an_object(); |
| 36 | 31 | } |
| 37 | 32 | |
| 38 | -function lng_switch($language_new) |
|
| 39 | -{ |
|
| 33 | +function lng_switch($language_new) { |
|
| 40 | 34 | global $lang; |
| 41 | 35 | return is_object($lang) ? $lang->lng_switch($language_new) : lng_die_not_an_object(); |
| 42 | 36 | } |
| 43 | 37 | |
| 44 | -function lng_load_i18n($i18n) |
|
| 45 | -{ |
|
| 38 | +function lng_load_i18n($i18n) { |
|
| 46 | 39 | global $lang; |
| 47 | 40 | return is_object($lang) ? $lang->lng_load_i18n($i18n) : lng_die_not_an_object(); |
| 48 | 41 | } |
@@ -11,8 +11,7 @@ discard block |
||
| 11 | 11 | * @version 1.0 copyright 2008 By e-Zobar for XNova |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | -function int_banner_create($id, $type = 'userbar', $format = 'png') |
|
| 15 | -{ |
|
| 14 | +function int_banner_create($id, $type = 'userbar', $format = 'png') { |
|
| 16 | 15 | // banner.php?id=<userid>&type=<banner|userbar>&format=<png> |
| 17 | 16 | global $config, $lang; |
| 18 | 17 | |
@@ -64,8 +63,7 @@ discard block |
||
| 64 | 63 | $b_planet = $planet_row['name']; |
| 65 | 64 | $b_xyz = "[".$planet_row['galaxy'].":".$planet_row['system'].":".$planet_row['planet']."]"; |
| 66 | 65 | $b_lvl = ($user['total_rank'] ? $user['total_rank'] : $config->users_amount) ."/{$config->users_amount}"; |
| 67 | - } |
|
| 68 | - else |
|
| 66 | + } else |
|
| 69 | 67 | { |
| 70 | 68 | $b_user = $lang['ov_banner_empty_id']; |
| 71 | 69 | } |
@@ -1,7 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -function eco_lab_sort_effectivness($a, $b) |
|
| 4 | -{ |
|
| 3 | +function eco_lab_sort_effectivness($a, $b) { |
|
| 5 | 4 | return $a['laboratory_effective_level'] > $b['laboratory_effective_level'] ? -1 : ($a['laboratory_effective_level'] < $b['laboratory_effective_level'] ? 1 : 0); |
| 6 | 5 | } |
| 7 | 6 | |
@@ -11,8 +10,7 @@ discard block |
||
| 11 | 10 | * 1.0 - copyright (c) 2010 by Gorlum for http://supernova.ws |
| 12 | 11 | * @version 1.0 |
| 13 | 12 | */ |
| 14 | -function eco_get_lab_max_effective_level(&$user, $lab_require) |
|
| 15 | -{ |
|
| 13 | +function eco_get_lab_max_effective_level(&$user, $lab_require) { |
|
| 16 | 14 | if(!$user['user_as_ally'] && !isset($user['laboratories_active'])) |
| 17 | 15 | { |
| 18 | 16 | $user['laboratories_active'] = array(); |
@@ -38,8 +36,7 @@ discard block |
||
| 38 | 36 | if($user['user_as_ally']) |
| 39 | 37 | { |
| 40 | 38 | $lab_level = doquery("SELECT ally_members AS effective_level FROM {{alliance}} WHERE id = {$user['user_as_ally']} LIMIT 1", true); |
| 41 | - } |
|
| 42 | - else |
|
| 39 | + } else |
|
| 43 | 40 | { |
| 44 | 41 | $tech_intergalactic = mrc_get_level($user, false, TECH_RESEARCH) + 1; |
| 45 | 42 | $lab_level['effective_level'] = 0; |
@@ -193,8 +190,7 @@ discard block |
||
| 193 | 190 | return $result; |
| 194 | 191 | } |
| 195 | 192 | |
| 196 | -function eco_is_builds_in_que($planet_que, $unit_list) |
|
| 197 | -{ |
|
| 193 | +function eco_is_builds_in_que($planet_que, $unit_list) { |
|
| 198 | 194 | $eco_is_builds_in_que = false; |
| 199 | 195 | |
| 200 | 196 | $unit_list = is_array($unit_list) ? $unit_list : array($unit_list => $unit_list); |
@@ -216,8 +212,7 @@ discard block |
||
| 216 | 212 | } |
| 217 | 213 | |
| 218 | 214 | function eco_unit_busy(&$user, &$planet, $unit_id){return sn_function_call('eco_unit_busy', array(&$user, &$planet, $unit_id, &$result));} |
| 219 | -function sn_eco_unit_busy(&$user, &$planet, $unit_id, &$result) |
|
| 220 | -{ |
|
| 215 | +function sn_eco_unit_busy(&$user, &$planet, $unit_id, &$result) { |
|
| 221 | 216 | global $config; |
| 222 | 217 | |
| 223 | 218 | $result = isset($result) ? $result : false; |
@@ -238,8 +233,7 @@ discard block |
||
| 238 | 233 | //{ |
| 239 | 234 | // $result = true; |
| 240 | 235 | //} |
| 241 | - } |
|
| 242 | - elseif(($unit_id == UNIT_TECHNOLOGIES || in_array($unit_id, sn_get_groups('tech'))) && !$config->BuildLabWhileRun && $planet['que']) |
|
| 236 | + } elseif(($unit_id == UNIT_TECHNOLOGIES || in_array($unit_id, sn_get_groups('tech'))) && !$config->BuildLabWhileRun && $planet['que']) |
|
| 243 | 237 | { |
| 244 | 238 | $result = eco_is_builds_in_que($planet['que'], array(STRUC_LABORATORY, STRUC_LABORATORY_NANO)); |
| 245 | 239 | } |
@@ -15,8 +15,7 @@ discard block |
||
| 15 | 15 | 1.5 - copyright (c) 2010-2011 by Gorlum for http://supernova.ws |
| 16 | 16 | [+] SuperMassMailing - authlevel=3 player can send messages to whole server ('*' as $owners) |
| 17 | 17 | */ |
| 18 | -function msg_ali_send($message, $subject, $ally_rank_id = 0, $ally_id = 0) |
|
| 19 | -{ |
|
| 18 | +function msg_ali_send($message, $subject, $ally_rank_id = 0, $ally_id = 0) { |
|
| 20 | 19 | global $user; |
| 21 | 20 | |
| 22 | 21 | $ally_id = $ally_id ? $ally_id : $user['ally_id']; |
@@ -37,8 +36,7 @@ discard block |
||
| 37 | 36 | return $list; |
| 38 | 37 | } |
| 39 | 38 | |
| 40 | -function msg_send_simple_message($owners, $sender, $timestamp, $message_type, $from, $subject, $text, $escaped = false, $force = false) |
|
| 41 | -{ |
|
| 39 | +function msg_send_simple_message($owners, $sender, $timestamp, $message_type, $from, $subject, $text, $escaped = false, $force = false) { |
|
| 42 | 40 | global $config, $user, $sn_message_class_list; |
| 43 | 41 | |
| 44 | 42 | if(!$owners) |
@@ -79,8 +77,7 @@ discard block |
||
| 79 | 77 | // TODO Добавить $sender - рассылка может быть и от кого-то |
| 80 | 78 | db_message_insert_all($message_type, $from, $subject, $text); |
| 81 | 79 | $owners = array(); |
| 82 | - } |
|
| 83 | - else |
|
| 80 | + } else |
|
| 84 | 81 | { |
| 85 | 82 | $insert_values = array(); |
| 86 | 83 | $insert_template = "('%u'," . str_replace('%', '%%', " '{$sender}', '{$timestamp}', '{$message_type}', '{$from}', '{$subject}', '{$text}')"); |
@@ -90,8 +87,7 @@ discard block |
||
| 90 | 87 | if($user['id'] != $owner) |
| 91 | 88 | { |
| 92 | 89 | $owner_row = db_user_by_id($owner); |
| 93 | - } |
|
| 94 | - else |
|
| 90 | + } else |
|
| 95 | 91 | { |
| 96 | 92 | $owner_row = $user; |
| 97 | 93 | } |
@@ -2,8 +2,7 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | // ------------------------------------------------------------------------------------------------ |
| 4 | 4 | // Записывает боевой отчет в БД |
| 5 | -function sn_ube_report_save(&$combat_data) |
|
| 6 | -{ |
|
| 5 | +function sn_ube_report_save(&$combat_data) { |
|
| 7 | 6 | global $config; |
| 8 | 7 | |
| 9 | 8 | // Если уже есть ИД репорта - значит репорт был взят из таблицы. С таким мы не работаем |
@@ -281,8 +280,7 @@ discard block |
||
| 281 | 280 | |
| 282 | 281 | // ------------------------------------------------------------------------------------------------ |
| 283 | 282 | // Читает боевой отчет из БД |
| 284 | -function sn_ube_report_load($report_cypher) |
|
| 285 | -{ |
|
| 283 | +function sn_ube_report_load($report_cypher) { |
|
| 286 | 284 | $report_cypher = db_escape($report_cypher); |
| 287 | 285 | |
| 288 | 286 | $report_row = doquery("SELECT * FROM {{ube_report}} WHERE ube_report_cypher = '{$report_cypher}' LIMIT 1", true); |
@@ -480,8 +478,7 @@ discard block |
||
| 480 | 478 | |
| 481 | 479 | // ------------------------------------------------------------------------------------------------ |
| 482 | 480 | // Парсит инфу о раунде для темплейта |
| 483 | -function sn_ube_report_round_fleet(&$combat_data, $round) |
|
| 484 | -{ |
|
| 481 | +function sn_ube_report_round_fleet(&$combat_data, $round) { |
|
| 485 | 482 | global $lang; |
| 486 | 483 | |
| 487 | 484 | $fleets_info = &$combat_data[UBE_FLEETS]; |
@@ -535,8 +532,7 @@ discard block |
||
| 535 | 532 | |
| 536 | 533 | // ------------------------------------------------------------------------------------------------ |
| 537 | 534 | // Рендерит таблицу общего результата боя |
| 538 | -function sn_ube_report_table_render(&$array, $header) |
|
| 539 | -{ |
|
| 535 | +function sn_ube_report_table_render(&$array, $header) { |
|
| 540 | 536 | global $lang; |
| 541 | 537 | |
| 542 | 538 | $result = array(); |
@@ -563,8 +559,7 @@ discard block |
||
| 563 | 559 | |
| 564 | 560 | // ------------------------------------------------------------------------------------------------ |
| 565 | 561 | // Генерирует данные для отчета из разобранных данных боя |
| 566 | -function sn_ube_report_generate(&$combat_data, &$template_result) |
|
| 567 | -{ |
|
| 562 | +function sn_ube_report_generate(&$combat_data, &$template_result) { |
|
| 568 | 563 | if(!is_array($combat_data)) |
| 569 | 564 | { |
| 570 | 565 | return; |
@@ -1,7 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -function flt_mission_hold(&$mission_data) |
|
| 4 | -{ |
|
| 3 | +function flt_mission_hold(&$mission_data) { |
|
| 5 | 4 | if($mission_data['fleet']['fleet_end_stay'] < SN_TIME_NOW) |
| 6 | 5 | { |
| 7 | 6 | fleet_send_back($mission_data['fleet']); |
@@ -10,8 +10,7 @@ discard block |
||
| 10 | 10 | * @copyright 2008 |
| 11 | 11 | */ |
| 12 | 12 | // ---------------------------------------------------------------------------------------------------------------- |
| 13 | -function coe_compress_add_units($unit_group, $target_planet, &$compress_data, $target_user = array()) |
|
| 14 | -{ |
|
| 13 | +function coe_compress_add_units($unit_group, $target_planet, &$compress_data, $target_user = array()) { |
|
| 15 | 14 | foreach($unit_group as $unit_id) |
| 16 | 15 | { |
| 17 | 16 | if(($unit_count = mrc_get_level($target_user, $target_planet, $unit_id, false, true)) > 0) |
@@ -29,8 +28,7 @@ discard block |
||
| 29 | 28 | } |
| 30 | 29 | } |
| 31 | 30 | |
| 32 | -function flt_spy_scan($target_planet, $group_name, $section_title, $target_user = array()) |
|
| 33 | -{ |
|
| 31 | +function flt_spy_scan($target_planet, $group_name, $section_title, $target_user = array()) { |
|
| 34 | 32 | global $lang; |
| 35 | 33 | |
| 36 | 34 | $result = "<tr><td class=\"c\" colspan=\"4\">{$section_title}</td></tr>"; |
@@ -53,8 +51,7 @@ discard block |
||
| 53 | 51 | return $result; |
| 54 | 52 | } |
| 55 | 53 | |
| 56 | -function flt_mission_spy(&$mission_data) |
|
| 57 | -{ |
|
| 54 | +function flt_mission_spy(&$mission_data) { |
|
| 58 | 55 | global $lang; |
| 59 | 56 | |
| 60 | 57 | $fleet_row = &$mission_data['fleet']; |
@@ -132,8 +129,7 @@ discard block |
||
| 132 | 129 | { |
| 133 | 130 | $spy_outcome_str = sprintf($lang['sys_mess_spy_detect_chance'], $spy_detected); |
| 134 | 131 | $spy_detected = false; |
| 135 | - } |
|
| 136 | - else |
|
| 132 | + } else |
|
| 137 | 133 | { |
| 138 | 134 | $spy_outcome_str = $lang['sys_mess_spy_destroyed']; |
| 139 | 135 | $spy_detected = true; |
@@ -168,8 +164,7 @@ discard block |
||
| 168 | 164 | $target_message .= "<br />{$lang['sys_mess_spy_destroyed_enemy']}"; |
| 169 | 165 | |
| 170 | 166 | $result = CACHE_FLEET | CACHE_PLANET_DST; |
| 171 | - } |
|
| 172 | - else |
|
| 167 | + } else |
|
| 173 | 168 | { |
| 174 | 169 | $result = CACHE_FLEET; |
| 175 | 170 | } |
@@ -7,8 +7,7 @@ discard block |
||
| 7 | 7 | * @copyright 2008 By Chlorel for XNova |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -function flt_mission_recycle(&$mission_data) |
|
| 11 | -{ |
|
| 10 | +function flt_mission_recycle(&$mission_data) { |
|
| 12 | 11 | $fleet_row = &$mission_data['fleet']; |
| 13 | 12 | $destination_planet = &$mission_data['dst_planet']; |
| 14 | 13 | |
@@ -37,8 +36,7 @@ discard block |
||
| 37 | 36 | if(in_array($unit_id, sn_get_groups('flt_recyclers'))) |
| 38 | 37 | { |
| 39 | 38 | $RecyclerCapacity += $capacity; |
| 40 | - } |
|
| 41 | - else |
|
| 39 | + } else |
|
| 42 | 40 | { |
| 43 | 41 | $OtherFleetCapacity += $capacity; |
| 44 | 42 | } |
@@ -55,16 +53,14 @@ discard block |
||
| 55 | 53 | { |
| 56 | 54 | $RecycledGoods["metal"] = $destination_planet["debris_metal"]; |
| 57 | 55 | $RecycledGoods["crystal"] = $destination_planet["debris_crystal"]; |
| 58 | - } |
|
| 59 | - else |
|
| 56 | + } else |
|
| 60 | 57 | { |
| 61 | 58 | if (($destination_planet["debris_metal"] > $RecyclerCapacity / 2) AND |
| 62 | 59 | ($destination_planet["debris_crystal"] > $RecyclerCapacity / 2)) |
| 63 | 60 | { |
| 64 | 61 | $RecycledGoods["metal"] = $RecyclerCapacity / 2; |
| 65 | 62 | $RecycledGoods["crystal"] = $RecyclerCapacity / 2; |
| 66 | - } |
|
| 67 | - else |
|
| 63 | + } else |
|
| 68 | 64 | { |
| 69 | 65 | if ($destination_planet["debris_metal"] > $destination_planet["debris_crystal"]) |
| 70 | 66 | { |
@@ -72,20 +68,17 @@ discard block |
||
| 72 | 68 | if ($destination_planet["debris_metal"] > ($RecyclerCapacity - $RecycledGoods["crystal"])) |
| 73 | 69 | { |
| 74 | 70 | $RecycledGoods["metal"] = $RecyclerCapacity - $RecycledGoods["crystal"]; |
| 75 | - } |
|
| 76 | - else |
|
| 71 | + } else |
|
| 77 | 72 | { |
| 78 | 73 | $RecycledGoods["metal"] = $destination_planet["debris_metal"]; |
| 79 | 74 | } |
| 80 | - } |
|
| 81 | - else |
|
| 75 | + } else |
|
| 82 | 76 | { |
| 83 | 77 | $RecycledGoods["metal"] = $destination_planet["debris_metal"]; |
| 84 | 78 | if ($destination_planet["debris_crystal"] > ($RecyclerCapacity - $RecycledGoods["metal"])) |
| 85 | 79 | { |
| 86 | 80 | $RecycledGoods["crystal"] = $RecyclerCapacity - $RecycledGoods["metal"]; |
| 87 | - } |
|
| 88 | - else |
|
| 81 | + } else |
|
| 89 | 82 | { |
| 90 | 83 | $RecycledGoods["crystal"] = $destination_planet["debris_crystal"]; |
| 91 | 84 | } |
@@ -8,8 +8,7 @@ |
||
| 8 | 8 | * @version 1.1 |
| 9 | 9 | * @copyright 2008 by Chlorel for XNova |
| 10 | 10 | */ |
| 11 | -function flt_mission_relocate($mission_data) |
|
| 12 | -{ |
|
| 11 | +function flt_mission_relocate($mission_data) { |
|
| 13 | 12 | $fleet_row = &$mission_data['fleet']; |
| 14 | 13 | $destination_planet = &$mission_data['dst_planet']; |
| 15 | 14 | |