Completed
Push — trunk ( 5a98ee...c2d255 )
by SuperNova.WS
04:09
created
includes/includes/flt_page3.inc 1 patch
Spacing   +41 added lines, -42 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 // @version 1.0
4 4
 // @copyright 2008 by Chlorel for XNova
5 5
 
6
-if(SN_IN_FLEET !== true) {
6
+if (SN_IN_FLEET !== true) {
7 7
   $debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403);
8 8
 }
9 9
 
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     $errorlist .= $lang['fl_limit_galaxy'];
23 23
   if (!$system || $system > $config->game_maxSystem || $system < 1)
24 24
     $errorlist .= $lang['fl_limit_system'];
25
-  if (!$planet || $planet < 1 || ($planet > $config->game_maxPlanet && $target_mission != MT_EXPLORE ))
25
+  if (!$planet || $planet < 1 || ($planet > $config->game_maxPlanet && $target_mission != MT_EXPLORE))
26 26
     $errorlist .= $lang['fl_limit_planet'];
27 27
   if ($planetrow['galaxy'] == $galaxy && $planetrow['system'] == $system && $planetrow['planet'] == $planet && $planetrow['planet_type'] == $planet_type)
28 28
     $errorlist .= $lang['fl_ownpl_err'];
@@ -49,35 +49,35 @@  discard block
 block discarded – undo
49 49
   $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true);
50 50
 
51 51
   if ($target_mission == MT_EXPLORE) {
52
-    if ($MaxExpeditions == 0 ) {
52
+    if ($MaxExpeditions == 0) {
53 53
       $errorlist .= $lang['fl_expe_notech'];
54
-    } elseif ($FlyingExpeditions >= $MaxExpeditions ) {
54
+    } elseif ($FlyingExpeditions >= $MaxExpeditions) {
55 55
       $errorlist .= $lang['fl_expe_max'];
56 56
     }
57 57
   } else {
58
-    if ($TargetPlanet['id_owner']){
58
+    if ($TargetPlanet['id_owner']) {
59 59
       if ($target_mission == MT_COLONIZE)
60 60
         $errorlist .= $lang['fl_colonized'];
61 61
 
62
-      if ($TargetPlanet['id_owner'] == $planetrow['id_owner']){
62
+      if ($TargetPlanet['id_owner'] == $planetrow['id_owner']) {
63 63
         if ($target_mission == MT_ATTACK)
64 64
           $errorlist .= $lang['fl_no_self_attack'];
65 65
 
66 66
         if ($target_mission == MT_SPY)
67 67
           $errorlist .= $lang['fl_no_self_spy'];
68
-      }else{
68
+      } else {
69 69
         if ($target_mission == MT_RELOCATE)
70 70
           $errorlist .= $lang['fl_only_stay_at_home'];
71 71
       }
72
-    }else{
73
-      if ($target_mission < MT_COLONIZE){
72
+    } else {
73
+      if ($target_mission < MT_COLONIZE) {
74 74
         $errorlist .= $lang['fl_unknow_target'];
75
-      }else{
75
+      } else {
76 76
         if ($target_mission == MT_DESTROY)
77 77
           $errorlist .= $lang['fl_nomoon'];
78 78
 
79
-        if ($target_mission == MT_RECYCLE){
80
-          if($TargetPlanet['debris_metal'] + $TargetPlanet['debris_crystal'] == 0)
79
+        if ($target_mission == MT_RECYCLE) {
80
+          if ($TargetPlanet['debris_metal'] + $TargetPlanet['debris_crystal'] == 0)
81 81
             $errorlist .= $lang['fl_nodebris'];
82 82
         }
83 83
       }
@@ -85,13 +85,13 @@  discard block
 block discarded – undo
85 85
   }
86 86
 
87 87
 
88
-  if($sn_module['unit_captain']->manifest['active'] && $captain_id = sys_get_param_id('captain_id')) {
88
+  if ($sn_module['unit_captain']->manifest['active'] && $captain_id = sys_get_param_id('captain_id')) {
89 89
     $captain = $sn_module['unit_captain']->unit_captain_get($planetrow['id']);
90 90
 //      mrc_get_level($user, $planetrow, UNIT_CAPTAIN, true);
91
-    if(!$captain) {
91
+    if (!$captain) {
92 92
       $errorlist .= $lang['module_unit_captain_error_no_captain'];
93
-    } elseif($captain['unit_location_type'] == LOC_PLANET) {
94
-      if($target_mission == MT_RELOCATE && ($arriving_captain = mrc_get_level($user, $TargetPlanet, UNIT_CAPTAIN, true))) {
93
+    } elseif ($captain['unit_location_type'] == LOC_PLANET) {
94
+      if ($target_mission == MT_RELOCATE && ($arriving_captain = mrc_get_level($user, $TargetPlanet, UNIT_CAPTAIN, true))) {
95 95
         $errorlist .= $lang['module_unit_captain_error_captain_already_bound'];
96 96
       }
97 97
     } else {
@@ -101,13 +101,13 @@  discard block
 block discarded – undo
101 101
 
102 102
   if ($errorlist) {
103 103
     sn_db_transaction_rollback();
104
-    messageBox ("<span class='error'><ul>{$errorlist}</ul></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, false);
104
+    messageBox("<span class='error'><ul>{$errorlist}</ul></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, false);
105 105
   }
106 106
 
107 107
   // On verifie s'il y a assez de vaisseaux sur la planete !
108 108
   foreach ($fleetarray as $Ship => $Count) {
109 109
     if ($Count > mrc_get_level($user, $planetrow, $Ship)) {
110
-      messageBox ("<span class='error'><b>{$lang['fl_fleet_err']}</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2);
110
+      messageBox("<span class='error'><b>{$lang['fl_fleet_err']}</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2);
111 111
     }
112 112
   }
113 113
 
@@ -115,13 +115,13 @@  discard block
 block discarded – undo
115 115
   $fleet_group = max(0, intval($_POST['fleet_group']));
116 116
   //But is it acs??
117 117
   //Well all acs fleets must have a fleet code.
118
-  if($fleet_group) {
118
+  if ($fleet_group) {
119 119
     //Also it must be mission type 2
120 120
     $target_mission = MT_AKS;
121 121
 
122 122
     //The co-ords must be the same as where the acs fleet is going.
123 123
     $target = "g{$galaxy}s{$system}p{$planet}t{$planet_type}";
124
-    if($_POST['acs_target_mr'] == $target) {
124
+    if ($_POST['acs_target_mr'] == $target) {
125 125
       //ACS attack must exist (if acs fleet has arrived this will also return false (2 checks in 1!!!)
126 126
       $aks = doquery("SELECT * FROM {{aks}} WHERE id = '{$fleet_group}' LIMIT 1;", true);
127 127
       if (!$aks) {
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
     }
138 138
   }
139 139
   //Check that a failed acs attack isn't being sent, if it is, make it an attack fleet.
140
-  if(!$fleet_group && $target_mission == MT_AKS) {
140
+  if (!$fleet_group && $target_mission == MT_AKS) {
141 141
     $target_mission = MT_ATTACK;
142 142
   }
143 143
 
@@ -147,22 +147,21 @@  discard block
 block discarded – undo
147 147
   $options = array('fleet_speed_percent' => $speed_percent, 'fleet_group' => $fleet_group, 'resources' => $StorageNeeded);
148 148
   $cant_attack = flt_can_attack($planetrow, $TargetPlanet, $fleetarray, $target_mission, $options);
149 149
 
150
-  if($cant_attack !== ATTACK_ALLOWED) {
150
+  if ($cant_attack !== ATTACK_ALLOWED) {
151 151
     messageBox("<span class='error'><b>{$lang['fl_attack_error'][$cant_attack]}</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 99);
152 152
   }
153 153
 
154 154
   $speed_possible = array(10, 9, 8, 7, 6, 5, 4, 3, 2, 1);
155 155
   if (!in_array($speed_percent, $speed_possible)) {
156
-    messageBox ("<span class='error'><b>". $lang['fl_cheat_speed'] ."</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2);
156
+    messageBox("<span class='error'><b>" . $lang['fl_cheat_speed'] . "</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2);
157 157
   }
158 158
 
159 159
   $fleet['start_time'] = $duration + SN_TIME_NOW;
160 160
 
161
-  $max_duration = $target_mission == MT_EXPLORE ? get_player_max_expedition_duration($user) :
162
-    ($target_mission == MT_HOLD ? 12 : 0);
163
-  if($max_duration) {
161
+  $max_duration = $target_mission == MT_EXPLORE ? get_player_max_expedition_duration($user) : ($target_mission == MT_HOLD ? 12 : 0);
162
+  if ($max_duration) {
164 163
     $StayDuration = sys_get_param_id('missiontime');
165
-    if($StayDuration > $max_duration || $StayDuration < 1) {
164
+    if ($StayDuration > $max_duration || $StayDuration < 1) {
166 165
       $debug->warning('Supplying wrong mission time', 'Hack attempt', 302, array('base_dump' => true));
167 166
       die();
168 167
     }
@@ -172,11 +171,11 @@  discard block
 block discarded – undo
172 171
     $StayDuration = 0;
173 172
     $StayTime     = 0;
174 173
   }
175
-  $fleet['end_time']   = $StayDuration + (2 * $duration) + SN_TIME_NOW;
174
+  $fleet['end_time'] = $StayDuration + (2 * $duration) + SN_TIME_NOW;
176 175
 
177
-  if($aks && $target_mission == MT_AKS) {
178
-    if ($fleet['start_time']>$aks['ankunft']) {
179
-      messageBox ($lang['fl_aks_too_slow'] . 'Fleet arrival: ' . date(FMT_DATE_TIME,$fleet['start_time']) . " AKS arrival: " .date(FMT_DATE_TIME,$aks['ankunft']), $lang['fl_error']);
176
+  if ($aks && $target_mission == MT_AKS) {
177
+    if ($fleet['start_time'] > $aks['ankunft']) {
178
+      messageBox($lang['fl_aks_too_slow'] . 'Fleet arrival: ' . date(FMT_DATE_TIME, $fleet['start_time']) . " AKS arrival: " . date(FMT_DATE_TIME, $aks['ankunft']), $lang['fl_error']);
180 179
     }
181 180
     $fleet['start_time'] = $aks['ankunft'];
182 181
     $fleet['end_time'] = $aks['ankunft'] + $duration;
@@ -186,21 +185,21 @@  discard block
 block discarded – undo
186 185
   $FleetShipCount      = 0;
187 186
   $db_changeset = array();
188 187
   foreach ($fleetarray as $Ship => $Count) {
189
-    $FleetStorage    += get_unit_param($Ship, P_CAPACITY) * $Count;
188
+    $FleetStorage += get_unit_param($Ship, P_CAPACITY) * $Count;
190 189
     $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($Ship, -$Count, $user, $planetrow['id']);
191 190
   }
192 191
   $fleet_array = sys_unit_arr2str($fleetarray);
193
-  $FleetShipCount  += array_sum($fleetarray);
194
-  $FleetStorage        -= $consumption;
192
+  $FleetShipCount += array_sum($fleetarray);
193
+  $FleetStorage -= $consumption;
195 194
 
196
-  if ( $StorageNeeded > $FleetStorage) {
197
-    messageBox ("<span class='error'><b>". $lang['fl_nostoragespa'] . HelperString::numberFloorAndFormat($StorageNeeded - $FleetStorage) ."</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2);
195
+  if ($StorageNeeded > $FleetStorage) {
196
+    messageBox("<span class='error'><b>" . $lang['fl_nostoragespa'] . HelperString::numberFloorAndFormat($StorageNeeded - $FleetStorage) . "</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2);
198 197
   }
199 198
   if ($planetrow['deuterium'] < $TransDeuterium + $consumption) {
200
-    messageBox ("<font color=\"red\"><b>". $lang['fl_no_deuterium'] . HelperString::numberFloorAndFormat($TransDeuterium + $consumption - $planetrow['deuterium']) ."</b></font>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2);
199
+    messageBox("<font color=\"red\"><b>" . $lang['fl_no_deuterium'] . HelperString::numberFloorAndFormat($TransDeuterium + $consumption - $planetrow['deuterium']) . "</b></font>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2);
201 200
   }
202 201
   if (($planetrow['metal'] < $TransMetal) || ($planetrow['crystal'] < $TransCrystal)) {
203
-    messageBox ("<font color=\"red\"><b>". $lang['fl_no_resources'] ."</b></font>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2);
202
+    messageBox("<font color=\"red\"><b>" . $lang['fl_no_resources'] . "</b></font>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2);
204 203
   }
205 204
 
206 205
   $fleet_set = array(
@@ -242,7 +241,7 @@  discard block
 block discarded – undo
242 241
 //    ));
243 242
 //  }
244 243
 
245
-  if(is_array($captain)) {
244
+  if (is_array($captain)) {
246 245
     DBStaticUnit::db_unit_set_by_id($captain['unit_id'], "`unit_location_type` = " . LOC_FLEET . ", `unit_location_id` = {$fleet_id}");
247 246
   }
248 247
 
@@ -255,7 +254,7 @@  discard block
 block discarded – undo
255 254
     'START_LEFT'         => floor($fleet['end_time'] + 1 - SN_TIME_NOW),
256 255
   );
257 256
 
258
-  if(!empty($TargetPlanet)) {
257
+  if (!empty($TargetPlanet)) {
259 258
     $template_route += array(
260 259
       'END_TYPE_TEXT_SH' => $lang['sys_planet_type_sh'][$TargetPlanet['planet_type']],
261 260
       'END_COORDS'       => uni_render_coordinates($TargetPlanet),
@@ -268,8 +267,8 @@  discard block
 block discarded – undo
268 267
   $template->assign_block_vars('fleets', $template_route);
269 268
 
270 269
   $sn_groups_fleet = sn_get_groups('fleet');
271
-  foreach($fleetarray as $ship_id => $ship_count) {
272
-    if(in_array($ship_id, $sn_groups_fleet) && $ship_count) {
270
+  foreach ($fleetarray as $ship_id => $ship_count) {
271
+    if (in_array($ship_id, $sn_groups_fleet) && $ship_count) {
273 272
 //      $ship_base_data = get_ship_data($ship_id, $user);
274 273
       $template->assign_block_vars('fleets.ships', array(
275 274
         'ID'          => $ship_id,
Please login to merge, or discard this patch.
includes/pages/imperator.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 //    $same_user = false;
48 48
 //  }
49 49
 
50
-  if(!$user_data) {
50
+  if (!$user_data) {
51 51
     messageBox($lang['imp_imperator_none'], $lang['sys_error'], 'index.php', 10);
52 52
     die();
53 53
   }
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
   $stat_array = array();
59 59
   $query = doquery("SELECT * FROM {{statpoints}} WHERE `stat_type` = 1 AND `id_owner` = {$user_id} ORDER BY `stat_code` DESC;");
60 60
   $stat_count = classSupernova::$db->db_affected_rows();
61
-  while($row = db_fetch($query)) {
62
-    foreach($stat_fields as $field_db_name => $field_template_name) {
61
+  while ($row = db_fetch($query)) {
62
+    foreach ($stat_fields as $field_db_name => $field_template_name) {
63 63
       // $stat_count - $row['stat_code'] - для реверсирования ID статы в JS
64 64
       $stat_array[$field_template_name]['DATA'][$stat_count - $row['stat_code']] = $row[$field_db_name];
65 65
     }
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
   $stat_array_date = $stat_array['STAT_DATE'];
69 69
   empty($stat_array_date['DATA']) ? $stat_array_date['DATA'] = array() : false;
70
-  foreach($stat_array_date['DATA'] as $key => $value) {
70
+  foreach ($stat_array_date['DATA'] as $key => $value) {
71 71
     $template->assign_block_vars('stat_date', array(
72 72
       'ID' => $key,
73 73
       'VALUE' => $value,
@@ -77,21 +77,21 @@  discard block
 block discarded – undo
77 77
 
78 78
   unset($stat_array['STAT_DATE']);
79 79
   $template_data = array();
80
-  foreach($stat_array as $stat_type => &$stat_type_data) {
80
+  foreach ($stat_array as $stat_type => &$stat_type_data) {
81 81
     $reverse_min_max = strpos($stat_type, '_RANK') !== false;
82 82
     $stat_type_data['MIN'] = $reverse_min_max ? max($stat_type_data['DATA']) : min($stat_type_data['DATA']);
83 83
     $stat_type_data['MAX'] = $reverse_min_max ? min($stat_type_data['DATA']) : max($stat_type_data['DATA']);
84 84
     $stat_type_data['AVG'] = average($stat_type_data['DATA']);
85
-    foreach($stat_type_data['DATA'] as $key => $value) {
85
+    foreach ($stat_type_data['DATA'] as $key => $value) {
86 86
       $stat_type_data['PERCENT'][$key] = ($stat_type_data['MAX'] - $value ? ($value - $stat_type_data['MIN']) / ($stat_type_data['MAX'] - $stat_type_data['MIN']) : 1) * 100;
87 87
       $template_data[$stat_type][$key]['ID'] = $key;
88 88
       $template_data[$stat_type][$key]['VALUE'] = $value;
89
-      $template_data[$stat_type][$key]['DELTA'] = ($reverse_min_max ? $stat_type_data['MIN']  - $value : $value - $stat_type_data['MAX']);
89
+      $template_data[$stat_type][$key]['DELTA'] = ($reverse_min_max ? $stat_type_data['MIN'] - $value : $value - $stat_type_data['MAX']);
90 90
       $template_data[$stat_type][$key]['PERCENT'] = $stat_type_data['PERCENT'][$key];
91 91
     }
92 92
   }
93 93
 
94
-  foreach($template_data as $stat_type => $stat_type_data) {
94
+  foreach ($template_data as $stat_type => $stat_type_data) {
95 95
     $template->assign_block_vars('stat', array(
96 96
       'TYPE' => $stat_type,
97 97
       'TEXT' => $lang['imp_stat_types'][$stat_type],
@@ -99,13 +99,13 @@  discard block
 block discarded – undo
99 99
       'MAX' => $stat_array[$stat_type]['MAX'],
100 100
       'AVG' => $stat_array[$stat_type]['AVG'],
101 101
     ));
102
-    foreach($stat_type_data as $stat_entry) {
102
+    foreach ($stat_type_data as $stat_entry) {
103 103
       $template->assign_block_vars('stat.entry', $stat_entry);
104 104
     }
105 105
   }
106 106
 
107 107
 
108
-  if($same_user) {
108
+  if ($same_user) {
109 109
     rpg_level_up($user, RPG_STRUCTURE);
110 110
     rpg_level_up($user, RPG_RAID);
111 111
     rpg_level_up($user, RPG_TECH);
@@ -139,29 +139,29 @@  discard block
 block discarded – undo
139 139
     'builder_xp'           => HelperString::numberFloorAndFormat($user_data['xpminier']),
140 140
     'builder_lvl'          => HelperString::numberFloorAndFormat($user_data['lvl_minier']),
141 141
     'builder_lvl_st'       => HelperString::numberFloorAndFormat(rpg_get_miner_xp($user_data['lvl_minier'])),
142
-    'builder_lvl_up'       => HelperString::numberFloorAndFormat(rpg_get_miner_xp($user_data['lvl_minier']+1)),
142
+    'builder_lvl_up'       => HelperString::numberFloorAndFormat(rpg_get_miner_xp($user_data['lvl_minier'] + 1)),
143 143
     'raid_xp'              => HelperString::numberFloorAndFormat($user_data['xpraid']),
144 144
     'raid_lvl'             => HelperString::numberFloorAndFormat($user_data['lvl_raid']),
145
-    'raid_lvl_up'          => HelperString::numberFloorAndFormat(rpg_get_raider_xp($user_data['lvl_raid']+1)),
145
+    'raid_lvl_up'          => HelperString::numberFloorAndFormat(rpg_get_raider_xp($user_data['lvl_raid'] + 1)),
146 146
     'raids'                => HelperString::numberFloorAndFormat($user_data['raids']),
147 147
     'raidswin'             => HelperString::numberFloorAndFormat($user_data['raidswin']),
148 148
     'raidsloose'           => HelperString::numberFloorAndFormat($user_data['raidsloose']),
149 149
     'tech_xp'              => HelperString::numberFloorAndFormat($user_data['player_rpg_tech_xp']),
150 150
     'tech_lvl'             => HelperString::numberFloorAndFormat($user_data['player_rpg_tech_level']),
151 151
     'tech_lvl_st'          => HelperString::numberFloorAndFormat(rpg_get_tech_xp($user_data['player_rpg_tech_level'])),
152
-    'tech_lvl_up'          => HelperString::numberFloorAndFormat(rpg_get_tech_xp($user_data['player_rpg_tech_level']+1)),
152
+    'tech_lvl_up'          => HelperString::numberFloorAndFormat(rpg_get_tech_xp($user_data['player_rpg_tech_level'] + 1)),
153 153
 
154 154
     'explore_xp'           => HelperString::numberFloorAndFormat($user_data['player_rpg_explore_xp']),
155 155
     'explore_lvl'          => HelperString::numberFloorAndFormat($user_data['player_rpg_explore_level']),
156 156
     'explore_lvl_st'       => HelperString::numberFloorAndFormat(rpg_get_explore_xp($user_data['player_rpg_explore_level'])),
157
-    'explore_lvl_up'       => HelperString::numberFloorAndFormat(rpg_get_explore_xp($user_data['player_rpg_explore_level']+1)),
158
-
159
-    'build_points'         => HelperString::numberFloorAndFormat( $StatRecord['build_points'] ),
160
-    'tech_points'          => HelperString::numberFloorAndFormat( $StatRecord['tech_points'] ),
161
-    'fleet_points'         => HelperString::numberFloorAndFormat( $StatRecord['fleet_points'] ),
162
-    'defs_points'          => HelperString::numberFloorAndFormat( $StatRecord['defs_points'] ),
163
-    'res_points'           => HelperString::numberFloorAndFormat( $StatRecord['res_points'] ),
164
-    'total_points'         => HelperString::numberFloorAndFormat( $StatRecord['total_points'] ),
157
+    'explore_lvl_up'       => HelperString::numberFloorAndFormat(rpg_get_explore_xp($user_data['player_rpg_explore_level'] + 1)),
158
+
159
+    'build_points'         => HelperString::numberFloorAndFormat($StatRecord['build_points']),
160
+    'tech_points'          => HelperString::numberFloorAndFormat($StatRecord['tech_points']),
161
+    'fleet_points'         => HelperString::numberFloorAndFormat($StatRecord['fleet_points']),
162
+    'defs_points'          => HelperString::numberFloorAndFormat($StatRecord['defs_points']),
163
+    'res_points'           => HelperString::numberFloorAndFormat($StatRecord['res_points']),
164
+    'total_points'         => HelperString::numberFloorAndFormat($StatRecord['total_points']),
165 165
     'user_rank'            => $StatRecord['total_rank'],
166 166
     'RANK_DIFF'            => $StatRecord['total_old_rank'] - $StatRecord['total_rank'],
167 167
 
Please login to merge, or discard this patch.
stat.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@  discard block
 block discarded – undo
11 11
   global $who, $lang;
12 12
 
13 13
   // $sn_group_stat_common = sn_get_groups('STAT_COMMON');
14
-  foreach($array as $key => $value) {
15
-    if($array_name == 'type' && $who == 2 && !in_array($key, $sn_group_stat_common)) {
14
+  foreach ($array as $key => $value) {
15
+    if ($array_name == 'type' && $who == 2 && !in_array($key, $sn_group_stat_common)) {
16 16
       continue;
17 17
     }
18 18
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 $subject_list = array(
45 45
   1 => array('header' => $lang['stat_player']),
46 46
 );
47
-if(!$source) {
47
+if (!$source) {
48 48
   $subject_list[2] = array('header' => $lang['stat_allys']);
49 49
 }
50 50
 stat_tpl_assign($template, $who, 'subject', $subject_list, $sn_group_stat_common);
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 
112 112
 $page_count = floor($record_count / 100);
113 113
 $pages = array();
114
-for($i = 0; $i <= $page_count; $i++) {
114
+for ($i = 0; $i <= $page_count; $i++) {
115 115
   $first_element = $i * 100 + 1;
116 116
   $last_element = $first_element + 99;
117 117
   $pages[$first_element] = array(
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
     'POINTS' => HelperString::numberFloorAndFormat($row['points']),
131 131
   );
132 132
 
133
-  if($who == 1) {
133
+  if ($who == 1) {
134 134
     $row_stat['ALLY_NAME'] = $row['ally_name'];
135 135
     $row_stat['ALLY_ID'] = $row['ally_id'];
136 136
     empty($row['username']) ? $row['username'] = $row['name'] : false;
Please login to merge, or discard this patch.
classes/classCache.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 
151 151
   public function unset_by_prefix($prefix_unset = '') {
152 152
     static $array_clear;
153
-    !$array_clear ? $array_clear = function (&$v, $k, $p) {
153
+    !$array_clear ? $array_clear = function(&$v, $k, $p) {
154 154
       strpos($k, $p) === 0 ? $v = null : false;
155 155
     } : false;
156 156
 
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
     if ($this->$name[0] === null) {
206 206
       for ($i = count($name) - 1; $i > 0; $i--) {
207 207
         $cName = "{$name[$i]}_COUNT";
208
-        $cName1 = "{$name[$i-1]}_COUNT";
208
+        $cName1 = "{$name[$i - 1]}_COUNT";
209 209
         if ($this->$cName1 == null || $i == 1) {
210 210
           $this->$cName++;
211 211
         }
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
     $count = count($name);
252 252
     for ($i = 1; $i < $count; $i++) {
253 253
       $cName = "{$name[$i]}_COUNT";
254
-      $cName1 = "{$name[$i-1]}_COUNT";
254
+      $cName1 = "{$name[$i - 1]}_COUNT";
255 255
 
256 256
       if ($i == 1 || $this->$cName1 === null) {
257 257
         $this->$cName--;
Please login to merge, or discard this patch.
includes/includes/ube_report.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -109,33 +109,33 @@  discard block
 block discarded – undo
109 109
       `ube_report_time_combat` = '" . date(FMT_DATE_TIME_SQL, $combat_data[UBE_TIME]) . "',
110 110
       `ube_report_time_spent` = {$combat_data[UBE_TIME_SPENT]},
111 111
 
112
-      `ube_report_combat_admin` = " . (int)$combat_data[UBE_OPTIONS][UBE_COMBAT_ADMIN] . ",
112
+      `ube_report_combat_admin` = " . (int) $combat_data[UBE_OPTIONS][UBE_COMBAT_ADMIN] . ",
113 113
       `ube_report_mission_type` = {$combat_data[UBE_OPTIONS][UBE_MISSION_TYPE]},
114 114
 
115 115
       `ube_report_combat_result` = {$outcome[UBE_COMBAT_RESULT]},
116
-      `ube_report_combat_sfr` = " . (int)$outcome[UBE_SFR] . ",
116
+      `ube_report_combat_sfr` = " . (int) $outcome[UBE_SFR] . ",
117 117
 
118
-      `ube_report_debris_metal` = " . (float)$outcome[UBE_DEBRIS][RES_METAL] . ",
119
-      `ube_report_debris_crystal` = " . (float)$outcome[UBE_DEBRIS][RES_CRYSTAL] . ",
118
+      `ube_report_debris_metal` = " . (float) $outcome[UBE_DEBRIS][RES_METAL] . ",
119
+      `ube_report_debris_crystal` = " . (float) $outcome[UBE_DEBRIS][RES_CRYSTAL] . ",
120 120
       `ube_report_debris_total_in_metal` = " . $ube_report_debris_total_in_metal . ",
121 121
 
122
-      `ube_report_planet_id`          = " . (int)$outcome[UBE_PLANET][PLANET_ID] . ",
122
+      `ube_report_planet_id`          = " . (int) $outcome[UBE_PLANET][PLANET_ID] . ",
123 123
       `ube_report_planet_name`        = '" . db_escape($outcome[UBE_PLANET][PLANET_NAME]) . "',
124
-      `ube_report_planet_size`        = " . (int)$outcome[UBE_PLANET][PLANET_SIZE] . ",
125
-      `ube_report_planet_galaxy`      = " . (int)$outcome[UBE_PLANET][PLANET_GALAXY] . ",
126
-      `ube_report_planet_system`      = " . (int)$outcome[UBE_PLANET][PLANET_SYSTEM] . ",
127
-      `ube_report_planet_planet`      = " . (int)$outcome[UBE_PLANET][PLANET_PLANET] . ",
128
-      `ube_report_planet_planet_type` = " . (int)$outcome[UBE_PLANET][PLANET_TYPE] . ",
124
+      `ube_report_planet_size`        = " . (int) $outcome[UBE_PLANET][PLANET_SIZE] . ",
125
+      `ube_report_planet_galaxy`      = " . (int) $outcome[UBE_PLANET][PLANET_GALAXY] . ",
126
+      `ube_report_planet_system`      = " . (int) $outcome[UBE_PLANET][PLANET_SYSTEM] . ",
127
+      `ube_report_planet_planet`      = " . (int) $outcome[UBE_PLANET][PLANET_PLANET] . ",
128
+      `ube_report_planet_planet_type` = " . (int) $outcome[UBE_PLANET][PLANET_TYPE] . ",
129 129
 
130
-      `ube_report_moon` = " . (int)$outcome[UBE_MOON] . ",
131
-      `ube_report_moon_chance` = " . (int)$outcome[UBE_MOON_CHANCE] . ",
132
-      `ube_report_moon_size` = " . (float)$outcome[UBE_MOON_SIZE] . ",
130
+      `ube_report_moon` = " . (int) $outcome[UBE_MOON] . ",
131
+      `ube_report_moon_chance` = " . (int) $outcome[UBE_MOON_CHANCE] . ",
132
+      `ube_report_moon_size` = " . (float) $outcome[UBE_MOON_SIZE] . ",
133 133
 
134
-      `ube_report_moon_reapers` = " . (int)$outcome[UBE_MOON_REAPERS] . ",
135
-      `ube_report_moon_destroy_chance` = " . (int)$outcome[UBE_MOON_DESTROY_CHANCE] . ",
136
-      `ube_report_moon_reapers_die_chance` = " . (int)$outcome[UBE_MOON_REAPERS_DIE_CHANCE] . ",
134
+      `ube_report_moon_reapers` = " . (int) $outcome[UBE_MOON_REAPERS] . ",
135
+      `ube_report_moon_destroy_chance` = " . (int) $outcome[UBE_MOON_DESTROY_CHANCE] . ",
136
+      `ube_report_moon_reapers_die_chance` = " . (int) $outcome[UBE_MOON_REAPERS_DIE_CHANCE] . ",
137 137
 
138
-      `ube_report_capture_result` = " . (int)$outcome[UBE_CAPTURE_RESULT] . "
138
+      `ube_report_capture_result` = " . (int) $outcome[UBE_CAPTURE_RESULT] . "
139 139
   ");
140 140
   $ube_report_id = $combat_data[UBE_REPORT_ID] = db_insert_id();
141 141
 
@@ -146,11 +146,11 @@  discard block
 block discarded – undo
146 146
       $player_id,
147 147
 
148 148
       "'" . db_escape($player_info[UBE_NAME]) . "'",
149
-      (int)$player_info[UBE_ATTACKER],
149
+      (int) $player_info[UBE_ATTACKER],
150 150
 
151
-      (float)$player_info[UBE_BONUSES][UBE_ATTACK],
152
-      (float)$player_info[UBE_BONUSES][UBE_SHIELD],
153
-      (float)$player_info[UBE_BONUSES][UBE_ARMOR],
151
+      (float) $player_info[UBE_BONUSES][UBE_ATTACK],
152
+      (float) $player_info[UBE_BONUSES][UBE_SHIELD],
153
+      (float) $player_info[UBE_BONUSES][UBE_ARMOR],
154 154
     );
155 155
   }
156 156
 
@@ -163,20 +163,20 @@  discard block
 block discarded – undo
163 163
       $fleet_info[UBE_OWNER],
164 164
       $fleet_id,
165 165
 
166
-      (float)$fleet_info[UBE_PLANET][PLANET_ID],
166
+      (float) $fleet_info[UBE_PLANET][PLANET_ID],
167 167
       "'" . db_escape($fleet_info[UBE_PLANET][PLANET_NAME]) . "'",
168
-      (int)$fleet_info[UBE_PLANET][PLANET_GALAXY],
169
-      (int)$fleet_info[UBE_PLANET][PLANET_SYSTEM],
170
-      (int)$fleet_info[UBE_PLANET][PLANET_PLANET],
171
-      (int)$fleet_info[UBE_PLANET][PLANET_TYPE],
172
-
173
-      (float)$fleet_info[UBE_RESOURCES][RES_METAL],
174
-      (float)$fleet_info[UBE_RESOURCES][RES_CRYSTAL],
175
-      (float)$fleet_info[UBE_RESOURCES][RES_DEUTERIUM],
176
-
177
-      (float)$fleet_info[UBE_BONUSES][UBE_ATTACK],
178
-      (float)$fleet_info[UBE_BONUSES][UBE_SHIELD],
179
-      (float)$fleet_info[UBE_BONUSES][UBE_ARMOR],
168
+      (int) $fleet_info[UBE_PLANET][PLANET_GALAXY],
169
+      (int) $fleet_info[UBE_PLANET][PLANET_SYSTEM],
170
+      (int) $fleet_info[UBE_PLANET][PLANET_PLANET],
171
+      (int) $fleet_info[UBE_PLANET][PLANET_TYPE],
172
+
173
+      (float) $fleet_info[UBE_RESOURCES][RES_METAL],
174
+      (float) $fleet_info[UBE_RESOURCES][RES_CRYSTAL],
175
+      (float) $fleet_info[UBE_RESOURCES][RES_DEUTERIUM],
176
+
177
+      (float) $fleet_info[UBE_BONUSES][UBE_ATTACK],
178
+      (float) $fleet_info[UBE_BONUSES][UBE_SHIELD],
179
+      (float) $fleet_info[UBE_BONUSES][UBE_ARMOR],
180 180
     );
181 181
 
182 182
     // Сохраняем итоговую информацию по ресурсам флота - потеряно, выброшено, увезено
@@ -185,19 +185,19 @@  discard block
 block discarded – undo
185 185
       $ube_report_id,
186 186
       $fleet_id,
187 187
 
188
-      (float)$fleet_outcome_data[UBE_RESOURCES_LOST][RES_METAL],
189
-      (float)$fleet_outcome_data[UBE_RESOURCES_LOST][RES_CRYSTAL],
190
-      (float)$fleet_outcome_data[UBE_RESOURCES_LOST][RES_DEUTERIUM],
188
+      (float) $fleet_outcome_data[UBE_RESOURCES_LOST][RES_METAL],
189
+      (float) $fleet_outcome_data[UBE_RESOURCES_LOST][RES_CRYSTAL],
190
+      (float) $fleet_outcome_data[UBE_RESOURCES_LOST][RES_DEUTERIUM],
191 191
 
192
-      (float)$fleet_outcome_data[UBE_CARGO_DROPPED][RES_METAL],
193
-      (float)$fleet_outcome_data[UBE_CARGO_DROPPED][RES_CRYSTAL],
194
-      (float)$fleet_outcome_data[UBE_CARGO_DROPPED][RES_DEUTERIUM],
192
+      (float) $fleet_outcome_data[UBE_CARGO_DROPPED][RES_METAL],
193
+      (float) $fleet_outcome_data[UBE_CARGO_DROPPED][RES_CRYSTAL],
194
+      (float) $fleet_outcome_data[UBE_CARGO_DROPPED][RES_DEUTERIUM],
195 195
 
196
-      (float)$fleet_outcome_data[UBE_RESOURCES_LOOTED][RES_METAL],
197
-      (float)$fleet_outcome_data[UBE_RESOURCES_LOOTED][RES_CRYSTAL],
198
-      (float)$fleet_outcome_data[UBE_RESOURCES_LOOTED][RES_DEUTERIUM],
196
+      (float) $fleet_outcome_data[UBE_RESOURCES_LOOTED][RES_METAL],
197
+      (float) $fleet_outcome_data[UBE_RESOURCES_LOOTED][RES_CRYSTAL],
198
+      (float) $fleet_outcome_data[UBE_RESOURCES_LOOTED][RES_DEUTERIUM],
199 199
 
200
-      (float)$fleet_outcome_data[UBE_RESOURCES_LOST_IN_METAL][RES_METAL],
200
+      (float) $fleet_outcome_data[UBE_RESOURCES_LOST_IN_METAL][RES_METAL],
201 201
     );
202 202
 
203 203
     // Сохраняем результаты по юнитам - потеряно и восстановлено
@@ -209,8 +209,8 @@  discard block
 block discarded – undo
209 209
           $fleet_id,
210 210
 
211 211
           $unit_id,
212
-          (float)$fleet_outcome_data[UBE_DEFENCE_RESTORE][$unit_id],
213
-          (float)$fleet_outcome_data[UBE_UNITS_LOST][$unit_id],
212
+          (float) $fleet_outcome_data[UBE_DEFENCE_RESTORE][$unit_id],
213
+          (float) $fleet_outcome_data[UBE_UNITS_LOST][$unit_id],
214 214
 
215 215
           $unit_sort_order,
216 216
         );
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 
234 234
           $unit_id,
235 235
           $unit_count,
236
-          (int)$fleet_data[UBE_UNITS_BOOM][$unit_id],
236
+          (int) $fleet_data[UBE_UNITS_BOOM][$unit_id],
237 237
 
238 238
           $fleet_data[UBE_ATTACK][$unit_id],
239 239
           $fleet_data[UBE_SHIELD][$unit_id],
Please login to merge, or discard this patch.
classes/FleetDispatcher.php 1 patch
Spacing   +5 added lines, -9 removed lines patch added patch discarded remove patch
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
       MT_EXPLORE   => 'flt_mission_explore',
210 210
     );
211 211
     foreach ($missions_used as $mission_id => $cork) {
212
-      if(empty($mission_files[$mission_id])) {
212
+      if (empty($mission_files[$mission_id])) {
213 213
         continue;
214 214
       }
215 215
 
@@ -474,15 +474,11 @@  discard block
 block discarded – undo
474 474
   protected function flt_flyingFleetsSort($a, $b) {
475 475
     return
476 476
       // Сравниваем время флотов - кто раньше, тот и первый обрабатывается
477
-      $a['fleet_time'] > $b['fleet_time'] ? 1 : ($a['fleet_time'] < $b['fleet_time'] ? -1 :
478
-        // Если время - одинаковое, сравниваем события флотов
477
+      $a['fleet_time'] > $b['fleet_time'] ? 1 : ($a['fleet_time'] < $b['fleet_time'] ? -1 : // Если время - одинаковое, сравниваем события флотов
479 478
         // Если события - одинаковые, то флоты равны
480
-        ($a['fleet_event'] == $b['fleet_event'] ? 0 :
481
-          // Если события разные - первыми считаем прибывающие флоты
482
-          ($a['fleet_event'] == EVENT_FLT_ARRIVE ? 1 : ($b['fleet_event'] == EVENT_FLT_ARRIVE ? -1 :
483
-            // Если нет прибывающих флотов - дальше считаем флоты, которые закончили миссию
484
-            ($a['fleet_event'] == EVENT_FLT_ACOMPLISH ? 1 : ($b['fleet_event'] == EVENT_FLT_ACOMPLISH ? -1 :
485
-              // Если нет флотов, закончивших задание - остались возвращающиеся флоты, которые равны между собой
479
+        ($a['fleet_event'] == $b['fleet_event'] ? 0 : // Если события разные - первыми считаем прибывающие флоты
480
+          ($a['fleet_event'] == EVENT_FLT_ARRIVE ? 1 : ($b['fleet_event'] == EVENT_FLT_ARRIVE ? -1 : // Если нет прибывающих флотов - дальше считаем флоты, которые закончили миссию
481
+            ($a['fleet_event'] == EVENT_FLT_ACOMPLISH ? 1 : ($b['fleet_event'] == EVENT_FLT_ACOMPLISH ? -1 : // Если нет флотов, закончивших задание - остались возвращающиеся флоты, которые равны между собой
486 482
               // TODO: Добавить еще проверку по ID флота и/или времени запуска - что бы обсчитывать их в порядке запуска
487 483
               (
488 484
               0 // Вообще сюда доходить не должно - будет отсекаться на равенстве событий
Please login to merge, or discard this patch.
classes/Fleet/MissionEspionage.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
 
31 31
       $this->target_message = "{$lang['sys_mess_spy_enemy_fleet']} {$this->src_planet['name']} " . uni_render_coordinates_href($this->src_planet, '', 3);
32 32
       $this->target_message .= " {$lang['sys_mess_spy_seen_at']} {$this->dst_planet['name']} " . uni_render_coordinates($this->dst_planet);
33
-      if($this->missionReport->isSpyDetected()) {
33
+      if ($this->missionReport->isSpyDetected()) {
34 34
         $this->target_message .= "<br />{$lang['sys_mess_spy_destroyed_enemy']}";
35 35
       }
36 36
 
Please login to merge, or discard this patch.
classes/Pm/DecodeEspionage.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,8 +25,8 @@  discard block
 block discarded – undo
25 25
       $groups[get_unit_param($unitId, P_UNIT_TYPE)][$unitId] = $unitAmount;
26 26
     }
27 27
 
28
-    foreach(static::ALLOWED_UNITS as $groupId) {
29
-      if(empty($groups[$groupId])) {
28
+    foreach (static::ALLOWED_UNITS as $groupId) {
29
+      if (empty($groups[$groupId])) {
30 30
         continue;
31 31
       }
32 32
 
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
35 35
         'NAME' => $lang['tech'][$groupId],
36 36
       ]);
37 37
 
38
-      foreach($general->getGroupsById($groupId) as $unitId) {
39
-        if((!isset($groups[$groupId][$unitId]) || floor($groups[$groupId][$unitId]) < 1) && $unitId != RES_ENERGY) {
38
+      foreach ($general->getGroupsById($groupId) as $unitId) {
39
+        if ((!isset($groups[$groupId][$unitId]) || floor($groups[$groupId][$unitId]) < 1) && $unitId != RES_ENERGY) {
40 40
           continue;
41 41
         }
42 42
 
Please login to merge, or discard this patch.
includes/functions/msg_send_simple_message.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
     "ally_id = '{$ally_id}'" . ($ally_rank_id >= 0 ? " AND ally_rank_id = {$ally_rank_id}" : ''),
27 27
     false, 'id, username');
28 28
   // while ($u = db_fetch($query))
29
-  foreach($query as $u)
29
+  foreach ($query as $u)
30 30
   {
31 31
     $sendList[] = $u['id'];
32 32
     $list .= "<br>{$u['username']} ";
@@ -53,19 +53,19 @@  discard block
 block discarded – undo
53 53
 {
54 54
   global $config, $user, $sn_message_class_list;
55 55
 
56
-  if(!$owners)
56
+  if (!$owners)
57 57
   {
58 58
     return;
59 59
   }
60 60
 
61 61
   $timestamp = $timestamp ? $timestamp : SN_TIME_NOW;
62 62
   $sender = intval($sender);
63
-  if(!is_array($owners))
63
+  if (!is_array($owners))
64 64
   {
65 65
     $owners = array($owners);
66 66
   }
67 67
 
68
-  if($escaped == STRING_NEED_ESCAPING)
68
+  if ($escaped == STRING_NEED_ESCAPING)
69 69
   {
70 70
     $from = db_escape($from);
71 71
     $subject = db_escape($subject);
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
 
82 82
   $message_class_name_total = $sn_message_class_list[MSG_TYPE_NEW]['name'];
83 83
 
84
-  if($owners[0] == '*')
84
+  if ($owners[0] == '*')
85 85
   {
86
-    if($user['authlevel'] < 3)
86
+    if ($user['authlevel'] < 3)
87 87
     {
88 88
       return false;
89 89
     }
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 
100 100
     foreach ($owners as $owner)
101 101
     {
102
-      if($user['id'] != $owner)
102
+      if ($user['id'] != $owner)
103 103
       {
104 104
         $owner_row = db_user_by_id($owner);
105 105
       }
@@ -109,14 +109,14 @@  discard block
 block discarded – undo
109 109
       }
110 110
       sys_user_options_unpack($owner_row);
111 111
 
112
-      if($force || !$message_class_switchable || $owner_row["opt_{$message_class_name}"])
112
+      if ($force || !$message_class_switchable || $owner_row["opt_{$message_class_name}"])
113 113
       {
114 114
         $insert_values[] = sprintf($insert_template, $owner);
115 115
       }
116 116
 
117
-      if($message_class_email && $config->game_email_pm && $owner_row["opt_email_{$message_class_name}"])
117
+      if ($message_class_email && $config->game_email_pm && $owner_row["opt_email_{$message_class_name}"])
118 118
       {
119
-        if($message_type == MSG_TYPE_SPY) {
119
+        if ($message_type == MSG_TYPE_SPY) {
120 120
           @$result = mymail($owner_row['email'], $subject, classSupernova::$lang['sys_spy_activity'], '', true);
121 121
         } else {
122 122
           @$result = mymail($owner_row['email'], $subject, $text_unescaped, '', true);
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
       }
125 125
     }
126 126
 
127
-    if(empty($insert_values))
127
+    if (empty($insert_values))
128 128
     {
129 129
       return;
130 130
     }
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
   }
135 135
   db_user_list_set_mass_mail($owners, "`{$message_class_name}` = `{$message_class_name}` + 1, `{$message_class_name_total}` = `{$message_class_name_total}` + 1");
136 136
 
137
-  if(in_array($user['id'], $owners) || $owners[0] == '*')
137
+  if (in_array($user['id'], $owners) || $owners[0] == '*')
138 138
   {
139 139
     $user[$message_class_name]++;
140 140
     $user[$message_class_name_total]++;
Please login to merge, or discard this patch.