Completed
Push — work-fleets ( a1656f...ab0e6c )
by SuperNova.WS
09:07 queued 03:10
created
galaxy.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 $uni_system = sys_get_param_int('system', $planetrow['system']);
22 22
 $planet = sys_get_param_int('planet', $planetrow['planet']);
23 23
 
24
-if($mode == 'name') {
24
+if ($mode == 'name') {
25 25
   require_once('includes/includes/uni_rename.php');
26 26
 }
27 27
 
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 
43 43
 $flying_fleet_count = FleetList::fleet_count_flying($user['id']);
44 44
 
45
-if($mode == 1) {
46
-} elseif($mode == 2 || $mode == 3) {
45
+if ($mode == 1) {
46
+} elseif ($mode == 2 || $mode == 3) {
47 47
   $planet = $planetrow['planet'];
48 48
 } else {
49 49
   $uni_galaxy = $planetrow['galaxy'];
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
   $planet = $planetrow['planet'];
52 52
 }
53 53
 
54
-$uni_galaxy = $uni_galaxy < 1 ? 1 : ($uni_galaxy > Vector::$knownGalaxies? Vector::$knownGalaxies: $uni_galaxy);
54
+$uni_galaxy = $uni_galaxy < 1 ? 1 : ($uni_galaxy > Vector::$knownGalaxies ? Vector::$knownGalaxies : $uni_galaxy);
55 55
 $uni_system = $uni_system < 1 ? 1 : ($uni_system > Vector::$knownSystems ? Vector::$knownSystems : $uni_system);
56 56
 $planet = $planet < 1 ? 1 : ($planet > Vector::$knownPlanets + 1 ? Vector::$knownPlanets + 1 : $planet);
57 57
 
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
 $PhalanxRange = GetPhalanxRange($HavePhalanx);
70 70
 
71 71
 $planet_precache_query = DBStaticPlanet::db_planet_list_in_system($uni_galaxy, $uni_system);
72
-if(!empty($planet_precache_query)) {
73
-  foreach($planet_precache_query as $planet_row) {
72
+if (!empty($planet_precache_query)) {
73
+  foreach ($planet_precache_query as $planet_row) {
74 74
     $planet_list[$planet_row['planet']][$planet_row['planet_type']] = $planet_row;
75 75
   }
76 76
 }
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
  * @var Fleet[][][] $fleet_list
89 89
  */
90 90
 $fleet_list = array();
91
-foreach($system_fleet_list->_container as $objFleetSystem) {
92
-  if(!$objFleetSystem->isReturning()) {
91
+foreach ($system_fleet_list->_container as $objFleetSystem) {
92
+  if (!$objFleetSystem->isReturning()) {
93 93
     $fleet_planet = $objFleetSystem->fleet_end_planet;
94 94
     $fleet_type = $objFleetSystem->fleet_end_type;
95 95
   } else {
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 $recycler_info = array();
105 105
 $planet_recyclers_orbiting = 0;
106 106
 $recyclers_fleet = array();
107
-foreach(classSupernova::$gc->groupRecyclers as $recycler_id) {
107
+foreach (classSupernova::$gc->groupRecyclers as $recycler_id) {
108 108
   $recycler_info[$recycler_id] = get_ship_data($recycler_id, $user);
109 109
   $recyclers_fleet[$recycler_id] = mrc_get_level($user, $planetrow, $recycler_id);
110 110
   $planet_recyclers_orbiting += $recyclers_fleet[$recycler_id];
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 $fleet_id = 1;
115 115
 $fleets = array();
116 116
 $config_game_max_planet = Vector::$knownPlanets + 1;
117
-for($Planet = 1; $Planet < $config_game_max_planet; $Planet++) {
117
+for ($Planet = 1; $Planet < $config_game_max_planet; $Planet++) {
118 118
   unset($uni_galaxyRowPlanet);
119 119
   unset($uni_galaxyRowMoon);
120 120
   unset($uni_galaxyRowUser);
@@ -124,17 +124,17 @@  discard block
 block discarded – undo
124 124
   $uni_galaxyRowPlanet = $planet_list[$Planet][PT_PLANET];
125 125
 
126 126
   $planet_fleet_id = 0;
127
-  if($uni_galaxyRowPlanet['destruyed']) {
127
+  if ($uni_galaxyRowPlanet['destruyed']) {
128 128
     CheckAbandonPlanetState($uni_galaxyRowPlanet);
129
-  } elseif($uni_galaxyRowPlanet['id']) {
130
-    if($cached['users'][$uni_galaxyRowPlanet['id_owner']]) {
129
+  } elseif ($uni_galaxyRowPlanet['id']) {
130
+    if ($cached['users'][$uni_galaxyRowPlanet['id_owner']]) {
131 131
       $uni_galaxyRowUser = $cached['users'][$uni_galaxyRowPlanet['id_owner']];
132 132
     } else {
133 133
       $uni_galaxyRowUser = DBStaticUser::db_user_by_id($uni_galaxyRowPlanet['id_owner']);
134 134
       $cached['users'][$uni_galaxyRowUser['id']] = $uni_galaxyRowUser;
135 135
     }
136 136
 
137
-    if(!$uni_galaxyRowUser['id']) {
137
+    if (!$uni_galaxyRowUser['id']) {
138 138
       classSupernova::$debug->warning("Planet '{$uni_galaxyRowPlanet['name']}' [{$uni_galaxy}:{$uni_system}:{$Planet}] has no owner!", 'Userless planet', 503);
139 139
       $uni_galaxyRowPlanet['destruyed'] = SN_TIME_NOW + 60 * 60 * 24;
140 140
       $uni_galaxyRowPlanet['id_owner'] = 0;
@@ -147,10 +147,10 @@  discard block
 block discarded – undo
147 147
       );
148 148
     }
149 149
 
150
-    if($uni_galaxyRowUser['id']) {
150
+    if ($uni_galaxyRowUser['id']) {
151 151
       $planetcount++;
152
-      if($uni_galaxyRowUser['ally_id']) {
153
-        if($cached['allies'][$uni_galaxyRowUser['ally_id']]) {
152
+      if ($uni_galaxyRowUser['ally_id']) {
153
+        if ($cached['allies'][$uni_galaxyRowUser['ally_id']]) {
154 154
           $allyquery = $cached['allies'][$uni_galaxyRowUser['ally_id']];
155 155
         } else {
156 156
           $allyquery = DBStaticAlly::db_ally_get_by_id($uni_galaxyRowUser['ally_id']);
@@ -159,19 +159,19 @@  discard block
 block discarded – undo
159 159
       }
160 160
 
161 161
       $fleets_to_planet = flt_get_fleets_to_planet_by_array_of_Fleet($fleet_list[$Planet][PT_PLANET]);
162
-      if(!empty($fleets_to_planet['own']['count'])) {
162
+      if (!empty($fleets_to_planet['own']['count'])) {
163 163
         $planet_fleet_id = $fleet_id;
164 164
         $fleets[] = tpl_parse_fleet_sn($fleets_to_planet['own']['total'], $fleet_id);
165 165
         $fleet_id++;
166 166
       }
167 167
 
168 168
       $uni_galaxyRowMoon = $planet_list[$Planet][PT_MOON];
169
-      if($uni_galaxyRowMoon['destruyed']) {
169
+      if ($uni_galaxyRowMoon['destruyed']) {
170 170
         CheckAbandonPlanetState($uni_galaxyRowMoon);
171 171
       } else {
172 172
         $moon_fleet_id = 0;
173 173
         $fleets_to_planet = flt_get_fleets_to_planet_by_array_of_Fleet($fleet_list[$Planet][PT_MOON]);
174
-        if(!empty($fleets_to_planet['own']['count'])) {
174
+        if (!empty($fleets_to_planet['own']['count'])) {
175 175
           $moon_fleet_id = $fleet_id;
176 176
           $fleets[] = tpl_parse_fleet_sn($fleets_to_planet['own']['total'], $fleet_id);
177 177
           $fleet_id++;
@@ -182,10 +182,10 @@  discard block
 block discarded – undo
182 182
 
183 183
   $recyclers_incoming_capacity = 0;
184 184
   $uni_galaxyRowPlanet['debris'] = $uni_galaxyRowPlanet['debris_metal'] + $uni_galaxyRowPlanet['debris_crystal'];
185
-  if($uni_galaxyRowPlanet['debris']) {
186
-    if(!empty($fleet_list[$Planet][PT_DEBRIS])) {
187
-      foreach($fleet_list[$Planet][PT_DEBRIS] as $objFleetToDebris) {
188
-        if($objFleetToDebris->playerOwnerId == $user['id']) {
185
+  if ($uni_galaxyRowPlanet['debris']) {
186
+    if (!empty($fleet_list[$Planet][PT_DEBRIS])) {
187
+      foreach ($fleet_list[$Planet][PT_DEBRIS] as $objFleetToDebris) {
188
+        if ($objFleetToDebris->playerOwnerId == $user['id']) {
189 189
           $recyclers_incoming_capacity += $objFleetToDebris->shipsGetCapacityRecyclers($recycler_info);
190 190
         }
191 191
       }
@@ -262,21 +262,21 @@  discard block
 block discarded – undo
262 262
 
263 263
 tpl_assign_fleet($template, $fleets);
264 264
 
265
-foreach(sn_get_groups('defense_active') as $unit_id) {
265
+foreach (sn_get_groups('defense_active') as $unit_id) {
266 266
   $template->assign_block_vars('defense_active', array(
267 267
     'ID'   => $unit_id,
268 268
     'NAME' => classLocale::$lang['tech'][$unit_id],
269 269
   ));
270 270
 }
271 271
 
272
-foreach($cached['users'] as $PlanetUser) {
273
-  if(!$PlanetUser) {
272
+foreach ($cached['users'] as $PlanetUser) {
273
+  if (!$PlanetUser) {
274 274
     continue;
275 275
   }
276 276
 
277 277
   $user_ally = $cached['allies'][$PlanetUser['ally_id']];
278
-  if(isset($user_ally)) {
279
-    if($PlanetUser['id'] == $user_ally['ally_owner']) {
278
+  if (isset($user_ally)) {
279
+    if ($PlanetUser['id'] == $user_ally['ally_owner']) {
280 280
       $user_rank_title = $user_ally['ally_owner_range'];
281 281
     } else {
282 282
       $ally_ranks = explode(';', $user_ally['ranklist']);
@@ -299,8 +299,8 @@  discard block
 block discarded – undo
299 299
   ));
300 300
 }
301 301
 
302
-foreach($cached['allies'] as $PlanetAlly) {
303
-  if($PlanetAlly) {
302
+foreach ($cached['allies'] as $PlanetAlly) {
303
+  if ($PlanetAlly) {
304 304
     $template->assign_block_vars('alliances', array(
305 305
       'ID'      => $PlanetAlly['id'],
306 306
       'NAME_JS' => js_safe_string($PlanetAlly['ally_name']),
Please login to merge, or discard this patch.
announce.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -28,40 +28,40 @@  discard block
 block discarded – undo
28 28
 $mode = sys_get_param_str('mode');
29 29
 
30 30
 $announce = array();
31
-if($user['authlevel'] >= 3) {
32
-  if(!empty($text)) {
31
+if ($user['authlevel'] >= 3) {
32
+  if (!empty($text)) {
33 33
     $announce_time = strtotime($announce_time, SN_TIME_NOW);
34 34
     $announce_time = $announce_time ? $announce_time : SN_TIME_NOW;
35 35
 
36
-    if($mode == 'edit') {
36
+    if ($mode == 'edit') {
37 37
       DBStaticNews::db_news_update_set($announce_time, $text_unsafe, $detail_url_unsafe, $announce_id);
38 38
       DBStaticSurvey::db_survey_delete_by_id($announce_id);
39 39
     } else {
40 40
       DBStaticNews::db_news_insert_set($announce_time, $text_unsafe, $detail_url_unsafe, $user['id'], $user['username']);
41 41
       $announce_id = classSupernova::$db->db_insert_id();
42 42
     }
43
-    if(($survey_question = sys_get_param_str('survey_question')) && ($survey_answers = sys_get_param('survey_answers'))) {
43
+    if (($survey_question = sys_get_param_str('survey_question')) && ($survey_answers = sys_get_param('survey_answers'))) {
44 44
       $survey_answers = explode("\r\n", $survey_answers);
45 45
       $survey_until = strtotime($survey_until = sys_get_param_str('survey_until'), SN_TIME_NOW);
46 46
       $survey_until = date(FMT_DATE_TIME_SQL, $survey_until ? $survey_until : SN_TIME_NOW + PERIOD_DAY * 1);
47 47
       $survey_question_unsafe = sys_get_param_str_unsafe('survey_question');
48 48
       DBStaticSurvey::db_survey_insert($announce_id, $survey_question_unsafe, $survey_until);
49 49
       $survey_id = classSupernova::$db->db_insert_id();
50
-      foreach($survey_answers as $survey_answer) {
50
+      foreach ($survey_answers as $survey_answer) {
51 51
         $survey_answer_unsafe = trim($survey_answer);
52
-        if(empty($survey_answer_unsafe)) {
52
+        if (empty($survey_answer_unsafe)) {
53 53
           continue;
54 54
         }
55 55
         DBStaticSurveyAnswer::db_survey_answer_insert($survey_id, $survey_answer_unsafe);
56 56
       }
57 57
     }
58 58
 
59
-    if($announce_time <= SN_TIME_NOW) {
60
-      if($announce_time > classSupernova::$config->var_news_last && $announce_time == SN_TIME_NOW) {
59
+    if ($announce_time <= SN_TIME_NOW) {
60
+      if ($announce_time > classSupernova::$config->var_news_last && $announce_time == SN_TIME_NOW) {
61 61
         classSupernova::$config->db_saveItem('var_news_last', $announce_time);
62 62
       }
63 63
 
64
-      if(sys_get_param_int('news_mass_mail')) {
64
+      if (sys_get_param_int('news_mass_mail')) {
65 65
         $lang_news_more = classLocale::$lang['news_more'];
66 66
         $text = sys_get_param('text') . ($detail_url ? " <a href=\"{$detail_url}\"><span class=\"positive\">{$lang_news_more}</span></a>" : '');
67 67
         DBStaticMessages::msgSendFromAdmin('*', classLocale::$lang['news_title'], $text);
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
   }
74 74
 
75 75
   $survey_answers = '';
76
-  switch($mode) {
76
+  switch ($mode) {
77 77
     case 'del':
78 78
       DBStaticNews::db_news_delete_by_id($announce_id);
79 79
       $mode = '';
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
       $template->assign_var('ID', $announce_id);
85 85
     case 'copy':
86 86
       $announce = DBStaticNews::db_news_with_survey_select_by_id($announce_id);
87
-      if($announce['survey_id']) {
87
+      if ($announce['survey_id']) {
88 88
         $query = DBStaticSurveyAnswer::db_survey_answer_text_select_by_news($announce);
89
-        while($row = db_fetch($query)) {
89
+        while ($row = db_fetch($query)) {
90 90
           $survey_answers[] = $row['survey_answer_text'];
91 91
         }
92 92
         $survey_answers = implode("\r\n", $survey_answers);
Please login to merge, or discard this patch.
notes.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -19,17 +19,17 @@  discard block
 block discarded – undo
19 19
 $template = gettemplate('notes', true);
20 20
 
21 21
 $result = array();
22
-if(($result_message = sys_get_param_str('MESSAGE')) && isset(classLocale::$lang[$result_message])) {
22
+if (($result_message = sys_get_param_str('MESSAGE')) && isset(classLocale::$lang[$result_message])) {
23 23
   $result[] = array('STATUS' => sys_get_param_int('STATUS'), 'MESSAGE' => classLocale::$lang[$result_message]);
24 24
 }
25 25
 
26 26
 $note_id_edit = sys_get_param_id('note_id_edit');
27 27
 $note_title_unsafe = sys_get_param_str_unsafe('note_title');
28 28
 $note_text_unsafe = sys_get_param_str_unsafe('note_text');
29
-if(sys_get_param('note_delete')) {
29
+if (sys_get_param('note_delete')) {
30 30
   try {
31 31
     DBStaticNote::processDelete($user, $note_id_edit);
32
-  } catch(Exception $e) {
32
+  } catch (Exception $e) {
33 33
     $note_id_edit = 0;
34 34
     sn_db_transaction_rollback();
35 35
     $result[] = array(
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
       'MESSAGE' => classLocale::$lang[$e->getMessage()],
38 38
     );
39 39
   }
40
-} elseif(($note_title_unsafe = sys_get_param_str_unsafe('note_title')) || ($note_text_unsafe = sys_get_param_str('note_text'))) {
40
+} elseif (($note_title_unsafe = sys_get_param_str_unsafe('note_title')) || ($note_text_unsafe = sys_get_param_str('note_text'))) {
41 41
   $note_title_unsafe == classLocale::$lang['note_new_title'] ? $note_title_unsafe = '' : false;
42 42
   $note_text_unsafe == classLocale::$lang['note_new_text'] ? $note_text_unsafe = '' : false;
43 43
   try {
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
     $note_system = max(0, min(sys_get_param_id('note_system'), Vector::$knownSystems));
46 46
     $note_planet = max(0, min(sys_get_param_id('note_planet'), Vector::$knownPlanets + 1));
47 47
 
48
-    if(!$note_text_unsafe && !$note_title_unsafe && !$note_galaxy && !$note_system && !$note_planet) {
48
+    if (!$note_text_unsafe && !$note_title_unsafe && !$note_galaxy && !$note_system && !$note_planet) {
49 49
       throw new Exception('note_err_note_empty', ERR_WARNING);
50 50
     }
51 51
 
@@ -54,15 +54,15 @@  discard block
 block discarded – undo
54 54
     $note_sticky = intval(sys_get_param_id('note_sticky')) ? 1 : 0;
55 55
 
56 56
     sn_db_transaction_start();
57
-    if($note_id_edit) {
57
+    if ($note_id_edit) {
58 58
       $check_note_id = DBStaticNote::db_note_get_id_and_owner($note_id_edit);
59
-      if(!$check_note_id) {
59
+      if (!$check_note_id) {
60 60
         throw new Exception('note_err_note_not_found', ERR_ERROR);
61 61
       }
62 62
     }
63 63
 
64
-    if($note_id_edit) {
65
-      if($check_note_id['owner'] != $user['id']) {
64
+    if ($note_id_edit) {
65
+      if ($check_note_id['owner'] != $user['id']) {
66 66
         throw new Exception('note_err_owner_wrong', ERR_ERROR);
67 67
       }
68 68
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     sn_db_transaction_commit();
75 75
     sys_redirect('notes.php?STATUS=' . ERR_NONE . '&MESSAGE=' . ($note_id_edit ? 'note_err_none_changed' : 'note_err_none_added'));
76 76
 //    throw new exception($note_id_edit ? 'note_err_none_changed' : 'note_err_none_added', ERR_NONE);
77
-  } catch(Exception $e) {
77
+  } catch (Exception $e) {
78 78
     $note_id_edit = 0;
79 79
     sn_db_transaction_rollback();
80 80
     $result[] = array(
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
   }
85 85
 }
86 86
 
87
-if(!$note_id_edit) {
87
+if (!$note_id_edit) {
88 88
   note_assign($template, array(
89 89
     'id'          => 0,
90 90
     'time'        => SN_TIME_NOW,
@@ -97,13 +97,13 @@  discard block
 block discarded – undo
97 97
 
98 98
 $note_exist = false;
99 99
 $notes_query = DBStaticNote::db_note_list_by_owner($user['id']);
100
-while($note_row = db_fetch($notes_query)) {
100
+while ($note_row = db_fetch($notes_query)) {
101 101
   note_assign($template, $note_row);
102 102
   $note_exist = $note_exist || $note_row['id'] == $note_id_edit;
103 103
 }
104 104
 $note_id_edit = $note_exist ? $note_id_edit : 0;
105 105
 
106
-foreach($note_priority_classes as $note_priority_id => $note_priority_class) {
106
+foreach ($note_priority_classes as $note_priority_id => $note_priority_class) {
107 107
   $template->assign_block_vars('note_priority', array(
108 108
     'ID'    => $note_priority_id,
109 109
     'CLASS' => $note_priority_classes[$note_priority_id],
@@ -111,14 +111,14 @@  discard block
 block discarded – undo
111 111
   ));
112 112
 }
113 113
 
114
-foreach(classLocale::$lang['sys_planet_type'] as $planet_type_id => $planet_type_string) {
114
+foreach (classLocale::$lang['sys_planet_type'] as $planet_type_id => $planet_type_string) {
115 115
   $template->assign_block_vars('planet_type', array(
116 116
     'ID'   => $planet_type_id,
117 117
     'TEXT' => $planet_type_string,
118 118
   ));
119 119
 }
120 120
 
121
-foreach($result as $result_data) {
121
+foreach ($result as $result_data) {
122 122
   $template->assign_block_vars('result', $result_data);
123 123
 }
124 124
 
Please login to merge, or discard this patch.
admin/statbuilder.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -9,18 +9,18 @@
 block discarded – undo
9 9
  * @copyright 2008 by Chlorel for XNova
10 10
  */
11 11
 
12
-define('INSIDE'  , true);
13
-define('INSTALL' , false);
12
+define('INSIDE', true);
13
+define('INSTALL', false);
14 14
 define('IN_ADMIN', true);
15 15
 require_once('../common.' . substr(strrchr(__FILE__, '.'), 1));
16 16
 
17 17
 // if($user['authlevel'] < 1)
18
-if($user['authlevel'] < 3)
18
+if ($user['authlevel'] < 3)
19 19
 {
20 20
   AdminMessage(classLocale::$lang['adm_err_denied']);
21 21
 }
22 22
 
23
-if(SN_TIME_NOW >= classSupernova::$config->db_loadItem('var_stat_update_admin_forced') && SN_TIME_NOW >= classSupernova::$config->db_loadItem('var_stat_update_end'))
23
+if (SN_TIME_NOW >= classSupernova::$config->db_loadItem('var_stat_update_admin_forced') && SN_TIME_NOW >= classSupernova::$config->db_loadItem('var_stat_update_end'))
24 24
 {
25 25
   classSupernova::$config->db_saveItem('var_stat_update_admin_forced', SN_TIME_NOW + 120);
26 26
 
Please login to merge, or discard this patch.
admin/adm_message_list.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 require('../common.' . substr(strrchr(__FILE__, '.'), 1));
16 16
 
17
-if($user['authlevel'] < 3) {
17
+if ($user['authlevel'] < 3) {
18 18
   AdminMessage(classLocale::$lang['adm_err_denied']);
19 19
 }
20 20
 
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
   ),
29 29
 );
30 30
 $template->assign_block_vars('int_type_selected', $allowed_types[-1]);
31
-foreach(DBStaticMessages::$snMessageClassList as $key => $value) {
32
-  if($key == MSG_TYPE_NEW || $key == MSG_TYPE_OUTBOX) {
31
+foreach (DBStaticMessages::$snMessageClassList as $key => $value) {
32
+  if ($key == MSG_TYPE_NEW || $key == MSG_TYPE_OUTBOX) {
33 33
     continue;
34 34
   }
35 35
 
@@ -41,21 +41,21 @@  discard block
 block discarded – undo
41 41
 
42 42
 
43 43
 $deletedMessages = '';
44
-if($idMessageDelete = sys_get_param_id('msg_del')) {
44
+if ($idMessageDelete = sys_get_param_id('msg_del')) {
45 45
   DBStaticMessages::db_message_delete_by_id($idMessageDelete);
46 46
   $deletedMessages = $idMessageDelete;
47
-} elseif(sys_get_param('str_delete_selected') && is_array($message_delete = sys_get_param('selected')) && !empty($message_delete)) {
47
+} elseif (sys_get_param('str_delete_selected') && is_array($message_delete = sys_get_param('selected')) && !empty($message_delete)) {
48 48
   $message_delete = implode(', ', $message_delete);
49 49
   DBStaticMessages::db_message_list_delete_set($message_delete);
50 50
   $deletedMessages = $message_delete;
51 51
 }
52 52
 
53
-if($deletedMessages) {
53
+if ($deletedMessages) {
54 54
   $template->assign_block_vars('result', array('MESSAGE' => sprintf(classLocale::$lang['mlst_messages_deleted'], $deletedMessages)));
55 55
 }
56 56
 
57 57
 
58
-if(sys_get_param('str_delete_date') && checkdate($month = sys_get_param_id('delete_month'), $day = sys_get_param_id('delete_day'), $year = sys_get_param_id('delete_year'))) {
58
+if (sys_get_param('str_delete_date') && checkdate($month = sys_get_param_id('delete_month'), $day = sys_get_param_id('delete_day'), $year = sys_get_param_id('delete_year'))) {
59 59
   $delete_date = "{$year}-{$month}-{$day}";
60 60
   DBStaticMessages::db_message_list_delete_by_date($delete_date, $int_type_selected);
61 61
   $template->assign_block_vars('result', array('MESSAGE' => sprintf(classLocale::$lang['mlst_messages_deleted_date'], $allowed_types[$int_type_selected]['TEXT'], $delete_date)));
@@ -67,13 +67,13 @@  discard block
 block discarded – undo
67 67
 
68 68
 $int_page_current = min(sys_get_param_id('int_page_current', 1), $page_max);
69 69
 
70
-if(sys_get_param('page_prev') && $int_page_current > 1) {
70
+if (sys_get_param('page_prev') && $int_page_current > 1) {
71 71
   $int_page_current--;
72
-} elseif(sys_get_param('page_next') && $int_page_current < $page_max) {
72
+} elseif (sys_get_param('page_next') && $int_page_current < $page_max) {
73 73
   $int_page_current++;
74 74
 }
75 75
 
76
-for($i = 1; $i <= $page_max; $i++) {
76
+for ($i = 1; $i <= $page_max; $i++) {
77 77
   $template->assign_block_vars('page', array('NUMBER' => $i));
78 78
 }
79 79
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 $StartRec = ($int_page_current - 1) * 25;
82 82
 
83 83
 $Messages = DBStaticMessages::db_message_list_admin_by_type($int_type_selected, $StartRec);
84
-while($row = db_fetch($Messages)) {
84
+while ($row = db_fetch($Messages)) {
85 85
   $row['FROM'] = htmlentities($row['FROM'], ENT_COMPAT, 'UTF-8');
86 86
   $row['OWNER_NAME'] = htmlentities($row['OWNER_NAME'], ENT_COMPAT, 'UTF-8');
87 87
   $row['TEXT'] = nl2br($row['TEXT']);
Please login to merge, or discard this patch.
admin/userlist.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 require('../common.' . substr(strrchr(__FILE__, '.'), 1));
18 18
 
19 19
 global $user;
20
-if($user['authlevel'] < 3) {
20
+if ($user['authlevel'] < 3) {
21 21
   AdminMessage(classLocale::$lang['adm_err_denied']);
22 22
 }
23 23
 
@@ -41,10 +41,10 @@  discard block
 block discarded – undo
41 41
 $sort = sys_get_param_int('sort', SORT_ID);
42 42
 $sort = $sort_fields[$sort] ? $sort : SORT_ID;
43 43
 
44
-if(($action = sys_get_param_int('action')) && ($user_id = sys_get_param_id('uid'))) {
44
+if (($action = sys_get_param_int('action')) && ($user_id = sys_get_param_id('uid'))) {
45 45
   $user_selected = DBStaticUser::db_user_by_id($user_id, false, 'id, username, authlevel');
46
-  if($user_selected['authlevel'] < $user['authlevel'] && $user['authlevel'] >= 3) {
47
-    switch($action) {
46
+  if ($user_selected['authlevel'] < $user['authlevel'] && $user['authlevel'] >= 3) {
47
+    switch ($action) {
48 48
       case ACTION_DELETE:
49 49
         DeleteSelectedUser($user_id);
50 50
         sys_redirect("{$_SERVER['SCRIPT_NAME']}?sort={$sort}");
@@ -64,20 +64,20 @@  discard block
 block discarded – undo
64 64
 $template = gettemplate('admin/userlist', true);
65 65
 
66 66
 $multi_ip = array();
67
-foreach(DBStaticUser::db_user_list_admin_multiaccounts() as $ip) {
67
+foreach (DBStaticUser::db_user_list_admin_multiaccounts() as $ip) {
68 68
   $multi_ip[$ip['user_lastip']] = $ip['ip_count'];
69 69
 }
70 70
 
71 71
 $geoip = geoip_status();
72 72
 $count = 0;
73
-foreach(DBStaticUser::db_user_list_admin_sorted($sort_fields[$sort], $is_players_online_page) as $user_row ) {
73
+foreach (DBStaticUser::db_user_list_admin_sorted($sort_fields[$sort], $is_players_online_page) as $user_row) {
74 74
   $count++;
75
-  if($user_row['banaday']) {
75
+  if ($user_row['banaday']) {
76 76
     $ban_details = db_ban_list_get_details($user_row);
77 77
   }
78 78
 
79 79
   $geoip_info = $geoip ? geoip_ip_info(ip2longu($user_row['user_lastip'])) : array();
80
-  foreach($geoip_info as $key => $value) {
80
+  foreach ($geoip_info as $key => $value) {
81 81
     $geoip_info[strtoupper($key)] = $value;
82 82
     unset($geoip_info[$key]);
83 83
   }
Please login to merge, or discard this patch.
admin/admin_user.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -5,20 +5,20 @@  discard block
 block discarded – undo
5 5
 define('IN_ADMIN', true);
6 6
 require('../common.' . substr(strrchr(__FILE__, '.'), 1));
7 7
 
8
-if($user['authlevel'] < 3) {
8
+if ($user['authlevel'] < 3) {
9 9
   AdminMessage(classLocale::$lang['adm_err_denied']);
10 10
 }
11 11
 
12 12
 lng_include('admin');
13 13
 
14 14
 $user_id = sys_get_param_id('uid');
15
-if(!($user_row = DBStaticUser::db_user_by_id($user_id))) {
15
+if (!($user_row = DBStaticUser::db_user_by_id($user_id))) {
16 16
   AdminMessage(sprintf(classLocale::$lang['adm_dm_user_none'], $user_id));
17 17
 }
18 18
 
19 19
 $template = gettemplate('admin/admin_user', true);
20 20
 
21
-if(!empty($user_row['user_last_browser_id'])) {
21
+if (!empty($user_row['user_last_browser_id'])) {
22 22
   $user_row['browser_user_agent'] = db_browser_agent_get_by_id($user_row['user_last_browser_id']);
23 23
 }
24 24
 
@@ -54,10 +54,10 @@  discard block
 block discarded – undo
54 54
     'raidsloose',
55 55
     'raidswin',
56 56
     'total_rank',
57
-    'total_points',  ),
57
+    'total_points',),
58 58
 );
59
-foreach($formats as $callable => $field_list) {
60
-  foreach($field_list as $field_name) {
59
+foreach ($formats as $callable => $field_list) {
60
+  foreach ($field_list as $field_name) {
61 61
     $user_row[$field_name] = call_user_func($callable, $user_row[$field_name]);
62 62
   }
63 63
 }
Please login to merge, or discard this patch.
admin/ajax_maintenance.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 
7 7
 require('../includes/init.' . substr(strrchr(__FILE__, '.'), 1));
8 8
 
9
-if($user['authlevel'] < 3)
9
+if ($user['authlevel'] < 3)
10 10
 {
11 11
   message(classLocale::$lang['sys_noalloaw'], classLocale::$lang['sys_noaccess']);
12 12
   die();
@@ -22,9 +22,9 @@  discard block
 block discarded – undo
22 22
 // [#] info_best_battles 1b0
23 23
 $best_reports = array();
24 24
 
25
-if(defined('MODULE_INFO_BEST_BATTLES_QUERY')) {
25
+if (defined('MODULE_INFO_BEST_BATTLES_QUERY')) {
26 26
   $query = db_ube_report_get_best_battles();
27
-  while($row = db_fetch($query)) {
27
+  while ($row = db_fetch($query)) {
28 28
     $best_reports[] = $row['ube_report_id'];
29 29
   }
30 30
 }
@@ -191,13 +191,13 @@  discard block
 block discarded – undo
191 191
 $old_server_status == GAME_DISABLE_NONE ? classSupernova::$config->db_saveItem('game_disable', GAME_DISABLE_MAINTENANCE) : false;
192 192
 sn_db_transaction_commit();
193 193
 
194
-foreach($ques as $que_transaction) {
194
+foreach ($ques as $que_transaction) {
195 195
   sn_db_transaction_start();
196 196
 
197 197
   !is_array($que_transaction) ? $que_transaction = array($que_transaction) : false;
198
-  foreach($que_transaction as $que) {
198
+  foreach ($que_transaction as $que) {
199 199
     set_time_limit(120);
200
-    if(is_callable($que)) {
200
+    if (is_callable($que)) {
201 201
       $QryResult = call_user_func($que);
202 202
     } else {
203 203
       $QryResult = classSupernova::$db->doSql($que);
Please login to merge, or discard this patch.
classes/classLocale.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -35,13 +35,13 @@  discard block
 block discarded – undo
35 35
 
36 36
     $this->container = array();
37 37
 
38
-    if(classSupernova::$cache->getMode() != CACHER_NO_CACHE && !classSupernova::$config->locale_cache_disable) {
38
+    if (classSupernova::$cache->getMode() != CACHER_NO_CACHE && !classSupernova::$config->locale_cache_disable) {
39 39
       $this->cache = classSupernova::$cache;
40 40
       classSupernova::log_file('locale.__constructor: Cache is present');
41 41
 //$this->cache->unset_by_prefix($this->cache_prefix); // TODO - remove? 'cause debug!
42 42
     }
43 43
 
44
-    if($enable_stat_usage && empty($this->stat_usage)) {
44
+    if ($enable_stat_usage && empty($this->stat_usage)) {
45 45
       $this->enable_stat_usage = $enable_stat_usage;
46 46
       $this->usage_stat_load();
47 47
       // TODO shutdown function
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
     unset($fallback[$this->active]);
68 68
 
69 69
     // Проходим по оставшимся локалям
70
-    foreach($fallback as $try_language) {
70
+    foreach ($fallback as $try_language) {
71 71
       // Если нет такой строки - пытаемся вытащить из кэша
72
-      if(!isset($this->container[$try_language][$offset]) && $this->cache) {
72
+      if (!isset($this->container[$try_language][$offset]) && $this->cache) {
73 73
         $this->container[$try_language][$offset] = $this->cache->__get($this->cache_prefix . $try_language . '_' . $offset);
74 74
 // Записываем результат работы кэша
75 75
 $locale_cache_statistic['queries']++;
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
       }
79 79
 
80 80
       // Если мы как-то где-то нашли строку...
81
-      if(isset($this->container[$try_language][$offset])) {
81
+      if (isset($this->container[$try_language][$offset])) {
82 82
         // ...значит она получена в результате фоллбэка и записываем её в кэш и контейнер
83 83
         $this[$offset] = $this->container[$try_language][$offset];
84 84
         $locale_cache_statistic['fallbacks']++;
@@ -94,16 +94,16 @@  discard block
 block discarded – undo
94 94
       $this->container[$this->active][] = $value;
95 95
     } else {
96 96
       $this->container[$this->active][$offset] = $value;
97
-      if($this->cache) {
97
+      if ($this->cache) {
98 98
         $this->cache->__set($this->cache_prefix_lang . $offset, $value);
99 99
       }
100 100
     }
101 101
   }
102 102
   public function offsetExists($offset) {
103 103
     // Шорткат если у нас уже есть строка в памяти PHP
104
-    if(!isset($this->container[$this->active][$offset])) {
104
+    if (!isset($this->container[$this->active][$offset])) {
105 105
 //        pdump($this->cache_prefix_lang . $offset);
106
-      if(!$this->cache || !($this->container[$this->active][$offset] = $this->cache->__get($this->cache_prefix_lang . $offset))) {
106
+      if (!$this->cache || !($this->container[$this->active][$offset] = $this->cache->__get($this->cache_prefix_lang . $offset))) {
107 107
 //        pdump($this->cache_prefix_lang . $offset);
108 108
         // Если нету такой строки - делаем фоллбэк
109 109
         $this->locale_string_fallback($offset);
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
   }
120 120
   public function offsetGet($offset) {
121 121
     $value = $this->offsetExists($offset) ? $this->container[$this->active][$offset] : null;
122
-    if($this->enable_stat_usage) {
122
+    if ($this->enable_stat_usage) {
123 123
       $this->usage_stat_log($offset, $value);
124 124
     }
125 125
     return $value;
@@ -134,16 +134,16 @@  discard block
 block discarded – undo
134 134
 
135 135
 
136 136
   public function usage_stat_load() {
137
-    $this->stat_usage = classSupernova::$cache->lng_stat_usage  = array();
138
-    if(empty($this->stat_usage)) {
137
+    $this->stat_usage = classSupernova::$cache->lng_stat_usage = array();
138
+    if (empty($this->stat_usage)) {
139 139
       $query = classSupernova::$db->doSelect("SELECT * FROM `{{lng_usage_stat}}`");
140
-      while($row = db_fetch($query)) {
140
+      while ($row = db_fetch($query)) {
141 141
         $this->stat_usage[$row['lang_code'] . ':' . $row['string_id'] . ':' . $row['file'] . ':' . $row['line']] = $row['is_empty'];
142 142
       }
143 143
     }
144 144
   }
145 145
   public function usage_stat_save() {
146
-    if(!empty($this->stat_usage_new)) {
146
+    if (!empty($this->stat_usage_new)) {
147 147
       classSupernova::$cache->lng_stat_usage = $this->stat_usage;
148 148
       classSupernova::$db->doSelect("SELECT 1 FROM `{{lng_usage_stat}}` LIMIT 1");
149 149
 //      foreach($this->stat_usage_new as &$value) {
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
     $file = str_replace('\\', '/', substr($trace[1]['file'], strlen(SN_ROOT_PHYSICAL) - 1));
173 173
 
174 174
     $string_id = $this->active . ':' . $offset . ':' . $file . ':' . $trace[1]['line'];
175
-    if(!isset($this->stat_usage[$string_id]) || $this->stat_usage[$string_id] != empty($value)) {
175
+    if (!isset($this->stat_usage[$string_id]) || $this->stat_usage[$string_id] != empty($value)) {
176 176
       $this->stat_usage[$string_id] = empty($value);
177 177
       $this->stat_usage_new[] = array(
178 178
         'lang_code' => $this->active,
@@ -212,11 +212,11 @@  discard block
 block discarded – undo
212 212
     $cache_file_key = $this->cache_prefix_lang . '__' . $filename;
213 213
 
214 214
     // Подключен ли внешний кэш?
215
-    if($this->cache) {
215
+    if ($this->cache) {
216 216
       // Загружен ли уже данный файл?
217 217
       $cache_file_status = $this->cache->__get($cache_file_key);
218 218
       classSupernova::log_file("locale.include: Cache - '{$filename}' has key '{$cache_file_key}' and is " . ($cache_file_status ? 'already loaded - EXIT' : 'EMPTY'), $cache_file_status ? -1 : 0);
219
-      if($cache_file_status) {
219
+      if ($cache_file_status) {
220 220
         // Если да - повторять загрузку нет смысла
221 221
         return null;
222 222
       }
@@ -230,36 +230,36 @@  discard block
 block discarded – undo
230 230
     $this->make_fallback($language);
231 231
 
232 232
     $file_path = '';
233
-    foreach($this->fallback as $lang_try) {
234
-      if(!$lang_try /* || isset($language_tried[$lang_try]) */) {
233
+    foreach ($this->fallback as $lang_try) {
234
+      if (!$lang_try /* || isset($language_tried[$lang_try]) */) {
235 235
         continue;
236 236
       }
237 237
 
238
-      if($file_path = $this->lng_try_filepath($path, "language/{$lang_try}/{$filename_ext}")) {
238
+      if ($file_path = $this->lng_try_filepath($path, "language/{$lang_try}/{$filename_ext}")) {
239 239
         break;
240 240
       }
241 241
 
242
-      if($file_path = $this->lng_try_filepath($path, "language/{$filename}_{$lang_try}{$ext}")) {
242
+      if ($file_path = $this->lng_try_filepath($path, "language/{$filename}_{$lang_try}{$ext}")) {
243 243
         break;
244 244
       }
245 245
 
246 246
       $file_path = '';
247 247
     }
248 248
 
249
-    if($file_path) {
249
+    if ($file_path) {
250 250
       $a_lang_array = array();
251 251
       include($file_path);
252 252
 
253
-      if(!empty($a_lang_array)) {
253
+      if (!empty($a_lang_array)) {
254 254
         $this->merge($a_lang_array);
255 255
 
256 256
         // Загрузка данных из файла в кэш
257
-        if($this->cache) {
257
+        if ($this->cache) {
258 258
           classSupernova::log_file("Locale: loading '{$filename}' into cache");
259
-          foreach($a_lang_array as $key => $value) {
259
+          foreach ($a_lang_array as $key => $value) {
260 260
             $value_cache_key = $this->cache_prefix_lang . $key;
261
-            if($this->cache->__isset($value_cache_key)) {
262
-              if(is_array($value)) {
261
+            if ($this->cache->__isset($value_cache_key)) {
262
+              if (is_array($value)) {
263 263
                 $alt_value = $this->cache->__get($value_cache_key);
264 264
                 $value = array_replace_recursive($alt_value, $value);
265 265
                 // pdump($alt_value, $alt_value);
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
         }
271 271
       }
272 272
 
273
-      if($this->cache) {
273
+      if ($this->cache) {
274 274
         $this->cache->__set($cache_file_key, true);
275 275
       }
276 276
 
@@ -283,14 +283,14 @@  discard block
 block discarded – undo
283 283
   }
284 284
 
285 285
   public function lng_load_i18n($i18n) {
286
-    if(!isset($i18n)) {
286
+    if (!isset($i18n)) {
287 287
       return;
288 288
     }
289 289
 
290
-    foreach($i18n as $i18n_data) {
291
-      if(is_string($i18n_data)) {
290
+    foreach ($i18n as $i18n_data) {
291
+      if (is_string($i18n_data)) {
292 292
         $this->lng_include($i18n_data);
293
-      } elseif(is_array($i18n_data)) {
293
+      } elseif (is_array($i18n_data)) {
294 294
         $this->lng_include($i18n_data['file'], $i18n_data['path']);
295 295
       }
296 296
     }
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 
309 309
     classSupernova::log_file("locale.switch: Trying to switch language to '{$language_new}'");
310 310
 
311
-    if($language_new == $this->active) {
311
+    if ($language_new == $this->active) {
312 312
       classSupernova::log_file("locale.switch: New language '{$language_new}' is equal to current language '{$this->active}' - EXIT", -1);
313 313
       return false;
314 314
     }
@@ -319,10 +319,10 @@  discard block
 block discarded – undo
319 319
     $this['LANG_INFO'] = $this->lng_get_info($this->active);
320 320
     $this->make_fallback($this->active);
321 321
 
322
-    if($this->cache) {
322
+    if ($this->cache) {
323 323
       $cache_lang_init_status = $this->cache->__get($this->cache_prefix_lang . '__INIT');
324 324
       classSupernova::log_file("locale.switch: Cache for '{$this->active}' prefixed '{$this->cache_prefix_lang}' is " . ($cache_lang_init_status ? 'already loaded. Doing nothing - EXIT' : 'EMPTY'), $cache_lang_init_status ? -1 : 0);
325
-      if($cache_lang_init_status) {
325
+      if ($cache_lang_init_status) {
326 326
         return false;
327 327
       }
328 328
 
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
     // Loading global language files
339 339
     $this->lng_load_i18n(classSupernova::$sn_mvc['i18n']['']);
340 340
 
341
-    if($this->cache) {
341
+    if ($this->cache) {
342 342
       classSupernova::log_file("locale.switch: Cache - setting flag " . $this->cache_prefix_lang . '__INIT');
343 343
       $this->cache->__set($this->cache_prefix_lang . '__INIT', true);
344 344
     }
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
   public function lng_get_info($entry) {
353 353
     $file_name = SN_ROOT_PHYSICAL . 'language/' . $entry . '/language.mo.php';
354 354
     $lang_info = array();
355
-    if(file_exists($file_name)) {
355
+    if (file_exists($file_name)) {
356 356
       include($file_name);
357 357
     }
358 358
 
@@ -360,15 +360,15 @@  discard block
 block discarded – undo
360 360
   }
361 361
 
362 362
   public function lng_get_list() {
363
-    if(empty($this->lang_list)) {
363
+    if (empty($this->lang_list)) {
364 364
       $this->lang_list = array();
365 365
 
366 366
       $path = SN_ROOT_PHYSICAL . 'language/';
367 367
       $dir = dir($path);
368
-      while(false !== ($entry = $dir->read())) {
369
-        if(is_dir($path . $entry) && $entry[0] != '.') {
368
+      while (false !== ($entry = $dir->read())) {
369
+        if (is_dir($path . $entry) && $entry[0] != '.') {
370 370
           $lang_info = $this->lng_get_info($entry);
371
-          if($lang_info['LANG_NAME_ISO2'] == $entry) {
371
+          if ($lang_info['LANG_NAME_ISO2'] == $entry) {
372 372
             $this->lang_list[$lang_info['LANG_NAME_ISO2']] = $lang_info;
373 373
           }
374 374
         }
Please login to merge, or discard this patch.