Completed
Push — work-fleets ( 1ceb9c...9cd586 )
by SuperNova.WS
04:56
created
includes/includes/flt_page1.inc 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -4,18 +4,18 @@  discard block
 block discarded – undo
4 4
 // @version 1.0
5 5
 // @copyright 2008 by Chlorel for XNova
6 6
 
7
-if(SN_IN_FLEET !== true) {
7
+if (SN_IN_FLEET !== true) {
8 8
   $debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403);
9 9
 }
10 10
 
11 11
 $template = gettemplate('fleet1', true);
12 12
 
13 13
 $ships = sys_get_param('ships', array());
14
-if(!is_array($ships)) {
14
+if (!is_array($ships)) {
15 15
   $ships = array();
16 16
 }
17 17
 
18
-foreach(array(PT_PLANET, PT_DEBRIS, PT_MOON) as $possible_planet_type_id) {
18
+foreach (array(PT_PLANET, PT_DEBRIS, PT_MOON) as $possible_planet_type_id) {
19 19
   $template->assign_block_vars('possible_planet_type_id', array(
20 20
     'ID' => $possible_planet_type_id,
21 21
     'NAME' => $lang['sys_planet_type_sh'][$possible_planet_type_id],
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
   'START_NAME'         => $planetrow['name'],
29 29
 );
30 30
 
31
-if(!empty($TargetPlanet)) {
31
+if (!empty($TargetPlanet)) {
32 32
   $template_route += array(
33 33
     'END_TYPE_TEXT_SH' => $lang['sys_planet_type_sh'][$TargetPlanet['planet_type']],
34 34
     'END_COORDS'       => uni_render_coordinates($TargetPlanet),
@@ -39,10 +39,10 @@  discard block
 block discarded – undo
39 39
 $template->assign_block_vars('fleets', $template_route);
40 40
 
41 41
 $sn_groups_fleet = sn_get_groups('fleet');
42
-foreach($ships as $ship_id => $ship_count) {
43
-  if(in_array($ship_id, $sn_groups_fleet) && $ship_count) {
42
+foreach ($ships as $ship_id => $ship_count) {
43
+  if (in_array($ship_id, $sn_groups_fleet) && $ship_count) {
44 44
     $ship_info = get_unit_param($ship_id);
45
-    if($ship_count > mrc_get_level($user, $planetrow, $ship_id, false, true)) {
45
+    if ($ship_count > mrc_get_level($user, $planetrow, $ship_id, false, true)) {
46 46
       $page .= $lang['fl_noenought'];
47 47
     } else {
48 48
       $fleet['fleetarray'][$ship_id]  = $ship_count;
@@ -61,13 +61,13 @@  discard block
 block discarded – undo
61 61
   }
62 62
 }
63 63
 
64
-if(empty($fleet['fleetarray'])) {
64
+if (empty($fleet['fleetarray'])) {
65 65
   message($lang['fl_err_no_ships'], $lang['fl_error'], 'fleet' . DOT_PHP_EX, 5);
66 66
 }
67 67
 
68 68
 // Building list of shortcuts
69 69
 $query = doquery("SELECT * FROM {{notes}} WHERE `owner` = {$user['id']} AND `galaxy` <> 0 AND `system` <> 0 AND `planet` <> 0 ORDER BY `priority` DESC, `galaxy`, `system`, `planet`, `planet_type`;");
70
-while($shortcut = db_fetch($query)) {
70
+while ($shortcut = db_fetch($query)) {
71 71
   $template->assign_block_vars('shortcut', array(
72 72
     'NAME'       => $shortcut['title'],
73 73
     'GALAXY'     => $shortcut['galaxy'],
@@ -81,10 +81,10 @@  discard block
 block discarded – undo
81 81
 }
82 82
 
83 83
 // Building list of own planets & moons
84
-$colonies = db_planet_list_sorted ( $user );
85
-if(count($colonies) > 1) {
84
+$colonies = db_planet_list_sorted($user);
85
+if (count($colonies) > 1) {
86 86
   // while($row = db_fetch($colonies))
87
-  foreach($colonies as $row) {
87
+  foreach ($colonies as $row) {
88 88
     $template->assign_block_vars('colonies', array(
89 89
       'NAME'       => $row['name'],
90 90
       'GALAXY'     => $row['galaxy'],
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
 //ACS Start
100 100
 //Need to look for acs attacks.
101 101
 $aks_madnessred = doquery('SELECT * FROM {{aks}};');
102
-while($row = db_fetch($aks_madnessred)) {
102
+while ($row = db_fetch($aks_madnessred)) {
103 103
   $members = explode(',', $row['eingeladen']);
104
-  foreach($members as $a => $b) {
104
+  foreach ($members as $a => $b) {
105 105
     if ($b == $user['id']) {
106 106
       $template->assign_block_vars('acss', array(
107 107
         'ID'         => $row['id'],
Please login to merge, or discard this patch.
includes/includes/ube_zi_helpers.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
27 27
   print($round);
28 28
   print('<table border=1>');
29 29
   print('<tr align="left">');
30
-  foreach($header as $key => $value)
30
+  foreach ($header as $key => $value)
31 31
   {
32
-    if(is_array($value))
32
+    if (is_array($value))
33 33
     {
34 34
       continue;
35 35
     }
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
   );
62 62
 
63 63
   print('<tr align="right">');
64
-  foreach($debug_unit_crossfire_result as $key => $value)
64
+  foreach ($debug_unit_crossfire_result as $key => $value)
65 65
   {
66
-    if(is_array($value))
66
+    if (is_array($value))
67 67
     {
68 68
       continue;
69 69
     }
Please login to merge, or discard this patch.
includes/classes/core_classes.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
     !is_array($offset) ? $offset = array($offset) : false;
39 39
 
40 40
     $current_leaf = $this->__get(reset($offset));
41
-    while(($leaf_index = next($offset)) !== false) {
42
-      if(!isset($current_leaf) || !is_array($current_leaf) || !isset($current_leaf[$leaf_index])) {
41
+    while (($leaf_index = next($offset)) !== false) {
42
+      if (!isset($current_leaf) || !is_array($current_leaf) || !isset($current_leaf[$leaf_index])) {
43 43
         unset($current_leaf);
44 44
         break;
45 45
       }
@@ -64,9 +64,9 @@  discard block
 block discarded – undo
64 64
 
65 65
     !is_array($offset) ? $offset = array($offset) : false;
66 66
 
67
-    if($this->offsetExists($offset)) {
67
+    if ($this->offsetExists($offset)) {
68 68
       $result = $this->__get(reset($offset));
69
-      while(($leaf_index = next($offset)) !== false) {
69
+      while (($leaf_index = next($offset)) !== false) {
70 70
         $result = $result[$leaf_index];
71 71
       }
72 72
     }
@@ -91,12 +91,12 @@  discard block
 block discarded – undo
91 91
    */
92 92
   public function offsetSet($offset, $value = null) {
93 93
     // Если нет никакого индекса - значит нечего записывать
94
-    if(!isset($offset) || (is_array($offset) && empty($offset))) {
94
+    if (!isset($offset) || (is_array($offset) && empty($offset))) {
95 95
       return;
96 96
     }
97 97
 
98 98
     // Если в массиве индекса только один элемент - значит это просто индекс
99
-    if(is_array($offset) && count($offset) == 1) {
99
+    if (is_array($offset) && count($offset) == 1) {
100 100
       // Разворачиваем его в индекс
101 101
       $offset = array(reset($offset) => $value);
102 102
       unset($value);
@@ -104,20 +104,20 @@  discard block
 block discarded – undo
104 104
     }
105 105
 
106 106
     // Адресация многомерного массива через массив индексов в $option
107
-    if(is_array($offset) && isset($value)) {
107
+    if (is_array($offset) && isset($value)) {
108 108
       // TODO - а не переделать ли это всё на __isset() ??
109 109
 //pdump($offset, '$offset');
110 110
 //pdump($value, '$value');
111 111
       // Вытаскиваем корневой элемент
112 112
       $root = $this->__get(reset($offset));
113 113
       $current_leaf = &$root;
114
-      while(($leaf_index = next($offset)) !== false) {
114
+      while (($leaf_index = next($offset)) !== false) {
115 115
         !is_array($current_leaf[$leaf_index]) ? $current_leaf[$leaf_index] = array() : false;
116 116
         $current_leaf = &$current_leaf[$leaf_index];
117 117
       }
118 118
 //pdump($current_leaf, '$current_leaf');
119 119
 //pdump($value, '$value');
120
-      if($current_leaf != $value) {
120
+      if ($current_leaf != $value) {
121 121
         $current_leaf = $value;
122 122
 //pdump(reset($offset), 'reset($offset)');
123 123
 //pdump($root, '$root');
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
       // Пакетная запись из массива ключ -> значение
129 129
       !is_array($offset) ? $offset = array($offset => $value) : false;
130 130
 
131
-      foreach($offset as $key => $value) {
131
+      foreach ($offset as $key => $value) {
132 132
         $this->__get($key) !== $value ? $this->__set($key, $value) : false;
133 133
       }
134 134
     }
@@ -149,13 +149,13 @@  discard block
 block discarded – undo
149 149
    */
150 150
   public function offsetUnset($offset) {
151 151
     // Если нет никакого индекса - значит нечего записывать
152
-    if(!isset($offset) || (is_array($offset) && empty($offset))) {
152
+    if (!isset($offset) || (is_array($offset) && empty($offset))) {
153 153
       return;
154 154
     }
155 155
 
156 156
     !is_array($offset) ? $offset = array($offset) : false;
157 157
 
158
-    if($this->offsetExists($offset)) {
158
+    if ($this->offsetExists($offset)) {
159 159
 //pdump($offset);
160 160
       // Перематываем массив в конец
161 161
       $key_to_delete = end($offset);
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 //pdump($key_to_delete, '$key_to_delete');
164 164
       $parent_offset = $offset;
165 165
       array_pop($parent_offset);
166
-      if(!count($parent_offset)) {
166
+      if (!count($parent_offset)) {
167 167
         // В массиве был один элемент - мы удаляем в корне. Просто удаляем элемент
168 168
         $this->__unset($key_to_delete);
169 169
       } else {
Please login to merge, or discard this patch.
includes/classes/PlayerToAccountTranslate.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
   protected static $is_init = false;
20 20
 
21 21
   protected static function init() {
22
-    if(!empty(static::$db)) {
22
+    if (!empty(static::$db)) {
23 23
       return;
24 24
     }
25 25
     static::$db = classSupernova::$db;
@@ -66,12 +66,12 @@  discard block
 block discarded – undo
66 66
     $provider_id_safe = intval($provider_id_unsafe);
67 67
     !is_array($account_list) ? $account_list = array($account_list) : false;
68 68
 
69
-    foreach($account_list as $provider_account_id_unsafe) {
69
+    foreach ($account_list as $provider_account_id_unsafe) {
70 70
       $provider_account_id_safe = intval($provider_account_id_unsafe);
71 71
 
72 72
       // TODO - Здесь могут отсутствовать аккаунты - проверять провайдером
73 73
       $query = static::$db->doquery("SELECT `user_id` FROM {{account_translate}} WHERE `provider_id` = {$provider_id_safe} AND `provider_account_id` = {$provider_account_id_safe} FOR UPDATE");
74
-      while($row = static::$db->db_fetch($query)) {
74
+      while ($row = static::$db->db_fetch($query)) {
75 75
         $account_translation[$row['user_id']][$provider_id_unsafe][$provider_account_id_unsafe] = true;
76 76
       }
77 77
     }
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
       "SELECT * FROM {{account_translate}} WHERE `user_id` = {$user_id_safe} " .
92 92
       ($provider_id_unsafe ? "AND `provider_id` = {$provider_id_safe} " : '') .
93 93
       "ORDER BY `timestamp` FOR UPDATE");
94
-    while($row = static::$db->db_fetch($query)) {
94
+    while ($row = static::$db->db_fetch($query)) {
95 95
       $account_translation[$row['user_id']][$row['provider_id']][$row['provider_account_id']] = $row;
96 96
     }
97 97
 
Please login to merge, or discard this patch.
includes/classes/auth_abstract.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
    */
36 36
   // OK 4.9
37 37
   public function __construct($filename = __FILE__) {
38
-    if($this->provider_id == ACCOUNT_PROVIDER_NONE) {
38
+    if ($this->provider_id == ACCOUNT_PROVIDER_NONE) {
39 39
       die('У всех провайдеров должен быть $provider_id!');
40 40
     }
41 41
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
   // OK 4.6
134 134
   public function player_name_suggest() {
135 135
     $name = '';
136
-    if(is_object($this->account) && !empty($this->account->account_email)) {
136
+    if (is_object($this->account) && !empty($this->account->account_email)) {
137 137
       list($name) = explode('@', $this->account->account_email);
138 138
     }
139 139
 
Please login to merge, or discard this patch.
includes/classes/skin.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
    * Инициализация харнилища скинов
153 153
    */
154 154
   protected static function init() {
155
-    if(static::$is_init) {
155
+    if (static::$is_init) {
156 156
       return;
157 157
     }
158 158
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 
166 166
     // Загружены ли уже данные по текущему скину?
167 167
 //pdump(static::$skin_list[$ini_path], 'static');
168
-    if(empty(static::$skin_list[$skin_path])) {
168
+    if (empty(static::$skin_list[$skin_path])) {
169 169
       // Прогружаем текущий скин
170 170
       static::$skin_list[$skin_path] = new skin($skin_path);
171 171
       static::$active = static::$skin_list[$skin_path];
@@ -201,22 +201,22 @@  discard block
 block discarded – undo
201 201
 
202 202
     $this->is_ini_present = false;
203 203
     // Проверка на корректность и существование пути
204
-    if(is_file($this->root_physical_absolute . 'skin.ini')) {
204
+    if (is_file($this->root_physical_absolute . 'skin.ini')) {
205 205
       // Пытаемся распарсить файл
206 206
 
207 207
       // По секциям? images и config? Что бы не копировать конфигурацию? Или просто unset(__inherit) а затем заново записать
208 208
       $this->config = parse_ini_file($this->root_physical_absolute . 'skin.ini');
209
-      if(!empty($this->config)) {
209
+      if (!empty($this->config)) {
210 210
 
211 211
         $this->is_ini_present = true;
212 212
 
213
-        if(!empty($this->config['_inherit'])) {
213
+        if (!empty($this->config['_inherit'])) {
214 214
           // Если скин наследует себя...
215
-          if($this->config['_inherit'] == $skin_path) {
215
+          if ($this->config['_inherit'] == $skin_path) {
216 216
             // TODO - определять более сложные случаи циклических ссылок в _inherit
217 217
             die('">circular skin inheritance!');
218 218
           }
219
-          if(empty(static::$skin_list[$this->config['_inherit']])) {
219
+          if (empty(static::$skin_list[$this->config['_inherit']])) {
220 220
             static::$skin_list[$this->config['_inherit']] = new skin($this->config['_inherit']);
221 221
           }
222 222
           $this->parent = static::$skin_list[$this->config['_inherit']];
@@ -232,12 +232,12 @@  discard block
 block discarded – undo
232 232
     }
233 233
 
234 234
     // Пытаемся скомпилировать _no_image заранее
235
-    if(!empty($this->config[SKIN_IMAGE_MISSED_FIELD])) {
235
+    if (!empty($this->config[SKIN_IMAGE_MISSED_FIELD])) {
236 236
       $this->container[SKIN_IMAGE_MISSED_FIELD] = $this->compile_try_path(SKIN_IMAGE_MISSED_FIELD, $this->config[SKIN_IMAGE_MISSED_FIELD]);
237 237
     }
238 238
 
239 239
     // Если нет заглушки
240
-    if(empty($this->container[SKIN_IMAGE_MISSED_FIELD])) {
240
+    if (empty($this->container[SKIN_IMAGE_MISSED_FIELD])) {
241 241
       $this->container[SKIN_IMAGE_MISSED_FIELD] = empty($this->parent)
242 242
         // Если нет парента - берем хардкод
243 243
         ? $this->container[SKIN_IMAGE_MISSED_FIELD] = SN_ROOT_VIRTUAL . SKIN_IMAGE_MISSED_FILE_PATH
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
     $image_tag = $this->image_tag_parse($image_tag, $template);
268 268
 
269 269
     // Проверяем наличие ключа RIT в хранилища. В нём не может быть несуществующих файлов по построению
270
-    if(!empty($this->container[$image_tag[SKIN_IMAGE_TAG_RESOLVED]])) {
270
+    if (!empty($this->container[$image_tag[SKIN_IMAGE_TAG_RESOLVED]])) {
271 271
       return $this->container[$image_tag[SKIN_IMAGE_TAG_RESOLVED]];
272 272
     }
273 273
 
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
     // Нет - image ID не является путём к файлу. Пора обратиться к предкам за помощью...
286 286
     // Пытаемся вытащить путь из родителя и применить к нему свои параметры
287 287
     // Тащим по ID изображения, а не по ТЭГУ - мало ли что там делает с путём родитель и как преобразовывает его в строку?
288
-    if(empty($this->container[$image_id]) && !empty($this->parent)) {
288
+    if (empty($this->container[$image_id]) && !empty($this->parent)) {
289 289
       $this->container[$image_id] = $this->parent->compile_image($image_id, $template);
290 290
 
291 291
       // Если у родителя нет картинки - он вернет пустую строку. Тогда нам надо использовать заглушку - свою или родительскую
@@ -306,18 +306,18 @@  discard block
 block discarded – undo
306 306
   protected function image_tag_parse($image_tag, $template) {
307 307
     $image_tag_ptl_resolved = $image_tag;
308 308
     // Есть переменные из темплейта ?
309
-    if(strpos($image_tag_ptl_resolved, '[') !== false && is_object($template)) {
309
+    if (strpos($image_tag_ptl_resolved, '[') !== false && is_object($template)) {
310 310
       // Что бы лишний раз не запускать регексп
311 311
       // TODO - многоуровневые вложения ?! Надо ли и где их можно применить
312 312
       preg_match_all('#(\[.+?\])#', $image_tag_ptl_resolved, $matches);
313
-      foreach($matches[0] as &$match) {
313
+      foreach ($matches[0] as &$match) {
314 314
         $var_name = str_replace(array('[', ']'), '', $match);
315
-        if(strpos($var_name, '.') !== false) {
315
+        if (strpos($var_name, '.') !== false) {
316 316
           // Вложенная переменная темплейта - на текущем уровне
317 317
           // TODO Вложенная переменная из корня через "!"
318 318
           list($block_name, $block_var) = explode('.', $var_name);
319 319
           isset($template->_block_value[$block_name][$block_var]) ? $image_tag_ptl_resolved = str_replace($match, $template->_block_value[$block_name][$block_var], $image_tag_ptl_resolved) : false;
320
-        } elseif(strpos($var_name, '$') !== false) {
320
+        } elseif (strpos($var_name, '$') !== false) {
321 321
           // Корневой DEFINE
322 322
           $define_name = substr($var_name, 1);
323 323
           isset($template->_tpldata['DEFINE']['.'][$define_name]) ? $image_tag_ptl_resolved = str_replace($match, $template->_tpldata['DEFINE']['.'][$define_name], $image_tag_ptl_resolved) : false;
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
       }
329 329
     }
330 330
 
331
-    if(strpos($image_tag_ptl_resolved, '|') !== false) {
331
+    if (strpos($image_tag_ptl_resolved, '|') !== false) {
332 332
       $params = explode('|', $image_tag_ptl_resolved);
333 333
       $image_id = $params[0];
334 334
       unset($params[0]);
@@ -392,11 +392,11 @@  discard block
 block discarded – undo
392 392
     $image_string = $this->container[$image_tag];
393 393
 
394 394
     // Нет параметров - просто возвращаем значение по $image_name из контейнера
395
-    if(!empty($params) && is_array($params)) {
395
+    if (!empty($params) && is_array($params)) {
396 396
       // Здесь автоматически произойдёт упорядочивание параметров
397 397
 
398 398
       // Параметр 'html' - выводить изображение в виде HTML-тэга
399
-      if(in_array('html', $params)) {
399
+      if (in_array('html', $params)) {
400 400
         $image_tag = $image_tag . '|html';
401 401
         $image_string = '<img src="' . $image_string . '" />';
402 402
         $this->container[$image_tag] = $image_string;
Please login to merge, or discard this patch.
includes/pages/imperator.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 //    $same_user = false;
54 54
 //  }
55 55
 
56
-  if(!$user_data) {
56
+  if (!$user_data) {
57 57
     message($lang['imp_imperator_none'], $lang['sys_error'], 'index.php', 10);
58 58
     die();
59 59
   }
@@ -64,15 +64,15 @@  discard block
 block discarded – undo
64 64
   $stat_array = array();
65 65
   $query = doquery("SELECT * FROM {{statpoints}} WHERE `stat_type` = 1 AND `id_owner` = {$user_id} ORDER BY `stat_code` DESC;");
66 66
   $stat_count = classSupernova::$db->db_affected_rows();
67
-  while($row = db_fetch($query)) {
68
-    foreach($stat_fields as $field_db_name => $field_template_name) {
67
+  while ($row = db_fetch($query)) {
68
+    foreach ($stat_fields as $field_db_name => $field_template_name) {
69 69
       // $stat_count - $row['stat_code'] - для реверсирования ID статы в JS
70 70
       $stat_array[$field_template_name]['DATA'][$stat_count - $row['stat_code']] = $row[$field_db_name];
71 71
     }
72 72
   }
73 73
 
74 74
   $stat_array_date = $stat_array['STAT_DATE'];
75
-  foreach($stat_array_date['DATA'] as $key => $value) {
75
+  foreach ($stat_array_date['DATA'] as $key => $value) {
76 76
     $template->assign_block_vars('stat_date', array(
77 77
       'ID' => $key,
78 78
       'VALUE' => $value,
@@ -85,17 +85,17 @@  discard block
 block discarded – undo
85 85
 
86 86
   unset($stat_array['STAT_DATE']);
87 87
   $template_data = array();
88
-  foreach($stat_array as $stat_type => &$stat_type_data) {
88
+  foreach ($stat_array as $stat_type => &$stat_type_data) {
89 89
     $reverse_min_max = strpos($stat_type, '_RANK') !== false;
90 90
     $stat_type_data['MIN'] = $reverse_min_max ? max($stat_type_data['DATA']) : min($stat_type_data['DATA']);
91 91
     $stat_type_data['MAX'] = $reverse_min_max ? min($stat_type_data['DATA']) : max($stat_type_data['DATA']);
92 92
     $stat_type_data['AVG'] = average($stat_type_data['DATA']);
93
-    foreach($stat_type_data['DATA'] as $key => $value) {
93
+    foreach ($stat_type_data['DATA'] as $key => $value) {
94 94
       // $stat_type_data['PERCENT'][$key] = $stat_type_data['MAX'] - $value ? ($stat_type_data['MAX'] - $stat_type_data['MIN']) / ($stat_type_data['MAX'] - $value) : 100;
95 95
       $stat_type_data['PERCENT'][$key] = ($stat_type_data['MAX'] - $value ? ($value - $stat_type_data['MIN']) / ($stat_type_data['MAX'] - $stat_type_data['MIN']) : 1) * 100;
96 96
       $template_data[$stat_type][$key]['ID'] = $key;
97 97
       $template_data[$stat_type][$key]['VALUE'] = $value;
98
-      $template_data[$stat_type][$key]['DELTA'] = ($reverse_min_max ? $stat_type_data['MIN']  - $value : $value - $stat_type_data['MAX']);
98
+      $template_data[$stat_type][$key]['DELTA'] = ($reverse_min_max ? $stat_type_data['MIN'] - $value : $value - $stat_type_data['MAX']);
99 99
       $template_data[$stat_type][$key]['PERCENT'] = $stat_type_data['PERCENT'][$key];
100 100
 
101 101
 //$template_data[$stat_type][$key]['PERCENT'] = $key ? $stat_type_data['PERCENT'][$key] : 50; // TODO DEBUG
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
   }
104 104
   // pdump($stat_array['RES_POINTS']);
105 105
 
106
-  foreach($template_data as $stat_type => $stat_type_data) {
106
+  foreach ($template_data as $stat_type => $stat_type_data) {
107 107
     $template->assign_block_vars('stat', array(
108 108
       'TYPE' => $stat_type,
109 109
       'TEXT' => $lang['imp_stat_types'][$stat_type],
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
       'MAX' => $stat_array[$stat_type]['MAX'],
112 112
       'AVG' => $stat_array[$stat_type]['AVG'],
113 113
     ));
114
-    foreach($stat_type_data as $stat_entry) {
114
+    foreach ($stat_type_data as $stat_entry) {
115 115
       $template->assign_block_vars('stat.entry', $stat_entry);
116 116
     }
117 117
   }
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 
120 120
   // pdump($template_data);
121 121
 
122
-  if($same_user) {
122
+  if ($same_user) {
123 123
     rpg_level_up($user, RPG_STRUCTURE);
124 124
     rpg_level_up($user, RPG_RAID);
125 125
     rpg_level_up($user, RPG_TECH);
@@ -153,29 +153,29 @@  discard block
 block discarded – undo
153 153
     'builder_xp'           => pretty_number($user_data['xpminier']),
154 154
     'builder_lvl'          => pretty_number($user_data['lvl_minier']),
155 155
     'builder_lvl_st'       => pretty_number(rpg_get_miner_xp($user_data['lvl_minier'])),
156
-    'builder_lvl_up'       => pretty_number(rpg_get_miner_xp($user_data['lvl_minier']+1)),
156
+    'builder_lvl_up'       => pretty_number(rpg_get_miner_xp($user_data['lvl_minier'] + 1)),
157 157
     'raid_xp'              => pretty_number($user_data['xpraid']),
158 158
     'raid_lvl'             => pretty_number($user_data['lvl_raid']),
159
-    'raid_lvl_up'          => pretty_number(rpg_get_raider_xp($user_data['lvl_raid']+1)),
159
+    'raid_lvl_up'          => pretty_number(rpg_get_raider_xp($user_data['lvl_raid'] + 1)),
160 160
     'raids'                => pretty_number($user_data['raids']),
161 161
     'raidswin'             => pretty_number($user_data['raidswin']),
162 162
     'raidsloose'           => pretty_number($user_data['raidsloose']),
163 163
     'tech_xp'              => pretty_number($user_data['player_rpg_tech_xp']),
164 164
     'tech_lvl'             => pretty_number($user_data['player_rpg_tech_level']),
165 165
     'tech_lvl_st'          => pretty_number(rpg_get_tech_xp($user_data['player_rpg_tech_level'])),
166
-    'tech_lvl_up'          => pretty_number(rpg_get_tech_xp($user_data['player_rpg_tech_level']+1)),
166
+    'tech_lvl_up'          => pretty_number(rpg_get_tech_xp($user_data['player_rpg_tech_level'] + 1)),
167 167
 
168 168
     'explore_xp'           => pretty_number($user_data['player_rpg_explore_xp']),
169 169
     'explore_lvl'          => pretty_number($user_data['player_rpg_explore_level']),
170 170
     'explore_lvl_st'       => pretty_number(rpg_get_explore_xp($user_data['player_rpg_explore_level'])),
171
-    'explore_lvl_up'       => pretty_number(rpg_get_explore_xp($user_data['player_rpg_explore_level']+1)),
172
-
173
-    'build_points'         => pretty_number( $StatRecord['build_points'] ),
174
-    'tech_points'          => pretty_number( $StatRecord['tech_points'] ),
175
-    'fleet_points'         => pretty_number( $StatRecord['fleet_points'] ),
176
-    'defs_points'          => pretty_number( $StatRecord['defs_points'] ),
177
-    'res_points'           => pretty_number( $StatRecord['res_points'] ),
178
-    'total_points'         => pretty_number( $StatRecord['total_points'] ),
171
+    'explore_lvl_up'       => pretty_number(rpg_get_explore_xp($user_data['player_rpg_explore_level'] + 1)),
172
+
173
+    'build_points'         => pretty_number($StatRecord['build_points']),
174
+    'tech_points'          => pretty_number($StatRecord['tech_points']),
175
+    'fleet_points'         => pretty_number($StatRecord['fleet_points']),
176
+    'defs_points'          => pretty_number($StatRecord['defs_points']),
177
+    'res_points'           => pretty_number($StatRecord['res_points']),
178
+    'total_points'         => pretty_number($StatRecord['total_points']),
179 179
     'user_rank'            => $StatRecord['total_rank'],
180 180
     'RANK_DIFF'            => $StatRecord['total_old_rank'] - $StatRecord['total_rank'],
181 181
 
Please login to merge, or discard this patch.
includes/pages/techtree.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,14 +14,14 @@
 block discarded – undo
14 14
   global $lang, $user, $planetrow;
15 15
 
16 16
   $tech_tree = array();
17
-  foreach(get_unit_param('techtree') as $unit_group_id => $unit_list)
17
+  foreach (get_unit_param('techtree') as $unit_group_id => $unit_list)
18 18
   {
19 19
     $tech_tree[] = array(
20 20
       'NAME' => $lang['tech'][$unit_group_id],
21 21
       'GROUP_ID' => $unit_group_id,
22 22
     );
23 23
 
24
-    foreach($unit_list as $unit_id)
24
+    foreach ($unit_list as $unit_id)
25 25
     {
26 26
       $sn_data_unit = get_unit_param($unit_id);
27 27
       $level_basic = $sn_data_unit[P_STACKABLE] ? 0 : mrc_get_level($user, $planetrow, $unit_id, false, true);
Please login to merge, or discard this patch.
includes/debug.class.php 3 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -140,11 +140,13 @@
 block discarded – undo
140 140
       $error_backtrace['locks'] = classSupernova::$locks;
141 141
       $error_backtrace['cSN_data'] = classSupernova::$data;
142 142
       foreach($error_backtrace['cSN_data'] as &$location) {
143
-        foreach($location as $location_id => &$location_data) //          $location_data = $location_id;
143
+        foreach($location as $location_id => &$location_data) {
144
+          //          $location_data = $location_id;
144 145
         {
145 146
           $location_data = isset($location_data['username']) ? $location_data['username'] :
146 147
             (isset($location_data['name']) ? $location_data['name'] : $location_id);
147 148
         }
149
+        }
148 150
       }
149 151
       $error_backtrace['cSN_queries'] = classSupernova::$queries;
150 152
     }
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Some helpers to sweeten dev's life
4
- */
3
+   * Some helpers to sweeten dev's life
4
+   */
5 5
 
6 6
 /*
7 7
  * debug.class.php ::  Clase Debug, maneja reporte de eventos
Please login to merge, or discard this patch.
Spacing   +37 added lines, -38 removed lines patch added patch discarded remove patch
@@ -50,16 +50,16 @@  discard block
 block discarded – undo
50 50
   function log_file($message, $ident_change = 0) {
51 51
     static $ident = 0;
52 52
 
53
-    if(!defined('SN_DEBUG_LOG')) {
53
+    if (!defined('SN_DEBUG_LOG')) {
54 54
       return;
55 55
     }
56 56
 
57
-    if($this->log_file_handler === null) {
57
+    if ($this->log_file_handler === null) {
58 58
       $this->log_file_handler = @fopen(SN_ROOT_PHYSICAL . '/.logs/supernova.log', 'a+');
59 59
       @fwrite($this->log_file_handler, "\r\n\r\n");
60 60
     }
61 61
     $ident_change < 0 ? $ident += $ident_change * 2 : false;
62
-    if($this->log_file_handler) {
62
+    if ($this->log_file_handler) {
63 63
       @fwrite($this->log_file_handler, date(FMT_DATE_TIME_SQL, time()) . str_repeat(' ', $ident + 1) . $message . "\r\n");
64 64
     }
65 65
     $ident_change > 0 ? $ident += $ident_change * 2 : false;
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
     $result = array();
91 91
     $transaction_id = classSupernova::db_transaction_check(false) ? classSupernova::$transaction_id : classSupernova::$transaction_id++;
92 92
     $result[] = "tID {$transaction_id}";
93
-    foreach($backtrace as $a_trace) {
94
-      if(in_array($a_trace['function'], $exclude_functions)) {
93
+    foreach ($backtrace as $a_trace) {
94
+      if (in_array($a_trace['function'], $exclude_functions)) {
95 95
         continue;
96 96
       }
97 97
       $function =
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
       // $result[] = "{$function} ({$a_trace['line']})'{$file}'";
109 109
       $result[] = "{$function} - '{$file}' Line {$a_trace['line']}";
110 110
 
111
-      if(!$long_comment) {
111
+      if (!$long_comment) {
112 112
         break;
113 113
       }
114 114
     }
@@ -120,26 +120,26 @@  discard block
 block discarded – undo
120 120
   }
121 121
 
122 122
   function dump($dump = false, $force_base = false, $deadlock = false) {
123
-    if($dump === false) {
123
+    if ($dump === false) {
124 124
       return;
125 125
     }
126 126
 
127 127
     $error_backtrace = array();
128 128
     $base_dump = false;
129 129
 
130
-    if($force_base === true) {
130
+    if ($force_base === true) {
131 131
       $base_dump = true;
132 132
     }
133 133
 
134
-    if($dump === true) {
134
+    if ($dump === true) {
135 135
       $base_dump = true;
136 136
     } else {
137
-      if(!is_array($dump)) {
137
+      if (!is_array($dump)) {
138 138
         $dump = array('var' => $dump);
139 139
       }
140 140
 
141
-      foreach($dump as $dump_var_name => $dump_var) {
142
-        if($dump_var_name == 'base_dump') {
141
+      foreach ($dump as $dump_var_name => $dump_var) {
142
+        if ($dump_var_name == 'base_dump') {
143 143
           $base_dump = $dump_var;
144 144
         } else {
145 145
           $error_backtrace[$dump_var_name] = $dump_var;
@@ -148,26 +148,25 @@  discard block
 block discarded – undo
148 148
     }
149 149
 
150 150
 //    if($deadlock && ($q = db_fetch(classSupernova::$db->__db_query('SHOW ENGINE INNODB STATUS')))) {
151
-    if($deadlock && ($q = db_fetch(classSupernova::$db->mysql_get_innodb_status()))) {
151
+    if ($deadlock && ($q = db_fetch(classSupernova::$db->mysql_get_innodb_status()))) {
152 152
       $error_backtrace['deadlock'] = explode("\n", $q['Status']);
153 153
       $error_backtrace['locks'] = classSupernova::$locks;
154 154
       $error_backtrace['cSN_data'] = classSupernova::$data;
155
-      foreach($error_backtrace['cSN_data'] as &$location) {
156
-        foreach($location as $location_id => &$location_data) //          $location_data = $location_id;
155
+      foreach ($error_backtrace['cSN_data'] as &$location) {
156
+        foreach ($location as $location_id => &$location_data) //          $location_data = $location_id;
157 157
         {
158
-          $location_data = isset($location_data['username']) ? $location_data['username'] :
159
-            (isset($location_data['name']) ? $location_data['name'] : $location_id);
158
+          $location_data = isset($location_data['username']) ? $location_data['username'] : (isset($location_data['name']) ? $location_data['name'] : $location_id);
160 159
         }
161 160
       }
162 161
       $error_backtrace['cSN_queries'] = classSupernova::$queries;
163 162
     }
164 163
 
165
-    if($base_dump) {
166
-      if(is_array($this->log_array) && count($this->log_array) > 0) {
164
+    if ($base_dump) {
165
+      if (is_array($this->log_array) && count($this->log_array) > 0) {
167 166
 //        ;
168 167
 //      }
169 168
 //      {
170
-        foreach($this->log_array as $log) {
169
+        foreach ($this->log_array as $log) {
171 170
           $error_backtrace['queries'][] = $log;
172 171
         }
173 172
       }
@@ -198,14 +197,14 @@  discard block
 block discarded – undo
198 197
   function error($message = 'There is a error on page', $title = 'Internal Error', $error_code = 500, $dump = true) {
199 198
     global $sys_stop_log_hit, $sys_log_disabled, $user;
200 199
 
201
-    if(empty(classSupernova::$db->connected)) {
200
+    if (empty(classSupernova::$db->connected)) {
202 201
       // TODO - писать ошибку в файл
203 202
       die('SQL server currently unavailable. Please contact Administration...');
204 203
     }
205 204
 
206 205
     sn_db_transaction_rollback();
207 206
 
208
-    if(classSupernova::$config->debug == 1) {
207
+    if (classSupernova::$config->debug == 1) {
209 208
       echo "<h2>{$title}</h2><br><font color=red>{$message}</font><br><hr>";
210 209
       echo "<table>{$this->log}</table>";
211 210
     }
@@ -215,7 +214,7 @@  discard block
 block discarded – undo
215 214
     $error_text = db_escape($message);
216 215
     $error_backtrace = $this->dump($dump, true, strpos($message, 'Deadlock') !== false);
217 216
 
218
-    if(!$sys_log_disabled) {
217
+    if (!$sys_log_disabled) {
219 218
       $query = "INSERT INTO `{{logs}}` SET
220 219
         `log_time` = '" . time() . "', `log_code` = '" . db_escape($error_code) . "', `log_sender` = '" . db_escape($user['id']) . "',
221 220
         `log_username` = '" . db_escape($user['user_name']) . "', `log_title` = '" . db_escape($title) . "',  `log_text` = '" . db_escape($message) . "',
@@ -233,7 +232,7 @@  discard block
 block discarded – undo
233 232
       ob_start();
234 233
       print("<hr>User ID {$user['id']} raised error code {$error_code} titled '{$title}' with text '{$error_text}' on page {$_SERVER['SCRIPT_NAME']}");
235 234
 
236
-      foreach($error_backtrace as $name => $value) {
235
+      foreach ($error_backtrace as $name => $value) {
237 236
         print(__DEBUG_LINE);
238 237
         pdump($value, $name);
239 238
       }
@@ -245,14 +244,14 @@  discard block
 block discarded – undo
245 244
   function warning($message, $title = 'System Message', $log_code = 300, $dump = false) {
246 245
     global $user, $sys_log_disabled;
247 246
 
248
-    if(empty(classSupernova::$db->connected)) {
247
+    if (empty(classSupernova::$db->connected)) {
249 248
       // TODO - писать ошибку в файл
250 249
       die('SQL server currently unavailable. Please contact Administration...');
251 250
     }
252 251
 
253 252
     $error_backtrace = $this->dump($dump, false);
254 253
 
255
-    if(!$sys_log_disabled) {
254
+    if (!$sys_log_disabled) {
256 255
       $query = "INSERT INTO `{{logs}}` SET
257 256
         `log_time` = '" . time() . "', `log_code` = '" . db_escape($log_code) . "', `log_sender` = '" . db_escape($user['id']) . "',
258 257
         `log_username` = '" . db_escape($user['user_name']) . "', `log_title` = '" . db_escape($title) . "',  `log_text` = '" . db_escape($message) . "',
@@ -270,11 +269,11 @@  discard block
 block discarded – undo
270 269
 // Dump variables nicer then var_dump()
271 270
 
272 271
 function dump($value, $varname = null, $level = 0, $dumper = '') {
273
-  if(isset($varname)) {
272
+  if (isset($varname)) {
274 273
     $varname .= " = ";
275 274
   }
276 275
 
277
-  if($level == -1) {
276
+  if ($level == -1) {
278 277
     $trans[' '] = '&there4;';
279 278
     $trans["\t"] = '&rArr;';
280 279
     $trans["\n"] = '&para;;';
@@ -283,7 +282,7 @@  discard block
 block discarded – undo
283 282
 
284 283
     return strtr(htmlspecialchars($value), $trans);
285 284
   }
286
-  if($level == 0) {
285
+  if ($level == 0) {
287 286
 //    $dumper = '<pre>' . mt_rand(10, 99) . '|' . $varname;
288 287
     $dumper = mt_rand(10, 99) . '|' . $varname;
289 288
   }
@@ -291,22 +290,22 @@  discard block
 block discarded – undo
291 290
   $type = gettype($value);
292 291
   $dumper .= $type;
293 292
 
294
-  if($type == 'string') {
293
+  if ($type == 'string') {
295 294
     $dumper .= '(' . strlen($value) . ')';
296 295
     $value = dump($value, '', -1);
297
-  } elseif($type == 'boolean') {
296
+  } elseif ($type == 'boolean') {
298 297
     $value = ($value ? 'true' : 'false');
299
-  } elseif($type == 'object') {
298
+  } elseif ($type == 'object') {
300 299
     $props = get_class_vars(get_class($value));
301 300
     $dumper .= '(' . count($props) . ') <u>' . get_class($value) . '</u>';
302
-    foreach($props as $key => $val) {
301
+    foreach ($props as $key => $val) {
303 302
       $dumper .= "\n" . str_repeat("\t", $level + 1) . $key . ' => ';
304 303
       $dumper .= dump($value->$key, '', $level + 1);
305 304
     }
306 305
     $value = '';
307
-  } elseif($type == 'array') {
306
+  } elseif ($type == 'array') {
308 307
     $dumper .= '(' . count($value) . ')';
309
-    foreach($value as $key => $val) {
308
+    foreach ($value as $key => $val) {
310 309
       $dumper .= "\n" . str_repeat("\t", $level + 1) . dump($key, '', -1) . ' => ';
311 310
       $dumper .= dump($val, '', $level + 1);
312 311
     }
@@ -326,7 +325,7 @@  discard block
 block discarded – undo
326 325
 //  $backtrace = $backtrace[1];
327 326
 
328 327
   $caller = '';
329
-  if(defined('SN_DEBUG_PDUMP_CALLER') && SN_DEBUG_PDUMP_CALLER) {
328
+  if (defined('SN_DEBUG_PDUMP_CALLER') && SN_DEBUG_PDUMP_CALLER) {
330 329
     $caller = (!empty($backtrace[1]['class']) ? $backtrace[1]['class'] : '') .
331 330
       (!empty($backtrace[1]['type']) ? $backtrace[1]['type'] : '') .
332 331
       $backtrace[1]['function'] .
@@ -353,7 +352,7 @@  discard block
 block discarded – undo
353 352
 }
354 353
 
355 354
 function pr($prePrint = false) {
356
-  if($prePrint) {
355
+  if ($prePrint) {
357 356
     print(__DEBUG_CRLF);
358 357
   }
359 358
   print(mt_rand() . __DEBUG_CRLF);
@@ -363,7 +362,7 @@  discard block
 block discarded – undo
363 362
   global $_PRINT_COUNT_VALUE;
364 363
   $_PRINT_COUNT_VALUE++;
365 364
 
366
-  if($prePrint) {
365
+  if ($prePrint) {
367 366
     print(__DEBUG_CRLF);
368 367
   }
369 368
   print($_PRINT_COUNT_VALUE . __DEBUG_CRLF);
Please login to merge, or discard this patch.