@@ -48,7 +48,7 @@ |
||
| 48 | 48 | public function updateDb() { |
| 49 | 49 | // Обновление файла базы данных Sypex Geo |
| 50 | 50 | // Настройки |
| 51 | - $url = 'https://sypexgeo.net/files/SxGeoCity_utf8.zip'; // Путь к скачиваемому файлу |
|
| 51 | + $url = 'https://sypexgeo.net/files/SxGeoCity_utf8.zip'; // Путь к скачиваемому файлу |
|
| 52 | 52 | $dat_file_dir = App::$primary->path . $this->geographyDbDir; // Каталог в который сохранять dat-файл |
| 53 | 53 | $last_updated_file = $dat_file_dir . '/SxGeo.upd'; // Файл в котором хранится дата последнего обновления |
| 54 | 54 | $info = false; // Вывод сообщений о работе, true заменить на false после установки в cron |
@@ -70,7 +70,9 @@ discard block |
||
| 70 | 70 | preg_match("/(Country|City|Max)/", pathinfo($url, PATHINFO_BASENAME), $m); |
| 71 | 71 | $type = $m[1]; |
| 72 | 72 | $dat_file = $types[$type]; |
| 73 | - if ($info) echo "Скачиваем архив с сервера\n"; |
|
| 73 | + if ($info) { |
|
| 74 | + echo "Скачиваем архив с сервера\n"; |
|
| 75 | + } |
|
| 74 | 76 | |
| 75 | 77 | $fp = fopen($dat_file_dir . '/SxGeoTmp.zip', 'wb'); |
| 76 | 78 | $ch = curl_init($url); |
@@ -79,7 +81,9 @@ discard block |
||
| 79 | 81 | CURLOPT_HTTPHEADER => file_exists($last_updated_file) ? array("If-Modified-Since: " . file_get_contents($last_updated_file)) : array(), |
| 80 | 82 | )); |
| 81 | 83 | if (!curl_exec($ch)) { |
| 82 | - if ($info) echo 'Ошибка при скачивании архива'; |
|
| 84 | + if ($info) { |
|
| 85 | + echo 'Ошибка при скачивании архива'; |
|
| 86 | + } |
|
| 83 | 87 | return; |
| 84 | 88 | } |
| 85 | 89 | $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); |
@@ -87,29 +91,40 @@ discard block |
||
| 87 | 91 | fclose($fp); |
| 88 | 92 | if ($code == 304) { |
| 89 | 93 | @unlink($dat_file_dir . '/SxGeoTmp.zip'); |
| 90 | - if ($info) echo "Архив не обновился, с момента предыдущего скачивания\n"; |
|
| 94 | + if ($info) { |
|
| 95 | + echo "Архив не обновился, с момента предыдущего скачивания\n"; |
|
| 96 | + } |
|
| 91 | 97 | return; |
| 92 | 98 | } |
| 93 | 99 | |
| 94 | - if ($info) echo "Архив с сервера скачан\n"; |
|
| 95 | -// Распаковываем архив |
|
| 100 | + if ($info) { |
|
| 101 | + echo "Архив с сервера скачан\n"; |
|
| 102 | + } |
|
| 103 | + // Распаковываем архив |
|
| 96 | 104 | $fp = fopen('zip://' . $dat_file_dir . '/SxGeoTmp.zip#' . $dat_file, 'rb'); |
| 97 | 105 | $fw = fopen($dat_file_dir . '/' . $dat_file, 'wb'); |
| 98 | 106 | if (!$fp) { |
| 99 | - if ($info) |
|
| 100 | - echo "Не получается открыть\n"; |
|
| 107 | + if ($info) { |
|
| 108 | + echo "Не получается открыть\n"; |
|
| 109 | + } |
|
| 101 | 110 | return; |
| 102 | 111 | } |
| 103 | - if ($info) echo "Распаковываем архив\n"; |
|
| 112 | + if ($info) { |
|
| 113 | + echo "Распаковываем архив\n"; |
|
| 114 | + } |
|
| 104 | 115 | stream_copy_to_stream($fp, $fw); |
| 105 | 116 | fclose($fp); |
| 106 | 117 | fclose($fw); |
| 107 | 118 | if (filesize($dat_file) == 0) { |
| 108 | - if ($info) echo 'Ошибка при распаковке архива'; |
|
| 119 | + if ($info) { |
|
| 120 | + echo 'Ошибка при распаковке архива'; |
|
| 121 | + } |
|
| 109 | 122 | } |
| 110 | 123 | @unlink($dat_file_dir . '/SxGeoTmp.zip'); |
| 111 | 124 | file_put_contents($last_updated_file, gmdate('D, d M Y H:i:s') . ' GMT'); |
| 112 | - if ($info) echo "Перемещен файл в {$dat_file_dir}/{$dat_file}\n"; |
|
| 125 | + if ($info) { |
|
| 126 | + echo "Перемещен файл в {$dat_file_dir}/{$dat_file}\n"; |
|
| 127 | + } |
|
| 113 | 128 | |
| 114 | 129 | } |
| 115 | 130 | |
@@ -298,8 +298,8 @@ |
||
| 298 | 298 | /** |
| 299 | 299 | * @var \Ecommerce\Cart\Item[] $cartItems |
| 300 | 300 | */ |
| 301 | - $cartItems =[]; |
|
| 302 | - foreach ($cart->cartItems as $cartItem){ |
|
| 301 | + $cartItems = []; |
|
| 302 | + foreach ($cart->cartItems as $cartItem) { |
|
| 303 | 303 | $cartItems[$cartItem->price->item_offer_id] = $cartItem; |
| 304 | 304 | } |
| 305 | 305 | if (!empty($this->ecommerce->config['cartAddToggle']) && isset($cartItems[$offer->id])) { |
@@ -299,7 +299,7 @@ |
||
| 299 | 299 | * @var \Ecommerce\Cart\Item[] $cartItems |
| 300 | 300 | */ |
| 301 | 301 | $cartItems =[]; |
| 302 | - foreach ($cart->cartItems as $cartItem){ |
|
| 302 | + foreach ($cart->cartItems as $cartItem) { |
|
| 303 | 303 | $cartItems[$cartItem->price->item_offer_id] = $cartItem; |
| 304 | 304 | } |
| 305 | 305 | if (!empty($this->ecommerce->config['cartAddToggle']) && isset($cartItems[$offer->id])) { |
@@ -310,7 +310,7 @@ |
||
| 310 | 310 | if (!$item) { |
| 311 | 311 | Tools::redirect('/ecommerce/', 'Такой товар не найден'); |
| 312 | 312 | } |
| 313 | - if(!$item->isVisible()){ |
|
| 313 | + if (!$item->isVisible()) { |
|
| 314 | 314 | Tools::redirect('/ecommerce/', 'Этот товар сейчас недоступен'); |
| 315 | 315 | } |
| 316 | 316 | $active = $item->category_id; |
@@ -310,7 +310,7 @@ |
||
| 310 | 310 | if (!$item) { |
| 311 | 311 | Tools::redirect('/ecommerce/', 'Такой товар не найден'); |
| 312 | 312 | } |
| 313 | - if(!$item->isVisible()){ |
|
| 313 | + if(!$item->isVisible()) { |
|
| 314 | 314 | Tools::redirect('/ecommerce/', 'Этот товар сейчас недоступен'); |
| 315 | 315 | } |
| 316 | 316 | $active = $item->category_id; |
@@ -13,8 +13,9 @@ |
||
| 13 | 13 | |
| 14 | 14 | public static function genArray($data, $level = 0) { |
| 15 | 15 | $return = ''; |
| 16 | - if ($level == 0) |
|
| 17 | - $return = "["; |
|
| 16 | + if ($level == 0) { |
|
| 17 | + $return = "["; |
|
| 18 | + } |
|
| 18 | 19 | foreach ($data as $key => $item) { |
| 19 | 20 | $return .= "\n" . str_repeat(' ', ($level * 4 + 4)) . "'{$key}' => "; |
| 20 | 21 | if (!is_array($item)) { |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | return false; |
| 32 | 32 | }; |
| 33 | 33 | |
| 34 | -$menu = \Inji\Menu\Menu::connection('injiStorage')->where( 'code',$code)->get(); |
|
| 34 | +$menu = \Inji\Menu\Menu::connection('injiStorage')->where('code', $code)->get(); |
|
| 35 | 35 | if ($menu) { |
| 36 | 36 | foreach ($menu->items(['where' => ['parent_id', 0], 'order' => ['weight', 'asc']]) as $item) { |
| 37 | 37 | $class = ''; |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <h3>История счета</h3> |
| 2 | 2 | <?php |
| 3 | -$currency_id = !empty($_GET['currency_id']) ? (int)$_GET['currency_id'] : 0; |
|
| 3 | +$currency_id = !empty($_GET['currency_id']) ? (int) $_GET['currency_id'] : 0; |
|
| 4 | 4 | $wallets = App::$cur->money->getUserWallets(); |
| 5 | 5 | if ($currency_id && empty($wallets[$currency_id])) {
|
| 6 | 6 | \Inji\Msg::add('У вас нет такого кошелька');
|
@@ -2,17 +2,17 @@ discard block |
||
| 2 | 2 | <?php |
| 3 | 3 | $currency_id = !empty($_GET['currency_id']) ? (int)$_GET['currency_id'] : 0; |
| 4 | 4 | $wallets = App::$cur->money->getUserWallets(); |
| 5 | -if ($currency_id && empty($wallets[$currency_id])) {
|
|
| 5 | +if ($currency_id && empty($wallets[$currency_id])) { |
|
| 6 | 6 | \Inji\Msg::add('У вас нет такого кошелька');
|
| 7 | 7 | \Inji\Msg::show(); |
| 8 | 8 | return; |
| 9 | 9 | } |
| 10 | 10 | |
| 11 | -if ($currency_id) {
|
|
| 11 | +if ($currency_id) { |
|
| 12 | 12 | $ids = $wallets[$currency_id]->id; |
| 13 | -} else {
|
|
| 13 | +} else { |
|
| 14 | 14 | $ids = []; |
| 15 | - foreach ($wallets as $wallet) {
|
|
| 15 | + foreach ($wallets as $wallet) { |
|
| 16 | 16 | $ids[] = $wallet->id; |
| 17 | 17 | } |
| 18 | 18 | $ids = implode(',', $ids);
|
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | 'start' => $pages->params['start'], |
| 34 | 34 | 'limit' => $pages->params['limit'], |
| 35 | 35 | ]); |
| 36 | -foreach ($histories as $history) {
|
|
| 36 | +foreach ($histories as $history) { |
|
| 37 | 37 | $amount = $history->amount ? $history->amount : $history->new - $history->old; |
| 38 | 38 | $table->addRow([ |
| 39 | 39 | $history->id, |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <h3>Блокировки на счете</h3> |
| 2 | 2 | <?php |
| 3 | -$currency_id = !empty($_GET['currency_id']) ? (int)$_GET['currency_id'] : 0; |
|
| 3 | +$currency_id = !empty($_GET['currency_id']) ? (int) $_GET['currency_id'] : 0; |
|
| 4 | 4 | $wallets = App::$cur->money->getUserWallets(); |
| 5 | 5 | if ($currency_id && empty($wallets[$currency_id])) {
|
| 6 | 6 | \Inji\Msg::add('У вас нет такого кошелька');
|
@@ -2,17 +2,17 @@ discard block |
||
| 2 | 2 | <?php |
| 3 | 3 | $currency_id = !empty($_GET['currency_id']) ? (int)$_GET['currency_id'] : 0; |
| 4 | 4 | $wallets = App::$cur->money->getUserWallets(); |
| 5 | -if ($currency_id && empty($wallets[$currency_id])) {
|
|
| 5 | +if ($currency_id && empty($wallets[$currency_id])) { |
|
| 6 | 6 | \Inji\Msg::add('У вас нет такого кошелька');
|
| 7 | 7 | \Inji\Msg::show(); |
| 8 | 8 | return; |
| 9 | 9 | } |
| 10 | 10 | |
| 11 | -if ($currency_id) {
|
|
| 11 | +if ($currency_id) { |
|
| 12 | 12 | $ids = $wallets[$currency_id]->id; |
| 13 | -} else {
|
|
| 13 | +} else { |
|
| 14 | 14 | $ids = []; |
| 15 | - foreach ($wallets as $wallet) {
|
|
| 15 | + foreach ($wallets as $wallet) { |
|
| 16 | 16 | $ids[] = $wallet->id; |
| 17 | 17 | } |
| 18 | 18 | $ids = implode(',', $ids);
|
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | 'start' => $pages->params['start'], |
| 34 | 34 | 'limit' => $pages->params['limit'], |
| 35 | 35 | ]); |
| 36 | -foreach ($histories as $history) {
|
|
| 36 | +foreach ($histories as $history) { |
|
| 37 | 37 | $amount = $history->amount; |
| 38 | 38 | $table->addRow([ |
| 39 | 39 | $history->id, |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | $type = !empty($colInfo['colParams']['type']) ? $colInfo['colParams']['type'] : 'string'; |
| 20 | 20 | if ($type != 'dataManager') { |
| 21 | 21 | $table->addRow([ |
| 22 | - str_replace(' ',' ',!empty($modelName::$labels[$colName]) ? $modelName::$labels[$colName] : $colName), |
|
| 22 | + str_replace(' ', ' ', !empty($modelName::$labels[$colName]) ? $modelName::$labels[$colName] : $colName), |
|
| 23 | 23 | \Inji\Model::resloveTypeValue($item, $colName, true) |
| 24 | 24 | ]); |
| 25 | 25 | } |
@@ -82,10 +82,10 @@ discard block |
||
| 82 | 82 | 'dataManager' => $this |
| 83 | 83 | ]); |
| 84 | 84 | if (!empty($params['limit'])) { |
| 85 | - $this->limit = (int)$params['limit']; |
|
| 85 | + $this->limit = (int) $params['limit']; |
|
| 86 | 86 | } |
| 87 | 87 | if (!empty($params['page'])) { |
| 88 | - $this->page = (int)$params['page']; |
|
| 88 | + $this->page = (int) $params['page']; |
|
| 89 | 89 | } |
| 90 | 90 | $queryParams = [ |
| 91 | 91 | 'count' => true |
@@ -234,10 +234,10 @@ discard block |
||
| 234 | 234 | $queryParams = []; |
| 235 | 235 | if (empty($params['all'])) { |
| 236 | 236 | if (!empty($params['limit'])) { |
| 237 | - $this->limit = (int)$params['limit']; |
|
| 237 | + $this->limit = (int) $params['limit']; |
|
| 238 | 238 | } |
| 239 | 239 | if (!empty($params['page'])) { |
| 240 | - $this->page = (int)$params['page']; |
|
| 240 | + $this->page = (int) $params['page']; |
|
| 241 | 241 | } |
| 242 | 242 | $queryParams['limit'] = $this->limit; |
| 243 | 243 | $queryParams['start'] = $this->page * $this->limit - $this->limit; |