Completed
Push — work-fleets ( 6257a1...22b5bc )
by SuperNova.WS
06:47
created
includes/classes/core_auth.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
       // Проверить наличие такого имени в истории имён
223 223
       do {
224 224
         sn_db_transaction_rollback();
225
-        $this->player_suggested_name = 'Emperor ' . mt_rand($max_user_id + 1, $max_user_id + 1000);
225
+        $this->player_suggested_name = 'Emperor '.mt_rand($max_user_id + 1, $max_user_id + 1000);
226 226
         sn_db_transaction_start();
227 227
       } while (db_player_name_exists($this->player_suggested_name));
228 228
 
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
     if ($player_name_submitted) {
232 232
       $this->register_player_db_create($this->player_suggested_name); // OK 4.5
233 233
       if ($this->register_status == LOGIN_SUCCESS) {
234
-        sys_redirect(SN_ROOT_VIRTUAL . 'overview.php');
234
+        sys_redirect(SN_ROOT_VIRTUAL.'overview.php');
235 235
       } elseif ($this->register_status == REGISTER_ERROR_PLAYER_NAME_EXISTS && $original_suggest == $this->player_suggested_name) {
236 236
         // self::$player_suggested_name .= ' ' . $this->account->account_id;
237 237
       }
@@ -257,8 +257,8 @@  discard block
 block discarded – undo
257 257
       );
258 258
 
259 259
     if ($this->register_status == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) {
260
-      $prohibited_characters = array_map(function ($value) {
261
-        return "'" . htmlentities($value, ENT_QUOTES, 'UTF-8') . "'";
260
+      $prohibited_characters = array_map(function($value) {
261
+        return "'".htmlentities($value, ENT_QUOTES, 'UTF-8')."'";
262 262
       }, str_split(LOGIN_REGISTER_CHARACTERS_PROHIBITED));
263 263
       $template_result[F_PLAYER_REGISTER_MESSAGE] .= implode(', ', $prohibited_characters);
264 264
     }
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 
306 306
     foreach ($this->providers as $provider_id => $provider) {
307 307
       $login_status = $provider->login(); // OK v4.5
308
-      self::flog(($provider->manifest['name'] . '->' . 'login_try - ') . (empty($provider->account->account_id) ? classLocale::$lang['sys_login_messages'][$provider->account_login_status] : dump($provider)));
308
+      self::flog(($provider->manifest['name'].'->'.'login_try - ').(empty($provider->account->account_id) ? classLocale::$lang['sys_login_messages'][$provider->account_login_status] : dump($provider)));
309 309
       if ($login_status == LOGIN_SUCCESS && is_object($provider->account) && $provider->account instanceof Account && $provider->account->account_id) {
310 310
         $this->providers_authorised[$provider_id] = &$this->providers[$provider_id];
311 311
 
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
         if (!$this->is_player_register) {
346 346
           // Нет - отправляем на процесс регистрации
347 347
           $partner_id = sys_get_param_int('id_ref', sys_get_param_int('partner_id'));
348
-          sys_redirect(SN_ROOT_VIRTUAL . 'index.php?page=player_register&player_register=1' . ($partner_id ? '&id_ref=' . $partner_id : ''));
348
+          sys_redirect(SN_ROOT_VIRTUAL.'index.php?page=player_register&player_register=1'.($partner_id ? '&id_ref='.$partner_id : ''));
349 349
         }
350 350
       } else {
351 351
         // Да, есть доступные игроки, которые так же прописаны в базе
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
     }
406 406
 
407 407
     if ($redirect === true) {
408
-      sys_redirect(SN_ROOT_RELATIVE . (empty($_COOKIE[SN_COOKIE_U]) ? 'login.php' : 'admin/overview.php'));
408
+      sys_redirect(SN_ROOT_RELATIVE.(empty($_COOKIE[SN_COOKIE_U]) ? 'login.php' : 'admin/overview.php'));
409 409
     } elseif ($redirect !== false) {
410 410
       sys_redirect($redirect);
411 411
     }
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
         $user['vacation'] = SN_TIME_NOW;
694 694
       }
695 695
 
696
-      $user['user_lastip'] = self::$device->ip_v4_string;// $ip['ip'];
696
+      $user['user_lastip'] = self::$device->ip_v4_string; // $ip['ip'];
697 697
       $user['user_proxy'] = self::$device->ip_v4_proxy_chain; //$ip['proxy_chain'];
698 698
 
699 699
       $result[F_BANNED_STATUS] = $user['banaday'];
@@ -701,9 +701,9 @@  discard block
 block discarded – undo
701 701
 
702 702
       $proxy_safe = static::$db->db_escape(self::$device->ip_v4_proxy_chain);
703 703
 
704
-      DBStaticUser::db_user_set_by_id_DEPRECATED($user['id'], "`onlinetime` = " . SN_TIME_NOW . ",
705
-      `banaday` = " . static::$db->db_escape($user['banaday']) . ", `vacation` = " . static::$db->db_escape($user['vacation']) . ",
706
-      `user_lastip` = '" . static::$db->db_escape($user['user_lastip']) . "', `user_last_proxy` = '{$proxy_safe}', `user_last_browser_id` = " . self::$device->browser_id
704
+      DBStaticUser::db_user_set_by_id_DEPRECATED($user['id'], "`onlinetime` = ".SN_TIME_NOW.",
705
+      `banaday` = " . static::$db->db_escape($user['banaday']).", `vacation` = ".static::$db->db_escape($user['vacation']).",
706
+      `user_lastip` = '" . static::$db->db_escape($user['user_lastip'])."', `user_last_proxy` = '{$proxy_safe}', `user_last_browser_id` = ".self::$device->browser_id
707 707
       );
708 708
     }
709 709
 
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
    */
797 797
   // OK v4
798 798
   public static function password_encode($password, $salt) {
799
-    return md5($password . $salt);
799
+    return md5($password.$salt);
800 800
   }
801 801
   /**
802 802
    * Генерирует соль
@@ -822,10 +822,10 @@  discard block
 block discarded – undo
822 822
     }
823 823
     list($called, $caller) = debug_backtrace(false);
824 824
     $caller_name =
825
-      (!empty($caller['class']) ? $caller['class'] : '') .
826
-      (!empty($caller['type']) ? $caller['type'] : '') .
827
-      (!empty($caller['function']) ? $caller['function'] : '') .
828
-      (!empty($called['line']) ? ':' . $called['line'] : '');
825
+      (!empty($caller['class']) ? $caller['class'] : '').
826
+      (!empty($caller['type']) ? $caller['type'] : '').
827
+      (!empty($caller['function']) ? $caller['function'] : '').
828
+      (!empty($called['line']) ? ':'.$called['line'] : '');
829 829
 
830 830
     $_SERVER['SERVER_NAME'] == 'localhost' ? print("<div class='debug'>$message - $caller_name\r\n</div>") : false;
831 831
 
@@ -833,7 +833,7 @@  discard block
 block discarded – undo
833 833
     if ($die) {
834 834
       // pdump($caller);
835 835
       // pdump(debug_backtrace(false));
836
-      $die && die("<div class='negative'>СТОП! Функция {$caller_name} при вызове в " . get_called_class() . " (располагается в " . get_class() . "). СООБЩИТЕ АДМИНИСТРАЦИИ!</div>");
836
+      $die && die("<div class='negative'>СТОП! Функция {$caller_name} при вызове в ".get_called_class()." (располагается в ".get_class()."). СООБЩИТЕ АДМИНИСТРАЦИИ!</div>");
837 837
     }
838 838
   }
839 839
 
Please login to merge, or discard this patch.
includes/classes/DBStaticAlly.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -72,12 +72,12 @@
 block discarded – undo
72 72
    */
73 73
   public static function db_ally_insert($ally_name_unsafe, $ally_tag_unsafe, $userId) {
74 74
     $ally = classSupernova::$db->doInsertSet(TABLE_ALLIANCE, array(
75
-      'ally_name'          => (string)$ally_name_unsafe,
76
-      'ally_tag'           => (string)$ally_tag_unsafe,
75
+      'ally_name'          => (string) $ally_name_unsafe,
76
+      'ally_tag'           => (string) $ally_tag_unsafe,
77 77
       'ally_owner'         => $userId,
78
-      'ally_owner_range'   => (string)classLocale::$lang['ali_leaderRank'],
79
-      'ally_members'       => (int)1,
80
-      'ranklist'           => (string)(classLocale::$lang['ali_defaultRankName'] . ",0,0,0,0,0"),
78
+      'ally_owner_range'   => (string) classLocale::$lang['ali_leaderRank'],
79
+      'ally_members'       => (int) 1,
80
+      'ranklist'           => (string) (classLocale::$lang['ali_defaultRankName'].",0,0,0,0,0"),
81 81
       'ally_register_time' => SN_TIME_NOW,
82 82
     ));
83 83
 
Please login to merge, or discard this patch.
includes/functions/_news.php 1 patch
Spacing   +15 added lines, -16 removed lines patch added patch discarded remove patch
@@ -11,15 +11,15 @@  discard block
 block discarded – undo
11 11
   $announce_list = DBStaticNews::db_news_list_get_by_query($template, $query_where, $query_limit);
12 12
 
13 13
   $users = array();
14
-  while($announce = db_fetch($announce_list)) {
15
-    if($announce['user_id'] && !isset($users[$announce['user_id']])) {
14
+  while ($announce = db_fetch($announce_list)) {
15
+    if ($announce['user_id'] && !isset($users[$announce['user_id']])) {
16 16
       $users[$announce['user_id']] = DBStaticUser::db_user_by_id($announce['user_id']);
17 17
     }
18 18
 
19 19
     $survey_vote = array('survey_vote_id' => 1);
20 20
     $survey_complete = strtotime($announce['survey_until']) < SN_TIME_NOW;
21 21
 
22
-    if($announce['survey_id'] && !empty($user['id'])) {
22
+    if ($announce['survey_id'] && !empty($user['id'])) {
23 23
       $survey_vote = !$survey_complete ? DBStaticSurveyVote::db_survey_get_vote($announce, $user) : array();
24 24
     }
25 25
 
@@ -31,8 +31,7 @@  discard block
 block discarded – undo
31 31
       'ANNOUNCE'        => cht_message_parse($announce['strAnnounce'], false, intval($announce['authlevel'])),
32 32
       'DETAIL_URL'      => $announce['detail_url'],
33 33
       'USER_NAME'       =>
34
-        isset($users[$announce['user_id']]) && $users[$announce['user_id']] ? player_nick_render_to_html($users[$announce['user_id']], array('color' => true)) :
35
-          js_safe_string($announce['user_name']),
34
+        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']),
36 35
       'NEW'             => $announce['unix_time'] + classSupernova::$config->game_news_actual >= SN_TIME_NOW,
37 36
       'FUTURE'          => $announce['unix_time'] > SN_TIME_NOW,
38 37
       'SURVEY_ID'       => $announce['survey_id'],
@@ -42,25 +41,25 @@  discard block
 block discarded – undo
42 41
       'SURVEY_UNTIL'    => $announce['survey_until'],
43 42
     ));
44 43
 
45
-    foreach($announce_exploded as $announce_paragraph) {
44
+    foreach ($announce_exploded as $announce_paragraph) {
46 45
       $template->assign_block_vars('announces.paragraph', array(
47 46
         'TEXT' => $announce_paragraph,
48 47
       ));
49 48
     }
50 49
 
51
-    if($announce['survey_id']) {
50
+    if ($announce['survey_id']) {
52 51
       $survey_query = DBStaticSurveyAnswer::db_survey_get_answer_texts($announce);
53 52
       $survey_vote_result = array();
54 53
       $total_votes = 0;
55
-      while($row = db_fetch($survey_query)) {
54
+      while ($row = db_fetch($survey_query)) {
56 55
         $survey_vote_result[] = $row;
57 56
         $total_votes += $row['VOTES'];
58 57
       }
59 58
 
60
-      if(empty($survey_vote) && !$survey_complete) {
59
+      if (empty($survey_vote) && !$survey_complete) {
61 60
         // Can vote
62 61
         $survey_query = DBStaticSurveyAnswer::db_survey_answers_get_list_by_parent($announce);
63
-        while($row = db_fetch($survey_query)) {
62
+        while ($row = db_fetch($survey_query)) {
64 63
           $template->assign_block_vars('announces.survey_answers', array(
65 64
             'ID'   => $row['survey_answer_id'],
66 65
             'TEXT' => $row['survey_answer_text'],
@@ -68,7 +67,7 @@  discard block
 block discarded – undo
68 67
         }
69 68
       } else {
70 69
         // Show result
71
-        foreach($survey_vote_result as &$vote_result) {
70
+        foreach ($survey_vote_result as &$vote_result) {
72 71
           $vote_percent = $total_votes ? $vote_result['VOTES'] / $total_votes * 100 : 0;
73 72
           $vote_result['PERCENT'] = $vote_percent;
74 73
           $vote_result['PERCENT_TEXT'] = round($vote_percent, 1);
@@ -85,8 +84,8 @@  discard block
 block discarded – undo
85 84
 }
86 85
 
87 86
 function nws_mark_read(&$user) {
88
-  if(isset($user['id'])) {
89
-    DBStaticUser::db_user_set_by_id_DEPRECATED($user['id'], '`news_lastread` = ' . SN_TIME_NOW);
87
+  if (isset($user['id'])) {
88
+    DBStaticUser::db_user_set_by_id_DEPRECATED($user['id'], '`news_lastread` = '.SN_TIME_NOW);
90 89
     $user['news_lastread'] = SN_TIME_NOW;
91 90
   }
92 91
 
@@ -94,17 +93,17 @@  discard block
 block discarded – undo
94 93
 }
95 94
 
96 95
 function survey_vote(&$user) {
97
-  if(empty($user['id'])) {
96
+  if (empty($user['id'])) {
98 97
     return true;
99 98
   }
100 99
 
101 100
   sn_db_transaction_start();
102 101
   $survey_id = sys_get_param_id('survey_id');
103 102
   $is_voted = DBStaticSurveyVote::db_survey_vote_get($user, $survey_id);
104
-  if(empty($is_voted)) {
103
+  if (empty($is_voted)) {
105 104
     $survey_vote_id = sys_get_param_id('survey_vote');
106 105
     $is_answer_exists = DBStaticSurveyAnswer::db_survey_answer_get($survey_id, $survey_vote_id);
107
-    if(!empty($is_answer_exists)) {
106
+    if (!empty($is_answer_exists)) {
108 107
       DBStaticSurveyVote::db_survey_vote_insert($survey_id, $survey_vote_id, $user['id'], $user['username']);
109 108
     }
110 109
   }
Please login to merge, or discard this patch.
includes/functions/sys_user.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 use Vector\Vector;
8 8
 
9 9
 function sys_user_vacation($user) {
10
-  if(sys_get_param_str('vacation') == 'leave') {
10
+  if (sys_get_param_str('vacation') == 'leave') {
11 11
     if ($user['vacation'] < SN_TIME_NOW) {
12 12
       $user['vacation'] = 0;
13 13
       $user['vacation_next'] = SN_TIME_NOW + classSupernova::$config->player_vacation_timeout;
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
     }
16 16
   }
17 17
 
18
-  if($user['vacation']) {
18
+  if ($user['vacation']) {
19 19
     // sn_sys_logout(false, true);
20 20
     // core_auth::logout(false, true);
21 21
 
@@ -45,10 +45,10 @@  discard block
 block discarded – undo
45 45
   // TODO: Full rewrite
46 46
   sn_db_transaction_start();
47 47
   $TheUser = DBStaticUser::db_user_by_id($UserID);
48
-  if ( $TheUser['ally_id'] != 0 ) {
49
-    $TheAlly = classSupernova::$db->doSelectFetch("SELECT * FROM `{{alliance}}` WHERE `id` = '" . $TheUser['ally_id'] . "';");
48
+  if ($TheUser['ally_id'] != 0) {
49
+    $TheAlly = classSupernova::$db->doSelectFetch("SELECT * FROM `{{alliance}}` WHERE `id` = '".$TheUser['ally_id']."';");
50 50
     $TheAlly['ally_members'] -= 1;
51
-    if ( $TheAlly['ally_members'] > 0 ) {
51
+    if ($TheAlly['ally_members'] > 0) {
52 52
       classSupernova::$db->doUpdateRowSet(
53 53
         TABLE_ALLIANCE,
54 54
         array(
@@ -69,10 +69,10 @@  discard block
 block discarded – undo
69 69
 
70 70
   classSupernova::$gc->db->doDeleteWhere(TABLE_MESSAGES, array('message_owner' => $UserID,));
71 71
   classSupernova::$gc->db->doDeleteWhere(TABLE_MESSAGES, array('message_sender' => $UserID,));
72
-  classSupernova::$gc->db->doDeleteWhere(TABLE_NOTES, array('owner' => $UserID ,));
72
+  classSupernova::$gc->db->doDeleteWhere(TABLE_NOTES, array('owner' => $UserID,));
73 73
   FleetList::db_fleet_list_delete_by_owner($UserID);
74
-  classSupernova::$gc->db->doDeleteWhere(TABLE_BUDDY, array('BUDDY_SENDER_ID' => $UserID ,));
75
-  classSupernova::$gc->db->doDeleteWhere(TABLE_BUDDY, array('BUDDY_OWNER_ID' => $UserID ,));
74
+  classSupernova::$gc->db->doDeleteWhere(TABLE_BUDDY, array('BUDDY_SENDER_ID' => $UserID,));
75
+  classSupernova::$gc->db->doDeleteWhere(TABLE_BUDDY, array('BUDDY_OWNER_ID' => $UserID,));
76 76
 
77 77
 
78 78
   classSupernova::$gc->cacheOperator->db_del_record_by_id(LOC_USER, $UserID);
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
   $ban_current = DBStaticUser::db_user_by_id($banned['id'], false, 'banaday');
94 94
   $ban_until = ($ban_current['banaday'] ? $ban_current['banaday'] : SN_TIME_NOW) + $term;
95 95
 
96
-  DBStaticUser::db_user_set_by_id_DEPRECATED($banned['id'], "`banaday` = {$ban_until} " . ($is_vacation ? ", `vacation` = '{$ban_until}' " : ''));
96
+  DBStaticUser::db_user_set_by_id_DEPRECATED($banned['id'], "`banaday` = {$ban_until} ".($is_vacation ? ", `vacation` = '{$ban_until}' " : ''));
97 97
 
98 98
   classSupernova::$db->doInsertSet(TABLE_BANNED, array(
99 99
     'ban_user_id'      => $banned['id'],
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
  * @param string $reasonUnsafe
119 119
  */
120 120
 function sys_admin_player_ban_unset($banner, $banned, $reasonUnsafe = '') {
121
-  DBStaticUser::db_user_set_by_id_DEPRECATED($banned['id'], "`banaday` = 0, `vacation` = " . SN_TIME_NOW . "");
121
+  DBStaticUser::db_user_set_by_id_DEPRECATED($banned['id'], "`banaday` = 0, `vacation` = ".SN_TIME_NOW."");
122 122
 
123 123
   return classSupernova::$db->doInsertSet(TABLE_BANNED, array(
124 124
     'ban_user_id'      => $banned['id'],
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 
154 154
     'total_points' => $options['total_points'] = empty($options['total_points']) ? 0 : $options['total_points'],
155 155
 
156
-    'options' => (empty($options['options']) ? $player_options_string : $options['options']) . (empty($options['options_extra']) ? '' : $options['options_extra']),
156
+    'options' => (empty($options['options']) ? $player_options_string : $options['options']).(empty($options['options_extra']) ? '' : $options['options_extra']),
157 157
 
158 158
     'galaxy' => $options['galaxy'] = intval($options['galaxy'] ? $options['galaxy'] : 0),
159 159
     'system' => $options['system'] = intval($options['system'] ? $options['system'] : 0),
@@ -164,28 +164,28 @@  discard block
 block discarded – undo
164 164
   !empty($options['password_encoded_unsafe']) ? $field_set['password'] = $options['password_encoded_unsafe'] : false;
165 165
 
166 166
   $user_new = classSupernova::$gc->cacheOperator->db_ins_field_set(LOC_USER, $field_set);
167
-  if(!($options['galaxy'] && $options['system'] && $options['planet'])) {
167
+  if (!($options['galaxy'] && $options['system'] && $options['planet'])) {
168 168
     $options['galaxy'] = classSupernova::$config->LastSettedGalaxyPos;
169 169
     $options['system'] = classSupernova::$config->LastSettedSystemPos;
170
-    $segment_size = floor(Vector::$knownPlanets/ 3);
170
+    $segment_size = floor(Vector::$knownPlanets / 3);
171 171
     $segment = floor(classSupernova::$config->LastSettedPlanetPos / $segment_size);
172 172
     $segment++;
173 173
     $options['planet'] = mt_rand(1 + $segment * $segment_size, ($segment + 1) * $segment_size);
174 174
 
175 175
     // $new_planet_id = 0;
176
-    while(true) {
177
-      if($options['planet'] > Vector::$knownPlanets) {
176
+    while (true) {
177
+      if ($options['planet'] > Vector::$knownPlanets) {
178 178
         $options['planet'] = mt_rand(0, $segment_size - 1) + 1;
179 179
         $options['system']++;
180 180
       }
181
-      if($options['system'] > Vector::$knownSystems) {
181
+      if ($options['system'] > Vector::$knownSystems) {
182 182
         $options['system'] = 1;
183 183
         $options['galaxy']++;
184 184
       }
185
-      $options['galaxy'] > Vector::$knownGalaxies? $options['galaxy'] = 1 : false;
185
+      $options['galaxy'] > Vector::$knownGalaxies ? $options['galaxy'] = 1 : false;
186 186
 
187 187
       $galaxy_row = DBStaticPlanet::db_planet_by_gspt($options['galaxy'], $options['system'], $options['planet'], PT_PLANET, true, 'id');
188
-      if(!$galaxy_row['id']) {
188
+      if (!$galaxy_row['id']) {
189 189
         classSupernova::$config->db_saveItem(array(
190 190
           'LastSettedGalaxyPos' => $options['galaxy'],
191 191
           'LastSettedSystemPos' => $options['system'],
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 
208 208
   db_player_name_history_replace($user_new['id'], $username_unsafe);
209 209
 
210
-  if(!empty($options['partner_id']) && ($referral_row = DBStaticUser::db_user_by_id($options['partner_id'], true))) {
210
+  if (!empty($options['partner_id']) && ($referral_row = DBStaticUser::db_user_by_id($options['partner_id'], true))) {
211 211
     db_referral_insert($options['partner_id'], $user_new['id']);
212 212
   }
213 213
 
Please login to merge, or discard this patch.
includes/alliance/ali_external_create_ally.inc 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 // Pretty Safe
3 3
 // TODO: Add ally_tag to usertable
4 4
 
5
-if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
5
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
6 6
   classSupernova::$debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
7 7
 }
8 8
 
@@ -11,22 +11,22 @@  discard block
 block discarded – undo
11 11
 $ally_name_unsafe = sys_get_param_str_unsafe('name');
12 12
 $ally_name = db_escape($ally_name_unsafe);
13 13
 
14
-if($ally_tag) {
15
-  if(!$ally_name_unsafe || !$ally_tag_unsafe) {
14
+if ($ally_tag) {
15
+  if (!$ally_name_unsafe || !$ally_tag_unsafe) {
16 16
     message(classLocale::$lang['have_not_name'], classLocale::$lang['make_alliance']);
17 17
   }
18 18
 
19 19
   $query = DBStaticAlly::db_ally_get_by_name_or_tag($ally_tag, $ally_name);
20
-  if($query) {
20
+  if ($query) {
21 21
     message(str_replace('%s', $query['ally_tag'] == $ally_tag_unsafe ? $ally_tag_unsafe : $ally_name_unsafe, classLocale::$lang['always_exist']), classLocale::$lang['make_alliance']);
22 22
   }
23 23
 
24 24
   DBStaticAlly::db_ally_insert($ally_name_unsafe, $ally_tag_unsafe, $user['id']);
25 25
   $ally_id = classSupernova::$db->db_insert_id();
26
-  DBStaticUser::db_user_set_by_id_DEPRECATED($user['id'], "`ally_tag` = '{$ally_tag}', `ally_id`= {$ally_id}, `ally_name`='{$ally_name}', `ally_register_time`= " . SN_TIME_NOW . "");
26
+  DBStaticUser::db_user_set_by_id_DEPRECATED($user['id'], "`ally_tag` = '{$ally_tag}', `ally_id`= {$ally_id}, `ally_name`='{$ally_name}', `ally_register_time`= ".SN_TIME_NOW."");
27 27
 
28 28
   $ally_user = classSupernova::$gc->cacheOperator->db_ins_record(LOC_USER, array(
29
-    'username'      => "[" . $ally_tag_unsafe . "]",
29
+    'username'      => "[".$ally_tag_unsafe."]",
30 30
     'register_time' => SN_TIME_NOW,
31 31
     'user_as_ally'  => $ally_id,
32 32
   ));
Please login to merge, or discard this patch.
includes/alliance/ali_internal_admin_request.inc 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
3
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
4 4
   classSupernova::$debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
5 5
 }
6 6
 
@@ -8,16 +8,16 @@  discard block
 block discarded – undo
8 8
   message(classLocale::$lang['Denied_access'], classLocale::$lang['requests_admin']);
9 9
 }
10 10
 
11
-if($d = sys_get_param_id('d')) {
11
+if ($d = sys_get_param_id('d')) {
12 12
   DBStaticAlly::db_ally_request_deny($d);
13 13
 }
14 14
 
15 15
 $id_user = sys_get_param_id('id_user');
16 16
 
17
-if($id_user) {
17
+if ($id_user) {
18 18
   $ally_name_safe = db_escape($ally['ally_name']);
19 19
   $ally_tag_safe = db_escape($ally['ally_tag']);
20
-  DBStaticUser::db_user_set_by_id_DEPRECATED($id_user, "`ally_id` = '{$ally['id']}', `ally_name` = '{$ally_name_safe}', `ally_tag` = '{$ally_tag_safe}', `ally_register_time` = " . SN_TIME_NOW . ", `ally_rank_id` = 0");
20
+  DBStaticUser::db_user_set_by_id_DEPRECATED($id_user, "`ally_id` = '{$ally['id']}', `ally_name` = '{$ally_name_safe}', `ally_tag` = '{$ally_tag_safe}', `ally_register_time` = ".SN_TIME_NOW.", `ally_rank_id` = 0");
21 21
   classSupernova::$db->doUpdateRowAdjust(
22 22
     TABLE_ALLIANCE,
23 23
     array(),
Please login to merge, or discard this patch.
includes/alliance/ali_internal_admin.inc 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
3
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
4 4
   classSupernova::$debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
5 5
 }
6 6
 
7
-if(!$user_admin) {
7
+if (!$user_admin) {
8 8
   message(classLocale::$lang['Denied_access'], classLocale::$lang['ally_admin']);
9 9
 }
10 10
 
@@ -20,27 +20,27 @@  discard block
 block discarded – undo
20 20
 $allyTextID = ($allyTextID < 1 || $allyTextID > 3) ? 1 : $allyTextID;
21 21
 
22 22
 
23
-if(sys_get_param_str('isSaveOptions')) {
23
+if (sys_get_param_str('isSaveOptions')) {
24 24
   require_once('includes/includes/sys_avatar.php');
25 25
 
26 26
   $fieldChange = array();
27
-  if(($new_tag = sys_get_param_str_unsafe('tag', $ally['ally_tag'])) != $ally['ally_tag']) {
27
+  if (($new_tag = sys_get_param_str_unsafe('tag', $ally['ally_tag'])) != $ally['ally_tag']) {
28 28
     $fieldChange['ally_tag'] = $new_tag;
29
-    DBStaticUser::db_user_set_by_id_DEPRECATED($ally['ally_user_id'], "`username`='[" . db_escape($new_tag) . "]'");
29
+    DBStaticUser::db_user_set_by_id_DEPRECATED($ally['ally_user_id'], "`username`='[".db_escape($new_tag)."]'");
30 30
   }
31
-  if(($new_name = sys_get_param_str_unsafe('name', $ally['ally_name'])) != $ally['ally_name']) {
31
+  if (($new_name = sys_get_param_str_unsafe('name', $ally['ally_name'])) != $ally['ally_name']) {
32 32
     $fieldChange['ally_name'] = $new_name;
33 33
   }
34 34
 
35
-  if(($new_owner_rank = sys_get_param_str_unsafe('owner_range', $ally['ally_owner_range'])) != $ally['ally_owner_range']) {
35
+  if (($new_owner_rank = sys_get_param_str_unsafe('owner_range', $ally['ally_owner_range'])) != $ally['ally_owner_range']) {
36 36
     $fieldChange['ally_owner_range'] = $new_owner_rank;
37 37
   }
38 38
 
39
-  if(($new_web = sys_get_param_str_unsafe('web', $ally['ally_web'])) != $ally['ally_web']) {
39
+  if (($new_web = sys_get_param_str_unsafe('web', $ally['ally_web'])) != $ally['ally_web']) {
40 40
     $fieldChange['ally_web'] = $new_web;
41 41
   }
42 42
 
43
-  if(($new_request = sys_get_param_int('request_notallow', $ally['ally_request_notallow'])) != $ally['ally_request_notallow']) {
43
+  if (($new_request = sys_get_param_int('request_notallow', $ally['ally_request_notallow'])) != $ally['ally_request_notallow']) {
44 44
     $fieldChange['ally_request_notallow'] = sys_get_param_int('request_notallow', $ally['ally_request_notallow']);
45 45
   }
46 46
 
@@ -50,11 +50,11 @@  discard block
 block discarded – undo
50 50
     'AVATAR_UPLOAD_STATUS'  => $avatar_upload_result['STATUS'],
51 51
     'AVATAR_UPLOAD_MESSAGE' => $avatar_upload_result['MESSAGE'],
52 52
   ));
53
-  if($new_image != $ally['ally_image']) {
53
+  if ($new_image != $ally['ally_image']) {
54 54
     $fieldChange['ally_image'] = $new_image;
55 55
   }
56 56
 
57
-  if(!empty($fieldChange)) {
57
+  if (!empty($fieldChange)) {
58 58
     classSupernova::$db->doUpdateRowSet(
59 59
       TABLE_ALLIANCE,
60 60
       $fieldChange,
@@ -65,17 +65,17 @@  discard block
 block discarded – undo
65 65
 
66 66
     sys_redirect('alliance.php?mode=admin&edit=ally');
67 67
   }
68
-} elseif(sys_get_param_str('isSaveText')) {
68
+} elseif (sys_get_param_str('isSaveText')) {
69 69
   $text_unsafe = sys_get_param_str_unsafe('text');
70 70
   DBStaticAlly::db_ally_update_texts($text_unsafe, $ally['id'], $text_list[$allyTextID]['db_field']);
71 71
   $ally[$text_list[$allyTextID]['db_field']] = db_escape($text_unsafe);
72
-} elseif(sys_get_param_str('isTransfer') && $idNewLeader = sys_get_param_id('idNewLeader')) {
73
-  if(!$isAllyOwner) {
72
+} elseif (sys_get_param_str('isTransfer') && $idNewLeader = sys_get_param_id('idNewLeader')) {
73
+  if (!$isAllyOwner) {
74 74
     message(classLocale::$lang['Denied_access'], classLocale::$lang['ally_admin']);
75 75
   }
76 76
 
77 77
   $newLeader = DBStaticUser::db_user_by_id($idNewLeader, false, `ally_id`);
78
-  if($newLeader['ally_id'] == $user['ally_id']) {
78
+  if ($newLeader['ally_id'] == $user['ally_id']) {
79 79
     sn_db_transaction_start();
80 80
     DBStaticUser::db_user_set_by_id_DEPRECATED($user['id'], "`ally_rank_id`='0'");
81 81
     DBStaticAlly::db_ally_update_owner($idNewLeader, $user['ally_id']);
@@ -83,8 +83,8 @@  discard block
 block discarded – undo
83 83
     sn_db_transaction_commit();
84 84
     sys_redirect('alliance.php');
85 85
   }
86
-} elseif(sys_get_param_str('isDisband') && sys_get_param_str('isConfirmDisband')) {
87
-  if(!$isAllyOwner) {
86
+} elseif (sys_get_param_str('isDisband') && sys_get_param_str('isConfirmDisband')) {
87
+  if (!$isAllyOwner) {
88 88
     message(classLocale::$lang['Denied_access'], classLocale::$lang['ally_admin']);
89 89
   }
90 90
   sn_db_transaction_start();
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 $request = DBStaticAlly::db_ally_request_count_by_id($ally);
98 98
 
99 99
 $template->assign_vars(array(
100
-  'request_count'           => $request['request_count'] ? classLocale::$lang['ali_req_requestCount'] . ': ' . intval($request['request_count']) . '. ' . classLocale::$lang['ali_req_check'] : classLocale::$lang['ali_req_emptyList'],
100
+  'request_count'           => $request['request_count'] ? classLocale::$lang['ali_req_requestCount'].': '.intval($request['request_count']).'. '.classLocale::$lang['ali_req_check'] : classLocale::$lang['ali_req_emptyList'],
101 101
   'text'                    => $ally[$text_list[$allyTextID]['db_field']],
102 102
   'request_type'            => classLocale::$lang[$text_list[$allyTextID]['text_type']],
103 103
   't'                       => $allyTextID,
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
   $userAllyAdmins = DBStaticUser::db_user_list("`ally_id`= {$ally['id']}", false, '`id`, `username`');
131 131
   unset($tmp);
132 132
   // while ($userAllyAdmin = db_fetch($userAllyAdmins))
133
-  foreach($userAllyAdmins as $userAllyAdmin) {
133
+  foreach ($userAllyAdmins as $userAllyAdmin) {
134 134
 // pdump($userAllyAdmin);
135 135
     $tmp .= "<option value={$userAllyAdmin['id']}>{$userAllyAdmin['username']}</option>";
136 136
   }
@@ -138,8 +138,8 @@  discard block
 block discarded – undo
138 138
   $template->assign_var('adminMembers', $tmp);
139 139
 }
140 140
 
141
-foreach($sn_ali_admin_internal as $sn_ali_admin_action => $sn_ali_admin_action_locale) {
142
-  if(!$sn_ali_admin_action_locale['title']) {
141
+foreach ($sn_ali_admin_internal as $sn_ali_admin_action => $sn_ali_admin_action_locale) {
142
+  if (!$sn_ali_admin_action_locale['title']) {
143 143
     continue;
144 144
   }
145 145
   $template->assign_block_vars('admin_actions', array(
Please login to merge, or discard this patch.
includes/includes/flt_page4.inc 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -2,28 +2,28 @@  discard block
 block discarded – undo
2 2
 
3 3
 $classLocale = classLocale::$lang;
4 4
 
5
-if(SN_IN_FLEET !== true) {
5
+if (SN_IN_FLEET !== true) {
6 6
   classSupernova::$debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403);
7 7
 }
8 8
 
9 9
 $fleetid = sys_get_param_id('fleetid');
10 10
 
11
-if(!is_numeric($fleetid) || empty($fleetid)) {
11
+if (!is_numeric($fleetid) || empty($fleetid)) {
12 12
   header("Location: fleet.php");
13 13
   exit();
14 14
 }
15 15
 
16 16
 $objFleet = new Fleet();
17 17
 $objFleet->dbLoad($fleetid);
18
-if(!$objFleet->dbId) {
18
+if (!$objFleet->dbId) {
19 19
   message(classLocale::$lang['fl_fleet_not_exists'], classLocale::$lang['fl_error']);
20 20
 }
21 21
 
22
-if($objFleet->time_arrive_to_target <= SN_TIME_NOW || $objFleet->time_return_to_source < SN_TIME_NOW || $objFleet->isReturning()) {
22
+if ($objFleet->time_arrive_to_target <= SN_TIME_NOW || $objFleet->time_return_to_source < SN_TIME_NOW || $objFleet->isReturning()) {
23 23
   message(classLocale::$lang['fl_isback'], classLocale::$lang['fl_error']);
24 24
 }
25 25
 
26
-if($objFleet->playerOwnerId != $user['id']) {
26
+if ($objFleet->playerOwnerId != $user['id']) {
27 27
   classSupernova::$debug->warning(classLocale::$lang['fl_aks_hack_wrong_fleet'], 'Wrong Fleet Owner', 301);
28 28
   message(classLocale::$lang['fl_aks_hack_wrong_fleet'], classLocale::$lang['fl_error']);
29 29
 }
@@ -34,19 +34,19 @@  discard block
 block discarded – undo
34 34
 
35 35
 !$aks && !$userToAdd_unsafe ? $userToAdd_unsafe = $user['username'] : false;
36 36
 
37
-if($userToAdd_unsafe) {
37
+if ($userToAdd_unsafe) {
38 38
   $userToAdd = db_escape($userToAdd_unsafe);
39 39
   $userToAddID = DBStaticUser::db_user_by_username($userToAdd_unsafe, false, 'id', true, true);
40 40
   $userToAddID = $userToAddID['id'];
41 41
 
42
-  if($objFleet->target_owner_id == $userToAddID) {
42
+  if ($objFleet->target_owner_id == $userToAddID) {
43 43
     message(classLocale::$lang['flt_aks_player_same'], classLocale::$lang['fl_error']);
44 44
   }
45 45
 
46
-  if($userToAddID) {
47
-    if(!$aks) {
46
+  if ($userToAddID) {
47
+    if (!$aks) {
48 48
       // No AСS exists - making one
49
-      if(!$objFleet->group_id) {
49
+      if (!$objFleet->group_id) {
50 50
         DBStaticFleetACS::db_acs_insert($fleetid, $user['id'], $objFleet);
51 51
 
52 52
         $aks = DBStaticFleetACS::db_acs_get_by_fleet($fleetid);
@@ -61,24 +61,24 @@  discard block
 block discarded – undo
61 61
 
62 62
     $isUserExists = false;
63 63
     $invited_ar = explode(",", $aks['eingeladen']);
64
-    foreach($invited_ar as $inv) {
65
-      if($userToAddID == $inv) {
64
+    foreach ($invited_ar as $inv) {
65
+      if ($userToAddID == $inv) {
66 66
         $isUserExists = true;
67 67
       }
68 68
     }
69 69
 
70
-    if(count($invited_ar) >= 5) {
70
+    if (count($invited_ar) >= 5) {
71 71
       message(classLocale::$lang['flt_aks_error_too_much_players'], classLocale::$lang['fl_error']);
72 72
     }
73 73
 
74
-    if($isUserExists) {
74
+    if ($isUserExists) {
75 75
       $userToAdd_unsafe != $user['username'] ? $add_user_message_mr = sprintf(classLocale::$lang['fl_aks_player_invited_already'], $userToAdd) : false;
76 76
     } else {
77 77
       $add_user_message_mr = sprintf(classLocale::$lang['fl_aks_player_invited'], $userToAdd);
78
-      if(!(DBStaticFleetACS::db_acs_update($userToAddID, $fleetid))) {
78
+      if (!(DBStaticFleetACS::db_acs_update($userToAddID, $fleetid))) {
79 79
         die(sprintf(classLocale::$lang['fl_aks_adding_error'], classSupernova::$db->db_error()));
80 80
       }
81
-      $aks['eingeladen'] .= ',' . $userToAddID;
81
+      $aks['eingeladen'] .= ','.$userToAddID;
82 82
     }
83 83
     DBStaticMessages::msg_send_simple_message($userToAddID, $user['id'], SN_TIME_NOW, MSG_TYPE_COMBAT, $user['username'], classLocale::$lang['fl_aks_invite_message_header'], sprintf(classLocale::$lang['fl_aks_invite_message'], $user['username']));
84 84
   } else {
@@ -94,8 +94,8 @@  discard block
 block discarded – undo
94 94
   'MISSION_NAME' => classLocale::$lang['type_mission'][MT_ACS],
95 95
 ));
96 96
 
97
-if($aks['eingeladen'] && is_array($members = classSupernova::$gc->cacheOperator->db_get_record_list(LOC_USER, "`id` in ({$aks['eingeladen']})")) && !empty($members)) {
98
-  foreach($members as $row) {
97
+if ($aks['eingeladen'] && is_array($members = classSupernova::$gc->cacheOperator->db_get_record_list(LOC_USER, "`id` in ({$aks['eingeladen']})")) && !empty($members)) {
98
+  foreach ($members as $row) {
99 99
     $template->assign_block_vars('invited', array(
100 100
       'NAME' => $row['username'],
101 101
     ));
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 $fleet_data = tplParseFleetObject($objFleet, $i, $user);
121 121
 
122 122
 $template->assign_block_vars('fleets', $fleet_data['fleet']);
123
-foreach($fleet_data['ships'] as $ship_data) {
123
+foreach ($fleet_data['ships'] as $ship_data) {
124 124
   $template->assign_block_vars('fleets.ships', $ship_data);
125 125
 }
126 126
 
Please login to merge, or discard this patch.
common.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -12,24 +12,24 @@  discard block
 block discarded – undo
12 12
 global $template_result, $user;
13 13
 
14 14
 // Напоминание для Администрации, что игра отключена
15
-if($template_result[F_GAME_DISABLE]) {
15
+if ($template_result[F_GAME_DISABLE]) {
16 16
   echo '<div class="global_admin_warning">', $template_result[F_GAME_DISABLE_REASON], '</div>';
17 17
 }
18 18
 unset($disable_reason);
19 19
 
20 20
 
21
-if(defined('IN_ADMIN') && IN_ADMIN === true) {
21
+if (defined('IN_ADMIN') && IN_ADMIN === true) {
22 22
   lng_include('admin');
23
-} elseif($sys_user_logged_in) {
23
+} elseif ($sys_user_logged_in) {
24 24
   sys_user_vacation($user);
25 25
 
26 26
   $planet_id = SetSelectedPlanet($user);
27 27
 
28 28
   // TODO НЕ НУЖНО АЛЬЯНС КАЖДЫЙ РАЗ ОБНОВЛЯТЬ!!!
29
-  if($user['ally_id']) {
29
+  if ($user['ally_id']) {
30 30
     sn_db_transaction_start();
31 31
     sn_ali_fill_user_ally($user);
32
-    if(!$user['ally']['player']['id']) {
32
+    if (!$user['ally']['player']['id']) {
33 33
       // sn_sys_logout(false, true);
34 34
       // core_auth::logout(false);
35 35
       classSupernova::$auth->logout(false);
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     }
38 38
     // TODO UNCOMMENT
39 39
     que_process($user['ally']['player']);
40
-    DBStaticUser::db_user_set_by_id_DEPRECATED($user['ally']['player']['id'], '`onlinetime` = ' . SN_TIME_NOW);
40
+    DBStaticUser::db_user_set_by_id_DEPRECATED($user['ally']['player']['id'], '`onlinetime` = '.SN_TIME_NOW);
41 41
     sn_db_transaction_commit();
42 42
   }
43 43
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
   sn_db_transaction_commit();
49 49
 
50 50
   $planetrow = $global_data['planet'];
51
-  if(!($planetrow && isset($planetrow['id']) && $planetrow['id'])) {
51
+  if (!($planetrow && isset($planetrow['id']) && $planetrow['id'])) {
52 52
     // sn_sys_logout(false, true);
53 53
     // core_auth::logout(false);
54 54
     classSupernova::$auth->logout(false);
Please login to merge, or discard this patch.