@@ -14,9 +14,9 @@ discard block |
||
14 | 14 | <!-- Indicators --> |
15 | 15 | <ol class="carousel-indicators"> |
16 | 16 | <?php |
17 | - $i = 0; |
|
18 | - for ($i = 0; $i < count($slides); $i++) { |
|
19 | - ?> |
|
17 | + $i = 0; |
|
18 | + for ($i = 0; $i < count($slides); $i++) { |
|
19 | + ?> |
|
20 | 20 | <li data-target="#sliderWidget-<?= $slider->id; ?>" data-slide-to="<?= $i; ?>" <?= !$i ? 'class="active"' : ''; ?>></li> |
21 | 21 | <?php |
22 | 22 | } |
@@ -27,15 +27,15 @@ discard block |
||
27 | 27 | <!-- Wrapper for slides --> |
28 | 28 | <div class="carousel-inner" role="listbox"> |
29 | 29 | <?php |
30 | - $i = 0; |
|
31 | - foreach ($slides as $item) { |
|
32 | - ?> |
|
30 | + $i = 0; |
|
31 | + foreach ($slides as $item) { |
|
32 | + ?> |
|
33 | 33 | <div class="item <?= !$i ? 'active' : ''; ?>"> |
34 | 34 | <?php |
35 | - if ($item->link) { |
|
36 | - echo "<a href = '{$item->link}' style = 'display:inline-block;'>"; |
|
37 | - } |
|
38 | - ?> |
|
35 | + if ($item->link) { |
|
36 | + echo "<a href = '{$item->link}' style = 'display:inline-block;'>"; |
|
37 | + } |
|
38 | + ?> |
|
39 | 39 | <img src="<?= Statics::file($item->image->path); ?>" alt="<?= $item->name; ?>"> |
40 | 40 | <div class="carousel-caption"> |
41 | 41 | <?= $item->description; ?> |
@@ -2,8 +2,8 @@ |
||
2 | 2 | <a href ='/admin/view/template/editFile/<?= $template->name; ?>?path=<?= $template->config['file']; ?>'>Основной файл темы</a> |
3 | 3 | <hr/> |
4 | 4 | <?php |
5 | -foreach ($template->config['css'] as $file) { |
|
6 | - if (file_exists($template->path . '/css/' . $file)) { |
|
5 | +foreach ($template->config['css'] as $file) { |
|
6 | + if (file_exists($template->path . '/css/' . $file)) { |
|
7 | 7 | ?> |
8 | 8 | <a href ='/admin/view/template/editFile/<?= $template->name; ?>?path=<?= 'css/' . $file; ?>'><?= $file; ?></a> |
9 | 9 | <?php |
@@ -11,12 +11,13 @@ |
||
11 | 11 | '', |
12 | 12 | '' |
13 | 13 | ]); |
14 | -if (!empty($templates['app']['installed'])) |
|
14 | +if (!empty($templates['app']['installed'])) { |
|
15 | 15 | foreach ($templates['app']['installed'] as $template => $name) { |
16 | 16 | $table->addRow([ |
17 | 17 | $name, |
18 | 18 | (empty($templates['app']['current']) || $templates['app']['current'] != $template) ? '<a href = "/admin/view/setDefault/' . $template . '">Установить по умолчанию</a>' : 'Тема по умолчанию', |
19 | 19 | '<a href = "/admin/view/template/editFile/' . $template . '">Файлы</a> <a href = "/admin/view/editTemplate/' . $template . '">Редактировать</a>' |
20 | 20 | ]); |
21 | +} |
|
21 | 22 | } |
22 | 23 | $table->draw(); |
@@ -183,7 +183,7 @@ |
||
183 | 183 | |
184 | 184 | $fileName = $fileinfo['filename'] . '.' . $fileinfo['extension']; |
185 | 185 | if (App::$cur->db->connect) { |
186 | - $fileObj = Files\File::get([ 'path', '%/' . $fileinfo['filename'] . '.' . $fileinfo['extension'], 'LIKE']); |
|
186 | + $fileObj = Files\File::get(['path', '%/' . $fileinfo['filename'] . '.' . $fileinfo['extension'], 'LIKE']); |
|
187 | 187 | if ($fileObj) { |
188 | 188 | $fileName = $fileObj->original_name; |
189 | 189 | } |
@@ -37,10 +37,12 @@ discard block |
||
37 | 37 | $scriptApp->installed = true; |
38 | 38 | $scriptApp->params = []; |
39 | 39 | $scriptApp->config = Config::app($scriptApp); |
40 | - } else { |
|
40 | + } |
|
41 | + else { |
|
41 | 42 | $scriptApp = \App::$cur; |
42 | 43 | } |
43 | - } else { |
|
44 | + } |
|
45 | + else { |
|
44 | 46 | $scriptApp = \App::$cur->system ? \App::$primary : \App::$cur; |
45 | 47 | } |
46 | 48 | |
@@ -107,30 +109,38 @@ discard block |
||
107 | 109 | |
108 | 110 | $sizes = explode('x', $_GET['resize']); |
109 | 111 | $sizes[0] = intval($sizes[0]); |
110 | - if (isset($sizes[1])) |
|
111 | - $sizes[1] = intval($sizes[1]); |
|
112 | - else |
|
113 | - $sizes[1] = 0; |
|
112 | + if (isset($sizes[1])) { |
|
113 | + $sizes[1] = intval($sizes[1]); |
|
114 | + } |
|
115 | + else { |
|
116 | + $sizes[1] = 0; |
|
117 | + } |
|
114 | 118 | |
115 | 119 | if (!$sizes[0] || !$sizes[1]) { |
116 | 120 | header('HTTP/1.1 404 Not Found'); |
117 | 121 | exit(); |
118 | - } elseif ($sizes[0] > 2000 || $sizes[1] > 2000) { |
|
122 | + } |
|
123 | + elseif ($sizes[0] > 2000 || $sizes[1] > 2000) { |
|
119 | 124 | header('HTTP/1.1 404 Not Found'); |
120 | 125 | exit(); |
121 | - } else { |
|
126 | + } |
|
127 | + else { |
|
122 | 128 | $dir = App::$primary->path; |
123 | 129 | |
124 | 130 | if (!empty($_GET['resize_crop'])) { |
125 | - if (in_array($_GET['resize_crop'], array('q', 'c'))) |
|
126 | - $crop = $_GET['resize_crop']; |
|
127 | - else |
|
128 | - $crop = 'c'; |
|
131 | + if (in_array($_GET['resize_crop'], array('q', 'c'))) { |
|
132 | + $crop = $_GET['resize_crop']; |
|
133 | + } |
|
134 | + else { |
|
135 | + $crop = 'c'; |
|
136 | + } |
|
137 | + } |
|
138 | + elseif (!empty($_GET['resize_quadro'])) { |
|
139 | + $crop = 'q'; |
|
140 | + } |
|
141 | + else { |
|
142 | + $crop = ''; |
|
129 | 143 | } |
130 | - elseif (!empty($_GET['resize_quadro'])) |
|
131 | - $crop = 'q'; |
|
132 | - else |
|
133 | - $crop = ''; |
|
134 | 144 | $pos = 'center'; |
135 | 145 | if (!empty($_GET['resize_pos']) && in_array($_GET['resize_pos'], array('top', 'center'))) { |
136 | 146 | $pos = $_GET['resize_pos']; |
@@ -155,7 +165,8 @@ discard block |
||
155 | 165 | |
156 | 166 | // Преобразуем запрос клиента If-Modified-Since в таймштамп |
157 | 167 | $modifiedSince = strtotime($modifiedSince[0]); |
158 | - } else { |
|
168 | + } |
|
169 | + else { |
|
159 | 170 | // Устанавливаем время модификации в ноль |
160 | 171 | $modifiedSince = 0; |
161 | 172 | } |
@@ -18,7 +18,8 @@ discard block |
||
18 | 18 | public function getArray($keyCol = '') { |
19 | 19 | if (!$keyCol) { |
20 | 20 | return $this->pdoResult->fetchAll(\PDO::FETCH_ASSOC); |
21 | - } else { |
|
21 | + } |
|
22 | + else { |
|
22 | 23 | $array = []; |
23 | 24 | while ($row = $this->pdoResult->fetch(\PDO::FETCH_ASSOC)) { |
24 | 25 | $array[$row[$keyCol]] = $row; |
@@ -33,7 +34,8 @@ discard block |
||
33 | 34 | while ($object = $this->pdoResult->fetchObject($class)) { |
34 | 35 | if ($keyCol) { |
35 | 36 | $array[$object->$keyCol] = $object; |
36 | - } else { |
|
37 | + } |
|
38 | + else { |
|
37 | 39 | $array[] = $object; |
38 | 40 | } |
39 | 41 | } |
@@ -44,7 +46,8 @@ discard block |
||
44 | 46 | public function fetch($className = '') { |
45 | 47 | if ($className) { |
46 | 48 | return $this->pdoResult->fetchObject($className); |
47 | - } else { |
|
49 | + } |
|
50 | + else { |
|
48 | 51 | return $this->pdoResult->fetch(\PDO::FETCH_ASSOC); |
49 | 52 | } |
50 | 53 | } |
@@ -15,11 +15,13 @@ |
||
15 | 15 | $param = isset($this->config['default']) ? $this->config['default'] : 'local'; |
16 | 16 | } |
17 | 17 | if (!is_array($param)) { |
18 | - if (!($dbOption = Db\Options::get($param, 'connect_alias', ['array' => true]))) |
|
19 | - return false; |
|
18 | + if (!($dbOption = Db\Options::get($param, 'connect_alias', ['array' => true]))) { |
|
19 | + return false; |
|
20 | + } |
|
20 | 21 | |
21 | 22 | $db = $dbOption; |
22 | - } else { |
|
23 | + } |
|
24 | + else { |
|
23 | 25 | $db = $param; |
24 | 26 | } |
25 | 27 | $className = 'Db\\' . $db['driver']; |
@@ -16,34 +16,35 @@ discard block |
||
16 | 16 | 'type' => 'decimal' |
17 | 17 | ] |
18 | 18 | ], |
19 | - 'viewer' => function($level) { |
|
19 | + 'viewer' => function($level) { |
|
20 | 20 | $levelTypes = [ |
21 | 21 | 'procent' => 'Процент', |
22 | 22 | 'amount' => 'Сумма', |
23 | 23 | ]; |
24 | 24 | return $levelTypes[$level->params['type']->value] . ': ' . $level->params['amount']->value . ' ' . ($level->params['type']->value == 'procent' ? '%' : ($level->params['currency_id']->value ? \Money\Currency::get($level->params['currency_id']->value)->acronym() : '')); |
25 | 25 | }, |
26 | - 'rewarder' => function($reward, $sums, $user, $rootUser, $level, $rewardGet) { |
|
26 | + 'rewarder' => function($reward, $sums, $user, $rootUser, $level, $rewardGet) { |
|
27 | 27 | $wallets = \App::$cur->money->getUserWallets($user->id); |
28 | 28 | $amount = 0; |
29 | -if (!empty($wallets[$level->params['currency_id']->value])) { |
|
30 | - switch ($level->params['type']->value) { |
|
29 | +if (!empty($wallets[$level->params['currency_id']->value])) { |
|
30 | + switch ($level->params['type']->value) { |
|
31 | 31 | case 'procent': |
32 | 32 | $finalSum = 0; |
33 | - foreach ($sums as $currency_id => $sum) { |
|
34 | - if ($currency_id != $level->params['currency_id']->value) { |
|
33 | + foreach ($sums as $currency_id => $sum) { |
|
34 | + if ($currency_id != $level->params['currency_id']->value) { |
|
35 | 35 | $rate = \Money\Currency\ExchangeRate::get([ |
36 | 36 | ['currency_id', $currency_id], |
37 | 37 | ['target_currency_id', $level->params['currency_id']->value], |
38 | 38 | ]); |
39 | - if ($rate) { |
|
39 | + if ($rate) { |
|
40 | 40 | $finalSum += $sum * $rate->rate; |
41 | 41 | } |
42 | - } else { |
|
42 | + } |
|
43 | + else { |
|
43 | 44 | $finalSum += $sum; |
44 | 45 | } |
45 | 46 | } |
46 | - switch ($reward->round_type) { |
|
47 | + switch ($reward->round_type) { |
|
47 | 48 | case 'round': |
48 | 49 | $finalSum = round($finalSum, $reward->round_precision); |
49 | 50 | $amount = $finalSum / 100 * (float) $level->params['amount']->value; |
@@ -59,33 +60,34 @@ discard block |
||
59 | 60 | case 'amount': |
60 | 61 | $amount = (float) $level->params['amount']->value; |
61 | 62 | } |
62 | - if (!$amount) { |
|
63 | + if (!$amount) { |
|
63 | 64 | return 0; |
64 | 65 | } |
65 | 66 | |
66 | 67 | $text = 'Вознаграждение по программе "' . $reward->name . '"'; |
67 | - if ($rootUser->id != $user->id) { |
|
68 | + if ($rootUser->id != $user->id) { |
|
68 | 69 | $text .= ' от ' . $rootUser->name(); |
69 | 70 | } |
70 | 71 | |
71 | - if (!$rewardGet && $reward->block) { |
|
72 | + if (!$rewardGet && $reward->block) { |
|
72 | 73 | $block = new \Money\Wallet\Block(); |
73 | 74 | $block->wallet_id = $wallets[$level->params['currency_id']->value]->id; |
74 | 75 | $block->amount = $amount; |
75 | 76 | $block->comment = $text; |
76 | 77 | $block->data = 'reward:' . $reward->id; |
77 | 78 | $dateGenerators = \App::$cur->money->getSnippets('expiredDateGenerator'); |
78 | - if ($reward->block_date_expired && !empty($dateGenerators[$reward->block_date_expired])) { |
|
79 | + if ($reward->block_date_expired && !empty($dateGenerators[$reward->block_date_expired])) { |
|
79 | 80 | $date = $dateGenerators[$reward->block_date_expired]($reward, $user); |
80 | - if (!empty($date['date'])) { |
|
81 | + if (!empty($date['date'])) { |
|
81 | 82 | $block->date_expired = $date['date']; |
82 | 83 | } |
83 | - if (!empty($date['type'])) { |
|
84 | + if (!empty($date['type'])) { |
|
84 | 85 | $block->expired_type = $date['type']; |
85 | 86 | } |
86 | 87 | } |
87 | 88 | $block->save(); |
88 | - } else { |
|
89 | + } |
|
90 | + else { |
|
89 | 91 | $wallets[$level->params['currency_id']->value]->diff($amount, $text); |
90 | 92 | } |
91 | 93 | \App::$cur->users->AddUserActivity($user->id, 4, $text . '<br />' . $amount . ' ' . $wallets[$level->params['currency_id']->value]->currency->acronym()); |
@@ -8,7 +8,8 @@ discard block |
||
8 | 8 | |
9 | 9 | if (!$rewardItemExist) { |
10 | 10 | $allowTypes = explode(',', $trigger->params['item_type_id']->value); |
11 | - } else { |
|
11 | + } |
|
12 | + else { |
|
12 | 13 | $allowTypes = []; |
13 | 14 | } |
14 | 15 | foreach ($cart->cartItems as $cartItem) { |
@@ -19,7 +20,8 @@ discard block |
||
19 | 20 | $currency_id = $cartItem->price->currency ? $cartItem->price->currency->id : \App::$cur->ecommerce->config['defaultCurrency']; |
20 | 21 | if (empty($sums[$currency_id])) { |
21 | 22 | $sums[$currency_id] = $cartItem->final_price * $cartItem->count; |
22 | - } else { |
|
23 | + } |
|
24 | + else { |
|
23 | 25 | $sums[$currency_id] += $cartItem->final_price * $cartItem->count; |
24 | 26 | } |
25 | 27 | } |
@@ -2,7 +2,7 @@ |
||
2 | 2 | |
3 | 3 | return [ |
4 | 4 | 'name' => 'Последняя покупка не позднее 90 дней', |
5 | - 'checker' => function($user) { |
|
5 | + 'checker' => function($user) { |
|
6 | 6 | $query = 'SELECT * FROM inji_ecommerce_cart iec WHERE iec.cart_cart_status_id >= 5 AND iec.cart_date_create >= NOW() - INTERVAL 90 DAY AND cart_user_id = ?'; |
7 | 7 | $result = \App::$cur->db->query(['query' => $query, 'params' => [$user->id]]); |
8 | 8 | return (bool) $result ? $result->fetch() : false; |