@@ -11,7 +11,7 @@ |
||
| 11 | 11 | class ServerController extends Controller { |
| 12 | 12 | function csrfAction($key = '') { |
| 13 | 13 | $result = new \Server\Result(); |
| 14 | - $key = (string)$key; |
|
| 14 | + $key = (string) $key; |
|
| 15 | 15 | if (!$key) { |
| 16 | 16 | $result->success = false; |
| 17 | 17 | return $result->send(); |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | ini_set('memory_limit', '2000M'); |
| 15 | 15 | ignore_user_abort(true); |
| 16 | 16 | set_time_limit(0); |
| 17 | - $reExchange = Exchange1c\Exchange::get((int)$_GET['item_pk']); |
|
| 17 | + $reExchange = Exchange1c\Exchange::get((int) $_GET['item_pk']); |
|
| 18 | 18 | |
| 19 | 19 | $exchange = new \Exchange1c\Exchange(); |
| 20 | 20 | $exchange->type = $reExchange->type; |
@@ -148,9 +148,9 @@ discard block |
||
| 148 | 148 | $new_width = $max_width; |
| 149 | 149 | $new_height = $max_height; |
| 150 | 150 | //Находим начальные координаты (центрируем новое изображение) |
| 151 | - $imgX = (int)(($ow / 2) - ($img_width / 2)); |
|
| 151 | + $imgX = (int) (($ow / 2) - ($img_width / 2)); |
|
| 152 | 152 | if ($pos == 'center') { |
| 153 | - $imgY = (int)(($oh / 2) - ($img_height / 2)); |
|
| 153 | + $imgY = (int) (($oh / 2) - ($img_height / 2)); |
|
| 154 | 154 | } else { |
| 155 | 155 | $imgY = 0; |
| 156 | 156 | } |
@@ -292,9 +292,9 @@ discard block |
||
| 292 | 292 | * @return string |
| 293 | 293 | */ |
| 294 | 294 | public static function toRusDate($date) { |
| 295 | - $yy = (int)substr($date, 0, 4); |
|
| 296 | - $mm = (int)substr($date, 5, 2); |
|
| 297 | - $dd = (int)substr($date, 8, 2); |
|
| 295 | + $yy = (int) substr($date, 0, 4); |
|
| 296 | + $mm = (int) substr($date, 5, 2); |
|
| 297 | + $dd = (int) substr($date, 8, 2); |
|
| 298 | 298 | |
| 299 | 299 | $hours = substr($date, 11, 5); |
| 300 | 300 | |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | public function submitReviewAction() { |
| 14 | 14 | $result = new \Server\Result(); |
| 15 | 15 | if (!empty($_POST['review']['item_id']) && !empty($_POST['review']['name']) && !empty($_POST['review']['text'])) { |
| 16 | - $item = Ecommerce\Item::get((int)$_POST['review']['item_id']); |
|
| 16 | + $item = Ecommerce\Item::get((int) $_POST['review']['item_id']); |
|
| 17 | 17 | if (!$item) { |
| 18 | 18 | $result->success = false; |
| 19 | 19 | $result->content = ['errorText' => 'Товар не найден']; |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | 'item_id' => $item->id, |
| 24 | 24 | 'user_id' => \Users\User::$cur->id, |
| 25 | 25 | 'name' => htmlspecialchars($_POST['review']['name']), |
| 26 | - 'rating' => (int)$_POST['review']['rating'], |
|
| 26 | + 'rating' => (int) $_POST['review']['rating'], |
|
| 27 | 27 | 'text' => htmlspecialchars($_POST['review']['text']), |
| 28 | 28 | 'mail' => !empty($_POST['review']['email']) ? htmlspecialchars($_POST['review']['email']) : '', |
| 29 | 29 | 'file_id' => !empty($_FILES['review']['tmp_name']['file']) ? App::$cur->files->upload([ |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | $user = Users\User::$cur; |
| 48 | 48 | if (!empty($_POST) && !empty($_POST['card_id'])) { |
| 49 | 49 | $error = false; |
| 50 | - $card = \Ecommerce\Card::get((int)$_POST['card_id']); |
|
| 50 | + $card = \Ecommerce\Card::get((int) $_POST['card_id']); |
|
| 51 | 51 | if (!$card) { |
| 52 | 52 | $error = true; |
| 53 | 53 | Msg::add('Такой карты не существует', 'danger'); |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | //search |
| 134 | 134 | if (!empty($_GET['search'])) { |
| 135 | 135 | if (!empty($_GET['inCatalog'])) { |
| 136 | - $category_id = (int)$_GET['inCatalog']; |
|
| 136 | + $category_id = (int) $_GET['inCatalog']; |
|
| 137 | 137 | } |
| 138 | 138 | $search = $_GET['search']; |
| 139 | 139 | } else { |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | public function viewAction($id = '', $quick = 0) { |
| 278 | - $item = \Ecommerce\Item::get((int)$id); |
|
| 278 | + $item = \Ecommerce\Item::get((int) $id); |
|
| 279 | 279 | if (!$item) { |
| 280 | 280 | Tools::redirect('/ecommerce/', 'Такой товар не найден'); |
| 281 | 281 | } |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | |
| 324 | 324 | public function toggleFavAction($itemId) { |
| 325 | 325 | $result = new Server\Result(); |
| 326 | - $item = \Ecommerce\Item::get((int)$itemId); |
|
| 326 | + $item = \Ecommerce\Item::get((int) $itemId); |
|
| 327 | 327 | if (!$item) { |
| 328 | 328 | $result->success = false; |
| 329 | 329 | $result->content = 'Товар не найден'; |
@@ -364,7 +364,7 @@ |
||
| 364 | 364 | public function inFav() { |
| 365 | 365 | if (\Users\User::$cur->id) { |
| 366 | 366 | $fav = \Ecommerce\Favorite::get([['user_id', \Users\User::$cur->id], ['item_id', $this->id]]); |
| 367 | - return (bool)$fav; |
|
| 367 | + return (bool) $fav; |
|
| 368 | 368 | } else { |
| 369 | 369 | $favs = !empty($_COOKIE['ecommerce_favitems']) ? json_decode($_COOKIE['ecommerce_favitems'], true) : []; |
| 370 | 370 | return in_array($this->id, $favs); |
@@ -27,6 +27,9 @@ |
||
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | + /** |
|
| 31 | + * @param \Model[] $params |
|
| 32 | + */ |
|
| 30 | 33 | private function parseData(&$data, $params) { |
| 31 | 34 | $objectParamValue = [ |
| 32 | 35 | 'col' => '', |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | </tr> |
| 46 | 46 | <?php |
| 47 | 47 | } |
| 48 | - if($linlcount===1){ |
|
| 48 | + if ($linlcount === 1) { |
|
| 49 | 49 | Tools::redirect($lastlink); |
| 50 | 50 | } |
| 51 | 51 | ?> |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | </tr> |
| 46 | 46 | <?php |
| 47 | 47 | } |
| 48 | - if($linlcount===1){ |
|
| 48 | + if($linlcount===1) { |
|
| 49 | 49 | Tools::redirect($lastlink); |
| 50 | 50 | } |
| 51 | 51 | ?> |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | $inputOptions = [ |
| 22 | 22 | 'value' => $this->value(), |
| 23 | 23 | 'disabled' => $this->readOnly(), |
| 24 | - 'values' => \Ui\ActiveForm::getOptionsList($this->colParams, $this->activeFormParams, !empty($this->modelName)?$this->modelName:$this->activeForm->modelName, $inputName) |
|
| 24 | + 'values' => \Ui\ActiveForm::getOptionsList($this->colParams, $this->activeFormParams, !empty($this->modelName) ? $this->modelName : $this->activeForm->modelName, $inputName) |
|
| 25 | 25 | ]; |
| 26 | 26 | $modelName = ''; |
| 27 | 27 | switch ($inputParams['source']) { |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | 'label' => 'Комментарий', |
| 67 | 67 | ], |
| 68 | 68 | ] |
| 69 | - ],], |
|
| 69 | + ], ], |
|
| 70 | 70 | ] |
| 71 | 71 | ]; |
| 72 | 72 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | public function diff($amount, $comment = '') { |
| 88 | - $amount = (float)$amount; |
|
| 88 | + $amount = (float) $amount; |
|
| 89 | 89 | $query = \App::$cur->db->newQuery(); |
| 90 | 90 | $string = 'UPDATE ' . \App::$cur->db->table_prefix . $this->table() . ' SET `' . $this->colPrefix() . 'amount`=`' . $this->colPrefix() . 'amount`+' . $amount . ' where `' . $this->index() . '` = ' . $this->id; |
| 91 | 91 | $query->query($string); |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | public function showAmount() { |
| 106 | 106 | switch ($this->currency->round_type) { |
| 107 | 107 | case 'floor': |
| 108 | - $dif = (float)('1' . str_repeat('0', $this->currency->round_precision)); |
|
| 108 | + $dif = (float) ('1' . str_repeat('0', $this->currency->round_precision)); |
|
| 109 | 109 | return floor($this->amount * $dif) / $dif; |
| 110 | 110 | default: |
| 111 | 111 | return $this->amount; |