Passed
Branch trunk (7dc288)
by SuperNova.WS
06:07
created
phalanx.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -18,17 +18,17 @@  discard block
 block discarded – undo
18 18
 
19 19
 $sensorLevel = mrc_get_level($user, $planetrow, STRUC_MOON_PHALANX);
20 20
 if (!intval($sensorLevel)) {
21
-  messageBox ($lang['phalanx_nosensoravailable'], $lang['tech'][STRUC_MOON_PHALANX], '', 3);
21
+  messageBox($lang['phalanx_nosensoravailable'], $lang['tech'][STRUC_MOON_PHALANX], '', 3);
22 22
 }
23 23
 
24 24
 if ($planetrow['planet_type'] != PT_MOON) {
25
-  messageBox ($lang['phalanx_onlyformoons'], $lang['tech'][STRUC_MOON_PHALANX], '', 3);
25
+  messageBox($lang['phalanx_onlyformoons'], $lang['tech'][STRUC_MOON_PHALANX], '', 3);
26 26
 }
27 27
 
28 28
 $scan_galaxy  = sys_get_param_int('galaxy');
29 29
 $scan_system  = sys_get_param_int('system');
30 30
 $scan_planet  = sys_get_param_int('planet');
31
-$scan_planet_type  = 1; // sys_get_param_int('planettype');
31
+$scan_planet_type = 1; // sys_get_param_int('planettype');
32 32
 $id = sys_get_param_id('id');
33 33
 
34 34
 $source_galaxy = $planetrow['galaxy'];
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
 $sensorRange = GetPhalanxRange($sensorLevel);
39 39
 
40 40
 $system_distance = abs($source_system - $scan_system);
41
-if($system_distance > $sensorRange || $scan_galaxy != $source_galaxy)
41
+if ($system_distance > $sensorRange || $scan_galaxy != $source_galaxy)
42 42
 {
43
-  messageBox ($lang['phalanx_rangeerror'], $lang['tech'][STRUC_MOON_PHALANX], '', 3);
43
+  messageBox($lang['phalanx_rangeerror'], $lang['tech'][STRUC_MOON_PHALANX], '', 3);
44 44
 }
45 45
 
46 46
 $cost = $sensorLevel * 1000;
@@ -51,14 +51,14 @@  discard block
 block discarded – undo
51 51
 }
52 52
 
53 53
 $planet_scanned = DBStaticPlanet::db_planet_by_gspt($scan_galaxy, $scan_system, $scan_planet, $scan_planet_type);
54
-if(!$planet_scanned['id'])
54
+if (!$planet_scanned['id'])
55 55
 {
56 56
   messageBox($lang['phalanx_planet_not_exists'], $lang['tech'][STRUC_MOON_PHALANX], '', 3);
57 57
 }
58 58
 
59
-if($planet_scanned['destruyed'])
59
+if ($planet_scanned['destruyed'])
60 60
 {
61
-  messageBox ($lang['phalanx_planet_destroyed'], $lang['tech'][STRUC_MOON_PHALANX], '', 3);
61
+  messageBox($lang['phalanx_planet_destroyed'], $lang['tech'][STRUC_MOON_PHALANX], '', 3);
62 62
 }
63 63
 
64 64
 DBStaticPlanet::db_planet_set_by_id($user['current_planet'], "deuterium = deuterium - {$cost}");
Please login to merge, or discard this patch.
admin/adm_planet_list.php 1 patch
Spacing   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-define('INSIDE'  , true);
4
-define('INSTALL' , false);
3
+define('INSIDE', true);
4
+define('INSTALL', false);
5 5
 define('IN_ADMIN', true);
6 6
 
7 7
 require('../common.' . substr(strrchr(__FILE__, '.'), 1));
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 messageBoxAdminAccessDenied(AUTH_LEVEL_ADMINISTRATOR);
12 12
 
13 13
 $planet_active = sys_get_param_int('planet_active');
14
-if(!$planet_active) {
14
+if (!$planet_active) {
15 15
   $planet_type = sys_get_param_int('planet_type', 1);
16 16
   $planet_type = $planet_type == 3 ? 3 : 1;
17 17
 } else {
@@ -40,8 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
 $page_title = 
42 42
   $lang['adm_planet_list_title'] . ': ' . 
43
-  ($planet_active ? $lang['adm_planet_active'] :
44
-    ($planet_type ? ($planet_type == 3 ? $lang['sys_moons'] : $lang['sys_planets']) : '')
43
+  ($planet_active ? $lang['adm_planet_active'] : ($planet_type ? ($planet_type == 3 ? $lang['sys_moons'] : $lang['sys_planets']) : '')
45 44
   );
46 45
 $template->assign_vars(array(
47 46
   'PAGE_TITLE' => $page_title,
Please login to merge, or discard this patch.
admin/ajax_maintenance.php 1 patch
Spacing   +9 added lines, -9 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
   messageBox($lang['sys_noalloaw'], $lang['sys_noaccess']);
10 10
   die();
@@ -19,9 +19,9 @@  discard block
 block discarded – undo
19 19
 
20 20
 // [#] info_best_battles 1b0
21 21
 $best_reports = array();
22
-if(defined('MODULE_INFO_BEST_BATTLES_QUERY')) {
22
+if (defined('MODULE_INFO_BEST_BATTLES_QUERY')) {
23 23
   $query = doquery(MODULE_INFO_BEST_BATTLES_QUERY);
24
-  while($row = db_fetch($query)) {
24
+  while ($row = db_fetch($query)) {
25 25
     $best_reports[] = $row['ube_report_id'];
26 26
   }
27 27
 }
@@ -185,16 +185,16 @@  discard block
 block discarded – undo
185 185
 
186 186
 function sn_maintenance_pack_user_list($user_list) {
187 187
   $user_list = explode(',', $user_list);
188
-  foreach($user_list as $key => $user_id) {
189
-    if(!ceil(floatval($user_id))) {
188
+  foreach ($user_list as $key => $user_id) {
189
+    if (!ceil(floatval($user_id))) {
190 190
       unset($user_list[$key]);
191 191
     }
192 192
   }
193 193
 
194 194
   $result = array();
195
-  if(!empty($user_list)) {
195
+  if (!empty($user_list)) {
196 196
     $query = doquery("SELECT `id` FROM {{users}} WHERE `id` in (" . implode(',', $user_list) . ")");
197
-    while($row = db_fetch($query)) {
197
+    while ($row = db_fetch($query)) {
198 198
       $result[] = $row['id'];
199 199
     }
200 200
   }
@@ -209,11 +209,11 @@  discard block
 block discarded – undo
209 209
 $old_server_status == GAME_DISABLE_NONE ? classSupernova::$config->db_saveItem('game_disable', GAME_DISABLE_MAINTENANCE) : false;
210 210
 sn_db_transaction_commit();
211 211
 
212
-foreach($ques as $que_transaction) {
212
+foreach ($ques as $que_transaction) {
213 213
   sn_db_transaction_start();
214 214
 
215 215
   !is_array($que_transaction) ? $que_transaction = array($que_transaction) : false;
216
-  foreach($que_transaction as $que) {
216
+  foreach ($que_transaction as $que) {
217 217
     set_time_limit(120);
218 218
     $QryResult = doquery($que);
219 219
     //$msg .= '<hr>' . $que . '<hr>';
Please login to merge, or discard this patch.
admin/statbuilder.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,8 +9,8 @@  discard block
 block discarded – undo
9 9
  * @copyright 2008 by Chlorel for XNova
10 10
  */
11 11
 
12
-define('INSIDE'  , true);
13
-define('INSTALL' , false);
12
+define('INSIDE', true);
13
+define('INSTALL', false);
14 14
 define('IN_ADMIN', true);
15 15
 require_once('../common.' . substr(strrchr(__FILE__, '.'), 1));
16 16
 
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 
19 19
 messageBoxAdminAccessDenied(AUTH_LEVEL_ADMINISTRATOR);
20 20
 
21
-if(SN_TIME_NOW >= classSupernova::$config->db_loadItem('var_stat_update_admin_forced') && SN_TIME_NOW >= classSupernova::$config->db_loadItem('var_stat_update_end'))
21
+if (SN_TIME_NOW >= classSupernova::$config->db_loadItem('var_stat_update_admin_forced') && SN_TIME_NOW >= classSupernova::$config->db_loadItem('var_stat_update_end'))
22 22
 {
23 23
   classSupernova::$config->db_saveItem('var_stat_update_admin_forced', SN_TIME_NOW + 120);
24 24
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,8 +37,7 @@
 block discarded – undo
37 37
   </script>';
38 38
 
39 39
   messageBoxAdmin("{$script}<img src=\"design/images/progressbar.gif\"><br>{$lang['sys_wait']}", $lang['adm_stat_title'], '', 0);
40
-}
41
-else
40
+} else
42 41
 {
43 42
   messageBoxAdmin($lang['adm_stat_already_started'], $lang['adm_stat_title'], 'admin/overview.php');
44 43
 }
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 = classSupernova::$config->game_mode == GAME_BLITZ ? 'sys_blitz_page_disabled' : (
7 7
     !classSupernova::$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(classSupernova::$config->db_loadItem('game_blitz_register_round'));
18 18
 $current_price = intval(classSupernova::$config->db_loadItem('game_blitz_register_price'));
19 19
 
20
-if(classSupernova::$config->db_loadItem('game_blitz_register') == BLITZ_REGISTER_OPEN && (sys_get_param_str('register_me') || sys_get_param_str('register_me_not'))) {
20
+if (classSupernova::$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
       classSupernova::$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(classSupernova::$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
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 
96 96
       $moon_row = uni_create_moon($galaxy, $system, $planet, $user_new['id'], 30, '', false);
97 97
 
98
-      if(($system += $system_step) >= classSupernova::$config->game_maxSystem) {
98
+      if (($system += $system_step) >= classSupernova::$config->game_maxSystem) {
99 99
         $galaxy++;
100 100
         $system = $system_step;
101 101
       }
@@ -104,13 +104,13 @@  discard block
 block discarded – undo
104 104
 
105 105
     classSupernova::$config->db_saveItem('users_amount', classSupernova::$config->users_amount + $new_players);
106 106
     // generated_string
107
-  } elseif(sys_get_param_str('import_result') && ($blitz_result_string = sys_get_param_str('blitz_result_string'))) {
107
+  } elseif (sys_get_param_str('import_result') && ($blitz_result_string = sys_get_param_str('blitz_result_string'))) {
108 108
     $blitz_result = explode(';', $blitz_result_string);
109 109
     $blitz_last_update = $blitz_result[0]; // Пока не используется
110 110
     unset($blitz_result[0]);
111
-    foreach($blitz_result as $blitz_result_data) {
111
+    foreach ($blitz_result as $blitz_result_data) {
112 112
       $blitz_result_data = explode(',', $blitz_result_data);
113
-      if(count($blitz_result_data) == 5) {
113
+      if (count($blitz_result_data) == 5) {
114 114
         $blitz_result_data[1] = db_escape($blitz_result_data[1]);
115 115
         doquery(
116 116
           "UPDATE `{{blitz_registrations}}` SET
@@ -124,15 +124,15 @@  discard block
 block discarded – undo
124 124
     $blitz_result = array();
125 125
   }
126 126
 
127
-  if(classSupernova::$config->game_mode == GAME_BLITZ) {
127
+  if (classSupernova::$config->game_mode == GAME_BLITZ) {
128 128
     $blitz_result = array(classSupernova::$config->db_loadItem('var_stat_update'));
129 129
     $query = doquery("SELECT id, username, total_rank, total_points, onlinetime FROM {{users}} ORDER BY `id`;");
130
-    while($row = db_fetch($query)) {
130
+    while ($row = db_fetch($query)) {
131 131
       $blitz_result[] = "{$row['id']},{$row['username']},{$row['onlinetime']},{$row['total_rank']},{$row['total_points']}";
132 132
     }
133 133
   } else {
134 134
     $query = doquery("SELECT blitz_name, blitz_password, blitz_online FROM {{blitz_registrations}} WHERE `round_number` = {$current_round} ORDER BY `id`;");
135
-    while($row = db_fetch($query)) {
135
+    while ($row = db_fetch($query)) {
136 136
       $blitz_generated[] = "{$row['blitz_name']},{$row['blitz_password']}";
137 137
       $row['blitz_online'] ? $blitz_prize_players_active++ : false;
138 138
       $blitz_players++;
@@ -147,13 +147,13 @@  discard block
 block discarded – undo
147 147
     'Игрок40'
148 148
     */
149 149
 
150
-    if(sys_get_param_str('prize_calculate') && $blitz_prize_players_active && ($blitz_prize_dark_matter_actual = sys_get_param_int('blitz_prize_dark_matter'))) {
150
+    if (sys_get_param_str('prize_calculate') && $blitz_prize_players_active && ($blitz_prize_dark_matter_actual = sys_get_param_int('blitz_prize_dark_matter'))) {
151 151
       // $blitz_prize_dark_matter_actual = sys_get_param_int('blitz_prize_dark_matter');
152 152
       $blitz_prize_places_actual = sys_get_param_int('blitz_prize_places');
153 153
       sn_db_transaction_start();
154 154
       $query = doquery("SELECT * FROM {{blitz_registrations}} WHERE `round_number` = {$current_round} ORDER BY `blitz_place` FOR UPDATE;");
155
-      while($row = db_fetch($query)) {
156
-        if(!$row['blitz_place']) {
155
+      while ($row = db_fetch($query)) {
156
+        if (!$row['blitz_place']) {
157 157
           continue;
158 158
         }
159 159
 
@@ -161,15 +161,15 @@  discard block
 block discarded – undo
161 161
         $blitz_prize_places_actual--;
162 162
 
163 163
         $reward = $blitz_prize_dark_matter_actual - $row['blitz_reward_dark_matter'];
164
-pdump("{{$row['id']}} {$row['blitz_name']}, Place {$row['blitz_place']}, Prize places {$blitz_prize_places_actual}, Prize {$reward}",$row['id']);
165
-        if($reward) {
164
+pdump("{{$row['id']}} {$row['blitz_name']}, Place {$row['blitz_place']}, Prize places {$blitz_prize_places_actual}, Prize {$reward}", $row['id']);
165
+        if ($reward) {
166 166
           rpg_points_change($row['user_id'], RPG_BLITZ, $reward, sprintf(
167 167
             $lang['sys_blitz_reward_log_message'], $row['blitz_place'], $row['blitz_name']
168 168
           ));
169 169
           doquery("UPDATE {{blitz_registrations}} SET blitz_reward_dark_matter = blitz_reward_dark_matter + ($reward) WHERE id = {$row['id']} AND `round_number` = {$current_round};");
170 170
         }
171 171
 
172
-        if(!$blitz_prize_places_actual || $blitz_prize_dark_matter_actual < 1000) {
172
+        if (!$blitz_prize_places_actual || $blitz_prize_dark_matter_actual < 1000) {
173 173
           break;
174 174
         }
175 175
       }
@@ -189,12 +189,12 @@  discard block
 block discarded – undo
189 189
     JOIN {{users}} AS u ON u.id = br.user_id
190 190
   WHERE br.`round_number` = {$current_round}
191 191
   order by `blitz_place`, `timestamp`;");
192
-while($row = db_fetch($query)) {
192
+while ($row = db_fetch($query)) {
193 193
   $tpl_player_data = array(
194 194
     'NAME' => player_nick_render_to_html($row, array('icons' => true, 'color' => true, 'ally' => true)),
195 195
   );
196 196
 
197
-  if(classSupernova::$config->game_blitz_register == BLITZ_REGISTER_DISCLOSURE_NAMES) {
197
+  if (classSupernova::$config->game_blitz_register == BLITZ_REGISTER_DISCLOSURE_NAMES) {
198 198
     // Вот так хитро, что бы не было не единого шанса попадания на страницу данных об игроках Блиц-сервера до закрытия раунда
199 199
     $tpl_player_data = array_merge($tpl_player_data, array(
200 200
       'ID' => $row['id'],
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
   }
208 208
 
209 209
   $template->assign_block_vars('registrations', $tpl_player_data);
210
-  if($row['id'] == $user['id']) {
210
+  if ($row['id'] == $user['id']) {
211 211
     $player_registered = $row;
212 212
   }
213 213
 }
Please login to merge, or discard this patch.
classes/DBStaticPlanet.php 1 patch
Spacing   +12 added lines, -13 removed lines patch added patch discarded remove patch
@@ -39,8 +39,7 @@  discard block
 block discarded – undo
39 39
     $galaxy = isset($vector[$prefix . 'galaxy']) ? intval($vector[$prefix . 'galaxy']) : 0;
40 40
     $system = isset($vector[$prefix . 'system']) ? intval($vector[$prefix . 'system']) : 0;
41 41
     $planet = isset($vector[$prefix . 'planet']) ? intval($vector[$prefix . 'planet']) : 0;
42
-    $planet_type = isset($vector[$prefix . 'planet_type']) ? intval($vector[$prefix . 'planet_type']) :
43
-      (isset($vector[$prefix . 'type']) ? intval($vector[$prefix . 'type']) : 0);
42
+    $planet_type = isset($vector[$prefix . 'planet_type']) ? intval($vector[$prefix . 'planet_type']) : (isset($vector[$prefix . 'type']) ? intval($vector[$prefix . 'type']) : 0);
44 43
     $planet_type = $planet_type == PT_DEBRIS ? PT_PLANET : $planet_type;
45 44
 
46 45
     return DBStaticPlanet::db_planet_by_gspt_safe($galaxy, $system, $planet, $planet_type, $for_update, $fields);
@@ -61,7 +60,7 @@  discard block
 block discarded – undo
61 60
 //  }
62 61
 
63 62
   public static function db_planet_by_parent($parent_id, $for_update = false, $fields = '*') {
64
-    if(!($parent_id = idval($parent_id))) {
63
+    if (!($parent_id = idval($parent_id))) {
65 64
       return false;
66 65
     }
67 66
 
@@ -70,7 +69,7 @@  discard block
 block discarded – undo
70 69
   }
71 70
 
72 71
   public static function db_planet_by_id_and_owner($planet_id, $owner_id, $for_update = false, $fields = '*') {
73
-    if(!($planet_id = idval($planet_id)) || !($owner_id = idval($owner_id))) {
72
+    if (!($planet_id = idval($planet_id)) || !($owner_id = idval($owner_id))) {
74 73
       return false;
75 74
     }
76 75
     return classSupernova::db_get_record_list(LOC_PLANET,
@@ -79,7 +78,7 @@  discard block
 block discarded – undo
79 78
 
80 79
 
81 80
   public static function db_planet_list_moon_other($user_id, $this_moon_id) {
82
-    if(!($user_id = idval($user_id)) || !($this_moon_id = idval($this_moon_id))) {
81
+    if (!($user_id = idval($user_id)) || !($this_moon_id = idval($this_moon_id))) {
83 82
       return false;
84 83
     }
85 84
     return classSupernova::db_get_record_list(LOC_PLANET,
@@ -94,7 +93,7 @@  discard block
 block discarded – undo
94 93
   }
95 94
 
96 95
   public static function db_planet_list_sorted($user_row, $skip_planet_id = false, $field_list = '', $conditions = '') {
97
-    if(!is_array($user_row)) {
96
+    if (!is_array($user_row)) {
98 97
       return false;
99 98
     }
100 99
     $conditions .= $skip_planet_id ? " AND `id` <> {$skip_planet_id} " : '';
@@ -115,7 +114,7 @@  discard block
 block discarded – undo
115 114
   }
116 115
 
117 116
   public static function db_planet_list_by_user_or_planet($user_id, $planet_id) {
118
-    if(!($user_id = idval($user_id)) && !($planet_id = idval($planet_id))) {
117
+    if (!($user_id = idval($user_id)) && !($planet_id = idval($planet_id))) {
119 118
       return false;
120 119
     }
121 120
 
@@ -124,14 +123,14 @@  discard block
 block discarded – undo
124 123
   }
125 124
 
126 125
   public static function db_planet_set_by_id($planet_id, $set) {
127
-    if(!($planet_id = idval($planet_id))) {
126
+    if (!($planet_id = idval($planet_id))) {
128 127
       return false;
129 128
     }
130 129
     return classSupernova::db_upd_record_by_id(LOC_PLANET, $planet_id, $set);
131 130
   }
132 131
 
133 132
   public static function db_planet_set_by_gspt($ui_galaxy, $ui_system, $ui_planet, $ui_planet_type = PT_ALL, $set) {
134
-    if(!($set = trim($set))) {
133
+    if (!($set = trim($set))) {
135 134
       return false;
136 135
     }
137 136
 
@@ -144,14 +143,14 @@  discard block
 block discarded – undo
144 143
   }
145 144
 
146 145
   public static function db_planet_set_by_parent($ui_parent_id, $ss_set) {
147
-    if(!($si_parent_id = idval($ui_parent_id)) || !($ss_set = trim($ss_set))) {
146
+    if (!($si_parent_id = idval($ui_parent_id)) || !($ss_set = trim($ss_set))) {
148 147
       return false;
149 148
     }
150 149
     return classSupernova::db_upd_record_list(LOC_PLANET, "`parent_planet` = {$si_parent_id}", $ss_set);
151 150
   }
152 151
 
153 152
   public static function db_planet_set_by_owner($ui_owner_id, $ss_set) {
154
-    if(!($si_owner_id = idval($ui_owner_id)) || !($ss_set = trim($ss_set))) {
153
+    if (!($si_owner_id = idval($ui_owner_id)) || !($ss_set = trim($ss_set))) {
155 154
       return false;
156 155
     }
157 156
     return classSupernova::db_upd_record_list(LOC_PLANET, "`id_owner` = {$si_owner_id}", $ss_set);
@@ -159,7 +158,7 @@  discard block
 block discarded – undo
159 158
 
160 159
 
161 160
   public static function db_planet_delete_by_id($planet_id) {
162
-    if(!($planet_id = idval($planet_id))) {
161
+    if (!($planet_id = idval($planet_id))) {
163 162
       return false;
164 163
     }
165 164
     classSupernova::db_del_record_by_id(LOC_PLANET, $planet_id);
@@ -169,7 +168,7 @@  discard block
 block discarded – undo
169 168
   }
170 169
 
171 170
   public static function db_planet_list_delete_by_owner($ui_owner_id) {
172
-    if(!($si_owner_id = idval($ui_owner_id))) {
171
+    if (!($si_owner_id = idval($ui_owner_id))) {
173 172
       return false;
174 173
     }
175 174
     classSupernova::db_del_record_list(LOC_PLANET, "`id_owner` = {$si_owner_id}");
Please login to merge, or discard this patch.
classes/classLocale.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -28,13 +28,13 @@  discard block
 block discarded – undo
28 28
 
29 29
     $this->container = array();
30 30
 
31
-    if(classSupernova::$cache->getMode() != classCache::CACHER_NO_CACHE && !classSupernova::$config->locale_cache_disable) {
31
+    if (classSupernova::$cache->getMode() != classCache::CACHER_NO_CACHE && !classSupernova::$config->locale_cache_disable) {
32 32
       $this->cache = classSupernova::$cache;
33 33
       classSupernova::log_file('locale.__constructor: Cache is present');
34 34
 //$this->cache->unset_by_prefix($this->cache_prefix); // TODO - remove? 'cause debug!
35 35
     }
36 36
 
37
-    if($enable_stat_usage && empty($this->stat_usage)) {
37
+    if ($enable_stat_usage && empty($this->stat_usage)) {
38 38
       $this->enable_stat_usage = $enable_stat_usage;
39 39
       $this->usage_stat_load();
40 40
       // TODO shutdown function
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
     unset($fallback[$this->active]);
61 61
 
62 62
     // Проходим по оставшимся локалям
63
-    foreach($fallback as $try_language) {
63
+    foreach ($fallback as $try_language) {
64 64
       // Если нет такой строки - пытаемся вытащить из кэша
65
-      if(!isset($this->container[$try_language][$offset]) && $this->cache) {
65
+      if (!isset($this->container[$try_language][$offset]) && $this->cache) {
66 66
         $this->container[$try_language][$offset] = $this->cache->__get($this->cache_prefix . $try_language . '_' . $offset);
67 67
 // Записываем результат работы кэша
68 68
 $locale_cache_statistic['queries']++;
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
       }
72 72
 
73 73
       // Если мы как-то где-то нашли строку...
74
-      if(isset($this->container[$try_language][$offset])) {
74
+      if (isset($this->container[$try_language][$offset])) {
75 75
         // ...значит она получена в результате фоллбэка и записываем её в кэш и контейнер
76 76
         $this[$offset] = $this->container[$try_language][$offset];
77 77
         $locale_cache_statistic['fallbacks']++;
@@ -85,15 +85,15 @@  discard block
 block discarded – undo
85 85
       $this->container[$this->active][] = $value;
86 86
     } else {
87 87
       $this->container[$this->active][$offset] = $value;
88
-      if($this->cache) {
88
+      if ($this->cache) {
89 89
         $this->cache->__set($this->cache_prefix_lang . $offset, $value);
90 90
       }
91 91
     }
92 92
   }
93 93
   public function offsetExists($offset) {
94 94
     // Шорткат если у нас уже есть строка в памяти PHP
95
-    if(!isset($this->container[$this->active][$offset])) {
96
-      if(!$this->cache || !($this->container[$this->active][$offset] = $this->cache->__get($this->cache_prefix_lang . $offset))) {
95
+    if (!isset($this->container[$this->active][$offset])) {
96
+      if (!$this->cache || !($this->container[$this->active][$offset] = $this->cache->__get($this->cache_prefix_lang . $offset))) {
97 97
         // Если нету такой строки - делаем фоллбэк
98 98
         $this->locale_string_fallback($offset);
99 99
       }
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
   }
108 108
   public function offsetGet($offset) {
109 109
     $value = $this->offsetExists($offset) ? $this->container[$this->active][$offset] : null;
110
-    if($this->enable_stat_usage) {
110
+    if ($this->enable_stat_usage) {
111 111
       $this->usage_stat_log($offset, $value);
112 112
     }
113 113
     return $value;
@@ -124,24 +124,24 @@  discard block
 block discarded – undo
124 124
   public function usage_stat_load() {
125 125
     global $sn_cache;
126 126
 
127
-    $this->stat_usage = $sn_cache->lng_stat_usage  = array(); // TODO for debug
128
-    if(empty($this->stat_usage)) {
127
+    $this->stat_usage = $sn_cache->lng_stat_usage = array(); // TODO for debug
128
+    if (empty($this->stat_usage)) {
129 129
       $query = doquery("SELECT * FROM {{lng_usage_stat}}");
130
-      while($row = db_fetch($query)) {
130
+      while ($row = db_fetch($query)) {
131 131
         $this->stat_usage[$row['lang_code'] . ':' . $row['string_id'] . ':' . $row['file'] . ':' . $row['line']] = $row['is_empty'];
132 132
       }
133 133
     }
134 134
   }
135 135
   public function usage_stat_save() {
136
-    if(!empty($this->stat_usage_new)) {
136
+    if (!empty($this->stat_usage_new)) {
137 137
       global $sn_cache;
138 138
       $sn_cache->lng_stat_usage = $this->stat_usage;
139 139
       doquery("SELECT 1 FROM {{lng_usage_stat}} LIMIT 1");
140
-      foreach($this->stat_usage_new as &$value) {
141
-        foreach($value as &$value2) {
140
+      foreach ($this->stat_usage_new as &$value) {
141
+        foreach ($value as &$value2) {
142 142
           $value2 = '"' . db_escape($value2) . '"';
143 143
         }
144
-        $value = '(' . implode(',', $value) .')';
144
+        $value = '(' . implode(',', $value) . ')';
145 145
       }
146 146
       doquery("REPLACE INTO {{lng_usage_stat}} (lang_code,string_id,`file`,line,is_empty,locale) VALUES " . implode(',', $this->stat_usage_new));
147 147
     }
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
     $file = str_replace('\\', '/', substr($trace[1]['file'], strlen(SN_ROOT_PHYSICAL) - 1));
155 155
 
156 156
     $string_id = $this->active . ':' . $offset . ':' . $file . ':' . $trace[1]['line'];
157
-    if(!isset($this->stat_usage[$string_id]) || $this->stat_usage[$string_id] != $empty) {
157
+    if (!isset($this->stat_usage[$string_id]) || $this->stat_usage[$string_id] != $empty) {
158 158
       $this->stat_usage[$string_id] = empty($value);
159 159
       $this->stat_usage_new[] = array(
160 160
         'lang_code' => $this->active,
@@ -194,11 +194,11 @@  discard block
 block discarded – undo
194 194
     $cache_file_key = $this->cache_prefix_lang . '__' . $filename;
195 195
 
196 196
     // Подключен ли внешний кэш?
197
-    if($this->cache) {
197
+    if ($this->cache) {
198 198
       // Загружен ли уже данный файл?
199 199
       $cache_file_status = $this->cache->__get($cache_file_key);
200 200
       classSupernova::log_file("locale.include: Cache - '{$filename}' has key '{$cache_file_key}' and is " . ($cache_file_status ? 'already loaded - EXIT' : 'EMPTY'), $cache_file_status ? -1 : 0);
201
-      if($cache_file_status) {
201
+      if ($cache_file_status) {
202 202
         // Если да - повторять загрузку нет смысла
203 203
         return null;
204 204
       }
@@ -212,35 +212,35 @@  discard block
 block discarded – undo
212 212
     $this->make_fallback($language);
213 213
 
214 214
     $file_path = '';
215
-    foreach($this->fallback as $lang_try) {
216
-      if(!$lang_try /* || isset($language_tried[$lang_try]) */) {
215
+    foreach ($this->fallback as $lang_try) {
216
+      if (!$lang_try /* || isset($language_tried[$lang_try]) */) {
217 217
         continue;
218 218
       }
219 219
 
220
-      if($file_path = $this->lng_try_filepath($path, "language/{$lang_try}/{$filename_ext}")) {
220
+      if ($file_path = $this->lng_try_filepath($path, "language/{$lang_try}/{$filename_ext}")) {
221 221
         break;
222 222
       }
223 223
 
224
-      if($file_path = $this->lng_try_filepath($path, "language/{$filename}_{$lang_try}{$ext}")) {
224
+      if ($file_path = $this->lng_try_filepath($path, "language/{$filename}_{$lang_try}{$ext}")) {
225 225
         break;
226 226
       }
227 227
 
228 228
       $file_path = '';
229 229
     }
230 230
 
231
-    if($file_path) {
231
+    if ($file_path) {
232 232
       include($file_path);
233 233
 
234
-      if(!empty($a_lang_array)) {
234
+      if (!empty($a_lang_array)) {
235 235
         $this->merge($a_lang_array);
236 236
 
237 237
         // Загрузка данных из файла в кэш
238
-        if($this->cache) {
238
+        if ($this->cache) {
239 239
           classSupernova::log_file("Locale: loading '{$filename}' into cache");
240
-          foreach($a_lang_array as $key => $value) {
240
+          foreach ($a_lang_array as $key => $value) {
241 241
             $value_cache_key = $this->cache_prefix_lang . $key;
242
-            if($this->cache->__isset($value_cache_key)) {
243
-              if(is_array($value)) {
242
+            if ($this->cache->__isset($value_cache_key)) {
243
+              if (is_array($value)) {
244 244
                 $alt_value = $this->cache->__get($value_cache_key);
245 245
                 $value = array_replace_recursive($alt_value, $value);
246 246
               }
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
         }
251 251
       }
252 252
 
253
-      if($this->cache) {
253
+      if ($this->cache) {
254 254
         $this->cache->__set($cache_file_key, true);
255 255
       }
256 256
 
@@ -263,14 +263,14 @@  discard block
 block discarded – undo
263 263
   }
264 264
 
265 265
   public function lng_load_i18n($i18n) {
266
-    if(!isset($i18n)) {
266
+    if (!isset($i18n)) {
267 267
       return;
268 268
     }
269 269
 
270
-    foreach($i18n as $i18n_data) {
271
-      if(is_string($i18n_data)) {
270
+    foreach ($i18n as $i18n_data) {
271
+      if (is_string($i18n_data)) {
272 272
         $this->lng_include($i18n_data);
273
-      } elseif(is_array($i18n_data)) {
273
+      } elseif (is_array($i18n_data)) {
274 274
         $this->lng_include($i18n_data['file'], $i18n_data['path']);
275 275
       }
276 276
     }
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 
289 289
     classSupernova::log_file("locale.switch: Trying to switch language to '{$language_new}'");
290 290
 
291
-    if($language_new == $this->active) {
291
+    if ($language_new == $this->active) {
292 292
       classSupernova::log_file("locale.switch: New language '{$language_new}' is equal to current language '{$this->active}' - EXIT", -1);
293 293
       return false;
294 294
     }
@@ -299,10 +299,10 @@  discard block
 block discarded – undo
299 299
     $this['LANG_INFO'] = $this->lng_get_info($this->active);
300 300
     $this->make_fallback($this->active);
301 301
 
302
-    if($this->cache) {
302
+    if ($this->cache) {
303 303
       $cache_lang_init_status = $this->cache->__get($this->cache_prefix_lang . '__INIT');
304 304
       classSupernova::log_file("locale.switch: Cache for '{$this->active}' prefixed '{$this->cache_prefix_lang}' is " . ($cache_lang_init_status ? 'already loaded. Doing nothing - EXIT' : 'EMPTY'), $cache_lang_init_status ? -1 : 0);
305
-      if($cache_lang_init_status) {
305
+      if ($cache_lang_init_status) {
306 306
         return false;
307 307
       }
308 308
 
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
     // Loading global language files
319 319
     $this->lng_load_i18n($sn_mvc['i18n']['']);
320 320
 
321
-    if($this->cache) {
321
+    if ($this->cache) {
322 322
       classSupernova::log_file("locale.switch: Cache - setting flag " . $this->cache_prefix_lang . '__INIT');
323 323
       $this->cache->__set($this->cache_prefix_lang . '__INIT', true);
324 324
     }
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
   public function lng_get_info($entry) {
333 333
     $file_name = SN_ROOT_PHYSICAL . 'language/' . $entry . '/language.mo.php';
334 334
     $lang_info = array();
335
-    if(file_exists($file_name)) {
335
+    if (file_exists($file_name)) {
336 336
       include($file_name);
337 337
     }
338 338
 
@@ -340,15 +340,15 @@  discard block
 block discarded – undo
340 340
   }
341 341
 
342 342
   public function lng_get_list() {
343
-    if(empty($this->lang_list)) {
343
+    if (empty($this->lang_list)) {
344 344
       $this->lang_list = array();
345 345
 
346 346
       $path = SN_ROOT_PHYSICAL . 'language/';
347 347
       $dir = dir($path);
348
-      while(false !== ($entry = $dir->read())) {
349
-        if(is_dir($path . $entry) && $entry[0] != '.') {
348
+      while (false !== ($entry = $dir->read())) {
349
+        if (is_dir($path . $entry) && $entry[0] != '.') {
350 350
           $lang_info = $this->lng_get_info($entry);
351
-          if($lang_info['LANG_NAME_ISO2'] == $entry) {
351
+          if ($lang_info['LANG_NAME_ISO2'] == $entry) {
352 352
             $this->lang_list[$lang_info['LANG_NAME_ISO2']] = $lang_info;
353 353
           }
354 354
         }
Please login to merge, or discard this patch.
classes/OldDbChangeSet.php 2 patches
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.
Spacing   +24 added lines, -26 removed lines patch added patch discarded remove patch
@@ -25,14 +25,14 @@  discard block
 block discarded – undo
25 25
    */
26 26
   public static function db_changeset_prepare_unit($unit_id, $unit_value, $user, $planet_id = null)
27 27
   {
28
-    if(!is_array($user))
28
+    if (!is_array($user))
29 29
     {
30 30
       // TODO - remove later
31 31
       print('<h1>СООБЩИТЕ ЭТО АДМИНУ: OldDbChangeSet::db_changeset_prepare_unit() - USER is not ARRAY</h1>');
32 32
       pdump(debug_backtrace());
33 33
       die('USER is not ARRAY');
34 34
     }
35
-    if(!isset($user['id']) || !$user['id'])
35
+    if (!isset($user['id']) || !$user['id'])
36 36
     {
37 37
       // TODO - remove later
38 38
       print('<h1>СООБЩИТЕ ЭТО АДМИНУ: OldDbChangeSet::db_changeset_prepare_unit() - USER[id] пустой</h1>');
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     $location_id = $location_id ? $location_id : 'NULL';
48 48
 
49 49
     $temp = DBStaticUnit::db_unit_by_location($user['id'], $unit_location, $location_id, $unit_id);
50
-    if(!empty($temp['unit_id']))
50
+    if (!empty($temp['unit_id']))
51 51
     {
52 52
       $db_changeset = array(
53 53
         'action' => SQL_OP_UPDATE,
@@ -93,9 +93,9 @@  discard block
 block discarded – undo
93 93
   }
94 94
 
95 95
   public static function db_changeset_condition_compile(&$conditions, &$table_name = '') {
96
-    if(!$conditions[P_LOCATION] || $conditions[P_LOCATION] == LOC_NONE) {
96
+    if (!$conditions[P_LOCATION] || $conditions[P_LOCATION] == LOC_NONE) {
97 97
       $conditions[P_LOCATION] = LOC_NONE;
98
-      switch($table_name) {
98
+      switch ($table_name) {
99 99
         case 'users':
100 100
         case LOC_USER:
101 101
           $conditions[P_TABLE_NAME] = $table_name = 'users';
@@ -117,18 +117,18 @@  discard block
 block discarded – undo
117 117
     }
118 118
 
119 119
     $conditions[P_FIELDS_STR] = '';
120
-    if($conditions['fields']) {
120
+    if ($conditions['fields']) {
121 121
       $fields = array();
122
-      foreach($conditions['fields'] as $field_name => $field_data) {
122
+      foreach ($conditions['fields'] as $field_name => $field_data) {
123 123
         $condition = "`{$field_name}` = ";
124 124
         $value = '';
125
-        if($field_data['delta']) {
125
+        if ($field_data['delta']) {
126 126
           $value = "`{$field_name}`" . ($field_data['delta'] >= 0 ? '+' : '') . $field_data['delta'];
127
-        } elseif($field_data['set']) {
128
-          $value = (is_string($field_data['set']) ? "'{$field_data['set']}'": $field_data['set']);
127
+        } elseif ($field_data['set']) {
128
+          $value = (is_string($field_data['set']) ? "'{$field_data['set']}'" : $field_data['set']);
129 129
         }
130 130
 
131
-        if($value) {
131
+        if ($value) {
132 132
           $fields[] = $condition . $value;
133 133
         }
134 134
       }
@@ -136,16 +136,14 @@  discard block
 block discarded – undo
136 136
     }
137 137
 
138 138
     $conditions[P_WHERE_STR] = '';
139
-    if(!empty($conditions['where'])) {
140
-      if($conditions[P_VERSION] == 1) {
139
+    if (!empty($conditions['where'])) {
140
+      if ($conditions[P_VERSION] == 1) {
141 141
         $the_conditions = array();
142
-        foreach($conditions['where'] as $field_id => $field_value) {
142
+        foreach ($conditions['where'] as $field_id => $field_value) {
143 143
           // Простое условие - $field_id = $field_value
144
-          if(is_string($field_id)) {
144
+          if (is_string($field_id)) {
145 145
             $field_value =
146
-              $field_value === null ? 'NULL' :
147
-                (is_string($field_value) ? "'" . db_escape($field_value) . "'" :
148
-                  (is_bool($field_value) ? intval($field_value) : $field_value));
146
+              $field_value === null ? 'NULL' : (is_string($field_value) ? "'" . db_escape($field_value) . "'" : (is_bool($field_value) ? intval($field_value) : $field_value));
149 147
             $the_conditions[] = "`{$field_id}` = {$field_value}";
150 148
           } else {
151 149
             die('Неподдерживаемый тип условия');
@@ -157,7 +155,7 @@  discard block
 block discarded – undo
157 155
       $conditions[P_WHERE_STR] = implode(' AND ', $the_conditions);
158 156
     }
159 157
 
160
-    switch($conditions['action']) {
158
+    switch ($conditions['action']) {
161 159
       case SQL_OP_DELETE: $conditions[P_ACTION_STR] = ("DELETE FROM {{{$table_name}}}"); break;
162 160
       case SQL_OP_UPDATE: $conditions[P_ACTION_STR] = ("UPDATE {{{$table_name}}} SET"); break;
163 161
       case SQL_OP_INSERT: $conditions[P_ACTION_STR] = ("INSERT INTO {{{$table_name}}} SET"); break;
@@ -176,17 +174,17 @@  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)) return $result;
180 178
 
181
-    foreach($db_changeset as $table_name => &$table_data) {
182
-      foreach($table_data as $record_id => &$conditions) {
179
+    foreach ($db_changeset as $table_name => &$table_data) {
180
+      foreach ($table_data as $record_id => &$conditions) {
183 181
         OldDbChangeSet::db_changeset_condition_compile($conditions, $table_name);
184 182
 
185
-        if($conditions['action'] != SQL_OP_DELETE && !$conditions[P_FIELDS_STR]) continue;
186
-        if($conditions['action'] == SQL_OP_DELETE && !$conditions[P_WHERE_STR]) continue; // Защита от случайного удаления всех данных в таблице
183
+        if ($conditions['action'] != SQL_OP_DELETE && !$conditions[P_FIELDS_STR]) continue;
184
+        if ($conditions['action'] == SQL_OP_DELETE && !$conditions[P_WHERE_STR]) continue; // Защита от случайного удаления всех данных в таблице
187 185
 
188
-        if($conditions[P_LOCATION] != LOC_NONE) {
189
-          switch($conditions['action'])
186
+        if ($conditions[P_LOCATION] != LOC_NONE) {
187
+          switch ($conditions['action'])
190 188
           {
191 189
             case SQL_OP_DELETE: $result = classSupernova::db_del_record_list($conditions[P_LOCATION], $conditions[P_WHERE_STR]) && $result; break;
192 190
             case SQL_OP_UPDATE: $result = classSupernova::db_upd_record_list($conditions[P_LOCATION], $conditions[P_WHERE_STR], $conditions[P_FIELDS_STR]) && $result; break;
Please login to merge, or discard this patch.
classes/Core/Watchdog.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
     $configValue = $forceLoad ? $this->config->db_loadItem($configName) : $this->config[$configName];
36 36
     $configType == WATCHDOG_TIME_SQL ? $configValue = strtotime($configValue, SN_TIME_NOW) : false;
37 37
 
38
-    if(SN_TIME_NOW - $configValue > $timeDiff) {
38
+    if (SN_TIME_NOW - $configValue > $timeDiff) {
39 39
       $callable();
40 40
     }
41 41
 
Please login to merge, or discard this patch.