Completed
Push — work-fleets ( cb2521...9eb2f3 )
by SuperNova.WS
08:26
created
includes/includes/flt_mission_hold.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
  * @copyright 2008 by Gorlum for Project "SuperNova.WS"
11 11
  */
12 12
 function flt_mission_hold($mission_data) {
13
-  if($mission_data->fleet->time_mission_job_complete < SN_TIME_NOW) {
13
+  if ($mission_data->fleet->time_mission_job_complete < SN_TIME_NOW) {
14 14
     $mission_data->fleet->mark_fleet_as_returned_and_save();
15 15
 
16 16
     return CACHE_FLEET;
Please login to merge, or discard this patch.
includes/includes/coe_simulator_helpers.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -4,9 +4,9 @@  discard block
 block discarded – undo
4 4
 {
5 5
   $strPacked = "{$type}!";
6 6
 
7
-  foreach($combat as $fleetID => $fleetCompress)
7
+  foreach ($combat as $fleetID => $fleetCompress)
8 8
   {
9
-    foreach($fleetCompress as $key => $value)
9
+    foreach ($fleetCompress as $key => $value)
10 10
     {
11 11
       $value = intval($value);
12 12
       $strPacked .= "{$key},{$value};";
@@ -22,29 +22,29 @@  discard block
 block discarded – undo
22 22
   $fleet_id = 0;
23 23
 
24 24
   $arr_data_unpacked = explode('!', $str_data);
25
-  foreach($arr_data_unpacked as $data_piece)
25
+  foreach ($arr_data_unpacked as $data_piece)
26 26
   {
27
-    if(!$data_piece)
27
+    if (!$data_piece)
28 28
     {
29 29
       continue;
30 30
     }
31 31
 
32
-    if($data_piece == 'A' || $data_piece == 'D')
32
+    if ($data_piece == 'A' || $data_piece == 'D')
33 33
     {
34 34
       $fleet_type = $data_piece;
35 35
       continue;
36 36
     }
37 37
 
38 38
     $arr_unit_strings = explode(';', $data_piece);
39
-    foreach($arr_unit_strings as $str_unit_string)
39
+    foreach ($arr_unit_strings as $str_unit_string)
40 40
     {
41
-      if(!$str_unit_string)
41
+      if (!$str_unit_string)
42 42
       {
43 43
         continue;
44 44
       }
45 45
 
46 46
       $arr_unit_data = explode(',', $str_unit_string);
47
-      if($arr_unit_data[1])
47
+      if ($arr_unit_data[1])
48 48
       {
49 49
         $unpacked[$fleet_type][$fleet_id][$arr_unit_data[0]] = intval($arr_unit_data[1]);
50 50
       }
Please login to merge, or discard this patch.
includes/includes/flt_mission_attack.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,14 +17,14 @@
 block discarded – undo
17 17
 function flt_mission_attack($objMission) {
18 18
   $objFleet = $objMission->fleet;
19 19
 
20
-  if($objFleet->shipsGetTotal() <= 0) {
20
+  if ($objFleet->shipsGetTotal() <= 0) {
21 21
     return null;
22 22
   }
23 23
 
24 24
   $destination_user = $objMission->dst_user;
25 25
   $destination_planet = $objMission->dst_planet;
26 26
 
27
-  if(
27
+  if (
28 28
     // Нет данных о планете назначения или её владельце
29 29
     empty($destination_user) || empty($destination_planet) || !is_array($destination_user) || !is_array($destination_planet)
30 30
     ||
Please login to merge, or discard this patch.
admin/includes/admin_planet_edit.inc.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,12 +21,12 @@  discard block
 block discarded – undo
21 21
 
22 22
 function sn_admin_planet_edit_template(&$template, $edit_planet_row, $mode) {
23 23
   $unit_list = sn_get_groups($mode);
24
-  if(empty($unit_list)) {
24
+  if (empty($unit_list)) {
25 25
     return;
26 26
   }
27 27
   $name_list = classLocale::$lang['tech'];
28 28
 
29
-  foreach($unit_list as $unit_id) {
29
+  foreach ($unit_list as $unit_id) {
30 30
     $template->assign_block_vars('unit', array(
31 31
       'ID'    => $unit_id,
32 32
       'NAME'  => $name_list[$unit_id],
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 function admin_planet_edit_query_string($unit_id, $unit_amount, $mode) { return sn_function_call(__FUNCTION__, array($unit_id, $unit_amount, $mode)); }
40 40
 
41 41
 function sn_admin_planet_edit_query_string($unit_id, $unit_amount, $mode) {
42
-  if($unit_amount && in_array($unit_id, sn_get_groups($mode))) {
42
+  if ($unit_amount && in_array($unit_id, sn_get_groups($mode))) {
43 43
     $unit_amount = round($unit_amount);
44 44
     $unit_name = get_unit_param($unit_id, P_NAME);
45 45
     $result = "{$unit_name} = GREATEST(0, {$unit_name} + ({$unit_amount}))";
Please login to merge, or discard this patch.
includes/pages/contact.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
   $query = db_user_list("`authlevel` > 0 ORDER BY `authlevel` ASC");
17 17
 
18 18
   // while($row = db_fetch($query))
19
-  foreach($query as $row) {
19
+  foreach ($query as $row) {
20 20
     $template_result['.']['contact'][] = array(
21 21
       'NAME'  => $row['username'],
22 22
       'LEVEL' => classLocale::$lang['user_level'][$row['authlevel']],
Please login to merge, or discard this patch.
includes/includes/mrc_mercenary.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -4,13 +4,13 @@  discard block
 block discarded – undo
4 4
 
5 5
 function mrc_officer_accessible(&$user, $mercenary_id) {
6 6
   $mercenary_info = get_unit_param($mercenary_id);
7
-  if(classSupernova::$config->empire_mercenary_temporary || $mercenary_info[P_UNIT_TYPE] == UNIT_PLANS) {
7
+  if (classSupernova::$config->empire_mercenary_temporary || $mercenary_info[P_UNIT_TYPE] == UNIT_PLANS) {
8 8
     return true;
9 9
   }
10 10
 
11
-  if(isset($mercenary_info[P_REQUIRE])) {
12
-    foreach($mercenary_info[P_REQUIRE] as $unit_id => $unit_level) {
13
-      if(mrc_get_level($user, null, $unit_id) < $unit_level) {
11
+  if (isset($mercenary_info[P_REQUIRE])) {
12
+    foreach ($mercenary_info[P_REQUIRE] as $unit_id => $unit_level) {
13
+      if (mrc_get_level($user, null, $unit_id) < $unit_level) {
14 14
         return false;
15 15
       }
16 16
     }
@@ -26,35 +26,35 @@  discard block
 block discarded – undo
26 26
     $is_permanent = $mode == UNIT_PLANS || !classSupernova::$config->empire_mercenary_temporary;
27 27
     $cost_alliance_multiplyer = (SN_IN_ALLY === true && $mode == UNIT_PLANS ? classSupernova::$config->ali_bonus_members : 1);
28 28
     $cost_alliance_multiplyer = $cost_alliance_multiplyer >= 1 ? $cost_alliance_multiplyer : 1;
29
-    if(!in_array($mercenary_id, sn_get_groups($mode == UNIT_PLANS ? 'plans' : 'mercenaries'))) {
29
+    if (!in_array($mercenary_id, sn_get_groups($mode == UNIT_PLANS ? 'plans' : 'mercenaries'))) {
30 30
       throw new Exception(classLocale::$lang['mrc_msg_error_wrong_mercenary'], ERR_ERROR);
31 31
     }
32 32
 
33
-    if(!mrc_officer_accessible($user, $mercenary_id)) {
33
+    if (!mrc_officer_accessible($user, $mercenary_id)) {
34 34
       throw new Exception(classLocale::$lang['mrc_msg_error_requirements'], ERR_ERROR);
35 35
     }
36 36
 
37 37
     $mercenary_level = sys_get_param_int('mercenary_level');
38
-    if($mercenary_level < 0 || $mercenary_level > get_unit_param($mercenary_id, P_MAX_STACK)) {
38
+    if ($mercenary_level < 0 || $mercenary_level > get_unit_param($mercenary_id, P_MAX_STACK)) {
39 39
       throw new Exception(classLocale::$lang['mrc_msg_error_wrong_level'], ERR_ERROR);
40 40
     }
41 41
 
42
-    if($mercenary_level && !array_key_exists($mercenary_period = sys_get_param_int('mercenary_period'), $sn_powerup_buy_discounts)) {
42
+    if ($mercenary_level && !array_key_exists($mercenary_period = sys_get_param_int('mercenary_period'), $sn_powerup_buy_discounts)) {
43 43
       throw new Exception(classLocale::$lang['mrc_msg_error_wrong_period'], ERR_ERROR);
44 44
     }
45 45
 
46 46
     sn_db_transaction_start();
47 47
 
48 48
     $mercenary_level_old = mrc_get_level($user, $planetrow, $mercenary_id, true, true);
49
-    if(classSupernova::$config->empire_mercenary_temporary && $mercenary_level_old && $mercenary_level) {
49
+    if (classSupernova::$config->empire_mercenary_temporary && $mercenary_level_old && $mercenary_level) {
50 50
       throw new Exception(classLocale::$lang['mrc_msg_error_already_hired'], ERR_ERROR); // Can't hire already hired temp mercenary - dismiss first
51
-    } elseif(classSupernova::$config->empire_mercenary_temporary && !$mercenary_level_old && !$mercenary_level) {
51
+    } elseif (classSupernova::$config->empire_mercenary_temporary && !$mercenary_level_old && !$mercenary_level) {
52 52
       throw new Exception('', ERR_NONE); // Can't dismiss (!$mercenary_level) not hired (!$mercenary_level_old) temp mercenary. But no error
53 53
     }
54 54
 
55
-    if($mercenary_level) {
55
+    if ($mercenary_level) {
56 56
       $darkmater_cost = eco_get_total_cost($mercenary_id, $mercenary_level);
57
-      if(!classSupernova::$config->empire_mercenary_temporary && $mercenary_level_old) {
57
+      if (!classSupernova::$config->empire_mercenary_temporary && $mercenary_level_old) {
58 58
         $darkmater_cost_old = eco_get_total_cost($mercenary_id, $mercenary_level_old);
59 59
         $darkmater_cost[BUILD_CREATE][RES_DARK_MATTER] -= $darkmater_cost_old[BUILD_CREATE][RES_DARK_MATTER];
60 60
       }
@@ -64,13 +64,13 @@  discard block
 block discarded – undo
64 64
     }
65 65
     $darkmater_cost *= $cost_alliance_multiplyer;
66 66
 
67
-    if(mrc_get_level($user, null, RES_DARK_MATTER) < $darkmater_cost) {
67
+    if (mrc_get_level($user, null, RES_DARK_MATTER) < $darkmater_cost) {
68 68
       throw new Exception(classLocale::$lang['mrc_msg_error_no_resource'], ERR_ERROR);
69 69
     }
70 70
 
71
-    if(($darkmater_cost && $mercenary_level) || !$is_permanent) {
71
+    if (($darkmater_cost && $mercenary_level) || !$is_permanent) {
72 72
       $unit_row = db_unit_by_location($user['id'], LOC_USER, $user['id'], $mercenary_id);
73
-      if(is_array($unit_row) && ($dismiss_left_days = floor((strtotime($unit_row['unit_time_finish']) - SN_TIME_NOW) / PERIOD_DAY))) {
73
+      if (is_array($unit_row) && ($dismiss_left_days = floor((strtotime($unit_row['unit_time_finish']) - SN_TIME_NOW) / PERIOD_DAY))) {
74 74
         $dismiss_full_cost = eco_get_total_cost($mercenary_id, $unit_row['unit_level']);
75 75
         $dismiss_full_cost = $dismiss_full_cost[BUILD_CREATE][RES_DARK_MATTER];
76 76
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
       db_unit_list_delete($user['id'], LOC_USER, $user['id'], $mercenary_id);
84 84
     }
85 85
 
86
-    if($darkmater_cost && $mercenary_level) {
86
+    if ($darkmater_cost && $mercenary_level) {
87 87
       db_unit_set_insert(
88 88
         "unit_player_id = {$user['id']},
89 89
         unit_location_type = " . LOC_USER . ",
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
     }
101 101
     sn_db_transaction_commit();
102 102
     sys_redirect($_SERVER['REQUEST_URI']);
103
-  } catch(Exception $e) {
103
+  } catch (Exception $e) {
104 104
     sn_db_transaction_rollback();
105 105
     $operation_result = array(
106 106
       'STATUS'  => in_array($e->getCode(), array(ERR_NONE, ERR_WARNING, ERR_ERROR)) ? $e->getCode() : ERR_ERROR,
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
   $mode = in_array($mode, array(UNIT_MERCENARIES, UNIT_PLANS)) ? $mode : UNIT_MERCENARIES;
119 119
   $is_permanent = $mode == UNIT_PLANS || !classSupernova::$config->empire_mercenary_temporary;
120 120
 
121
-  if($mercenary_id = sys_get_param_int('mercenary_id')) {
121
+  if ($mercenary_id = sys_get_param_int('mercenary_id')) {
122 122
     $operation_result = mrc_mercenary_hire($mode, $user, $mercenary_id);
123 123
   }
124 124
 
@@ -126,11 +126,11 @@  discard block
 block discarded – undo
126 126
 
127 127
   $template = gettemplate('mrc_mercenary_hire', true);
128 128
 
129
-  if(!empty($operation_result)) {
129
+  if (!empty($operation_result)) {
130 130
     $template->assign_block_vars('result', $operation_result);
131 131
   }
132 132
 
133
-  foreach($sn_powerup_buy_discounts as $hire_period => $hire_discount) {
133
+  foreach ($sn_powerup_buy_discounts as $hire_period => $hire_discount) {
134 134
     $template->assign_block_vars('period', array(
135 135
       'LENGTH'   => $hire_period,
136 136
       'TEXT'     => classLocale::$lang['mrc_period_list'][$hire_period],
@@ -142,12 +142,12 @@  discard block
 block discarded – undo
142 142
   $user_dark_matter = mrc_get_level($user, null, RES_DARK_MATTER);
143 143
   $cost_alliance_multiplyer = (SN_IN_ALLY === true && $mode == UNIT_PLANS ? classSupernova::$config->ali_bonus_members : 1);
144 144
   $cost_alliance_multiplyer = $cost_alliance_multiplyer >= 1 ? $cost_alliance_multiplyer : 1;
145
-  foreach(sn_get_groups($mode == UNIT_PLANS ? 'plans' : 'mercenaries') as $mercenary_id) {
145
+  foreach (sn_get_groups($mode == UNIT_PLANS ? 'plans' : 'mercenaries') as $mercenary_id) {
146 146
     {
147 147
       $mercenary = get_unit_param($mercenary_id);
148 148
       $mercenary_bonus = $mercenary['bonus'];
149 149
       $mercenary_bonus = $mercenary_bonus >= 0 ? "+{$mercenary_bonus}" : "{$mercenary_bonus}";
150
-      switch($mercenary['bonus_type']) {
150
+      switch ($mercenary['bonus_type']) {
151 151
         case BONUS_PERCENT:
152 152
           $mercenary_bonus = "{$mercenary_bonus}% ";
153 153
         break;
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
       $mercenary_level = mrc_get_level($user, null, $mercenary_id, false, true);
165 165
       $mercenary_level_bonus = max(0, mrc_get_level($user, null, $mercenary_id) - $mercenary_level);
166 166
       $total_cost_old = 0;
167
-      if($is_permanent) {
167
+      if ($is_permanent) {
168 168
         $total_cost_old = eco_get_total_cost($mercenary_id, $mercenary_level);
169 169
         $total_cost_old = $total_cost_old[BUILD_CREATE][RES_DARK_MATTER] * $cost_alliance_multiplyer;
170 170
       }
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
       ));
194 194
 
195 195
       $upgrade_cost = 1;
196
-      for($i = classSupernova::$config->empire_mercenary_temporary ? 1 : $mercenary_level + 1; $mercenary['max'] ? ($i <= $mercenary['max']) : $upgrade_cost <= $user_dark_matter; $i++) {
196
+      for ($i = classSupernova::$config->empire_mercenary_temporary ? 1 : $mercenary_level + 1; $mercenary['max'] ? ($i <= $mercenary['max']) : $upgrade_cost <= $user_dark_matter; $i++) {
197 197
         $total_cost = eco_get_total_cost($mercenary_id, $i);
198 198
         $total_cost[BUILD_CREATE][RES_DARK_MATTER] *= $cost_alliance_multiplyer;
199 199
         $upgrade_cost = $total_cost[BUILD_CREATE][RES_DARK_MATTER] - $total_cost_old;
Please login to merge, or discard this patch.
includes/includes/flt_page5.inc 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 *
13 13
 **/
14 14
 
15
-if(SN_IN_FLEET !== true) {
15
+if (SN_IN_FLEET !== true) {
16 16
   $debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403);
17 17
 }
18 18
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
   $planet_list = array();
27 27
 
28
-  if(is_array($resources_taken))
28
+  if (is_array($resources_taken))
29 29
   {
30 30
     $query = implode(',', array_keys($resources_taken));
31 31
     $query = " AND `destruyed` = 0 AND `id` IN ({$query})";
@@ -33,16 +33,16 @@  discard block
 block discarded – undo
33 33
     $query = '';
34 34
   }
35 35
 
36
-  foreach(sn_get_groups('flt_transports') as $transport_id) {
36
+  foreach (sn_get_groups('flt_transports') as $transport_id) {
37 37
     $transports[$transport_id] = get_unit_param($transport_id, P_CAPACITY);
38 38
   }
39 39
   arsort($transports);
40 40
 
41 41
   $planets_db_list = db_planet_list_sorted($user, $planetrow['id'], '*', $query);
42 42
   !is_array($planets_db_list) ? $planets_db_list = array() : false;
43
-  foreach($planets_db_list as $planet_db_data) {
43
+  foreach ($planets_db_list as $planet_db_data) {
44 44
   // begin planet loop
45
-    if(!$query) {
45
+    if (!$query) {
46 46
       $resources_taken[$planet_db_data['id']] = 1;
47 47
     }
48 48
     sn_db_transaction_start();
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
     $planet_id = $planet_db_data['id'];
55 55
 
56 56
     $planet_resources = 0;
57
-    foreach(sn_get_groups('resources_loot') as $resource_id) {
58
-      if($resources_taken[$planet_id] == 1 || $resources_taken[$planet_id][$resource_id]) {
57
+    foreach (sn_get_groups('resources_loot') as $resource_id) {
58
+      if ($resources_taken[$planet_id] == 1 || $resources_taken[$planet_id][$resource_id]) {
59 59
         $planet_resources += floor(mrc_get_level($user, $planet_db_data, $resource_id, true, true)); // $planet_db_data[get_unit_param($resource_id, P_NAME)]);
60 60
       }
61 61
     }
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
     $fleet_capacity = 0;
87 87
     $ship_loadout = array();
88 88
     $fleet = array();
89
-    foreach($transports as $ship_id => $ship_capacity) {
90
-      if($ship_count = mrc_get_level($user, $planet_db_data, $ship_id, true, true)) {
89
+    foreach ($transports as $ship_id => $ship_capacity) {
90
+      if ($ship_count = mrc_get_level($user, $planet_db_data, $ship_id, true, true)) {
91 91
         $ship_loadout[$ship_id]['capacity'] = $ship_count * $ship_capacity;
92 92
         $ship_loadout[$ship_id]['taken'] = 0;
93 93
         $fleet_capacity += $ship_loadout[$ship_id]['capacity'];
@@ -98,9 +98,9 @@  discard block
 block discarded – undo
98 98
 
99 99
     $will_take = min($planet_resources, $fleet_capacity);
100 100
 
101
-    foreach($ship_loadout as $ship_id => &$planet_ship) {
101
+    foreach ($ship_loadout as $ship_id => &$planet_ship) {
102 102
       $can_take = min($will_take, $planet_ship['capacity']);
103
-      if($can_take <= 0) {
103
+      if ($can_take <= 0) {
104 104
         continue;
105 105
       }
106 106
       $planet_ship['capacity'] -= $can_take;
@@ -108,23 +108,23 @@  discard block
 block discarded – undo
108 108
       $fleet[$ship_id] = ceil($planet_ship['taken'] / $transports[$ship_id]);
109 109
 
110 110
       $will_take -= $can_take;
111
-      if($will_take <= 0) {
111
+      if ($will_take <= 0) {
112 112
         break;
113 113
       }
114 114
     }
115 115
 
116
-    if(!empty($fleet)) {
116
+    if (!empty($fleet)) {
117 117
       $travel_data = flt_travel_data($user, $planetrow, $planet_db_data, $fleet, 10);
118 118
       $planet_data['FLEET_SPEED'] = $travel_data['fleet_speed'];
119 119
       $planet_data['DISTANCE']    = $travel_data['distance'];
120 120
       $planet_data['DURATION']    = $travel_data['duration'];
121 121
       $planet_data['CONSUMPTION'] = $travel_data['consumption'];
122 122
 
123
-      if(floor(mrc_get_level($user, $planet_db_data, RES_DEUTERIUM, true)) >= $planet_data['CONSUMPTION']) {
123
+      if (floor(mrc_get_level($user, $planet_db_data, RES_DEUTERIUM, true)) >= $planet_data['CONSUMPTION']) {
124 124
         $will_take = min($planet_resources, $fleet_capacity) - $planet_data['CONSUMPTION'];
125 125
 
126
-        foreach(sn_get_groups('resources_loot') as $resource_id) {
127
-          if($resources_taken[$planet_id] != 1 && !$resources_taken[$planet_id][$resource_id]) {
126
+        foreach (sn_get_groups('resources_loot') as $resource_id) {
127
+          if ($resources_taken[$planet_id] != 1 && !$resources_taken[$planet_id][$resource_id]) {
128 128
             continue;
129 129
           }
130 130
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
           $fleet[$resource_id] = min($will_take, $resource_amount);
134 134
           $will_take -= $resource_amount;
135 135
 
136
-          if($will_take <= 0) {
136
+          if ($will_take <= 0) {
137 137
             break;
138 138
           }
139 139
         }
@@ -157,19 +157,19 @@  discard block
 block discarded – undo
157 157
 
158 158
 $resources_taken = sys_get_param('resources');
159 159
 
160
-if(!empty($resources_taken))  { // begin processing parameters
160
+if (!empty($resources_taken)) { // begin processing parameters
161 161
   $planet_list = flt_build_gathering($resources_taken);
162 162
 
163
-  foreach($planet_list as $planet_id => $planet_data) {
164
-    if($planet_data['RESULT'] == FLIGHT_ALLOWED) {
163
+  foreach ($planet_list as $planet_id => $planet_data) {
164
+    if ($planet_data['RESULT'] == FLIGHT_ALLOWED) {
165 165
       $planet_data['RESULT'] = flt_t_send_fleet($user, $planet_data['PLANET_DB_DATA'], $planetrow, $planet_data['FLEET'], MT_TRANSPORT);
166 166
     }
167 167
 
168 168
     $planet_data['MESSAGE'] = classLocale::$lang['fl_attack_error'][$planet_data['RESULT']];
169 169
 
170 170
     $template->assign_block_vars('results', $planet_data);
171
-    if(!empty($planet_data['FLEET']) && $planet_data['RESULT'] == FLIGHT_ALLOWED) {
172
-      foreach($planet_data['FLEET'] as $unit_id => $amount) {
171
+    if (!empty($planet_data['FLEET']) && $planet_data['RESULT'] == FLIGHT_ALLOWED) {
172
+      foreach ($planet_data['FLEET'] as $unit_id => $amount) {
173 173
         $template->assign_block_vars('results.units', array(
174 174
           'ID'     => $unit_id,
175 175
           'NAME'   => classLocale::$lang['tech'][$unit_id],
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 
183 183
 // Building list of own planets & moons
184 184
 $planet_list = flt_build_gathering();
185
-foreach($planet_list as $planet_data) {
185
+foreach ($planet_list as $planet_data) {
186 186
   $planet_data['DURATION'] = $planet_data['DURATION'] ? pretty_time($planet_data['DURATION']) : classLocale::$lang['flt_no_fuel'];
187 187
   $template->assign_block_vars('colonies', $planet_data);
188 188
 }
Please login to merge, or discard this patch.
includes/functions/int_fleet_events.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -6,26 +6,26 @@  discard block
 block discarded – undo
6 6
   $fleet_events = array();
7 7
   $fleet_number = 0;
8 8
 
9
-  if($objFleetList->count() <= 0) {
9
+  if ($objFleetList->count() <= 0) {
10 10
     return;
11 11
   }
12 12
 
13
-  foreach($objFleetList->_container as $objFleet) {
13
+  foreach ($objFleetList->_container as $objFleet) {
14 14
     $planet_start_type = $objFleet->fleet_start_type == PT_MOON ? PT_MOON : PT_PLANET;
15 15
     $planet_start = db_planet_by_gspt($objFleet->fleet_start_galaxy, $objFleet->fleet_start_system, $objFleet->fleet_start_planet, $planet_start_type, false, 'name');
16 16
     $objFleet->fleet_start_name = $planet_start['name'];
17 17
 
18 18
     $planet_end_type = $objFleet->fleet_end_type == PT_MOON ? PT_MOON : PT_PLANET;
19
-    if($objFleet->fleet_end_planet > Vector::$knownPlanets) {
19
+    if ($objFleet->fleet_end_planet > Vector::$knownPlanets) {
20 20
       $objFleet->fleet_end_name = classLocale::$lang['ov_fleet_exploration'];
21
-    } elseif($objFleet->mission_type == MT_COLONIZE) {
21
+    } elseif ($objFleet->mission_type == MT_COLONIZE) {
22 22
       $objFleet->fleet_end_name = classLocale::$lang['ov_fleet_colonization'];
23 23
     } else {
24 24
       $planet_end = db_planet_by_gspt($objFleet->fleet_end_galaxy, $objFleet->fleet_end_system, $objFleet->fleet_end_planet, $planet_end_type, false, 'name');
25 25
       $objFleet->fleet_end_name = $planet_end['name'];
26 26
     }
27 27
 
28
-    if($objFleet->time_arrive_to_target > SN_TIME_NOW && !$objFleet->isReturning() && $objFleet->mission_type != MT_MISSILE &&
28
+    if ($objFleet->time_arrive_to_target > SN_TIME_NOW && !$objFleet->isReturning() && $objFleet->mission_type != MT_MISSILE &&
29 29
       ($planet_scanned === false
30 30
         ||
31 31
         (
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
       $fleet_events[] = flt_register_event_objFleet($objFleet, 0, $planet_end_type);
40 40
     }
41 41
 
42
-    if($objFleet->time_mission_job_complete > SN_TIME_NOW && !$objFleet->isReturning() && $planet_scanned === false && $objFleet->mission_type != MT_MISSILE) {
42
+    if ($objFleet->time_mission_job_complete > SN_TIME_NOW && !$objFleet->isReturning() && $planet_scanned === false && $objFleet->mission_type != MT_MISSILE) {
43 43
       $fleet_events[] = flt_register_event_objFleet($objFleet, 1, $planet_end_type);
44 44
     }
45 45
 
46
-    if(
46
+    if (
47 47
       $objFleet->time_return_to_source > SN_TIME_NOW && $objFleet->mission_type != MT_MISSILE && ($objFleet->isReturning() || ($objFleet->mission_type != MT_RELOCATE && $objFleet->mission_type != MT_COLONIZE)) &&
48 48
       (
49 49
         ($planet_scanned === false && $objFleet->playerOwnerId == $user['id'])
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
       $fleet_events[] = flt_register_event_objFleet($objFleet, 2, $planet_end_type);
60 60
     }
61 61
 
62
-    if($objFleet->mission_type == MT_MISSILE) {
62
+    if ($objFleet->mission_type == MT_MISSILE) {
63 63
       $fleet_events[] = flt_register_event_objFleet($objFleet, 3, $planet_end_type);
64 64
     }
65 65
   }
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 
80 80
   $is_this_planet = false;
81 81
 
82
-  switch($objFleet->ov_label = $ov_label) {
82
+  switch ($objFleet->ov_label = $ov_label) {
83 83
     case 0:
84 84
       $objFleet->event_time = $objFleet->time_arrive_to_target;
85 85
       $is_this_planet = (
@@ -110,9 +110,9 @@  discard block
 block discarded – undo
110 110
 
111 111
   }
112 112
 
113
-  $objFleet->ov_this_planet = $is_this_planet;// || $planet_scanned != false;
113
+  $objFleet->ov_this_planet = $is_this_planet; // || $planet_scanned != false;
114 114
 
115
-  if($objFleet->playerOwnerId == $user['id']) {
115
+  if ($objFleet->playerOwnerId == $user['id']) {
116 116
     $user_data = $user;
117 117
   } else {
118 118
     $user_data = db_user_by_id($objFleet->playerOwnerId);
Please login to merge, or discard this patch.
ajax_version_check.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,42 +1,42 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-require_once('includes/init.' . substr(strrchr(__FILE__, '.'), 1));
3
+require_once('includes/init.'.substr(strrchr(__FILE__, '.'), 1));
4 4
 
5 5
 $mode = sys_get_param_int('mode');
6 6
 $ajax = sys_get_param_int('ajax');
7 7
 
8
-$url = 'http://supernova.ws/version_check.php?mode=' . $mode
9
-  . '&db=' . DB_VERSION
10
-  . '&release=' . SN_RELEASE
11
-  . '&version=' . SN_VERSION
12
-  . '&key=' . urlencode(classSupernova::$config->server_updater_key)
13
-  . '&id=' . urlencode(classSupernova::$config->server_updater_id);
8
+$url = 'http://supernova.ws/version_check.php?mode='.$mode
9
+  . '&db='.DB_VERSION
10
+  . '&release='.SN_RELEASE
11
+  . '&version='.SN_VERSION
12
+  . '&key='.urlencode(classSupernova::$config->server_updater_key)
13
+  . '&id='.urlencode(classSupernova::$config->server_updater_id);
14 14
 
15
-switch($mode) {
15
+switch ($mode) {
16 16
   case SNC_MODE_REGISTER:
17
-    if(classSupernova::$config->server_updater_key || classSupernova::$config->server_updater_id) {
18
-      if($ajax) {
17
+    if (classSupernova::$config->server_updater_key || classSupernova::$config->server_updater_id) {
18
+      if ($ajax) {
19 19
         print(SNC_VER_REGISTER_ERROR_REGISTERED);
20 20
       }
21 21
       die();
22 22
     }
23
-    $url .= "&name=" . urlencode(classSupernova::$config->game_name) . "&url=" . urlencode(SN_ROOT_VIRTUAL);
23
+    $url .= "&name=".urlencode(classSupernova::$config->game_name)."&url=".urlencode(SN_ROOT_VIRTUAL);
24 24
   break;
25 25
 }
26 26
 
27 27
 $check_result = sn_get_url_contents($url);
28
-if(!$check_result) {
28
+if (!$check_result) {
29 29
   $version_check = SNC_VER_ERROR_CONNECT;
30
-} elseif(($version_check = intval($check_result)) && $version_check == $check_result) {
30
+} elseif (($version_check = intval($check_result)) && $version_check == $check_result) {
31 31
   $version_check = $check_result;
32 32
 } else {
33 33
   // JSON decode if string
34 34
   $check_result = json_decode($check_result, true);
35 35
   $version_check = $check_result === null ? SNC_VER_UNKNOWN_RESPONSE : $check_result['version_check'];
36 36
 
37
-  switch($mode) {
37
+  switch ($mode) {
38 38
     case SNC_MODE_REGISTER:
39
-      if($check_result['site']['site_key'] && $check_result['site']['site_id'] && $check_result['site']['result'] == SNC_VER_REGISTER_REGISTERED) {
39
+      if ($check_result['site']['site_key'] && $check_result['site']['site_id'] && $check_result['site']['result'] == SNC_VER_REGISTER_REGISTERED) {
40 40
         classSupernova::$config->db_saveItem('server_updater_key', $check_result['site']['site_key']);
41 41
         classSupernova::$config->db_saveItem('server_updater_id', $check_result['site']['site_id']);
42 42
       }
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 classSupernova::$config->db_saveItem('server_updater_check_last', SN_TIME_NOW);
50 50
 classSupernova::$config->db_saveItem('server_updater_check_result', $version_check);
51 51
 
52
-if($ajax) {
52
+if ($ajax) {
53 53
   define('IN_AJAX', true);
54 54
   print($version_check);
55 55
 }
Please login to merge, or discard this patch.