@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
104 | - if(!isset($next)) { |
|
104 | + if (!isset($next)) { |
|
105 | 105 | $next = new TextEntity(); |
106 | 106 | } |
107 | 107 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $prev = $this->getById($currentText->prev); |
120 | 120 | } |
121 | 121 | |
122 | - if(!isset($prev)) { |
|
122 | + if (!isset($prev)) { |
|
123 | 123 | $prev = new TextEntity(); |
124 | 124 | } |
125 | 125 |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | * @return string |
339 | 339 | */ |
340 | 340 | protected function stringValue($value) { |
341 | - return "'" . $this->escape((string)$value) . "'"; |
|
341 | + return "'" . $this->escape((string) $value) . "'"; |
|
342 | 342 | } |
343 | 343 | |
344 | 344 | /** |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | * @return string |
350 | 350 | */ |
351 | 351 | public function quote($fieldName) { |
352 | - return "`" . $this->escape((string)$fieldName) . "`"; |
|
352 | + return "`" . $this->escape((string) $fieldName) . "`"; |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | /** |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | * @return string |
397 | 397 | */ |
398 | 398 | protected function quoteTable($tableName) { |
399 | - return "`{{" . $this->escape((string)$tableName) . "}}`"; |
|
399 | + return "`{{" . $this->escape((string) $tableName) . "}}`"; |
|
400 | 400 | } |
401 | 401 | |
402 | 402 | /** |
@@ -43,7 +43,7 @@ |
||
43 | 43 | */ |
44 | 44 | public function toArray() { |
45 | 45 | $tutorial = array(); |
46 | - foreach($this->keys() as $key) { |
|
46 | + foreach ($this->keys() as $key) { |
|
47 | 47 | $tutorial[$key] = $this->$key; |
48 | 48 | } |
49 | 49 |
@@ -7,9 +7,9 @@ |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -define('INSIDE' , true); |
|
11 | -define('INSTALL' , false); |
|
12 | -define('IN_ADMIN' , true); |
|
10 | +define('INSIDE', true); |
|
11 | +define('INSTALL', false); |
|
12 | +define('IN_ADMIN', true); |
|
13 | 13 | |
14 | 14 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
15 | 15 |
@@ -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'); |
@@ -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 | ?> */ |
@@ -13,7 +13,7 @@ |
||
13 | 13 | * @return mixed |
14 | 14 | * @deprecated |
15 | 15 | */ |
16 | -function RestoreFleetToPlanet(&$fleet_row, $start = true, $only_resources = false, $safe_fleet = false){return sn_function_call('RestoreFleetToPlanet', array(&$fleet_row, $start, $only_resources, $safe_fleet, &$result));} |
|
16 | +function RestoreFleetToPlanet(&$fleet_row, $start = true, $only_resources = false, $safe_fleet = false) {return sn_function_call('RestoreFleetToPlanet', array(&$fleet_row, $start, $only_resources, $safe_fleet, &$result)); } |
|
17 | 17 | /** |
18 | 18 | * @param array $fleet_row |
19 | 19 | * @param bool $start |
@@ -29,7 +29,7 @@ |
||
29 | 29 | */ |
30 | 30 | protected $_repository; |
31 | 31 | |
32 | - /** |
|
32 | + /** |
|
33 | 33 | * @var ContainerPlus $_oldRepo |
34 | 34 | */ |
35 | 35 | protected $_oldRepo; |
@@ -86,7 +86,7 @@ |
||
86 | 86 | |
87 | 87 | public function get($entityClass, $id) { |
88 | 88 | $entityIndex = get_class($entityClass) . '\\' . $id; |
89 | - if(!isset($this->_repository[$entityIndex])) { |
|
89 | + if (!isset($this->_repository[$entityIndex])) { |
|
90 | 90 | |
91 | 91 | } |
92 | 92 |
@@ -11,7 +11,7 @@ |
||
11 | 11 | class SnBootstrap { |
12 | 12 | |
13 | 13 | public static function install_benchmark() { |
14 | - register_shutdown_function(function () { |
|
14 | + register_shutdown_function(function() { |
|
15 | 15 | if (defined('IN_AJAX')) { |
16 | 16 | return; |
17 | 17 | } |