Test Failed
Branch trunk (d809b8)
by SuperNova.WS
05:48
created
classes/OldDbChangeSet.php 1 patch
Braces   +12 added lines, -7 removed lines patch added patch discarded remove patch
@@ -23,8 +23,7 @@  discard block
 block discarded – undo
23 23
    * @return array
24 24
    * @deprecated
25 25
    */
26
-  public static function db_changeset_prepare_unit($unit_id, $unit_value, $user, $planet_id = null)
27
-  {
26
+  public static function db_changeset_prepare_unit($unit_id, $unit_value, $user, $planet_id = null) {
28 27
     if(!is_array($user))
29 28
     {
30 29
       // TODO - remove later
@@ -61,8 +60,7 @@  discard block
 block discarded – undo
61 60
           ),
62 61
         ),
63 62
       );
64
-    }
65
-    else
63
+    } else
66 64
     {
67 65
       $db_changeset = array(
68 66
         'action' => SQL_OP_INSERT,
@@ -176,14 +174,21 @@  discard block
 block discarded – undo
176 174
    */
177 175
   public static function db_changeset_apply($db_changeset) {
178 176
     $result = true;
179
-    if(!is_array($db_changeset) || empty($db_changeset)) return $result;
177
+    if(!is_array($db_changeset) || empty($db_changeset)) {
178
+      return $result;
179
+    }
180 180
 
181 181
     foreach($db_changeset as $table_name => &$table_data) {
182 182
       foreach($table_data as $record_id => &$conditions) {
183 183
         OldDbChangeSet::db_changeset_condition_compile($conditions, $table_name);
184 184
 
185
-        if($conditions['action'] != SQL_OP_DELETE && !$conditions[P_FIELDS_STR]) continue;
186
-        if($conditions['action'] == SQL_OP_DELETE && !$conditions[P_WHERE_STR]) continue; // Защита от случайного удаления всех данных в таблице
185
+        if($conditions['action'] != SQL_OP_DELETE && !$conditions[P_FIELDS_STR]) {
186
+          continue;
187
+        }
188
+        if($conditions['action'] == SQL_OP_DELETE && !$conditions[P_WHERE_STR]) {
189
+          continue;
190
+        }
191
+        // Защита от случайного удаления всех данных в таблице
187 192
 
188 193
         if($conditions[P_LOCATION] != LOC_NONE) {
189 194
           switch($conditions['action'])
Please login to merge, or discard this patch.
includes/pages/chat.php 1 patch
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -4,8 +4,7 @@  discard block
 block discarded – undo
4 4
  *
5 5
  */
6 6
 
7
-function sn_chat_model()
8
-{
7
+function sn_chat_model() {
9 8
   global $config, $user, $template_result, $lang;
10 9
 
11 10
   $config->array_set('users', $user['id'], 'chat_last_activity', SN_TIME_MICRO);
@@ -44,15 +43,13 @@  discard block
 block discarded – undo
44 43
 
45 44
   $template_result['PAGE_HEADER'] = $page_title;
46 45
 }
47
-function sn_chat_view($template = null)
48
-{
46
+function sn_chat_view($template = null) {
49 47
   $template = gettemplate('chat_body', $template);
50 48
 
51 49
   return $template;
52 50
 }
53 51
 
54
-function sn_chat_add_model()
55
-{
52
+function sn_chat_add_model() {
56 53
   global $config, $user;
57 54
 
58 55
   define('IN_AJAX', true);
@@ -76,8 +73,7 @@  discard block
 block discarded – undo
76 73
 
77 74
   die();
78 75
 }
79
-function sn_chat_msg_view($template = null)
80
-{
76
+function sn_chat_msg_view($template = null) {
81 77
   global $config, $user, $lang;
82 78
 
83 79
   define('IN_AJAX', true);
@@ -99,8 +95,7 @@  discard block
 block discarded – undo
99 95
       'TIME' => date(FMT_DATE_TIME, htmlentities(SN_CLIENT_TIME_LOCAL, ENT_QUOTES, 'utf-8')),
100 96
       'DISABLE' => true,
101 97
     );
102
-  }
103
-  else
98
+  } else
104 99
   {
105 100
     $alliance = sys_get_param_str('ally') && $user['ally_id'] ? $user['ally_id'] : 0;
106 101
 
@@ -121,8 +116,7 @@  discard block
 block discarded – undo
121 116
       }
122 117
 
123 118
       $page = min($page_count, max(0, sys_get_param_int('sheet')));
124
-    }
125
-    else
119
+    } else
126 120
     {
127 121
       $last_message = sys_get_param_id('last_message');
128 122
       $where_add = $last_message ? "AND `messageid` > {$last_message}" : '';
@@ -171,8 +165,7 @@  discard block
 block discarded – undo
171 165
   {
172 166
     $pageTitle = "{$lang['chat_history']} - {$lang[$alliance ? 'chat_ally' : 'chat_common']}";
173 167
     display($template, $pageTitle);
174
-  }
175
-  else
168
+  } else
176 169
   {
177 170
     $result['last_message'] = $last_message;
178 171
     $result['html'] = templateRenderToHtml($template);
Please login to merge, or discard this patch.
includes/db/db_queries.php 1 patch
Braces   +12 added lines, -24 removed lines patch added patch discarded remove patch
@@ -7,8 +7,7 @@  discard block
 block discarded – undo
7 7
 require_once('db_queries_fleet.php');
8 8
 
9 9
 
10
-function db_planet_list_admin_list($table_parent_columns, $planet_active, $active_time, $planet_type)
11
-{
10
+function db_planet_list_admin_list($table_parent_columns, $planet_active, $active_time, $planet_type) {
12 11
   return doquery(
13 12
     "SELECT p.*, u.username" . ($table_parent_columns ? ', p1.name AS parent_name' : '') .
14 13
     " FROM {{planets}} AS p
@@ -17,8 +16,7 @@  discard block
 block discarded – undo
17 16
     " WHERE " . ($planet_active ? "p.last_update >= {$active_time}" : "p.planet_type = {$planet_type}"));
18 17
 }
19 18
 
20
-function db_planet_list_search($searchtext)
21
-{
19
+function db_planet_list_search($searchtext) {
22 20
   return doquery(
23 21
     "SELECT
24 22
       p.galaxy, p.system, p.planet, p.planet_type, p.name as planet_name,
@@ -38,8 +36,7 @@  discard block
 block discarded – undo
38 36
 
39 37
 
40 38
 
41
-function db_user_list_search($searchtext)
42
-{
39
+function db_user_list_search($searchtext) {
43 40
   return doquery(
44 41
     "SELECT
45 42
       pn.player_name, u.id as uid, u.username, u.ally_id, u.id_planet, u.total_points, u.total_rank,
@@ -57,8 +54,7 @@  discard block
 block discarded – undo
57 54
   );
58 55
 }
59 56
 
60
-function db_buddy_list_by_user($user_id)
61
-{
57
+function db_buddy_list_by_user($user_id) {
62 58
 //  return ($user_id = intval($user_id)) ? doquery(
63 59
   return ($user_id = idval($user_id)) ? doquery(
64 60
     "SELECT
@@ -84,8 +80,7 @@  discard block
 block discarded – undo
84 80
 
85 81
 
86 82
 
87
-function db_message_list_outbox_by_user_id($user_id)
88
-{
83
+function db_message_list_outbox_by_user_id($user_id) {
89 84
   // return ($user_id = intval($user_id))
90 85
   return ($user_id = idval($user_id))
91 86
     ? doquery("SELECT {{messages}}.message_id, {{messages}}.message_owner, {{users}}.id AS message_sender, {{messages}}.message_time,
@@ -101,8 +96,7 @@  discard block
 block discarded – undo
101 96
 
102 97
 
103 98
 
104
-function db_unit_records_sum($unit_id, $user_skip_list_unit)
105
-{
99
+function db_unit_records_sum($unit_id, $user_skip_list_unit) {
106 100
   return doquery (
107 101
     "SELECT unit_player_id, username, sum(unit_level) as unit_level
108 102
           FROM {{unit}} JOIN {{users}} AS u ON u.id = unit_player_id
@@ -113,8 +107,7 @@  discard block
 block discarded – undo
113 107
     , true);
114 108
 }
115 109
 
116
-function db_unit_records_plain($unit_id, $user_skip_list_unit)
117
-{
110
+function db_unit_records_plain($unit_id, $user_skip_list_unit) {
118 111
   return doquery (
119 112
     "SELECT unit_player_id, username, unit_level
120 113
           FROM {{unit}} JOIN {{users}} AS u ON u.id = unit_player_id
@@ -198,15 +191,13 @@  discard block
 block discarded – undo
198 191
 }
199 192
 
200 193
 
201
-function db_stat_list_delete_ally_player()
202
-{
194
+function db_stat_list_delete_ally_player() {
203 195
   return doquery('DELETE s FROM {{statpoints}} AS s JOIN {{users}} AS u ON u.id = s.id_owner WHERE s.id_ally IS NULL AND u.user_as_ally IS NOT NULL');
204 196
 }
205 197
 
206 198
 
207 199
 
208
-function db_chat_player_list_online($chat_refresh_rate, $ally_add)
209
-{
200
+function db_chat_player_list_online($chat_refresh_rate, $ally_add) {
210 201
   $sql_date = SN_TIME_NOW - $chat_refresh_rate * 2;
211 202
 
212 203
   return doquery(
@@ -220,13 +211,11 @@  discard block
 block discarded – undo
220 211
     ORDER BY authlevel DESC, `username`");
221 212
 }
222 213
 
223
-function db_referrals_list_by_id($user_id)
224
-{
214
+function db_referrals_list_by_id($user_id) {
225 215
   return doquery("SELECT r.*, u.username, u.register_time FROM {{referrals}} AS r LEFT JOIN {{users}} AS u ON u.id = r.id WHERE id_partner = {$user_id}");
226 216
 }
227 217
 
228
-function db_message_list_admin_by_type($int_type_selected, $StartRec)
229
-{
218
+function db_message_list_admin_by_type($int_type_selected, $StartRec) {
230 219
   return doquery("SELECT
231 220
   message_id as `ID`,
232 221
   message_from as `FROM`,
@@ -245,8 +234,7 @@  discard block
 block discarded – undo
245 234
 }
246 235
 
247 236
 
248
-function db_message_insert_all($message_type, $from, $subject, $text)
249
-{
237
+function db_message_insert_all($message_type, $from, $subject, $text) {
250 238
   return doquery($QryInsertMessage = 'INSERT INTO {{messages}} (`message_owner`, `message_sender`, `message_time`, `message_type`, `message_from`, `message_subject`, `message_text`) ' .
251 239
     "SELECT `id`, 0, unix_timestamp(now()), {$message_type}, '{$from}', '{$subject}', '{$text}' FROM {{users}}");
252 240
 }
Please login to merge, or discard this patch.
includes/functions/tpl_helpers.php 1 patch
Braces   +9 added lines, -18 removed lines patch added patch discarded remove patch
@@ -1,8 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 // Compare function to sort fleet in time order
4
-function tpl_assign_fleet_compare($a, $b)
5
-{
4
+function tpl_assign_fleet_compare($a, $b) {
6 5
   if($a['fleet']['OV_THIS_PLANET'] == $b['fleet']['OV_THIS_PLANET'])
7 6
   {
8 7
     if($a['fleet']['OV_LEFT'] == $b['fleet']['OV_LEFT'])
@@ -10,15 +9,13 @@  discard block
 block discarded – undo
10 9
       return 0;
11 10
     }
12 11
     return ($a['fleet']['OV_LEFT'] < $b['fleet']['OV_LEFT']) ? -1 : 1;
13
-  }
14
-  else
12
+  } else
15 13
   {
16 14
     return $a['fleet']['OV_THIS_PLANET'] ? -1 : 1;
17 15
   }
18 16
 }
19 17
 
20
-function tpl_assign_fleet(&$template, $fleets, $js_name = 'fleets')
21
-{
18
+function tpl_assign_fleet(&$template, $fleets, $js_name = 'fleets') {
22 19
   if(!$fleets)
23 20
   {
24 21
     return;
@@ -41,8 +38,7 @@  discard block
 block discarded – undo
41 38
 }
42 39
 
43 40
 // function that parses internal fleet representation (as array(id => count))
44
-function tpl_parse_fleet_sn($fleet, $fleet_id)
45
-{
41
+function tpl_parse_fleet_sn($fleet, $fleet_id) {
46 42
   global $lang, $user;
47 43
 
48 44
   $user_data = &$user;
@@ -182,8 +178,7 @@  discard block
 block discarded – undo
182 178
   return $result;
183 179
 }
184 180
 
185
-function tpl_parse_planet_que($que, $planet, $que_id)
186
-{
181
+function tpl_parse_planet_que($que, $planet, $que_id) {
187 182
   $hangar_que = array();
188 183
   $que_hangar = $que['ques'][$que_id][$planet['id_owner']][$planet['id']];
189 184
   if(!empty($que_hangar))
@@ -198,8 +193,7 @@  discard block
 block discarded – undo
198 193
   return $hangar_que;
199 194
 }
200 195
 
201
-function tpl_parse_planet($planet, &$fleets)
202
-{
196
+function tpl_parse_planet($planet, &$fleets) {
203 197
   global $lang;
204 198
 
205 199
   $que = que_get($planet['id_owner'], $planet['id'], false);
@@ -268,8 +262,7 @@  discard block
 block discarded – undo
268 262
   return $result;
269 263
 }
270 264
 
271
-function flt_get_fleets_to_planet($planet, $fleet_db_list = 0)
272
-{
265
+function flt_get_fleets_to_planet($planet, $fleet_db_list = 0) {
273 266
   if(!($planet && $planet['id']) && !$fleet_db_list)
274 267
   {
275 268
     return $planet;
@@ -291,8 +284,7 @@  discard block
 block discarded – undo
291 284
         continue;
292 285
       }
293 286
       $fleet_ownage = 'own';
294
-    }
295
-    else
287
+    } else
296 288
     {
297 289
       switch($fleet['fleet_mission'])
298 290
       {
@@ -341,8 +333,7 @@  discard block
 block discarded – undo
341 333
  * @param array    $fleets_to_planet
342 334
  * @param int      $round
343 335
  */
344
-function tpl_set_resource_info(&$template, $planetrow, $fleets_to_planet = array(), $round = 0)
345
-{
336
+function tpl_set_resource_info(&$template, $planetrow, $fleets_to_planet = array(), $round = 0) {
346 337
   $template->assign_vars(array(
347 338
     'RESOURCE_ROUNDING' => $round,
348 339
 
Please login to merge, or discard this patch.