@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | |
44 | 44 | public function __clone() { |
45 | - if(static::$_clonable == ArrayAccessV2::CLONE_NONE) { |
|
45 | + if (static::$_clonable == ArrayAccessV2::CLONE_NONE) { |
|
46 | 46 | return; |
47 | 47 | } |
48 | 48 | |
@@ -50,10 +50,10 @@ discard block |
||
50 | 50 | } |
51 | 51 | |
52 | 52 | protected static function _deep_clone(&$array) { |
53 | - foreach($array as &$value) { |
|
54 | - if(is_object($value)) { |
|
53 | + foreach ($array as &$value) { |
|
54 | + if (is_object($value)) { |
|
55 | 55 | $value = clone $value; |
56 | - } elseif(is_array($value) && static::$_clonable == ArrayAccessV2::CLONE_DEEP) { |
|
56 | + } elseif (is_array($value) && static::$_clonable == ArrayAccessV2::CLONE_DEEP) { |
|
57 | 57 | static::_deep_clone($value); |
58 | 58 | } |
59 | 59 | } |
@@ -67,8 +67,8 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function __call($method_name, array $arguments) { |
69 | 69 | $object_first = reset($this->_container); |
70 | - if($object_first !== false && method_exists($object_first, $method_name)) { |
|
71 | - foreach($this->_container as $unit_id => $object) { |
|
70 | + if ($object_first !== false && method_exists($object_first, $method_name)) { |
|
71 | + foreach ($this->_container as $unit_id => $object) { |
|
72 | 72 | call_user_func_array(array($object, $method_name), $arguments); |
73 | 73 | } |
74 | 74 | } |
@@ -83,8 +83,8 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public function getSumProperty($property_name) { |
85 | 85 | $result = 0.0; |
86 | - foreach($this->_container as $object) { |
|
87 | - if(is_object($object) && property_exists($object, $property_name)) { |
|
86 | + foreach ($this->_container as $object) { |
|
87 | + if (is_object($object) && property_exists($object, $property_name)) { |
|
88 | 88 | $result += $object->$property_name; |
89 | 89 | } |
90 | 90 | } |
@@ -100,8 +100,8 @@ discard block |
||
100 | 100 | * @return mixed |
101 | 101 | */ |
102 | 102 | public function aggregateByMethod($method_name, &$result) { |
103 | - foreach($this->_container as $object) { |
|
104 | - if(is_object($object) && method_exists($object, $method_name)) { |
|
103 | + foreach ($this->_container as $object) { |
|
104 | + if (is_object($object) && method_exists($object, $method_name)) { |
|
105 | 105 | call_user_func(array($object, $method_name), $result); |
106 | 106 | } |
107 | 107 | } |
@@ -37,14 +37,14 @@ discard block |
||
37 | 37 | (!empty($where_safe) ? " WHERE {$where_safe}" : '') . |
38 | 38 | " FOR UPDATE;" |
39 | 39 | ); |
40 | - while($row = db_fetch($query)) { |
|
40 | + while ($row = db_fetch($query)) { |
|
41 | 41 | /** |
42 | 42 | * @var Fleet $fleet |
43 | 43 | */ |
44 | 44 | $fleet = $this->_createElement(); |
45 | 45 | $fleet->dbRowParse($row); |
46 | 46 | |
47 | - if(isset($this[$fleet->dbId])) { |
|
47 | + if (isset($this[$fleet->dbId])) { |
|
48 | 48 | // Нужно ли ???? |
49 | 49 | classSupernova::$debug->error('Fleet list already set'); |
50 | 50 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @return static |
171 | 171 | */ |
172 | 172 | public static function dbGetFleetListAndMissileByCoordinates($coordinates, $for_phalanx = false) { |
173 | - if(empty($coordinates) || !is_array($coordinates)) { |
|
173 | + if (empty($coordinates) || !is_array($coordinates)) { |
|
174 | 174 | return array(); |
175 | 175 | } |
176 | 176 | |
@@ -199,8 +199,8 @@ discard block |
||
199 | 199 | * @var Fleet[] $array_of_Fleet |
200 | 200 | */ |
201 | 201 | $array_of_Fleet = array(); |
202 | - if(!empty($fleet_db_list) && $fleet_db_list->count()) { |
|
203 | - foreach($fleet_db_list->_container as $fleet_id => $objFleet) { |
|
202 | + if (!empty($fleet_db_list) && $fleet_db_list->count()) { |
|
203 | + foreach ($fleet_db_list->_container as $fleet_id => $objFleet) { |
|
204 | 204 | $array_of_Fleet[$fleet_id] = $objFleet; |
205 | 205 | } |
206 | 206 | $planet_fleets = flt_get_fleets_to_planet_by_array_of_Fleet($array_of_Fleet); |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | "SELECT * FROM `{{iraks}}`" . |
250 | 250 | (!empty($where) ? " WHERE {$where}" : '') . |
251 | 251 | " FOR UPDATE;"); |
252 | - while($missile_db_row = db_fetch($query)) { |
|
252 | + while ($missile_db_row = db_fetch($query)) { |
|
253 | 253 | /** |
254 | 254 | * @var Fleet $objFleet |
255 | 255 | */ |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | */ |
272 | 272 | public static function dbGetFleetListAndMissileINCOMING($owner_id) { |
273 | 273 | $owner_id_safe = idval($owner_id); |
274 | - if(empty($owner_id_safe)) { |
|
274 | + if (empty($owner_id_safe)) { |
|
275 | 275 | return array(); |
276 | 276 | } |
277 | 277 | |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | */ |
306 | 306 | public static function fleet_count_flying($player_id, $mission_id = 0) { |
307 | 307 | $player_id_safe = idval($player_id); |
308 | - if(!empty($player_id_safe)) { |
|
308 | + if (!empty($player_id_safe)) { |
|
309 | 309 | $mission_id_safe = intval($mission_id); |
310 | 310 | $result = static::db_fleet_count( |
311 | 311 | "`fleet_owner` = {$player_id_safe}" . |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | public static function _init($group_name = '') { |
27 | 27 | parent::_init($group_name); |
28 | 28 | |
29 | - foreach(static::$_group_unit_id_list as $resource_id) { |
|
29 | + foreach (static::$_group_unit_id_list as $resource_id) { |
|
30 | 30 | static::$_group_pnames[$resource_id] = pname_resource_name($resource_id); |
31 | 31 | } |
32 | 32 | |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | |
49 | 49 | !is_array($resource_array) ? $resource_array = array() : false; |
50 | 50 | |
51 | - foreach($resource_array as $resource_id => $resource_actual_delta) { |
|
52 | - if(!$resource_actual_delta) { |
|
51 | + foreach ($resource_array as $resource_id => $resource_actual_delta) { |
|
52 | + if (!$resource_actual_delta) { |
|
53 | 53 | // No delta - no changes |
54 | 54 | continue; |
55 | 55 | } |
@@ -229,8 +229,8 @@ |
||
229 | 229 | public function calcColonyMaxCount($astrotech = -1) { |
230 | 230 | global $config; |
231 | 231 | |
232 | - if($astrotech == -1) { |
|
233 | - if(!isset($this->db_row[UNIT_PLAYER_COLONIES_MAX])) { |
|
232 | + if ($astrotech == -1) { |
|
233 | + if (!isset($this->db_row[UNIT_PLAYER_COLONIES_MAX])) { |
|
234 | 234 | |
235 | 235 | $expeditions = get_player_max_expeditons($this->db_row); |
236 | 236 | $astrotech = mrc_get_level($this->db_row, false, TECH_ASTROTECH); |
@@ -23,7 +23,7 @@ |
||
23 | 23 | * @version 41a6.16 |
24 | 24 | */ |
25 | 25 | protected function db_load_player_by_id($player_id) { |
26 | - if(isset($this[$player_id])) { |
|
26 | + if (isset($this[$player_id])) { |
|
27 | 27 | return; |
28 | 28 | } |
29 | 29 |
@@ -30,11 +30,11 @@ discard block |
||
30 | 30 | |
31 | 31 | static $need_keys = array('server', 'user', 'pass', 'name', 'prefix'); |
32 | 32 | |
33 | - if($this->connected) { |
|
33 | + if ($this->connected) { |
|
34 | 34 | return true; |
35 | 35 | } |
36 | 36 | |
37 | - if(empty($settings) || !is_array($settings) || array_intersect($need_keys, array_keys($settings)) != $need_keys) { |
|
37 | + if (empty($settings) || !is_array($settings) || array_intersect($need_keys, array_keys($settings)) != $need_keys) { |
|
38 | 38 | $debug->error_fatal('There is missconfiguration in your config.php. Check it again'); |
39 | 39 | } |
40 | 40 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | return mysqli_real_escape_string($this->link, $unescaped_string); |
91 | 91 | } |
92 | 92 | function mysql_close_link() { |
93 | - if(is_object($this->link)) { |
|
93 | + if (is_object($this->link)) { |
|
94 | 94 | $this->link->close(); |
95 | 95 | $this->connected = false; |
96 | 96 | unset($this->link); |
@@ -154,15 +154,15 @@ discard block |
||
154 | 154 | * @param string $group_name |
155 | 155 | */ |
156 | 156 | public static function _init($group_name = '') { |
157 | - if(static::$_is_static_init) { |
|
157 | + if (static::$_is_static_init) { |
|
158 | 158 | return; |
159 | 159 | } |
160 | 160 | |
161 | - if($group_name) { |
|
161 | + if ($group_name) { |
|
162 | 162 | static::$_sn_group_name = $group_name; |
163 | 163 | } |
164 | 164 | |
165 | - if(static::$_sn_group_name) { |
|
165 | + if (static::$_sn_group_name) { |
|
166 | 166 | static::$_group_unit_id_list = sn_get_groups(static::$_sn_group_name); |
167 | 167 | empty(static::$_group_unit_id_list) ? static::$_group_unit_id_list = array() : false; |
168 | 168 | } |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | // TODO - Reset combat stats?? |
188 | 188 | $this->_unitId = $unitId; |
189 | 189 | |
190 | - if($this->_unitId) { |
|
190 | + if ($this->_unitId) { |
|
191 | 191 | $this->info = get_unit_param($this->_unitId); |
192 | 192 | $this->_type = $this->info[P_UNIT_TYPE]; |
193 | 193 | } else { |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | |
199 | 199 | protected function setCount($value) { |
200 | 200 | // TODO - Reset combat stats?? |
201 | - if($value < 0) { |
|
201 | + if ($value < 0) { |
|
202 | 202 | classSupernova::$debug->error('Can not set Unit::$count to negative value'); |
203 | 203 | } |
204 | 204 | $this->_count = $value; |
@@ -411,7 +411,7 @@ |
||
411 | 411 | /** |
412 | 412 | * @param array $field_set |
413 | 413 | * |
414 | - * @return int|string |
|
414 | + * @return integer |
|
415 | 415 | */ |
416 | 416 | protected function db_field_set_create(array $field_set) { |
417 | 417 | !sn_db_field_set_is_safe($field_set) ? $field_set = sn_db_field_set_make_safe($field_set) : false; |
@@ -138,14 +138,14 @@ discard block |
||
138 | 138 | |
139 | 139 | // If method is not getter or setter OR property name not exists in $_properties - raising exception |
140 | 140 | // Descendants can catch this Exception to make own __call magic |
141 | - if(($left3 != 'get' && $left3 != 'set') || empty(static::$_properties[$propertyName])) { |
|
141 | + if (($left3 != 'get' && $left3 != 'set') || empty(static::$_properties[$propertyName])) { |
|
142 | 142 | throw new ExceptionPropertyNotExists('Property ' . $propertyName . ' not exists when calling getter/setter ' . get_called_class() . '::' . $name, ERR_ERROR); |
143 | 143 | } |
144 | 144 | |
145 | 145 | // TODO check for read-only |
146 | 146 | |
147 | - if($left3 == 'set') { |
|
148 | - if(!empty($this->propertiesAdjusted[$propertyName])) { |
|
147 | + if ($left3 == 'set') { |
|
148 | + if (!empty($this->propertiesAdjusted[$propertyName])) { |
|
149 | 149 | throw new PropertyAccessException('Property ' . $propertyName . ' already was adjusted so no SET is possible until dbSave in ' . get_called_class() . '::' . $name, ERR_ERROR); |
150 | 150 | } |
151 | 151 | $this->propertiesChanged[$propertyName] = 1; |
@@ -154,13 +154,13 @@ discard block |
||
154 | 154 | // Now deciding - will we call a protected setter or will we work with protected property |
155 | 155 | |
156 | 156 | // If method exists - just calling it |
157 | - if(method_exists($this, $name)) { |
|
157 | + if (method_exists($this, $name)) { |
|
158 | 158 | return call_user_func_array(array($this, $name), $arguments); |
159 | 159 | } |
160 | 160 | // No getter/setter exists - works directly with protected property |
161 | 161 | |
162 | 162 | // Is it getter? |
163 | - if($left3 === 'get') { |
|
163 | + if ($left3 === 'get') { |
|
164 | 164 | return $this->{'_' . $propertyName}; |
165 | 165 | } |
166 | 166 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | */ |
183 | 183 | public function dbLoad($dbId, $lockSkip = false) { |
184 | 184 | $dbId = idval($dbId); |
185 | - if($dbId <= 0) { |
|
185 | + if ($dbId <= 0) { |
|
186 | 186 | classSupernova::$debug->error(get_called_class() . '::dbLoad $dbId not positive = ' . $dbId); |
187 | 187 | |
188 | 188 | return; |
@@ -191,12 +191,12 @@ discard block |
||
191 | 191 | $this->_dbId = $dbId; |
192 | 192 | $this->lockSkip = $lockSkip; |
193 | 193 | // TODO - Use classSupernova::$db_records_locked |
194 | - if(false && !$lockSkip && sn_db_transaction_check(false)) { |
|
194 | + if (false && !$lockSkip && sn_db_transaction_check(false)) { |
|
195 | 195 | $this->dbGetLockById($this->_dbId); |
196 | 196 | } |
197 | 197 | |
198 | 198 | $db_row = doquery("SELECT * FROM `{{" . static::$_table . "}}` WHERE `" . static::$_dbIdFieldName . "` = " . $this->_dbId . " LIMIT 1 FOR UPDATE;", true); |
199 | - if(empty($db_row)) { |
|
199 | + if (empty($db_row)) { |
|
200 | 200 | return; |
201 | 201 | } |
202 | 202 | |
@@ -224,26 +224,26 @@ discard block |
||
224 | 224 | */ |
225 | 225 | // TODO - perform operations only if properties was changed |
226 | 226 | public function dbSave() { |
227 | - if($this->isNew()) { |
|
227 | + if ($this->isNew()) { |
|
228 | 228 | // No DB_ID - new unit |
229 | - if($this->isEmpty()) { |
|
229 | + if ($this->isEmpty()) { |
|
230 | 230 | classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - object is empty on ' . get_called_class() . '::dbSave'); |
231 | 231 | } |
232 | 232 | $this->dbInsert(); |
233 | 233 | } else { |
234 | 234 | // DB_ID is present |
235 | - if($this->isEmpty()) { |
|
235 | + if ($this->isEmpty()) { |
|
236 | 236 | $this->dbDelete(); |
237 | 237 | } else { |
238 | - if(!sn_db_transaction_check(false)) { |
|
238 | + if (!sn_db_transaction_check(false)) { |
|
239 | 239 | classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - transaction should always be started on ' . get_called_class() . '::dbUpdate'); |
240 | 240 | } |
241 | 241 | $this->dbUpdate(); |
242 | 242 | } |
243 | 243 | } |
244 | 244 | |
245 | - if(!empty($this->triggerDbOperationOn)) { |
|
246 | - foreach($this->triggerDbOperationOn as $item) { |
|
245 | + if (!empty($this->triggerDbOperationOn)) { |
|
246 | + foreach ($this->triggerDbOperationOn as $item) { |
|
247 | 247 | $item->dbSave(); |
248 | 248 | } |
249 | 249 | } |
@@ -263,12 +263,12 @@ discard block |
||
263 | 263 | */ |
264 | 264 | // TODO - protected |
265 | 265 | public function dbInsert() { |
266 | - if(!$this->isNew()) { |
|
266 | + if (!$this->isNew()) { |
|
267 | 267 | classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - record db_id is not empty on ' . get_called_class() . '::dbInsert'); |
268 | 268 | } |
269 | 269 | $this->_dbId = $this->db_field_set_create($this->dbMakeFieldSet()); |
270 | 270 | |
271 | - if(empty($this->_dbId)) { |
|
271 | + if (empty($this->_dbId)) { |
|
272 | 272 | classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - error saving record ' . get_called_class() . '::dbInsert'); |
273 | 273 | } |
274 | 274 | |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | // TODO - protected |
282 | 282 | public function dbUpdate() { |
283 | 283 | // TODO - Update |
284 | - if($this->isNew()) { |
|
284 | + if ($this->isNew()) { |
|
285 | 285 | classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - unit db_id is empty on dbUpdate'); |
286 | 286 | } |
287 | 287 | $this->db_field_update($this->dbMakeFieldSet(true)); |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | */ |
293 | 293 | // TODO - protected |
294 | 294 | public function dbDelete() { |
295 | - if($this->isNew()) { |
|
295 | + if ($this->isNew()) { |
|
296 | 296 | classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - unit db_id is empty on dbDelete'); |
297 | 297 | } |
298 | 298 | doquery("DELETE FROM {{" . static::$_table . "}} WHERE `" . static::$_dbIdFieldName . "` = " . $this->_dbId); |
@@ -334,18 +334,18 @@ discard block |
||
334 | 334 | * @param array $db_row |
335 | 335 | */ |
336 | 336 | public function dbRowParse(array $db_row) { |
337 | - foreach(static::$_properties as $property_name => &$property_data) { |
|
337 | + foreach (static::$_properties as $property_name => &$property_data) { |
|
338 | 338 | // Advanced values extraction procedure. Should be used when at least one of following rules is matched: |
339 | 339 | // - one field should translate to several properties; |
340 | 340 | // - one property should be filled according to several fields; |
341 | 341 | // - property filling requires some lookup in object values; |
342 | - if(!empty($property_data[P_METHOD_EXTRACT]) && is_callable(array($this, $property_data[P_METHOD_EXTRACT]))) { |
|
342 | + if (!empty($property_data[P_METHOD_EXTRACT]) && is_callable(array($this, $property_data[P_METHOD_EXTRACT]))) { |
|
343 | 343 | call_user_func_array(array($this, $property_data[P_METHOD_EXTRACT]), array(&$db_row)); |
344 | 344 | continue; |
345 | 345 | } |
346 | 346 | |
347 | 347 | // If property is read-only - doing nothing |
348 | - if(!empty($property_data[P_READ_ONLY])) { |
|
348 | + if (!empty($property_data[P_READ_ONLY])) { |
|
349 | 349 | continue; |
350 | 350 | } |
351 | 351 | |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | !empty($property_data[P_FUNC_INPUT]) && is_callable($property_data[P_FUNC_INPUT]) ? $value = call_user_func($property_data[P_FUNC_INPUT], $value) : false; |
357 | 357 | |
358 | 358 | // If there is setter for this field - using it. Setters is always a methods of $THIS |
359 | - if(!empty($property_data[P_METHOD_SET]) && is_callable(array($this, $property_data[P_METHOD_SET]))) { |
|
359 | + if (!empty($property_data[P_METHOD_SET]) && is_callable(array($this, $property_data[P_METHOD_SET]))) { |
|
360 | 360 | call_user_func(array($this, $property_data[P_METHOD_SET]), $value); |
361 | 361 | } else { |
362 | 362 | $this->{$property_name} = $value; |
@@ -372,21 +372,21 @@ discard block |
||
372 | 372 | protected function dbMakeFieldSet($isUpdate = false) { |
373 | 373 | $array = array(); |
374 | 374 | |
375 | - foreach(static::$_properties as $property_name => &$property_data) { |
|
375 | + foreach (static::$_properties as $property_name => &$property_data) { |
|
376 | 376 | // TODO - on isUpdate add only changed/adjusted properties |
377 | 377 | |
378 | - if(!empty($property_data[P_METHOD_INJECT]) && is_callable(array($this, $property_data[P_METHOD_INJECT]))) { |
|
378 | + if (!empty($property_data[P_METHOD_INJECT]) && is_callable(array($this, $property_data[P_METHOD_INJECT]))) { |
|
379 | 379 | call_user_func_array(array($this, $property_data[P_METHOD_INJECT]), array(&$array)); |
380 | 380 | continue; |
381 | 381 | } |
382 | 382 | |
383 | 383 | // Skipping properties which have no corresponding field in DB |
384 | - if(empty($property_data[P_DB_FIELD])) { |
|
384 | + if (empty($property_data[P_DB_FIELD])) { |
|
385 | 385 | continue; |
386 | 386 | } |
387 | 387 | |
388 | 388 | // Checking - is property was adjusted or changed |
389 | - if($isUpdate && array_key_exists($property_name, $this->propertiesAdjusted)) { |
|
389 | + if ($isUpdate && array_key_exists($property_name, $this->propertiesAdjusted)) { |
|
390 | 390 | // For adjusted property - take value from propertiesAdjusted array |
391 | 391 | // TODO - differ how treated conversion to string for changed and adjusted properties |
392 | 392 | $value = $this->propertiesAdjusted[$property_name]; |
@@ -416,17 +416,17 @@ discard block |
||
416 | 416 | */ |
417 | 417 | protected function isFieldChanged($fieldName) { |
418 | 418 | $isFieldChanged = false; |
419 | - foreach($this->propertiesChanged as $propertyName => $cork) { |
|
419 | + foreach ($this->propertiesChanged as $propertyName => $cork) { |
|
420 | 420 | $propertyScheme = static::$_properties[$propertyName]; |
421 | - if(!empty($propertyScheme[P_DB_FIELDS_LINKED])) { |
|
422 | - foreach($propertyScheme[P_DB_FIELDS_LINKED] as $linkedFieldName) { |
|
423 | - if($linkedFieldName == $fieldName) { |
|
421 | + if (!empty($propertyScheme[P_DB_FIELDS_LINKED])) { |
|
422 | + foreach ($propertyScheme[P_DB_FIELDS_LINKED] as $linkedFieldName) { |
|
423 | + if ($linkedFieldName == $fieldName) { |
|
424 | 424 | $isFieldChanged = $propertyName; |
425 | 425 | break 2; |
426 | 426 | } |
427 | 427 | } |
428 | 428 | } |
429 | - if(!empty($propertyScheme[P_DB_FIELD]) && $propertyScheme[P_DB_FIELD] == $fieldName) { |
|
429 | + if (!empty($propertyScheme[P_DB_FIELD]) && $propertyScheme[P_DB_FIELD] == $fieldName) { |
|
430 | 430 | $isFieldChanged = $propertyName; |
431 | 431 | break; |
432 | 432 | } |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | $fields = implode(',', array_keys($field_set)); |
449 | 449 | |
450 | 450 | $result = 0; |
451 | - if(classSupernova::db_query("INSERT INTO `{{" . static::$_table . "}}` ({$fields}) VALUES ({$values});")) { |
|
451 | + if (classSupernova::db_query("INSERT INTO `{{" . static::$_table . "}}` ({$fields}) VALUES ({$values});")) { |
|
452 | 452 | $result = db_insert_id(); |
453 | 453 | } |
454 | 454 | |
@@ -466,13 +466,13 @@ discard block |
||
466 | 466 | sn_db_field_set_safe_flag_clear($field_set); |
467 | 467 | |
468 | 468 | $set = array(); |
469 | - foreach($field_set as $fieldName => $value) { |
|
470 | - if(!($changedProperty = $this->isFieldChanged($fieldName))) { |
|
469 | + foreach ($field_set as $fieldName => $value) { |
|
470 | + if (!($changedProperty = $this->isFieldChanged($fieldName))) { |
|
471 | 471 | continue; |
472 | 472 | } |
473 | 473 | |
474 | 474 | // TODO - separate sets from adjusts |
475 | - if(array_key_exists($changedProperty, $this->propertiesAdjusted)) { |
|
475 | + if (array_key_exists($changedProperty, $this->propertiesAdjusted)) { |
|
476 | 476 | $value = "`{$fieldName}` + ($value)"; // braces for negative values |
477 | 477 | } |
478 | 478 |
@@ -20,14 +20,14 @@ discard block |
||
20 | 20 | $TargetAddress = sprintf($lang['sys_adress_planet'], $fleet_end_coordinates['galaxy'], $fleet_end_coordinates['system'], $fleet_end_coordinates['planet']); |
21 | 21 | |
22 | 22 | $TheMessage = $lang['sys_colo_no_colonizer']; |
23 | - if($objFleet->shipsGetTotalById(SHIP_COLONIZER) >= 1) { |
|
23 | + if ($objFleet->shipsGetTotalById(SHIP_COLONIZER) >= 1) { |
|
24 | 24 | $TheMessage = $lang['sys_colo_notfree']; |
25 | - if(empty($mission_data->dst_planet)) { |
|
25 | + if (empty($mission_data->dst_planet)) { |
|
26 | 26 | $iPlanetCount = get_player_current_colonies($src_user_row); |
27 | 27 | |
28 | 28 | // Can we colonize more planets? |
29 | 29 | $TheMessage = $lang['sys_colo_maxcolo']; |
30 | - if($iPlanetCount < get_player_max_colonies($src_user_row)) { |
|
30 | + if ($iPlanetCount < get_player_max_colonies($src_user_row)) { |
|
31 | 31 | // Yes, we can colonize |
32 | 32 | $TheMessage = $lang['sys_colo_badpos']; |
33 | 33 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $fleet_end_coordinates['galaxy'], $fleet_end_coordinates['system'], $fleet_end_coordinates['planet'], |
36 | 36 | $objFleet->playerOwnerId, "{$lang['sys_colo_defaultname']} {$iPlanetCount}", false, |
37 | 37 | array('user_row' => $src_user_row)); |
38 | - if($NewOwnerPlanet) { |
|
38 | + if ($NewOwnerPlanet) { |
|
39 | 39 | $TheMessage = $lang['sys_colo_arrival'] . $TargetAddress . $lang['sys_colo_allisok']; |
40 | 40 | msg_send_simple_message($objFleet->playerOwnerId, '', $objFleet->time_arrive_to_target, MSG_TYPE_SPY, $lang['sys_colo_mess_from'], $lang['sys_colo_mess_report'], $TheMessage); |
41 | 41 |