@@ -70,9 +70,9 @@ discard block |
||
70 | 70 | 'distinct' => false, |
71 | 71 | 'join' => [], |
72 | 72 | 'order' => [], |
73 | - 'start' => isset($options['start']) ? (int)$options['start'] : 0, |
|
73 | + 'start' => isset($options['start']) ? (int) $options['start'] : 0, |
|
74 | 74 | 'key' => isset($options['key']) ? $options['key'] : null, |
75 | - 'limit' => !empty($options['count']) ? (int)$options['count'] : 0, |
|
75 | + 'limit' => !empty($options['count']) ? (int) $options['count'] : 0, |
|
76 | 76 | ]; |
77 | 77 | |
78 | 78 | //only not deleted items |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | if (!empty(\App::$cur->Ecommerce->config['view_filter']['options'])) { |
135 | 135 | foreach (\App::$cur->Ecommerce->config['view_filter']['options'] as $optionId => $optionValue) { |
136 | 136 | $selectOptions['join'][] = [Item\Param::table(), Item::index() . ' = ' . 'option' . $optionId . '.' . Item\Param::colPrefix() . Item::index() . ' AND ' . |
137 | - 'option' . $optionId . '.' . Item\Param::colPrefix() . Item\Option::index() . ' = "' . (int)$optionId . '" AND ' . |
|
138 | - 'option' . $optionId . '.' . Item\Param::colPrefix() . 'value = "' . (int)$optionValue . '"', |
|
137 | + 'option' . $optionId . '.' . Item\Param::colPrefix() . Item\Option::index() . ' = "' . (int) $optionId . '" AND ' . |
|
138 | + 'option' . $optionId . '.' . Item\Param::colPrefix() . 'value = "' . (int) $optionValue . '"', |
|
139 | 139 | 'inner', 'option' . $optionId]; |
140 | 140 | } |
141 | 141 | } |
@@ -153,15 +153,15 @@ discard block |
||
153 | 153 | } |
154 | 154 | break; |
155 | 155 | case 'badge': |
156 | - $selectOptions['where'][] = ['item_badge_id', (int)$filter]; |
|
156 | + $selectOptions['where'][] = ['item_badge_id', (int) $filter]; |
|
157 | 157 | break; |
158 | 158 | case 'price': |
159 | 159 | $colName = Item\Offer\Price::colPrefix() . 'price'; |
160 | 160 | if (!empty($filter['min'])) { |
161 | - $selectOptions['where'][] = [$colName, (float)$filter['min'], '>=']; |
|
161 | + $selectOptions['where'][] = [$colName, (float) $filter['min'], '>=']; |
|
162 | 162 | } |
163 | 163 | if (!empty($filter['max'])) { |
164 | - $selectOptions['where'][] = [$colName, (float)$filter['max'], '<=']; |
|
164 | + $selectOptions['where'][] = [$colName, (float) $filter['max'], '<=']; |
|
165 | 165 | } |
166 | 166 | break; |
167 | 167 | case 'options': |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | } |
180 | 180 | if ($filter) { |
181 | 181 | foreach ($filter as $optionId => $optionValue) { |
182 | - $optionId = (int)$optionId; |
|
182 | + $optionId = (int) $optionId; |
|
183 | 183 | if (is_array($optionValue)) { |
184 | 184 | $optionValueArr = []; |
185 | 185 | foreach ($optionValue as $val) { |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | $qstr = '= ' . \App::$cur->db->connection->pdo->quote($optionValue); |
191 | 191 | } |
192 | 192 | $selectOptions['join'][] = [$table, $itemIndex . ' = ' . 'option' . $optionId . '.' . $paramPrefix . $itemIndex . ' AND ' . |
193 | - 'option' . $optionId . '.' . $paramPrefix . $optionIndex . ' = "' . (int)$optionId . '" AND ' . |
|
193 | + 'option' . $optionId . '.' . $paramPrefix . $optionIndex . ' = "' . (int) $optionId . '" AND ' . |
|
194 | 194 | 'option' . $optionId . '.' . $paramPrefix . 'value ' . $qstr . '', |
195 | 195 | 'inner', 'option' . $optionId]; |
196 | 196 | } |
@@ -212,14 +212,14 @@ discard block |
||
212 | 212 | continue; |
213 | 213 | } |
214 | 214 | $category = Category::get($categoryId); |
215 | - $where[] = ['tree_path', $category->tree_path . (int)$categoryId . '/%', 'LIKE', $first ? 'AND' : 'OR']; |
|
215 | + $where[] = ['tree_path', $category->tree_path . (int) $categoryId . '/%', 'LIKE', $first ? 'AND' : 'OR']; |
|
216 | 216 | $first = false; |
217 | 217 | } |
218 | 218 | $selectOptions['where'][] = $where; |
219 | 219 | } else { |
220 | 220 | $category = Category::get($options['parent']); |
221 | 221 | if ($category) { |
222 | - $selectOptions['where'][] = ['tree_path', $category->tree_path . (int)$options['parent'] . '/%', 'LIKE']; |
|
222 | + $selectOptions['where'][] = ['tree_path', $category->tree_path . (int) $options['parent'] . '/%', 'LIKE']; |
|
223 | 223 | } |
224 | 224 | } |
225 | 225 | } |
@@ -65,7 +65,7 @@ |
||
65 | 65 | ['user_id', $userId], |
66 | 66 | ['hash', $hash] |
67 | 67 | ]); |
68 | - if(!$session){ |
|
68 | + if (!$session) { |
|
69 | 69 | if (!headers_sent()) { |
70 | 70 | setcookie($this->cookiePrefix . "_user_session_hash", '', 0, "/"); |
71 | 71 | setcookie($this->cookiePrefix . "_user_id", '', 0, "/"); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | ['user_id', $userId], |
66 | 66 | ['hash', $hash] |
67 | 67 | ]); |
68 | - if(!$session){ |
|
68 | + if(!$session) { |
|
69 | 69 | if (!headers_sent()) { |
70 | 70 | setcookie($this->cookiePrefix . "_user_session_hash", '', 0, "/"); |
71 | 71 | setcookie($this->cookiePrefix . "_user_id", '', 0, "/"); |
@@ -243,17 +243,20 @@ discard block |
||
243 | 243 | * @return boolean|\Users\User |
244 | 244 | */ |
245 | 245 | public function get($idn, $ltype = 'id') { |
246 | - if (!$idn) |
|
247 | - return false; |
|
246 | + if (!$idn) { |
|
247 | + return false; |
|
248 | + } |
|
248 | 249 | |
249 | - if (is_numeric($idn) && $ltype != 'login') |
|
250 | - $user = Users\User::get($idn, 'id'); |
|
251 | - elseif ($ltype == 'login') |
|
252 | - $user = Users\User::get($idn, 'login'); |
|
253 | - else |
|
254 | - $user = Users\User::get($idn, 'mail'); |
|
255 | - if (!$user) |
|
256 | - return []; |
|
250 | + if (is_numeric($idn) && $ltype != 'login') { |
|
251 | + $user = Users\User::get($idn, 'id'); |
|
252 | + } elseif ($ltype == 'login') { |
|
253 | + $user = Users\User::get($idn, 'login'); |
|
254 | + } else { |
|
255 | + $user = Users\User::get($idn, 'mail'); |
|
256 | + } |
|
257 | + if (!$user) { |
|
258 | + return []; |
|
259 | + } |
|
257 | 260 | |
258 | 261 | return $user; |
259 | 262 | } |
@@ -16,11 +16,11 @@ |
||
16 | 16 | public static $cols = [ |
17 | 17 | 'name' => ['type' => 'text'], |
18 | 18 | 'code' => ['type' => 'text'], |
19 | - 'message' => ['type' => 'dataManager','relation'=>'messages'], |
|
19 | + 'message' => ['type' => 'dataManager', 'relation'=>'messages'], |
|
20 | 20 | ]; |
21 | 21 | public static $dataManagers = [ |
22 | 22 | 'manager' => [ |
23 | - 'cols' => ['name', 'code','message'] |
|
23 | + 'cols' => ['name', 'code', 'message'] |
|
24 | 24 | ] |
25 | 25 | ]; |
26 | 26 | public static $forms = [ |