Completed
Push — work-fleets ( 74a0d7...680ce4 )
by SuperNova.WS
05:04
created
admin/adm_message_list.php 1 patch
Spacing   +10 added lines, -10 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($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($sn_message_class_list as $key => $value) {
32
-  if($key == MSG_TYPE_NEW || $key == MSG_TYPE_OUTBOX) {
31
+foreach ($sn_message_class_list as $key => $value) {
32
+  if ($key == MSG_TYPE_NEW || $key == MSG_TYPE_OUTBOX) {
33 33
     continue;
34 34
   }
35 35
 
@@ -41,17 +41,17 @@  discard block
 block discarded – undo
41 41
 
42 42
 
43 43
 $message_delete = sys_get_param_id('msg_del');
44
-if(sys_get_param('str_delete_selected') && is_array($message_delete = sys_get_param('selected')) && !empty($message_delete)) {
44
+if (sys_get_param('str_delete_selected') && is_array($message_delete = sys_get_param('selected')) && !empty($message_delete)) {
45 45
   $message_delete = implode(', ', $message_delete);
46 46
 }
47 47
 
48
-if($message_delete) {
48
+if ($message_delete) {
49 49
   db_message_list_delete_set($message_delete);
50 50
   $template->assign_block_vars('result', array('MESSAGE' => sprintf($lang['mlst_messages_deleted'], $message_delete)));
51 51
 }
52 52
 
53 53
 
54
-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'))) {
54
+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'))) {
55 55
   $delete_date = "{$year}-{$month}-{$day}";
56 56
   db_message_list_delete_by_date($delete_date, $int_type_selected);
57 57
   $template->assign_block_vars('result', array('MESSAGE' => sprintf($lang['mlst_messages_deleted_date'], $allowed_types[$int_type_selected]['TEXT'], $delete_date)));
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
 
64 64
 $int_page_current = min(sys_get_param_id('int_page_current', 1), $page_max);
65 65
 
66
-if(sys_get_param('page_prev') && $int_page_current > 1) {
66
+if (sys_get_param('page_prev') && $int_page_current > 1) {
67 67
   $int_page_current--;
68
-} elseif(sys_get_param('page_next') && $int_page_current < $page_max) {
68
+} elseif (sys_get_param('page_next') && $int_page_current < $page_max) {
69 69
   $int_page_current++;
70 70
 }
71 71
 
72
-for($i = 1; $i <= $page_max; $i++) {
72
+for ($i = 1; $i <= $page_max; $i++) {
73 73
   $template->assign_block_vars('page', array('NUMBER' => $i));
74 74
 }
75 75
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 $StartRec = ($int_page_current - 1) * 25;
78 78
 
79 79
 $Messages = db_message_list_admin_by_type($int_type_selected, $StartRec);
80
-while($row = db_fetch($Messages)) {
80
+while ($row = db_fetch($Messages)) {
81 81
   $row['FROM'] = htmlentities($row['FROM'], ENT_COMPAT, 'UTF-8');
82 82
   $row['OWNER_NAME'] = htmlentities($row['OWNER_NAME'], ENT_COMPAT, 'UTF-8');
83 83
   $row['TEXT'] = nl2br($row['TEXT']);
Please login to merge, or discard this patch.
admin/adm_flying_fleets.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 require('../common.' . substr(strrchr(__FILE__, '.'), 1));
13 13
 
14 14
 // if ($user['authlevel'] < 2)
15
-if($user['authlevel'] < 3) {
15
+if ($user['authlevel'] < 3) {
16 16
   AdminMessage($lang['adm_err_denied']);
17 17
 }
18 18
 
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 //while($CurrentFleet = db_fetch($FlyingFleets))
23 23
 
24 24
 $all_flying_fleets = FleetList::dbGetFleetList();
25
-foreach($all_flying_fleets->_container as $fleet_id => $objFleet) {
25
+foreach ($all_flying_fleets->_container as $fleet_id => $objFleet) {
26 26
   $FleetOwner = db_user_by_id($objFleet->playerOwnerId);
27 27
   $TargetOwner = db_user_by_id($objFleet->target_owner_id);
28 28
 
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
   $fleet_data['fleet']['STAY_TIME_INT'] = $objFleet->time_mission_job_complete;
34 34
 
35 35
   $template->assign_block_vars('fleets', $fleet_data['fleet']);
36
-  foreach($fleet_data['ships'] as $ship_data) {
36
+  foreach ($fleet_data['ships'] as $ship_data) {
37 37
     $template->assign_block_vars('fleets.ships', $ship_data);
38 38
   }
39 39
 }
Please login to merge, or discard this patch.
admin/admin_chat.php 1 patch
Spacing   +4 added lines, -4 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($lang['adm_err_denied']);
19 19
 }
20 20
 
@@ -24,15 +24,15 @@  discard block
 block discarded – undo
24 24
 $deleteall = sys_get_param_str('deleteall');
25 25
 
26 26
 
27
-if($delete) {
27
+if ($delete) {
28 28
   db_chat_message_delete($delete);
29
-} elseif($deleteall == 'yes') {
29
+} elseif ($deleteall == 'yes') {
30 30
   db_chat_message_purge();
31 31
 }
32 32
 
33 33
 $query = db_chat_message_get_last_25();
34 34
 $i = 0;
35
-while($e = db_fetch($query)) {
35
+while ($e = db_fetch($query)) {
36 36
   $i++;
37 37
   $parse['msg_list'] .= stripslashes("<tr>" .
38 38
     "<td class=n>{$e['messageid']}</td>" .
Please login to merge, or discard this patch.
admin/adm_log_main.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -14,25 +14,25 @@  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($lang['adm_err_denied']);
19 19
 }
20 20
 
21
-if($delete = sys_get_param_id('delete')) {
21
+if ($delete = sys_get_param_id('delete')) {
22 22
   db_log_delete_by_id($delete);
23
-} elseif(sys_get_param_str('delete_update_info')) {
23
+} elseif (sys_get_param_str('delete_update_info')) {
24 24
   db_log_delete_update_and_stat_calc();
25
-} elseif(sys_get_param_str('deleteall') == 'yes') {
25
+} elseif (sys_get_param_str('deleteall') == 'yes') {
26 26
 //  doquery("TRUNCATE TABLE `{{logs}}`");
27 27
 }
28 28
 
29
-if($detail = sys_get_param_id('detail')) {
29
+if ($detail = sys_get_param_id('detail')) {
30 30
   $template = gettemplate('admin/adm_log_main_detail', true);
31 31
 
32 32
   $errorInfo = db_log_get_by_id($detail);
33 33
   $error_dump = unserialize($errorInfo['log_dump']);
34
-  if(is_array($error_dump)) {
35
-    foreach($error_dump as $key => $value) {
34
+  if (is_array($error_dump)) {
35
+    foreach ($error_dump as $key => $value) {
36 36
       $v = array(
37 37
         'VAR_NAME'  => $key,
38 38
         'VAR_VALUE' => $key == 'query_log' ? $value : dump($value, $key)
@@ -47,10 +47,10 @@  discard block
 block discarded – undo
47 47
 
48 48
   $i = 0;
49 49
   $query = db_log_list_get_last_100();
50
-  while($u = db_fetch($query)) {
50
+  while ($u = db_fetch($query)) {
51 51
     $i++;
52 52
     $v = array();
53
-    foreach($u as $key => $value) {
53
+    foreach ($u as $key => $value) {
54 54
       $v[strtoupper($key)] = $value;
55 55
     }
56 56
     $template->assign_block_vars('error', $v);
Please login to merge, or discard this patch.
admin/ajax_maintenance.php 1 patch
Spacing   +10 added lines, -10 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();
@@ -20,9 +20,9 @@  discard block
 block discarded – undo
20 20
 // [#] info_best_battles 1b0
21 21
 $best_reports = array();
22 22
 
23
-if(defined('MODULE_INFO_BEST_BATTLES_QUERY')) {
23
+if (defined('MODULE_INFO_BEST_BATTLES_QUERY')) {
24 24
   $query = db_ube_report_get_best_battles();
25
-  while($row = db_fetch($query)) {
25
+  while ($row = db_fetch($query)) {
26 26
     $best_reports[] = $row['ube_report_id'];
27 27
   }
28 28
 }
@@ -186,16 +186,16 @@  discard block
 block discarded – undo
186 186
 
187 187
 function sn_maintenance_pack_user_list($user_list) {
188 188
   $user_list = explode(',', $user_list);
189
-  foreach($user_list as $key => $user_id) {
190
-    if(!ceil(floatval($user_id))) {
189
+  foreach ($user_list as $key => $user_id) {
190
+    if (!ceil(floatval($user_id))) {
191 191
       unset($user_list[$key]);
192 192
     }
193 193
   }
194 194
 
195 195
   $result = array();
196
-  if(!empty($user_list)) {
196
+  if (!empty($user_list)) {
197 197
     $query = db_user_list_get_by_id_array($user_list);
198
-    while($row = db_fetch($query)) {
198
+    while ($row = db_fetch($query)) {
199 199
       $result[] = $row['id'];
200 200
     }
201 201
   }
@@ -210,13 +210,13 @@  discard block
 block discarded – undo
210 210
 $old_server_status == GAME_DISABLE_NONE ? $config->db_saveItem('game_disable', GAME_DISABLE_MAINTENANCE) : false;
211 211
 sn_db_transaction_commit();
212 212
 
213
-foreach($ques as $que_transaction) {
213
+foreach ($ques as $que_transaction) {
214 214
   sn_db_transaction_start();
215 215
 
216 216
   !is_array($que_transaction) ? $que_transaction = array($que_transaction) : false;
217
-  foreach($que_transaction as $que) {
217
+  foreach ($que_transaction as $que) {
218 218
     set_time_limit(120);
219
-    if(is_callable($que)) {
219
+    if (is_callable($que)) {
220 220
       $QryResult = call_user_func($que);
221 221
     } else {
222 222
       $QryResult = doquery($que);
Please login to merge, or discard this patch.
admin/tools.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -12,19 +12,19 @@  discard block
 block discarded – undo
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
   AdminMessage($lang['adm_err_denied']);
17 17
 }
18 18
 
19 19
 $mode = sys_get_param_int('mode');
20 20
 
21
-switch($mode) {
21
+switch ($mode) {
22 22
   case ADM_TOOL_CONFIG_RELOAD:
23 23
     $config->db_loadAll();
24 24
     sys_refresh_tablelist();
25 25
 
26 26
     $config->db_loadItem('game_watchlist');
27
-    if($config->game_watchlist) {
27
+    if ($config->game_watchlist) {
28 28
       $config->game_watchlist_array = explode(';', $config->game_watchlist);
29 29
     } else {
30 30
       unset($config->game_watchlist_array);
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
       $lang['adm_tool_sql_client_version'] => db_get_client_info(),
70 70
       $lang['adm_tool_sql_host_info']      => db_get_host_info(),
71 71
     );
72
-    foreach($status as $key => $value) {
72
+    foreach ($status as $key => $value) {
73 73
       $template->assign_block_vars('table.row', array(
74 74
         'VALUE_1' => $key,
75 75
         'VALUE_2' => $value,
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 
79 79
     $template->assign_block_vars('table', $lang['adm_tool_sql_table']['status']);
80 80
     $status = explode('  ', db_server_stat());
81
-    foreach($status as $value) {
81
+    foreach ($status as $value) {
82 82
       $row = explode(': ', $value);
83 83
       $template->assign_block_vars('table.row', array(
84 84
         'VALUE_1' => $row[0],
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 
90 90
     $template->assign_block_vars('table', $lang['adm_tool_sql_table']['params']);
91 91
     $result = db_core_show_status();
92
-    while($row = db_fetch($result)) {
92
+    while ($row = db_fetch($result)) {
93 93
       $template->assign_block_vars('table.row', array(
94 94
         'VALUE_1' => $row['Variable_name'],
95 95
         'VALUE_2' => $row['Value'],
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * erreurs.php
4
- *
5
- * @version 1.0
6
- * @copyright 2009 by Gorlum for http://oGame.Triolan.COM.UA
7
- */
3
+   * erreurs.php
4
+   *
5
+   * @version 1.0
6
+   * @copyright 2009 by Gorlum for http://oGame.Triolan.COM.UA
7
+   */
8 8
 
9 9
 define('INSIDE', true);
10 10
 define('INSTALL', false);
Please login to merge, or discard this patch.
admin/adm_payment.php 1 patch
Spacing   +5 added lines, -5 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($lang['adm_err_denied']);
19 19
 }
20 20
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 );
26 26
 
27 27
 $query = db_payment_list_payers();
28
-while($row = db_fetch($query)) {
28
+while ($row = db_fetch($query)) {
29 29
   $payer_list[$row['payment_user_id']] = '[' . $row['payment_user_id'] . '] ' . $row['payment_user_name'];
30 30
 }
31 31
 tpl_assign_select($template, 'payer', $payer_list);
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 );
36 36
 
37 37
 $query = db_payment_list_modules();
38
-while($row = db_fetch($query)) {
38
+while ($row = db_fetch($query)) {
39 39
   $module_list[$row['payment_module_name']] = $row['payment_module_name'];
40 40
 }
41 41
 tpl_assign_select($template, 'module', $module_list);
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
 
51 51
 $query = db_payment_list_get($flt_payer, $flt_status, $flt_test, $flt_module);
52 52
 
53
-while($row = db_fetch($query)) {
53
+while ($row = db_fetch($query)) {
54 54
   $row2 = array();
55
-  foreach($row as $key => $value) {
55
+  foreach ($row as $key => $value) {
56 56
     $row2[strtoupper($key)] = $value;
57 57
   }
58 58
   $template->assign_block_vars('payment', $row2);
Please login to merge, or discard this patch.
flotenajax.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
   $target_mission = sys_get_param_int('mission');
38 38
   $sn_group_missions = sn_get_groups('missions');
39
-  if(empty($sn_group_missions[$target_mission]['AJAX'])) {
39
+  if (empty($sn_group_missions[$target_mission]['AJAX'])) {
40 40
     die($lang['gs_c00']);
41 41
   }
42 42
 
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
   );
52 52
   // fleet_ajax now can send fleets only to existing planets/moons
53 53
   // TODO - sending colonization and expeditions in 1 click
54
-  if(!uni_coordinates_valid($target_coord)) {
54
+  if (!uni_coordinates_valid($target_coord)) {
55 55
     die($lang['gs_c02']);
56 56
   }
57 57
 
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 
63 63
   // TODO - DEADLOCK CAN BE HERE!!!! We should lock SOURCE and TARGET owners in one query
64 64
   $target_row = db_planet_by_vector($target_coord);
65
-  if(empty($target_row)) {
65
+  if (empty($target_row)) {
66 66
     $target_row = $target_coord;
67 67
     $target_row['id_owner'] = 0;
68 68
     // If fleet destination is PT_DEBRIS - then it's actually destination is PT_PLANET // TODO - REMOVE! Debris should be valid DESTINATION planet_type!
@@ -73,15 +73,15 @@  discard block
 block discarded – undo
73 73
   }
74 74
 
75 75
   $fleet_array = array();
76
-  switch($target_mission) {
76
+  switch ($target_mission) {
77 77
     case MT_SPY:
78 78
       $fleet_array[SHIP_SPY] = min(mrc_get_level($user, $planetrow, SHIP_SPY), abs(classSupernova::$user_options[PLAYER_OPTION_FLEET_SPY_DEFAULT]));
79 79
       $unit_group = 'flt_spies';
80 80
     break;
81 81
 
82 82
     case MT_RECYCLE:
83
-      foreach(sn_get_groups('flt_recyclers') as $unit_id) {
84
-        if($unit_count = mrc_get_level($user, $planetrow, $unit_id)) {
83
+      foreach (sn_get_groups('flt_recyclers') as $unit_id) {
84
+        if ($unit_count = mrc_get_level($user, $planetrow, $unit_id)) {
85 85
           $fleet_array[$unit_id] = $unit_count;
86 86
         }
87 87
       }
@@ -106,16 +106,16 @@  discard block
 block discarded – undo
106 106
       'target_structure' => $target_structure = sys_get_param_int('structures'),
107 107
     )
108 108
   );
109
-  if($isAttackAllowed != ATTACK_ALLOWED) {
109
+  if ($isAttackAllowed != ATTACK_ALLOWED) {
110 110
     die($lang['fl_attack_error'][$isAttackAllowed]);
111 111
   }
112 112
 
113 113
   $db_changeset = array();
114
-  foreach($fleet_array as $unit_id => $unit_count) {
114
+  foreach ($fleet_array as $unit_id => $unit_count) {
115 115
     $db_changeset['unit'][] = sn_db_unit_changeset_prepare($unit_id, -$unit_count, $user, $planetrow);
116 116
   }
117 117
 
118
-  if($target_mission == MT_MISSILE) {
118
+  if ($target_mission == MT_MISSILE) {
119 119
     $distance = abs($target_coord['system'] - $planetrow['system']);
120 120
     $duration = round((30 + (60 * $distance)) / flt_server_flight_speed_multiplier());
121 121
     $arrival = SN_TIME_NOW + $duration;
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
   } else {
126 126
     $travel_data = flt_travel_data($user, $planetrow, $target_coord, $fleet_array, 10);
127 127
 
128
-    if($planetrow['deuterium'] < $travel_data['consumption']) {
128
+    if ($planetrow['deuterium'] < $travel_data['consumption']) {
129 129
       die($lang['gs_c13']);
130 130
     }
131 131
 
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 
147 147
   $ships_sent = array();
148 148
   $ships_sent_js = 0;
149
-  foreach($fleet_array as $unit_id => $unit_count) {
149
+  foreach ($fleet_array as $unit_id => $unit_count) {
150 150
     $ships_sent[] = "{$unit_count} {$lang['tech'][$unit_id]}";
151 151
     $ships_sent_js += mrc_get_level($user, $planetrow, $unit_id, false, true);
152 152
   }
Please login to merge, or discard this patch.
includes/pages/options.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 
23 23
   $language_new = sys_get_param_str('langer', $user['lang']);
24 24
 
25
-  if($language_new != $user['lang']) {
25
+  if ($language_new != $user['lang']) {
26 26
     $lang->lng_switch($language_new);
27 27
   }
28 28
 
@@ -31,35 +31,35 @@  discard block
 block discarded – undo
31 31
 
32 32
   $FMT_DATE = preg_replace(array('/d/', '/m/', '/Y/'), array('DD', 'MM', 'YYYY'), FMT_DATE);
33 33
 
34
-  if(sys_get_param_str('mode') == 'change') {
35
-    if($user['authlevel'] > 0) {
34
+  if (sys_get_param_str('mode') == 'change') {
35
+    if ($user['authlevel'] > 0) {
36 36
       $planet_protection = sys_get_param_int('adm_pl_prot') ? $user['authlevel'] : 0;
37 37
       db_planet_set_by_owner($user['id'], "`id_level` = '{$planet_protection}'");
38 38
       db_user_set_by_id($user['id'], "`admin_protection` = '{$planet_protection}'");
39 39
       $user['admin_protection'] = $planet_protection;
40 40
     }
41 41
 
42
-    if(sys_get_param_int('vacation') && !$config->user_vacation_disable) {
42
+    if (sys_get_param_int('vacation') && !$config->user_vacation_disable) {
43 43
       sn_db_transaction_start();
44
-      if($user['authlevel'] < 3) {
45
-        if($user['vacation_next'] > SN_TIME_NOW) {
44
+      if ($user['authlevel'] < 3) {
45
+        if ($user['vacation_next'] > SN_TIME_NOW) {
46 46
           message($lang['opt_vacation_err_timeout'], $lang['Error'], 'index.php?page=options', 5);
47 47
           die();
48 48
         }
49 49
 
50
-        if(FleetList::fleet_count_flying($user['id'])) {
50
+        if (FleetList::fleet_count_flying($user['id'])) {
51 51
           message($lang['opt_vacation_err_your_fleet'], $lang['Error'], 'index.php?page=options', 5);
52 52
           die();
53 53
         }
54 54
 
55 55
         $que = que_get($user['id'], false);
56
-        if(!empty($que)) {
56
+        if (!empty($que)) {
57 57
           message($lang['opt_vacation_err_que'], $lang['Error'], 'index.php?page=options', 5);
58 58
           die();
59 59
         }
60 60
 
61 61
         $query = classSupernova::db_get_record_list(LOC_PLANET, "`id_owner` = {$user['id']}");
62
-        foreach($query as $planet) {
62
+        foreach ($query as $planet) {
63 63
           // $planet = sys_o_get_updated($user, $planet, SN_TIME_NOW);
64 64
           // $planet = $planet['planet'];
65 65
 
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
       sn_db_transaction_commit();
78 78
     }
79 79
 
80
-    foreach($user_option_list as $option_group_id => $option_group) {
81
-      foreach($option_group as $option_name => $option_value) {
82
-        if($user[$option_name] !== null) {
80
+    foreach ($user_option_list as $option_group_id => $option_group) {
81
+      foreach ($option_group as $option_name => $option_value) {
82
+        if ($user[$option_name] !== null) {
83 83
           $user[$option_name] = sys_get_param_str($option_name);
84 84
         } else {
85 85
           $user[$option_name] = $option_value;
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
 
91 91
 
92 92
     $player_options = sys_get_param('options');
93
-    if(!empty($player_options)) {
94
-      array_walk($player_options, function (&$value) {
93
+    if (!empty($player_options)) {
94
+      array_walk($player_options, function(&$value) {
95 95
         // TODO - Когда будет больше параметров - сделать больше проверок
96 96
         $value = intval($value);
97 97
       });
@@ -102,15 +102,15 @@  discard block
 block discarded – undo
102 102
 
103 103
     $username = substr(sys_get_param_str_unsafe('username'), 0, 32);
104 104
     $username_safe = db_escape($username);
105
-    if($username && $user['username'] != $username && $config->game_user_changename != SERVER_PLAYER_NAME_CHANGE_NONE && sys_get_param_int('username_confirm') && !strpbrk($username, LOGIN_REGISTER_CHARACTERS_PROHIBITED)) {
105
+    if ($username && $user['username'] != $username && $config->game_user_changename != SERVER_PLAYER_NAME_CHANGE_NONE && sys_get_param_int('username_confirm') && !strpbrk($username, LOGIN_REGISTER_CHARACTERS_PROHIBITED)) {
106 106
       // проверка на корректность
107 107
       sn_db_transaction_start();
108 108
       $name_check = db_player_name_history_get_name_by_name($username_safe);
109
-      if(!$name_check || $name_check['player_id'] == $user['id']) {
109
+      if (!$name_check || $name_check['player_id'] == $user['id']) {
110 110
         $user = db_user_by_id($user['id'], true);
111
-        switch($config->game_user_changename) {
111
+        switch ($config->game_user_changename) {
112 112
           case SERVER_PLAYER_NAME_CHANGE_PAY:
113
-            if(mrc_get_level($user, $planetrow, RES_DARK_MATTER) < $config->game_user_changename_cost) {
113
+            if (mrc_get_level($user, $planetrow, RES_DARK_MATTER) < $config->game_user_changename_cost) {
114 114
               $template_result['.']['result'][] = array(
115 115
                 'STATUS'  => ERR_ERROR,
116 116
                 'MESSAGE' => $lang['opt_msg_name_change_err_no_dm'],
@@ -140,18 +140,18 @@  discard block
 block discarded – undo
140 140
       sn_db_transaction_commit();
141 141
     }
142 142
 
143
-    if($new_password = sys_get_param('newpass1')) {
143
+    if ($new_password = sys_get_param('newpass1')) {
144 144
       try {
145
-        if($new_password != sys_get_param('newpass2')) {
145
+        if ($new_password != sys_get_param('newpass2')) {
146 146
           throw new Exception($lang['opt_err_pass_unmatched'], ERR_WARNING);
147 147
         }
148 148
 
149
-        if(!classSupernova::$auth->password_change(sys_get_param('db_password'), $new_password)) {
149
+        if (!classSupernova::$auth->password_change(sys_get_param('db_password'), $new_password)) {
150 150
           throw new Exception($lang['opt_err_pass_wrong'], ERR_WARNING);
151 151
         }
152 152
 
153 153
         throw new Exception($lang['opt_msg_pass_changed'], ERR_NONE);
154
-      } catch(Exception $e) {
154
+      } catch (Exception $e) {
155 155
         $template_result['.']['result'][] = array(
156 156
           'STATUS'  => in_array($e->getCode(), array(ERR_NONE, ERR_WARNING, ERR_ERROR)) ? $e->getCode() : ERR_ERROR,
157 157
           'MESSAGE' => $e->getMessage()
@@ -192,12 +192,12 @@  discard block
 block discarded – undo
192 192
     $user['gender'] = $user['gender'] == GENDER_UNKNOWN ? $gender : $user['gender'];
193 193
 
194 194
     try {
195
-      if($user['birthday']) {
195
+      if ($user['birthday']) {
196 196
         throw new exception();
197 197
       }
198 198
 
199 199
       $user_birthday = sys_get_param_str_unsafe('user_birthday');
200
-      if(!$user_birthday || $user_birthday == $FMT_DATE) {
200
+      if (!$user_birthday || $user_birthday == $FMT_DATE) {
201 201
         throw new exception();
202 202
       }
203 203
 
@@ -207,16 +207,16 @@  discard block
 block discarded – undo
207 207
       $pos['Y'] = strpos(FMT_DATE, 'Y');
208 208
       asort($pos);
209 209
       $i = 0;
210
-      foreach($pos as &$position) {
210
+      foreach ($pos as &$position) {
211 211
         $position = ++$i;
212 212
       }
213 213
 
214 214
       $regexp = "/" . preg_replace(array('/\\\\/', '/\//', '/\./', '/\-/', '/d/', '/m/', '/Y/'), array('\\\\\\', '\/', '\.', '\-', '(\d?\d)', '(\d?\d)', '(\d{4})'), FMT_DATE) . "/";
215
-      if(!preg_match($regexp, $user_birthday, $match)) {
215
+      if (!preg_match($regexp, $user_birthday, $match)) {
216 216
         throw new exception();
217 217
       }
218 218
 
219
-      if(!checkdate($match[$pos['m']], $match[$pos['d']], $match[$pos['Y']])) {
219
+      if (!checkdate($match[$pos['m']], $match[$pos['d']], $match[$pos['Y']])) {
220 220
         throw new exception();
221 221
       }
222 222
 
@@ -224,13 +224,13 @@  discard block
 block discarded – undo
224 224
       // EOF black magic! Now we have valid SQL date in $user['user_birthday'] - independent of date format
225 225
 
226 226
       $year = date('Y', SN_TIME_NOW);
227
-      if(mktime(0, 0, 0, $match[$pos['m']], $match[$pos['d']], $year) > SN_TIME_NOW) {
227
+      if (mktime(0, 0, 0, $match[$pos['m']], $match[$pos['d']], $year) > SN_TIME_NOW) {
228 228
         $year--;
229 229
       }
230 230
       $user['user_birthday_celebrated'] = db_escape("{$year}-{$match[$pos['m']]}-{$match[$pos['d']]}");
231 231
 
232 232
       $user_birthday = ", `user_birthday` = '{$user['user_birthday']}', `user_birthday_celebrated` = '{$user['user_birthday_celebrated']}'";
233
-    } catch(exception $e) {
233
+    } catch (exception $e) {
234 234
       $user_birthday = '';
235 235
     }
236 236
 
@@ -240,14 +240,14 @@  discard block
 block discarded – undo
240 240
     $template_result['.']['result'][] = $avatar_upload_result;
241 241
 
242 242
     $user_time_diff = playerTimeDiff::user_time_diff_get();
243
-    if(sys_get_param_int('PLAYER_OPTION_TIME_DIFF_FORCED')) {
243
+    if (sys_get_param_int('PLAYER_OPTION_TIME_DIFF_FORCED')) {
244 244
       playerTimeDiff::user_time_diff_set(array(
245 245
         PLAYER_OPTION_TIME_DIFF              => sys_get_param_int('PLAYER_OPTION_TIME_DIFF'),
246 246
         PLAYER_OPTION_TIME_DIFF_UTC_OFFSET   => 0,
247 247
         PLAYER_OPTION_TIME_DIFF_FORCED       => 1,
248 248
         PLAYER_OPTION_TIME_DIFF_MEASURE_TIME => SN_TIME_SQL,
249 249
       ));
250
-    } elseif(sys_get_param_int('opt_time_diff_clear') || $user_time_diff[PLAYER_OPTION_TIME_DIFF_FORCED]) {
250
+    } elseif (sys_get_param_int('opt_time_diff_clear') || $user_time_diff[PLAYER_OPTION_TIME_DIFF_FORCED]) {
251 251
       playerTimeDiff::user_time_diff_set(array(
252 252
         PLAYER_OPTION_TIME_DIFF              => '',
253 253
         PLAYER_OPTION_TIME_DIFF_UTC_OFFSET   => 0,
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
       'STATUS'  => ERR_NONE,
268 268
       'MESSAGE' => $lang['opt_msg_saved']
269 269
     );
270
-  } elseif(sys_get_param_str('result') == 'ok') {
270
+  } elseif (sys_get_param_str('result') == 'ok') {
271 271
     $template_result['.']['result'][] = array(
272 272
       'STATUS'  => ERR_NONE,
273 273
       'MESSAGE' => $lang['opt_msg_saved']
@@ -295,8 +295,8 @@  discard block
 block discarded – undo
295 295
 //  );
296 296
 
297 297
   $dir = dir(SN_ROOT_PHYSICAL . 'skins');
298
-  while(($entry = $dir->read()) !== false) {
299
-    if(is_dir("skins/{$entry}") && $entry[0] != '.') {
298
+  while (($entry = $dir->read()) !== false) {
299
+    if (is_dir("skins/{$entry}") && $entry[0] != '.') {
300 300
       $template_result['.']['skin_list'][] = array(
301 301
         'VALUE'    => $entry,
302 302
         'NAME'     => $entry,
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
   }
307 307
   $dir->close();
308 308
 
309
-  foreach($lang['opt_planet_sort_options'] as $key => &$value) {
309
+  foreach ($lang['opt_planet_sort_options'] as $key => &$value) {
310 310
     $template_result['.']['planet_sort_options'][] = array(
311 311
       'VALUE'    => $key,
312 312
       'NAME'     => $value,
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
       );
323 323
     }
324 324
   */
325
-  foreach($lang['sys_gender_list'] as $key => $value) {
325
+  foreach ($lang['sys_gender_list'] as $key => $value) {
326 326
     $template_result['.']['gender_list'][] = array(
327 327
       'VALUE'    => $key,
328 328
       'NAME'     => $value,
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
   }
332 332
 
333 333
   $lang_list = lng_get_list();
334
-  foreach($lang_list as $lang_id => $lang_data) {
334
+  foreach ($lang_list as $lang_id => $lang_data) {
335 335
     $template_result['.']['languages'][] = array(
336 336
       'VALUE'    => $lang_id,
337 337
       'NAME'     => $lang_data['LANG_NAME_NATIVE'],
@@ -340,8 +340,8 @@  discard block
 block discarded – undo
340 340
   }
341 341
 
342 342
 
343
-  if(isset($lang['menu_customize_show_hide_button_state'])) {
344
-    foreach($lang['menu_customize_show_hide_button_state'] as $key => $value) {
343
+  if (isset($lang['menu_customize_show_hide_button_state'])) {
344
+    foreach ($lang['menu_customize_show_hide_button_state'] as $key => $value) {
345 345
       $template->assign_block_vars('menu_customize_show_hide_button_state', array(
346 346
         'ID'   => $key,
347 347
         'NAME' => $value,
@@ -451,10 +451,10 @@  discard block
 block discarded – undo
451 451
     'PAGE_HEADER' => $lang['opt_header'],
452 452
   ));
453 453
 
454
-  foreach($user_option_list as $option_group_id => $option_group) {
455
-    if($option_group_id == OPT_MESSAGE) {
456
-      foreach($sn_message_class_list as $message_class_id => $message_class_data) {
457
-        if($message_class_data['switchable'] || ($message_class_data['email'] && $config->game_email_pm)) {
454
+  foreach ($user_option_list as $option_group_id => $option_group) {
455
+    if ($option_group_id == OPT_MESSAGE) {
456
+      foreach ($sn_message_class_list as $message_class_id => $message_class_data) {
457
+        if ($message_class_data['switchable'] || ($message_class_data['email'] && $config->game_email_pm)) {
458 458
           $option_name = $message_class_data['name'];
459 459
 
460 460
           $template->assign_block_vars("options_{$option_group_id}", array(
@@ -466,8 +466,8 @@  discard block
 block discarded – undo
466 466
         }
467 467
       }
468 468
     } else {
469
-      foreach($option_group as $option_name => $option_value) {
470
-        if(array_key_exists($option_name, $user_option_types)) {
469
+      foreach ($option_group as $option_name => $option_value) {
470
+        if (array_key_exists($option_name, $user_option_types)) {
471 471
           $option_type = $user_option_types[$option_name];
472 472
         } else {
473 473
           $option_type = 'switch';
Please login to merge, or discard this patch.