Passed
Push — master ( bc874f...230097 )
by SuperNova.WS
04:01
created
includes/includes/art_artifact.php 2 patches
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;
@@ -68,9 +68,9 @@  discard block
 block discarded – undo
68 68
 
69 69
         // $deployment_str = '';
70 70
         $sectors_used = 0;
71
-        foreach($artifact_deploy as $deploy_unit_id => $deploy_unit_level)
71
+        foreach ($artifact_deploy as $deploy_unit_id => $deploy_unit_level)
72 72
         {
73
-          if(!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true))))
73
+          if (!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true))))
74 74
             continue;
75 75
           $sectors_used += $levels_deployed;
76 76
           $db_changeset['unit'][] = sn_db_unit_changeset_prepare($deploy_unit_id, $levels_deployed, $user, $planetrow['id']);
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
           //$deployment_str .= ",`{$deploy_unit_name}` = GREATEST(`{$deploy_unit_name}`, {$deploy_unit_level})";
79 79
         }
80 80
 
81
-        if($sectors_used == 0)
81
+        if ($sectors_used == 0)
82 82
         {
83 83
           $message = $lang['art_rcd_err_no_sense'];
84 84
           break;
@@ -93,13 +93,13 @@  discard block
 block discarded – undo
93 93
         $que_item = null;
94 94
         $que = que_get($user['id'], $planetrow['id'], QUE_RESEARCH, true);
95 95
         $current_que = &$que['ques'][QUE_RESEARCH][$user['id']][0];
96
-        if(!empty($current_que))
96
+        if (!empty($current_que))
97 97
         {
98 98
           reset($current_que);
99 99
           $que_item = &$que['ques'][QUE_RESEARCH][$user['id']][0][key($current_que)];
100 100
         }
101 101
 
102
-        if(!empty($que_item) && $que_item['que_time_left'] > 60)
102
+        if (!empty($que_item) && $que_item['que_time_left'] > 60)
103 103
         {
104 104
           $unit_level--;
105 105
           $old_time = $que_item['que_time_left'];
@@ -120,13 +120,13 @@  discard block
 block discarded – undo
120 120
         $que = que_get($user['id'], $planetrow['id'], QUE_STRUCTURES, true);
121 121
         $current_que = &$que['ques'][QUE_STRUCTURES][$user['id']][$planetrow['id']];
122 122
         // $que_item = &$que['que'][QUE_STRUCTURES][0];
123
-        if(!empty($current_que))
123
+        if (!empty($current_que))
124 124
         {
125 125
           reset($current_que);
126 126
           $que_item = &$que['ques'][QUE_STRUCTURES][$user['id']][$planetrow['id']][key($current_que)];
127 127
         }
128 128
 
129
-        if(isset($que_item) && $que_item['que_time_left'] > 60)
129
+        if (isset($que_item) && $que_item['que_time_left'] > 60)
130 130
         {
131 131
           $unit_level--;
132 132
           $old_time = $que_item['que_time_left'];
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
       break;
145 145
 
146 146
     }
147
-    if($unit_level != $artifact_level_old)
147
+    if ($unit_level != $artifact_level_old)
148 148
     {
149 149
       $db_changeset['unit'][] = sn_db_unit_changeset_prepare($unit_id, $unit_level - $artifact_level_old, $user);
150 150
       db_changeset_apply($db_changeset);
Please login to merge, or discard this patch.
Braces   +9 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,7 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-function art_use(&$user, &$planetrow, $unit_id)
4
-{
3
+function art_use(&$user, &$planetrow, $unit_id) {
5 4
   global $lang;
6 5
 
7 6
   if(!in_array($unit_id, sn_get_groups('artifacts')))
@@ -34,14 +33,12 @@  discard block
 block discarded – undo
34 33
           {
35 34
             $new_moon_row = uni_create_moon($planetrow['galaxy'], $planetrow['system'], $planetrow['planet'], $user['id'], $moon_chance);
36 35
             $message = sprintf($lang['art_moon_create'][$unit_id], $new_moon_row['name'], uni_render_coordinates($planetrow), pretty_number($moon_chance));
37
-          }
38
-          else
36
+          } else
39 37
           {
40 38
             $message = $lang['art_lhc_moon_fail'];
41 39
           }
42 40
           msg_send_simple_message($user['id'], 0, 0, MSG_TYPE_ADMIN, $lang['art_lhc_from'], $lang['art_lhc_subj'], $message);
43
-        }
44
-        else
41
+        } else
45 42
         {
46 43
           $message = $lang['art_moon_exists'];
47 44
         }
@@ -70,8 +67,9 @@  discard block
 block discarded – undo
70 67
         $sectors_used = 0;
71 68
         foreach($artifact_deploy as $deploy_unit_id => $deploy_unit_level)
72 69
         {
73
-          if(!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true))))
74
-            continue;
70
+          if(!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true)))) {
71
+                      continue;
72
+          }
75 73
           $sectors_used += $levels_deployed;
76 74
           $db_changeset['unit'][] = sn_db_unit_changeset_prepare($deploy_unit_id, $levels_deployed, $user, $planetrow['id']);
77 75
           //$deploy_unit_name = get_unit_param($deploy_unit_id, P_NAME);
@@ -107,8 +105,7 @@  discard block
 block discarded – undo
107 105
           DBStaticQue::db_que_set_time_left_by_id($que_item['que_id'], $que_item['que_time_left']);
108 106
           $message = sprintf($lang['art_heurestic_chip_ok'], $lang['tech'][$que_item['que_unit_id']], $que_item['que_unit_level'], sys_time_human($old_time - $que_item['que_time_left']));
109 107
           msg_send_simple_message($user['id'], 0, 0, MSG_TYPE_QUE, $lang['art_heurestic_chip_subj'], $lang['art_heurestic_chip_subj'], $message);
110
-        }
111
-        else
108
+        } else
112 109
         {
113 110
           $message = $lang['art_heurestic_chip_no_research'];
114 111
         }
@@ -136,8 +133,7 @@  discard block
 block discarded – undo
136 133
             $lang['tech'][$que_item['que_unit_id']], $que_item['que_unit_level'], $planetrow['name'], uni_render_coordinates($planetrow), sys_time_human($old_time - $que_item['que_time_left'])
137 134
           );
138 135
           msg_send_simple_message($user['id'], 0, 0, MSG_TYPE_QUE, $lang['art_nano_builder_subj'], $lang['art_nano_builder_subj'], $message);
139
-        }
140
-        else
136
+        } else
141 137
         {
142 138
           $message = $lang['art_nano_builder_no_que'];
143 139
         }
@@ -149,8 +145,7 @@  discard block
 block discarded – undo
149 145
       $db_changeset['unit'][] = sn_db_unit_changeset_prepare($unit_id, $unit_level - $artifact_level_old, $user);
150 146
       db_changeset_apply($db_changeset);
151 147
     }
152
-  }
153
-  else
148
+  } else
154 149
   {
155 150
     $message = $lang['art_err_no_artifact'];
156 151
   }
Please login to merge, or discard this patch.
includes/includes/flt_flying_fleet_handler2.php 1 patch
Spacing   +33 added lines, -37 removed lines patch added patch discarded remove patch
@@ -19,12 +19,12 @@  discard block
 block discarded – undo
19 19
 */
20 20
 
21 21
 // ------------------------------------------------------------------
22
-function RestoreFleetToPlanet(&$fleet_row, $start = true, $only_resources = false, $safe_fleet = false){return sn_function_call('RestoreFleetToPlanet', array(&$fleet_row, $start, $only_resources, $safe_fleet, &$result));}
22
+function RestoreFleetToPlanet(&$fleet_row, $start = true, $only_resources = false, $safe_fleet = false) {return sn_function_call('RestoreFleetToPlanet', array(&$fleet_row, $start, $only_resources, $safe_fleet, &$result)); }
23 23
 function sn_RestoreFleetToPlanet(&$fleet_row, $start = true, $only_resources = false, $safe_fleet = false, &$result) {
24 24
   sn_db_transaction_check(true);
25 25
 
26 26
   $result = CACHE_NOTHING;
27
-  if(!is_array($fleet_row)) {
27
+  if (!is_array($fleet_row)) {
28 28
     return $result;
29 29
   }
30 30
 
@@ -46,24 +46,24 @@  discard block
 block discarded – undo
46 46
 //  $fleet_row = doquery("SELECT * FROM {{fleets}} WHERE `fleet_id`='{$fleet_row['fleet_id']}' LIMIT 1 FOR UPDATE;", true);
47 47
 
48 48
   // Если флот уже обработан - не существует или возращается - тогда ничего не делаем
49
-  if(!$fleet_row || !is_array($fleet_row) || ($fleet_row['fleet_mess'] == 1 && $only_resources)) {
49
+  if (!$fleet_row || !is_array($fleet_row) || ($fleet_row['fleet_mess'] == 1 && $only_resources)) {
50 50
     return $result;
51 51
   }
52 52
 
53 53
   // Флот, который возвращается на захваченную планету, пропадает
54
-  if($start && $fleet_row['fleet_mess'] == 1 && $planet_arrival['id_owner'] != $fleet_row['fleet_owner']) {
54
+  if ($start && $fleet_row['fleet_mess'] == 1 && $planet_arrival['id_owner'] != $fleet_row['fleet_owner']) {
55 55
     db_fleet_delete($fleet_row['fleet_id']);
56 56
     return $result;
57 57
   }
58 58
 
59 59
   $db_changeset = array();
60
-  if(!$only_resources) {
60
+  if (!$only_resources) {
61 61
     db_fleet_delete($fleet_row['fleet_id']);
62 62
 
63
-    if($fleet_row['fleet_owner'] == $planet_arrival['id_owner']) {
63
+    if ($fleet_row['fleet_owner'] == $planet_arrival['id_owner']) {
64 64
       $fleet_array = sys_unit_str2arr($fleet_row['fleet_array']);
65
-      foreach($fleet_array as $ship_id => $ship_count) {
66
-        if($ship_count) {
65
+      foreach ($fleet_array as $ship_id => $ship_count) {
66
+        if ($ship_count) {
67 67
           $db_changeset['unit'][] = sn_db_unit_changeset_prepare($ship_id, $ship_count, $user, $planet_arrival['id']);
68 68
         }
69 69
       }
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     fleet_update_set($fleet_row['fleet_id'], $fleet_set);
81 81
   }
82 82
 
83
-  if(!empty($db_changeset)) {
83
+  if (!empty($db_changeset)) {
84 84
     db_changeset_apply($db_changeset);
85 85
   }
86 86
 
@@ -94,15 +94,11 @@  discard block
 block discarded – undo
94 94
 // ------------------------------------------------------------------
95 95
 function flt_flyingFleetsSort($a, $b) {
96 96
   // Сравниваем время флотов - кто раньше, тот и первый обрабатывается
97
-  return $a['fleet_time'] > $b['fleet_time'] ? 1 : ($a['fleet_time'] < $b['fleet_time'] ? -1 :
98
-    // Если время - одинаковое, сравниваем события флотов
97
+  return $a['fleet_time'] > $b['fleet_time'] ? 1 : ($a['fleet_time'] < $b['fleet_time'] ? -1 : // Если время - одинаковое, сравниваем события флотов
99 98
     // Если события - одинаковые, то флоты равны
100
-    ($a['fleet_event'] == $b['fleet_event'] ? 0 :
101
-      // Если события разные - первыми считаем прибывающие флоты
102
-      ($a['fleet_event'] == EVENT_FLT_ARRIVE ? 1 : ($b['fleet_event'] == EVENT_FLT_ARRIVE ? -1 :
103
-        // Если нет прибывающих флотов - дальше считаем флоты, которые закончили миссию
104
-        ($a['fleet_event'] == EVENT_FLT_ACOMPLISH ? 1 : ($b['fleet_event'] == EVENT_FLT_ACOMPLISH ? -1 :
105
-          // Если нет флотов, закончивших задание - остались возвращающиеся флоты, которые равны между собой
99
+    ($a['fleet_event'] == $b['fleet_event'] ? 0 : // Если события разные - первыми считаем прибывающие флоты
100
+      ($a['fleet_event'] == EVENT_FLT_ARRIVE ? 1 : ($b['fleet_event'] == EVENT_FLT_ARRIVE ? -1 : // Если нет прибывающих флотов - дальше считаем флоты, которые закончили миссию
101
+        ($a['fleet_event'] == EVENT_FLT_ACOMPLISH ? 1 : ($b['fleet_event'] == EVENT_FLT_ACOMPLISH ? -1 : // Если нет флотов, закончивших задание - остались возвращающиеся флоты, которые равны между собой
106 102
           // TODO: Добавить еще проверку по ID флота и/или времени запуска - что бы обсчитывать их в порядке запуска
107 103
           (
108 104
             0 // Вообще сюда доходить не должно - будет отсекаться на равенстве событий
@@ -116,11 +112,11 @@  discard block
 block discarded – undo
116 112
 function log_file($msg) {
117 113
   static $handler;
118 114
 
119
-  if(!$handler) {
115
+  if (!$handler) {
120 116
     $handler = fopen('event.log', 'a+');
121 117
   }
122 118
 
123
-  fwrite($handler, date(FMT_DATE_TIME_SQL, time()) .' ' . $msg . "\r\n");
119
+  fwrite($handler, date(FMT_DATE_TIME_SQL, time()) . ' ' . $msg . "\r\n");
124 120
 }
125 121
 
126 122
 // ------------------------------------------------------------------
@@ -154,7 +150,7 @@  discard block
 block discarded – undo
154 150
   */
155 151
   global $config, $debug;
156 152
 
157
-  if(
153
+  if (
158 154
     $config->game_disable != GAME_DISABLE_NONE
159 155
     ||
160 156
     $skip_fleet_update
@@ -167,8 +163,8 @@  discard block
 block discarded – undo
167 163
   sn_db_transaction_start();
168 164
 
169 165
   // Watchdog timer
170
-  if($config->db_loadItem('fleet_update_lock')) {
171
-    if(SN_TIME_NOW - strtotime($config->fleet_update_lock) <= mt_rand(90, 120)) {
166
+  if ($config->db_loadItem('fleet_update_lock')) {
167
+    if (SN_TIME_NOW - strtotime($config->fleet_update_lock) <= mt_rand(90, 120)) {
172 168
       sn_db_transaction_rollback();
173 169
       return;
174 170
     } else {
@@ -192,12 +188,12 @@  discard block
 block discarded – undo
192 188
   $missions_used = array();
193 189
 
194 190
   $fleet_list_current_tick = fleet_list_current_tick();
195
-  foreach($fleet_list_current_tick as $fleet_row) {
191
+  foreach ($fleet_list_current_tick as $fleet_row) {
196 192
     set_time_limit(15);
197 193
     // TODO - Унифицировать код с темплейтным разбором эвентов на планете!
198 194
     $fleet_list[$fleet_row['fleet_id']] = $fleet_row;
199 195
     $missions_used[$fleet_row['fleet_mission']] = 1;
200
-    if($fleet_row['fleet_start_time'] <= SN_TIME_NOW && $fleet_row['fleet_mess'] == 0) {
196
+    if ($fleet_row['fleet_start_time'] <= SN_TIME_NOW && $fleet_row['fleet_mess'] == 0) {
201 197
       $fleet_event_list[] = array(
202 198
         'fleet_row' => &$fleet_list[$fleet_row['fleet_id']],
203 199
         'fleet_time' => $fleet_list[$fleet_row['fleet_id']]['fleet_start_time'],
@@ -205,7 +201,7 @@  discard block
 block discarded – undo
205 201
       );
206 202
     }
207 203
 
208
-    if($fleet_row['fleet_end_stay'] > 0 && $fleet_row['fleet_end_stay'] <= SN_TIME_NOW && $fleet_row['fleet_mess'] == 0) {
204
+    if ($fleet_row['fleet_end_stay'] > 0 && $fleet_row['fleet_end_stay'] <= SN_TIME_NOW && $fleet_row['fleet_mess'] == 0) {
209 205
       $fleet_event_list[] = array(
210 206
         'fleet_row' => &$fleet_list[$fleet_row['fleet_id']],
211 207
         'fleet_time' => $fleet_list[$fleet_row['fleet_id']]['fleet_end_stay'],
@@ -213,7 +209,7 @@  discard block
 block discarded – undo
213 209
       );
214 210
     }
215 211
 
216
-    if($fleet_row['fleet_end_time'] <= SN_TIME_NOW)
212
+    if ($fleet_row['fleet_end_time'] <= SN_TIME_NOW)
217 213
     {
218 214
       $fleet_event_list[] = array(
219 215
         'fleet_row' => &$fleet_list[$fleet_row['fleet_id']],
@@ -243,7 +239,7 @@  discard block
 block discarded – undo
243 239
 //    MT_MISSILE => 'flt_mission_missile.php',
244 240
     MT_EXPLORE => 'flt_mission_explore',
245 241
   );
246
-  foreach($missions_used as $mission_id => $cork) {
242
+  foreach ($missions_used as $mission_id => $cork) {
247 243
     require_once(SN_ROOT_PHYSICAL . "includes/includes/{$mission_files[$mission_id]}" . DOT_PHP_EX);
248 244
   }
249 245
 
@@ -251,11 +247,11 @@  discard block
 block discarded – undo
251 247
 
252 248
 //log_file('Обработка миссий');
253 249
   $sn_groups_mission = sn_get_groups('missions');
254
-  foreach($fleet_event_list as $fleet_event) {
250
+  foreach ($fleet_event_list as $fleet_event) {
255 251
     // Watchdog timer
256 252
     // If flying fleet handler works more then 10 seconds - stopping it
257 253
     // Let next run handle rest of fleets
258
-    if(time() - SN_TIME_NOW > 10) {
254
+    if (time() - SN_TIME_NOW > 10) {
259 255
       $debug->warning('Flying fleet handler standard routine works more then 10 seconds - watchdog unlocked', 'FFH Warning', 504);
260 256
       break;
261 257
     }
@@ -263,7 +259,7 @@  discard block
 block discarded – undo
263 259
     // TODO: Указатель тут потом сделать
264 260
     // TODO: СЕЙЧАС НАДО ПРОВЕРЯТЬ ПО БАЗЕ - А ЖИВОЙ ЛИ ФЛОТ?!
265 261
     $fleet_row = $fleet_event['fleet_row'];
266
-    if(!$fleet_row) {
262
+    if (!$fleet_row) {
267 263
       // Fleet was destroyed in course of previous actions
268 264
       continue;
269 265
     }
@@ -280,20 +276,20 @@  discard block
 block discarded – undo
280 276
 
281 277
 //    $fleet_row = doquery("SELECT * FROM {{fleets}} WHERE fleet_id = {$fleet_row['fleet_id']} FOR UPDATE", true);
282 278
     $fleet_row = db_fleet_get($fleet_row['fleet_id']);
283
-    if(!$fleet_row || empty($fleet_row)) {
279
+    if (!$fleet_row || empty($fleet_row)) {
284 280
       // Fleet was destroyed in course of previous actions
285 281
       sn_db_transaction_commit();
286 282
       continue;
287 283
     }
288 284
 
289
-    if($fleet_event['fleet_event'] == EVENT_FLT_RETURN) {
285
+    if ($fleet_event['fleet_event'] == EVENT_FLT_RETURN) {
290 286
       // Fleet returns to planet
291 287
       RestoreFleetToPlanet($fleet_row, true, false, true);
292 288
       sn_db_transaction_commit();
293 289
       continue;
294 290
     }
295 291
 
296
-    if($fleet_event['fleet_event'] == EVENT_FLT_ARRIVE && $fleet_row['fleet_mess'] != 0) {
292
+    if ($fleet_event['fleet_event'] == EVENT_FLT_ARRIVE && $fleet_row['fleet_mess'] != 0) {
297 293
       // При событии EVENT_FLT_ARRIVE флот всегда должен иметь fleet_mess == 0
298 294
       // В противном случае это означает, что флот уже был обработан ранее - например, при САБе
299 295
       sn_db_transaction_commit();
@@ -310,22 +306,22 @@  discard block
 block discarded – undo
310 306
       'dst_user'   => $mission_data['dst_user'] || $mission_data['dst_planet'] ? db_user_by_id($fleet_row['fleet_target_owner'], true) : null,
311 307
       // TODO 'dst_planet' => $mission_data['dst_planet'] ? db_planet_by_id($fleet_row['fleet_end_planet_id'], true) : null,
312 308
       'dst_planet' => $mission_data['dst_planet'] ? DBStaticPlanet::db_planet_by_vector($fleet_row, 'fleet_end_', true, '`id`, `id_owner`, `name`') : null,
313
-      'src_user'   => $mission_data['src_user'] || $mission_data['src_planet'] ? db_user_by_id($fleet_row['fleet_owner'], true)  : null,
309
+      'src_user'   => $mission_data['src_user'] || $mission_data['src_planet'] ? db_user_by_id($fleet_row['fleet_owner'], true) : null,
314 310
       // TODO 'src_planet' => $mission_data['src_planet'] ? db_planet_by_id($fleet_row['fleet_start_planet_id'], true) : null,
315 311
       'src_planet' => $mission_data['src_planet'] ? DBStaticPlanet::db_planet_by_vector($fleet_row, 'fleet_start_', true, '`id`, `id_owner`, `name`') : null,
316 312
       'fleet_event' => $fleet_event['fleet_event'],
317 313
     );
318 314
 
319
-    if($mission_data['dst_planet']) {
315
+    if ($mission_data['dst_planet']) {
320 316
       // $mission_data['dst_planet'] = sys_o_get_updated($mission_data['dst_user'], $mission_data['dst_planet']['id'], $fleet_row['fleet_start_time']);
321
-      if($mission_data['dst_planet']['id_owner']) {
317
+      if ($mission_data['dst_planet']['id_owner']) {
322 318
         $mission_data['dst_planet'] = sys_o_get_updated($mission_data['dst_planet']['id_owner'], $mission_data['dst_planet']['id'], $fleet_row['fleet_start_time']);
323 319
       }
324 320
       $mission_data['dst_user'] = $mission_data['dst_user'] ? $mission_data['dst_planet']['user'] : null;
325 321
       $mission_data['dst_planet'] = $mission_data['dst_planet']['planet'];
326 322
     }
327 323
 
328
-    switch($fleet_row['fleet_mission']) {
324
+    switch ($fleet_row['fleet_mission']) {
329 325
       // Для боевых атак нужно обновлять по САБу и по холду - таки надо возвращать данные из обработчика миссий!
330 326
       case MT_AKS:
331 327
       case MT_ATTACK:
Please login to merge, or discard this patch.
includes/init.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 // Защита от двойного инита
4
-if(defined('INIT')) {
4
+if (defined('INIT')) {
5 5
   return;
6 6
 }
7 7
 
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 
21 21
 // Бенчмарк
22 22
 register_shutdown_function(function() {
23
-  if(defined('IN_AJAX')) {
23
+  if (defined('IN_AJAX')) {
24 24
     return;
25 25
   }
26 26
 
@@ -30,11 +30,11 @@  discard block
 block discarded – undo
30 30
     (!empty($locale_cache_statistic['misses']) ? ', LOCALE MISSED' : '') .
31 31
     (class_exists('classSupernova') && is_object(classSupernova::$db) ? ', DB time: ' . classSupernova::$db->time_mysql_total . 'ms' : '') .
32 32
     '</div>');
33
-  if($user['authlevel'] >= 2 && file_exists(SN_ROOT_PHYSICAL . 'badqrys.txt') && @filesize(SN_ROOT_PHYSICAL . 'badqrys.txt') > 0) {
33
+  if ($user['authlevel'] >= 2 && file_exists(SN_ROOT_PHYSICAL . 'badqrys.txt') && @filesize(SN_ROOT_PHYSICAL . 'badqrys.txt') > 0) {
34 34
     echo '<a href="badqrys.txt" target="_blank" style="color:red">', 'HACK ALERT!', '</a>';
35 35
   }
36 36
 
37
-  if(!empty($locale_cache_statistic['misses'])) {
37
+  if (!empty($locale_cache_statistic['misses'])) {
38 38
     print('<!--');
39 39
     pdump($locale_cache_statistic);
40 40
     print('-->');
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
 define('SN_TIME_NOW_GMT_STRING', gmdate(DATE_ATOM, SN_TIME_NOW));
56 56
 
57
-if(strpos(strtolower($_SERVER['SERVER_NAME']), 'google.') !== false) {
57
+if (strpos(strtolower($_SERVER['SERVER_NAME']), 'google.') !== false) {
58 58
   define('SN_GOOGLE', true);
59 59
 }
60 60
 
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 $phpbb_root_path = SN_ROOT_PHYSICAL; // Это нужно для работы PTL
65 65
 
66 66
 empty($classRoot) ? $classRoot = SN_ROOT_PHYSICAL . 'classes/' : false;
67
-spl_autoload_register(function ($class) use ($classRoot) {
67
+spl_autoload_register(function($class) use ($classRoot) {
68 68
   $class = str_replace('\\', '/', $class);
69 69
   if (file_exists($classRoot . $class . '.php')) {
70 70
     require_once $classRoot . $class . '.php';
@@ -119,21 +119,21 @@  discard block
 block discarded – undo
119 119
   ? trim(strip_tags($_GET['page']))
120 120
   : str_replace(DOT_PHP_EX, '', str_replace(SN_ROOT_RELATIVE, '', str_replace('\\', '/', $_SERVER['SCRIPT_NAME'])));
121 121
 define('INITIAL_PAGE', $sn_page_name_original);
122
-define('SN_COOKIE'        , (classSupernova::$config->COOKIE_NAME ? classSupernova::$config->COOKIE_NAME : 'SuperNova') . (defined('SN_GOOGLE') ? '_G' : ''));
123
-define('SN_COOKIE_I'      , SN_COOKIE . AUTH_COOKIE_IMPERSONATE_SUFFIX);
124
-define('SN_COOKIE_D'      , SN_COOKIE . '_D');
125
-define('SN_COOKIE_T'      , SN_COOKIE . '_T'); // Time measure cookie
126
-define('SN_COOKIE_F'      , SN_COOKIE . '_F'); // Font size cookie
127
-define('SN_COOKIE_U'      , SN_COOKIE . '_U'); // Current user cookie aka user ID
128
-define('SN_COOKIE_U_I'    , SN_COOKIE_U . AUTH_COOKIE_IMPERSONATE_SUFFIX); // Current impersonator user cookie aka impersonator user ID
129
-define('TEMPLATE_NAME'    , classSupernova::$config->game_default_template ? classSupernova::$config->game_default_template : 'OpenGame');
130
-define('TEMPLATE_PATH'    , 'design/templates/' . TEMPLATE_NAME);
131
-define('TEMPLATE_DIR'     , SN_ROOT_PHYSICAL . TEMPLATE_PATH);
132
-define('DEFAULT_SKINPATH' , classSupernova::$config->game_default_skin ? classSupernova::$config->game_default_skin : 'skins/EpicBlue/');
133
-define('DEFAULT_LANG'     , classSupernova::$config->game_default_language ? classSupernova::$config->game_default_language : 'ru');
134
-define('FMT_DATE'         , classSupernova::$config->int_format_date ? classSupernova::$config->int_format_date : 'd.m.Y');
135
-define('FMT_TIME'         , classSupernova::$config->int_format_time ? classSupernova::$config->int_format_time : 'H:i:s');
136
-define('FMT_DATE_TIME'    , FMT_DATE . ' ' . FMT_TIME);
122
+define('SN_COOKIE', (classSupernova::$config->COOKIE_NAME ? classSupernova::$config->COOKIE_NAME : 'SuperNova') . (defined('SN_GOOGLE') ? '_G' : ''));
123
+define('SN_COOKIE_I', SN_COOKIE . AUTH_COOKIE_IMPERSONATE_SUFFIX);
124
+define('SN_COOKIE_D', SN_COOKIE . '_D');
125
+define('SN_COOKIE_T', SN_COOKIE . '_T'); // Time measure cookie
126
+define('SN_COOKIE_F', SN_COOKIE . '_F'); // Font size cookie
127
+define('SN_COOKIE_U', SN_COOKIE . '_U'); // Current user cookie aka user ID
128
+define('SN_COOKIE_U_I', SN_COOKIE_U . AUTH_COOKIE_IMPERSONATE_SUFFIX); // Current impersonator user cookie aka impersonator user ID
129
+define('TEMPLATE_NAME', classSupernova::$config->game_default_template ? classSupernova::$config->game_default_template : 'OpenGame');
130
+define('TEMPLATE_PATH', 'design/templates/' . TEMPLATE_NAME);
131
+define('TEMPLATE_DIR', SN_ROOT_PHYSICAL . TEMPLATE_PATH);
132
+define('DEFAULT_SKINPATH', classSupernova::$config->game_default_skin ? classSupernova::$config->game_default_skin : 'skins/EpicBlue/');
133
+define('DEFAULT_LANG', classSupernova::$config->game_default_language ? classSupernova::$config->game_default_language : 'ru');
134
+define('FMT_DATE', classSupernova::$config->int_format_date ? classSupernova::$config->int_format_date : 'd.m.Y');
135
+define('FMT_TIME', classSupernova::$config->int_format_time ? classSupernova::$config->int_format_time : 'H:i:s');
136
+define('FMT_DATE_TIME', FMT_DATE . ' ' . FMT_TIME);
137 137
 
138 138
 $HTTP_ACCEPT_LANGUAGE = DEFAULT_LANG;
139 139
 
@@ -165,9 +165,9 @@  discard block
 block discarded – undo
165 165
 // Но нужно, пока у нас есть не MVC-страницы
166 166
 $sn_page_data = $sn_data['pages'][$sn_page_name];
167 167
 $sn_page_name_file = 'includes/pages/' . $sn_page_data['filename'] . DOT_PHP_EX;
168
-if($sn_page_name && isset($sn_page_data) && file_exists($sn_page_name_file)) {
168
+if ($sn_page_name && isset($sn_page_data) && file_exists($sn_page_name_file)) {
169 169
   require_once($sn_page_name_file);
170
-  if(is_array($sn_page_data['options'])) {
170
+  if (is_array($sn_page_data['options'])) {
171 171
     classSupernova::$options = array_merge(classSupernova::$options, $sn_page_data['options']);
172 172
   }
173 173
 //  $sn_page_data
@@ -189,10 +189,10 @@  discard block
 block discarded – undo
189 189
 $load_order = array();
190 190
 $sn_req = array();
191 191
 
192
-foreach($sn_module as $loaded_module_name => $module_data) {
192
+foreach ($sn_module as $loaded_module_name => $module_data) {
193 193
   $load_order[$loaded_module_name] = isset($module_data->manifest['load_order']) && !empty($module_data->manifest['load_order']) ? $module_data->manifest['load_order'] : 100000;
194
-  if(isset($module_data->manifest['require']) && !empty($module_data->manifest['require'])) {
195
-    foreach($module_data->manifest['require'] as $require_name) {
194
+  if (isset($module_data->manifest['require']) && !empty($module_data->manifest['require'])) {
195
+    foreach ($module_data->manifest['require'] as $require_name) {
196 196
       $sn_req[$loaded_module_name][$require_name] = 0;
197 197
     }
198 198
   }
@@ -203,10 +203,10 @@  discard block
 block discarded – undo
203 203
 do {
204 204
   $prev_order = $load_order;
205 205
 
206
-  foreach($sn_req as $loaded_module_name => &$req_data) {
206
+  foreach ($sn_req as $loaded_module_name => &$req_data) {
207 207
     $level = 1;
208
-    foreach($req_data as $req_name => &$req_level) {
209
-      if($load_order[$req_name] == -1 || !isset($load_order[$req_name])) {
208
+    foreach ($req_data as $req_name => &$req_level) {
209
+      if ($load_order[$req_name] == -1 || !isset($load_order[$req_name])) {
210 210
         $level = $req_level = -1;
211 211
         break;
212 212
       } else {
@@ -214,21 +214,21 @@  discard block
 block discarded – undo
214 214
       }
215 215
       $req_level = $load_order[$req_name];
216 216
     }
217
-    if($level > $load_order[$loaded_module_name] || $level == -1) {
217
+    if ($level > $load_order[$loaded_module_name] || $level == -1) {
218 218
       $load_order[$loaded_module_name] = $level;
219 219
     }
220 220
   }
221 221
 }
222
-while($prev_order != $load_order);
222
+while ($prev_order != $load_order);
223 223
 
224 224
 asort($load_order);
225 225
 
226 226
 // Инициализируем модули
227 227
 // По нормальным делам это должна быть загрузка модулей и лишь затем инициализация - что бы минимизировать размер процесса в памяти
228
-foreach($load_order as $loaded_module_name => $load_order_order) {
229
-  if($load_order_order >= 0) {
228
+foreach ($load_order as $loaded_module_name => $load_order_order) {
229
+  if ($load_order_order >= 0) {
230 230
     $sn_module[$loaded_module_name]->check_status();
231
-    if(!$sn_module[$loaded_module_name]->manifest['active']) {
231
+    if (!$sn_module[$loaded_module_name]->manifest['active']) {
232 232
       unset($sn_module[$loaded_module_name]);
233 233
       continue;
234 234
     }
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 unset($sn_req);
246 246
 
247 247
 // А теперь проверяем - поддерживают ли у нас загруженный код такую страницу
248
-if(!isset($sn_data['pages'][$sn_page_name])) {
248
+if (!isset($sn_data['pages'][$sn_page_name])) {
249 249
   $sn_page_name = '';
250 250
 }
251 251
 
@@ -258,19 +258,19 @@  discard block
 block discarded – undo
258 258
 $lang->lng_switch(sys_get_param_str('lang'));
259 259
 
260 260
 
261
-if(classSupernova::$config->server_updater_check_auto && classSupernova::$config->server_updater_check_last + classSupernova::$config->server_updater_check_period <= SN_TIME_NOW) {
261
+if (classSupernova::$config->server_updater_check_auto && classSupernova::$config->server_updater_check_last + classSupernova::$config->server_updater_check_period <= SN_TIME_NOW) {
262 262
   include(SN_ROOT_PHYSICAL . 'ajax_version_check' . DOT_PHP_EX);
263 263
 }
264 264
 
265
-if(classSupernova::$config->user_birthday_gift && SN_TIME_NOW - classSupernova::$config->user_birthday_celebrate > PERIOD_DAY) {
265
+if (classSupernova::$config->user_birthday_gift && SN_TIME_NOW - classSupernova::$config->user_birthday_celebrate > PERIOD_DAY) {
266 266
   require_once(SN_ROOT_PHYSICAL . "includes/includes/user_birthday_celebrate" . DOT_PHP_EX);
267 267
   sn_user_birthday_celebrate();
268 268
 }
269 269
 
270
-if(!classSupernova::$config->var_online_user_count || classSupernova::$config->var_online_user_time + 30 < SN_TIME_NOW) {
270
+if (!classSupernova::$config->var_online_user_count || classSupernova::$config->var_online_user_time + 30 < SN_TIME_NOW) {
271 271
   classSupernova::$config->db_saveItem('var_online_user_count', db_user_count(true));
272 272
   classSupernova::$config->db_saveItem('var_online_user_time', SN_TIME_NOW);
273
-  if(classSupernova::$config->server_log_online) {
273
+  if (classSupernova::$config->server_log_online) {
274 274
     doquery("INSERT IGNORE INTO {{log_users_online}} SET online_count = " . classSupernova::$config->var_online_user_count . ";");
275 275
   }
276 276
 }
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 
294 294
 $template_result[F_ACCOUNT_IS_AUTHORIZED] = $sys_user_logged_in = !empty($user) && isset($user['id']) && $user['id'];
295 295
 
296
-if(!empty($user['id'])) {
296
+if (!empty($user['id'])) {
297 297
   classSupernova::$user_options->user_change($user['id']);
298 298
 }
299 299
 
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
         : false
307 307
       );
308 308
 
309
-if($template_result[F_LOGIN_STATUS] == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) {
309
+if ($template_result[F_LOGIN_STATUS] == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) {
310 310
   $prohibited_characters = array_map(function($value) {
311 311
     return "'" . htmlentities($value, ENT_QUOTES, 'UTF-8') . "'";
312 312
   }, str_split(LOGIN_REGISTER_CHARACTERS_PROHIBITED));
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 }
315 315
 
316 316
 
317
-if(defined('DEBUG_AUTH') && DEBUG_AUTH && !defined('IN_AJAX')) {
317
+if (defined('DEBUG_AUTH') && DEBUG_AUTH && !defined('IN_AJAX')) {
318 318
   pdump("Отключи отладку перед продакшном!");
319 319
 }
320 320
 
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
   ? define('INSTALL_MODE', GAME_DISABLE_INSTALL)
329 329
   : false;
330 330
 
331
-if(
331
+if (
332 332
   classSupernova::$config->game_disable == GAME_DISABLE_STAT
333 333
   &&
334 334
   SN_TIME_NOW - strtotime(classSupernova::$config->db_loadItem('var_stat_update_end')) > 600
@@ -342,17 +342,17 @@  discard block
 block discarded – undo
342 342
 }
343 343
 
344 344
 
345
-if($template_result[F_GAME_DISABLE] = classSupernova::$config->game_disable) {
345
+if ($template_result[F_GAME_DISABLE] = classSupernova::$config->game_disable) {
346 346
   $template_result[F_GAME_DISABLE_REASON] = sys_bbcodeParse(
347 347
     classSupernova::$config->game_disable == GAME_DISABLE_REASON
348 348
       ? classSupernova::$config->game_disable_reason
349 349
       : $lang['sys_game_disable_reason'][classSupernova::$config->game_disable]
350 350
   );
351
-  if(defined('IN_API')) {
351
+  if (defined('IN_API')) {
352 352
     return;
353 353
   }
354 354
 
355
-  if(
355
+  if (
356 356
     ($user['authlevel'] < 1 || !(defined('IN_ADMIN') && IN_ADMIN))
357 357
     &&
358 358
     !(defined('INSTALL_MODE') && defined('LOGIN_LOGOUT'))
@@ -365,8 +365,8 @@  discard block
 block discarded – undo
365 365
 
366 366
 // TODO ban
367 367
 // TODO $skip_ban_check
368
-if($template_result[F_BANNED_STATUS] && !$skip_ban_check) {
369
-  if(defined('IN_API')) {
368
+if ($template_result[F_BANNED_STATUS] && !$skip_ban_check) {
369
+  if (defined('IN_API')) {
370 370
     return;
371 371
   }
372 372
 
@@ -380,10 +380,10 @@  discard block
 block discarded – undo
380 380
 $allow_anonymous = $allow_anonymous || (isset($sn_page_data['allow_anonymous']) && $sn_page_data['allow_anonymous']);
381 381
 
382 382
 
383
-if($sys_user_logged_in && INITIAL_PAGE == 'login') {
383
+if ($sys_user_logged_in && INITIAL_PAGE == 'login') {
384 384
   sys_redirect(SN_ROOT_VIRTUAL . 'overview.php');
385
-} elseif($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id'])
386
-} elseif(!$allow_anonymous && !$sys_user_logged_in) {
385
+} elseif ($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id'])
386
+} elseif (!$allow_anonymous && !$sys_user_logged_in) {
387 387
   sys_redirect(SN_ROOT_VIRTUAL . 'login.php');
388 388
 }
389 389
 
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 
404 404
 global $skip_fleet_update;
405 405
 $skip_fleet_update = $skip_fleet_update || classSupernova::$options['fleet_update_skip'] || defined('IN_ADMIN');
406
-if(!$skip_fleet_update && SN_TIME_NOW - strtotime(classSupernova::$config->fleet_update_last) > classSupernova::$config->fleet_update_interval) {
406
+if (!$skip_fleet_update && SN_TIME_NOW - strtotime(classSupernova::$config->fleet_update_last) > classSupernova::$config->fleet_update_interval) {
407 407
   require_once(SN_ROOT_PHYSICAL . "includes/includes/flt_flying_fleet_handler2" . DOT_PHP_EX);
408 408
   flt_flying_fleet_handler($skip_fleet_update);
409 409
 }
Please login to merge, or discard this patch.
admin/planet_edit.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 require('../common.' . substr(strrchr(__FILE__, '.'), 1));
8 8
 
9 9
 // if($user['authlevel'] < 2)
10
-if($user['authlevel'] < 3)
10
+if ($user['authlevel'] < 3)
11 11
 {
12 12
   AdminMessage($lang['adm_err_denied']);
13 13
 }
@@ -21,30 +21,30 @@  discard block
 block discarded – undo
21 21
 $planet_id = sys_get_param_id('planet_id');
22 22
 
23 23
 $unit_list = sys_get_param('unit_list');
24
-if(sys_get_param('change_data') && !empty($unit_list))
24
+if (sys_get_param('change_data') && !empty($unit_list))
25 25
 {
26 26
   $query_string = array();
27
-  foreach($unit_list as $unit_id => $unit_amount)
27
+  foreach ($unit_list as $unit_id => $unit_amount)
28 28
   {
29
-    if($unit_query_string = admin_planet_edit_query_string($unit_id, $unit_amount, $mode))
29
+    if ($unit_query_string = admin_planet_edit_query_string($unit_id, $unit_amount, $mode))
30 30
     {
31 31
       $query_string[] = $unit_query_string;
32 32
     }
33 33
   }
34 34
 
35
-  if(!empty($query_string))
35
+  if (!empty($query_string))
36 36
   {
37 37
     DBStaticPlanet::db_planet_set_by_id($planet_id, implode(', ', $query_string));
38 38
   }
39 39
 }
40 40
 
41
-if($planet_id)
41
+if ($planet_id)
42 42
 {
43 43
   $edit_planet_row = DBStaticPlanet::db_planet_by_id($planet_id);
44 44
   admin_planet_edit_template($template, $edit_planet_row, $mode);
45 45
 }
46 46
 
47
-foreach($admin_planet_edit_mode_list as $page_mode => $mode_locale)
47
+foreach ($admin_planet_edit_mode_list as $page_mode => $mode_locale)
48 48
 {
49 49
   $template->assign_block_vars('page_menu', array(
50 50
     'ID' => $page_mode,
Please login to merge, or discard this patch.
admin/messall.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -7,13 +7,13 @@  discard block
 block discarded – undo
7 7
  * @copyright 2008 by ??????? for XNova
8 8
  */
9 9
 
10
-define('INSIDE'  , true);
11
-define('INSTALL' , false);
10
+define('INSIDE', true);
11
+define('INSTALL', false);
12 12
 define('IN_ADMIN', true);
13 13
 
14 14
 require('../common.' . substr(strrchr(__FILE__, '.'), 1));
15 15
 
16
-if($user['authlevel'] < 3)
16
+if ($user['authlevel'] < 3)
17 17
 {
18 18
   AdminMessage($lang['adm_err_denied']);
19 19
 }
@@ -37,20 +37,20 @@  discard block
 block discarded – undo
37 37
   }
38 38
   if (classSupernova::$config->tresc != '' and classSupernova::$config->temat) {
39 39
     $Time    = time();
40
-    $From    = '<font color="'. $kolor .'">'. $ranga ." ".$user['username']."</font>";
41
-    $Subject = '<font color="'. $kolor .'">'. classSupernova::$config->temat ."</font>";
42
-    $Message = '<font color="'. $kolor .'"><b>'. classSupernova::$config->tresc ."</b></font>";
40
+    $From    = '<font color="' . $kolor . '">' . $ranga . " " . $user['username'] . "</font>";
41
+    $Subject = '<font color="' . $kolor . '">' . classSupernova::$config->temat . "</font>";
42
+    $Message = '<font color="' . $kolor . '"><b>' . classSupernova::$config->tresc . "</b></font>";
43 43
     $sq      = db_user_list('', false, 'id');
44
-    foreach($sq as $u)
44
+    foreach ($sq as $u)
45 45
     // while ($u = db_fetch($sq))
46 46
     {
47
-      msg_send_simple_message ($u['id'], $user['id'], $Time, MSG_TYPE_ADMIN, $From, $Subject, $Message);
47
+      msg_send_simple_message($u['id'], $user['id'], $Time, MSG_TYPE_ADMIN, $From, $Subject, $Message);
48 48
     }
49 49
     message("<font color=\"lime\">Херня на польском</font>", "Complete", "../overview." . PHP_EX, 3);
50 50
   }
51 51
 } else {
52 52
   $parse['dpath'] = $dpath;
53
-  $parse['debug'] = (classSupernova::$config->debug == 1) ? " checked='checked'/":'';
53
+  $parse['debug'] = (classSupernova::$config->debug == 1) ? " checked='checked'/" : '';
54 54
   $page .= parsetemplate(gettemplate('admin/messall_body'), $parse);
55
-  display($page, '', false,'', true);
55
+  display($page, '', false, '', true);
56 56
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,11 +41,12 @@
 block discarded – undo
41 41
     $Subject = '<font color="'. $kolor .'">'. classSupernova::$config->temat ."</font>";
42 42
     $Message = '<font color="'. $kolor .'"><b>'. classSupernova::$config->tresc ."</b></font>";
43 43
     $sq      = db_user_list('', false, 'id');
44
-    foreach($sq as $u)
45
-    // while ($u = db_fetch($sq))
44
+    foreach($sq as $u) {
45
+        // while ($u = db_fetch($sq))
46 46
     {
47 47
       msg_send_simple_message ($u['id'], $user['id'], $Time, MSG_TYPE_ADMIN, $From, $Subject, $Message);
48 48
     }
49
+    }
49 50
     message("<font color=\"lime\">Херня на польском</font>", "Complete", "../overview." . PHP_EX, 3);
50 51
   }
51 52
 } else {
Please login to merge, or discard this patch.
admin/tools.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -6,26 +6,26 @@  discard block
 block discarded – undo
6 6
  * @copyright 2009 by Gorlum for http://oGame.Triolan.COM.UA
7 7
  */
8 8
 
9
-define('INSIDE'  , true);
10
-define('INSTALL' , false);
9
+define('INSIDE', true);
10
+define('INSTALL', false);
11 11
 define('IN_ADMIN', true);
12 12
 require('../common.' . substr(strrchr(__FILE__, '.'), 1));
13 13
 
14 14
 // if($user['authlevel'] < 1)
15
-if($user['authlevel'] < 3)
15
+if ($user['authlevel'] < 3)
16 16
 {
17 17
   AdminMessage($lang['adm_err_denied']);
18 18
 }
19 19
 
20 20
 $mode = sys_get_param_int('mode');
21 21
 
22
-switch($mode){
22
+switch ($mode) {
23 23
   case ADM_TOOL_CONFIG_RELOAD:
24 24
     classSupernova::$config->db_loadAll();
25 25
     sys_refresh_tablelist();
26 26
 
27 27
     classSupernova::$config->db_loadItem('game_watchlist');
28
-    if(classSupernova::$config->game_watchlist)
28
+    if (classSupernova::$config->game_watchlist)
29 29
     {
30 30
       classSupernova::$config->game_watchlist_array = explode(';', classSupernova::$config->game_watchlist);
31 31
     }
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
       'STRING' => htmlentities($string),
48 48
       'MD5' => md5($string),
49 49
     ));
50
-    display($template, $lang['adm_tools_md5_header'], false, '', true );
50
+    display($template, $lang['adm_tools_md5_header'], false, '', true);
51 51
   break;
52 52
 
53 53
   case ADM_TOOL_FORCE_ALL:
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
       $lang['adm_tool_sql_client_version'] => db_get_client_info(),
74 74
       $lang['adm_tool_sql_host_info']      => db_get_host_info(),
75 75
     );
76
-    foreach($status as $key => $value)
76
+    foreach ($status as $key => $value)
77 77
     {
78 78
       $template->assign_block_vars('table.row', array(
79 79
         'VALUE_1' => $key,
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 
84 84
     $template->assign_block_vars('table', $lang['adm_tool_sql_table']['status']);
85 85
     $status = explode('  ', db_server_stat());
86
-    foreach($status as $value)
86
+    foreach ($status as $value)
87 87
     {
88 88
       $row = explode(': ', $value);
89 89
       $template->assign_block_vars('table.row', array(
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 
96 96
     $template->assign_block_vars('table', $lang['adm_tool_sql_table']['params']);
97 97
     $result = doquery('SHOW STATUS;');
98
-    while($row = db_fetch($result))
98
+    while ($row = db_fetch($result))
99 99
     {
100 100
       $template->assign_block_vars('table.row', array(
101 101
         'VALUE_1' => $row['Variable_name'],
@@ -110,10 +110,10 @@  discard block
 block discarded – undo
110 110
       'TABLE_FOOTER' => 'test',
111 111
     ));
112 112
 
113
-    display( $template, $lang['adm_bn_ttle'], false, '', true);
113
+    display($template, $lang['adm_bn_ttle'], false, '', true);
114 114
   break;
115 115
 
116 116
 }
117 117
 
118
-display( parsetemplate(gettemplate("admin/admin_tools", true)), $lang['adm_bn_ttle'], false, '', true);
118
+display(parsetemplate(gettemplate("admin/admin_tools", true)), $lang['adm_bn_ttle'], false, '', true);
119 119
 ?>
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,8 +28,7 @@
 block discarded – undo
28 28
     if(classSupernova::$config->game_watchlist)
29 29
     {
30 30
       classSupernova::$config->game_watchlist_array = explode(';', classSupernova::$config->game_watchlist);
31
-    }
32
-    else
31
+    } else
33 32
     {
34 33
       unset(classSupernova::$config->game_watchlist_array);
35 34
     }
Please login to merge, or discard this patch.
admin/settings.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -8,18 +8,18 @@  discard block
 block discarded – undo
8 8
  * @copyright 2008 by ??????? for XNova
9 9
  */
10 10
 
11
-define('INSIDE'  , true);
12
-define('INSTALL' , false);
11
+define('INSIDE', true);
12
+define('INSTALL', false);
13 13
 define('IN_ADMIN', true);
14 14
 require('../common.' . substr(strrchr(__FILE__, '.'), 1));
15 15
 
16
-if($user['authlevel'] < 3) {
16
+if ($user['authlevel'] < 3) {
17 17
   AdminMessage($lang['adm_err_denied']);
18 18
 }
19 19
 
20 20
 $template = gettemplate('admin/settings', true);
21 21
 
22
-if(sys_get_param('save')) {
22
+if (sys_get_param('save')) {
23 23
   classSupernova::$config->game_name               = sys_get_param_str_unsafe('game_name');
24 24
   classSupernova::$config->game_mode               = sys_get_param_int('game_mode');
25 25
   classSupernova::$config->game_speed              = sys_get_param_float('game_speed', 1);
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
   classSupernova::$config->url_faq                 = sys_get_param_str_unsafe('url_faq');
30 30
   classSupernova::$config->url_forum               = sys_get_param_str_unsafe('url_forum');
31 31
   classSupernova::$config->url_rules               = sys_get_param_str_unsafe('url_rules');
32
-  classSupernova::$config->url_purchase_metamatter         = sys_get_param_str_unsafe('url_purchase_metamatter');
32
+  classSupernova::$config->url_purchase_metamatter = sys_get_param_str_unsafe('url_purchase_metamatter');
33 33
   classSupernova::$config->game_disable            = sys_get_param_int('game_disable');
34 34
   classSupernova::$config->game_disable_reason     = sys_get_param_str_unsafe('game_disable_reason');
35 35
   classSupernova::$config->server_updater_check_auto = sys_get_param_int('server_updater_check_auto');
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
   classSupernova::$config->stats_schedule          = sys_get_param_str('stats_schedule');
97 97
 
98 98
   classSupernova::$config->empire_mercenary_base_period = sys_get_param_int('empire_mercenary_base_period');
99
-  if(classSupernova::$config->empire_mercenary_temporary != sys_get_param_int('empire_mercenary_temporary')) {
100
-    if(classSupernova::$config->empire_mercenary_temporary) {
99
+  if (classSupernova::$config->empire_mercenary_temporary != sys_get_param_int('empire_mercenary_temporary')) {
100
+    if (classSupernova::$config->empire_mercenary_temporary) {
101 101
       DBStaticUnit::db_unit_list_admin_delete_mercenaries_finished();
102 102
     } else {
103 103
       DBStaticUnit::db_unit_list_admin_set_mercenaries_expire_time(classSupernova::$config->empire_mercenary_base_period);
@@ -140,21 +140,21 @@  discard block
 block discarded – undo
140 140
 //  'STATS_SCHEDULE' => classSupernova::$config->stats_hide_player_list,
141 141
 ));
142 142
 
143
-foreach($lang['sys_game_disable_reason'] as $id => $name) {
143
+foreach ($lang['sys_game_disable_reason'] as $id => $name) {
144 144
   $template->assign_block_vars('sys_game_disable_reason', array(
145 145
     'ID'   => $id,
146 146
     'NAME' => $name,
147 147
   ));
148 148
 }
149 149
 
150
-foreach($lang['sys_game_mode'] as $mode_id => $mode_name) {
150
+foreach ($lang['sys_game_mode'] as $mode_id => $mode_name) {
151 151
   $template->assign_block_vars('game_modes', array(
152 152
     'ID'   => $mode_id,
153 153
     'NAME' => $mode_name,
154 154
   ));
155 155
 }
156 156
 
157
-foreach($lang['adm_opt_ver_response'] as $ver_id => $ver_response) {
157
+foreach ($lang['adm_opt_ver_response'] as $ver_id => $ver_response) {
158 158
   $template->assign_block_vars('ver_response', array(
159 159
     'ID'   => $ver_id,
160 160
     'NAME' => js_safe_string($ver_response),
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 }
163 163
 
164 164
 $lang_list = lng_get_list();
165
-foreach($lang_list as $lang_id => $lang_data) {
165
+foreach ($lang_list as $lang_id => $lang_data) {
166 166
   $template->assign_block_vars('game_languages', array(
167 167
     'ID'   => $lang_id,
168 168
     'NAME' => "{$lang_data['LANG_NAME_NATIVE']} ({$lang_data['LANG_NAME_ENGLISH']})",
Please login to merge, or discard this patch.
admin/paneladmina.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -8,13 +8,13 @@  discard block
 block discarded – undo
8 8
  * @copyright 2008 by ??????? for XNova
9 9
  */
10 10
 
11
-define('INSIDE'  , true);
12
-define('INSTALL' , false);
11
+define('INSIDE', true);
12
+define('INSTALL', false);
13 13
 define('IN_ADMIN', true);
14 14
 
15 15
 require('../common.' . substr(strrchr(__FILE__, '.'), 1));
16 16
 
17
-if($user['authlevel'] < 3)
17
+if ($user['authlevel'] < 3)
18 18
 {
19 19
   AdminMessage($lang['adm_err_denied']);
20 20
 }
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
 
35 35
 // Afficher les templates
36 36
 if (isset($GET_result)) {
37
-  switch ($GET_result){
37
+  switch ($GET_result) {
38 38
     case 'usr_search':
39
-      $SelUser = db_user_by_username('%'. $Pattern .'%', false, '*', true, true);
39
+      $SelUser = db_user_by_username('%' . $Pattern . '%', false, '*', true, true);
40 40
       $UsrMain = DBStaticPlanet::db_planet_by_id($SelUser['id_planet'], false, 'name');
41 41
 
42 42
       $bloc                   = $lang;
@@ -44,14 +44,14 @@  discard block
 block discarded – undo
44 44
       $bloc['answer2']        = $SelUser['username'];
45 45
       $bloc['answer3']        = $SelUser['user_lastip'];
46 46
       $bloc['answer4']        = $SelUser['email'];
47
-      $bloc['answer5']        = $lang['adm_usr_level'][ $SelUser['authlevel'] ];
48
-      $bloc['answer6']        = $lang['adm_usr_genre'][ $SelUser['gender'] ];
49
-      $bloc['answer7']        = "[".$SelUser['id_planet']."] ".$UsrMain['name'];
50
-      $bloc['answer8']        = "[".$SelUser['galaxy'].":".$SelUser['system'].":".$SelUser['planet']."] ";
47
+      $bloc['answer5']        = $lang['adm_usr_level'][$SelUser['authlevel']];
48
+      $bloc['answer6']        = $lang['adm_usr_genre'][$SelUser['gender']];
49
+      $bloc['answer7']        = "[" . $SelUser['id_planet'] . "] " . $UsrMain['name'];
50
+      $bloc['answer8']        = "[" . $SelUser['galaxy'] . ":" . $SelUser['system'] . ":" . $SelUser['planet'] . "] ";
51 51
       $bloc['qst_quest_complete'] = get_quest_amount_complete($SelUser['id']);
52 52
       $bloc['user_id'] = $SelUser['id'];
53 53
       $SubPanelTPL            = gettemplate('admin/admin_panel_asw1');
54
-      $parse['adm_sub_form2'] = parsetemplate( $SubPanelTPL, $bloc );
54
+      $parse['adm_sub_form2'] = parsetemplate($SubPanelTPL, $bloc);
55 55
       break;
56 56
 
57 57
     case 'usr_data':
@@ -109,10 +109,10 @@  discard block
 block discarded – undo
109 109
 
110 110
       $selected_user = db_user_by_username($Pattern, false, 'id');
111 111
       $QryUpdate = db_user_set_by_id($selected_user['id'], "`authlevel` = '{$NewLvl}'");
112
-      $Message    = $lang['adm_mess_lvl1']. " ". $Pattern ." ".$lang['adm_mess_lvl2'];
113
-      $Message   .= "<font color=\"red\">".$lang['adm_usr_level'][ $NewLvl ]."</font>!";
112
+      $Message    = $lang['adm_mess_lvl1'] . " " . $Pattern . " " . $lang['adm_mess_lvl2'];
113
+      $Message   .= "<font color=\"red\">" . $lang['adm_usr_level'][$NewLvl] . "</font>!";
114 114
 
115
-      AdminMessage ( $Message, $lang['adm_mod_level'] );
115
+      AdminMessage($Message, $lang['adm_mod_level']);
116 116
       break;
117 117
 
118 118
     case 'ip_search':
@@ -121,12 +121,12 @@  discard block
 block discarded – undo
121 121
       $bloc['adm_this_ip']    = $ip;
122 122
       $SelUser = db_user_list("`user_lastip` = '{$ip}'");
123 123
       //while ( $Usr = db_fetch($SelUser) ) {
124
-      foreach($SelUser as $Usr) {
124
+      foreach ($SelUser as $Usr) {
125 125
         $UsrMain = DBStaticPlanet::db_planet_by_id($Usr['id_planet'], false, 'name');
126
-        $bloc['adm_plyer_lst'] .= "<tr><th>".$Usr['username']."</th><th>[".$Usr['galaxy'].":".$Usr['system'].":".$Usr['planet']."] ".$UsrMain['name']."</th></tr>";
126
+        $bloc['adm_plyer_lst'] .= "<tr><th>" . $Usr['username'] . "</th><th>[" . $Usr['galaxy'] . ":" . $Usr['system'] . ":" . $Usr['planet'] . "] " . $UsrMain['name'] . "</th></tr>";
127 127
       }
128 128
       $SubPanelTPL            = gettemplate('admin/admin_panel_asw2');
129
-      $parse['adm_sub_form2'] = parsetemplate( $SubPanelTPL, $bloc );
129
+      $parse['adm_sub_form2'] = parsetemplate($SubPanelTPL, $bloc);
130 130
       break;
131 131
     default:
132 132
       break;
@@ -135,14 +135,14 @@  discard block
 block discarded – undo
135 135
 
136 136
 // Traiter les reponses aux formulaires
137 137
 if (isset($GET_action)) {
138
-  $bloc                   = $lang;
139
-  switch ($GET_action){
138
+  $bloc = $lang;
139
+  switch ($GET_action) {
140 140
     case 'usr_search':
141
-      $SubPanelTPL            = gettemplate('admin/admin_panel_frm1');
141
+      $SubPanelTPL = gettemplate('admin/admin_panel_frm1');
142 142
       break;
143 143
 
144 144
     case 'usr_data':
145
-      $SubPanelTPL            = gettemplate('admin/admin_panel_frm4');
145
+      $SubPanelTPL = gettemplate('admin/admin_panel_frm4');
146 146
       break;
147 147
 
148 148
     case 'usr_level':
@@ -155,21 +155,21 @@  discard block
 block discarded – undo
155 155
 
156 156
 
157 157
       for ($Lvl = 0; $Lvl < 4; $Lvl++) {
158
-        $bloc['adm_level_lst'] .= '<option value="'. $Lvl .'">'. $lang['adm_usr_level'][ $Lvl ] ."</option>";
158
+        $bloc['adm_level_lst'] .= '<option value="' . $Lvl . '">' . $lang['adm_usr_level'][$Lvl] . "</option>";
159 159
       }
160
-      $SubPanelTPL            = gettemplate('admin/admin_panel_frm3');
160
+      $SubPanelTPL = gettemplate('admin/admin_panel_frm3');
161 161
       break;
162 162
 
163 163
     case 'ip_search':
164
-      $SubPanelTPL            = gettemplate('admin/admin_panel_frm2');
164
+      $SubPanelTPL = gettemplate('admin/admin_panel_frm2');
165 165
       break;
166 166
 
167 167
     default:
168 168
       break;
169 169
   }
170
-  $parse['adm_sub_form2'] = parsetemplate( $SubPanelTPL, $bloc );
170
+  $parse['adm_sub_form2'] = parsetemplate($SubPanelTPL, $bloc);
171 171
 }
172 172
 
173
-$page = parsetemplate( $PanelMainTPL, $parse );
174
-display( $page, $lang['panel_mainttl'], false, '', true );
173
+$page = parsetemplate($PanelMainTPL, $parse);
174
+display($page, $lang['panel_mainttl'], false, '', true);
175 175
 ?>
Please login to merge, or discard this patch.
admin/ajax_maintenance.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 
5 5
 require('../includes/init.' . substr(strrchr(__FILE__, '.'), 1));
6 6
 
7
-if($user['authlevel'] < 3)
7
+if ($user['authlevel'] < 3)
8 8
 {
9 9
   message($lang['sys_noalloaw'], $lang['sys_noaccess']);
10 10
   die();
@@ -19,9 +19,9 @@  discard block
 block discarded – undo
19 19
 
20 20
 // [#] info_best_battles 1b0
21 21
 $best_reports = array();
22
-if(defined('MODULE_INFO_BEST_BATTLES_QUERY')) {
22
+if (defined('MODULE_INFO_BEST_BATTLES_QUERY')) {
23 23
   $query = doquery(MODULE_INFO_BEST_BATTLES_QUERY);
24
-  while($row = db_fetch($query)) {
24
+  while ($row = db_fetch($query)) {
25 25
     $best_reports[] = $row['ube_report_id'];
26 26
   }
27 27
 }
@@ -185,16 +185,16 @@  discard block
 block discarded – undo
185 185
 
186 186
 function sn_maintenance_pack_user_list($user_list) {
187 187
   $user_list = explode(',', $user_list);
188
-  foreach($user_list as $key => $user_id) {
189
-    if(!ceil(floatval($user_id))) {
188
+  foreach ($user_list as $key => $user_id) {
189
+    if (!ceil(floatval($user_id))) {
190 190
       unset($user_list[$key]);
191 191
     }
192 192
   }
193 193
 
194 194
   $result = array();
195
-  if(!empty($user_list)) {
195
+  if (!empty($user_list)) {
196 196
     $query = doquery("SELECT `id` FROM {{users}} WHERE `id` in (" . implode(',', $user_list) . ")");
197
-    while($row = db_fetch($query)) {
197
+    while ($row = db_fetch($query)) {
198 198
       $result[] = $row['id'];
199 199
     }
200 200
   }
@@ -209,11 +209,11 @@  discard block
 block discarded – undo
209 209
 $old_server_status == GAME_DISABLE_NONE ? classSupernova::$config->db_saveItem('game_disable', GAME_DISABLE_MAINTENANCE) : false;
210 210
 sn_db_transaction_commit();
211 211
 
212
-foreach($ques as $que_transaction) {
212
+foreach ($ques as $que_transaction) {
213 213
   sn_db_transaction_start();
214 214
 
215 215
   !is_array($que_transaction) ? $que_transaction = array($que_transaction) : false;
216
-  foreach($que_transaction as $que) {
216
+  foreach ($que_transaction as $que) {
217 217
     set_time_limit(120);
218 218
     $QryResult = doquery($que);
219 219
     //$msg .= '<hr>' . $que . '<hr>';
Please login to merge, or discard this patch.