Completed
Push — work-fleets ( 961997...006942 )
by SuperNova.WS
06:22
created
overview.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 use DBStatic\DBStaticPlanet;
34 34
 use DBStatic\DBStaticUser;
35 35
 
36
-include('common.' . substr(strrchr(__FILE__, '.'), 1));
36
+include('common.'.substr(strrchr(__FILE__, '.'), 1));
37 37
 
38 38
 //$ccc = 0;
39 39
 //foreach(DBStatic\DBStaticUser::db_user_list_non_bots() as $ip) {
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
 $result = array();
54 54
 
55
-switch($mode = sys_get_param_str('mode')) {
55
+switch ($mode = sys_get_param_str('mode')) {
56 56
   case 'manage':
57 57
     sn_sys_sector_buy('overview.php?mode=manage');
58 58
 
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     $template  = gettemplate('planet_manage', true);
63 63
     $planet_id = sys_get_param_id('planet_id');
64 64
 
65
-    if(sys_get_param_str('rename') && ($new_name_unsafe = sys_get_param_str_unsafe('new_name'))) {
65
+    if (sys_get_param_str('rename') && ($new_name_unsafe = sys_get_param_str_unsafe('new_name'))) {
66 66
       $planetrow['name'] = $new_name_unsafe;
67 67
       DBStaticPlanet::db_planet_update_set_by_id(
68 68
         $planetrow['id'],
@@ -70,21 +70,21 @@  discard block
 block discarded – undo
70 70
           'name' => $new_name_unsafe,
71 71
         )
72 72
       );
73
-    } elseif(sys_get_param_str('action') == 'make_capital') {
73
+    } elseif (sys_get_param_str('action') == 'make_capital') {
74 74
       try {
75 75
         sn_db_transaction_start();
76 76
         $user = DBStaticUser::db_user_by_id($user['id'], true, '*');
77 77
         $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true, '*');
78 78
 
79
-        if($planetrow['planet_type'] != PT_PLANET) {
79
+        if ($planetrow['planet_type'] != PT_PLANET) {
80 80
           throw new exception(classLocale::$lang['ov_capital_err_not_a_planet'], ERR_ERROR);
81 81
         }
82 82
 
83
-        if($planetrow['id'] == $user['id_planet']) {
83
+        if ($planetrow['id'] == $user['id_planet']) {
84 84
           throw new exception(classLocale::$lang['ov_capital_err_capital_already'], ERR_ERROR);
85 85
         }
86 86
 
87
-        if($user_dark_matter < classSupernova::$config->planet_capital_cost) {
87
+        if ($user_dark_matter < classSupernova::$config->planet_capital_cost) {
88 88
           throw new exception(classLocale::$lang['ov_capital_err_no_dark_matter'], ERR_ERROR);
89 89
         }
90 90
 
@@ -109,16 +109,16 @@  discard block
 block discarded – undo
109 109
         );
110 110
         sn_db_transaction_commit();
111 111
         sys_redirect('overview.php?mode=manage');
112
-      } catch(exception $e) {
112
+      } catch (exception $e) {
113 113
         sn_db_transaction_rollback();
114 114
         $result[] = array(
115 115
           'STATUS'  => $e->getCode(),
116 116
           'MESSAGE' => $e->getMessage(),
117 117
         );
118 118
       }
119
-    } elseif(sys_get_param_str('action') == 'planet_teleport') {
119
+    } elseif (sys_get_param_str('action') == 'planet_teleport') {
120 120
       try {
121
-        if(!uni_coordinates_valid($new_coordinates = array(
121
+        if (!uni_coordinates_valid($new_coordinates = array(
122 122
           'galaxy' => sys_get_param_int('new_galaxy'),
123 123
           'system' => sys_get_param_int('new_system'),
124 124
           'planet' => sys_get_param_int('new_planet')))
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 //        $planetrow = $global_data['planet'];
136 136
 
137 137
         $can_teleport = uni_planet_teleport_check($user, $planetrow, $new_coordinates);
138
-        if($can_teleport['result'] != ERR_NONE) {
138
+        if ($can_teleport['result'] != ERR_NONE) {
139 139
           throw new exception($can_teleport['message'], $can_teleport['result']);
140 140
         }
141 141
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
           array()
155 155
         );
156 156
 
157
-        if($planetrow['id'] == $user['id_planet']) {
157
+        if ($planetrow['id'] == $user['id_planet']) {
158 158
           DBStaticUser::db_user_set_by_id(
159 159
             $user['id'],
160 160
             array(
@@ -174,17 +174,17 @@  discard block
 block discarded – undo
174 174
           'MESSAGE' => classLocale::$lang['ov_teleport_err_none'],
175 175
         );
176 176
         sys_redirect('overview.php?mode=manage');
177
-      } catch(exception $e) {
177
+      } catch (exception $e) {
178 178
         sn_db_transaction_rollback();
179 179
         $result[] = array(
180 180
           'STATUS'  => $e->getCode(),
181 181
           'MESSAGE' => $e->getMessage(),
182 182
         );
183 183
       }
184
-    } elseif(sys_get_param_str('action') == 'planet_abandon') {
184
+    } elseif (sys_get_param_str('action') == 'planet_abandon') {
185 185
       // if(sec_password_check($user['id'], sys_get_param('abandon_confirm'))) {
186
-      if(classSupernova::$auth->password_check(sys_get_param('abandon_confirm'))) {
187
-        if($user['id_planet'] != $user['current_planet'] && $user['current_planet'] == $planet_id) {
186
+      if (classSupernova::$auth->password_check(sys_get_param('abandon_confirm'))) {
187
+        if ($user['id_planet'] != $user['current_planet'] && $user['current_planet'] == $planet_id) {
188 188
           $destroyed = SN_TIME_NOW + 60 * 60 * 24;
189 189
           DBStaticPlanet::db_planet_update_set_by_id(
190 190
             $user['current_planet'],
@@ -210,9 +210,9 @@  discard block
 block discarded – undo
210 210
           message(classLocale::$lang['ov_delete_wrong_planet'], classLocale::$lang['colony_abandon'], 'overview.php?mode=manage');
211 211
         }
212 212
       } else {
213
-        message(classLocale::$lang['ov_delete_wrong_pass'] , classLocale::$lang['colony_abandon'], 'overview.php?mode=manage');
213
+        message(classLocale::$lang['ov_delete_wrong_pass'], classLocale::$lang['colony_abandon'], 'overview.php?mode=manage');
214 214
       }
215
-    } elseif(
215
+    } elseif (
216 216
       ($hire = sys_get_param_int('hire')) && in_array($hire, sn_get_groups('governors'))
217 217
       && (
218 218
         !get_unit_param($hire, P_MAX_STACK) ||
@@ -227,8 +227,8 @@  discard block
 block discarded – undo
227 227
       $user = DBStaticUser::db_user_by_id($user['id'], true);
228 228
       $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true);
229 229
       $build_data = eco_get_build_data($user, $planetrow, $hire, $planetrow['PLANET_GOVERNOR_ID'] == $hire ? $planetrow['PLANET_GOVERNOR_LEVEL'] : 0);
230
-      if($build_data['CAN'][BUILD_CREATE]) {
231
-        if($planetrow['PLANET_GOVERNOR_ID'] == $hire) {
230
+      if ($build_data['CAN'][BUILD_CREATE]) {
231
+        if ($planetrow['PLANET_GOVERNOR_ID'] == $hire) {
232 232
           $planetrow['PLANET_GOVERNOR_LEVEL']++;
233 233
         } else {
234 234
           $planetrow['PLANET_GOVERNOR_LEVEL'] = 1;
@@ -260,8 +260,8 @@  discard block
 block discarded – undo
260 260
 
261 261
     lng_include('mrc_mercenary');
262 262
     int_planet_pretemplate($planetrow, $template);
263
-    foreach(sn_get_groups('governors') as $governor_id) {
264
-      if($planetrow['planet_type'] == PT_MOON && $governor_id == MRC_TECHNOLOGIST) {
263
+    foreach (sn_get_groups('governors') as $governor_id) {
264
+      if ($planetrow['planet_type'] == PT_MOON && $governor_id == MRC_TECHNOLOGIST) {
265 265
         continue;
266 266
       }
267 267
 
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
       'PAGE_HINT'   => classLocale::$lang['ov_manage_page_hint'],
314 314
     ));
315 315
 
316
-    foreach($result as &$a_result) {
316
+    foreach ($result as &$a_result) {
317 317
       $template->assign_block_vars('result', $a_result);
318 318
     }
319 319
 
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
   default:
324 324
     sn_sys_sector_buy();
325 325
 
326
-    if(sys_get_param_str('rename') && $new_name_unsafe = sys_get_param_str_unsafe('new_name')) {
326
+    if (sys_get_param_str('rename') && $new_name_unsafe = sys_get_param_str_unsafe('new_name')) {
327 327
       $planetrow['name'] = $new_name_unsafe;
328 328
       DBStaticPlanet::db_planet_update_set_by_id(
329 329
         $planetrow['id'],
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 
359 359
     $planet_count = 0;
360 360
     $planets_query = DBStaticPlanet::db_planet_list_sorted($user, false, '*');
361
-    foreach($planets_query as $an_id => $UserPlanet) {
361
+    foreach ($planets_query as $an_id => $UserPlanet) {
362 362
       sn_db_transaction_start();
363 363
       $UserPlanet = sys_o_get_updated($user, $UserPlanet['id'], SN_TIME_NOW, false, true);
364 364
       sn_db_transaction_commit();
@@ -369,16 +369,16 @@  discard block
 block discarded – undo
369 369
 
370 370
       $planet_fleet_id = 0;
371 371
       $fleet_list = $template_planet['fleet_list'];
372
-      if($fleet_list['own']['count']) {
372
+      if ($fleet_list['own']['count']) {
373 373
         $planet_fleet_id = "p{$UserPlanet['id']}";
374 374
         $fleets_to_planet[$UserPlanet['id']] = tpl_parse_fleet_sn($fleet_list['own']['total'], $planet_fleet_id);
375 375
 //        $fleet_id++;tpl_parse_fleet_sn
376 376
       }
377
-      if($UserPlanet['planet_type'] == PT_MOON) {
377
+      if ($UserPlanet['planet_type'] == PT_MOON) {
378 378
         continue;
379 379
       }
380 380
       $moon = DBStaticPlanet::db_planet_by_parent($UserPlanet['id']);
381
-      if($moon) {
381
+      if ($moon) {
382 382
         $moon_fill = min(100, floor($moon['field_current'] / eco_planet_fields_max($moon) * 100));
383 383
       } else {
384 384
         $moon_fill = 0;
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
     tpl_assign_fleet($template, $fleets);
419 419
 
420 420
     $lune = $planetrow['planet_type'] == PT_PLANET ? DBStaticPlanet::db_planet_by_parent($planetrow['id']) : DBStaticPlanet::db_planet_by_id($planetrow['parent_planet']);
421
-    if($lune) {
421
+    if ($lune) {
422 422
       $template->assign_vars(array(
423 423
         'MOON_ID' => $lune['id'],
424 424
         'MOON_IMG' => $lune['image'],
@@ -430,15 +430,15 @@  discard block
 block discarded – undo
430 430
     $planet_fill = $planet_fill > 100 ? 100 : $planet_fill;
431 431
 
432 432
     $planet_recyclers_orbiting = 0;
433
-    foreach(classSupernova::$gc->groupRecyclers as $recycler_id) {
433
+    foreach (classSupernova::$gc->groupRecyclers as $recycler_id) {
434 434
       $planet_recyclers_orbiting += mrc_get_level($user, $planetrow, $recycler_id);
435 435
     }
436 436
 
437 437
     int_planet_pretemplate($planetrow, $template);
438 438
 
439 439
     $sn_group_ques = sn_get_groups('ques');
440
-    if(!defined('GAME_STRUCTURES_DISABLED') || !GAME_STRUCTURES_DISABLED) {
441
-      foreach(array(QUE_STRUCTURES => $sn_group_ques[QUE_STRUCTURES]) as $que_id => $que_type_data) {
440
+    if (!defined('GAME_STRUCTURES_DISABLED') || !GAME_STRUCTURES_DISABLED) {
441
+      foreach (array(QUE_STRUCTURES => $sn_group_ques[QUE_STRUCTURES]) as $que_id => $que_type_data) {
442 442
         $this_que = $que['ques'][$que_id][$user['id']][$planetrow['id']];
443 443
         $template->assign_block_vars('ques', array(
444 444
           'ID'     => $que_id,
@@ -446,8 +446,8 @@  discard block
 block discarded – undo
446 446
           'LENGTH' => empty($this_que) ? 0 : count($this_que),
447 447
         ));
448 448
 
449
-        if(!empty($this_que)) {
450
-          foreach($this_que as $que_item) {
449
+        if (!empty($this_que)) {
450
+          foreach ($this_que as $que_item) {
451 451
             $template->assign_block_vars('que', que_tpl_parse_element($que_item));
452 452
           }
453 453
         }
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
       'LENGTH' => $que_hangar_length,
462 462
     ));
463 463
 
464
-    if(!defined('GAME_DEFENSE_DISABLED') || !GAME_DEFENSE_DISABLED) {
464
+    if (!defined('GAME_DEFENSE_DISABLED') || !GAME_DEFENSE_DISABLED) {
465 465
       $que_hangar_length = tpl_assign_hangar($template, $planetrow, SUBQUE_DEFENSE);
466 466
       $template->assign_block_vars('ques', array(
467 467
         'ID'     => SUBQUE_DEFENSE,
@@ -473,12 +473,12 @@  discard block
 block discarded – undo
473 473
     $overview_planet_rows = $user['opt_int_overview_planet_rows'];
474 474
     $overview_planet_columns = $user['opt_int_overview_planet_columns'];
475 475
 
476
-    if($overview_planet_rows <= 0 && $overview_planet_columns <= 0) {
476
+    if ($overview_planet_rows <= 0 && $overview_planet_columns <= 0) {
477 477
       $overview_planet_rows = $user_option_list[OPT_INTERFACE]['opt_int_overview_planet_rows'];
478 478
       $overview_planet_columns = $user_option_list[OPT_INTERFACE]['opt_int_overview_planet_columns'];
479 479
     }
480 480
 
481
-    if($overview_planet_rows > 0 && $overview_planet_columns <= 0) {
481
+    if ($overview_planet_rows > 0 && $overview_planet_columns <= 0) {
482 482
       $overview_planet_columns = ceil($planet_count / $overview_planet_rows);
483 483
     }
484 484
 
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
     ));
536 536
     tpl_set_resource_info($template, $planetrow, $fleets_to_planet, 2);
537 537
 
538
-    foreach($result as &$a_result) {
538
+    foreach ($result as &$a_result) {
539 539
       $template->assign_block_vars('result', $a_result);
540 540
     }
541 541
 
Please login to merge, or discard this patch.
galaxy.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 use DBStatic\DBStaticUser;
12 12
 use Vector\Vector;
13 13
 
14
-include('common.' . substr(strrchr(__FILE__, '.'), 1));
14
+include('common.'.substr(strrchr(__FILE__, '.'), 1));
15 15
 
16 16
 lng_include('universe');
17 17
 lng_include('stat');
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 $uni_system = sys_get_param_int('system', $planetrow['system']);
22 22
 $planet = sys_get_param_int('planet', $planetrow['planet']);
23 23
 
24
-if($mode == 'name') {
24
+if ($mode == 'name') {
25 25
   require_once('includes/includes/uni_rename.php');
26 26
 }
27 27
 
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 
43 43
 $flying_fleet_count = FleetList::fleet_count_flying($user['id']);
44 44
 
45
-if($mode == 1) {
46
-} elseif($mode == 2 || $mode == 3) {
45
+if ($mode == 1) {
46
+} elseif ($mode == 2 || $mode == 3) {
47 47
   $planet = $planetrow['planet'];
48 48
 } else {
49 49
   $uni_galaxy = $planetrow['galaxy'];
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
   $planet = $planetrow['planet'];
52 52
 }
53 53
 
54
-$uni_galaxy = $uni_galaxy < 1 ? 1 : ($uni_galaxy > Vector::$knownGalaxies? Vector::$knownGalaxies: $uni_galaxy);
54
+$uni_galaxy = $uni_galaxy < 1 ? 1 : ($uni_galaxy > Vector::$knownGalaxies ? Vector::$knownGalaxies : $uni_galaxy);
55 55
 $uni_system = $uni_system < 1 ? 1 : ($uni_system > Vector::$knownSystems ? Vector::$knownSystems : $uni_system);
56 56
 $planet = $planet < 1 ? 1 : ($planet > Vector::$knownPlanets + 1 ? Vector::$knownPlanets + 1 : $planet);
57 57
 
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
 $PhalanxRange = GetPhalanxRange($HavePhalanx);
70 70
 
71 71
 $planet_precache_query = DBStaticPlanet::db_planet_list_in_system($uni_galaxy, $uni_system);
72
-if(!empty($planet_precache_query)) {
73
-  foreach($planet_precache_query as $planet_row) {
72
+if (!empty($planet_precache_query)) {
73
+  foreach ($planet_precache_query as $planet_row) {
74 74
     $planet_list[$planet_row['planet']][$planet_row['planet_type']] = $planet_row;
75 75
   }
76 76
 }
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
  * @var Fleet[][][] $fleet_list
89 89
  */
90 90
 $fleet_list = array();
91
-foreach($system_fleet_list->_container as $objFleetSystem) {
92
-  if(!$objFleetSystem->isReturning()) {
91
+foreach ($system_fleet_list->_container as $objFleetSystem) {
92
+  if (!$objFleetSystem->isReturning()) {
93 93
     $fleet_planet = $objFleetSystem->fleet_end_planet;
94 94
     $fleet_type = $objFleetSystem->fleet_end_type;
95 95
   } else {
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 $recycler_info = array();
105 105
 $planet_recyclers_orbiting = 0;
106 106
 $recyclers_fleet = array();
107
-foreach(classSupernova::$gc->groupRecyclers as $recycler_id) {
107
+foreach (classSupernova::$gc->groupRecyclers as $recycler_id) {
108 108
   $recycler_info[$recycler_id] = get_ship_data($recycler_id, $user);
109 109
   $recyclers_fleet[$recycler_id] = mrc_get_level($user, $planetrow, $recycler_id);
110 110
   $planet_recyclers_orbiting += $recyclers_fleet[$recycler_id];
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 $fleet_id = 1;
115 115
 $fleets = array();
116 116
 $config_game_max_planet = Vector::$knownPlanets + 1;
117
-for($Planet = 1; $Planet < $config_game_max_planet; $Planet++) {
117
+for ($Planet = 1; $Planet < $config_game_max_planet; $Planet++) {
118 118
   unset($uni_galaxyRowPlanet);
119 119
   unset($uni_galaxyRowMoon);
120 120
   unset($uni_galaxyRowUser);
@@ -124,17 +124,17 @@  discard block
 block discarded – undo
124 124
   $uni_galaxyRowPlanet = $planet_list[$Planet][PT_PLANET];
125 125
 
126 126
   $planet_fleet_id = 0;
127
-  if($uni_galaxyRowPlanet['destruyed']) {
127
+  if ($uni_galaxyRowPlanet['destruyed']) {
128 128
     CheckAbandonPlanetState($uni_galaxyRowPlanet);
129
-  } elseif($uni_galaxyRowPlanet['id']) {
130
-    if($cached['users'][$uni_galaxyRowPlanet['id_owner']]) {
129
+  } elseif ($uni_galaxyRowPlanet['id']) {
130
+    if ($cached['users'][$uni_galaxyRowPlanet['id_owner']]) {
131 131
       $uni_galaxyRowUser = $cached['users'][$uni_galaxyRowPlanet['id_owner']];
132 132
     } else {
133 133
       $uni_galaxyRowUser = DBStaticUser::db_user_by_id($uni_galaxyRowPlanet['id_owner']);
134 134
       $cached['users'][$uni_galaxyRowUser['id']] = $uni_galaxyRowUser;
135 135
     }
136 136
 
137
-    if(!$uni_galaxyRowUser['id']) {
137
+    if (!$uni_galaxyRowUser['id']) {
138 138
       classSupernova::$debug->warning("Planet '{$uni_galaxyRowPlanet['name']}' [{$uni_galaxy}:{$uni_system}:{$Planet}] has no owner!", 'Userless planet', 503);
139 139
       $uni_galaxyRowPlanet['destruyed'] = SN_TIME_NOW + 60 * 60 * 24;
140 140
       $uni_galaxyRowPlanet['id_owner'] = 0;
@@ -147,10 +147,10 @@  discard block
 block discarded – undo
147 147
       );
148 148
     }
149 149
 
150
-    if($uni_galaxyRowUser['id']) {
150
+    if ($uni_galaxyRowUser['id']) {
151 151
       $planetcount++;
152
-      if($uni_galaxyRowUser['ally_id']) {
153
-        if($cached['allies'][$uni_galaxyRowUser['ally_id']]) {
152
+      if ($uni_galaxyRowUser['ally_id']) {
153
+        if ($cached['allies'][$uni_galaxyRowUser['ally_id']]) {
154 154
           $allyquery = $cached['allies'][$uni_galaxyRowUser['ally_id']];
155 155
         } else {
156 156
           $allyquery = DBStaticAlly::db_ally_get_by_id($uni_galaxyRowUser['ally_id']);
@@ -159,19 +159,19 @@  discard block
 block discarded – undo
159 159
       }
160 160
 
161 161
       $fleets_to_planet = flt_get_fleets_to_planet_by_array_of_Fleet($fleet_list[$Planet][PT_PLANET]);
162
-      if(!empty($fleets_to_planet['own']['count'])) {
162
+      if (!empty($fleets_to_planet['own']['count'])) {
163 163
         $planet_fleet_id = $fleet_id;
164 164
         $fleets[] = tpl_parse_fleet_sn($fleets_to_planet['own']['total'], $fleet_id);
165 165
         $fleet_id++;
166 166
       }
167 167
 
168 168
       $uni_galaxyRowMoon = $planet_list[$Planet][PT_MOON];
169
-      if($uni_galaxyRowMoon['destruyed']) {
169
+      if ($uni_galaxyRowMoon['destruyed']) {
170 170
         CheckAbandonPlanetState($uni_galaxyRowMoon);
171 171
       } else {
172 172
         $moon_fleet_id = 0;
173 173
         $fleets_to_planet = flt_get_fleets_to_planet_by_array_of_Fleet($fleet_list[$Planet][PT_MOON]);
174
-        if(!empty($fleets_to_planet['own']['count'])) {
174
+        if (!empty($fleets_to_planet['own']['count'])) {
175 175
           $moon_fleet_id = $fleet_id;
176 176
           $fleets[] = tpl_parse_fleet_sn($fleets_to_planet['own']['total'], $fleet_id);
177 177
           $fleet_id++;
@@ -182,10 +182,10 @@  discard block
 block discarded – undo
182 182
 
183 183
   $recyclers_incoming_capacity = 0;
184 184
   $uni_galaxyRowPlanet['debris'] = $uni_galaxyRowPlanet['debris_metal'] + $uni_galaxyRowPlanet['debris_crystal'];
185
-  if($uni_galaxyRowPlanet['debris']) {
186
-    if(!empty($fleet_list[$Planet][PT_DEBRIS])) {
187
-      foreach($fleet_list[$Planet][PT_DEBRIS] as $objFleetToDebris) {
188
-        if($objFleetToDebris->playerOwnerId == $user['id']) {
185
+  if ($uni_galaxyRowPlanet['debris']) {
186
+    if (!empty($fleet_list[$Planet][PT_DEBRIS])) {
187
+      foreach ($fleet_list[$Planet][PT_DEBRIS] as $objFleetToDebris) {
188
+        if ($objFleetToDebris->playerOwnerId == $user['id']) {
189 189
           $recyclers_incoming_capacity += $objFleetToDebris->shipsGetCapacityRecyclers($recycler_info);
190 190
         }
191 191
       }
@@ -262,21 +262,21 @@  discard block
 block discarded – undo
262 262
 
263 263
 tpl_assign_fleet($template, $fleets);
264 264
 
265
-foreach(sn_get_groups('defense_active') as $unit_id) {
265
+foreach (sn_get_groups('defense_active') as $unit_id) {
266 266
   $template->assign_block_vars('defense_active', array(
267 267
     'ID'   => $unit_id,
268 268
     'NAME' => classLocale::$lang['tech'][$unit_id],
269 269
   ));
270 270
 }
271 271
 
272
-foreach($cached['users'] as $PlanetUser) {
273
-  if(!$PlanetUser) {
272
+foreach ($cached['users'] as $PlanetUser) {
273
+  if (!$PlanetUser) {
274 274
     continue;
275 275
   }
276 276
 
277 277
   $user_ally = $cached['allies'][$PlanetUser['ally_id']];
278
-  if(isset($user_ally)) {
279
-    if($PlanetUser['id'] == $user_ally['ally_owner']) {
278
+  if (isset($user_ally)) {
279
+    if ($PlanetUser['id'] == $user_ally['ally_owner']) {
280 280
       $user_rank_title = $user_ally['ally_owner_range'];
281 281
     } else {
282 282
       $ally_ranks = explode(';', $user_ally['ranklist']);
@@ -299,8 +299,8 @@  discard block
 block discarded – undo
299 299
   ));
300 300
 }
301 301
 
302
-foreach($cached['allies'] as $PlanetAlly) {
303
-  if($PlanetAlly) {
302
+foreach ($cached['allies'] as $PlanetAlly) {
303
+  if ($PlanetAlly) {
304 304
     $template->assign_block_vars('alliances', array(
305 305
       'ID'      => $PlanetAlly['id'],
306 306
       'NAME_JS' => js_safe_string($PlanetAlly['ally_name']),
Please login to merge, or discard this patch.
includes/includes/market_fleeter.inc 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -5,11 +5,11 @@  discard block
 block discarded – undo
5 5
 
6 6
 $classLocale = classLocale::$lang;
7 7
 
8
-if(!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) {
8
+if (!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) {
9 9
   classSupernova::$debug->error("Attempt to call market page mode {$mode} directly - not from market.php", 'Forbidden', 403);
10 10
 }
11 11
 
12
-$page_title .= ' - ' . classLocale::$lang["eco_mrk_{$submode}"];
12
+$page_title .= ' - '.classLocale::$lang["eco_mrk_{$submode}"];
13 13
 
14 14
 $template = gettemplate('market_fleet', true);
15 15
 $template->assign_vars(array(
@@ -17,8 +17,8 @@  discard block
 block discarded – undo
17 17
   'rpg_cost' => $rpg_cost,
18 18
 ));
19 19
 
20
-if(is_array($shipList)) {
21
-  if(mrc_get_level($user, null, RES_DARK_MATTER) < $rpg_cost) {
20
+if (is_array($shipList)) {
21
+  if (mrc_get_level($user, null, RES_DARK_MATTER) < $rpg_cost) {
22 22
     $intError = MARKET_NO_DM;
23 23
   }
24 24
 
@@ -31,32 +31,32 @@  discard block
 block discarded – undo
31 31
   // Блокируем запись о запасах кораблей у трейдера
32 32
   db_config_get_stockman_fleet();
33 33
 
34
-  $message .= classLocale::$lang["eco_mrk_{$submode}_ships"] . '<ul>';
34
+  $message .= classLocale::$lang["eco_mrk_{$submode}_ships"].'<ul>';
35 35
   $total = array();
36
-  foreach($shipList as $shipID => &$shipCount) {
36
+  foreach ($shipList as $shipID => &$shipCount) {
37 37
     $shipCount = ceil(floatval($shipCount));
38
-    if(!$shipCount) {
38
+    if (!$shipCount) {
39 39
       continue;
40 40
     }
41 41
 
42
-    if($shipCount < 0) {
42
+    if ($shipCount < 0) {
43 43
       classSupernova::$debug->warning('User supplied negative ship count on Black Market page', 'Hack Attempt', 307);
44 44
       $intError = MARKET_NEGATIVE_SHIPS;
45 45
       break;
46 46
     }
47 47
 
48
-    if($mode == MARKET_SCRAPPER) {
48
+    if ($mode == MARKET_SCRAPPER) {
49 49
       $amount = mrc_get_level($user, $planetrow, $shipID, true, true); // $planetrow[get_unit_param($shipID, P_NAME)];
50
-    } elseif($mode == MARKET_STOCKMAN) {
50
+    } elseif ($mode == MARKET_STOCKMAN) {
51 51
       $amount = $stock[$shipID];
52 52
     }
53 53
 
54
-    if($amount < $shipCount) {
54
+    if ($amount < $shipCount) {
55 55
       $intError = $error_no_stock;
56 56
       break;
57 57
     }
58 58
 
59
-    if(!in_array($shipID, classSupernova::$gc->groupFleet)) {
59
+    if (!in_array($shipID, classSupernova::$gc->groupFleet)) {
60 60
       classSupernova::$debug->warning('Hack Attempt', 'User supplied non-ship unit ID on Black Market page', 306);
61 61
       $intError = MARKET_NOT_A_SHIP;
62 62
       break;
@@ -72,16 +72,16 @@  discard block
 block discarded – undo
72 72
     $resTemp[RES_CRYSTAL] = floor($build_data[BUILD_CREATE][RES_CRYSTAL] * $shipCount * $config_rpg_scrape_crystal * (-$multiplier));
73 73
     $resTemp[RES_DEUTERIUM] = floor($build_data[BUILD_CREATE][RES_DEUTERIUM] * $shipCount * $config_rpg_scrape_deuterium * (-$multiplier));
74 74
 
75
-    foreach($resTemp as $resID => $resCount) {
75
+    foreach ($resTemp as $resID => $resCount) {
76 76
       $total[$resID] += $resCount;
77 77
     }
78 78
 
79
-    $message .= "<li>{$classLocale['tech'][$shipID]}: " . pretty_number($shipCount);
79
+    $message .= "<li>{$classLocale['tech'][$shipID]}: ".pretty_number($shipCount);
80 80
   }
81 81
 
82
-  if($mode == MARKET_STOCKMAN && $intError == MARKET_DEAL) {
83
-    foreach($total as $resID => $resCount) {
84
-      if(mrc_get_level($user, $planetrow, $resID, true, true) < -$resCount) {
82
+  if ($mode == MARKET_STOCKMAN && $intError == MARKET_DEAL) {
83
+    foreach ($total as $resID => $resCount) {
84
+      if (mrc_get_level($user, $planetrow, $resID, true, true) < -$resCount) {
85 85
         $intError = MARKET_NO_RESOURCES;
86 86
         classSupernova::$debug->warning('Trying to use bug in s/h market', 'S/H Ship Market', 301);
87 87
         break;
@@ -92,15 +92,15 @@  discard block
 block discarded – undo
92 92
   $intError = ($intError == MARKET_DEAL) && (array_sum($total) == 0) ? $error_zero_res : $intError;
93 93
 
94 94
   $qry = array();
95
-  if($intError == MARKET_DEAL) {
96
-    $message .= '</ul>' . classLocale::$lang["eco_mrk_{$submode}_res"] . '<ul>';
97
-    foreach($total as $resID => $resCount) {
98
-      if(!$resCount) {
95
+  if ($intError == MARKET_DEAL) {
96
+    $message .= '</ul>'.classLocale::$lang["eco_mrk_{$submode}_res"].'<ul>';
97
+    foreach ($total as $resID => $resCount) {
98
+      if (!$resCount) {
99 99
         continue;
100 100
       }
101 101
 
102 102
       $qry[pname_resource_name($resID)] = $resCount;
103
-      $message .= "<li>" . classLocale::$lang['sys_' . pname_resource_name($resID)] . ": " . pretty_number(abs($resCount));
103
+      $message .= "<li>".classLocale::$lang['sys_'.pname_resource_name($resID)].": ".pretty_number(abs($resCount));
104 104
     }
105 105
     $message .= "</ul>";
106 106
 
@@ -128,38 +128,38 @@  discard block
 block discarded – undo
128 128
       'MESSAGE' => classLocale::$lang['eco_mrk_errors'][$intError],
129 129
     ));
130 130
 
131
-    foreach($shipList as $shipID => $shipCount) {
131
+    foreach ($shipList as $shipID => $shipCount) {
132 132
       $data['ships'][$shipID] = max(0, intval($shipCount));
133 133
     }
134 134
   }
135 135
 }
136 136
 $message = '';
137 137
 
138
-if(!classSupernova::$config->eco_stockman_fleet && classSupernova::$config->eco_stockman_fleet_populate) {
139
-  classSupernova::$config->db_saveItem('eco_stockman_fleet', sys_unit_arr2str(array_map(function($item){return mt_rand(1, 1000);}, classSupernova::$gc->groupFleet)));
138
+if (!classSupernova::$config->eco_stockman_fleet && classSupernova::$config->eco_stockman_fleet_populate) {
139
+  classSupernova::$config->db_saveItem('eco_stockman_fleet', sys_unit_arr2str(array_map(function($item) {return mt_rand(1, 1000); }, classSupernova::$gc->groupFleet)));
140 140
 }
141 141
 
142 142
 tpl_set_resource_info($template, $planetrow, array());
143 143
 
144
-if(!$array) {
144
+if (!$array) {
145 145
   $array = array();
146 146
 }
147 147
 
148 148
 $group_fleet = classSupernova::$gc->groupFleet;
149
-foreach($array as $key => $value) {
150
-  if($mode == MARKET_SCRAPPER) {
149
+foreach ($array as $key => $value) {
150
+  if ($mode == MARKET_SCRAPPER) {
151 151
     $shipID = $value;
152 152
     $amount = mrc_get_level($user, $planetrow, $shipID, false, true); // $planetrow[get_unit_param($shipID, P_NAME)];
153
-  } elseif($mode == MARKET_STOCKMAN) {
153
+  } elseif ($mode == MARKET_STOCKMAN) {
154 154
     $shipID = $key;
155 155
     $amount = $value;
156 156
   }
157 157
 
158
-  if(!in_array($shipID, $group_fleet)) {
158
+  if (!in_array($shipID, $group_fleet)) {
159 159
     continue;
160 160
   }
161 161
 
162
-  if($amount > 0) {
162
+  if ($amount > 0) {
163 163
     $build_data = eco_get_build_data($user, $planetrow, $shipID);
164 164
     $template->assign_block_vars('ships', array(
165 165
       'ID'        => $shipID,
Please login to merge, or discard this patch.
includes/includes/flt_mission_recycle.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -16,10 +16,10 @@  discard block
 block discarded – undo
16 16
   $RecyclerCapacity = 0;
17 17
   $OtherFleetCapacity = 0;
18 18
 
19
-  foreach($objFleet->shipsIterator() as $unit_id => $unit) {
20
-    if(in_array($unit_id, classSupernova::$gc->groupFleet)) {
19
+  foreach ($objFleet->shipsIterator() as $unit_id => $unit) {
20
+    if (in_array($unit_id, classSupernova::$gc->groupFleet)) {
21 21
       $capacity = get_unit_param($unit_id, P_CAPACITY) * $unit->count;
22
-      if(in_array($unit_id, classSupernova::$gc->groupRecyclers)) {
22
+      if (in_array($unit_id, classSupernova::$gc->groupRecyclers)) {
23 23
         $RecyclerCapacity += $capacity;
24 24
       } else {
25 25
         $OtherFleetCapacity += $capacity;
@@ -28,33 +28,33 @@  discard block
 block discarded – undo
28 28
   }
29 29
 
30 30
   $fleet_resources_amount = $objFleet->resourcesGetTotal();
31
-  if($fleet_resources_amount > $OtherFleetCapacity) {
31
+  if ($fleet_resources_amount > $OtherFleetCapacity) {
32 32
     // Если во флоте есть другие корабли И количество ресурсов больше, чем их ёмкость трюмов - значит часть этих ресурсов лежит в трюмах переработчиков
33 33
     // Уменьшаем ёмкость переработчиков на указанную величину
34 34
     $RecyclerCapacity -= ($fleet_resources_amount - $OtherFleetCapacity);
35 35
   }
36 36
 
37 37
   $resources_recycled = array();
38
-  if(($destination_planet["debris_metal"] + $destination_planet["debris_crystal"]) <= $RecyclerCapacity) {
38
+  if (($destination_planet["debris_metal"] + $destination_planet["debris_crystal"]) <= $RecyclerCapacity) {
39 39
     $resources_recycled[RES_METAL] = $destination_planet["debris_metal"];
40 40
     $resources_recycled[RES_CRYSTAL] = $destination_planet["debris_crystal"];
41 41
   } else {
42
-    if(($destination_planet["debris_metal"] > $RecyclerCapacity / 2) &&
42
+    if (($destination_planet["debris_metal"] > $RecyclerCapacity / 2) &&
43 43
       ($destination_planet["debris_crystal"] > $RecyclerCapacity / 2)
44 44
     ) {
45 45
       $resources_recycled[RES_METAL] = $RecyclerCapacity / 2;
46 46
       $resources_recycled[RES_CRYSTAL] = $RecyclerCapacity / 2;
47 47
     } else {
48
-      if($destination_planet["debris_metal"] > $destination_planet["debris_crystal"]) {
48
+      if ($destination_planet["debris_metal"] > $destination_planet["debris_crystal"]) {
49 49
         $resources_recycled[RES_CRYSTAL] = $destination_planet["debris_crystal"];
50
-        if($destination_planet["debris_metal"] > ($RecyclerCapacity - $resources_recycled[RES_CRYSTAL])) {
50
+        if ($destination_planet["debris_metal"] > ($RecyclerCapacity - $resources_recycled[RES_CRYSTAL])) {
51 51
           $resources_recycled[RES_METAL] = $RecyclerCapacity - $resources_recycled[RES_CRYSTAL];
52 52
         } else {
53 53
           $resources_recycled[RES_METAL] = $destination_planet["debris_metal"];
54 54
         }
55 55
       } else {
56 56
         $resources_recycled[RES_METAL] = $destination_planet["debris_metal"];
57
-        if($destination_planet["debris_crystal"] > ($RecyclerCapacity - $resources_recycled[RES_METAL])) {
57
+        if ($destination_planet["debris_crystal"] > ($RecyclerCapacity - $resources_recycled[RES_METAL])) {
58 58
           $resources_recycled[RES_CRYSTAL] = $RecyclerCapacity - $resources_recycled[RES_METAL];
59 59
         } else {
60 60
           $resources_recycled[RES_CRYSTAL] = $destination_planet["debris_crystal"];
Please login to merge, or discard this patch.
classes/Fleet.php 3 patches
Doc Comments   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -979,7 +979,7 @@  discard block
 block discarded – undo
979 979
   /**
980 980
    * Set current resource list from array of units
981 981
    *
982
-   * @param array $resource_list
982
+   * @param integer[] $resource_list
983 983
    */
984 984
   public function resourcesSet($resource_list) {
985 985
     if (!empty($this->propertiesAdjusted['resource_list'])) {
@@ -1027,7 +1027,7 @@  discard block
 block discarded – undo
1027 1027
   }
1028 1028
 
1029 1029
   /**
1030
-   * @param array $rate
1030
+   * @param integer[] $rate
1031 1031
    *
1032 1032
    * @return float
1033 1033
    */
@@ -1058,8 +1058,6 @@  discard block
 block discarded – undo
1058 1058
    * Restores fleet or resources to planet
1059 1059
    *
1060 1060
    * @param bool $start
1061
-   * @param bool $only_resources
1062
-   * @param int  $result
1063 1061
    */
1064 1062
   public function resourcesUnload($start = true) {
1065 1063
     sn_db_transaction_check(true);
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,5 @@
 block discarded – undo
1 1
 <?php
2 2
 use DBStatic\DBStaticFleetACS;
3
-use DBStatic\DBStaticNote;
4 3
 use DBStatic\DBStaticPlanet;
5 4
 use DBStatic\DBStaticUnit;
6 5
 use DBStatic\DBStaticUser;
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -401,31 +401,31 @@  discard block
 block discarded – undo
401 401
 
402 402
     return classSupernova::$db->doSelect(
403 403
     // Блокировка самого флота
404
-      "SELECT 1 FROM {{fleets}} AS f " .
404
+      "SELECT 1 FROM {{fleets}} AS f ".
405 405
 
406 406
       // Блокировка всех юнитов, принадлежащих этому флоту
407
-      "LEFT JOIN {{unit}} as unit ON unit.unit_location_type = " . static::$locationType . " AND unit.unit_location_id = f.fleet_id " .
407
+      "LEFT JOIN {{unit}} as unit ON unit.unit_location_type = ".static::$locationType." AND unit.unit_location_id = f.fleet_id ".
408 408
 
409 409
       // Блокировка всех прилетающих и улетающих флотов, если нужно
410 410
       // TODO - lock fleets by COORDINATES
411
-      ($mission_data['dst_fleets'] ? "LEFT JOIN {{fleets}} AS fd ON fd.fleet_end_planet_id = f.fleet_end_planet_id OR fd.fleet_start_planet_id = f.fleet_end_planet_id " : '') .
411
+      ($mission_data['dst_fleets'] ? "LEFT JOIN {{fleets}} AS fd ON fd.fleet_end_planet_id = f.fleet_end_planet_id OR fd.fleet_start_planet_id = f.fleet_end_planet_id " : '').
412 412
       // Блокировка всех юнитов, принадлежащих прилетающим и улетающим флотам - ufd = unit_fleet_destination
413
-      ($mission_data['dst_fleets'] ? "LEFT JOIN {{unit}} AS ufd ON ufd.unit_location_type = " . static::$locationType . " AND ufd.unit_location_id = fd.fleet_id " : '') .
413
+      ($mission_data['dst_fleets'] ? "LEFT JOIN {{unit}} AS ufd ON ufd.unit_location_type = ".static::$locationType." AND ufd.unit_location_id = fd.fleet_id " : '').
414 414
 
415
-      ($mission_data['dst_user'] || $mission_data['dst_planet'] ? "LEFT JOIN {{users}} AS ud ON ud.id = f.fleet_target_owner " : '') .
415
+      ($mission_data['dst_user'] || $mission_data['dst_planet'] ? "LEFT JOIN {{users}} AS ud ON ud.id = f.fleet_target_owner " : '').
416 416
       // Блокировка всех юнитов, принадлежащих владельцу планеты-цели
417
-      ($mission_data['dst_user'] || $mission_data['dst_planet'] ? "LEFT JOIN {{unit}} AS unit_player_dest ON unit_player_dest.unit_player_id = ud.id " : '') .
417
+      ($mission_data['dst_user'] || $mission_data['dst_planet'] ? "LEFT JOIN {{unit}} AS unit_player_dest ON unit_player_dest.unit_player_id = ud.id " : '').
418 418
       // Блокировка планеты-цели
419
-      ($mission_data['dst_planet'] ? "LEFT JOIN {{planets}} AS pd ON pd.id = f.fleet_end_planet_id " : '') .
419
+      ($mission_data['dst_planet'] ? "LEFT JOIN {{planets}} AS pd ON pd.id = f.fleet_end_planet_id " : '').
420 420
       // Блокировка всех юнитов, принадлежащих планете-цели - НЕ НУЖНО. Уже залочили ранее, как принадлежащие игроку-цели
421 421
 //      ($mission_data['dst_planet'] ? "LEFT JOIN {{unit}} AS upd ON upd.unit_location_type = " . LOC_PLANET . " AND upd.unit_location_id = pd.id " : '') .
422 422
 
423 423
 
424
-      ($mission_data['src_user'] || $mission_data['src_planet'] ? "LEFT JOIN {{users}} AS us ON us.id = f.fleet_owner " : '') .
424
+      ($mission_data['src_user'] || $mission_data['src_planet'] ? "LEFT JOIN {{users}} AS us ON us.id = f.fleet_owner " : '').
425 425
       // Блокировка всех юнитов, принадлежащих владельцу флота
426
-      ($mission_data['src_user'] || $mission_data['src_planet'] ? "LEFT JOIN {{unit}} AS unit_player_src ON unit_player_src.unit_player_id = us.id " : '') .
426
+      ($mission_data['src_user'] || $mission_data['src_planet'] ? "LEFT JOIN {{unit}} AS unit_player_src ON unit_player_src.unit_player_id = us.id " : '').
427 427
       // Блокировка планеты отправления
428
-      ($mission_data['src_planet'] ? "LEFT JOIN {{planets}} AS ps ON ps.id = f.fleet_start_planet_id " : '') .
428
+      ($mission_data['src_planet'] ? "LEFT JOIN {{planets}} AS ps ON ps.id = f.fleet_start_planet_id " : '').
429 429
       // Блокировка всех юнитов, принадлежащих планете с которой юниты были отправлены - НЕ НУЖНО. Уже залочили ранее, как принадлежащие владельцу флота
430 430
 //      ($mission_data['src_planet'] ? "LEFT JOIN {{unit}} AS ups ON ups.unit_location_type = " . LOC_PLANET . " AND ups.unit_location_id = ps.id " : '') .
431 431
 
@@ -442,11 +442,11 @@  discard block
 block discarded – undo
442 442
   public function dbGetLockById($dbId) {
443 443
     classSupernova::$db->doSelect(
444 444
     // Блокировка самого флота
445
-      "SELECT 1 FROM {{fleets}} AS FLEET0 " .
445
+      "SELECT 1 FROM {{fleets}} AS FLEET0 ".
446 446
       // Lock fleet owner
447
-      "LEFT JOIN {{users}} as USER0 on USER0.id = FLEET0.fleet_owner " .
447
+      "LEFT JOIN {{users}} as USER0 on USER0.id = FLEET0.fleet_owner ".
448 448
       // Блокировка всех юнитов, принадлежащих этому флоту
449
-      "LEFT JOIN {{unit}} as UNIT0 ON UNIT0.unit_location_type = " . LOC_FLEET . " AND UNIT0.unit_location_id = FLEET0.fleet_id " .
449
+      "LEFT JOIN {{unit}} as UNIT0 ON UNIT0.unit_location_type = ".LOC_FLEET." AND UNIT0.unit_location_id = FLEET0.fleet_id ".
450 450
 
451 451
       // Без предварительной выборки неизвестно - куда летит этот флот.
452 452
       // Поэтому надо выбирать флоты, чьи координаты прибытия ИЛИ отбытия совпадают с координатами прибытия ИЛИ отбытия текущего флота.
@@ -462,9 +462,9 @@  discard block
 block discarded – undo
462 462
         FLEET1.fleet_end_planet = FLEET0.fleet_end_planet
463 463
       " .
464 464
       // Блокировка всех юнитов, принадлежащих этим флотам
465
-      "LEFT JOIN {{unit}} as UNIT1 ON UNIT1.unit_location_type = " . LOC_FLEET . " AND UNIT1.unit_location_id = FLEET1.fleet_id " .
465
+      "LEFT JOIN {{unit}} as UNIT1 ON UNIT1.unit_location_type = ".LOC_FLEET." AND UNIT1.unit_location_id = FLEET1.fleet_id ".
466 466
       // Lock fleet owner
467
-      "LEFT JOIN {{users}} as USER1 on USER1.id = FLEET1.fleet_owner " .
467
+      "LEFT JOIN {{users}} as USER1 on USER1.id = FLEET1.fleet_owner ".
468 468
 
469 469
       "LEFT JOIN {{fleets}} AS FLEET2 ON
470 470
         FLEET2.fleet_mess = 1   AND FLEET0.fleet_mess = 0 AND
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
       " .
475 475
       // Блокировка всех юнитов, принадлежащих этим флотам
476 476
       "LEFT JOIN {{unit}} as UNIT2 ON
477
-        UNIT2.unit_location_type = " . LOC_FLEET . " AND
477
+        UNIT2.unit_location_type = " . LOC_FLEET." AND
478 478
         UNIT2.unit_location_id = FLEET2.fleet_id
479 479
       " .
480 480
       // Lock fleet owner
@@ -491,11 +491,11 @@  discard block
 block discarded – undo
491 491
       " .
492 492
       // Блокировка всех юнитов, принадлежащих этим флотам
493 493
       "LEFT JOIN {{unit}} as UNIT3 ON
494
-        UNIT3.unit_location_type = " . LOC_FLEET . " AND
494
+        UNIT3.unit_location_type = " . LOC_FLEET." AND
495 495
         UNIT3.unit_location_id = FLEET3.fleet_id
496 496
       " .
497 497
       // Lock fleet owner
498
-      "LEFT JOIN {{users}} as USER3 on USER3.id = FLEET3.fleet_owner " .
498
+      "LEFT JOIN {{users}} as USER3 on USER3.id = FLEET3.fleet_owner ".
499 499
 
500 500
       "LEFT JOIN {{fleets}} AS FLEET4 ON
501 501
         FLEET4.fleet_mess = 1   AND FLEET0.fleet_mess = 1 AND
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
       " .
506 506
       // Блокировка всех юнитов, принадлежащих этим флотам
507 507
       "LEFT JOIN {{unit}} as UNIT4 ON
508
-        UNIT4.unit_location_type = " . LOC_FLEET . " AND
508
+        UNIT4.unit_location_type = " . LOC_FLEET." AND
509 509
         UNIT4.unit_location_id = FLEET4.fleet_id
510 510
       " .
511 511
       // Lock fleet owner
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
       " .
528 528
       // Блокировка всех юнитов, принадлежащих этой планете
529 529
       "LEFT JOIN {{unit}} as UNIT5 ON
530
-        UNIT5.unit_location_type = " . LOC_PLANET . " AND
530
+        UNIT5.unit_location_type = " . LOC_PLANET." AND
531 531
         UNIT5.unit_location_id = PLANETS5.id
532 532
       " .
533 533
 
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
       " .
546 546
       // Блокировка всех юнитов, принадлежащих этой планете
547 547
       "LEFT JOIN {{unit}} as UNIT6 ON
548
-        UNIT6.unit_location_type = " . LOC_PLANET . " AND
548
+        UNIT6.unit_location_type = " . LOC_PLANET." AND
549 549
         UNIT6.unit_location_id = PLANETS6.id
550 550
       " .
551 551
       "WHERE FLEET0.fleet_id = {$dbId} GROUP BY 1 FOR UPDATE"
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
       } elseif ($this->isResource($unit_id)) {
658 658
         $this->resource_list[$unit_id] = $unit_count;
659 659
       } else {
660
-        throw new Exception('Trying to pass to fleet non-resource and non-ship ' . var_export($unit_array, true), FLIGHT_SHIPS_UNIT_WRONG);
660
+        throw new Exception('Trying to pass to fleet non-resource and non-ship '.var_export($unit_array, true), FLIGHT_SHIPS_UNIT_WRONG);
661 661
       }
662 662
     }
663 663
   }
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
    * @param int $unit_count
792 792
    */
793 793
   public function shipSetCount($unit_id, $unit_count = 0) {
794
-    pdump(__CLASS__ . '->' . __FUNCTION__);
794
+    pdump(__CLASS__.'->'.__FUNCTION__);
795 795
     $this->shipAdjustCount($unit_id, $unit_count, true);
796 796
   }
797 797
 
@@ -983,7 +983,7 @@  discard block
 block discarded – undo
983 983
    */
984 984
   public function resourcesSet($resource_list) {
985 985
     if (!empty($this->propertiesAdjusted['resource_list'])) {
986
-      throw new ExceptionPropertyAccess('Property "resource_list" already was adjusted so no SET is possible until dbSave in ' . get_called_class() . '::unitSetResourceList', ERR_ERROR);
986
+      throw new ExceptionPropertyAccess('Property "resource_list" already was adjusted so no SET is possible until dbSave in '.get_called_class().'::unitSetResourceList', ERR_ERROR);
987 987
     }
988 988
     $this->resourcesAdjust($resource_list, true);
989 989
   }
@@ -1017,7 +1017,7 @@  discard block
 block discarded – undo
1017 1017
       // Check for negative unit value
1018 1018
       if ($this->resource_list[$resource_id] < 0) {
1019 1019
         // TODO
1020
-        throw new Exception('Resource ' . $resource_id . ' will become negative in ' . get_called_class() . '::unitAdjustResourceList', ERR_ERROR);
1020
+        throw new Exception('Resource '.$resource_id.' will become negative in '.get_called_class().'::unitAdjustResourceList', ERR_ERROR);
1021 1021
       }
1022 1022
     }
1023 1023
   }
@@ -1325,14 +1325,14 @@  discard block
 block discarded – undo
1325 1325
       if (FLIGHT_ALLOWED == $validateResult[$missionType]) {
1326 1326
         $this->allowed_missions[$missionType] = $mission;
1327 1327
       } else {
1328
-        if($missionType == $this->mission_type) {
1328
+        if ($missionType == $this->mission_type) {
1329 1329
         }
1330 1330
         unset($this->allowed_missions[$missionType]);
1331 1331
       }
1332 1332
     }
1333 1333
 
1334
-    if(empty($this->allowed_missions)) {
1335
-      if($this->mission_type != MT_NONE && isset($validateResult[$this->mission_type])) {
1334
+    if (empty($this->allowed_missions)) {
1335
+      if ($this->mission_type != MT_NONE && isset($validateResult[$this->mission_type])) {
1336 1336
         throw new ExceptionFleetInvalid($validateResult[$this->mission_type], $validateResult[$this->mission_type]);
1337 1337
       } else {
1338 1338
         throw new ExceptionFleetInvalid(FLIGHT_MISSION_IMPOSSIBLE, FLIGHT_MISSION_IMPOSSIBLE);
@@ -1570,7 +1570,7 @@  discard block
 block discarded – undo
1570 1570
     $template_result['.']['fleets'][] = $this->fleetRenderer->renderFleet($this, SN_TIME_NOW, $timeMissionJob);
1571 1571
 
1572 1572
     $template_result += array(
1573
-      'mission'         => classLocale::$lang['type_mission'][$this->_mission_type] . ($this->_mission_type == MT_EXPLORE || $this->_mission_type == MT_HOLD ? ' ' . pretty_time($timeMissionJob) : ''),
1573
+      'mission'         => classLocale::$lang['type_mission'][$this->_mission_type].($this->_mission_type == MT_EXPLORE || $this->_mission_type == MT_HOLD ? ' '.pretty_time($timeMissionJob) : ''),
1574 1574
       'dist'            => pretty_number($this->travelData['distance']),
1575 1575
       'speed'           => pretty_number($this->travelData['fleet_speed']),
1576 1576
       'deute_need'      => pretty_number($this->travelData['consumption']),
Please login to merge, or discard this patch.
classes/Common/GlobalContainer.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -52,82 +52,82 @@
 block discarded – undo
52 52
     $gc = $this;
53 53
 
54 54
     // Default db
55
-    $gc->db = function ($c) {
55
+    $gc->db = function($c) {
56 56
       classSupernova::$db = $db = new \db_mysql($c);
57 57
 
58 58
       return $db;
59 59
     };
60 60
 
61
-    $gc->debug = function ($c) {
61
+    $gc->debug = function($c) {
62 62
       return new \debug();
63 63
     };
64 64
 
65
-    $gc->types = function ($c) {
65
+    $gc->types = function($c) {
66 66
       return new \Common\Types();
67 67
     };
68 68
 
69
-    $gc->cache = function ($c) {
69
+    $gc->cache = function($c) {
70 70
       return new \classCache(classSupernova::$cache_prefix);
71 71
     };
72 72
 
73
-    $gc->config = function ($c) {
73
+    $gc->config = function($c) {
74 74
       return new \classConfig(classSupernova::$cache_prefix);
75 75
     };
76 76
 
77
-    $gc->localePlayer = function (GlobalContainer $c) {
77
+    $gc->localePlayer = function(GlobalContainer $c) {
78 78
       return new \classLocale($c->config->server_locale_log_usage);
79 79
     };
80 80
 
81
-    $gc->dbGlobalRowOperator = function (GlobalContainer $c) {
81
+    $gc->dbGlobalRowOperator = function(GlobalContainer $c) {
82 82
       return new \DbRowDirectOperator($c->db);
83 83
     };
84 84
 
85
-    $gc->query = $gc->factory(function (GlobalContainer $c) {
85
+    $gc->query = $gc->factory(function(GlobalContainer $c) {
86 86
       return new \DbQueryConstructor($c->db);
87 87
     });
88 88
 
89
-    $gc->cacheOperator = function (GlobalContainer $gc) {
89
+    $gc->cacheOperator = function(GlobalContainer $gc) {
90 90
       return new \SnDbCachedOperator($gc);
91 91
     };
92 92
 
93 93
     $gc->snCacheClass = 'SnCache';
94
-    $gc->snCache = function (GlobalContainer $gc) {
94
+    $gc->snCache = function(GlobalContainer $gc) {
95 95
       return $gc->db->snCache;
96 96
     };
97 97
 
98 98
     $gc->buddyClass = 'Buddy\BuddyModel';
99
-    $gc->buddyModel = function (GlobalContainer $c) {
99
+    $gc->buddyModel = function(GlobalContainer $c) {
100 100
       return new $c->buddyClass($c);
101 101
     };
102 102
 
103
-    $gc->unitModel = function (GlobalContainer $c) {
103
+    $gc->unitModel = function(GlobalContainer $c) {
104 104
       return new \V2Unit\V2UnitModel($c);
105 105
     };
106
-    $gc->unitList = $this->factory(function (GlobalContainer $c) {
106
+    $gc->unitList = $this->factory(function(GlobalContainer $c) {
107 107
       return new \V2Unit\V2UnitList($c);
108 108
     });
109 109
 
110
-    $gc->fleetModel = function (GlobalContainer $c) {
110
+    $gc->fleetModel = function(GlobalContainer $c) {
111 111
       return new V2FleetModel($c);
112 112
     };
113 113
 
114
-    $gc->planetRenderer = function (GlobalContainer $c) {
114
+    $gc->planetRenderer = function(GlobalContainer $c) {
115 115
       return new PlanetRenderer($c);
116 116
     };
117 117
 
118
-    $gc->fleetRenderer = function (GlobalContainer $c) {
118
+    $gc->fleetRenderer = function(GlobalContainer $c) {
119 119
       return new \FleetRenderer($c);
120 120
     };
121 121
 
122
-    $gc->groupFleet = function (GlobalContainer $c) {
122
+    $gc->groupFleet = function(GlobalContainer $c) {
123 123
       return sn_get_groups('fleet');
124 124
     };
125 125
 
126
-    $gc->groupFleetAndMissiles = function (GlobalContainer $c) {
126
+    $gc->groupFleetAndMissiles = function(GlobalContainer $c) {
127 127
       return sn_get_groups(array('fleet', GROUP_STR_MISSILES));
128 128
     };
129 129
 
130
-    $gc->groupRecyclers = function (GlobalContainer $c) {
130
+    $gc->groupRecyclers = function(GlobalContainer $c) {
131 131
       return sn_get_groups('flt_recyclers');
132 132
     };
133 133
 
Please login to merge, or discard this patch.
classes/FleetRenderer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
   public function renderFleet(Fleet $fleet, $missionStartTimeStamp = SN_TIME_NOW, $timeMissionJob = 0) {
48 48
     $unitList = $fleet->getUnitList();
49 49
     if ($unitList->unitsCount() <= 0) {
50
-      message(classLocale::$lang['fl_err_no_ships'], classLocale::$lang['fl_error'], 'fleet' . DOT_PHP_EX, 5);
50
+      message(classLocale::$lang['fl_err_no_ships'], classLocale::$lang['fl_error'], 'fleet'.DOT_PHP_EX, 5);
51 51
     }
52 52
 
53 53
     $timeToReturn = $fleet->travelData['duration'] * 2 + $timeMissionJob;
Please login to merge, or discard this patch.
classes/DBRow.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
    * @param db_mysql|null $db
87 87
    */
88 88
   public static function setDb($db = null) {
89
-    if(empty($db) || !($db instanceof db_mysql)) {
89
+    if (empty($db) || !($db instanceof db_mysql)) {
90 90
       $db = null;
91 91
     }
92 92
     static::$db = !empty($db) || !class_exists('classSupernova', false) ? $db : classSupernova::$db;
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
   public function dbLoad($dbId, $lockSkip = false) {
150 150
     $dbId = idval($dbId);
151 151
     if ($dbId <= 0) {
152
-      classSupernova::$debug->error(get_called_class() . '::' . __METHOD__ . ' $dbId not positive = ' . $dbId);
152
+      classSupernova::$debug->error(get_called_class().'::'.__METHOD__.' $dbId not positive = '.$dbId);
153 153
 
154 154
       return;
155 155
     }
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
       $this->dbGetLockById($this->_dbId);
162 162
     }
163 163
 
164
-    $db_row = classSupernova::$db->doSelectFetchArray("SELECT * FROM `{{" . static::$_table . "}}` WHERE `" . static::$_dbIdFieldName . "` = " . $this->_dbId . " LIMIT 1 FOR UPDATE;");
164
+    $db_row = classSupernova::$db->doSelectFetchArray("SELECT * FROM `{{".static::$_table."}}` WHERE `".static::$_dbIdFieldName."` = ".$this->_dbId." LIMIT 1 FOR UPDATE;");
165 165
     if (empty($db_row)) {
166 166
       return;
167 167
     }
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
     if ($this->isNew()) {
194 194
       // No DB_ID - new unit
195 195
       if ($this->isEmpty()) {
196
-        classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - object is empty on ' . get_called_class() . '::dbSave');
196
+        classSupernova::$debug->error(__FILE__.':'.__LINE__.' - object is empty on '.get_called_class().'::dbSave');
197 197
       }
198 198
       $this->dbInsert();
199 199
     } else {
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
         $this->dbDelete();
203 203
       } else {
204 204
         if (!sn_db_transaction_check(false)) {
205
-          classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - transaction should always be started on ' . get_called_class() . '::dbUpdate');
205
+          classSupernova::$debug->error(__FILE__.':'.__LINE__.' - transaction should always be started on '.get_called_class().'::dbUpdate');
206 206
         }
207 207
         $this->dbUpdate();
208 208
       }
@@ -230,13 +230,13 @@  discard block
 block discarded – undo
230 230
   // TODO - protected
231 231
   public function dbInsert() {
232 232
     if (!$this->isNew()) {
233
-      classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - record db_id is not empty on ' . get_called_class() . '::dbInsert');
233
+      classSupernova::$debug->error(__FILE__.':'.__LINE__.' - record db_id is not empty on '.get_called_class().'::dbInsert');
234 234
     }
235 235
 
236 236
     $fieldSet = $this->dbMakeFieldSet(false);
237 237
 
238 238
     if (!static::$db->doInsertSet(static::$_table, $fieldSet)) {
239
-      classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - error saving record ' . get_called_class() . '::dbInsert');
239
+      classSupernova::$debug->error(__FILE__.':'.__LINE__.' - error saving record '.get_called_class().'::dbInsert');
240 240
     }
241 241
     $this->_dbId = static::$db->db_insert_id();
242 242
 
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
   public function dbUpdate() {
251 251
     // TODO - Update
252 252
     if ($this->isNew()) {
253
-      classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - unit db_id is empty on dbUpdate');
253
+      classSupernova::$debug->error(__FILE__.':'.__LINE__.' - unit db_id is empty on dbUpdate');
254 254
     }
255 255
     $this->db_field_update($this->dbMakeFieldUpdate());
256 256
   }
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
   // TODO - protected
262 262
   public function dbDelete() {
263 263
     if ($this->isNew()) {
264
-      classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - unit db_id is empty on dbDelete');
264
+      classSupernova::$debug->error(__FILE__.':'.__LINE__.' - unit db_id is empty on dbDelete');
265 265
     }
266 266
     classSupernova::$gc->db->doDeleteRow(
267 267
       static::$_table,
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
       }
453 453
     }
454 454
 
455
-    if(empty($set)) {
455
+    if (empty($set)) {
456 456
       $theResult = true;
457 457
     } else {
458 458
       $theResult = classSupernova::$db->doUpdateRowAdjust(
Please login to merge, or discard this patch.
classes/Entity/KeyedModel.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@
 block discarded – undo
90 90
   /**
91 91
    * @param KeyedContainer $cEntity
92 92
    */
93
-  protected function onSaveUnchanged($cEntity){
93
+  protected function onSaveUnchanged($cEntity) {
94 94
     // TODO - or just save nothing ?????
95 95
     // throw new \Exception('EntityModel isNotEmpty, have dbId and not CHANGED! It can\'t be!');
96 96
     // Do nothing
Please login to merge, or discard this patch.