Test Failed
Branch trunk (d809b8)
by SuperNova.WS
05:48
created
includes/includes/upd_helpers.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if(!defined('IN_UPDATE')) {
3
+if (!defined('IN_UPDATE')) {
4 4
   die('Trying to call update helpers externally!');
5 5
 }
6 6
 
@@ -8,12 +8,12 @@  discard block
 block discarded – undo
8 8
   global $update_tables;
9 9
 
10 10
   upd_add_more_time();
11
-  if(!$no_log) {
11
+  if (!$no_log) {
12 12
     upd_log_message("Performing query '{$query}'");
13 13
   }
14 14
 
15
-  if(strpos($query, '{{') !== false) {
16
-    foreach($update_tables as $tableName => $cork) {
15
+  if (strpos($query, '{{') !== false) {
16
+    foreach ($update_tables as $tableName => $cork) {
17 17
       $query = str_replace("{{{$tableName}}}", classSupernova::$db->db_prefix . $tableName, $query);
18 18
     }
19 19
   }
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
   global $config, $sys_log_disabled;
26 26
 
27 27
   $config->db_loadItem($key);
28
-  if($condition || !isset($config->$key)) {
28
+  if ($condition || !isset($config->$key)) {
29 29
     upd_add_more_time();
30
-    if(!$sys_log_disabled) {
30
+    if (!$sys_log_disabled) {
31 31
       upd_log_message("Updating config key '{$key}' with value '{$default_value}'");
32 32
     }
33 33
     $config->db_saveItem($key, $default_value);
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 function upd_log_message($message) {
56 56
   global $sys_log_disabled, $upd_log, $debug;
57 57
 
58
-  if($sys_log_disabled)
58
+  if ($sys_log_disabled)
59 59
   {
60 60
 //    print("{$message}<br />");
61 61
   } else {
@@ -67,15 +67,15 @@  discard block
 block discarded – undo
67 67
 function upd_unset_table_info($table_name) {
68 68
   global $update_tables, $update_indexes, $update_foreigns;
69 69
 
70
-  if(isset($update_tables[$table_name])) {
70
+  if (isset($update_tables[$table_name])) {
71 71
     unset($update_tables[$table_name]);
72 72
   }
73 73
 
74
-  if(isset($update_indexes[$table_name])) {
74
+  if (isset($update_indexes[$table_name])) {
75 75
     unset($update_indexes[$table_name]);
76 76
   }
77 77
 
78
-  if(isset($update_foreigns[$table_name])) {
78
+  if (isset($update_foreigns[$table_name])) {
79 79
     unset($update_foreigns[$table_name]);
80 80
   }
81 81
 }
@@ -89,18 +89,18 @@  discard block
 block discarded – undo
89 89
   upd_unset_table_info($tableName);
90 90
 
91 91
   $q1 = upd_do_query("SHOW FULL COLUMNS FROM {$prefix_table_name};", true);
92
-  while($r1 = db_fetch($q1)) {
92
+  while ($r1 = db_fetch($q1)) {
93 93
     $update_tables[$tableName][$r1['Field']] = $r1;
94 94
   }
95 95
 
96 96
   $q1 = upd_do_query("SHOW INDEX FROM {$prefix_table_name};", true);
97
-  while($r1 = db_fetch($q1)) {
97
+  while ($r1 = db_fetch($q1)) {
98 98
     $update_indexes[$tableName][$r1['Key_name']] .= "{$r1['Column_name']},";
99 99
     $update_indexes_full[$tableName][$r1['Key_name']][$r1['Column_name']] = $r1;
100 100
   }
101 101
 
102
-  $q1 = upd_do_query("SELECT * FROM `information_schema`.`KEY_COLUMN_USAGE` WHERE `TABLE_SCHEMA` = '" . db_escape(classSupernova::$db_name). "' AND TABLE_NAME = '{$prefix_table_name}' AND REFERENCED_TABLE_NAME is not null;", true);
103
-  while($r1 = db_fetch($q1)) {
102
+  $q1 = upd_do_query("SELECT * FROM `information_schema`.`KEY_COLUMN_USAGE` WHERE `TABLE_SCHEMA` = '" . db_escape(classSupernova::$db_name) . "' AND TABLE_NAME = '{$prefix_table_name}' AND REFERENCED_TABLE_NAME is not null;", true);
103
+  while ($r1 = db_fetch($q1)) {
104 104
     $table_referenced = str_replace($config->db_prefix, '', $r1['REFERENCED_TABLE_NAME']);
105 105
 
106 106
     $update_foreigns[$tableName][$r1['CONSTRAINT_NAME']] .= "{$r1['COLUMN_NAME']},{$table_referenced},{$r1['REFERENCED_COLUMN_NAME']};";
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 function upd_alter_table($table, $alters, $condition = true) {
111 111
   global $config, $update_tables;
112 112
 
113
-  if(!$condition) {
113
+  if (!$condition) {
114 114
     return;
115 115
   }
116 116
 
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
   $alters_print = is_array($alters) ? dump($alters) : $alters;
119 119
   upd_log_message("Altering table '{$table}' with alterations {$alters_print}");
120 120
 
121
-  if(!is_array($alters)) {
121
+  if (!is_array($alters)) {
122 122
     $alters = array($alters);
123 123
   }
124 124
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 
129 129
   $result = upd_do_query($qry);
130 130
   $error = db_error();
131
-  if($error) {
131
+  if ($error) {
132 132
     die("Altering error for table `{$table}`: {$error}<br />{$alters_print}");
133 133
   }
134 134
 
@@ -155,19 +155,19 @@  discard block
 block discarded – undo
155 155
 function upd_create_table($table_name, $declaration, $tableOptions = '') {
156 156
   global $config, $update_tables;
157 157
 
158
-  if(!$update_tables[$table_name]) {
158
+  if (!$update_tables[$table_name]) {
159 159
     upd_do_query('set foreign_key_checks = 0;', true);
160 160
     $declaration = trim($declaration);
161
-    if(substr($declaration, 0, 1) != '(') {
161
+    if (substr($declaration, 0, 1) != '(') {
162 162
       $declaration = "($declaration)";
163 163
     }
164 164
     $tableOptions = trim($tableOptions);
165
-    if(!empty($tableOptions)) {
165
+    if (!empty($tableOptions)) {
166 166
       $declaration .= $tableOptions;
167 167
     }
168 168
     $result = upd_do_query("CREATE TABLE IF NOT EXISTS `{$config->db_prefix}{$table_name}` {$declaration}");
169 169
     $error = db_error();
170
-    if($error) {
170
+    if ($error) {
171 171
       die("Creating error for table `{$table_name}`: {$error}<br />" . dump($declaration));
172 172
     }
173 173
     upd_do_query('set foreign_key_checks = 1;', true);
@@ -193,14 +193,14 @@  discard block
 block discarded – undo
193 193
 
194 194
 
195 195
 function upd_db_unit_changeset_prepare($unit_id, $unit_value, $user, $planet_id = null) {
196
-  if(!is_array($user)) {
196
+  if (!is_array($user)) {
197 197
     // TODO - remove later
198 198
     print('<h1>СООБЩИТЕ ЭТО АДМИНУ: upd_db_unit_changeset_prepare() - USER is not ARRAY</h1>');
199 199
     pdump(debug_backtrace());
200 200
     die('USER is not ARRAY');
201 201
   }
202 202
 
203
-  if(!isset($user['id']) || !$user['id']) {
203
+  if (!isset($user['id']) || !$user['id']) {
204 204
     // TODO - remove later
205 205
     print('<h1>СООБЩИТЕ ЭТО АДМИНУ: upd_db_unit_changeset_prepare() - USER[id] пустой</h1>');
206 206
     pdump($user);
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 
216 216
   $db_changeset = array();
217 217
   $temp = upd_db_unit_by_location($user['id'], $unit_location, $location_id, $unit_id, true, 'unit_id');
218
-  if($temp['unit_id']) {
218
+  if ($temp['unit_id']) {
219 219
     // update
220 220
     $db_changeset = array(
221 221
       'action' => SQL_OP_UPDATE,
@@ -261,53 +261,53 @@  discard block
 block discarded – undo
261 261
 
262 262
 
263 263
 function upd_db_changeset_apply($db_changeset) {
264
-  if(!is_array($db_changeset) || empty($db_changeset)) {
264
+  if (!is_array($db_changeset) || empty($db_changeset)) {
265 265
     return;
266 266
   }
267 267
 
268
-  foreach($db_changeset as $table_name => $table_data) {
269
-    foreach($table_data as $record_id => $conditions) {
268
+  foreach ($db_changeset as $table_name => $table_data) {
269
+    foreach ($table_data as $record_id => $conditions) {
270 270
       $where = '';
271
-      if(!empty($conditions['where'])) {
271
+      if (!empty($conditions['where'])) {
272 272
         $where = 'WHERE ' . implode(' AND ', $conditions['where']);
273 273
       }
274 274
 
275 275
       $fields = array();
276
-      if($conditions['fields']) {
277
-        foreach($conditions['fields'] as $field_name => $field_data) {
276
+      if ($conditions['fields']) {
277
+        foreach ($conditions['fields'] as $field_name => $field_data) {
278 278
           $condition = "`{$field_name}` = ";
279 279
           $value = '';
280
-          if($field_data['delta']) {
280
+          if ($field_data['delta']) {
281 281
             $value = "`{$field_name}`" . ($field_data['delta'] >= 0 ? '+' : '') . $field_data['delta'];
282
-          } elseif($field_data['set']) {
283
-            $value = (is_string($field_data['set']) ? "'{$field_data['set']}'": $field_data['set']);
282
+          } elseif ($field_data['set']) {
283
+            $value = (is_string($field_data['set']) ? "'{$field_data['set']}'" : $field_data['set']);
284 284
           }
285
-          if($value) {
285
+          if ($value) {
286 286
             $fields[] = $condition . $value;
287 287
           }
288 288
         }
289 289
       }
290 290
       $fields = implode(',', $fields);
291 291
 
292
-      switch($conditions['action']) {
292
+      switch ($conditions['action']) {
293 293
         case SQL_OP_DELETE:
294 294
           upd_do_query("DELETE FROM {{{$table_name}}} {$where}");
295 295
           break;
296 296
 
297 297
         case SQL_OP_UPDATE:
298
-          if($fields) {
298
+          if ($fields) {
299 299
             upd_do_query("UPDATE {{{$table_name}}} SET {$fields} {$where}");
300 300
           }
301 301
           break;
302 302
 
303 303
         case SQL_OP_INSERT:
304
-          if($fields) {
304
+          if ($fields) {
305 305
             upd_do_query("INSERT INTO {{{$table_name}}} SET {$fields}");
306 306
           }
307 307
           break;
308 308
 
309 309
         case SQL_OP_REPLACE:
310
-          if($fields) {
310
+          if ($fields) {
311 311
             upd_do_query("REPLACE INTO {{{$table_name}}} SET {$fields}");
312 312
           }
313 313
           break;
Please login to merge, or discard this patch.
includes/includes/art_artifact.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 {
5 5
   global $lang;
6 6
 
7
-  if(!in_array($unit_id, sn_get_groups('artifacts')))
7
+  if (!in_array($unit_id, sn_get_groups('artifacts')))
8 8
   {
9 9
     return;
10 10
   }
@@ -13,24 +13,24 @@  discard block
 block discarded – undo
13 13
   $user = db_user_by_id($user['id'], true);
14 14
 
15 15
   $unit_level = $artifact_level_old = mrc_get_level($user, array(), $unit_id, true);
16
-  if($unit_level > 0)
16
+  if ($unit_level > 0)
17 17
   {
18 18
     $db_changeset = array();
19
-    switch($unit_id)
19
+    switch ($unit_id)
20 20
     {
21 21
       case ART_LHC:
22 22
       case ART_HOOK_SMALL:
23 23
       case ART_HOOK_MEDIUM:
24 24
       case ART_HOOK_LARGE:
25 25
         $has_moon = DBStaticPlanet::db_planet_by_parent($planetrow['id'], true, '`id`');
26
-        if($planetrow['planet_type'] == PT_PLANET && !$has_moon['id'])
26
+        if ($planetrow['planet_type'] == PT_PLANET && !$has_moon['id'])
27 27
         {
28 28
           $unit_level--;
29 29
           $moon_chance = $unit_id == ART_LHC ? uni_calculate_moon_chance($planetrow['debris_metal'] + $planetrow['debris_crystal']) : (
30 30
             $unit_id == ART_HOOK_MEDIUM ? mt_rand(1100, 8999) : ($unit_id == ART_HOOK_SMALL ? 1100 : 8999)
31 31
           );
32 32
           $random = $unit_id == ART_LHC ? mt_rand(1, 100) : $moon_chance;
33
-          if($random <= $moon_chance)
33
+          if ($random <= $moon_chance)
34 34
           {
35 35
             $new_moon_row = uni_create_moon($planetrow['galaxy'], $planetrow['system'], $planetrow['planet'], $user['id'], $moon_chance);
36 36
             $message = sprintf($lang['art_moon_create'][$unit_id], $new_moon_row['name'], uni_render_coordinates($planetrow), pretty_number($moon_chance));
@@ -51,14 +51,14 @@  discard block
 block discarded – undo
51 51
       case ART_RCD_MEDIUM:
52 52
       case ART_RCD_LARGE:
53 53
         $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true);
54
-        if($planetrow['planet_type'] != PT_PLANET)
54
+        if ($planetrow['planet_type'] != PT_PLANET)
55 55
         {
56 56
           $message = $lang['art_rcd_err_moon'];
57 57
           break;
58 58
         }
59 59
 
60 60
         $que = que_get($user['id'], $planetrow['id'], QUE_STRUCTURES, false);
61
-        if(!empty($que['items']))
61
+        if (!empty($que['items']))
62 62
         {
63 63
           $message = $lang['art_rcd_err_que'];
64 64
           break;
@@ -67,15 +67,15 @@  discard block
 block discarded – undo
67 67
         $artifact_deploy = get_unit_param($unit_id, P_DEPLOY);
68 68
 
69 69
         $sectors_used = 0;
70
-        foreach($artifact_deploy as $deploy_unit_id => $deploy_unit_level)
70
+        foreach ($artifact_deploy as $deploy_unit_id => $deploy_unit_level)
71 71
         {
72
-          if(!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true))))
72
+          if (!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true))))
73 73
             continue;
74 74
           $sectors_used += $levels_deployed;
75 75
           $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($deploy_unit_id, $levels_deployed, $user, $planetrow['id']);
76 76
         }
77 77
 
78
-        if($sectors_used == 0)
78
+        if ($sectors_used == 0)
79 79
         {
80 80
           $message = $lang['art_rcd_err_no_sense'];
81 81
           break;
@@ -90,13 +90,13 @@  discard block
 block discarded – undo
90 90
         $que_item = null;
91 91
         $que = que_get($user['id'], $planetrow['id'], QUE_RESEARCH, true);
92 92
         $current_que = &$que['ques'][QUE_RESEARCH][$user['id']][0];
93
-        if(!empty($current_que))
93
+        if (!empty($current_que))
94 94
         {
95 95
           reset($current_que);
96 96
           $que_item = &$que['ques'][QUE_RESEARCH][$user['id']][0][key($current_que)];
97 97
         }
98 98
 
99
-        if(!empty($que_item) && $que_item['que_time_left'] > 60)
99
+        if (!empty($que_item) && $que_item['que_time_left'] > 60)
100 100
         {
101 101
           $unit_level--;
102 102
           $old_time = $que_item['que_time_left'];
@@ -117,13 +117,13 @@  discard block
 block discarded – undo
117 117
         $que = que_get($user['id'], $planetrow['id'], QUE_STRUCTURES, true);
118 118
         $current_que = &$que['ques'][QUE_STRUCTURES][$user['id']][$planetrow['id']];
119 119
         // $que_item = &$que['que'][QUE_STRUCTURES][0];
120
-        if(!empty($current_que))
120
+        if (!empty($current_que))
121 121
         {
122 122
           reset($current_que);
123 123
           $que_item = &$que['ques'][QUE_STRUCTURES][$user['id']][$planetrow['id']][key($current_que)];
124 124
         }
125 125
 
126
-        if(isset($que_item) && $que_item['que_time_left'] > 60)
126
+        if (isset($que_item) && $que_item['que_time_left'] > 60)
127 127
         {
128 128
           $unit_level--;
129 129
           $old_time = $que_item['que_time_left'];
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
       break;
142 142
 
143 143
     }
144
-    if($unit_level != $artifact_level_old)
144
+    if ($unit_level != $artifact_level_old)
145 145
     {
146 146
       $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($unit_id, $unit_level - $artifact_level_old, $user);
147 147
       OldDbChangeSet::db_changeset_apply($db_changeset);
Please login to merge, or discard this patch.
includes/includes/flt_functions.php 1 patch
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -8,11 +8,11 @@  discard block
 block discarded – undo
8 8
   }
9 9
 
10 10
   $speeds = array();
11
-  if(!empty($fleet))
11
+  if (!empty($fleet))
12 12
   {
13 13
     foreach ($fleet as $ship_id => $amount)
14 14
     {
15
-      if($amount && in_array($ship_id, sn_get_groups(array('fleet', 'missile'))))
15
+      if ($amount && in_array($ship_id, sn_get_groups(array('fleet', 'missile'))))
16 16
       {
17 17
         $single_ship_data = get_ship_data($ship_id, $user);
18 18
         $speeds[] = $single_ship_data['speed'];
@@ -26,15 +26,15 @@  discard block
 block discarded – undo
26 26
 function flt_travel_distance($from, $to) {
27 27
   global $config;
28 28
 
29
-  if($from['galaxy'] != $to['galaxy'])
29
+  if ($from['galaxy'] != $to['galaxy'])
30 30
   {
31 31
     $distance = abs($from['galaxy'] - $to['galaxy']) * $config->uni_galaxy_distance;
32 32
   }
33
-  elseif($from['system'] != $to['system'])
33
+  elseif ($from['system'] != $to['system'])
34 34
   {
35 35
     $distance = abs($from['system'] - $to['system']) * 5 * 19 + 2700;
36 36
   }
37
-  elseif($from['planet'] != $to['planet'])
37
+  elseif ($from['planet'] != $to['planet'])
38 38
   {
39 39
     $distance = abs($from['planet'] - $to['planet']) * 5 + 1000;
40 40
   }
@@ -65,14 +65,14 @@  discard block
 block discarded – undo
65 65
 
66 66
   $game_fleet_speed = flt_server_flight_speed_multiplier();
67 67
   $fleet_speed = flt_fleet_speed($user_row, $fleet_array);
68
-  if(!empty($fleet_array) && $fleet_speed && $game_fleet_speed)
68
+  if (!empty($fleet_array) && $fleet_speed && $game_fleet_speed)
69 69
   {
70 70
     $speed_percent = $speed_percent ? max(min($speed_percent, 10), 1) : 10;
71 71
     $real_speed = $speed_percent * sqrt($fleet_speed);
72 72
 
73 73
     $duration = max(1, round((35000 / $speed_percent * sqrt($distance * 10 / $fleet_speed) + 10) / $game_fleet_speed));
74 74
 
75
-    foreach($fleet_array as $ship_id => $ship_count)
75
+    foreach ($fleet_array as $ship_id => $ship_count)
76 76
     {
77 77
       if (!$ship_id || !$ship_count)
78 78
       {
@@ -126,19 +126,19 @@  discard block
 block discarded – undo
126 126
 
127 127
   $config_bashing_attacks = $config->fleet_bashing_attacks;
128 128
   $config_bashing_interval = $config->fleet_bashing_interval;
129
-  if(!$config_bashing_attacks) {
129
+  if (!$config_bashing_attacks) {
130 130
     // Bashing allowed - protection disabled
131 131
     return ATTACK_ALLOWED;
132 132
   }
133 133
 
134 134
   $bashing_result = ATTACK_BASHING;
135
-  if($user['ally_id'] && $enemy['ally_id']) {
135
+  if ($user['ally_id'] && $enemy['ally_id']) {
136 136
     $relations = ali_relations($user['ally_id'], $enemy['ally_id']);
137
-    if(!empty($relations)) {
137
+    if (!empty($relations)) {
138 138
       $relations = $relations[$enemy['ally_id']];
139
-      switch($relations['alliance_diplomacy_relation']) {
139
+      switch ($relations['alliance_diplomacy_relation']) {
140 140
         case ALLY_DIPLOMACY_WAR:
141
-          if(SN_TIME_NOW - $relations['alliance_diplomacy_time'] <= $config->fleet_bashing_war_delay) {
141
+          if (SN_TIME_NOW - $relations['alliance_diplomacy_time'] <= $config->fleet_bashing_war_delay) {
142 142
             $bashing_result = ATTACK_BASHING_WAR_DELAY;
143 143
           } else {
144 144
             return ATTACK_ALLOWED;
@@ -175,9 +175,9 @@  discard block
 block discarded – undo
175 175
 //    }
176 176
 //  }
177 177
   $bashing_fleet_list = fleet_list_bashing($user['id'], $planet_dst);
178
-  foreach($bashing_fleet_list as $fleet_row) {
178
+  foreach ($bashing_fleet_list as $fleet_row) {
179 179
     // Checking for ACS - each ACS count only once
180
-    if($fleet_row['fleet_group']) {
180
+    if ($fleet_row['fleet_group']) {
181 181
       $bashing_list["{$user['id']}_{$fleet_row['fleet_group']}"] = $fleet_row['fleet_start_time'];
182 182
     } else {
183 183
       $bashing_list[] = $fleet_row['fleet_start_time'];
@@ -185,12 +185,12 @@  discard block
 block discarded – undo
185 185
   }
186 186
 
187 187
   // Check for joining to ACS - if there are already fleets in ACS no checks should be done
188
-  if($mission == MT_AKS && $bashing_list["{$user['id']}_{$fleet_group}"]) {
188
+  if ($mission == MT_AKS && $bashing_list["{$user['id']}_{$fleet_group}"]) {
189 189
     return ATTACK_ALLOWED;
190 190
   }
191 191
 
192 192
   $query = doquery("SELECT bashing_time FROM {{bashing}} WHERE bashing_user_id = {$user['id']} AND bashing_planet_id = {$planet_dst['id']} AND bashing_time >= {$time_limit};");
193
-  while($bashing_row = db_fetch($query)) {
193
+  while ($bashing_row = db_fetch($query)) {
194 194
     $bashing_list[] = $bashing_row['bashing_time'];
195 195
   }
196 196
 
@@ -199,9 +199,9 @@  discard block
 block discarded – undo
199 199
   $last_attack = 0;
200 200
   $wave = 0;
201 201
   $attack = 1;
202
-  foreach($bashing_list as &$bash_time) {
202
+  foreach ($bashing_list as &$bash_time) {
203 203
     $attack++;
204
-    if($bash_time - $last_attack > $config_bashing_interval || $attack > $config_bashing_attacks) {
204
+    if ($bash_time - $last_attack > $config_bashing_interval || $attack > $config_bashing_attacks) {
205 205
       $attack = 1;
206 206
       $wave++;
207 207
     }
@@ -212,21 +212,21 @@  discard block
 block discarded – undo
212 212
   return ($wave > $config->fleet_bashing_waves ? $bashing_result : ATTACK_ALLOWED);
213 213
 }
214 214
 
215
-function flt_can_attack($planet_src, $planet_dst, $fleet = array(), $mission, $options = false){return sn_function_call('flt_can_attack', array($planet_src, $planet_dst, $fleet, $mission, $options, &$result));}
215
+function flt_can_attack($planet_src, $planet_dst, $fleet = array(), $mission, $options = false) {return sn_function_call('flt_can_attack', array($planet_src, $planet_dst, $fleet, $mission, $options, &$result)); }
216 216
 function sn_flt_can_attack($planet_src, $planet_dst, $fleet = array(), $mission, $options = false, &$result) {
217 217
   //TODO: try..catch
218 218
   global $config, $user;
219 219
 
220
-  if($user['vacation']) {
220
+  if ($user['vacation']) {
221 221
     return $result = ATTACK_OWN_VACATION;
222 222
   }
223 223
 
224
-  if(empty($fleet) || !is_array($fleet)) {
224
+  if (empty($fleet) || !is_array($fleet)) {
225 225
     return $result = ATTACK_NO_FLEET;
226 226
   }
227 227
 
228 228
   $sn_groups_mission = sn_get_groups('missions');
229
-  if(!isset($sn_groups_mission[$mission])) {
229
+  if (!isset($sn_groups_mission[$mission])) {
230 230
     return $result = ATTACK_MISSION_ABSENT;
231 231
   }
232 232
   $sn_data_mission = $sn_groups_mission[$mission];
@@ -245,32 +245,32 @@  discard block
 block discarded – undo
245 245
   $resources = 0;
246 246
   $ship_ids = sn_get_groups('fleet');
247 247
   $resource_ids = sn_get_groups('resources_loot');
248
-  foreach($fleet as $ship_id => $ship_count) {
248
+  foreach ($fleet as $ship_id => $ship_count) {
249 249
     $is_ship = in_array($ship_id, $ship_ids);
250 250
     $is_resource = in_array($ship_id, $resource_ids);
251
-    if(!$is_ship && !$is_resource) {
251
+    if (!$is_ship && !$is_resource) {
252 252
       // TODO Спецобработчик для Капитана и модулей
253 253
 //      return ATTACK_WRONG_UNIT;
254 254
     }
255 255
 
256
-    if($ship_count < 0) {
256
+    if ($ship_count < 0) {
257 257
       return $result = $is_ship ? ATTACK_SHIP_COUNT_WRONG : ATTACK_RESOURCE_COUNT_WRONG;
258 258
     }
259 259
 
260
-    if($ship_count > mrc_get_level($user, $planet_src, $ship_id)) {
260
+    if ($ship_count > mrc_get_level($user, $planet_src, $ship_id)) {
261 261
       // TODO ATTACK_NO_MISSILE
262 262
       return $result = $is_ship ? ATTACK_NO_SHIPS : ATTACK_NO_RESOURCES;
263 263
     }
264 264
 
265
-    if($is_ship) {
265
+    if ($is_ship) {
266 266
       $single_ship_data = get_ship_data($ship_id, $user);
267
-      if($single_ship_data[P_SPEED] <= 0) {
267
+      if ($single_ship_data[P_SPEED] <= 0) {
268 268
         return $result = ATTACK_ZERO_SPEED;
269 269
       }
270 270
       $ships += $ship_count;
271 271
       $recyclers += in_array($ship_id, sn_get_groups('flt_recyclers')) ? $ship_count : 0;
272 272
       $spies += $ship_id == SHIP_SPY ? $ship_count : 0;
273
-    } elseif($is_resource) {
273
+    } elseif ($is_resource) {
274 274
       $resources += $ship_count;
275 275
     }
276 276
   }
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
   }
282 282
 */
283 283
 
284
-  if(isset($options['resources']) && $options['resources'] > 0 && !(isset($sn_data_mission['transport']) && $sn_data_mission['transport'])) {
284
+  if (isset($options['resources']) && $options['resources'] > 0 && !(isset($sn_data_mission['transport']) && $sn_data_mission['transport'])) {
285 285
     return $result = ATTACK_RESOURCE_FORBIDDEN;
286 286
   }
287 287
 
@@ -293,35 +293,35 @@  discard block
 block discarded – undo
293 293
   */
294 294
 
295 295
   $speed = $options['fleet_speed_percent'];
296
-  if($speed && ($speed != intval($speed) || $speed < 1 || $speed > 10)) {
296
+  if ($speed && ($speed != intval($speed) || $speed < 1 || $speed > 10)) {
297 297
     return $result = ATTACK_WRONG_SPEED;
298 298
   }
299 299
 
300 300
   $travel_data = flt_travel_data($user, $planet_src, $planet_dst, $fleet, $options['fleet_speed_percent']);
301 301
 
302 302
 
303
-  if(mrc_get_level($user, $planet_src, RES_DEUTERIUM) < $fleet[RES_DEUTERIUM] + $travel_data['consumption']) {
303
+  if (mrc_get_level($user, $planet_src, RES_DEUTERIUM) < $fleet[RES_DEUTERIUM] + $travel_data['consumption']) {
304 304
     return $result = ATTACK_NO_FUEL;
305 305
   }
306 306
 
307
-  if($travel_data['consumption'] > $travel_data['capacity']) {
307
+  if ($travel_data['consumption'] > $travel_data['capacity']) {
308 308
     return $result = ATTACK_TOO_FAR;
309 309
   }
310 310
 
311
-  if($travel_data['hold'] < $resources) {
311
+  if ($travel_data['hold'] < $resources) {
312 312
     return $result = ATTACK_OVERLOADED;
313 313
   }
314 314
 
315 315
   $fleet_start_time = SN_TIME_NOW + $travel_data['duration'];
316 316
 
317 317
   $fleet_group = $options['fleet_group'];
318
-  if($fleet_group) {
319
-    if($mission != MT_AKS) {
318
+  if ($fleet_group) {
319
+    if ($mission != MT_AKS) {
320 320
       return $result = ATTACK_WRONG_MISSION;
321 321
     };
322 322
 
323 323
     $acs = doquery("SELECT * FROM {{aks}} WHERE id = '{$fleet_group}' LIMIT 1;", '', true);
324
-    if(!$acs['id']) {
324
+    if (!$acs['id']) {
325 325
       return $result = ATTACK_NO_ACS;
326 326
     }
327 327
 
@@ -329,70 +329,70 @@  discard block
 block discarded – undo
329 329
       return $result = ATTACK_ACS_WRONG_TARGET;
330 330
     }
331 331
 
332
-    if ($fleet_start_time>$acs['ankunft']) {
332
+    if ($fleet_start_time > $acs['ankunft']) {
333 333
       return $result = ATTACK_ACS_TOO_LATE;
334 334
     }
335 335
   }
336 336
 
337 337
   $flying_fleets = $options['flying_fleets'];
338
-  if(!$flying_fleets) {
338
+  if (!$flying_fleets) {
339 339
 //    $flying_fleets = doquery("SELECT COUNT(fleet_id) AS `flying_fleets` FROM {{fleets}} WHERE `fleet_owner` = '{$user['id']}';", '', true);
340 340
 //    $flying_fleets = $flying_fleets['flying_fleets'];
341 341
     $flying_fleets = fleet_count_flying($user['id']);
342 342
   }
343
-  if(GetMaxFleets($user) <= $flying_fleets && $mission != MT_MISSILE) {
343
+  if (GetMaxFleets($user) <= $flying_fleets && $mission != MT_MISSILE) {
344 344
     return $result = ATTACK_NO_SLOTS;
345 345
   }
346 346
 
347 347
   // В одиночку шпионские зонды могут летать только в миссии Шпионаж, Передислокация и Транспорт
348
-  if($ships && $spies && $spies == $ships && !($mission == MT_SPY || $mission == MT_RELOCATE || $mission == MT_TRANSPORT)) {
348
+  if ($ships && $spies && $spies == $ships && !($mission == MT_SPY || $mission == MT_RELOCATE || $mission == MT_TRANSPORT)) {
349 349
     return $result = ATTACK_SPIES_LONLY;
350 350
   }
351 351
 
352 352
   // Checking for no planet
353
-  if(!$planet_dst['id_owner']) {
354
-    if($mission == MT_COLONIZE && !$fleet[SHIP_COLONIZER]) {
353
+  if (!$planet_dst['id_owner']) {
354
+    if ($mission == MT_COLONIZE && !$fleet[SHIP_COLONIZER]) {
355 355
       return $result = ATTACK_NO_COLONIZER;
356 356
     }
357 357
 
358
-    if($mission == MT_EXPLORE || $mission == MT_COLONIZE) {
358
+    if ($mission == MT_EXPLORE || $mission == MT_COLONIZE) {
359 359
       return $result = ATTACK_ALLOWED;
360 360
     }
361 361
     return $result = ATTACK_NO_TARGET;
362 362
   }
363 363
 
364
-  if($mission == MT_RECYCLE) {
365
-    if($planet_dst['debris_metal'] + $planet_dst['debris_crystal'] <= 0) {
364
+  if ($mission == MT_RECYCLE) {
365
+    if ($planet_dst['debris_metal'] + $planet_dst['debris_crystal'] <= 0) {
366 366
       return $result = ATTACK_NO_DEBRIS;
367 367
     }
368
-    if($recyclers <= 0) {
368
+    if ($recyclers <= 0) {
369 369
       return $result = ATTACK_NO_RECYCLERS;
370 370
     }
371 371
     return $result = ATTACK_ALLOWED;
372 372
   }
373 373
 
374 374
   // Got planet. Checking if it is ours
375
-  if($planet_dst['id_owner'] == $user['id']) {
376
-    if($mission == MT_TRANSPORT || $mission == MT_RELOCATE) {
375
+  if ($planet_dst['id_owner'] == $user['id']) {
376
+    if ($mission == MT_TRANSPORT || $mission == MT_RELOCATE) {
377 377
       return $result = ATTACK_ALLOWED;
378 378
     }
379 379
     return $planet_src['id'] == $planet_dst['id'] ? ATTACK_SAME : ATTACK_OWN;
380 380
   }
381 381
 
382 382
   // No, planet not ours. Cutting mission that can't be send to not-ours planet
383
-  if($mission == MT_RELOCATE || $mission == MT_COLONIZE || $mission == MT_EXPLORE) {
383
+  if ($mission == MT_RELOCATE || $mission == MT_COLONIZE || $mission == MT_EXPLORE) {
384 384
     return $result = ATTACK_WRONG_MISSION;
385 385
   }
386 386
 
387 387
   $enemy = db_user_by_id($planet_dst['id_owner']);
388 388
   // We cannot attack or send resource to users in VACATION mode
389
-  if($enemy['vacation'] && $mission != MT_RECYCLE) {
389
+  if ($enemy['vacation'] && $mission != MT_RECYCLE) {
390 390
     return $result = ATTACK_VACATION;
391 391
   }
392 392
 
393 393
   // Multi IP protection
394 394
   // TODO: Here we need a procedure to check proxies
395
-  if(sys_is_multiaccount($user, $enemy)) {
395
+  if (sys_is_multiaccount($user, $enemy)) {
396 396
     return $result = ATTACK_SAME_IP;
397 397
   }
398 398
 
@@ -400,8 +400,8 @@  discard block
 block discarded – undo
400 400
   $enemy_points = $enemy['total_points'];
401 401
 
402 402
   // Is it transport? If yes - checking for buffing to prevent mega-alliance destroyer
403
-  if($mission == MT_TRANSPORT) {
404
-    if($user_points >= $enemy_points || $config->allow_buffing) {
403
+  if ($mission == MT_TRANSPORT) {
404
+    if ($user_points >= $enemy_points || $config->allow_buffing) {
405 405
       return $result = ATTACK_ALLOWED;
406 406
     } else {
407 407
       return $result = ATTACK_BUFFING;
@@ -411,65 +411,65 @@  discard block
 block discarded – undo
411 411
   // Only aggresive missions passed to this point. HOLD counts as passive but aggresive
412 412
 
413 413
   // Is it admin with planet protection?
414
-  if($planet_dst['id_level'] > $user['authlevel']) {
414
+  if ($planet_dst['id_level'] > $user['authlevel']) {
415 415
     return $result = ATTACK_ADMIN;
416 416
   }
417 417
 
418 418
   // Okay. Now skipping protection checks for inactive longer then 1 week
419
-  if(!$enemy['onlinetime'] || $enemy['onlinetime'] >= (SN_TIME_NOW - 60*60*24*7)) {
420
-    if(
419
+  if (!$enemy['onlinetime'] || $enemy['onlinetime'] >= (SN_TIME_NOW - 60 * 60 * 24 * 7)) {
420
+    if (
421 421
       ($enemy_points <= $config->game_noob_points && $user_points > $config->game_noob_points)
422 422
       ||
423 423
       ($config->game_noob_factor && $user_points > $enemy_points * $config->game_noob_factor)
424 424
     ) {
425
-      if($mission != MT_HOLD) {
425
+      if ($mission != MT_HOLD) {
426 426
         return $result = ATTACK_NOOB;
427 427
       }
428
-      if($mission == MT_HOLD && !($user['ally_id'] && $user['ally_id'] == $enemy['ally_id'] && $config->ally_help_weak)) {
428
+      if ($mission == MT_HOLD && !($user['ally_id'] && $user['ally_id'] == $enemy['ally_id'] && $config->ally_help_weak)) {
429 429
         return $result = ATTACK_NOOB;
430 430
       }
431 431
     }
432 432
   }
433 433
 
434 434
   // Is it HOLD mission? If yes - there should be ally deposit
435
-  if($mission == MT_HOLD) {
436
-    if(mrc_get_level($user, $planet_dst, STRUC_ALLY_DEPOSIT)) {
435
+  if ($mission == MT_HOLD) {
436
+    if (mrc_get_level($user, $planet_dst, STRUC_ALLY_DEPOSIT)) {
437 437
       return $result = ATTACK_ALLOWED;
438 438
     }
439 439
     return $result = ATTACK_NO_ALLY_DEPOSIT;
440 440
   }
441 441
 
442
-  if($mission == MT_SPY) {
442
+  if ($mission == MT_SPY) {
443 443
     return $result = $spies >= 1 ? ATTACK_ALLOWED : ATTACK_NO_SPIES;
444 444
   }
445 445
 
446 446
   // Is it MISSILE mission?
447
-  if($mission == MT_MISSILE) {
447
+  if ($mission == MT_MISSILE) {
448 448
     $sn_data_mip = get_unit_param(UNIT_DEF_MISSILE_INTERPLANET);
449
-    if(mrc_get_level($user, $planet_src, STRUC_SILO) < $sn_data_mip[P_REQUIRE][STRUC_SILO]) {
449
+    if (mrc_get_level($user, $planet_src, STRUC_SILO) < $sn_data_mip[P_REQUIRE][STRUC_SILO]) {
450 450
       return $result = ATTACK_NO_SILO;
451 451
     }
452 452
 
453
-    if(!$fleet[UNIT_DEF_MISSILE_INTERPLANET]) {
453
+    if (!$fleet[UNIT_DEF_MISSILE_INTERPLANET]) {
454 454
       return $result = ATTACK_NO_MISSILE;
455 455
     }
456 456
 
457 457
     $distance = abs($planet_dst['system'] - $planet_src['system']);
458 458
     $mip_range = flt_get_missile_range($user);
459
-    if($distance > $mip_range || $planet_dst['galaxy'] != $planet_src['galaxy']) {
459
+    if ($distance > $mip_range || $planet_dst['galaxy'] != $planet_src['galaxy']) {
460 460
       return $result = ATTACK_MISSILE_TOO_FAR;
461 461
     }
462 462
 
463
-    if(isset($options['target_structure']) && $options['target_structure'] && !in_array($options['target_structure'], sn_get_groups('defense_active'))) {
463
+    if (isset($options['target_structure']) && $options['target_structure'] && !in_array($options['target_structure'], sn_get_groups('defense_active'))) {
464 464
       return $result = ATTACK_WRONG_STRUCTURE;
465 465
     }
466 466
   }
467 467
 
468
-  if($mission == MT_DESTROY && $planet_dst['planet_type'] != PT_MOON) {
468
+  if ($mission == MT_DESTROY && $planet_dst['planet_type'] != PT_MOON) {
469 469
     return $result = ATTACK_WRONG_MISSION;
470 470
   }
471 471
 
472
-  if($mission == MT_ATTACK || $mission == MT_AKS || $mission == MT_DESTROY) {
472
+  if ($mission == MT_ATTACK || $mission == MT_AKS || $mission == MT_DESTROY) {
473 473
     return $result = flt_bashing_check($user, $enemy, $planet_dst, $mission, $travel_data['duration'], $fleet_group);
474 474
   }
475 475
 
@@ -495,18 +495,18 @@  discard block
 block discarded – undo
495 495
   $from = $from['planet'];
496 496
 
497 497
   $can_attack = flt_can_attack($from, $to, $fleet, $mission, $options);
498
-  if($can_attack != ATTACK_ALLOWED) {
498
+  if ($can_attack != ATTACK_ALLOWED) {
499 499
     $internal_transaction ? sn_db_transaction_rollback() : false;
500 500
     return $can_attack;
501 501
   }
502 502
 
503 503
   $fleet_group = isset($options['fleet_group']) ? floatval($options['fleet_group']) : 0;
504 504
 
505
-  $travel_data  = flt_travel_data($user, $from, $to, $fleet, $options['fleet_speed_percent']);
505
+  $travel_data = flt_travel_data($user, $from, $to, $fleet, $options['fleet_speed_percent']);
506 506
 
507 507
   $fleet_start_time = SN_TIME_NOW + $travel_data['duration'];
508 508
 
509
-  if($mission == MT_EXPLORE || $mission == MT_HOLD) {
509
+  if ($mission == MT_EXPLORE || $mission == MT_HOLD) {
510 510
     $stay_duration = $options['stay_time'] * 3600;
511 511
     $stay_time     = $fleet_start_time + $stay_duration;
512 512
   } else {
@@ -519,20 +519,20 @@  discard block
 block discarded – undo
519 519
   $fleet_string      = '';
520 520
   $db_changeset = array();
521 521
   $planet_fields = array();
522
-  foreach($fleet as $unit_id => $amount)
522
+  foreach ($fleet as $unit_id => $amount)
523 523
   {
524
-    if(!$amount || !$unit_id)
524
+    if (!$amount || !$unit_id)
525 525
     {
526 526
       continue;
527 527
     }
528 528
 
529
-    if(in_array($unit_id, sn_get_groups('fleet')))
529
+    if (in_array($unit_id, sn_get_groups('fleet')))
530 530
     {
531 531
       $fleet_ship_count += $amount;
532 532
       $fleet_string     .= "{$unit_id},{$amount};";
533 533
       $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($unit_id, -$amount, $user, $from['id']);
534 534
     }
535
-    elseif(in_array($unit_id, sn_get_groups('resources_loot')))
535
+    elseif (in_array($unit_id, sn_get_groups('resources_loot')))
536 536
     {
537 537
       $planet_fields[pname_resource_name($unit_id)]['delta'] -= $amount;
538 538
     }
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
 
641 641
   $ship_data = array();
642 642
   $fleet_array = array();
643
-  foreach($ship_list as $transport_id => $cork)
643
+  foreach ($ship_list as $transport_id => $cork)
644 644
   {
645 645
     $ship_data[$transport_id] = flt_travel_data($user, $from, $to, array($transport_id => 1), 10);
646 646
   }
@@ -649,10 +649,10 @@  discard block
 block discarded – undo
649 649
   $fleet_hold = 0;
650 650
   $fleet_capacity = 0;
651 651
   $fuel_total = $fuel_left = mrc_get_level($user, $from, RES_DEUTERIUM);
652
-  foreach($ship_data as $transport_id => &$ship_info)
652
+  foreach ($ship_data as $transport_id => &$ship_info)
653 653
   {
654 654
     $ship_loaded = min($ship_list[$transport_id], ceil($resource_amount / $ship_info['hold']), floor($fuel_left / $ship_info['consumption']));
655
-    if($ship_loaded)
655
+    if ($ship_loaded)
656 656
     {
657 657
       $fleet_array[$transport_id] = $ship_loaded;
658 658
       $resource_amount -= min($resource_amount, $ship_info['hold'] * $ship_loaded);
Please login to merge, or discard this patch.
alliance.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 include('common.' . substr(strrchr(__FILE__, '.'), 1));
4 4
 
5
-if(classSupernova::$config->game_mode == GAME_BLITZ) {
5
+if (classSupernova::$config->game_mode == GAME_BLITZ) {
6 6
   messageBox($lang['sys_blitz_page_disabled'], $lang['sys_error'], 'overview.php', 10);
7 7
   die();
8 8
 }
@@ -14,21 +14,21 @@  discard block
 block discarded – undo
14 14
 
15 15
 $mode = sys_get_param_str('mode');
16 16
 
17
-if($mode == 'ainfo')
17
+if ($mode == 'ainfo')
18 18
 {
19 19
   include('includes/alliance/ali_info.inc');
20 20
 }
21 21
 
22
-if(!$user['ally_id'])
22
+if (!$user['ally_id'])
23 23
 {
24 24
   $user_request = doquery("SELECT * FROM {{alliance_requests}} WHERE `id_user` ='{$user['id']}' LIMIT 1;", '', true);
25
-  if($user_request['id_user'])
25
+  if ($user_request['id_user'])
26 26
   {
27 27
     require('includes/alliance/ali_external_request.inc');
28 28
   }
29 29
   else
30 30
   {
31
-    switch($mode)
31
+    switch ($mode)
32 32
     {
33 33
       case 'search':
34 34
         require('includes/alliance/ali_external_search.inc');
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
 sn_ali_fill_user_ally($user);
54 54
 //$ally = doquery("SELECT * FROM {{alliance}} WHERE `id` ='{$user['ally_id']}'", '', true);
55
-if(!isset($user['ally']))
55
+if (!isset($user['ally']))
56 56
 {
57 57
   db_user_set_by_id($user['id'], "`ally_id` = null, `ally_name` = null, `ally_register_time` = 0, `ally_rank_id` = 0");
58 58
   messageBox($lang['ali_sys_notFound'], $lang['your_alliance'], 'alliance.php');
@@ -81,13 +81,13 @@  discard block
 block discarded – undo
81 81
 
82 82
 // This piece converting old ally data to new one
83 83
 //  unset($ally['ranklist']);
84
-if(!$ally['ranklist'] && $ally['ally_ranks'])
84
+if (!$ally['ranklist'] && $ally['ally_ranks'])
85 85
 {
86 86
   $ally_ranks = unserialize($ally['ally_ranks']);
87 87
   $i = 0;
88
-  foreach($ally_ranks as $rank_id => $rank)
88
+  foreach ($ally_ranks as $rank_id => $rank)
89 89
   {
90
-    foreach($ally_rights as $key => $value)
90
+    foreach ($ally_rights as $key => $value)
91 91
     {
92 92
       $ranks[$i][$value] = $rank[$rights_old[$key]];
93 93
     }
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     $i++;
96 96
   }
97 97
 
98
-  if(!empty($ranks))
98
+  if (!empty($ranks))
99 99
   {
100 100
     ali_rank_list_save($ranks);
101 101
   }
@@ -114,18 +114,18 @@  discard block
 block discarded – undo
114 114
 
115 115
 $edit = sys_get_param_str('edit');
116 116
 ally_pre_call();
117
-switch($mode)
117
+switch ($mode)
118 118
 {
119 119
   case 'admin':
120
-    if(!array_key_exists($edit , $sn_ali_admin_internal))
120
+    if (!array_key_exists($edit, $sn_ali_admin_internal))
121 121
     {
122 122
       $edit = 'default';
123 123
     }
124
-    if($sn_ali_admin_internal[$edit]['include'])
124
+    if ($sn_ali_admin_internal[$edit]['include'])
125 125
     {
126 126
       require("includes/{$sn_ali_admin_internal[$edit]['include']}");
127 127
     }
128
-    if(isset($sn_ali_admin_internal[$edit]['function']) && is_callable($sn_ali_admin_internal[$edit]['function']))
128
+    if (isset($sn_ali_admin_internal[$edit]['function']) && is_callable($sn_ali_admin_internal[$edit]['function']))
129 129
     {
130 130
       call_user_func($sn_ali_admin_internal[$edit]['function']);
131 131
     }
@@ -136,6 +136,6 @@  discard block
 block discarded – undo
136 136
   default:             require('includes/alliance/ali_info.inc'); break;
137 137
 }
138 138
 
139
-function ally_pre_call(){$func_args = func_get_args();return sn_function_call('ally_pre_call', $func_args);}
139
+function ally_pre_call() {$func_args = func_get_args(); return sn_function_call('ally_pre_call', $func_args); }
140 140
 
141 141
 ?>
Please login to merge, or discard this patch.
common.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -12,24 +12,24 @@  discard block
 block discarded – undo
12 12
 global $debug, $template_result, $user, $lang, $planetrow;
13 13
 
14 14
 // Напоминание для Администрации, что игра отключена
15
-if($template_result[F_GAME_DISABLE]) {
15
+if ($template_result[F_GAME_DISABLE]) {
16 16
   echo '<div class="global_admin_warning">', $template_result[F_GAME_DISABLE_REASON], '</div>';
17 17
 }
18 18
 unset($disable_reason);
19 19
 
20 20
 
21
-if(defined('IN_ADMIN') && IN_ADMIN === true) {
21
+if (defined('IN_ADMIN') && IN_ADMIN === true) {
22 22
   lng_include('admin');
23
-} elseif($sys_user_logged_in) {
23
+} elseif ($sys_user_logged_in) {
24 24
   sys_user_vacation($user);
25 25
 
26 26
   $planet_id = SetSelectedPlanet($user);
27 27
 
28 28
   // TODO НЕ НУЖНО АЛЬЯНС КАЖДЫЙ РАЗ ОБНОВЛЯТЬ!!!
29
-  if($user['ally_id']) {
29
+  if ($user['ally_id']) {
30 30
     sn_db_transaction_start();
31 31
     sn_ali_fill_user_ally($user);
32
-    if(!$user['ally']['player']['id']) {
32
+    if (!$user['ally']['player']['id']) {
33 33
       // sn_sys_logout(false, true);
34 34
       // core_auth::logout(false);
35 35
       classSupernova::$auth->logout(false);
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
   sn_db_transaction_commit();
49 49
 
50 50
   $planetrow = $global_data['planet'];
51
-  if(!($planetrow && isset($planetrow['id']) && $planetrow['id'])) {
51
+  if (!($planetrow && isset($planetrow['id']) && $planetrow['id'])) {
52 52
     // sn_sys_logout(false, true);
53 53
     // core_auth::logout(false);
54 54
     classSupernova::$auth->logout(false);
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 sys_user_options_unpack($user);
64 64
 
65 65
 global $sn_page_name, $sn_mvc;
66
-if(!empty($sn_mvc['pages'][INITIAL_PAGE][PAGE_OPTION_EARLY_HEADER])) {
66
+if (!empty($sn_mvc['pages'][INITIAL_PAGE][PAGE_OPTION_EARLY_HEADER])) {
67 67
   $title = !empty($sn_mvc['pages'][INITIAL_PAGE][PAGE_OPTION_TITLE]) ? $sn_mvc['pages'][INITIAL_PAGE][PAGE_OPTION_TITLE] : '';
68 68
   renderHeader($page, $title, $template_result, false, $user, classSupernova::$config, $lang, $planetrow);
69 69
 }
Please login to merge, or discard this patch.
jumpgate.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -14,39 +14,39 @@  discard block
 block discarded – undo
14 14
 
15 15
 lng_include('fleet');
16 16
 
17
-if($TargetPlanet = sys_get_param_id('jmpto'))
17
+if ($TargetPlanet = sys_get_param_id('jmpto'))
18 18
 {
19 19
   sn_db_transaction_start();
20 20
   db_user_by_id($user['id'], true, 'id');
21 21
   $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true);
22
-  if(!($NextJumpTime = uni_get_time_to_jump($planetrow)))
22
+  if (!($NextJumpTime = uni_get_time_to_jump($planetrow)))
23 23
   {
24 24
     $TargetGate = DBStaticPlanet::db_planet_by_id($TargetPlanet, true, '`id`, `last_jump_time`');
25
-    if(mrc_get_level($user, $TargetGate, STRUC_MOON_GATE) > 0)
25
+    if (mrc_get_level($user, $TargetGate, STRUC_MOON_GATE) > 0)
26 26
     {
27
-      $NextDestTime = uni_get_time_to_jump ( $TargetGate );
28
-      if(!$NextDestTime)
27
+      $NextDestTime = uni_get_time_to_jump($TargetGate);
28
+      if (!$NextDestTime)
29 29
       {
30 30
         // $SubQueryOri = "";
31 31
         // $SubQueryDes = "";
32 32
         $ship_list = sys_get_param('ships');
33 33
         $db_changeset = array();
34
-        foreach($ship_list as $ship_id => $ship_count)
34
+        foreach ($ship_list as $ship_id => $ship_count)
35 35
         {
36
-          if(!in_array($ship_id, sn_get_groups('fleet')))
36
+          if (!in_array($ship_id, sn_get_groups('fleet')))
37 37
           {
38 38
             continue;
39 39
           }
40 40
 
41 41
           $ship_count = max(0, min(floor($ship_count), mrc_get_level($user, $planetrow, $ship_id)));
42
-          if($ship_count)
42
+          if ($ship_count)
43 43
           {
44 44
             $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($ship_id, -$ship_count, $user, $planetrow['id']);
45 45
             $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($ship_id, $ship_count, $user, $TargetGate['id']);
46 46
           }
47 47
         }
48 48
         // Dit monsieur, y avait quelque chose a envoyer ???
49
-        if(!empty($db_changeset))
49
+        if (!empty($db_changeset))
50 50
         {
51 51
           DBStaticPlanet::db_planet_set_by_id($TargetGate['id'], "`last_jump_time` = " . SN_TIME_NOW . "");
52 52
           DBStaticPlanet::db_planet_set_by_id($planetrow['id'], "`last_jump_time` = " . SN_TIME_NOW . "");
@@ -55,31 +55,31 @@  discard block
 block discarded – undo
55 55
           db_user_set_by_id($user['id'], "`current_planet` = '{$TargetGate['id']}'");
56 56
 
57 57
           $planetrow['last_jump_time'] = SN_TIME_NOW;
58
-          $RetMessage = $lang['gate_jump_done'] ." - ". pretty_time(uni_get_time_to_jump($planetrow));
58
+          $RetMessage = $lang['gate_jump_done'] . " - " . pretty_time(uni_get_time_to_jump($planetrow));
59 59
         } else {
60 60
           $RetMessage = $lang['gate_wait_data'];
61 61
         }
62 62
       } else {
63
-        $RetMessage = $lang['gate_wait_dest'] ." - ". pretty_time($NextDestTime);
63
+        $RetMessage = $lang['gate_wait_dest'] . " - " . pretty_time($NextDestTime);
64 64
       }
65 65
     } else {
66 66
       $RetMessage = $lang['gate_no_dest_g'];
67 67
     }
68 68
   } else {
69
-    $RetMessage = $lang['gate_wait_star'] ." - ". pretty_time($NextJumpTime);
69
+    $RetMessage = $lang['gate_wait_star'] . " - " . pretty_time($NextJumpTime);
70 70
   }
71 71
   sn_db_transaction_commit();
72 72
   messageBox($RetMessage, $lang['tech'][STRUC_MOON_GATE], "jumpgate.php", 10);
73 73
 } else {
74 74
   $template = gettemplate('jumpgate', true);
75
-  if(mrc_get_level($user, $planetrow, STRUC_MOON_GATE) > 0)
75
+  if (mrc_get_level($user, $planetrow, STRUC_MOON_GATE) > 0)
76 76
   {
77 77
     $Combo = '';
78 78
     $MoonList = DBStaticPlanet::db_planet_list_moon_other($user['id'], $planetrow['id']);
79 79
     // while($CurMoon = db_fetch($MoonList))
80
-    foreach($MoonList as $CurMoon)
80
+    foreach ($MoonList as $CurMoon)
81 81
     {
82
-      if(mrc_get_level($user, $CurMoon, STRUC_MOON_GATE) >= 1)
82
+      if (mrc_get_level($user, $CurMoon, STRUC_MOON_GATE) >= 1)
83 83
       {
84 84
         $NextJumpTime = uni_get_time_to_jump($CurMoon);
85 85
         $template->assign_block_vars('moon', array(
@@ -93,9 +93,9 @@  discard block
 block discarded – undo
93 93
       }
94 94
     }
95 95
 
96
-    foreach(sn_get_groups('fleet') as $Ship)
96
+    foreach (sn_get_groups('fleet') as $Ship)
97 97
     {
98
-      if(($ship_count = mrc_get_level($user, $planetrow, $Ship)) <= 0)
98
+      if (($ship_count = mrc_get_level($user, $planetrow, $Ship)) <= 0)
99 99
       {
100 100
         continue;
101 101
       }
Please login to merge, or discard this patch.
messages.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
 $mode = sys_get_param_str('msg_delete') ? 'delete' : sys_get_param_str('mode');
44 44
 $current_class = sys_get_param_int('message_class');
45
-if(!isset($sn_message_class_list[$current_class])) {
45
+if (!isset($sn_message_class_list[$current_class])) {
46 46
   $current_class = 0;
47 47
   $mode = '';
48 48
 }
@@ -53,48 +53,48 @@  discard block
 block discarded – undo
53 53
     $template = gettemplate('msg_message_compose', true);
54 54
 
55 55
     $recipient_name = sys_get_param_str_unsafe('recipient_name');
56
-    if($recipient_name) {
56
+    if ($recipient_name) {
57 57
       $recipient_row = db_user_by_username($recipient_name);
58 58
     }
59 59
 
60
-    if(!$recipient_row) {
60
+    if (!$recipient_row) {
61 61
       $recipient_id = sys_get_param_id('id');
62 62
       $recipient_row = db_user_by_id($recipient_id);
63
-      if(!$recipient_row) {
63
+      if (!$recipient_row) {
64 64
         $recipient_id = 0;
65 65
       }
66 66
     }
67 67
 
68
-    if($recipient_row) {
68
+    if ($recipient_row) {
69 69
       $recipient_id = $recipient_row['id'];
70 70
       $recipient_name = $recipient_row['username'];
71 71
     }
72 72
 
73
-    if($recipient_id == $user['id']) {
73
+    if ($recipient_id == $user['id']) {
74 74
       $error_list[] = array('MESSAGE' => $lang['msg_err_self_send'], 'STATUS' => ERR_ERROR);
75 75
     }
76 76
 
77 77
     $re = 0;
78 78
     $subject = sys_get_param_str('subject');
79
-    while(strpos($subject, $lang['msg_answer_prefix']) !== false) {
79
+    while (strpos($subject, $lang['msg_answer_prefix']) !== false) {
80 80
       $subject = substr($subject, strlen($lang['msg_answer_prefix']));
81 81
       $re++;
82 82
     }
83 83
     $re ? $subject = $lang['msg_answer_prefix'] . $subject : false;
84 84
 
85
-    if(sys_get_param_str('msg_send')) {
85
+    if (sys_get_param_str('msg_send')) {
86 86
       $subject = $subject ? $subject : $lang['msg_subject_default'];
87 87
 
88
-      if(!$recipient_id) {
88
+      if (!$recipient_id) {
89 89
         $error_list[] = array('MESSAGE' => $lang['msg_err_player_not_found'], 'STATUS' => ERR_ERROR);
90 90
       }
91 91
 
92 92
       $text = sys_get_param_str('text');
93
-      if(!$text) {
93
+      if (!$text) {
94 94
         $error_list[] = array('MESSAGE' => $lang['msg_err_no_text'], 'STATUS' => ERR_ERROR);
95 95
       }
96 96
 
97
-      if(empty($error_list)) {
97
+      if (empty($error_list)) {
98 98
         $error_list[] = array('MESSAGE' => $lang['msg_not_message_sent'], 'STATUS' => ERR_NONE);
99 99
 
100 100
         $user_safe_name = db_escape($user['username']);
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         //$recipient_id = 0;
105 105
         //$recipient_name = '';
106 106
         //$subject = '';
107
-        $text    = '';
107
+        $text = '';
108 108
 
109 109
         $msg_sent = true;
110 110
       } else {
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
       'TEXT'           => htmlspecialchars($text),
124 124
     ));
125 125
 
126
-    foreach($error_list as $error_message) {
126
+    foreach ($error_list as $error_message) {
127 127
       $template->assign_block_vars('result', $error_message);
128 128
     }
129 129
 
@@ -153,25 +153,25 @@  discard block
 block discarded – undo
153 153
 
154 154
     $message_range = sys_get_param_str('message_range');
155 155
 
156
-    switch($message_range) {
156
+    switch ($message_range) {
157 157
       case 'unchecked':
158 158
       case 'checked':
159 159
         $marked_message_list = sys_get_param('mark', array());
160
-        if($message_range == 'checked' && empty($marked_message_list)) {
160
+        if ($message_range == 'checked' && empty($marked_message_list)) {
161 161
           break;
162 162
         }
163 163
 
164 164
         $query_add = implode(',', $marked_message_list);
165
-        if($query_add) {
165
+        if ($query_add) {
166 166
           $query_add = "IN ({$query_add})";
167
-          if($message_range == 'unchecked') {
167
+          if ($message_range == 'unchecked') {
168 168
             $query_add = "NOT {$query_add}";
169 169
           }
170 170
           $query_add = " AND `message_id` {$query_add}";
171 171
         }
172 172
 
173 173
       case 'class':
174
-        if($current_class != MSG_TYPE_OUTBOX && $current_class != MSG_TYPE_NEW) {
174
+        if ($current_class != MSG_TYPE_OUTBOX && $current_class != MSG_TYPE_NEW) {
175 175
           $query_add .= " AND `message_type` = {$current_class}";
176 176
         }
177 177
       case 'all':
@@ -179,19 +179,19 @@  discard block
 block discarded – undo
179 179
       break;
180 180
     }
181 181
 
182
-    if($query_add) {
182
+    if ($query_add) {
183 183
       $query_add = $query_add === true ? '' : $query_add;
184 184
       doquery("DELETE FROM `{{messages}}` WHERE `message_owner` = '{$user['id']}'{$query_add};");
185 185
     }
186 186
 
187 187
   case 'show':
188
-    if($current_class == MSG_TYPE_OUTBOX) {
188
+    if ($current_class == MSG_TYPE_OUTBOX) {
189 189
       $message_query = db_message_list_outbox_by_user_id($user['id']);
190 190
     } else {
191 191
       if ($current_class == MSG_TYPE_NEW) {
192 192
         $SubUpdateQry = array();
193
-        foreach($sn_message_class_list as $message_class_id => $message_class) {
194
-          if($message_class_id != MSG_TYPE_OUTBOX) {
193
+        foreach ($sn_message_class_list as $message_class_id => $message_class) {
194
+          if ($message_class_id != MSG_TYPE_OUTBOX) {
195 195
             $SubUpdateQry[] = "`{$message_class['name']}` = '0'";
196 196
             $user[$message_class['name']] = 0;
197 197
           }
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
       $message_query = doquery($message_query);
211 211
     }
212 212
 
213
-    if(sys_get_param_int('return')) {
213
+    if (sys_get_param_int('return')) {
214 214
       sys_redirect('messages.php');
215 215
     }
216 216
 
@@ -238,11 +238,11 @@  discard block
 block discarded – undo
238 238
   break;
239 239
 }
240 240
 
241
-if(!$template) {
241
+if (!$template) {
242 242
   $template = gettemplate('msg_message_class', true);
243 243
 
244 244
   $query = doquery("SELECT message_owner, message_type, COUNT(message_owner) AS message_count FROM {{messages}} WHERE `message_owner` = {$user['id']} GROUP BY message_owner, message_type ORDER BY message_owner ASC, message_type;");
245
-  while($message_row = db_fetch($query)) {
245
+  while ($message_row = db_fetch($query)) {
246 246
     $messages_total[$message_row['message_type']]  = $message_row['message_count'];
247 247
     $messages_total[MSG_TYPE_NEW]                 += $message_row['message_count'];
248 248
   }
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
   $query = doquery("SELECT COUNT(message_sender) AS message_count FROM {{messages}} WHERE `message_sender` = '{$user['id']}' AND message_type = 1 GROUP BY message_sender;", '', true);
251 251
   $messages_total[MSG_TYPE_OUTBOX] = intval($query['message_count']);
252 252
 
253
-  foreach($sn_message_class_list as $message_class_id => $message_class) {
253
+  foreach ($sn_message_class_list as $message_class_id => $message_class) {
254 254
     $template->assign_block_vars('message_class', array(
255 255
       'ID'     => $message_class_id,
256 256
       'STYLE'  => $message_class['name'],
Please login to merge, or discard this patch.
search.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 
13 13
 include('common.' . substr(strrchr(__FILE__, '.'), 1));
14 14
 
15
-if(classSupernova::$config->game_mode == GAME_BLITZ) {
15
+if (classSupernova::$config->game_mode == GAME_BLITZ) {
16 16
   messageBox($lang['sys_blitz_page_disabled'], $lang['sys_error'], 'overview.php', 10);
17 17
   die();
18 18
 }
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
 
26 26
 $template = gettemplate('search', true);
27 27
 
28
-if($searchtext && $type)
28
+if ($searchtext && $type)
29 29
 {
30
-  switch($type)
30
+  switch ($type)
31 31
   {
32 32
     case "planetname":
33 33
       // $search = db_planet_list_search($searchtext);
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
     break;
44 44
   }
45 45
 
46
-  while($row = db_fetch($search))
46
+  while ($row = db_fetch($search))
47 47
   {
48
-    if($type=='playername' || $type=='planetname')
48
+    if ($type == 'playername' || $type == 'planetname')
49 49
     {
50 50
       $template->assign_block_vars('search_result', array(
51 51
         'PLAYER_ID' => $row['uid'],
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
         'ALLY_TAG' => htmlentities($row['ally_tag'], ENT_COMPAT, 'UTF-8'),
63 63
       ));
64 64
     }
65
-    elseif($type=='ally')
65
+    elseif ($type == 'ally')
66 66
     {
67 67
       $template->assign_block_vars('search_result', array(
68 68
         'ALLY_NAME' => htmlentities($row['ally_name'], ENT_COMPAT, 'UTF-8'),
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
   'ally' => 'sys_alliance',
82 82
 );
83 83
 
84
-foreach($search_type as $type_id => $type_lang)
84
+foreach ($search_type as $type_id => $type_lang)
85 85
 {
86 86
   $template->assign_block_vars('type', array(
87 87
     'ID' => $type_id,
Please login to merge, or discard this patch.
annonce.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -18,25 +18,25 @@  discard block
 block discarded – undo
18 18
 
19 19
 lng_include('announce');
20 20
 
21
-switch($action)
21
+switch ($action)
22 22
 {
23 23
   case 1://on veut poster une annonce
24
-    $page .='<HTML>
24
+    $page .= '<HTML>
25 25
     <center>
26 26
     <br>
27 27
     <table width="600">
28
-    <td class="c" colspan="10" align="center"><b><font color="white">'.$lang['Classifieds'].'</font></b></td></tr>
28
+    <td class="c" colspan="10" align="center"><b><font color="white">'.$lang['Classifieds'] . '</font></b></td></tr>
29 29
     <form action="annonce.php?action=2" method="post">
30
-    <td class="c" colspan="10" align="center"><b>'.$lang['Resources_to_be_sold'].'</font></b></td>
31
-    <tr><th colspan="5">'.$lang['metal'].'</th><th colspan="5"><input type="texte" value="0" name="metalvendre" /></th></tr>
32
-    <tr><th colspan="5">'.$lang['crystal'].'</th><th colspan="5"><input type="texte" value="0" name="cristalvendre" /></th></tr>
33
-    <tr><th colspan="5">'.$lang['deuterium'].'</th><th colspan="5"><input type="texte" value="0" name="deutvendre" /></th></tr>
30
+    <td class="c" colspan="10" align="center"><b>'.$lang['Resources_to_be_sold'] . '</font></b></td>
31
+    <tr><th colspan="5">'.$lang['metal'] . '</th><th colspan="5"><input type="texte" value="0" name="metalvendre" /></th></tr>
32
+    <tr><th colspan="5">'.$lang['crystal'] . '</th><th colspan="5"><input type="texte" value="0" name="cristalvendre" /></th></tr>
33
+    <tr><th colspan="5">'.$lang['deuterium'] . '</th><th colspan="5"><input type="texte" value="0" name="deutvendre" /></th></tr>
34 34
 
35
-    <td class="c" colspan="10" align="center"><b>'.$lang['Desired_resources'].'</font></b></td></tr>
36
-    <tr><th colspan="5">'.$lang['metal'].'</th><th colspan="5"><input type="texte" value="0" name="metalsouhait" /></th></tr>
37
-    <tr><th colspan="5">'.$lang['crystal'].'</th><th colspan="5"><input type="texte" value="0" name="cristalsouhait" /></th></tr>
38
-    <tr><th colspan="5">'.$lang['deuterium'].'</th><th colspan="5"><input type="texte" value="0" name="deutsouhait" /></th></tr>
39
-    <tr><th colspan="10"><input type="submit" value="'.$lang['send'].'" /></th></tr>
35
+    <td class="c" colspan="10" align="center"><b>'.$lang['Desired_resources'] . '</font></b></td></tr>
36
+    <tr><th colspan="5">'.$lang['metal'] . '</th><th colspan="5"><input type="texte" value="0" name="metalsouhait" /></th></tr>
37
+    <tr><th colspan="5">'.$lang['crystal'] . '</th><th colspan="5"><input type="texte" value="0" name="cristalsouhait" /></th></tr>
38
+    <tr><th colspan="5">'.$lang['deuterium'] . '</th><th colspan="5"><input type="texte" value="0" name="deutsouhait" /></th></tr>
39
+    <tr><th colspan="10"><input type="submit" value="'.$lang['send'] . '" /></th></tr>
40 40
 
41 41
     <form>
42 42
     </table>
@@ -53,20 +53,20 @@  discard block
 block discarded – undo
53 53
     $deutvendre = sys_get_param_float('deutvendre');
54 54
     $deutsouhait = sys_get_param_float('deutsouhait');
55 55
 
56
-    if(($metalvendre!=0 && $metalsouhait==0) ||($cristalvendre!=0 && $cristalsouhait==0) || ($deutvendre!=0 && $deutsouhait==0))
56
+    if (($metalvendre != 0 && $metalsouhait == 0) || ($cristalvendre != 0 && $cristalsouhait == 0) || ($deutvendre != 0 && $deutsouhait == 0))
57 57
     {
58 58
       doquery("INSERT INTO {{annonce}} SET `user` ='{$users['username']}', `galaxie` ='{$users['galaxy']}', `systeme` ='{$users['system']}', `metala` ='{$metalvendre}', `cristala` ='{$cristalvendre}', `deuta` ='{$deutvendre}', `metals` ='{$metalsouhait}', `cristals` ='{$cristalsouhait}', `deuts` ='{$deutsouhait}'");
59
-      messageBox ($lang['Your_announce_was_recorded'], $lang['announce_status'],"annonce.php");
59
+      messageBox($lang['Your_announce_was_recorded'], $lang['announce_status'], "annonce.php");
60 60
     }
61 61
     else
62 62
     {
63
-      messageBox ($lang['Your_announce_not_recorded'], $lang['announce_status'],"annonce.php?action=1");
63
+      messageBox($lang['Your_announce_not_recorded'], $lang['announce_status'], "annonce.php?action=1");
64 64
     }
65 65
   break;
66 66
 
67 67
   case 3://Suppression d'annonce
68 68
     doquery("DELETE FROM {{annonce}} WHERE `id` = {$GET_id}");
69
-    messageBox ($lang['Your_announce_was_deleted'], $lang['announce_status'],"annonce.php");
69
+    messageBox($lang['Your_announce_was_deleted'], $lang['announce_status'], "annonce.php");
70 70
   break;
71 71
 
72 72
   default://Sinon on affiche la liste des annonces
@@ -81,15 +81,15 @@  discard block
 block discarded – undo
81 81
     while ($b = db_fetch($annonce))
82 82
     {
83 83
       $page2 .= '<tr><th>';
84
-      foreach($b as $name => $value)
84
+      foreach ($b as $name => $value)
85 85
       {
86
-        if($name!='id')
86
+        if ($name != 'id')
87 87
         {
88
-          $page2 .= $value ;
88
+          $page2 .= $value;
89 89
           $page2 .= '</th><th>';
90 90
         }
91 91
       }
92
-      $page2 .= ($b['user']==$users['username'])?"<a href=\"annonce.php?action=3&id={$b[id]}\">X</a></th></tr>":"</th></tr>";
92
+      $page2 .= ($b['user'] == $users['username']) ? "<a href=\"annonce.php?action=3&id={$b[id]}\">X</a></th></tr>" : "</th></tr>";
93 93
     }
94 94
 
95 95
     $page2 .= "<tr><th colspan=\"10\" align=\"center\"><a href=\"annonce.php?action=1\">{$lang['add_announce']}</a></th></tr></td></table></HTML>";
Please login to merge, or discard this patch.