Completed
Push — trunk ( 34029c...0f5c9b )
by SuperNova.WS
03:54
created
includes/functions/sys_user.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 function sys_user_vacation($user) {
10 10
   global $config;
11 11
 
12
-  if(sys_get_param_str('vacation') == 'leave') {
12
+  if (sys_get_param_str('vacation') == 'leave') {
13 13
     if ($user['vacation'] < SN_TIME_NOW) {
14 14
       $user['vacation'] = 0;
15 15
       $user['vacation_next'] = SN_TIME_NOW + $config->player_vacation_timeout;
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
     }
18 18
   }
19 19
 
20
-  if($user['vacation']) {
20
+  if ($user['vacation']) {
21 21
     // sn_sys_logout(false, true);
22 22
     // core_auth::logout(false, true);
23 23
 
@@ -52,33 +52,33 @@  discard block
 block discarded – undo
52 52
   // TODO: Full rewrite
53 53
   sn_db_transaction_start();
54 54
   $TheUser = db_user_by_id($UserID);
55
-  if ( $TheUser['ally_id'] != 0 ) {
56
-    $TheAlly = doquery ( "SELECT * FROM `{{alliance}}` WHERE `id` = '" . $TheUser['ally_id'] . "';", '', true );
55
+  if ($TheUser['ally_id'] != 0) {
56
+    $TheAlly = doquery("SELECT * FROM `{{alliance}}` WHERE `id` = '" . $TheUser['ally_id'] . "';", '', true);
57 57
     $TheAlly['ally_members'] -= 1;
58
-    if ( $TheAlly['ally_members'] > 0 ) {
59
-      doquery ( "UPDATE `{{alliance}}` SET `ally_members` = '" . $TheAlly['ally_members'] . "' WHERE `id` = '" . $TheAlly['id'] . "';");
58
+    if ($TheAlly['ally_members'] > 0) {
59
+      doquery("UPDATE `{{alliance}}` SET `ally_members` = '" . $TheAlly['ally_members'] . "' WHERE `id` = '" . $TheAlly['id'] . "';");
60 60
     } else {
61
-      doquery ( "DELETE FROM `{{alliance}}` WHERE `id` = '" . $TheAlly['id'] . "';");
62
-      doquery ( "DELETE FROM `{{statpoints}}` WHERE `stat_type` = '2' AND `id_owner` = '" . $TheAlly['id'] . "';");
61
+      doquery("DELETE FROM `{{alliance}}` WHERE `id` = '" . $TheAlly['id'] . "';");
62
+      doquery("DELETE FROM `{{statpoints}}` WHERE `stat_type` = '2' AND `id_owner` = '" . $TheAlly['id'] . "';");
63 63
     }
64 64
   }
65
-  doquery ( "DELETE FROM `{{statpoints}}` WHERE `stat_type` = '1' AND `id_owner` = '" . $UserID . "';");
65
+  doquery("DELETE FROM `{{statpoints}}` WHERE `stat_type` = '1' AND `id_owner` = '" . $UserID . "';");
66 66
 
67 67
   DBStaticPlanet::db_planet_list_delete_by_owner($UserID);
68 68
 
69
-  doquery ( "DELETE FROM `{{messages}}` WHERE `message_sender` = '" . $UserID . "';");
70
-  doquery ( "DELETE FROM `{{messages}}` WHERE `message_owner` = '" . $UserID . "';");
71
-  doquery ( "DELETE FROM `{{notes}}` WHERE `owner` = '" . $UserID . "';");
69
+  doquery("DELETE FROM `{{messages}}` WHERE `message_sender` = '" . $UserID . "';");
70
+  doquery("DELETE FROM `{{messages}}` WHERE `message_owner` = '" . $UserID . "';");
71
+  doquery("DELETE FROM `{{notes}}` WHERE `owner` = '" . $UserID . "';");
72 72
   db_fleet_list_delete_by_owner($UserID);
73 73
 //  doquery ( "DELETE FROM `{{rw}}` WHERE `id_owner1` = '" . $UserID . "';");
74 74
 //  doquery ( "DELETE FROM `{{rw}}` WHERE `id_owner2` = '" . $UserID . "';");
75
-  doquery ( "DELETE FROM `{{buddy}}` WHERE `BUDDY_SENDER_ID` = '" . $UserID . "';");
76
-  doquery ( "DELETE FROM `{{buddy}}` WHERE `BUDDY_OWNER_ID` = '" . $UserID . "';");
77
-  doquery ( "DELETE FROM `{{annonce}}` WHERE `user` = '" . $UserID . "';");
75
+  doquery("DELETE FROM `{{buddy}}` WHERE `BUDDY_SENDER_ID` = '" . $UserID . "';");
76
+  doquery("DELETE FROM `{{buddy}}` WHERE `BUDDY_OWNER_ID` = '" . $UserID . "';");
77
+  doquery("DELETE FROM `{{annonce}}` WHERE `user` = '" . $UserID . "';");
78 78
 
79 79
 
80 80
   SN::db_del_record_by_id(LOC_USER, $UserID);
81
-  doquery ( "DELETE FROM `{{referrals}}` WHERE (`id` = '{$UserID}') OR (`id_partner` = '{$UserID}');");
81
+  doquery("DELETE FROM `{{referrals}}` WHERE (`id` = '{$UserID}') OR (`id_partner` = '{$UserID}');");
82 82
   global $config;
83 83
   $config->db_saveItem('users_amount', $config->db_loadItem('users_amount') - 1);
84 84
   sn_db_transaction_commit();
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
   \DBAL\DbQuery::build()->setTable('users')->setValues($field_set)->doInsert();
181 181
   $user_new = db_user_by_id(db_insert_id());
182 182
 
183
-  if(!($options['galaxy'] && $options['system'] && $options['planet'])) {
183
+  if (!($options['galaxy'] && $options['system'] && $options['planet'])) {
184 184
     $options['galaxy'] = $config->LastSettedGalaxyPos;
185 185
     $options['system'] = $config->LastSettedSystemPos;
186 186
     $segment_size = floor($config->game_maxPlanet / 3);
@@ -188,19 +188,19 @@  discard block
 block discarded – undo
188 188
     $segment++;
189 189
     $options['planet'] = mt_rand(1 + $segment * $segment_size, ($segment + 1) * $segment_size);
190 190
 
191
-    while(true) {
192
-      if($options['planet'] > $config->game_maxPlanet) {
191
+    while (true) {
192
+      if ($options['planet'] > $config->game_maxPlanet) {
193 193
         $options['planet'] = mt_rand(0, $segment_size - 1) + 1;
194 194
         $options['system']++;
195 195
       }
196
-      if($options['system'] > $config->game_maxSystem) {
196
+      if ($options['system'] > $config->game_maxSystem) {
197 197
         $options['system'] = 1;
198 198
         $options['galaxy']++;
199 199
       }
200 200
       $options['galaxy'] > $config->game_maxGalaxy ? $options['galaxy'] = 1 : false;
201 201
 
202 202
       $galaxy_row = DBStaticPlanet::db_planet_by_gspt($options['galaxy'], $options['system'], $options['planet'], PT_PLANET, true, 'id');
203
-      if(!$galaxy_row['id']) {
203
+      if (!$galaxy_row['id']) {
204 204
         $config->db_saveItem(array(
205 205
           'LastSettedGalaxyPos' => $options['galaxy'],
206 206
           'LastSettedSystemPos' => $options['system'],
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
   $username_safe = db_escape($username_unsafe);
224 224
   doquery("REPLACE INTO {{player_name_history}} SET `player_id` = {$user_new['id']}, `player_name` = '{$username_safe}'");
225 225
 
226
-  if(!empty($options['partner_id']) && ($referral_row = db_user_by_id($options['partner_id'], true))) {
226
+  if (!empty($options['partner_id']) && ($referral_row = db_user_by_id($options['partner_id'], true))) {
227 227
     doquery("INSERT INTO {{referrals}} SET `id` = {$user_new['id']}, `id_partner` = {$options['partner_id']}");
228 228
   }
229 229
 
Please login to merge, or discard this patch.
includes/functions/_news.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,8 +46,7 @@
 block discarded – undo
46 46
       'ANNOUNCE'        => SN::$gc->bbCodeParser->expandBbCode($announce['strAnnounce'], intval($announce['authlevel'])),
47 47
       'DETAIL_URL'      => $announce['detail_url'],
48 48
       'USER_NAME'       =>
49
-        isset($users[$announce['user_id']]) && $users[$announce['user_id']] ? player_nick_render_to_html($users[$announce['user_id']], array('color' => true)) :
50
-          js_safe_string($announce['user_name']),
49
+        isset($users[$announce['user_id']]) && $users[$announce['user_id']] ? player_nick_render_to_html($users[$announce['user_id']], array('color' => true)) : js_safe_string($announce['user_name']),
51 50
       'NEW'             => $announce['unix_time'] + $config->game_news_actual >= SN_TIME_NOW,
52 51
       'FUTURE'          => $announce['unix_time'] > SN_TIME_NOW,
53 52
       'SURVEY_ID'       => $announce['survey_id'],
Please login to merge, or discard this patch.
includes/general/nickRender.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 
272 272
 
273 273
   if (($options === true || isset($options['icons']) || isset($options['birthday'])) && (date('Y', SN_TIME_NOW) . date('-m-d', strtotime($render_user['user_birthday'])) == date('Y-m-d', SN_TIME_NOW))) {
274
-    if(!empty($render_user['user_birthday'])) {
274
+    if (!empty($render_user['user_birthday'])) {
275 275
       $result[NICK_BIRTHDAY] = '';
276 276
     }
277 277
   }
@@ -283,13 +283,13 @@  discard block
 block discarded – undo
283 283
   }
284 284
 
285 285
   if (($options === true || (isset($options['icons']) && $options['icons']) || (isset($options['vacancy']) && $options['vacancy'])) && $render_user['vacation']) {
286
-    if(isset($render_user['vacation'])) {
286
+    if (isset($render_user['vacation'])) {
287 287
       $result[NICK_VACATION] = $render_user['vacation'];
288 288
     }
289 289
   }
290 290
 
291 291
   if ($options === true || !empty($options['icons']) || !empty($options['player_rank'])) {
292
-    if(isset($render_user['total_points'])) {
292
+    if (isset($render_user['total_points'])) {
293 293
       $result[NICK_RANK] = SN::$gc->playerLevelHelper->getPointLevel($render_user['total_points'], $render_user['authlevel']);
294 294
     }
295 295
   }
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
   }
314 314
 
315 315
   if ($render_user['ally_tag'] && ($options === true || (isset($options['ally']) && $options['ally']))) {
316
-    if(isset($render_user['ally_tag'])) {
316
+    if (isset($render_user['ally_tag'])) {
317 317
       $result[NICK_ALLY] = $render_user['ally_tag'];
318 318
     }
319 319
   }
Please login to merge, or discard this patch.
blitz_register.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -2,12 +2,12 @@  discard block
 block discarded – undo
2 2
 
3 3
 include('common.' . substr(strrchr(__FILE__, '.'), 1));
4 4
 
5
-if($user['authlevel'] < AUTH_LEVEL_DEVELOPER) {
5
+if ($user['authlevel'] < AUTH_LEVEL_DEVELOPER) {
6 6
   $error_message = SN::$config->game_mode == GAME_BLITZ ? 'sys_blitz_page_disabled' : (
7 7
     !SN::$config->game_blitz_register ? 'sys_blitz_registration_disabled' : ''
8 8
   );
9 9
 
10
-  if($error_message) {
10
+  if ($error_message) {
11 11
     messageBox($lang[$error_message], $lang['sys_error'], 'overview.php', 10);
12 12
     die();
13 13
   }
@@ -17,12 +17,12 @@  discard block
 block discarded – undo
17 17
 $current_round = intval(SN::$config->db_loadItem('game_blitz_register_round'));
18 18
 $current_price = intval(SN::$config->db_loadItem('game_blitz_register_price'));
19 19
 
20
-if(SN::$config->db_loadItem('game_blitz_register') == BLITZ_REGISTER_OPEN && (sys_get_param_str('register_me') || sys_get_param_str('register_me_not'))) {
20
+if (SN::$config->db_loadItem('game_blitz_register') == BLITZ_REGISTER_OPEN && (sys_get_param_str('register_me') || sys_get_param_str('register_me_not'))) {
21 21
   sn_db_transaction_start();
22 22
   $user = db_user_by_id($user['id'], true);
23 23
   $is_registered = doquery("SELECT `id` FROM {{blitz_registrations}} WHERE `user_id` = {$user['id']} AND `round_number` = {$current_round} FOR UPDATE;", true);
24
-  if(sys_get_param_str('register_me')) {
25
-    if(empty($is_registered) && mrc_get_level($user, null, RES_METAMATTER) >= $current_price) {
24
+  if (sys_get_param_str('register_me')) {
25
+    if (empty($is_registered) && mrc_get_level($user, null, RES_METAMATTER) >= $current_price) {
26 26
       doquery("INSERT IGNORE INTO {{blitz_registrations}} SET `user_id` = {$user['id']}, `round_number` = {$current_round};");
27 27
       //mm_points_change($user['id'], RPG_BLITZ_REGISTRATION, -$current_price, "Регистрация в раунде {$current_round} Блица");
28 28
       SN::$auth->account->metamatter_change(RPG_BLITZ_REGISTRATION, -$current_price, "Регистрация в раунде {$current_round} Блица");
@@ -43,17 +43,17 @@  discard block
 block discarded – undo
43 43
 $blitz_players = 0;
44 44
 $blitz_prize_dark_matter = 0;
45 45
 $blitz_prize_places = 0;
46
-if($user['authlevel'] >= AUTH_LEVEL_DEVELOPER) {
47
-  if(sys_get_param_str('generate')) {
46
+if ($user['authlevel'] >= AUTH_LEVEL_DEVELOPER) {
47
+  if (sys_get_param_str('generate')) {
48 48
     $next_id = 0;
49 49
     $query = doquery("SELECT `id` FROM {{blitz_registrations}} WHERE `round_number` = {$current_round} ORDER BY RAND();");
50
-    while($row = db_fetch($query)) {
50
+    while ($row = db_fetch($query)) {
51 51
       $next_id++;
52 52
       $blitz_name = 'Игрок' . $next_id;
53 53
       $blitz_password = sys_random_string(8);
54 54
       doquery("UPDATE {{blitz_registrations}} SET blitz_name = '{$blitz_name}', blitz_password = '{$blitz_password}' WHERE `id` = {$row['id']} AND `round_number` = {$current_round};");
55 55
     }
56
-  } elseif(sys_get_param_str('import_generated')) {
56
+  } elseif (sys_get_param_str('import_generated')) {
57 57
     // ЭТО НА БЛИЦЕ!!!
58 58
     doquery("DELETE FROM {{users}} WHERE username like 'Игрок%';");
59 59
     doquery("DELETE FROM {{planets}} WHERE id_owner not in (SELECT `id` FROM {{users}});");
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
     $system = $system_step;
76 76
     $planet = round(SN::$config->game_maxPlanet / 2);
77 77
 
78
-    foreach($imported_string as &$string_data) {
78
+    foreach ($imported_string as &$string_data) {
79 79
       $string_data = explode(',', $string_data);
80 80
       $username_safe = $string_data[0];
81 81
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 
90 90
       $moon_row = uni_create_moon($galaxy, $system, $planet, $user_new['id'], Universe::MOON_MAX_SIZE, false);
91 91
 
92
-      if(($system += $system_step) >= SN::$config->game_maxSystem) {
92
+      if (($system += $system_step) >= SN::$config->game_maxSystem) {
93 93
         $galaxy++;
94 94
         $system = $system_step;
95 95
       }
@@ -98,13 +98,13 @@  discard block
 block discarded – undo
98 98
 
99 99
     SN::$config->db_saveItem('users_amount', SN::$config->users_amount + $new_players);
100 100
     // generated_string
101
-  } elseif(sys_get_param_str('import_result') && ($blitz_result_string = sys_get_param_str('blitz_result_string'))) {
101
+  } elseif (sys_get_param_str('import_result') && ($blitz_result_string = sys_get_param_str('blitz_result_string'))) {
102 102
     $blitz_result = explode(';', $blitz_result_string);
103 103
     $blitz_last_update = $blitz_result[0]; // Пока не используется
104 104
     unset($blitz_result[0]);
105
-    foreach($blitz_result as $blitz_result_data) {
105
+    foreach ($blitz_result as $blitz_result_data) {
106 106
       $blitz_result_data = explode(',', $blitz_result_data);
107
-      if(count($blitz_result_data) == 5) {
107
+      if (count($blitz_result_data) == 5) {
108 108
         $blitz_result_data[1] = db_escape($blitz_result_data[1]);
109 109
         doquery(
110 110
           "UPDATE `{{blitz_registrations}}` SET
@@ -118,15 +118,15 @@  discard block
 block discarded – undo
118 118
     $blitz_result = array();
119 119
   }
120 120
 
121
-  if(SN::$config->game_mode == GAME_BLITZ) {
121
+  if (SN::$config->game_mode == GAME_BLITZ) {
122 122
     $blitz_result = array(SN::$config->db_loadItem('var_stat_update'));
123 123
     $query = doquery("SELECT id, username, total_rank, total_points, onlinetime FROM {{users}} ORDER BY `id`;");
124
-    while($row = db_fetch($query)) {
124
+    while ($row = db_fetch($query)) {
125 125
       $blitz_result[] = "{$row['id']},{$row['username']},{$row['onlinetime']},{$row['total_rank']},{$row['total_points']}";
126 126
     }
127 127
   } else {
128 128
     $query = doquery("SELECT blitz_name, blitz_password, blitz_online FROM {{blitz_registrations}} WHERE `round_number` = {$current_round} ORDER BY `id`;");
129
-    while($row = db_fetch($query)) {
129
+    while ($row = db_fetch($query)) {
130 130
       $blitz_generated[] = "{$row['blitz_name']},{$row['blitz_password']}";
131 131
       $row['blitz_online'] ? $blitz_prize_players_active++ : false;
132 132
       $blitz_players++;
@@ -141,13 +141,13 @@  discard block
 block discarded – undo
141 141
     'Игрок40'
142 142
     */
143 143
 
144
-    if(sys_get_param_str('prize_calculate') && $blitz_prize_players_active && ($blitz_prize_dark_matter_actual = sys_get_param_int('blitz_prize_dark_matter'))) {
144
+    if (sys_get_param_str('prize_calculate') && $blitz_prize_players_active && ($blitz_prize_dark_matter_actual = sys_get_param_int('blitz_prize_dark_matter'))) {
145 145
       // $blitz_prize_dark_matter_actual = sys_get_param_int('blitz_prize_dark_matter');
146 146
       $blitz_prize_places_actual = sys_get_param_int('blitz_prize_places');
147 147
       sn_db_transaction_start();
148 148
       $query = doquery("SELECT * FROM {{blitz_registrations}} WHERE `round_number` = {$current_round} ORDER BY `blitz_place` FOR UPDATE;");
149
-      while($row = db_fetch($query)) {
150
-        if(!$row['blitz_place']) {
149
+      while ($row = db_fetch($query)) {
150
+        if (!$row['blitz_place']) {
151 151
           continue;
152 152
         }
153 153
 
@@ -155,15 +155,15 @@  discard block
 block discarded – undo
155 155
         $blitz_prize_places_actual--;
156 156
 
157 157
         $reward = $blitz_prize_dark_matter_actual - $row['blitz_reward_dark_matter'];
158
-pdump("{{$row['id']}} {$row['blitz_name']}, Place {$row['blitz_place']}, Prize places {$blitz_prize_places_actual}, Prize {$reward}",$row['id']);
159
-        if($reward) {
158
+pdump("{{$row['id']}} {$row['blitz_name']}, Place {$row['blitz_place']}, Prize places {$blitz_prize_places_actual}, Prize {$reward}", $row['id']);
159
+        if ($reward) {
160 160
           rpg_points_change($row['user_id'], RPG_BLITZ, $reward, sprintf(
161 161
             $lang['sys_blitz_reward_log_message'], $row['blitz_place'], $row['blitz_name']
162 162
           ));
163 163
           doquery("UPDATE {{blitz_registrations}} SET blitz_reward_dark_matter = blitz_reward_dark_matter + ($reward) WHERE id = {$row['id']} AND `round_number` = {$current_round};");
164 164
         }
165 165
 
166
-        if(!$blitz_prize_places_actual || $blitz_prize_dark_matter_actual < 1000) {
166
+        if (!$blitz_prize_places_actual || $blitz_prize_dark_matter_actual < 1000) {
167 167
           break;
168 168
         }
169 169
       }
@@ -183,12 +183,12 @@  discard block
 block discarded – undo
183 183
     JOIN {{users}} AS u ON u.id = br.user_id
184 184
   WHERE br.`round_number` = {$current_round}
185 185
   order by `blitz_place`, `timestamp`;");
186
-while($row = db_fetch($query)) {
186
+while ($row = db_fetch($query)) {
187 187
   $tpl_player_data = array(
188 188
     'NAME' => player_nick_render_to_html($row, array('icons' => true, 'color' => true, 'ally' => true)),
189 189
   );
190 190
 
191
-  if(SN::$config->game_blitz_register == BLITZ_REGISTER_DISCLOSURE_NAMES) {
191
+  if (SN::$config->game_blitz_register == BLITZ_REGISTER_DISCLOSURE_NAMES) {
192 192
     // Вот так хитро, что бы не было не единого шанса попадания на страницу данных об игроках Блиц-сервера до закрытия раунда
193 193
     $tpl_player_data = array_merge($tpl_player_data, array(
194 194
       'ID' => $row['id'],
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
   }
202 202
 
203 203
   $template->assign_block_vars('registrations', $tpl_player_data);
204
-  if($row['id'] == $user['id']) {
204
+  if ($row['id'] == $user['id']) {
205 205
     $player_registered = $row;
206 206
   }
207 207
 }
Please login to merge, or discard this patch.
includes/pages/options.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
     unset($player_options[PLAYER_OPTION_TUTORIAL_CURRENT]);
402 402
   }
403 403
 
404
-  array_walk($player_options, function (&$value) {
404
+  array_walk($player_options, function(&$value) {
405 405
     // TODO - Когда будет больше параметров - сделать больше проверок
406 406
     $value = intval($value);
407 407
   });
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
           $user['id'],
451 451
           RPG_NAME_CHANGE,
452 452
           -$config->game_user_changename_cost,
453
-          vsprintf('Пользователь ID %1$d сменил имя с "%2$s" на "%3$s"', [$user['id'], $user['username'], $username,])
453
+          vsprintf('Пользователь ID %1$d сменил имя с "%2$s" на "%3$s"', [$user['id'], $user['username'], $username, ])
454 454
         );
455 455
 
456 456
       case SERVER_PLAYER_NAME_CHANGE_FREE:
Please login to merge, or discard this patch.
classes/classConfig.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -150,9 +150,9 @@  discard block
 block discarded – undo
150 150
     'advGoogleLeftMenuCode'        => '(Place here code for banner)',
151 151
 
152 152
     // Alliance bonus calculations
153
-    'ali_bonus_algorithm'          => 0,  // Bonus calculation algorithm
153
+    'ali_bonus_algorithm'          => 0, // Bonus calculation algorithm
154 154
     'ali_bonus_brackets'           => 10, // Brackets count for ALI_BONUS_BY_RANK
155
-    'ali_bonus_brackets_divisor'   => 10,// Bonus divisor for ALI_BONUS_BY_RANK
155
+    'ali_bonus_brackets_divisor'   => 10, // Bonus divisor for ALI_BONUS_BY_RANK
156 156
     'ali_bonus_divisor'            => 10000000, // Rank divisor for ALI_BONUS_BY_POINTS
157 157
     'ali_bonus_members'            => 10, // Minimum alliance size to start using bonus
158 158
 
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
     'Defs_Cdr'                     => 30,
187 187
     'eco_scale_storage'            => 1,
188 188
     'eco_stockman_fleet'           => '', // Black Market - Starting amount of s/h ship merchant to sell
189
-    'eco_stockman_fleet_populate'  => 1,  // Populate empty Stockman fleet with ships or not
189
+    'eco_stockman_fleet_populate'  => 1, // Populate empty Stockman fleet with ships or not
190 190
     'empire_mercenary_base_period' => PERIOD_MONTH, // Base
191 191
     'empire_mercenary_temporary'   => 0, // Temporary empire-wide mercenaries
192 192
 
@@ -197,11 +197,11 @@  discard block
 block discarded – undo
197 197
     'energy_basic_income'          => 0,
198 198
 
199 199
     // Bashing protection settings
200
-    'fleet_bashing_attacks'        => 3,      // Max amount of attack per wave - 3 by default
201
-    'fleet_bashing_interval'       => 1800,   // Maximum interval between attacks when they still count as one wave - 30m by default
202
-    'fleet_bashing_scope'          => 86400,  // Interval on which bashing waves counts - 24h by default
203
-    'fleet_bashing_war_delay'      => 43200,  // Delay before start bashing after declaring war to alliance - 12h by default
204
-    'fleet_bashing_waves'          => 3,      // Max amount of waves per day - 3 by default
200
+    'fleet_bashing_attacks'        => 3, // Max amount of attack per wave - 3 by default
201
+    'fleet_bashing_interval'       => 1800, // Maximum interval between attacks when they still count as one wave - 30m by default
202
+    'fleet_bashing_scope'          => 86400, // Interval on which bashing waves counts - 24h by default
203
+    'fleet_bashing_war_delay'      => 43200, // Delay before start bashing after declaring war to alliance - 12h by default
204
+    'fleet_bashing_waves'          => 3, // Max amount of waves per day - 3 by default
205 205
 
206 206
     'Fleet_Cdr'   => 30,
207 207
     'fleet_speed' => 1,
@@ -209,8 +209,8 @@  discard block
 block discarded – undo
209 209
     'fleet_update_interval' => 4,
210 210
     'fleet_update_lock'     => '', // SQL time when lock was acquired
211 211
 
212
-    'game_adminEmail'       => 'root@localhost',    // Admin's email to show to users
213
-    'game_counter'          => 0,  // Does built-in page hit counter is on?
212
+    'game_adminEmail'       => 'root@localhost', // Admin's email to show to users
213
+    'game_counter'          => 0, // Does built-in page hit counter is on?
214 214
     // Defaults
215 215
     'game_default_language' => 'ru',
216 216
     'game_default_skin'     => 'skins/EpicBlue/',
@@ -224,14 +224,14 @@  discard block
 block discarded – undo
224 224
     'game_maxSystem'      => 199,
225 225
     'game_maxPlanet'      => 15,
226 226
     // Game global settings
227
-    'game_mode'           => 0,           // 0 - SuperNova, 1 - oGame
227
+    'game_mode'           => 0, // 0 - SuperNova, 1 - oGame
228 228
     'game_name'           => 'SuperNova', // Server name (would be on banners and on top of left menu)
229 229
 
230 230
     'game_news_actual'        => PERIOD_DAY_3, // How long announcement would be marked as "New". In seconds. Default - 3 days
231
-    'game_news_overview'      => 3,    // How much last news to show in Overview page
232
-    'game_news_overview_show' => PERIOD_WEEK_2,    // How long news will be shown in Overview page in seconds. Default - 2 weeks
231
+    'game_news_overview'      => 3, // How much last news to show in Overview page
232
+    'game_news_overview_show' => PERIOD_WEEK_2, // How long news will be shown in Overview page in seconds. Default - 2 weeks
233 233
     // Noob protection
234
-    'game_noob_factor'        => 5,    // Multiplier to divide "stronger" and "weaker" users
234
+    'game_noob_factor'        => 5, // Multiplier to divide "stronger" and "weaker" users
235 235
     'game_noob_points'        => 5000, // Below this point user threated as noob. 0 to disable
236 236
 
237 237
     'game_multiaccount_enabled' => 0, // 1 - allow interactions for players with same IP (multiaccounts)
@@ -285,12 +285,12 @@  discard block
 block discarded – undo
285 285
     'payment_currency_exchange_wmu' => 30,
286 286
     'payment_currency_exchange_wmz' => 1,
287 287
 
288
-    'payment_lot_price' => 1,     // Lot price in default currency
289
-    'payment_lot_size'  => 2500,  // Lot size. Also service as minimum amount of DM that could be bought with one transaction
288
+    'payment_lot_price' => 1, // Lot price in default currency
289
+    'payment_lot_size'  => 2500, // Lot size. Also service as minimum amount of DM that could be bought with one transaction
290 290
 
291 291
     'planet_capital_cost'          => 25000, // Cost in DM to move Capital to current planet
292
-    'planet_capital_mining_rate'   => 2.0,   // Capital Mining rates
293
-    'planet_capital_building_rate' => 2.0,   // Capital Building rates
292
+    'planet_capital_mining_rate'   => 2.0, // Capital Mining rates
293
+    'planet_capital_building_rate' => 2.0, // Capital Building rates
294 294
     'planet_teleport_cost'         => 50000, // Cost of planet teleportation
295 295
     'planet_teleport_timeout'      => 86400, // Timeout for next teleportation
296 296
 
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
     'resource_multiplier'     => 1,
313 313
 
314 314
     //Roleplay system
315
-    'rpg_bonus_divisor'       => 10,    // Amount of DM referral shoud get for partner have 1 DM bonus
315
+    'rpg_bonus_divisor'       => 10, // Amount of DM referral shoud get for partner have 1 DM bonus
316 316
     'rpg_bonus_minimum'       => 10000, // Minimum DM ammount for starting paying bonuses to affiliate
317 317
 
318 318
     // Black Market - General
Please login to merge, or discard this patch.
includes/general/formatters.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -112,10 +112,10 @@  discard block
 block discarded – undo
112 112
     $rexep = "#" . strtr(preg_quote($format), $masks) . "#";
113 113
     if (preg_match($rexep, $date, $out)) {
114 114
       $ret = array(
115
-        "tm_sec"  => (int)$out['S'],
116
-        "tm_min"  => (int)$out['M'],
117
-        "tm_hour" => (int)$out['H'],
118
-        "tm_mday" => (int)$out['d'],
115
+        "tm_sec"  => (int) $out['S'],
116
+        "tm_min"  => (int) $out['M'],
117
+        "tm_hour" => (int) $out['H'],
118
+        "tm_mday" => (int) $out['d'],
119 119
         "tm_mon"  => $out['m'] ? $out['m'] - 1 : 0,
120 120
         "tm_year" => $out['Y'] > 1900 ? $out['Y'] - 1900 : 0,
121 121
       );
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
  * @return int
151 151
  */
152 152
 function datePart($fullDate) {
153
-  return (int)strtotime(date('Y-m-d', $fullDate));
153
+  return (int) strtotime(date('Y-m-d', $fullDate));
154 154
 }
155 155
 
156 156
 
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
    * @return bool
179 179
    * @throws ErrorException
180 180
    */
181
-    function ($errno, $errstr, $errfile, $errline) {
181
+    function($errno, $errstr, $errfile, $errline) {
182 182
       throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
183 183
     }
184 184
   );
Please login to merge, or discard this patch.
admin/settings.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -8,8 +8,8 @@  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
 
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
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
   SN::$config->game_name               = sys_get_param_str_unsafe('game_name');
24 24
   SN::$config->game_mode               = sys_get_param_int('game_mode');
25 25
   SN::$config->game_speed              = sys_get_param_float('game_speed', 1);
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
   SN::$config->url_faq                 = sys_get_param_str_unsafe('url_faq');
30 30
   SN::$config->url_forum               = sys_get_param_str_unsafe('url_forum');
31 31
   SN::$config->url_rules               = sys_get_param_str_unsafe('url_rules');
32
-  SN::$config->url_purchase_metamatter         = sys_get_param_str_unsafe('url_purchase_metamatter');
32
+  SN::$config->url_purchase_metamatter = sys_get_param_str_unsafe('url_purchase_metamatter');
33 33
   SN::$config->game_disable            = sys_get_param_int('game_disable');
34 34
   SN::$config->game_disable_reason     = sys_get_param_str_unsafe('game_disable_reason');
35 35
   SN::$config->server_updater_check_auto = sys_get_param_int('server_updater_check_auto');
@@ -99,8 +99,8 @@  discard block
 block discarded – undo
99 99
   SN::$config->stats_schedule          = sys_get_param_str('stats_schedule');
100 100
 
101 101
   SN::$config->empire_mercenary_base_period = sys_get_param_int('empire_mercenary_base_period');
102
-  if(SN::$config->empire_mercenary_temporary != sys_get_param_int('empire_mercenary_temporary')) {
103
-    if(SN::$config->empire_mercenary_temporary) {
102
+  if (SN::$config->empire_mercenary_temporary != sys_get_param_int('empire_mercenary_temporary')) {
103
+    if (SN::$config->empire_mercenary_temporary) {
104 104
       DBStaticUnit::db_unit_list_admin_delete_mercenaries_finished();
105 105
     } else {
106 106
       DBStaticUnit::db_unit_list_admin_set_mercenaries_expire_time(SN::$config->empire_mercenary_base_period);
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 tpl_assign_select($template, 'ver_response', SN::$lang['adm_opt_ver_response'], 'ID', 'NAME');
151 151
 
152 152
 $lang_list = lng_get_list();
153
-foreach($lang_list as $lang_id => $lang_data) {
153
+foreach ($lang_list as $lang_id => $lang_data) {
154 154
   $template->assign_block_vars('game_languages', array(
155 155
     'ID'   => $lang_id,
156 156
     'NAME' => "{$lang_data['LANG_NAME_NATIVE']} ({$lang_data['LANG_NAME_ENGLISH']})",
Please login to merge, or discard this patch.
includes/alliance/ali_internal_admin_diplomacy.inc 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 use \DBAL\DbQuery;
4 4
 
5
-if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)
5
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)
6 6
 {
7 7
   $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
8 8
 }
@@ -17,28 +17,28 @@  discard block
 block discarded – undo
17 17
 $ally_name_safe = db_escape($user['ally_name']);
18 18
 
19 19
 $autoAccept = false;
20
-if(sys_get_param_str('ali_dip_offer_make'))
20
+if (sys_get_param_str('ali_dip_offer_make'))
21 21
 {
22 22
   $alliance_negotiation_relation = sys_get_param_str('alliance_negotiation_relation');
23
-  if(!array_key_exists($alliance_negotiation_relation, $sn_diplomacy_relation_list))
23
+  if (!array_key_exists($alliance_negotiation_relation, $sn_diplomacy_relation_list))
24 24
   {
25 25
     messageBox($lang['ali_dip_err_wrong_offer'], $page_title);
26 26
   }
27 27
 
28 28
   $alliance_negotiation_contr_ally_id = sys_get_param_id('alliance_negotiation_contr_ally_id');
29
-  if($alliance_negotiation_contr_ally_id == $user['ally_id'])
29
+  if ($alliance_negotiation_contr_ally_id == $user['ally_id'])
30 30
   {
31 31
     messageBox($lang['ali_dip_err_same_ally'], $page_title);
32 32
   }
33 33
 
34 34
   $contr_ally_row = doquery("SELECT `ally_name` FROM {{alliance}} WHERE `id` = {$alliance_negotiation_contr_ally_id} LIMIT 1;", '', true);
35
-  if(!$contr_ally_row)
35
+  if (!$contr_ally_row)
36 36
   {
37 37
     messageBox($lang['ali_dip_err_no_ally'], $page_title);
38 38
   }
39 39
 
40 40
   $relation_current_id = ali_relation($user['ally_id'], $alliance_negotiation_contr_ally_id);
41
-  if($alliance_negotiation_relation == $relation_current_id)
41
+  if ($alliance_negotiation_relation == $relation_current_id)
42 42
   {
43 43
     messageBox(sprintf($lang['ali_dip_err_offer_same'], $lang['ali_dip_relations'][$alliance_negotiation_relation]), $page_title);
44 44
   }
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
   $relation_new = $sn_diplomacy_relation_list[$alliance_negotiation_relation];
52 52
   $relation_current = $sn_diplomacy_relation_list[$relation_current_id];
53
-  if($relation_new['enter_delay'] == -1 || $relation_current['exit_delay'] == -1)
53
+  if ($relation_new['enter_delay'] == -1 || $relation_current['exit_delay'] == -1)
54 54
   {
55 55
     DbQuery::build()
56 56
       ->setTable('alliance_negotiation')
@@ -84,39 +84,39 @@  discard block
 block discarded – undo
84 84
 else
85 85
 {
86 86
   $offer_id = sys_get_param_id('offer_id');
87
-  if($offer_id)
87
+  if ($offer_id)
88 88
   {
89 89
     $offer_answer = sys_get_param_str('answer');
90 90
 
91 91
     $negotiation = doquery("SELECT * FROM {{alliance_negotiation}} WHERE alliance_negotiation_id = {$offer_id} LIMIT 1;", '', true);
92
-    if(!$negotiation)
92
+    if (!$negotiation)
93 93
     {
94 94
       messageBox($lang['ali_dip_err_offer_none'], $page_title);
95 95
     }
96
-    elseif($negotiation['alliance_negotiation_ally_id'] != $user['ally_id'] && $negotiation['alliance_negotiation_contr_ally_id'] != $user['ally_id'])
96
+    elseif ($negotiation['alliance_negotiation_ally_id'] != $user['ally_id'] && $negotiation['alliance_negotiation_contr_ally_id'] != $user['ally_id'])
97 97
     {
98 98
       // TODO: Add log of hack attempt
99 99
       messageBox($lang['ali_dip_err_offer_alien'], $page_title);
100 100
     }
101
-    elseif($negotiation['alliance_negotiation_ally_id'] == $user['ally_id'])
101
+    elseif ($negotiation['alliance_negotiation_ally_id'] == $user['ally_id'])
102 102
     {
103
-      if($offer_answer == 'accept')
103
+      if ($offer_answer == 'accept')
104 104
       {
105 105
         // TODO: Add log of hack attempt
106 106
         messageBox($lang['ali_dip_err_offer_accept_own'], $page_title);
107 107
       }
108
-      elseif($offer_answer == 'deny')
108
+      elseif ($offer_answer == 'deny')
109 109
       {
110 110
         doquery("DELETE FROM {{alliance_negotiation}} WHERE alliance_negotiation_id = {$offer_id} LIMIT 1;");
111 111
       }
112 112
     }
113 113
     else
114 114
     {
115
-      if($offer_answer == 'accept')
115
+      if ($offer_answer == 'accept')
116 116
       {
117 117
         $accept_offer = true;
118 118
       }
119
-      elseif($offer_answer == 'deny')
119
+      elseif ($offer_answer == 'deny')
120 120
       {
121 121
         DBStaticAlly::db_ally_negotiation_update_status_1($offer_id);
122 122
       }
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
   }
125 125
 }
126 126
 
127
-if($accept_offer)
127
+if ($accept_offer)
128 128
 {
129 129
   sn_db_transaction_start();
130 130
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
   sn_db_transaction_commit();
185 185
 }
186 186
 
187
-foreach($sn_diplomacy_relation_list as $diplomacy_relation_id => $diplomacy_relation)
187
+foreach ($sn_diplomacy_relation_list as $diplomacy_relation_id => $diplomacy_relation)
188 188
 {
189 189
   $template->assign_block_vars('relation', array(
190 190
     'ID'   => $diplomacy_relation_id,
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 }
194 194
 
195 195
 $query = doquery("SELECT id, ally_name, ally_tag FROM {{alliance}} WHERE `id` != {$user['ally_id']} ORDER BY ally_name;");
196
-while($alliance = db_fetch($query))
196
+while ($alliance = db_fetch($query))
197 197
 {
198 198
   $template->assign_block_vars('alliance', array(
199 199
     'ID'   => $alliance['id'],
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
   WHERE
213 213
     alliance_negotiation_ally_id = {$user['ally_id']} OR alliance_negotiation_contr_ally_id = {$user['ally_id']};"
214 214
 );
215
-while($offer = db_fetch($query))
215
+while ($offer = db_fetch($query))
216 216
 {
217 217
   $template->assign_block_vars('offer', array(
218 218
     'ID'       => $offer['alliance_negotiation_id'],
Please login to merge, or discard this patch.
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -67,8 +67,7 @@  discard block
 block discarded – undo
67 67
       ->doInsert();
68 68
 
69 69
     $accept_offer = false;
70
-  }
71
-  else
70
+  } else
72 71
   {
73 72
     $accept_offer = true;
74 73
     $autoAccept = true;
@@ -80,8 +79,7 @@  discard block
 block discarded – undo
80 79
       'alliance_negotiation_relation' => $alliance_negotiation_relation,
81 80
     );
82 81
   }
83
-}
84
-else
82
+} else
85 83
 {
86 84
   $offer_id = sys_get_param_id('offer_id');
87 85
   if($offer_id)
@@ -92,31 +90,26 @@  discard block
 block discarded – undo
92 90
     if(!$negotiation)
93 91
     {
94 92
       messageBox($lang['ali_dip_err_offer_none'], $page_title);
95
-    }
96
-    elseif($negotiation['alliance_negotiation_ally_id'] != $user['ally_id'] && $negotiation['alliance_negotiation_contr_ally_id'] != $user['ally_id'])
93
+    } elseif($negotiation['alliance_negotiation_ally_id'] != $user['ally_id'] && $negotiation['alliance_negotiation_contr_ally_id'] != $user['ally_id'])
97 94
     {
98 95
       // TODO: Add log of hack attempt
99 96
       messageBox($lang['ali_dip_err_offer_alien'], $page_title);
100
-    }
101
-    elseif($negotiation['alliance_negotiation_ally_id'] == $user['ally_id'])
97
+    } elseif($negotiation['alliance_negotiation_ally_id'] == $user['ally_id'])
102 98
     {
103 99
       if($offer_answer == 'accept')
104 100
       {
105 101
         // TODO: Add log of hack attempt
106 102
         messageBox($lang['ali_dip_err_offer_accept_own'], $page_title);
107
-      }
108
-      elseif($offer_answer == 'deny')
103
+      } elseif($offer_answer == 'deny')
109 104
       {
110 105
         doquery("DELETE FROM {{alliance_negotiation}} WHERE alliance_negotiation_id = {$offer_id} LIMIT 1;");
111 106
       }
112
-    }
113
-    else
107
+    } else
114 108
     {
115 109
       if($offer_answer == 'accept')
116 110
       {
117 111
         $accept_offer = true;
118
-      }
119
-      elseif($offer_answer == 'deny')
112
+      } elseif($offer_answer == 'deny')
120 113
       {
121 114
         DBStaticAlly::db_ally_negotiation_update_status_1($offer_id);
122 115
       }
Please login to merge, or discard this patch.