Completed
Push — trunk ( cc9b3e...f009e4 )
by SuperNova.WS
04:37
created
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/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.
classes/Core/Autoloader.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -20,11 +20,11 @@  discard block
 block discarded – undo
20 20
    */
21 21
   public static function autoloader($class) {
22 22
     $classFile = str_replace('\\', '/', $class);
23
-    foreach(static::$folders as $folder) {
23
+    foreach (static::$folders as $folder) {
24 24
       $classFullFileName = str_replace('\\', '/', $folder . $classFile) . DOT_PHP_EX;
25
-      if(file_exists($classFullFileName) && is_file($classFullFileName)) {
25
+      if (file_exists($classFullFileName) && is_file($classFullFileName)) {
26 26
         require_once($classFullFileName);
27
-        if(method_exists($class, '_constructorStatic')) {
27
+        if (method_exists($class, '_constructorStatic')) {
28 28
           $class::_constructorStatic();
29 29
         }
30 30
       }
@@ -35,20 +35,20 @@  discard block
 block discarded – undo
35 35
    * @param string $absoluteClassRoot - absolute path to root class folder
36 36
    */
37 37
   public static function register($absoluteClassRoot) {
38
-    if(!static::$autoloaderRegistered) {
38
+    if (!static::$autoloaderRegistered) {
39 39
       spl_autoload_register(array(__CLASS__, 'autoloader'));
40 40
       static::$autoloaderRegistered = true;
41 41
     }
42 42
 
43 43
     $absoluteClassRoot = str_replace('\\', '/', $absoluteClassRoot);
44 44
 
45
-    if(!($absoluteClassRoot = realpath($absoluteClassRoot))) {
45
+    if (!($absoluteClassRoot = realpath($absoluteClassRoot))) {
46 46
       return;
47 47
     }
48 48
 
49 49
     $absoluteClassRoot = str_replace('\\', '/', $absoluteClassRoot) . '/';
50 50
 
51
-    if(!isset(static::$folders[$absoluteClassRoot])) {
51
+    if (!isset(static::$folders[$absoluteClassRoot])) {
52 52
       static::$folders[$absoluteClassRoot] = $absoluteClassRoot;
53 53
     }
54 54
   }
Please login to merge, or discard this patch.
includes/alliance/ali_internal_admin_rights.inc 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 global $lang, $debug;
4 4
 
5
-if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)
5
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)
6 6
 {
7 7
   $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
8 8
 }
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 
16 16
 if ($new_rank_name = sys_get_param_str('newRankName'))
17 17
 {
18
-  foreach($ally_rights as $fieldName)
18
+  foreach ($ally_rights as $fieldName)
19 19
   {
20 20
     $newRank[$fieldName] = 0;
21 21
   }
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
 {
29 29
   unset($ranks);
30 30
 
31
-  foreach($rankListInput as $rankID => $rank)
31
+  foreach ($rankListInput as $rankID => $rank)
32 32
   {
33
-    foreach($ally_rights as $rightName)
33
+    foreach ($ally_rights as $rightName)
34 34
     {
35 35
       $ranks[$rankID][$rightName] = $rank[$rightName] ? 1 : 0;
36 36
     }
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 $d = sys_get_param_int('d');
42 42
 if ($d && isset($ranks[$d]))
43 43
 {
44
-  if(count($ranks) == 1)
44
+  if (count($ranks) == 1)
45 45
   {
46 46
     messageBox($lang['ali_adm_lastRank'], $lang['ali_adm_rights_title']);
47 47
   }
@@ -53,16 +53,16 @@  discard block
 block discarded – undo
53 53
 
54 54
 if (count($ranks))
55 55
 {
56
-  foreach($ranks as $rankID => $rank)
56
+  foreach ($ranks as $rankID => $rank)
57 57
   {
58 58
     $rank_data = array(
59 59
       'ID'   => $rankID,
60 60
       'NAME' => $rank['name'],
61 61
     );
62 62
 
63
-    for($i = 1; $i < count($rank); $i++)
63
+    for ($i = 1; $i < count($rank); $i++)
64 64
     {
65
-      $rank_data['R' . $i] = (($rank[$ally_rights[$i]] == 1) ? ' checked' : '') ;
65
+      $rank_data['R' . $i] = (($rank[$ally_rights[$i]] == 1) ? ' checked' : '');
66 66
       $rank_data['N' . $i] = $ally_rights[$i];
67 67
     }
68 68
 
Please login to merge, or discard this patch.
includes/functions/_deprecated.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
  * @return mixed
14 14
  * @deprecated
15 15
  */
16
-function RestoreFleetToPlanet(&$fleet_row, $start = true, $only_resources = false, $safe_fleet = false){return sn_function_call('RestoreFleetToPlanet', array(&$fleet_row, $start, $only_resources, $safe_fleet, &$result));}
16
+function RestoreFleetToPlanet(&$fleet_row, $start = true, $only_resources = false, $safe_fleet = false) {return sn_function_call('RestoreFleetToPlanet', array(&$fleet_row, $start, $only_resources, $safe_fleet, &$result)); }
17 17
 /**
18 18
  * @param array $fleet_row
19 19
  * @param bool  $start
Please login to merge, or discard this patch.
includes/functions/sys_user.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 function sys_user_vacation($user) {
10 10
   global $config;
11 11
 
12
-  if(sys_get_param_str('vacation') == 'leave') {
12
+  if (sys_get_param_str('vacation') == 'leave') {
13 13
     if ($user['vacation'] < SN_TIME_NOW) {
14 14
       $user['vacation'] = 0;
15 15
       $user['vacation_next'] = SN_TIME_NOW + $config->player_vacation_timeout;
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
     }
18 18
   }
19 19
 
20
-  if($user['vacation']) {
20
+  if ($user['vacation']) {
21 21
     // sn_sys_logout(false, true);
22 22
     // core_auth::logout(false, true);
23 23
 
@@ -52,33 +52,33 @@  discard block
 block discarded – undo
52 52
   // TODO: Full rewrite
53 53
   sn_db_transaction_start();
54 54
   $TheUser = db_user_by_id($UserID);
55
-  if ( $TheUser['ally_id'] != 0 ) {
56
-    $TheAlly = doquery ( "SELECT * FROM `{{alliance}}` WHERE `id` = '" . $TheUser['ally_id'] . "';", '', true );
55
+  if ($TheUser['ally_id'] != 0) {
56
+    $TheAlly = doquery("SELECT * FROM `{{alliance}}` WHERE `id` = '" . $TheUser['ally_id'] . "';", '', true);
57 57
     $TheAlly['ally_members'] -= 1;
58
-    if ( $TheAlly['ally_members'] > 0 ) {
59
-      doquery ( "UPDATE `{{alliance}}` SET `ally_members` = '" . $TheAlly['ally_members'] . "' WHERE `id` = '" . $TheAlly['id'] . "';");
58
+    if ($TheAlly['ally_members'] > 0) {
59
+      doquery("UPDATE `{{alliance}}` SET `ally_members` = '" . $TheAlly['ally_members'] . "' WHERE `id` = '" . $TheAlly['id'] . "';");
60 60
     } else {
61
-      doquery ( "DELETE FROM `{{alliance}}` WHERE `id` = '" . $TheAlly['id'] . "';");
62
-      doquery ( "DELETE FROM `{{statpoints}}` WHERE `stat_type` = '2' AND `id_owner` = '" . $TheAlly['id'] . "';");
61
+      doquery("DELETE FROM `{{alliance}}` WHERE `id` = '" . $TheAlly['id'] . "';");
62
+      doquery("DELETE FROM `{{statpoints}}` WHERE `stat_type` = '2' AND `id_owner` = '" . $TheAlly['id'] . "';");
63 63
     }
64 64
   }
65
-  doquery ( "DELETE FROM `{{statpoints}}` WHERE `stat_type` = '1' AND `id_owner` = '" . $UserID . "';");
65
+  doquery("DELETE FROM `{{statpoints}}` WHERE `stat_type` = '1' AND `id_owner` = '" . $UserID . "';");
66 66
 
67 67
   DBStaticPlanet::db_planet_list_delete_by_owner($UserID);
68 68
 
69
-  doquery ( "DELETE FROM `{{messages}}` WHERE `message_sender` = '" . $UserID . "';");
70
-  doquery ( "DELETE FROM `{{messages}}` WHERE `message_owner` = '" . $UserID . "';");
71
-  doquery ( "DELETE FROM `{{notes}}` WHERE `owner` = '" . $UserID . "';");
69
+  doquery("DELETE FROM `{{messages}}` WHERE `message_sender` = '" . $UserID . "';");
70
+  doquery("DELETE FROM `{{messages}}` WHERE `message_owner` = '" . $UserID . "';");
71
+  doquery("DELETE FROM `{{notes}}` WHERE `owner` = '" . $UserID . "';");
72 72
   db_fleet_list_delete_by_owner($UserID);
73 73
 //  doquery ( "DELETE FROM `{{rw}}` WHERE `id_owner1` = '" . $UserID . "';");
74 74
 //  doquery ( "DELETE FROM `{{rw}}` WHERE `id_owner2` = '" . $UserID . "';");
75
-  doquery ( "DELETE FROM `{{buddy}}` WHERE `BUDDY_SENDER_ID` = '" . $UserID . "';");
76
-  doquery ( "DELETE FROM `{{buddy}}` WHERE `BUDDY_OWNER_ID` = '" . $UserID . "';");
77
-  doquery ( "DELETE FROM `{{annonce}}` WHERE `user` = '" . $UserID . "';");
75
+  doquery("DELETE FROM `{{buddy}}` WHERE `BUDDY_SENDER_ID` = '" . $UserID . "';");
76
+  doquery("DELETE FROM `{{buddy}}` WHERE `BUDDY_OWNER_ID` = '" . $UserID . "';");
77
+  doquery("DELETE FROM `{{annonce}}` WHERE `user` = '" . $UserID . "';");
78 78
 
79 79
 
80 80
   classSupernova::db_del_record_by_id(LOC_USER, $UserID);
81
-  doquery ( "DELETE FROM `{{referrals}}` WHERE (`id` = '{$UserID}') OR (`id_partner` = '{$UserID}');");
81
+  doquery("DELETE FROM `{{referrals}}` WHERE (`id` = '{$UserID}') OR (`id_partner` = '{$UserID}');");
82 82
   global $config;
83 83
   $config->db_saveItem('users_amount', $config->db_loadItem('users_amount') - 1);
84 84
   sn_db_transaction_commit();
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
   \DBAL\DbQuery::build()->setTable('users')->setValues($field_set)->doInsert();
181 181
   $user_new = db_user_by_id(db_insert_id());
182 182
 
183
-  if(!($options['galaxy'] && $options['system'] && $options['planet'])) {
183
+  if (!($options['galaxy'] && $options['system'] && $options['planet'])) {
184 184
     $options['galaxy'] = $config->LastSettedGalaxyPos;
185 185
     $options['system'] = $config->LastSettedSystemPos;
186 186
     $segment_size = floor($config->game_maxPlanet / 3);
@@ -188,19 +188,19 @@  discard block
 block discarded – undo
188 188
     $segment++;
189 189
     $options['planet'] = mt_rand(1 + $segment * $segment_size, ($segment + 1) * $segment_size);
190 190
 
191
-    while(true) {
192
-      if($options['planet'] > $config->game_maxPlanet) {
191
+    while (true) {
192
+      if ($options['planet'] > $config->game_maxPlanet) {
193 193
         $options['planet'] = mt_rand(0, $segment_size - 1) + 1;
194 194
         $options['system']++;
195 195
       }
196
-      if($options['system'] > $config->game_maxSystem) {
196
+      if ($options['system'] > $config->game_maxSystem) {
197 197
         $options['system'] = 1;
198 198
         $options['galaxy']++;
199 199
       }
200 200
       $options['galaxy'] > $config->game_maxGalaxy ? $options['galaxy'] = 1 : false;
201 201
 
202 202
       $galaxy_row = DBStaticPlanet::db_planet_by_gspt($options['galaxy'], $options['system'], $options['planet'], PT_PLANET, true, 'id');
203
-      if(!$galaxy_row['id']) {
203
+      if (!$galaxy_row['id']) {
204 204
         $config->db_saveItem(array(
205 205
           'LastSettedGalaxyPos' => $options['galaxy'],
206 206
           'LastSettedSystemPos' => $options['system'],
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
   $username_safe = db_escape($username_unsafe);
224 224
   doquery("REPLACE INTO {{player_name_history}} SET `player_id` = {$user_new['id']}, `player_name` = '{$username_safe}'");
225 225
 
226
-  if(!empty($options['partner_id']) && ($referral_row = db_user_by_id($options['partner_id'], true))) {
226
+  if (!empty($options['partner_id']) && ($referral_row = db_user_by_id($options['partner_id'], true))) {
227 227
     doquery("INSERT INTO {{referrals}} SET `id` = {$user_new['id']}, `id_partner` = {$options['partner_id']}");
228 228
   }
229 229
 
Please login to merge, or discard this patch.
includes/pages/chat.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
   $user_auth_level = isset($user['authlevel']) ? $user['authlevel'] : AUTH_LEVEL_ANONYMOUS;
15 15
 
16 16
   $mode = sys_get_param_int('mode');
17
-  switch($mode)
17
+  switch ($mode)
18 18
   {
19 19
     case CHAT_MODE_ALLY:
20 20
       $template_result['ALLY'] = intval($user['ally_id']);
@@ -28,12 +28,12 @@  discard block
 block discarded – undo
28 28
   }
29 29
 
30 30
   $template_result['.']['smiles'] = array();
31
-  foreach(classSupernova::$gc->design->getSmilesList() as $auth_level => $replaces) {
32
-    if($auth_level > $user_auth_level) {
31
+  foreach (classSupernova::$gc->design->getSmilesList() as $auth_level => $replaces) {
32
+    if ($auth_level > $user_auth_level) {
33 33
       continue;
34 34
     }
35 35
 
36
-    foreach($replaces as $bbcode => $filename)
36
+    foreach ($replaces as $bbcode => $filename)
37 37
     {
38 38
       $template_result['.']['smiles'][] = array(
39 39
         'BBCODE' => $bbcode,
@@ -57,12 +57,12 @@  discard block
 block discarded – undo
57 57
 
58 58
   define('IN_AJAX', true);
59 59
 
60
-  if($config->getMode() != classCache::CACHER_NO_CACHE && $config->chat_timeout && SN_TIME_MICRO - $config->array_get('users', $user['id'], 'chat_last_activity') > $config->chat_timeout)
60
+  if ($config->getMode() != classCache::CACHER_NO_CACHE && $config->chat_timeout && SN_TIME_MICRO - $config->array_get('users', $user['id'], 'chat_last_activity') > $config->chat_timeout)
61 61
   {
62 62
     die();
63 63
   }
64 64
 
65
-  if(($message = sys_get_param_str('message')) && $user['username'])
65
+  if (($message = sys_get_param_str('message')) && $user['username'])
66 66
   {
67 67
     $ally_id = sys_get_param('ally') && $user['ally_id'] ? $user['ally_id'] : 0;
68 68
     $nick = db_escape(player_nick_compact(player_nick_render_current_to_array($user, array('color' => true, 'icons' => true, 'ally' => !$ally_id))));
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
   define('IN_AJAX', true);
84 84
 
85 85
   $history = sys_get_param_str('history');
86
-  if(!$history)
86
+  if (!$history)
87 87
   {
88 88
     $config->array_set('users', $user['id'], 'chat_last_refresh', SN_TIME_MICRO);
89 89
   }
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
   $last_message = '';
93 93
   $alliance = 0;
94 94
   $template_result['.']['chat'] = array();
95
-  if(!$history && $config->getMode() != classCache::CACHER_NO_CACHE && $config->chat_timeout && SN_TIME_MICRO - $config->array_get('users', $user['id'], 'chat_last_activity') > $config->chat_timeout)
95
+  if (!$history && $config->getMode() != classCache::CACHER_NO_CACHE && $config->chat_timeout && SN_TIME_MICRO - $config->array_get('users', $user['id'], 'chat_last_activity') > $config->chat_timeout)
96 96
   {
97 97
     $result['disable'] = true;
98 98
     $template_result['.']['chat'][] = array(
@@ -108,12 +108,12 @@  discard block
 block discarded – undo
108 108
 
109 109
     $where_add = '';
110 110
     $last_message = 0;
111
-    if($history)
111
+    if ($history)
112 112
     {
113 113
       $rows = doquery("SELECT count(1) AS CNT FROM {{chat}} WHERE ally_id = '{$alliance}';", true);
114 114
       $page_count = ceil($rows['CNT'] / $page_limit);
115 115
 
116
-      for($i = 0; $i < $page_count; $i++)
116
+      for ($i = 0; $i < $page_count; $i++)
117 117
       {
118 118
         $template_result['.']['page'][] = array(
119 119
           'NUMBER' => $i
@@ -135,13 +135,13 @@  discard block
 block discarded – undo
135 135
         {{chat}} AS c
136 136
         LEFT JOIN {{users}} AS u ON u.id = c.chat_message_sender_id
137 137
       WHERE c.chat_message_recipient_id IS NULL AND c.ally_id = '{$alliance}' {$where_add} ORDER BY messageid DESC LIMIT {$start_row}, {$page_limit};");
138
-    while($chat_row = db_fetch($query))
138
+    while ($chat_row = db_fetch($query))
139 139
     {
140 140
       // Little magik here - to retain HTML codes from DB and stripping HTML codes from nick
141 141
       $chat_row['user'] = player_nick_render_to_html($chat_row['user']);
142 142
       $nick_stripped = htmlentities(strip_tags($chat_row['user']), ENT_QUOTES, 'utf-8');
143 143
       $nick = str_replace(strip_tags($chat_row['user']), $nick_stripped, $chat_row['user']);
144
-      if(!$history)
144
+      if (!$history)
145 145
       {
146 146
         $nick = "<span style=\"cursor: pointer;\" onclick=\"addSmiley('({$nick_stripped})');\">{$nick}</span>";
147 147
       }
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
   $template = gettemplate('chat_messages', $template);
168 168
   $template->assign_recursive($template_result);
169 169
 
170
-  if($history)
170
+  if ($history)
171 171
   {
172 172
     $pageTitle = "{$lang['chat_history']} - {$lang[$alliance ? 'chat_ally' : 'chat_common']}";
173 173
     display($template, $pageTitle);
Please login to merge, or discard this patch.
classes/HelperArray.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
    * @return array
241 241
    */
242 242
   public static function parseParamStrings($array, $delimiter = '=') {
243
-    !is_array($array) ? $array = array((string)$array) : false;
243
+    !is_array($array) ? $array = array((string) $array) : false;
244 244
 
245 245
     $result = array();
246 246
     foreach ($array as $param) {
@@ -262,8 +262,8 @@  discard block
 block discarded – undo
262 262
    * @return float|null
263 263
    */
264 264
   public static function maxValueByField(&$array, $fieldName) {
265
-    return array_reduce($array, function ($carry, $item) use ($fieldName) {
266
-      if(is_array($item) && isset($item[$fieldName]) && (!isset($carry) || $carry < $item[$fieldName])) {
265
+    return array_reduce($array, function($carry, $item) use ($fieldName) {
266
+      if (is_array($item) && isset($item[$fieldName]) && (!isset($carry) || $carry < $item[$fieldName])) {
267 267
         $carry = $item[$fieldName];
268 268
       }
269 269
 
@@ -280,8 +280,8 @@  discard block
 block discarded – undo
280 280
 
281 281
     return
282 282
       array_reduce($array,
283
-        function ($carry, $item) use (&$fieldName, $maxValue) {
284
-          if(is_array($item) && isset($item[$fieldName]) && $item[$fieldName] == $maxValue) {
283
+        function($carry, $item) use (&$fieldName, $maxValue) {
284
+          if (is_array($item) && isset($item[$fieldName]) && $item[$fieldName] == $maxValue) {
285 285
             $carry[] = $item;
286 286
           }
287 287
 
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
   }
293 293
 
294 294
   public static function intersectByKeys(array &$array1, array &$array2) {
295
-    return array_uintersect_assoc($array1, $array2, function ($a, $b) {return 0;});
295
+    return array_uintersect_assoc($array1, $array2, function($a, $b) {return 0; });
296 296
   }
297 297
 
298 298
 }
Please login to merge, or discard this patch.