@@ -74,14 +74,12 @@ discard block |
||
74 | 74 | doquery("UPDATE {{alliance}} SET " . implode(',', $ally_changeset) . " WHERE `id`='{$ally['id']}' LIMIT 1;"); |
75 | 75 | sys_redirect('alliance.php?mode=admin&edit=ally'); |
76 | 76 | } |
77 | -} |
|
78 | -elseif(sys_get_param_str('isSaveText')) |
|
77 | +} elseif(sys_get_param_str('isSaveText')) |
|
79 | 78 | { |
80 | 79 | $text = sys_get_param_str_both('text'); |
81 | 80 | doquery("UPDATE {{alliance}} SET `{$text_list[$allyTextID]['db_field']}`='{$text['safe']}' WHERE `id`='{$ally['id']}';"); |
82 | 81 | $ally[$text_list[$allyTextID]['db_field']] = $text['unsafe']; |
83 | -} |
|
84 | -elseif(sys_get_param_str('isTransfer') && $idNewLeader = sys_get_param_id('idNewLeader')) |
|
82 | +} elseif(sys_get_param_str('isTransfer') && $idNewLeader = sys_get_param_id('idNewLeader')) |
|
85 | 83 | { |
86 | 84 | if(!$isAllyOwner) |
87 | 85 | { |
@@ -98,8 +96,7 @@ discard block |
||
98 | 96 | sn_db_transaction_commit(); |
99 | 97 | sys_redirect('alliance.php'); |
100 | 98 | } |
101 | -} |
|
102 | -elseif(sys_get_param_str('isDisband') && sys_get_param_str('isConfirmDisband')) |
|
99 | +} elseif(sys_get_param_str('isDisband') && sys_get_param_str('isConfirmDisband')) |
|
103 | 100 | { |
104 | 101 | if(!$isAllyOwner) |
105 | 102 | { |
@@ -1,8 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | function admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list){return sn_function_call('admin_planet_edit_mode', array(&$template, &$admin_planet_edit_mode_list));} |
4 | -function sn_admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list) |
|
5 | -{ |
|
4 | +function sn_admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list) { |
|
6 | 5 | global $lang; |
7 | 6 | |
8 | 7 | $admin_planet_edit_mode_list = array_merge(isset($admin_planet_edit_mode_list) ? $admin_planet_edit_mode_list : array(), array( |
@@ -25,8 +24,7 @@ discard block |
||
25 | 24 | * @param $edit_planet_row |
26 | 25 | * @param $mode |
27 | 26 | */ |
28 | -function sn_admin_planet_edit_template(&$template, $edit_planet_row, $mode) |
|
29 | -{ |
|
27 | +function sn_admin_planet_edit_template(&$template, $edit_planet_row, $mode) { |
|
30 | 28 | global $lang; |
31 | 29 | |
32 | 30 | $unit_list = sn_get_groups($mode); |
@@ -48,15 +46,13 @@ discard block |
||
48 | 46 | } |
49 | 47 | |
50 | 48 | function admin_planet_edit_query_string($unit_id, $unit_amount, $mode){return sn_function_call('admin_planet_edit_query_string', array($unit_id, $unit_amount, $mode));} |
51 | -function sn_admin_planet_edit_query_string($unit_id, $unit_amount, $mode) |
|
52 | -{ |
|
49 | +function sn_admin_planet_edit_query_string($unit_id, $unit_amount, $mode) { |
|
53 | 50 | if($unit_amount && in_array($unit_id, sn_get_groups($mode))) |
54 | 51 | { |
55 | 52 | $unit_amount = round($unit_amount); |
56 | 53 | $unit_name = get_unit_param($unit_id, P_NAME); |
57 | 54 | $result = "{$unit_name} = GREATEST(0, {$unit_name} + ({$unit_amount}))"; |
58 | - } |
|
59 | - else |
|
55 | + } else |
|
60 | 56 | { |
61 | 57 | $result = ''; |
62 | 58 | } |
@@ -30,8 +30,7 @@ |
||
30 | 30 | * @param $resource_id |
31 | 31 | * @param ResourceCalculations $capsObj |
32 | 32 | */ |
33 | -function int_calc_storage_bar($resource_id, $capsObj) |
|
34 | -{ |
|
33 | +function int_calc_storage_bar($resource_id, $capsObj) { |
|
35 | 34 | global $lang, $template, $planetrow, $user; |
36 | 35 | |
37 | 36 | $totalProduction = $capsObj->getProduction($resource_id); |
@@ -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']; |
@@ -49,8 +48,7 @@ discard block |
||
49 | 48 | * @param bool $force |
50 | 49 | * @param bool $json |
51 | 50 | */ |
52 | -function msg_send_simple_message($owners, $sender, $timestamp, $message_type, $from, $subject, $text, $escaped = STRING_NEED_ESCAPING, $force = false, $json = false) |
|
53 | -{ |
|
51 | +function msg_send_simple_message($owners, $sender, $timestamp, $message_type, $from, $subject, $text, $escaped = STRING_NEED_ESCAPING, $force = false, $json = false) { |
|
54 | 52 | global $config, $user, $sn_message_class_list; |
55 | 53 | |
56 | 54 | if(!$owners) |
@@ -91,8 +89,7 @@ discard block |
||
91 | 89 | // TODO Добавить $sender - рассылка может быть и от кого-то |
92 | 90 | db_message_insert_all($message_type, $from, $subject, $text); |
93 | 91 | $owners = []; |
94 | - } |
|
95 | - else |
|
92 | + } else |
|
96 | 93 | { |
97 | 94 | $insert_values = []; |
98 | 95 | $insert_template = "('%u'," . str_replace('%', '%%', " '{$sender}', '{$timestamp}', '{$message_type}', '{$from}', '{$subject}', '{$text}', '" . intval($json) . "')"); |
@@ -102,8 +99,7 @@ discard block |
||
102 | 99 | if($user['id'] != $owner) |
103 | 100 | { |
104 | 101 | $owner_row = db_user_by_id($owner); |
105 | - } |
|
106 | - else |
|
102 | + } else |
|
107 | 103 | { |
108 | 104 | $owner_row = $user; |
109 | 105 | } |
@@ -139,11 +139,13 @@ |
||
139 | 139 | $error_backtrace['locks'] = _SnCacheInternal::$locks; |
140 | 140 | $error_backtrace['cSN_data'] = _SnCacheInternal::$data; |
141 | 141 | foreach($error_backtrace['cSN_data'] as &$location) { |
142 | - foreach($location as $location_id => &$location_data) // $location_data = $location_id; |
|
142 | + foreach($location as $location_id => &$location_data) { |
|
143 | + // $location_data = $location_id; |
|
143 | 144 | { |
144 | 145 | $location_data = isset($location_data['username']) ? $location_data['username'] : |
145 | 146 | (isset($location_data['name']) ? $location_data['name'] : $location_id); |
146 | 147 | } |
148 | + } |
|
147 | 149 | } |
148 | 150 | } |
149 | 151 |
@@ -56,8 +56,7 @@ discard block |
||
56 | 56 | sprintf($lang['buddy_msg_accept_text'], $user['username'])); |
57 | 57 | sn_db_transaction_commit(); |
58 | 58 | throw new exception('buddy_err_accept_none', ERR_NONE); |
59 | - } |
|
60 | - else |
|
59 | + } else |
|
61 | 60 | { |
62 | 61 | throw new exception('buddy_err_accept_internal', ERR_ERROR); |
63 | 62 | } |
@@ -69,9 +68,11 @@ discard block |
||
69 | 68 | throw new exception('buddy_err_delete_alien', ERR_ERROR); |
70 | 69 | } |
71 | 70 | |
72 | - if($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_ACTIVE) // Existing friendship |
|
71 | + if($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_ACTIVE) { |
|
72 | + // Existing friendship |
|
73 | 73 | { |
74 | 74 | $ex_friend_id = $buddy_row['BUDDY_SENDER_ID'] == $user['id'] ? $buddy_row['BUDDY_OWNER_ID'] : $buddy_row['BUDDY_SENDER_ID']; |
75 | + } |
|
75 | 76 | |
76 | 77 | msg_send_simple_message($ex_friend_id, $user['id'], SN_TIME_NOW, MSG_TYPE_PLAYER, $user['username'], $lang['buddy_msg_unfriend_title'], |
77 | 78 | sprintf($lang['buddy_msg_unfriend_text'], $user['username'])); |
@@ -79,17 +80,19 @@ discard block |
||
79 | 80 | doquery("DELETE FROM {{buddy}} WHERE `BUDDY_ID` = {$buddy_id} LIMIT 1;"); |
80 | 81 | sn_db_transaction_commit(); |
81 | 82 | throw new exception('buddy_err_unfriend_none', ERR_NONE); |
82 | - } |
|
83 | - elseif($buddy_row['BUDDY_SENDER_ID'] == $user['id']) // Player's outcoming request - either denied or waiting |
|
83 | + } elseif($buddy_row['BUDDY_SENDER_ID'] == $user['id']) { |
|
84 | + // Player's outcoming request - either denied or waiting |
|
84 | 85 | { |
85 | 86 | doquery("DELETE FROM {{buddy}} WHERE `BUDDY_ID` = {$buddy_id} LIMIT 1;"); |
87 | + } |
|
86 | 88 | sn_db_transaction_commit(); |
87 | 89 | throw new exception('buddy_err_delete_own', ERR_NONE); |
88 | - } |
|
89 | - elseif($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_WAITING) // Deny incoming request |
|
90 | + } elseif($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_WAITING) { |
|
91 | + // Deny incoming request |
|
90 | 92 | { |
91 | 93 | msg_send_simple_message($buddy_row['BUDDY_SENDER_ID'], $user['id'], SN_TIME_NOW, MSG_TYPE_PLAYER, $user['username'], $lang['buddy_msg_deny_title'], |
92 | 94 | sprintf($lang['buddy_msg_deny_text'], $user['username'])); |
95 | + } |
|
93 | 96 | |
94 | 97 | doquery("UPDATE {{buddy}} SET `BUDDY_STATUS` = " . BUDDY_REQUEST_DENIED . " WHERE `BUDDY_ID` = {$buddy_id} LIMIT 1;"); |
95 | 98 | sn_db_transaction_commit(); |
@@ -104,8 +107,7 @@ discard block |
||
104 | 107 | if($new_friend_id = sys_get_param_id('request_user_id')) |
105 | 108 | { |
106 | 109 | $new_friend_row = db_user_by_id($new_friend_id, true, '`id`, `username`'); |
107 | - } |
|
108 | - elseif($new_friend_name = sys_get_param_str_unsafe('request_user_name')) |
|
110 | + } elseif($new_friend_name = sys_get_param_str_unsafe('request_user_name')) |
|
109 | 111 | { |
110 | 112 | $new_friend_row = db_user_by_username($new_friend_name); |
111 | 113 | $new_friend_name = db_escape($new_friend_name); |
@@ -138,8 +140,7 @@ discard block |
||
138 | 140 | sn_db_transaction_commit(); |
139 | 141 | throw new exception('buddy_err_adding_none', ERR_NONE); |
140 | 142 | } |
141 | -} |
|
142 | -catch(exception $e) |
|
143 | +} catch(exception $e) |
|
143 | 144 | { |
144 | 145 | $result[] = array( |
145 | 146 | 'STATUS' => in_array($e->getCode(), array(ERR_NONE, ERR_WARNING, ERR_ERROR)) ? $e->getCode() : ERR_ERROR, |
@@ -290,10 +290,12 @@ discard block |
||
290 | 290 | } |
291 | 291 | } |
292 | 292 | |
293 | - if ($fleet_id) // Не планета |
|
293 | + if ($fleet_id) { |
|
294 | + // Не планета |
|
294 | 295 | { |
295 | 296 | if ($fleet_info[UBE_FLEET_TYPE] == UBE_ATTACKERS && $outcome[UBE_MOON_REAPERS] == UBE_MOON_REAPERS_DIED) { |
296 | 297 | $new_fleet_count = 0; |
298 | + } |
|
297 | 299 | } |
298 | 300 | |
299 | 301 | if ($new_fleet_count) { |
@@ -316,10 +318,12 @@ discard block |
||
316 | 318 | } |
317 | 319 | DBStaticPlanet::db_planet_set_by_id($planet_id, implode(',', $temp)); |
318 | 320 | } |
319 | - if (!empty($db_changeset)) // Сохраняем изменения юнитов на планете - если они есть |
|
321 | + if (!empty($db_changeset)) { |
|
322 | + // Сохраняем изменения юнитов на планете - если они есть |
|
320 | 323 | { |
321 | 324 | OldDbChangeSet::db_changeset_apply($db_changeset); |
322 | 325 | } |
326 | + } |
|
323 | 327 | } |
324 | 328 | } |
325 | 329 |
@@ -236,9 +236,11 @@ |
||
236 | 236 | } |
237 | 237 | |
238 | 238 | // Если новая планета не найдена или было переключения - проверяем текущую выбранную планету |
239 | - if (!isset($planet_row['id'])) // || $planet_row['id'] != $user['current_planet'] |
|
239 | + if (!isset($planet_row['id'])) { |
|
240 | + // || $planet_row['id'] != $user['current_planet'] |
|
240 | 241 | { |
241 | 242 | $planet_row = DBStaticPlanet::db_planet_by_id_and_owner($user['current_planet'], $user['id'], false, 'id'); |
243 | + } |
|
242 | 244 | // Если текущей планеты не существует - выставляем Столицу |
243 | 245 | if (!isset($planet_row['id'])) { |
244 | 246 | $planet_row = DBStaticPlanet::db_planet_by_id_and_owner($user['id_planet'], $user['id'], false, 'id'); |
@@ -24,7 +24,9 @@ |
||
24 | 24 | * DO NOT CHANGE |
25 | 25 | */ |
26 | 26 | |
27 | -if (!defined('INSIDE')) die(); |
|
27 | +if (!defined('INSIDE')) { |
|
28 | + die(); |
|
29 | +} |
|
28 | 30 | |
29 | 31 | $a_lang_array = array( |
30 | 32 | 'built' => 'Построено', |