Completed
Push — work-fleets ( 5b06a4...37e31f )
by SuperNova.WS
04:49
created
includes/includes/user_birthday_celebrate.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 
9 9
   $query = db_user_list_to_celebrate($config->user_birthday_range);
10 10
 
11
-  while($row = db_fetch($query))
11
+  while ($row = db_fetch($query))
12 12
   {
13 13
     $row['username'] = db_escape($row['username']);
14 14
     rpg_points_change($row['id'], RPG_BIRTHDAY, $config->user_birthday_gift, "Birthday gift for user {$row['username']} ID {$row['id']} on his birthday on {$row['user_birthday']}. Gift last gaved at {$row['user_birthday_celebrated']}");
Please login to merge, or discard this patch.
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/includes/sys_avatar.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -9,28 +9,28 @@  discard block
 block discarded – undo
9 9
     $avatar_filename = $fullsize_filename = SN_ROOT_PHYSICAL . 'images/avatar/' . $prefix . '_' . $subject_id;
10 10
     $avatar_filename .= '.png';
11 11
     $fullsize_filename .= '_full.png';
12
-    if(sys_get_param_int('avatar_remove'))
12
+    if (sys_get_param_int('avatar_remove'))
13 13
     {
14
-      if(file_exists($avatar_filename) && !unlink($avatar_filename))
14
+      if (file_exists($avatar_filename) && !unlink($avatar_filename))
15 15
       {
16 16
         throw new Exception($lang['opt_msg_avatar_error_delete'], ERR_ERROR);
17 17
       }
18 18
       $avatar_field = 0;
19 19
       throw new Exception($lang['opt_msg_avatar_removed'], ERR_NONE);
20 20
     }
21
-    elseif($_FILES['avatar']['size'])
21
+    elseif ($_FILES['avatar']['size'])
22 22
     {
23
-      if(!in_array($_FILES['avatar']['type'], array('image/gif', 'image/jpeg', 'image/jpg', 'image/pjpeg', 'image/png')) || $_FILES['avatar']['size'] > 204800)
23
+      if (!in_array($_FILES['avatar']['type'], array('image/gif', 'image/jpeg', 'image/jpg', 'image/pjpeg', 'image/png')) || $_FILES['avatar']['size'] > 204800)
24 24
       {
25 25
         throw new Exception($lang['opt_msg_avatar_error_unsupported'], ERR_WARNING);
26 26
       }
27 27
 
28
-      if($_FILES['avatar']['error'])
28
+      if ($_FILES['avatar']['error'])
29 29
       {
30 30
         throw new Exception(sprintf($lang['opt_msg_avatar_error_upload'], $_FILES['avatar']['error']), ERR_ERROR);
31 31
       }
32 32
 
33
-      if(!($avatar_image = imagecreatefromstring(file_get_contents($_FILES['avatar']['tmp_name']))))
33
+      if (!($avatar_image = imagecreatefromstring(file_get_contents($_FILES['avatar']['tmp_name']))))
34 34
       {
35 35
         throw new Exception($lang['opt_msg_avatar_error_unsupported'], ERR_WARNING);
36 36
       }
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
       $avatar_size = getimagesize($_FILES['avatar']['tmp_name']);
39 39
       $avatar_max_width  = $config-> avatar_max_width;
40 40
       $avatar_max_height = $config-> avatar_max_height;
41
-      if($avatar_size[0] > $avatar_max_width || $avatar_size[1] > $avatar_max_height)
41
+      if ($avatar_size[0] > $avatar_max_width || $avatar_size[1] > $avatar_max_height)
42 42
       {
43 43
         $aspect_ratio = min($avatar_max_width / $avatar_size[0], $avatar_max_height / $avatar_size[1]);
44 44
         $avatar_image_new = imagecreatetruecolor($avatar_size[0] * $aspect_ratio, $avatar_size[0] * $aspect_ratio);
@@ -47,12 +47,12 @@  discard block
 block discarded – undo
47 47
         $avatar_image = $avatar_image_new;
48 48
       }
49 49
 
50
-      if(file_exists($avatar_filename) && !unlink($avatar_filename))
50
+      if (file_exists($avatar_filename) && !unlink($avatar_filename))
51 51
       {
52 52
         throw new Exception($lang['opt_msg_avatar_error_delete'], ERR_ERROR);
53 53
       }
54 54
 
55
-      if(!imagepng($avatar_image, $avatar_filename, 9))
55
+      if (!imagepng($avatar_image, $avatar_filename, 9))
56 56
       {
57 57
         throw new Exception($lang['opt_msg_avatar_error_writing'], ERR_ERROR);
58 58
       }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,8 +17,7 @@  discard block
 block discarded – undo
17 17
       }
18 18
       $avatar_field = 0;
19 19
       throw new Exception($lang['opt_msg_avatar_removed'], ERR_NONE);
20
-    }
21
-    elseif($_FILES['avatar']['size'])
20
+    } elseif($_FILES['avatar']['size'])
22 21
     {
23 22
       if(!in_array($_FILES['avatar']['type'], array('image/gif', 'image/jpeg', 'image/jpg', 'image/pjpeg', 'image/png')) || $_FILES['avatar']['size'] > 204800)
24 23
       {
@@ -61,8 +60,7 @@  discard block
 block discarded – undo
61 60
       imagedestroy($avatar_image);
62 61
       throw new Exception($lang['opt_msg_avatar_uploaded'], ERR_NONE);
63 62
     }
64
-  }
65
-  catch (Exception $e)
63
+  } catch (Exception $e)
66 64
   {
67 65
     return array(
68 66
       'STATUS'  => in_array($e->getCode(), array(ERR_NONE, ERR_WARNING, ERR_ERROR)) ? $e->getCode() : ERR_ERROR,
Please login to merge, or discard this patch.
includes/classes/RequestInfo.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -89,15 +89,15 @@  discard block
 block discarded – undo
89 89
     // Инфа об устройстве и браузере - общая для всех
90 90
     sn_db_transaction_start();
91 91
     $this->device_cypher = $_COOKIE[SN_COOKIE_D];
92
-    if($this->device_cypher) {
92
+    if ($this->device_cypher) {
93 93
       $cypher_safe = db_escape($this->device_cypher);
94 94
       $device_id = doquery("SELECT `device_id` FROM {{security_device}} WHERE `device_cypher` = '{$cypher_safe}' LIMIT 1 FOR UPDATE", true);
95
-      if(!empty($device_id['device_id'])) {
95
+      if (!empty($device_id['device_id'])) {
96 96
         $this->device_id = $device_id['device_id'];
97 97
       }
98 98
     }
99 99
 
100
-    if($this->device_id <= 0) {
100
+    if ($this->device_id <= 0) {
101 101
       do {
102 102
         $cypher_safe = db_escape($this->device_cypher = sys_random_string());
103 103
         $row = doquery("SELECT `device_id` FROM {{security_device}} WHERE `device_cypher` = '{$cypher_safe}' LIMIT 1 FOR UPDATE", true);
@@ -118,10 +118,10 @@  discard block
 block discarded – undo
118 118
     $this->page_address_id = db_get_set_unique_id_value($this->page_address, 'url_id', 'security_url', 'url_string');
119 119
     sn_db_transaction_commit();
120 120
 
121
-    if($this->write_full_url) {
121
+    if ($this->write_full_url) {
122 122
       sn_db_transaction_start();
123 123
       $this->page_url = substr($_SERVER['REQUEST_URI'], strlen(SN_ROOT_RELATIVE));
124
-      if(strpos($_SERVER['REQUEST_URI'], '/simulator.php') === 0) {
124
+      if (strpos($_SERVER['REQUEST_URI'], '/simulator.php') === 0) {
125 125
         $this->page_url = '/simulator.php';
126 126
       }
127 127
       $this->page_url_id = db_get_set_unique_id_value($this->page_url, 'url_id', 'security_url', 'url_string');
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
    */
145 145
   public function db_security_entry_insert($user_id_unsafe) {
146 146
     // TODO $user_id = !empty(self::$user['id']) ? self::$user['id'] : 'NULL';
147
-    if(empty($user_id_unsafe)) {
147
+    if (empty($user_id_unsafe)) {
148 148
       // self::flog('Нет ИД пользователя');
149 149
       return true;
150 150
     }
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
   public function db_counter_insert($user_id_unsafe) {
168 168
     global $config, $sys_stop_log_hit, $is_watching;
169 169
 
170
-    if($sys_stop_log_hit || !$config->game_counter) {
170
+    if ($sys_stop_log_hit || !$config->game_counter) {
171 171
       return;
172 172
     }
173 173
 
@@ -183,14 +183,14 @@  discard block
 block discarded – undo
183 183
 //      $this->ip_v4_int . ", '{$proxy_safe}', " . $this->page_address_id . ", " . $this->page_url_id . ");");
184 184
     doquery(
185 185
       "INSERT INTO {{counter}} SET
186
-        `visit_time` = '" . SN_TIME_SQL. "',
186
+        `visit_time` = '" . SN_TIME_SQL . "',
187 187
         `user_id` = {$user_id_safe},
188 188
         `device_id` = {$this->device_id},
189 189
         `browser_id` = {$this->browser_id},
190 190
         `user_ip` = {$this->ip_v4_int},
191 191
         `user_proxy` = '{$proxy_safe}',
192 192
         `page_url_id` = {$this->page_address_id}" .
193
-        ($this->write_full_url ? ", `plain_url_id` = {$this->page_url_id}" : '' ).
193
+        ($this->write_full_url ? ", `plain_url_id` = {$this->page_url_id}" : '') .
194 194
       ";");
195 195
 
196 196
     $is_watching = false;
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.