@@ -270,10 +270,11 @@ |
||
| 270 | 270 | $item->sales ++; |
| 271 | 271 | $item->save(); |
| 272 | 272 | |
| 273 | - if (empty($_GET['count'])) |
|
| 274 | - $count = 1; |
|
| 275 | - else |
|
| 276 | - $count = (float) $_GET['count']; |
|
| 273 | + if (empty($_GET['count'])) { |
|
| 274 | + $count = 1; |
|
| 275 | + } else { |
|
| 276 | + $count = (float) $_GET['count']; |
|
| 277 | + } |
|
| 277 | 278 | |
| 278 | 279 | $cart = $this->ecommerce->getCurCart(); |
| 279 | 280 | |
@@ -196,17 +196,20 @@ |
||
| 196 | 196 | */ |
| 197 | 197 | public function get($idn, $ltype = 'id') |
| 198 | 198 | {
|
| 199 | - if (!$idn) |
|
| 200 | - return false; |
|
| 199 | + if (!$idn) { |
|
| 200 | + return false; |
|
| 201 | + } |
|
| 201 | 202 | |
| 202 | - if (is_numeric($idn) && $ltype != 'login') |
|
| 203 | - $user = Users\User::get($idn, 'id'); |
|
| 204 | - elseif ($ltype == 'login') |
|
| 205 | - $user = Users\User::get($idn, 'login'); |
|
| 206 | - else |
|
| 207 | - $user = Users\User::get($idn, 'mail'); |
|
| 208 | - if (!$user) |
|
| 209 | - return []; |
|
| 203 | + if (is_numeric($idn) && $ltype != 'login') { |
|
| 204 | + $user = Users\User::get($idn, 'id'); |
|
| 205 | + } elseif ($ltype == 'login') { |
|
| 206 | + $user = Users\User::get($idn, 'login'); |
|
| 207 | + } else { |
|
| 208 | + $user = Users\User::get($idn, 'mail'); |
|
| 209 | + } |
|
| 210 | + if (!$user) { |
|
| 211 | + return []; |
|
| 212 | + } |
|
| 210 | 213 | |
| 211 | 214 | return $user; |
| 212 | 215 | } |
@@ -18,11 +18,13 @@ |
||
| 18 | 18 | <ul class="item-options"> |
| 19 | 19 | <?php |
| 20 | 20 | foreach ($item->options as $param) { |
| 21 | - if (!$param->item_option_view || !$param->value) |
|
| 22 | - continue; |
|
| 21 | + if (!$param->item_option_view || !$param->value) { |
|
| 22 | + continue; |
|
| 23 | + } |
|
| 23 | 24 | if ($param->item_option_type == 'select') { |
| 24 | - if (empty($param->option->items[$param->value])) |
|
| 25 | - continue; |
|
| 25 | + if (empty($param->option->items[$param->value])) { |
|
| 26 | + continue; |
|
| 27 | + } |
|
| 26 | 28 | $value = $param->option->items[$param->value]->value; |
| 27 | 29 | } else { |
| 28 | 30 | $value = $param->value; |
@@ -3,9 +3,9 @@ |
||
| 3 | 3 | <div class="cart-order_page"> |
| 4 | 4 | <h2>Быстрое оформление заказа</h2> |
| 5 | 5 | <?php |
| 6 | - if (!$cart || !$cart->cartItems) |
|
| 7 | - echo "<h1>Ваша корзина пуста</h1>"; |
|
| 8 | - else { |
|
| 6 | + if (!$cart || !$cart->cartItems) { |
|
| 7 | + echo "<h1>Ваша корзина пуста</h1>"; |
|
| 8 | + } else { |
|
| 9 | 9 | $sums = []; |
| 10 | 10 | $cartDelivery = $cart->delivery; |
| 11 | 11 | $deliveryPrice = 0; |
@@ -9,18 +9,20 @@ |
||
| 9 | 9 | $menu = \Menu\Menu::get($code, 'code'); |
| 10 | 10 | if ($menu) { |
| 11 | 11 | foreach ($menu->items(['where' => ['parent_id', 0], 'order' => ['weight', 'asc']]) as $item) { |
| 12 | - if (urldecode($_SERVER['REQUEST_URI']) == $item->href) |
|
| 13 | - $active = ' class = "active" '; |
|
| 14 | - else |
|
| 15 | - $active = ''; |
|
| 12 | + if (urldecode($_SERVER['REQUEST_URI']) == $item->href) { |
|
| 13 | + $active = ' class = "active" '; |
|
| 14 | + } else { |
|
| 15 | + $active = ''; |
|
| 16 | + } |
|
| 16 | 17 | echo "<li {$active}><a href = '{$item->href}'>{$item->name}</a>"; |
| 17 | 18 | if ($item->childs(['order' => ['weight', 'asc']])) { |
| 18 | 19 | echo "<ul>"; |
| 19 | 20 | foreach ($item->childs as $item) { |
| 20 | - if (urldecode($_SERVER['REQUEST_URI']) == $item->href) |
|
| 21 | - $active = ' class = "active" '; |
|
| 22 | - else |
|
| 23 | - $active = ''; |
|
| 21 | + if (urldecode($_SERVER['REQUEST_URI']) == $item->href) { |
|
| 22 | + $active = ' class = "active" '; |
|
| 23 | + } else { |
|
| 24 | + $active = ''; |
|
| 25 | + } |
|
| 24 | 26 | echo "<li {$active}><a href = '{$item->href}'>{$item->name}</a>"; |
| 25 | 27 | } |
| 26 | 28 | echo "</ul>"; |
@@ -39,8 +39,7 @@ |
||
| 39 | 39 | $form->input($field->type, "deliveryFields[{$field->id}]", $field->name, ['required' => $field->required]);
|
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | - } |
|
| 43 | - else {
|
|
| 42 | + } else {
|
|
| 44 | 43 | echo "<h4>Выберите способ доставки</h4>"; |
| 45 | 44 | } |
| 46 | 45 | ?> |
@@ -2,27 +2,45 @@ |
||
| 2 | 2 | <form action = '' method = 'POST' enctype="multipart/form-data"> |
| 3 | 3 | <div class ="form-group"> |
| 4 | 4 | <label>Название сайта</label> |
| 5 | - <input class ="form-control" type = 'text' name = 'site_name' value = '<?php if (!empty(\App::$primary->config['site']['name'])) echo \App::$primary->config['site']['name']; ?>' /> |
|
| 5 | + <input class ="form-control" type = 'text' name = 'site_name' value = '<?php if (!empty(\App::$primary->config['site']['name'])) { |
|
| 6 | + echo \App::$primary->config['site']['name']; |
|
| 7 | +} |
|
| 8 | +?>' /> |
|
| 6 | 9 | </div> |
| 7 | 10 | <div class ="form-group"> |
| 8 | 11 | <label>Название компании</label> |
| 9 | - <input class ="form-control" type = 'text' name = 'company_name' value = '<?php if (!empty(\App::$primary->config['site']['company_name'])) echo \App::$primary->config['site']['company_name']; ?>' /> |
|
| 12 | + <input class ="form-control" type = 'text' name = 'company_name' value = '<?php if (!empty(\App::$primary->config['site']['company_name'])) { |
|
| 13 | + echo \App::$primary->config['site']['company_name']; |
|
| 14 | +} |
|
| 15 | +?>' /> |
|
| 10 | 16 | </div> |
| 11 | 17 | <div class ="form-group"> |
| 12 | 18 | <label>Основной домен</label> |
| 13 | - <input class ="form-control" type = 'text' name = 'site_domain' value = '<?php if (!empty(\App::$primary->config['site']['domain'])) echo \App::$primary->config['site']['domain']; ?>' /> |
|
| 19 | + <input class ="form-control" type = 'text' name = 'site_domain' value = '<?php if (!empty(\App::$primary->config['site']['domain'])) { |
|
| 20 | + echo \App::$primary->config['site']['domain']; |
|
| 21 | +} |
|
| 22 | +?>' /> |
|
| 14 | 23 | </div> |
| 15 | 24 | <div class ="form-group"> |
| 16 | 25 | <label>Контактный email</label> |
| 17 | - <input class ="form-control" type = 'text' name = 'site_email' value = '<?php if (!empty(\App::$primary->config['site']['email'])) echo \App::$primary->config['site']['email']; ?>' /> |
|
| 26 | + <input class ="form-control" type = 'text' name = 'site_email' value = '<?php if (!empty(\App::$primary->config['site']['email'])) { |
|
| 27 | + echo \App::$primary->config['site']['email']; |
|
| 28 | +} |
|
| 29 | +?>' /> |
|
| 18 | 30 | </div> |
| 19 | 31 | <div class ="form-group"> |
| 20 | 32 | <label>Ключевые слова</label> |
| 21 | - <input class ="form-control" type = 'text' name = 'site_keywords' value = '<?php if (!empty(\App::$primary->config['site']['keywords'])) echo \App::$primary->config['site']['keywords']; ?>' /> |
|
| 33 | + <input class ="form-control" type = 'text' name = 'site_keywords' value = '<?php if (!empty(\App::$primary->config['site']['keywords'])) { |
|
| 34 | + echo \App::$primary->config['site']['keywords']; |
|
| 35 | +} |
|
| 36 | +?>' /> |
|
| 22 | 37 | </div> |
| 23 | 38 | <div class ="form-group"> |
| 24 | 39 | <label>Краткое описание сайта</label> |
| 25 | - <input class ="form-control" type = 'text' name = 'site_description' value = '<?php if (!empty(\App::$primary->config['site']['description'])) echo \App::$primary->config['site']['description']; ?>' /> |
|
| 40 | + <input class ="form-control" type = 'text' name = 'site_description' value = '<?php if (!empty(\App::$primary->config['site']['description'])) { |
|
| 41 | + echo \App::$primary->config['site']['description']; |
|
| 42 | +} |
|
| 43 | +?>' /> |
|
| 26 | 44 | </div> |
| 27 | 45 | <?php |
| 28 | 46 | $form = new Ui\Form(); |
@@ -126,12 +126,14 @@ discard block |
||
| 126 | 126 | if (!is_array($order)) { |
| 127 | 127 | $this->order[] = "{$order} {$type}"; |
| 128 | 128 | } else { |
| 129 | - foreach ($order as $item) |
|
| 130 | - if (!is_array($item)) { |
|
| 129 | + foreach ($order as $item) { |
|
| 130 | + if (!is_array($item)) { |
|
| 131 | 131 | call_user_func_array(array($this, 'order'), $order); |
| 132 | + } |
|
| 132 | 133 | break; |
| 133 | - } else |
|
| 134 | - $this->order($item); |
|
| 134 | + } else { |
|
| 135 | + $this->order($item); |
|
| 136 | + } |
|
| 135 | 137 | } |
| 136 | 138 | } |
| 137 | 139 | |
@@ -140,8 +142,9 @@ discard block |
||
| 140 | 142 | $start = intval($start); |
| 141 | 143 | $len = intval($len); |
| 142 | 144 | $this->limit = "LIMIT {$start}"; |
| 143 | - if ($len !== 0) |
|
| 144 | - $this->limit .= ",{$len}"; |
|
| 145 | + if ($len !== 0) { |
|
| 146 | + $this->limit .= ",{$len}"; |
|
| 147 | + } |
|
| 145 | 148 | } |
| 146 | 149 | |
| 147 | 150 | public function buildJoin($table, $where = false, $type = 'LEFT', $alias = '') |
@@ -154,10 +157,12 @@ discard block |
||
| 154 | 157 | } |
| 155 | 158 | } else { |
| 156 | 159 | $join .= " {$type} JOIN {$this->curInstance->table_prefix}{$table}"; |
| 157 | - if ($alias) |
|
| 158 | - $join .= " AS `{$alias}`"; |
|
| 159 | - if ($where) |
|
| 160 | - $join .= " ON {$where}"; |
|
| 160 | + if ($alias) { |
|
| 161 | + $join .= " AS `{$alias}`"; |
|
| 162 | + } |
|
| 163 | + if ($where) { |
|
| 164 | + $join .= " ON {$where}"; |
|
| 165 | + } |
|
| 161 | 166 | } |
| 162 | 167 | return $join; |
| 163 | 168 | } |
@@ -177,13 +182,15 @@ discard block |
||
| 177 | 182 | $operation = '='; |
| 178 | 183 | } |
| 179 | 184 | |
| 180 | - if ($concatenation === false) |
|
| 181 | - $concatenation = 'AND'; |
|
| 182 | - elseif ($concatenation === true) |
|
| 183 | - $concatenation = ''; |
|
| 185 | + if ($concatenation === false) { |
|
| 186 | + $concatenation = 'AND'; |
|
| 187 | + } elseif ($concatenation === true) { |
|
| 188 | + $concatenation = ''; |
|
| 189 | + } |
|
| 184 | 190 | |
| 185 | - if ($this->whereString == NULL) |
|
| 186 | - $this->whereString = ' WHERE '; |
|
| 191 | + if ($this->whereString == NULL) { |
|
| 192 | + $this->whereString = ' WHERE '; |
|
| 193 | + } |
|
| 187 | 194 | |
| 188 | 195 | if (stristr($operation, 'IN') || stristr($operation, 'NOT IN')) { |
| 189 | 196 | if (is_array($value)) { |
@@ -209,12 +216,12 @@ discard block |
||
| 209 | 216 | $value = "?"; |
| 210 | 217 | } |
| 211 | 218 | |
| 212 | - if (substr($this->whereString, -1, 1) == '(' || substr($this->whereString, -2, 2) == 'E ') |
|
| 213 | - $this->whereString .= " {$where} {$operation} {$value} "; |
|
| 214 | - else |
|
| 215 | - $this->whereString .= "{$concatenation} {$where} {$operation} {$value} "; |
|
| 216 | - } |
|
| 217 | - else { |
|
| 219 | + if (substr($this->whereString, -1, 1) == '(' || substr($this->whereString, -2, 2) == 'E ') { |
|
| 220 | + $this->whereString .= " {$where} {$operation} {$value} "; |
|
| 221 | + } else { |
|
| 222 | + $this->whereString .= "{$concatenation} {$where} {$operation} {$value} "; |
|
| 223 | + } |
|
| 224 | + } else { |
|
| 218 | 225 | $i = -1; |
| 219 | 226 | while (isset($where[++$i])) { |
| 220 | 227 | $item = $where[$i]; |
@@ -229,10 +236,11 @@ discard block |
||
| 229 | 236 | $this->whereString .= "{$concatenation} "; |
| 230 | 237 | } |
| 231 | 238 | |
| 232 | - if ($this->whereString != NULL) |
|
| 233 | - $this->whereString .= '('; |
|
| 234 | - else |
|
| 235 | - $this->whereString = 'WHERE ('; |
|
| 239 | + if ($this->whereString != NULL) { |
|
| 240 | + $this->whereString .= '('; |
|
| 241 | + } else { |
|
| 242 | + $this->whereString = 'WHERE ('; |
|
| 243 | + } |
|
| 236 | 244 | } |
| 237 | 245 | |
| 238 | 246 | if (!is_array($item)) { |
@@ -260,8 +260,7 @@ discard block |
||
| 260 | 260 | } else { |
| 261 | 261 | $value = $item->$colName; |
| 262 | 262 | } |
| 263 | - } |
|
| 264 | - else { |
|
| 263 | + } else { |
|
| 265 | 264 | $value = $item->$colName; |
| 266 | 265 | } |
| 267 | 266 | break; |
@@ -751,17 +750,21 @@ discard block |
||
| 751 | 750 | if (!$query) { |
| 752 | 751 | return []; |
| 753 | 752 | } |
| 754 | - if (!empty($options['where'])) |
|
| 755 | - $query->where($options['where']); |
|
| 753 | + if (!empty($options['where'])) { |
|
| 754 | + $query->where($options['where']); |
|
| 755 | + } |
|
| 756 | 756 | if (!empty($options['group'])) { |
| 757 | 757 | $query->group($options['group']); |
| 758 | 758 | } |
| 759 | - if (!empty($options['order'])) |
|
| 760 | - $query->order($options['order']); |
|
| 761 | - if (!empty($options['join'])) |
|
| 762 | - $query->join($options['join']); |
|
| 763 | - if (!empty($options['distinct'])) |
|
| 764 | - $query->distinct = $options['distinct']; |
|
| 759 | + if (!empty($options['order'])) { |
|
| 760 | + $query->order($options['order']); |
|
| 761 | + } |
|
| 762 | + if (!empty($options['join'])) { |
|
| 763 | + $query->join($options['join']); |
|
| 764 | + } |
|
| 765 | + if (!empty($options['distinct'])) { |
|
| 766 | + $query->distinct = $options['distinct']; |
|
| 767 | + } |
|
| 765 | 768 | |
| 766 | 769 | foreach (static::$relJoins as $join) { |
| 767 | 770 | $query->join($join[0], $join[1]); |
@@ -787,14 +790,14 @@ discard block |
||
| 787 | 790 | } |
| 788 | 791 | static::$needJoin = []; |
| 789 | 792 | |
| 790 | - if (!empty($options['limit'])) |
|
| 791 | - $limit = (int) $options['limit']; |
|
| 792 | - else { |
|
| 793 | + if (!empty($options['limit'])) { |
|
| 794 | + $limit = (int) $options['limit']; |
|
| 795 | + } else { |
|
| 793 | 796 | $limit = 0; |
| 794 | 797 | } |
| 795 | - if (!empty($options['start'])) |
|
| 796 | - $start = (int) $options['start']; |
|
| 797 | - else { |
|
| 798 | + if (!empty($options['start'])) { |
|
| 799 | + $start = (int) $options['start']; |
|
| 800 | + } else { |
|
| 798 | 801 | $start = 0; |
| 799 | 802 | } |
| 800 | 803 | if ($limit || $start) { |
@@ -1061,21 +1064,23 @@ discard block |
||
| 1061 | 1064 | if (!empty($options['where'])) { |
| 1062 | 1065 | static::fixPrefix($options['where'], 'first'); |
| 1063 | 1066 | } |
| 1064 | - if (!empty($options['where'])) |
|
| 1065 | - $query->where($options['where']); |
|
| 1066 | - if (!empty($options['join'])) |
|
| 1067 | - $query->join($options['join']); |
|
| 1067 | + if (!empty($options['where'])) { |
|
| 1068 | + $query->where($options['where']); |
|
| 1069 | + } |
|
| 1070 | + if (!empty($options['join'])) { |
|
| 1071 | + $query->join($options['join']); |
|
| 1072 | + } |
|
| 1068 | 1073 | if (!empty($options['order'])) { |
| 1069 | 1074 | $query->order($options['order']); |
| 1070 | 1075 | } |
| 1071 | - if (!empty($options['limit'])) |
|
| 1072 | - $limit = (int) $options['limit']; |
|
| 1073 | - else { |
|
| 1076 | + if (!empty($options['limit'])) { |
|
| 1077 | + $limit = (int) $options['limit']; |
|
| 1078 | + } else { |
|
| 1074 | 1079 | $limit = 0; |
| 1075 | 1080 | } |
| 1076 | - if (!empty($options['start'])) |
|
| 1077 | - $start = (int) $options['start']; |
|
| 1078 | - else { |
|
| 1081 | + if (!empty($options['start'])) { |
|
| 1082 | + $start = (int) $options['start']; |
|
| 1083 | + } else { |
|
| 1079 | 1084 | $start = 0; |
| 1080 | 1085 | } |
| 1081 | 1086 | if ($limit || $start) { |
@@ -1153,8 +1158,9 @@ discard block |
||
| 1153 | 1158 | |
| 1154 | 1159 | $values = []; |
| 1155 | 1160 | foreach ($cols as $col => $param) { |
| 1156 | - if (isset($params[$col])) |
|
| 1157 | - $values[$col] = $params[$col]; |
|
| 1161 | + if (isset($params[$col])) { |
|
| 1162 | + $values[$col] = $params[$col]; |
|
| 1163 | + } |
|
| 1158 | 1164 | } |
| 1159 | 1165 | if (empty($values)) { |
| 1160 | 1166 | return false; |
@@ -1337,8 +1343,9 @@ discard block |
||
| 1337 | 1343 | $values = []; |
| 1338 | 1344 | |
| 1339 | 1345 | foreach ($this->cols() as $col => $param) { |
| 1340 | - if (isset($this->_params[$col])) |
|
| 1341 | - $values[$col] = $this->_params[$col]; |
|
| 1346 | + if (isset($this->_params[$col])) { |
|
| 1347 | + $values[$col] = $this->_params[$col]; |
|
| 1348 | + } |
|
| 1342 | 1349 | } |
| 1343 | 1350 | if (empty($values) && empty($options['empty'])) { |
| 1344 | 1351 | return false; |
@@ -1498,8 +1505,9 @@ discard block |
||
| 1498 | 1505 | { |
| 1499 | 1506 | |
| 1500 | 1507 | foreach (static::relations() as $relName => $rel) { |
| 1501 | - if ($rel['col'] == $col) |
|
| 1502 | - return $relName; |
|
| 1508 | + if ($rel['col'] == $col) { |
|
| 1509 | + return $relName; |
|
| 1510 | + } |
|
| 1503 | 1511 | } |
| 1504 | 1512 | return NULL; |
| 1505 | 1513 | } |