@@ -19,7 +19,7 @@ |
||
19 | 19 | |
20 | 20 | $template = gettemplate("admin/add_moon", true); |
21 | 21 | |
22 | -if(sys_get_param_str('mode') == 'addit') |
|
22 | +if (sys_get_param_str('mode') == 'addit') |
|
23 | 23 | { |
24 | 24 | $PlanetID = sys_get_param_id('user'); |
25 | 25 | $MoonName = sys_get_param_str('name'); |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | |
14 | 14 | $mip_data = get_unit_param(UNIT_DEF_MISSILE_INTERPLANET); |
15 | 15 | $MIPDamage = floor(mrc_modify_value($attackerTech, false, TECH_WEAPON, $MIPs * $mip_data[P_ATTACK] * mt_rand(80, 120) / 100)); |
16 | - foreach($structures as $key => $structure) |
|
16 | + foreach ($structures as $key => $structure) |
|
17 | 17 | { |
18 | 18 | $unit_info = get_unit_param($key); |
19 | 19 | $amplify = isset($mip_data[P_AMPLIFY][$key]) ? $mip_data[P_AMPLIFY][$key] : 1; |
@@ -31,9 +31,9 @@ discard block |
||
31 | 31 | { |
32 | 32 | //attacking only selected structure |
33 | 33 | $damageDone = $structures[$targetedStructure][$damageTo]; |
34 | - $structsDestroyed = min( floor($MIPDamage/$damageDone), $structures[$targetedStructure][0] ); |
|
34 | + $structsDestroyed = min(floor($MIPDamage / $damageDone), $structures[$targetedStructure][0]); |
|
35 | 35 | $structures[$targetedStructure][0] -= $structsDestroyed; |
36 | - $MIPDamage -= $structsDestroyed*$damageDone; |
|
36 | + $MIPDamage -= $structsDestroyed * $damageDone; |
|
37 | 37 | } |
38 | 38 | else |
39 | 39 | { |
@@ -44,16 +44,16 @@ discard block |
||
44 | 44 | do |
45 | 45 | { |
46 | 46 | // finding is there any structure that can be damaged with leftovers of $MIPDamage |
47 | - foreach($can_be_damaged as $key => $unit_id) |
|
47 | + foreach ($can_be_damaged as $key => $unit_id) |
|
48 | 48 | { |
49 | 49 | //debug($structures[$unit_id][0]); |
50 | 50 | //debug($structures[$unit_id][$damageTo], $MIPDamage); |
51 | - if($structures[$unit_id][0] <= 0 || $structures[$unit_id][$damageTo] > $MIPDamage) |
|
51 | + if ($structures[$unit_id][0] <= 0 || $structures[$unit_id][$damageTo] > $MIPDamage) |
|
52 | 52 | { |
53 | 53 | unset($can_be_damaged[$key]); |
54 | 54 | } |
55 | 55 | } |
56 | - if(empty($can_be_damaged)) |
|
56 | + if (empty($can_be_damaged)) |
|
57 | 57 | { |
58 | 58 | break; |
59 | 59 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | //debug($destroyed, 'Actually destroyed'); |
73 | 73 | |
74 | 74 | //print('<hr>'); |
75 | - } while($MIPDamage > 0 && !empty($can_be_damaged)); |
|
75 | + } while ($MIPDamage > 0 && !empty($can_be_damaged)); |
|
76 | 76 | //debug($MIPDamage, 'MIPDamage left'); |
77 | 77 | } |
78 | 78 | //debug($structures);//die(); |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | $crystal += $destroyed * $unit_info[P_COST][RES_CRYSTAL] / 4; |
88 | 88 | } |
89 | 89 | |
90 | - $return['structures'] = $structures; // Structures left after attack |
|
91 | - $return['metal'] = floor($metal); // Metal scraps |
|
90 | + $return['structures'] = $structures; // Structures left after attack |
|
91 | + $return['metal'] = floor($metal); // Metal scraps |
|
92 | 92 | $return['crystal'] = floor($crystal); // Crystal scraps |
93 | 93 | |
94 | 94 | return $return; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | $iraks = doquery("SELECT * FROM {{iraks}} WHERE `fleet_end_time` <= " . SN_TIME_NOW . " FOR UPDATE;"); |
114 | 114 | |
115 | - while($fleetRow = db_fetch($iraks)) { |
|
115 | + while ($fleetRow = db_fetch($iraks)) { |
|
116 | 116 | set_time_limit(15); |
117 | 117 | $db_changeset = array(); |
118 | 118 | |
@@ -128,9 +128,9 @@ discard block |
||
128 | 128 | |
129 | 129 | $rowAttacker = db_user_by_id($fleetRow['fleet_owner'], true); |
130 | 130 | |
131 | - if($target_planet_row['id']) { |
|
131 | + if ($target_planet_row['id']) { |
|
132 | 132 | $planetDefense = array(); |
133 | - foreach(sn_get_groups('defense_active') as $unit_id) { |
|
133 | + foreach (sn_get_groups('defense_active') as $unit_id) { |
|
134 | 134 | $planetDefense[$unit_id] = array(mrc_get_level($targetUser, $target_planet_row, $unit_id, true, true)); |
135 | 135 | } |
136 | 136 | |
@@ -141,23 +141,23 @@ discard block |
||
141 | 141 | $message = $lang['mip_all_destroyed']; |
142 | 142 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit(UNIT_DEF_MISSILE_INTERCEPTOR, -$missiles, $targetUser, $target_planet_row['id']); |
143 | 143 | } else { |
144 | - if($interceptors) { |
|
144 | + if ($interceptors) { |
|
145 | 145 | $message = sprintf($lang['mip_destroyed'], $interceptors); |
146 | 146 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit(UNIT_DEF_MISSILE_INTERCEPTOR, -$interceptors, $targetUser, $target_planet_row['id']); |
147 | 147 | } |
148 | 148 | |
149 | 149 | $attackResult = COE_missileAttack($targetUser, $rowAttacker, $missiles - $interceptors, $planetDefense, $fleetRow['primaer']); |
150 | 150 | |
151 | - foreach($attackResult['structures'] as $key => $structure) { |
|
151 | + foreach ($attackResult['structures'] as $key => $structure) { |
|
152 | 152 | $destroyed = $planetDefense[$key][0] - $structure[0]; |
153 | - if($destroyed) { |
|
153 | + if ($destroyed) { |
|
154 | 154 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($key, -$destroyed, $targetUser, $target_planet_row['id']); |
155 | 155 | |
156 | 156 | $message .= " {$lang['tech'][$key]} - {$destroyed} {$lang['quantity']}<br>"; |
157 | 157 | } |
158 | 158 | } |
159 | 159 | |
160 | - if(!empty($message)) { |
|
160 | + if (!empty($message)) { |
|
161 | 161 | $message = $lang['mip_defense_destroyed'] . $message . "{$lang['mip_recycled']}{$lang['Metal']}: {$attackResult['metal']}, {$lang['Crystal']}: {$attackResult['crystal']}<br>"; |
162 | 162 | |
163 | 163 | DBStaticPlanet::db_planet_set_by_id($target_planet_row['id'], "`metal` = `metal` + {$attackResult['metal']}, `crystal` = `crystal` + {$attackResult['crystal']}"); |
@@ -174,8 +174,8 @@ discard block |
||
174 | 174 | |
175 | 175 | empty($message) ? $message = $lang['mip_no_defense'] : false; |
176 | 176 | |
177 | - msg_send_simple_message ( $fleetRow['fleet_owner'], '', SN_TIME_NOW, MSG_TYPE_SPY, $lang['mip_sender_amd'], $lang['mip_subject_amd'], $message_vorlage . $message ); |
|
178 | - msg_send_simple_message ( $fleetRow['fleet_target_owner'], '', SN_TIME_NOW, MSG_TYPE_SPY, $lang['mip_sender_amd'], $lang['mip_subject_amd'], $message_vorlage . $message ); |
|
177 | + msg_send_simple_message($fleetRow['fleet_owner'], '', SN_TIME_NOW, MSG_TYPE_SPY, $lang['mip_sender_amd'], $lang['mip_subject_amd'], $message_vorlage . $message); |
|
178 | + msg_send_simple_message($fleetRow['fleet_target_owner'], '', SN_TIME_NOW, MSG_TYPE_SPY, $lang['mip_sender_amd'], $lang['mip_subject_amd'], $message_vorlage . $message); |
|
179 | 179 | } |
180 | 180 | doquery("DELETE FROM {{iraks}} WHERE id = '{$fleetRow['id']}';"); |
181 | 181 | } |
@@ -7,8 +7,7 @@ discard block |
||
7 | 7 | use DBAL\OldDbChangeSet; |
8 | 8 | use Planet\DBStaticPlanet; |
9 | 9 | |
10 | -function COE_missileAttack($defenceTech, $attackerTech, $MIPs, $structures, $targetedStructure = '0') |
|
11 | -{ |
|
10 | +function COE_missileAttack($defenceTech, $attackerTech, $MIPs, $structures, $targetedStructure = '0') { |
|
12 | 11 | // Here we select which part of defense should take damage: structure or shield |
13 | 12 | // $damageTo = P_SHIELD; |
14 | 13 | // $damageTo = P_STRUCTURE; |
@@ -37,8 +36,7 @@ discard block |
||
37 | 36 | $structsDestroyed = min( floor($MIPDamage/$damageDone), $structures[$targetedStructure][0] ); |
38 | 37 | $structures[$targetedStructure][0] -= $structsDestroyed; |
39 | 38 | $MIPDamage -= $structsDestroyed*$damageDone; |
40 | - } |
|
41 | - else |
|
39 | + } else |
|
42 | 40 | { |
43 | 41 | // REALLY random attack |
44 | 42 | $can_be_damaged = sn_get_groups('defense_active'); |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | global $lang; |
4 | 4 | |
5 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
5 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
6 | 6 | { |
7 | 7 | $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
8 | 8 | } |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | $page = gettemplate('ali_admin_mail', true); |
21 | 21 | |
22 | 22 | if ($ranks) { |
23 | - foreach($ranks as $id => $array) { |
|
23 | + foreach ($ranks as $id => $array) { |
|
24 | 24 | $page->assign_block_vars('ranks', array( |
25 | 25 | 'NAME' => $array['name'], |
26 | 26 | 'VALUE' => $id, |
@@ -14,39 +14,39 @@ discard block |
||
14 | 14 | |
15 | 15 | lng_include('fleet'); |
16 | 16 | |
17 | -if($TargetPlanet = sys_get_param_id('jmpto')) |
|
17 | +if ($TargetPlanet = sys_get_param_id('jmpto')) |
|
18 | 18 | { |
19 | 19 | sn_db_transaction_start(); |
20 | 20 | db_user_by_id($user['id'], true, 'id'); |
21 | 21 | $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true); |
22 | - if(!($NextJumpTime = uni_get_time_to_jump($planetrow))) |
|
22 | + if (!($NextJumpTime = uni_get_time_to_jump($planetrow))) |
|
23 | 23 | { |
24 | 24 | $TargetGate = DBStaticPlanet::db_planet_by_id($TargetPlanet, true, '`id`, `last_jump_time`'); |
25 | - if(mrc_get_level($user, $TargetGate, STRUC_MOON_GATE) > 0) |
|
25 | + if (mrc_get_level($user, $TargetGate, STRUC_MOON_GATE) > 0) |
|
26 | 26 | { |
27 | - $NextDestTime = uni_get_time_to_jump ( $TargetGate ); |
|
28 | - if(!$NextDestTime) |
|
27 | + $NextDestTime = uni_get_time_to_jump($TargetGate); |
|
28 | + if (!$NextDestTime) |
|
29 | 29 | { |
30 | 30 | // $SubQueryOri = ""; |
31 | 31 | // $SubQueryDes = ""; |
32 | 32 | $ship_list = sys_get_param('ships'); |
33 | 33 | $db_changeset = array(); |
34 | - foreach($ship_list as $ship_id => $ship_count) |
|
34 | + foreach ($ship_list as $ship_id => $ship_count) |
|
35 | 35 | { |
36 | - if(!in_array($ship_id, sn_get_groups('fleet'))) |
|
36 | + if (!in_array($ship_id, sn_get_groups('fleet'))) |
|
37 | 37 | { |
38 | 38 | continue; |
39 | 39 | } |
40 | 40 | |
41 | 41 | $ship_count = max(0, min(floor($ship_count), mrc_get_level($user, $planetrow, $ship_id))); |
42 | - if($ship_count) |
|
42 | + if ($ship_count) |
|
43 | 43 | { |
44 | 44 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($ship_id, -$ship_count, $user, $planetrow['id']); |
45 | 45 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($ship_id, $ship_count, $user, $TargetGate['id']); |
46 | 46 | } |
47 | 47 | } |
48 | 48 | // Dit monsieur, y avait quelque chose a envoyer ??? |
49 | - if(!empty($db_changeset)) |
|
49 | + if (!empty($db_changeset)) |
|
50 | 50 | { |
51 | 51 | DBStaticPlanet::db_planet_set_by_id($TargetGate['id'], "`last_jump_time` = " . SN_TIME_NOW . ""); |
52 | 52 | DBStaticPlanet::db_planet_set_by_id($planetrow['id'], "`last_jump_time` = " . SN_TIME_NOW . ""); |
@@ -55,31 +55,31 @@ discard block |
||
55 | 55 | db_user_set_by_id($user['id'], "`current_planet` = '{$TargetGate['id']}'"); |
56 | 56 | |
57 | 57 | $planetrow['last_jump_time'] = SN_TIME_NOW; |
58 | - $RetMessage = $lang['gate_jump_done'] ." - ". pretty_time(uni_get_time_to_jump($planetrow)); |
|
58 | + $RetMessage = $lang['gate_jump_done'] . " - " . pretty_time(uni_get_time_to_jump($planetrow)); |
|
59 | 59 | } else { |
60 | 60 | $RetMessage = $lang['gate_wait_data']; |
61 | 61 | } |
62 | 62 | } else { |
63 | - $RetMessage = $lang['gate_wait_dest'] ." - ". pretty_time($NextDestTime); |
|
63 | + $RetMessage = $lang['gate_wait_dest'] . " - " . pretty_time($NextDestTime); |
|
64 | 64 | } |
65 | 65 | } else { |
66 | 66 | $RetMessage = $lang['gate_no_dest_g']; |
67 | 67 | } |
68 | 68 | } else { |
69 | - $RetMessage = $lang['gate_wait_star'] ." - ". pretty_time($NextJumpTime); |
|
69 | + $RetMessage = $lang['gate_wait_star'] . " - " . pretty_time($NextJumpTime); |
|
70 | 70 | } |
71 | 71 | sn_db_transaction_commit(); |
72 | 72 | messageBox($RetMessage, $lang['tech'][STRUC_MOON_GATE], "jumpgate.php", 10); |
73 | 73 | } else { |
74 | 74 | $template = gettemplate('jumpgate', true); |
75 | - if(mrc_get_level($user, $planetrow, STRUC_MOON_GATE) > 0) |
|
75 | + if (mrc_get_level($user, $planetrow, STRUC_MOON_GATE) > 0) |
|
76 | 76 | { |
77 | 77 | $Combo = ''; |
78 | 78 | $MoonList = DBStaticPlanet::db_planet_list_moon_other($user['id'], $planetrow['id']); |
79 | 79 | // while($CurMoon = db_fetch($MoonList)) |
80 | - foreach($MoonList as $CurMoon) |
|
80 | + foreach ($MoonList as $CurMoon) |
|
81 | 81 | { |
82 | - if(mrc_get_level($user, $CurMoon, STRUC_MOON_GATE) >= 1) |
|
82 | + if (mrc_get_level($user, $CurMoon, STRUC_MOON_GATE) >= 1) |
|
83 | 83 | { |
84 | 84 | $NextJumpTime = uni_get_time_to_jump($CurMoon); |
85 | 85 | $template->assign_block_vars('moon', array( |
@@ -93,9 +93,9 @@ discard block |
||
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
96 | - foreach(sn_get_groups('fleet') as $Ship) |
|
96 | + foreach (sn_get_groups('fleet') as $Ship) |
|
97 | 97 | { |
98 | - if(($ship_count = mrc_get_level($user, $planetrow, $Ship)) <= 0) |
|
98 | + if (($ship_count = mrc_get_level($user, $planetrow, $Ship)) <= 0) |
|
99 | 99 | { |
100 | 100 | continue; |
101 | 101 | } |
@@ -115,8 +115,7 @@ |
||
115 | 115 | )); |
116 | 116 | |
117 | 117 | display($template, $lang['tech'][STRUC_MOON_GATE]); |
118 | - } |
|
119 | - else |
|
118 | + } else |
|
120 | 119 | { |
121 | 120 | messageBox($lang['gate_no_src_ga'], $lang['tech'][STRUC_MOON_GATE], "overview.php", 10); |
122 | 121 | } |
@@ -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 | { |
@@ -2,26 +2,26 @@ discard block |
||
2 | 2 | |
3 | 3 | use Alliance\DBStaticAlly; |
4 | 4 | |
5 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) { |
|
5 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) { |
|
6 | 6 | $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
7 | 7 | } |
8 | 8 | |
9 | -if(!$user_admin) { |
|
9 | +if (!$user_admin) { |
|
10 | 10 | messageBox($lang['Denied_access'], $lang['ally_admin']); |
11 | 11 | } |
12 | 12 | |
13 | 13 | $template = gettemplate('ali_admin', $template); |
14 | 14 | |
15 | 15 | $text_list = array( |
16 | - 1 => array ('db_field' => 'ally_description', 'text_type' => 'Public_text_of_alliance'), |
|
17 | - 2 => array ('db_field' => 'ally_text', 'text_type' => 'Internal_text'), |
|
18 | - 3 => array ('db_field' => 'ally_request', 'text_type' => 'Show_of_request_text'), |
|
16 | + 1 => array('db_field' => 'ally_description', 'text_type' => 'Public_text_of_alliance'), |
|
17 | + 2 => array('db_field' => 'ally_text', 'text_type' => 'Internal_text'), |
|
18 | + 3 => array('db_field' => 'ally_request', 'text_type' => 'Show_of_request_text'), |
|
19 | 19 | ); |
20 | 20 | |
21 | 21 | $allyTextID = sys_get_param_int('t', 1); |
22 | -$allyTextID = ($allyTextID<1 || $allyTextID>3) ? 1 : $allyTextID; |
|
22 | +$allyTextID = ($allyTextID < 1 || $allyTextID > 3) ? 1 : $allyTextID; |
|
23 | 23 | |
24 | -if(sys_get_param_str('isSaveOptions')) { |
|
24 | +if (sys_get_param_str('isSaveOptions')) { |
|
25 | 25 | require_once('includes/includes/sys_avatar.php'); |
26 | 26 | |
27 | 27 | $new_image = $ally['ally_image']; |
@@ -33,32 +33,32 @@ discard block |
||
33 | 33 | // $template->assign_block_vars('result', $avatar_upload_result); |
34 | 34 | |
35 | 35 | $ally_changeset = array(); |
36 | - if(($new_tag = sys_get_param_str_unsafe('tag', $ally['ally_tag'])) && $new_tag != $ally['ally_tag']) { |
|
36 | + if (($new_tag = sys_get_param_str_unsafe('tag', $ally['ally_tag'])) && $new_tag != $ally['ally_tag']) { |
|
37 | 37 | $new_tag_unsafe = $new_tag; |
38 | 38 | $new_tag = db_escape($new_tag); |
39 | 39 | $isTaggedAllyExists = DBStaticAlly::db_ally_get_by_tag($new_tag); |
40 | - if(!empty($isTaggedAllyExists)) { |
|
40 | + if (!empty($isTaggedAllyExists)) { |
|
41 | 41 | messageBox(sprintf($lang['ally_message_tag_exists'], $new_tag_unsafe), '', 'alliance.php?mode=admin&edit=ally'); |
42 | 42 | } |
43 | 43 | $ally_changeset[] = "`ally_tag`='{$new_tag}'"; |
44 | 44 | db_user_set_by_id($ally['ally_user_id'], "`username`='[{$new_tag}]'"); |
45 | 45 | } |
46 | 46 | |
47 | - if(($new_name = sys_get_param_str_unsafe('name', $ally['ally_name'])) && $new_name != $ally['ally_name']) { |
|
47 | + if (($new_name = sys_get_param_str_unsafe('name', $ally['ally_name'])) && $new_name != $ally['ally_name']) { |
|
48 | 48 | $new_name_unsafe = $new_name; |
49 | 49 | $new_name = db_escape($new_name); |
50 | 50 | $isTaggedAllyExists = DBStaticAlly::db_ally_get_by_name($new_name); |
51 | - if(!empty($isTaggedAllyExists)) { |
|
51 | + if (!empty($isTaggedAllyExists)) { |
|
52 | 52 | messageBox(sprintf($lang['ally_message_name_exists'], $new_name_unsafe), '', 'alliance.php?mode=admin&edit=ally'); |
53 | 53 | } |
54 | 54 | $ally_changeset[] = "`ally_name`='{$new_name}'"; |
55 | 55 | } |
56 | 56 | |
57 | - if(($new_owner_rank = sys_get_param_str_unsafe('owner_range', $ally['ally_owner_range'])) && $new_owner_rank != $ally['ally_owner_range']) { |
|
57 | + if (($new_owner_rank = sys_get_param_str_unsafe('owner_range', $ally['ally_owner_range'])) && $new_owner_rank != $ally['ally_owner_range']) { |
|
58 | 58 | $new_owner_rank = db_escape($new_owner_rank); |
59 | 59 | $ally_changeset[] = "`ally_owner_range` = '{$new_owner_rank}'"; |
60 | 60 | } |
61 | - if(($new_web = sys_get_param_str_unsafe('web', $ally['ally_web'])) && $new_web != $ally['ally_web']) { |
|
61 | + if (($new_web = sys_get_param_str_unsafe('web', $ally['ally_web'])) && $new_web != $ally['ally_web']) { |
|
62 | 62 | $new_web = db_escape($new_web); |
63 | 63 | $ally_changeset[] = "`ally_web` = '{$new_web}'"; |
64 | 64 | } |
@@ -67,31 +67,31 @@ discard block |
||
67 | 67 | // if(($new_request = sys_get_param_int('request_notallow', $ally['ally_request_notallow'])) && $new_request != $ally['ally_request_notallow']) { |
68 | 68 | // $ally_changeset[] = "`ally_request_notallow` = '{$new_request}'"; |
69 | 69 | // } |
70 | - if($new_image != $ally['ally_image']) { |
|
70 | + if ($new_image != $ally['ally_image']) { |
|
71 | 71 | $new_image = intval($new_image); |
72 | 72 | $ally_changeset[] = "`ally_image` = '{$new_image}'"; |
73 | 73 | } |
74 | 74 | |
75 | - if(!empty($ally_changeset)) { |
|
75 | + if (!empty($ally_changeset)) { |
|
76 | 76 | doquery("UPDATE {{alliance}} SET " . implode(',', $ally_changeset) . " WHERE `id`='{$ally['id']}' LIMIT 1;"); |
77 | 77 | sys_redirect('alliance.php?mode=admin&edit=ally'); |
78 | 78 | } |
79 | 79 | } |
80 | -elseif(sys_get_param_str('isSaveText')) |
|
80 | +elseif (sys_get_param_str('isSaveText')) |
|
81 | 81 | { |
82 | 82 | $text = sys_get_param_str_both('text'); |
83 | 83 | doquery("UPDATE {{alliance}} SET `{$text_list[$allyTextID]['db_field']}`='{$text['safe']}' WHERE `id`='{$ally['id']}';"); |
84 | 84 | $ally[$text_list[$allyTextID]['db_field']] = $text['unsafe']; |
85 | 85 | } |
86 | -elseif(sys_get_param_str('isTransfer') && $idNewLeader = sys_get_param_id('idNewLeader')) |
|
86 | +elseif (sys_get_param_str('isTransfer') && $idNewLeader = sys_get_param_id('idNewLeader')) |
|
87 | 87 | { |
88 | - if(!$isAllyOwner) |
|
88 | + if (!$isAllyOwner) |
|
89 | 89 | { |
90 | 90 | messageBox($lang['Denied_access'], $lang['ally_admin']); |
91 | 91 | } |
92 | 92 | |
93 | 93 | $newLeader = db_user_by_id($idNewLeader, false, `ally_id`); |
94 | - if($newLeader['ally_id'] == $user['ally_id']) |
|
94 | + if ($newLeader['ally_id'] == $user['ally_id']) |
|
95 | 95 | { |
96 | 96 | sn_db_transaction_start(); |
97 | 97 | db_user_set_by_id($user['id'], "`ally_rank_id`='0'"); |
@@ -101,9 +101,9 @@ discard block |
||
101 | 101 | sys_redirect('alliance.php'); |
102 | 102 | } |
103 | 103 | } |
104 | -elseif(sys_get_param_str('isDisband') && sys_get_param_str('isConfirmDisband')) |
|
104 | +elseif (sys_get_param_str('isDisband') && sys_get_param_str('isConfirmDisband')) |
|
105 | 105 | { |
106 | - if(!$isAllyOwner) |
|
106 | + if (!$isAllyOwner) |
|
107 | 107 | { |
108 | 108 | messageBox($lang['Denied_access'], $lang['ally_admin']); |
109 | 109 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | 'ally_name' => htmlspecialchars($ally['ally_name']), |
127 | 127 | 'ally_tag' => htmlspecialchars($ally['ally_tag']), |
128 | 128 | 'ally_web' => htmlspecialchars($ally['ally_web']), |
129 | - 'ally_request_notallow_0' => (( $ally['ally_request_notallow']) ? ' SELECTED' : ''), |
|
129 | + 'ally_request_notallow_0' => (($ally['ally_request_notallow']) ? ' SELECTED' : ''), |
|
130 | 130 | 'ally_request_notallow_1' => ((!$ally['ally_request_notallow']) ? ' SELECTED' : ''), |
131 | 131 | 'ally_owner_range' => htmlspecialchars($ally['ally_owner_range']), |
132 | 132 | 'hideNotOwner' => $ally['ally_owner'] != $user['id'] ? 'display: hide;' : '', |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | { |
136 | 136 | $userAllyAdmins = db_user_list("`ally_id`= {$ally['id']}", false, '`id`, `username`'); |
137 | 137 | unset($tmp); |
138 | - foreach($userAllyAdmins as $userAllyAdmin) |
|
138 | + foreach ($userAllyAdmins as $userAllyAdmin) |
|
139 | 139 | { |
140 | 140 | $tmp .= "<option value={$userAllyAdmin['id']}>{$userAllyAdmin['username']}</option>"; |
141 | 141 | } |
@@ -143,9 +143,9 @@ discard block |
||
143 | 143 | $template->assign_var('adminMembers', $tmp); |
144 | 144 | } |
145 | 145 | |
146 | -foreach($sn_ali_admin_internal as $sn_ali_admin_action => $sn_ali_admin_action_locale) |
|
146 | +foreach ($sn_ali_admin_internal as $sn_ali_admin_action => $sn_ali_admin_action_locale) |
|
147 | 147 | { |
148 | - if(!$sn_ali_admin_action_locale['title']) |
|
148 | + if (!$sn_ali_admin_action_locale['title']) |
|
149 | 149 | { |
150 | 150 | continue; |
151 | 151 | } |
@@ -23,16 +23,14 @@ discard block |
||
23 | 23 | $lang['Go_out_welldone'] = str_replace("%s", $ally_name, $lang['Go_out_welldone']); |
24 | 24 | messageBox(sprintf($lang['ali_info_leave_success'], $ally['ally_name']), $lang['sys_alliance']); |
25 | 25 | } |
26 | -} |
|
27 | -elseif($mode == 'ainfo') |
|
26 | +} elseif($mode == 'ainfo') |
|
28 | 27 | { |
29 | 28 | $tag = sys_get_param_str('tag'); |
30 | 29 | $id_ally = sys_get_param_id('a'); |
31 | 30 | if($tag) |
32 | 31 | { |
33 | 32 | $ally = doquery("SELECT * FROM {{alliance}} WHERE ally_tag='{$tag}' LIMIT 1;", '', true); |
34 | - } |
|
35 | - elseif($id_ally) |
|
33 | + } elseif($id_ally) |
|
36 | 34 | { |
37 | 35 | $ally = doquery("SELECT * FROM {{alliance}} WHERE id='{$id_ally}' LIMIT 1;", '', true); |
38 | 36 | } |
@@ -52,20 +50,17 @@ discard block |
||
52 | 50 | 'USER_ALLY_ID' => $user['ally_id'], |
53 | 51 | )); |
54 | 52 | $page_header = $lang['sys_alliance']; |
55 | -} |
|
56 | -else |
|
53 | +} else |
|
57 | 54 | { |
58 | 55 | $page_header = $lang['your_alliance']; |
59 | 56 | |
60 | 57 | if($ally['ally_owner'] == $user['id']) |
61 | 58 | { |
62 | 59 | $range = $ally['ally_owner_range'] ? $ally['ally_owner_range'] : $lang['Founder']; |
63 | - } |
|
64 | - elseif($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name'])) |
|
60 | + } elseif($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name'])) |
|
65 | 61 | { |
66 | 62 | $range = $ranks[$user['ally_rank_id']]['name']; |
67 | - } |
|
68 | - else |
|
63 | + } else |
|
69 | 64 | { |
70 | 65 | $range = $lang['member']; |
71 | 66 | } |
@@ -3,14 +3,14 @@ discard block |
||
3 | 3 | use Alliance\AllianceHelper; |
4 | 4 | use Alliance\DBStaticAlly; |
5 | 5 | |
6 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
6 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
7 | 7 | { |
8 | 8 | $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
9 | 9 | } |
10 | 10 | |
11 | 11 | $template = gettemplate('ali_info', true); |
12 | 12 | |
13 | -if($mode == 'exit') |
|
13 | +if ($mode == 'exit') |
|
14 | 14 | { |
15 | 15 | if ($ally['ally_owner'] == $user['id']) |
16 | 16 | { |
@@ -27,25 +27,25 @@ discard block |
||
27 | 27 | messageBox(sprintf($lang['ali_info_leave_success'], $ally['ally_name']), $lang['sys_alliance']); |
28 | 28 | } |
29 | 29 | } |
30 | -elseif($mode == 'ainfo') |
|
30 | +elseif ($mode == 'ainfo') |
|
31 | 31 | { |
32 | 32 | $tag = sys_get_param_str('tag'); |
33 | 33 | $id_ally = sys_get_param_id('a'); |
34 | - if($tag) |
|
34 | + if ($tag) |
|
35 | 35 | { |
36 | 36 | $ally = doquery("SELECT * FROM {{alliance}} WHERE ally_tag='{$tag}' LIMIT 1;", '', true); |
37 | 37 | } |
38 | - elseif($id_ally) |
|
38 | + elseif ($id_ally) |
|
39 | 39 | { |
40 | 40 | $ally = doquery("SELECT * FROM {{alliance}} WHERE id='{$id_ally}' LIMIT 1;", '', true); |
41 | 41 | } |
42 | 42 | |
43 | - if(!$ally) |
|
43 | + if (!$ally) |
|
44 | 44 | { |
45 | 45 | messageBox($lang['ali_sys_notFound'], $lang['Ally_info_1']); |
46 | 46 | } |
47 | 47 | |
48 | - if(!$ally['ally_description']) |
|
48 | + if (!$ally['ally_description']) |
|
49 | 49 | { |
50 | 50 | $ally['ally_description'] = $lang['Ally_nodescription']; |
51 | 51 | } |
@@ -54,17 +54,17 @@ discard block |
||
54 | 54 | 'EXTERNAL' => true, |
55 | 55 | 'USER_ALLY_ID' => $user['ally_id'], |
56 | 56 | )); |
57 | - $page_header = $lang['sys_alliance']; |
|
57 | + $page_header = $lang['sys_alliance']; |
|
58 | 58 | } |
59 | 59 | else |
60 | 60 | { |
61 | 61 | $page_header = $lang['your_alliance']; |
62 | 62 | |
63 | - if($ally['ally_owner'] == $user['id']) |
|
63 | + if ($ally['ally_owner'] == $user['id']) |
|
64 | 64 | { |
65 | 65 | $range = $ally['ally_owner_range'] ? $ally['ally_owner_range'] : $lang['Founder']; |
66 | 66 | } |
67 | - elseif($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name'])) |
|
67 | + elseif ($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name'])) |
|
68 | 68 | { |
69 | 69 | $range = $ranks[$user['ally_rank_id']]['name']; |
70 | 70 | } |
@@ -99,9 +99,9 @@ discard block |
||
99 | 99 | ]); |
100 | 100 | |
101 | 101 | $relations = ali_relations($ally['id']); |
102 | -foreach($relations as $relation) |
|
102 | +foreach ($relations as $relation) |
|
103 | 103 | { |
104 | - if($relation['alliance_diplomacy_contr_ally_id'] && $relation['alliance_diplomacy_ally_id']) |
|
104 | + if ($relation['alliance_diplomacy_contr_ally_id'] && $relation['alliance_diplomacy_ally_id']) |
|
105 | 105 | { |
106 | 106 | $template->assign_block_vars('relation', array( |
107 | 107 | 'NAME' => $relation['alliance_diplomacy_contr_ally_name'], |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | // Pretty Safe |
3 | 3 | // TODO: Add ally_tag to usertable |
4 | 4 | |
5 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
5 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
6 | 6 | { |
7 | 7 | $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
8 | 8 | } |
@@ -12,15 +12,15 @@ discard block |
||
12 | 12 | $ally_name_raw = sys_get_param_str_unsafe('name'); |
13 | 13 | $ally_name = db_escape($ally_name_raw); |
14 | 14 | |
15 | -if($ally_tag) |
|
15 | +if ($ally_tag) |
|
16 | 16 | { |
17 | - if(!$ally_name_raw || !$ally_tag_raw) |
|
17 | + if (!$ally_name_raw || !$ally_tag_raw) |
|
18 | 18 | { |
19 | 19 | messageBox($lang['have_not_name'], $lang['make_alliance']); |
20 | 20 | } |
21 | 21 | |
22 | 22 | $query = doquery("SELECT ally_tag FROM {{alliance}} WHERE `ally_tag` = '{$ally_tag}' or `ally_name` = '{$ally_name}' LIMIT 1;", true); |
23 | - if($query) |
|
23 | + if ($query) |
|
24 | 24 | { |
25 | 25 | messageBox(str_replace('%s', $query['ally_tag'] == $ally_tag_raw ? $ally_tag_raw : $ally_name_raw, $lang['always_exist']), $lang['make_alliance']); |
26 | 26 | } |
@@ -4,6 +4,6 @@ |
||
4 | 4 | |
5 | 5 | // header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found"); |
6 | 6 | // @header("{$serverProtocol} 200 OK"); |
7 | -echo "File {$redirectFrom} not found on server. Contact administration if you think that this is error"; |
|
7 | +echo "file {$redirectFrom} not found on server. Contact administration if you think that this is error"; |
|
8 | 8 | die(); |
9 | 9 | ?> */ |
@@ -18,17 +18,17 @@ discard block |
||
18 | 18 | |
19 | 19 | $sensorLevel = mrc_get_level($user, $planetrow, STRUC_MOON_PHALANX); |
20 | 20 | if (!intval($sensorLevel)) { |
21 | - messageBox ($lang['phalanx_nosensoravailable'], $lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
21 | + messageBox($lang['phalanx_nosensoravailable'], $lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | if ($planetrow['planet_type'] != PT_MOON) { |
25 | - messageBox ($lang['phalanx_onlyformoons'], $lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
25 | + messageBox($lang['phalanx_onlyformoons'], $lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | $scan_galaxy = sys_get_param_int('galaxy'); |
29 | 29 | $scan_system = sys_get_param_int('system'); |
30 | 30 | $scan_planet = sys_get_param_int('planet'); |
31 | -$scan_planet_type = 1; // sys_get_param_int('planettype'); |
|
31 | +$scan_planet_type = 1; // sys_get_param_int('planettype'); |
|
32 | 32 | $id = sys_get_param_id('id'); |
33 | 33 | |
34 | 34 | $source_galaxy = $planetrow['galaxy']; |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | $sensorRange = GetPhalanxRange($sensorLevel); |
39 | 39 | |
40 | 40 | $system_distance = abs($source_system - $scan_system); |
41 | -if($system_distance > $sensorRange || $scan_galaxy != $source_galaxy) |
|
41 | +if ($system_distance > $sensorRange || $scan_galaxy != $source_galaxy) |
|
42 | 42 | { |
43 | - messageBox ($lang['phalanx_rangeerror'], $lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
43 | + messageBox($lang['phalanx_rangeerror'], $lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | $cost = $sensorLevel * 1000; |
@@ -51,14 +51,14 @@ discard block |
||
51 | 51 | } |
52 | 52 | |
53 | 53 | $planet_scanned = DBStaticPlanet::db_planet_by_gspt($scan_galaxy, $scan_system, $scan_planet, $scan_planet_type); |
54 | -if(!$planet_scanned['id']) |
|
54 | +if (!$planet_scanned['id']) |
|
55 | 55 | { |
56 | 56 | messageBox($lang['phalanx_planet_not_exists'], $lang['tech'][STRUC_MOON_PHALANX], '', 3); |
57 | 57 | } |
58 | 58 | |
59 | -if($planet_scanned['destruyed']) |
|
59 | +if ($planet_scanned['destruyed']) |
|
60 | 60 | { |
61 | - messageBox ($lang['phalanx_planet_destroyed'], $lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
61 | + messageBox($lang['phalanx_planet_destroyed'], $lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | DBStaticPlanet::db_planet_set_by_id($user['current_planet'], "deuterium = deuterium - {$cost}"); |