@@ -131,7 +131,7 @@ |
||
131 | 131 | if ($treePath) { |
132 | 132 | $categorys = Category::getList(['where' => ['id', implode(',', $treePath), 'IN']]); |
133 | 133 | foreach ($categorys as $category) { |
134 | - $href .="/{$category->alias}"; |
|
134 | + $href .= "/{$category->alias}"; |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | return $href . "/" . ($this->alias ? $this->alias : $this->pk()); |
@@ -136,9 +136,11 @@ discard block |
||
136 | 136 | $param = $material ? 'material_template' : 'template'; |
137 | 137 | if ($this->$param !== 'inherit') { |
138 | 138 | return $this->$param; |
139 | - } elseif ($this->$param == 'inherit' && $this->parent) { |
|
139 | + } |
|
140 | + elseif ($this->$param == 'inherit' && $this->parent) { |
|
140 | 141 | return $this->parent->resolveTemplate($material); |
141 | - } else { |
|
142 | + } |
|
143 | + else { |
|
142 | 144 | return 'current'; |
143 | 145 | } |
144 | 146 | } |
@@ -147,9 +149,11 @@ discard block |
||
147 | 149 | $param = $material ? 'material_viewer' : 'viewer'; |
148 | 150 | if ($this->$param !== 'inherit') { |
149 | 151 | return $this->$param; |
150 | - } elseif ($this->$param == 'inherit' && $this->parent) { |
|
152 | + } |
|
153 | + elseif ($this->$param == 'inherit' && $this->parent) { |
|
151 | 154 | return $this->parent->resolveViewer($material); |
152 | - } else { |
|
155 | + } |
|
156 | + else { |
|
153 | 157 | return $material ? 'default' : 'category'; |
154 | 158 | } |
155 | 159 | } |
@@ -13,11 +13,11 @@ |
||
13 | 13 | |
14 | 14 | class Mysql extends \Object |
15 | 15 | { |
16 | - public $config = []; // настройки подключения выбраной базы |
|
17 | - public $connect = FALSE; // ярлык соединения с MySQL |
|
18 | - public $encoding = 'utf-8'; // установленная кодировка |
|
19 | - public $db_name = 'test'; // выбраная в данный момент база |
|
20 | - public $table_prefix = 'inji_'; // префикс названий таблиц |
|
16 | + public $config = []; // настройки подключения выбраной базы |
|
17 | + public $connect = FALSE; // ярлык соединения с MySQL |
|
18 | + public $encoding = 'utf-8'; // установленная кодировка |
|
19 | + public $db_name = 'test'; // выбраная в данный момент база |
|
20 | + public $table_prefix = 'inji_'; // префикс названий таблиц |
|
21 | 21 | public $pdo = NULL; |
22 | 22 | public $lastQuery = ''; |
23 | 23 | public $last_error = ''; |
@@ -29,14 +29,18 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function init($connect_options) { |
31 | 31 | extract($connect_options); |
32 | - if (isset($db_name)) |
|
33 | - $this->db_name = $db_name; |
|
34 | - if (isset($encoding)) |
|
35 | - $this->encoding = $encoding; |
|
36 | - if (isset($table_prefix)) |
|
37 | - $this->table_prefix = $table_prefix; |
|
38 | - if (isset($noConnectAbort)) |
|
39 | - $this->noConnectAbort = $noConnectAbort; |
|
32 | + if (isset($db_name)) { |
|
33 | + $this->db_name = $db_name; |
|
34 | + } |
|
35 | + if (isset($encoding)) { |
|
36 | + $this->encoding = $encoding; |
|
37 | + } |
|
38 | + if (isset($table_prefix)) { |
|
39 | + $this->table_prefix = $table_prefix; |
|
40 | + } |
|
41 | + if (isset($noConnectAbort)) { |
|
42 | + $this->noConnectAbort = $noConnectAbort; |
|
43 | + } |
|
40 | 44 | |
41 | 45 | $dsn = "mysql:host=$host;port=$port;dbname=$db_name;charset=$encoding"; |
42 | 46 | $dt = new \DateTime(); |
@@ -52,10 +56,12 @@ discard block |
||
52 | 56 | if ((int) $error[0]) { |
53 | 57 | if ($this->noConnectAbort) { |
54 | 58 | return false; |
55 | - } else { |
|
59 | + } |
|
60 | + else { |
|
56 | 61 | INJI_SYSTEM_ERROR($error[2], true); |
57 | 62 | } |
58 | - } else { |
|
63 | + } |
|
64 | + else { |
|
59 | 65 | $this->connect = true; |
60 | 66 | $query = new Mysql\Query($this); |
61 | 67 | $query->query("SET SQL_BIG_SELECTS=1"); |
@@ -14,11 +14,11 @@ |
||
14 | 14 | class Mysql extends \Object { |
15 | 15 | |
16 | 16 | public $config = []; // настройки подключения выбраной базы |
17 | - public $connect = FALSE; // ярлык соединения с MySQL |
|
17 | + public $connect = false; // ярлык соединения с MySQL |
|
18 | 18 | public $encoding = 'utf-8'; // установленная кодировка |
19 | 19 | public $db_name = 'test'; // выбраная в данный момент база |
20 | 20 | public $table_prefix = 'inji_'; // префикс названий таблиц |
21 | - public $pdo = NULL; |
|
21 | + public $pdo = null; |
|
22 | 22 | public $lastQuery = ''; |
23 | 23 | public $last_error = ''; |
24 | 24 | public $noConnectAbort = false; |
@@ -97,13 +97,13 @@ |
||
97 | 97 | if ($this->first_name . $this->last_name . $this->middle_name) { |
98 | 98 | $name = ''; |
99 | 99 | if ($this->first_name) { |
100 | - $name.=$this->first_name; |
|
100 | + $name .= $this->first_name; |
|
101 | 101 | } |
102 | 102 | if ($this->middle_name) { |
103 | - $name.=($name ? ' ' : '') . $this->middle_name; |
|
103 | + $name .= ($name ? ' ' : '') . $this->middle_name; |
|
104 | 104 | } |
105 | 105 | if ($this->last_name) { |
106 | - $name.=($name ? ' ' : '') . $this->last_name; |
|
106 | + $name .= ($name ? ' ' : '') . $this->last_name; |
|
107 | 107 | } |
108 | 108 | return $name; |
109 | 109 | } else { |
@@ -56,7 +56,8 @@ |
||
56 | 56 | $name.=($name ? ' ' : '') . $this->last_name; |
57 | 57 | } |
58 | 58 | return $name; |
59 | - } else { |
|
59 | + } |
|
60 | + else { |
|
60 | 61 | return $this->user_id; |
61 | 62 | } |
62 | 63 | } |
@@ -187,16 +187,16 @@ discard block |
||
187 | 187 | { |
188 | 188 | $pos = strpos($source, $rawTag) - 1; |
189 | 189 | echo substr($source, 0, $pos); |
190 | - return substr($source, ( $pos + strlen($rawTag) + 2)); |
|
190 | + return substr($source, ($pos + strlen($rawTag) + 2)); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | public function getHref($type, $params) |
194 | 194 | { |
195 | 195 | $href = ''; |
196 | 196 | if (is_string($params)) { |
197 | - $href = ($this->app->type != 'app' ? '/' . $this->app->name : '' ) . $params; |
|
197 | + $href = ($this->app->type != 'app' ? '/' . $this->app->name : '') . $params; |
|
198 | 198 | } elseif (empty($params['template']) && !empty($params['file'])) { |
199 | - $href = ($this->app->type != 'app' ? '/' . $this->app->name : '' ) . $params['file']; |
|
199 | + $href = ($this->app->type != 'app' ? '/' . $this->app->name : '') . $params['file']; |
|
200 | 200 | } elseif (!empty($params['template']) && !empty($params['file'])) { |
201 | 201 | $href = $this->app->templatesPath . "/{$this->template->name}/{$type}/{$params['file']}"; |
202 | 202 | } |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | |
256 | 256 | $this->checkNeedLibs(); |
257 | 257 | $this->parseCss(); |
258 | - echo "\n <script src='" . Statics::file(($this->app->type != 'app' ? '/' . $this->app->name : '' ) . "/static/system/js/Inji.js") . "'></script>"; |
|
258 | + echo "\n <script src='" . Statics::file(($this->app->type != 'app' ? '/' . $this->app->name : '') . "/static/system/js/Inji.js") . "'></script>"; |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | public function parseCss() |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | if (file_exists($path)) { |
280 | 280 | $this->loadedCss[$href] = $href; |
281 | 281 | $urls[$href] = $path; |
282 | - $timeStr.=filemtime($path); |
|
282 | + $timeStr .= filemtime($path); |
|
283 | 283 | } else { |
284 | 284 | echo "\n <link href='{$href}' rel='stylesheet' type='text/css' />"; |
285 | 285 | } |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | if (strpos($css, '//') !== false) |
331 | 331 | $href = $css; |
332 | 332 | else |
333 | - $href = ($this->app->type != 'app' ? '/' . $this->app->name : '' ) . $css; |
|
333 | + $href = ($this->app->type != 'app' ? '/' . $this->app->name : '') . $css; |
|
334 | 334 | $hrefs[$href] = $href; |
335 | 335 | } |
336 | 336 | break; |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | if (strpos($css, '//') !== false) |
357 | 357 | $href = $css; |
358 | 358 | else |
359 | - $href = ($this->app->type != 'app' ? '/' . $this->app->name : '' ) . $css; |
|
359 | + $href = ($this->app->type != 'app' ? '/' . $this->app->name : '') . $css; |
|
360 | 360 | $hrefs[$href] = $href; |
361 | 361 | } |
362 | 362 | break; |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | if (file_exists($path)) { |
418 | 418 | $nativeUrl[$script] = $script; |
419 | 419 | $urls[$script] = $path; |
420 | - $timeStr.=filemtime($path); |
|
420 | + $timeStr .= filemtime($path); |
|
421 | 421 | } else { |
422 | 422 | $noParsedScripts[$script] = $script; |
423 | 423 | } |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | if (!empty($script['name'])) { |
433 | 433 | $onLoadModules[$script['name']] = $script['name']; |
434 | 434 | } |
435 | - $timeStr.=filemtime($path); |
|
435 | + $timeStr .= filemtime($path); |
|
436 | 436 | } else { |
437 | 437 | $noParsedScripts[$script] = $script; |
438 | 438 | } |
@@ -59,7 +59,8 @@ discard block |
||
59 | 59 | $source = str_replace('</body>', '{BODYEND}</body>', $source); |
60 | 60 | } |
61 | 61 | $this->parseSource($source); |
62 | - } else { |
|
62 | + } |
|
63 | + else { |
|
63 | 64 | $this->content(); |
64 | 65 | } |
65 | 66 | } |
@@ -80,7 +81,8 @@ discard block |
||
80 | 81 | //set content |
81 | 82 | if (!empty($params['content'])) { |
82 | 83 | $this->template->setContent($params['content']); |
83 | - } elseif (!$this->template->contentPath) { |
|
84 | + } |
|
85 | + elseif (!$this->template->contentPath) { |
|
84 | 86 | $this->template->setContent(); |
85 | 87 | } |
86 | 88 | //set data |
@@ -98,7 +100,8 @@ discard block |
||
98 | 100 | } |
99 | 101 | if (!file_exists($this->template->contentPath)) { |
100 | 102 | echo 'Content not found'; |
101 | - } else { |
|
103 | + } |
|
104 | + else { |
|
102 | 105 | extract($this->contentData); |
103 | 106 | include $this->template->contentPath; |
104 | 107 | } |
@@ -126,15 +129,17 @@ discard block |
||
126 | 129 | } |
127 | 130 | if (!$data) { |
128 | 131 | echo 'Content not found'; |
129 | - } else { |
|
132 | + } |
|
133 | + else { |
|
130 | 134 | extract($this->contentData); |
131 | 135 | include $data['contentPath']; |
132 | 136 | } |
133 | 137 | } |
134 | 138 | |
135 | 139 | private function parseRaw($source) { |
136 | - if (!$source) |
|
137 | - return []; |
|
140 | + if (!$source) { |
|
141 | + return []; |
|
142 | + } |
|
138 | 143 | |
139 | 144 | preg_match_all("|{([^}]+)}|", $source, $result); |
140 | 145 | return $result[1]; |
@@ -185,9 +190,11 @@ discard block |
||
185 | 190 | $href = ''; |
186 | 191 | if (is_string($params)) { |
187 | 192 | $href = ($this->app->type != 'app' ? '/' . $this->app->name : '' ) . $params; |
188 | - } elseif (empty($params['template']) && !empty($params['file'])) { |
|
193 | + } |
|
194 | + elseif (empty($params['template']) && !empty($params['file'])) { |
|
189 | 195 | $href = ($this->app->type != 'app' ? '/' . $this->app->name : '' ) . $params['file']; |
190 | - } elseif (!empty($params['template']) && !empty($params['file'])) { |
|
196 | + } |
|
197 | + elseif (!empty($params['template']) && !empty($params['file'])) { |
|
191 | 198 | $href = $this->app->templatesPath . "/{$this->template->name}/{$type}/{$params['file']}"; |
192 | 199 | } |
193 | 200 | return $href; |
@@ -225,9 +232,11 @@ discard block |
||
225 | 232 | |
226 | 233 | if (!empty($this->template->config['favicon']) && file_exists($this->template->path . "/{$this->template->config['favicon']}")) { |
227 | 234 | echo " <link rel='shortcut icon' href='/templates/{$this->template->name}/{$this->template->config['favicon']}' />"; |
228 | - } elseif (!empty($this->template->config['favicon']) && file_exists($this->app->path . "/static/images/{$this->template->config['favicon']}")) { |
|
235 | + } |
|
236 | + elseif (!empty($this->template->config['favicon']) && file_exists($this->app->path . "/static/images/{$this->template->config['favicon']}")) { |
|
229 | 237 | echo " <link rel='shortcut icon' href='/static/images/{$this->template->config['favicon']}' />"; |
230 | - } elseif (file_exists($this->app->path . '/static/images/favicon.ico')) { |
|
238 | + } |
|
239 | + elseif (file_exists($this->app->path . '/static/images/favicon.ico')) { |
|
231 | 240 | echo " <link rel='shortcut icon' href='/static/images/favicon.ico' />"; |
232 | 241 | } |
233 | 242 | |
@@ -267,7 +276,8 @@ discard block |
||
267 | 276 | $this->loadedCss[$href] = $href; |
268 | 277 | $urls[$href] = $path; |
269 | 278 | $timeStr.=filemtime($path); |
270 | - } else { |
|
279 | + } |
|
280 | + else { |
|
271 | 281 | echo "\n <link href='{$href}' rel='stylesheet' type='text/css' />"; |
272 | 282 | } |
273 | 283 | } |
@@ -311,10 +321,12 @@ discard block |
||
311 | 321 | $this->ResolveCssHref($css, $type, $hrefs); |
312 | 322 | continue; |
313 | 323 | } |
314 | - if (strpos($css, '//') !== false) |
|
315 | - $href = $css; |
|
316 | - else |
|
317 | - $href = ($this->app->type != 'app' ? '/' . $this->app->name : '' ) . $css; |
|
324 | + if (strpos($css, '//') !== false) { |
|
325 | + $href = $css; |
|
326 | + } |
|
327 | + else { |
|
328 | + $href = ($this->app->type != 'app' ? '/' . $this->app->name : '' ) . $css; |
|
329 | + } |
|
318 | 330 | $hrefs[$href] = $href; |
319 | 331 | } |
320 | 332 | break; |
@@ -324,10 +336,12 @@ discard block |
||
324 | 336 | $this->ResolveCssHref($css, $type, $hrefs); |
325 | 337 | continue; |
326 | 338 | } |
327 | - if (strpos($css, '://') !== false) |
|
328 | - $href = $css; |
|
329 | - else |
|
330 | - $href = $this->app->templatesPath . "/{$this->template->name}/css/{$css}"; |
|
339 | + if (strpos($css, '://') !== false) { |
|
340 | + $href = $css; |
|
341 | + } |
|
342 | + else { |
|
343 | + $href = $this->app->templatesPath . "/{$this->template->name}/css/{$css}"; |
|
344 | + } |
|
331 | 345 | $hrefs[$href] = $href; |
332 | 346 | } |
333 | 347 | break; |
@@ -337,10 +351,12 @@ discard block |
||
337 | 351 | $this->ResolveCssHref($css, $type, $hrefs); |
338 | 352 | continue; |
339 | 353 | } |
340 | - if (strpos($css, '//') !== false) |
|
341 | - $href = $css; |
|
342 | - else |
|
343 | - $href = ($this->app->type != 'app' ? '/' . $this->app->name : '' ) . $css; |
|
354 | + if (strpos($css, '//') !== false) { |
|
355 | + $href = $css; |
|
356 | + } |
|
357 | + else { |
|
358 | + $href = ($this->app->type != 'app' ? '/' . $this->app->name : '' ) . $css; |
|
359 | + } |
|
344 | 360 | $hrefs[$href] = $href; |
345 | 361 | } |
346 | 362 | break; |
@@ -360,7 +376,8 @@ discard block |
||
360 | 376 | foreach ($this->app->config['site']['metatags'] as $meta) { |
361 | 377 | if (!empty($meta['name'])) { |
362 | 378 | $metas['metaName:' . $meta['name']] = $meta; |
363 | - } elseif (!empty($meta['property'])) { |
|
379 | + } |
|
380 | + elseif (!empty($meta['property'])) { |
|
364 | 381 | $metas['metaProperty:' . $meta['property']] = $meta; |
365 | 382 | } |
366 | 383 | } |
@@ -374,7 +391,8 @@ discard block |
||
374 | 391 | public function addMetaTag($meta) { |
375 | 392 | if (!empty($meta['name'])) { |
376 | 393 | $this->dynMetas['metaName:' . $meta['name']] = $meta; |
377 | - } elseif (!empty($meta['property'])) { |
|
394 | + } |
|
395 | + elseif (!empty($meta['property'])) { |
|
378 | 396 | $this->dynMetas['metaProperty:' . $meta['property']] = $meta; |
379 | 397 | } |
380 | 398 | } |
@@ -391,20 +409,24 @@ discard block |
||
391 | 409 | $noParsedScripts = []; |
392 | 410 | foreach ($scripts as $script) { |
393 | 411 | if (is_string($script)) { |
394 | - if (!empty($urls[$script])) |
|
395 | - continue; |
|
412 | + if (!empty($urls[$script])) { |
|
413 | + continue; |
|
414 | + } |
|
396 | 415 | |
397 | 416 | $path = $this->app->staticLoader->parsePath($script); |
398 | 417 | if (file_exists($path)) { |
399 | 418 | $nativeUrl[$script] = $script; |
400 | 419 | $urls[$script] = $path; |
401 | 420 | $timeStr.=filemtime($path); |
402 | - } else { |
|
421 | + } |
|
422 | + else { |
|
403 | 423 | $noParsedScripts[$script] = $script; |
404 | 424 | } |
405 | - } elseif (!empty($script['file'])) { |
|
406 | - if (!empty($urls[$script['file']])) |
|
407 | - continue; |
|
425 | + } |
|
426 | + elseif (!empty($script['file'])) { |
|
427 | + if (!empty($urls[$script['file']])) { |
|
428 | + continue; |
|
429 | + } |
|
408 | 430 | |
409 | 431 | $path = $this->app->staticLoader->parsePath($script['file']); |
410 | 432 | if (file_exists($path)) { |
@@ -414,7 +436,8 @@ discard block |
||
414 | 436 | $onLoadModules[$script['name']] = $script['name']; |
415 | 437 | } |
416 | 438 | $timeStr.=filemtime($path); |
417 | - } else { |
|
439 | + } |
|
440 | + else { |
|
418 | 441 | $noParsedScripts[$script] = $script; |
419 | 442 | } |
420 | 443 | } |
@@ -461,12 +484,15 @@ discard block |
||
461 | 484 | $this->genScriptArray($js, $type, $resultArray); |
462 | 485 | continue; |
463 | 486 | } |
464 | - if (strpos($js, '//') !== false) |
|
465 | - $href = $js; |
|
466 | - else |
|
467 | - $href = $this->getHref('js', $js); |
|
468 | - if (!$href) |
|
469 | - continue; |
|
487 | + if (strpos($js, '//') !== false) { |
|
488 | + $href = $js; |
|
489 | + } |
|
490 | + else { |
|
491 | + $href = $this->getHref('js', $js); |
|
492 | + } |
|
493 | + if (!$href) { |
|
494 | + continue; |
|
495 | + } |
|
470 | 496 | |
471 | 497 | $resultArray[] = $href; |
472 | 498 | } |
@@ -477,10 +503,12 @@ discard block |
||
477 | 503 | $this->genScriptArray($js, $type, $resultArray); |
478 | 504 | continue; |
479 | 505 | } |
480 | - if (strpos($js, '//') !== false) |
|
481 | - $href = $js; |
|
482 | - else |
|
483 | - $href = $this->app->templatesPath . "/{$this->template->name}/js/{$js}"; |
|
506 | + if (strpos($js, '//') !== false) { |
|
507 | + $href = $js; |
|
508 | + } |
|
509 | + else { |
|
510 | + $href = $this->app->templatesPath . "/{$this->template->name}/js/{$js}"; |
|
511 | + } |
|
484 | 512 | $resultArray[] = $href; |
485 | 513 | } |
486 | 514 | break; |
@@ -492,12 +520,14 @@ discard block |
||
492 | 520 | continue; |
493 | 521 | } |
494 | 522 | $asset = $js; |
495 | - } else { |
|
523 | + } |
|
524 | + else { |
|
496 | 525 | $asset = []; |
497 | 526 | } |
498 | 527 | $asset['file'] = $this->getHref('js', $js); |
499 | - if (!$asset['file']) |
|
500 | - continue; |
|
528 | + if (!$asset['file']) { |
|
529 | + continue; |
|
530 | + } |
|
501 | 531 | $resultArray[] = $asset; |
502 | 532 | } |
503 | 533 | break; |
@@ -507,7 +537,8 @@ discard block |
||
507 | 537 | public function customAsset($type, $asset, $lib = false) { |
508 | 538 | if (!$lib) { |
509 | 539 | $this->dynAssets[$type][] = $asset; |
510 | - } else { |
|
540 | + } |
|
541 | + else { |
|
511 | 542 | $this->libAssets[$type][$lib][] = $asset; |
512 | 543 | } |
513 | 544 | } |
@@ -516,10 +547,12 @@ discard block |
||
516 | 547 | if ($add && !empty($this->app->config['site']['name'])) { |
517 | 548 | if ($title) { |
518 | 549 | $this->title = $title . ' - ' . $this->app->config['site']['name']; |
519 | - } else { |
|
550 | + } |
|
551 | + else { |
|
520 | 552 | $this->title = $this->app->config['site']['name']; |
521 | 553 | } |
522 | - } else { |
|
554 | + } |
|
555 | + else { |
|
523 | 556 | $this->title = $title; |
524 | 557 | } |
525 | 558 | } |
@@ -542,8 +575,9 @@ discard block |
||
542 | 575 | $paramArray = true; |
543 | 576 | } |
544 | 577 | } |
545 | - if (!$paramArray) |
|
546 | - $lineParams = ':' . implode(':', $_params); |
|
578 | + if (!$paramArray) { |
|
579 | + $lineParams = ':' . implode(':', $_params); |
|
580 | + } |
|
547 | 581 | } |
548 | 582 | } |
549 | 583 | echo "<!--start:{WIDGET:{$_widgetName}{$lineParams}}-->\n"; |
@@ -570,7 +604,8 @@ discard block |
||
570 | 604 | $paths[$pathName] = $path . '/widgets/' . $widgetName[1] . '.php'; |
571 | 605 | } |
572 | 606 | return $paths; |
573 | - } else { |
|
607 | + } |
|
608 | + else { |
|
574 | 609 | $paths['templatePath_widgetDir'] = $this->templatesPath . '/' . $this->template->name . '/widgets/' . $widgetName . '/' . $widgetName . '.php'; |
575 | 610 | $paths['templatePath'] = $this->templatesPath . '/' . $this->template->name . '/widgets/' . $widgetName . '.php'; |
576 | 611 |
@@ -329,6 +329,9 @@ |
||
329 | 329 | return $rows; |
330 | 330 | } |
331 | 331 | |
332 | + /** |
|
333 | + * @param DataManager $dataManager |
|
334 | + */ |
|
332 | 335 | public static function drawCol($item, $colName, $params = [], $dataManager = null, $originalCol = '', $originalItem = null) |
333 | 336 | { |
334 | 337 | $modelName = get_class($item); |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | return $item->$colName; |
474 | 474 | } |
475 | 475 | } elseif (!empty($modelName::$cols[$colName]['type'])) { |
476 | - if (\App::$cur->name == 'admin' && $originalCol == 'name' || ( $dataManager && !empty($dataManager->managerOptions['colToView']) && $dataManager->managerOptions['colToView'] == $originalCol)) { |
|
476 | + if (\App::$cur->name == 'admin' && $originalCol == 'name' || ($dataManager && !empty($dataManager->managerOptions['colToView']) && $dataManager->managerOptions['colToView'] == $originalCol)) { |
|
477 | 477 | $formName = $dataManager && !empty($dataManager->managerOptions['editForm']) ? $dataManager->managerOptions['editForm'] : 'manager'; |
478 | 478 | $redirectUrl = !empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/admin/' . str_replace('\\', '/', get_class($originalItem)); |
479 | 479 | return "<a href ='/admin/{$originalItem->genViewLink()}?formName={$formName}&redirectUrl={$redirectUrl}'>{$item->$colName}</a>"; |
@@ -684,7 +684,7 @@ discard block |
||
684 | 684 | ]; |
685 | 685 | } |
686 | 686 | $tableCols[] = ''; |
687 | - $this->table->class .=' datamanagertable'; |
|
687 | + $this->table->class .= ' datamanagertable'; |
|
688 | 688 | $this->table->setCols($tableCols); |
689 | 689 | } |
690 | 690 |
@@ -42,10 +42,12 @@ discard block |
||
42 | 42 | $this->managerOptions = !empty($modelNameOrOptions::$dataManagers[$managerName]) ? $modelNameOrOptions::$dataManagers[$managerName] : []; |
43 | 43 | if (isset($modelNameOrOptions::$objectName)) { |
44 | 44 | $this->name = $modelNameOrOptions::$objectName; |
45 | - } else { |
|
45 | + } |
|
46 | + else { |
|
46 | 47 | $this->name = $modelNameOrOptions; |
47 | 48 | } |
48 | - } else { |
|
49 | + } |
|
50 | + else { |
|
49 | 51 | $this->managerOptions = $modelNameOrOptions; |
50 | 52 | } |
51 | 53 | |
@@ -152,7 +154,8 @@ discard block |
||
152 | 154 | $action['className'] = $key; |
153 | 155 | } |
154 | 156 | $return[$key] = $action; |
155 | - } else { |
|
157 | + } |
|
158 | + else { |
|
156 | 159 | $key = $action; |
157 | 160 | $return[$key] = [ |
158 | 161 | 'className' => $action |
@@ -208,7 +211,8 @@ discard block |
||
208 | 211 | if (is_array($col)) { |
209 | 212 | $colName = $key; |
210 | 213 | $colOptions = $col; |
211 | - } else { |
|
214 | + } |
|
215 | + else { |
|
212 | 216 | $colName = $col; |
213 | 217 | $colOptions = []; |
214 | 218 | } |
@@ -218,7 +222,8 @@ discard block |
||
218 | 222 | } |
219 | 223 | if (empty($colOptions['label']) && !empty($colInfo['label'])) { |
220 | 224 | $colOptions['label'] = $colInfo['label']; |
221 | - } elseif (empty($colOptions['label'])) { |
|
225 | + } |
|
226 | + elseif (empty($colOptions['label'])) { |
|
222 | 227 | $colOptions['label'] = $colName; |
223 | 228 | } |
224 | 229 | $cols[$colName] = $colOptions; |
@@ -267,7 +272,8 @@ discard block |
||
267 | 272 | foreach ($this->managerOptions['userGroupFilter'][\Users\User::$cur->group_id]['getRows'] as $colName => $colOptions) { |
268 | 273 | if (!empty($colOptions['userCol'])) { |
269 | 274 | $queryParams['where'][] = [$colName, \Model::getColValue(\Users\User::$cur, $colOptions['userCol'])]; |
270 | - } elseif (isset($colOptions['value'])) { |
|
275 | + } |
|
276 | + elseif (isset($colOptions['value'])) { |
|
271 | 277 | if (is_array($colOptions['value'])) { |
272 | 278 | foreach ($colOptions['value'] as $key => $value) { |
273 | 279 | if ($key === 'userCol') { |
@@ -318,7 +324,8 @@ discard block |
||
318 | 324 | if ($colInfo['colParams']['type'] == 'dateTime' && !strpos($params['filters'][$col]['max'], ' ')) { |
319 | 325 | |
320 | 326 | $date = $params['filters'][$col]['max'] . ' 23:59:59'; |
321 | - } else { |
|
327 | + } |
|
328 | + else { |
|
322 | 329 | $date = $params['filters'][$col]['max']; |
323 | 330 | } |
324 | 331 | $queryParams['where'][] = [$col, $date, '<=']; |
@@ -362,7 +369,8 @@ discard block |
||
362 | 369 | } |
363 | 370 | if (!empty($params['mode']) && $params['mode'] == 'sort') { |
364 | 371 | $queryParams['order'] = ['weight', 'asc']; |
365 | - } elseif (!empty($params['sortered']) && !empty($this->managerOptions['sortable'])) { |
|
372 | + } |
|
373 | + elseif (!empty($params['sortered']) && !empty($this->managerOptions['sortable'])) { |
|
366 | 374 | foreach ($params['sortered'] as $colName => $sortType) { |
367 | 375 | if ($colName && in_array($colName, $this->managerOptions['sortable'])) { |
368 | 376 | $sortType = in_array($sortType, ['desc', 'asc']) ? $sortType : 'desc'; |
@@ -373,7 +381,8 @@ discard block |
||
373 | 381 | if ($model && !empty($params['relation'])) { |
374 | 382 | $relation = $model::getRelation($params['relation']); |
375 | 383 | $items = $model->$params['relation']($queryParams); |
376 | - } else { |
|
384 | + } |
|
385 | + else { |
|
377 | 386 | $relation = false; |
378 | 387 | $items = $modelName::getList($queryParams); |
379 | 388 | } |
@@ -389,7 +398,8 @@ discard block |
||
389 | 398 | foreach ($this->managerOptions['cols'] as $key => $colName) { |
390 | 399 | if (!empty($params['download'])) { |
391 | 400 | $row[] = \Model::getColValue($item, is_array($colName) ? $key : $colName, true, false); |
392 | - } else { |
|
401 | + } |
|
402 | + else { |
|
393 | 403 | $row[] = DataManager::drawCol($item, is_array($colName) ? $key : $colName, $params, $this); |
394 | 404 | } |
395 | 405 | } |
@@ -418,7 +428,8 @@ discard block |
||
418 | 428 | $col = substr($colName, strpos($colName, ':') + 1); |
419 | 429 | if ($item->$rel) { |
420 | 430 | return DataManager::drawCol($item->$rel, $col, $params, $dataManager, $originalCol, $originalItem); |
421 | - } else { |
|
431 | + } |
|
432 | + else { |
|
422 | 433 | return 'Не указано'; |
423 | 434 | } |
424 | 435 | } |
@@ -441,20 +452,24 @@ discard block |
||
441 | 452 | $href = "<a href ='/admin/" . $item->{$modelName::$cols[$colName]['relation']}->genViewLink() . "'>"; |
442 | 453 | if (!empty($modelName::$cols[$colName]['showCol'])) { |
443 | 454 | $href .= $item->{$modelName::$cols[$colName]['relation']}->{$modelName::$cols[$colName]['showCol']}; |
444 | - } else { |
|
455 | + } |
|
456 | + else { |
|
445 | 457 | |
446 | 458 | $href .= $item->{$modelName::$cols[$colName]['relation']}->name(); |
447 | 459 | } |
448 | 460 | $href .= '</a>'; |
449 | 461 | return $href; |
450 | - } else { |
|
462 | + } |
|
463 | + else { |
|
451 | 464 | return $item->{$modelName::$cols[$colName]['relation']}->name(); |
452 | 465 | } |
453 | - } else { |
|
466 | + } |
|
467 | + else { |
|
454 | 468 | return $item->$colName; |
455 | 469 | } |
456 | 470 | } |
457 | - } else { |
|
471 | + } |
|
472 | + else { |
|
458 | 473 | if (!empty($modelName::$cols[$colName]['view']['type'])) { |
459 | 474 | switch ($modelName::$cols[$colName]['view']['type']) { |
460 | 475 | case 'widget': |
@@ -472,15 +487,18 @@ discard block |
||
472 | 487 | default: |
473 | 488 | return $item->$colName; |
474 | 489 | } |
475 | - } elseif (!empty($modelName::$cols[$colName]['type'])) { |
|
490 | + } |
|
491 | + elseif (!empty($modelName::$cols[$colName]['type'])) { |
|
476 | 492 | if (\App::$cur->name == 'admin' && $originalCol == 'name' || ( $dataManager && !empty($dataManager->managerOptions['colToView']) && $dataManager->managerOptions['colToView'] == $originalCol)) { |
477 | 493 | $formName = $dataManager && !empty($dataManager->managerOptions['editForm']) ? $dataManager->managerOptions['editForm'] : 'manager'; |
478 | 494 | $redirectUrl = !empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/admin/' . str_replace('\\', '/', get_class($originalItem)); |
479 | 495 | return "<a href ='/admin/{$originalItem->genViewLink()}?formName={$formName}&redirectUrl={$redirectUrl}'>{$item->$colName}</a>"; |
480 | - } elseif (\App::$cur->name == 'admin' && $colName == 'name') { |
|
496 | + } |
|
497 | + elseif (\App::$cur->name == 'admin' && $colName == 'name') { |
|
481 | 498 | $redirectUrl = !empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/admin/' . str_replace('\\', '/', get_class($originalItem)); |
482 | 499 | return "<a href ='/admin/{$item->genViewLink()}?redirectUrl={$redirectUrl}'>{$item->$colName}</a>"; |
483 | - } elseif ($modelName::$cols[$colName]['type'] == 'html') { |
|
500 | + } |
|
501 | + elseif ($modelName::$cols[$colName]['type'] == 'html') { |
|
484 | 502 | $uid = \Tools::randomString(); |
485 | 503 | $script = "<script>inji.onLoad(function(){ |
486 | 504 | var el{$uid}=$('#{$uid}'); |
@@ -509,10 +527,12 @@ discard block |
||
509 | 527 | } |
510 | 528 | })</script>"; |
511 | 529 | return "<div id = '{$uid}' style='max-height:44px;overflow:hidden;'>{$item->$colName}</div>" . $script; |
512 | - } else { |
|
530 | + } |
|
531 | + else { |
|
513 | 532 | return \Model::resloveTypeValue($item, $colName); |
514 | 533 | } |
515 | - } else { |
|
534 | + } |
|
535 | + else { |
|
516 | 536 | return $item->$colName; |
517 | 537 | } |
518 | 538 | } |
@@ -561,7 +581,8 @@ discard block |
||
561 | 581 | foreach ($this->managerOptions['userGroupFilter'][\Users\User::$cur->group_id]['getRows'] as $colName => $colOptions) { |
562 | 582 | if (!empty($colOptions['userCol'])) { |
563 | 583 | $queryParams['where'][] = [$colName, \Model::getColValue(\Users\User::$cur, $colOptions['userCol'])]; |
564 | - } elseif (isset($colOptions['value'])) { |
|
584 | + } |
|
585 | + elseif (isset($colOptions['value'])) { |
|
565 | 586 | if (is_array($colOptions['value'])) { |
566 | 587 | foreach ($colOptions['value'] as $key => $value) { |
567 | 588 | if ($key === 'userCol') { |
@@ -613,7 +634,8 @@ discard block |
||
613 | 634 | if ($colInfo['colParams']['type'] == 'dateTime' && !strpos($params['filters'][$col]['max'], ' ')) { |
614 | 635 | |
615 | 636 | $date = $params['filters'][$col]['max'] . ' 23:59:59'; |
616 | - } else { |
|
637 | + } |
|
638 | + else { |
|
617 | 639 | $date = $params['filters'][$col]['max']; |
618 | 640 | } |
619 | 641 | $queryParams['where'][] = [$col, $date, '<=']; |
@@ -657,7 +679,8 @@ discard block |
||
657 | 679 | } |
658 | 680 | if ($model && !empty($params['relation'])) { |
659 | 681 | $count = $model->$params['relation']($queryParams); |
660 | - } else { |
|
682 | + } |
|
683 | + else { |
|
661 | 684 | $count = $modelName::getCount($queryParams); |
662 | 685 | } |
663 | 686 | $pages = new Pages([ |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | if (empty($blocks[$block->wallet->currency_id])) { |
103 | 103 | $blocks[$block->wallet->currency_id] = $block->amount; |
104 | 104 | } else { |
105 | - $blocks[$block->wallet->currency_id]+= $block->amount; |
|
105 | + $blocks[$block->wallet->currency_id] += $block->amount; |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 | return $blocks; |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | $rootUser = $rootUser ? $rootUser : \Users\User::$cur; |
169 | 169 | $reward = \Money\Reward::get($reward_id); |
170 | 170 | $reward->checkBlocked(); |
171 | - $reward_count = \Money\Reward\Recive::getCount([ 'where' => [ 'reward_id', $reward_id]]); |
|
171 | + $reward_count = \Money\Reward\Recive::getCount(['where' => ['reward_id', $reward_id]]); |
|
172 | 172 | if ($reward_count >= $reward->quantity && $reward->quantity) |
173 | 173 | return false; |
174 | 174 | $types = $this->getSnippets('rewardType'); |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | $recives = \Money\Reward\Recive::getList(['where' => [['user_id', $user->id], ['reward_id', $reward->id]]]); |
190 | 190 | $amount = 0; |
191 | 191 | foreach ($recives as $recive) { |
192 | - $amount+=$recive->amount; |
|
192 | + $amount += $recive->amount; |
|
193 | 193 | } |
194 | 194 | if ($amount >= $reward->peruser) { |
195 | 195 | continue; |
@@ -49,7 +49,8 @@ discard block |
||
49 | 49 | public function reciver($data, $system, $status, $mr) { |
50 | 50 | if ($system) { |
51 | 51 | $merchant = \Money\Merchant::get($system, 'object_name'); |
52 | - } else { |
|
52 | + } |
|
53 | + else { |
|
53 | 54 | $merchant = false; |
54 | 55 | } |
55 | 56 | if ($merchant) { |
@@ -96,7 +97,8 @@ discard block |
||
96 | 97 | foreach ($blocked as $block) { |
97 | 98 | if (empty($blocks[$block->wallet->currency_id])) { |
98 | 99 | $blocks[$block->wallet->currency_id] = $block->amount; |
99 | - } else { |
|
100 | + } |
|
101 | + else { |
|
100 | 102 | $blocks[$block->wallet->currency_id]+= $block->amount; |
101 | 103 | } |
102 | 104 | } |
@@ -123,7 +125,8 @@ discard block |
||
123 | 125 | $wallet->currency_id = $currency->id; |
124 | 126 | $wallet->save(); |
125 | 127 | $result[$walletIdasKey ? $wallet->id : $currency->id] = $forSelect ? $wallet->name() : $wallet; |
126 | - } else { |
|
128 | + } |
|
129 | + else { |
|
127 | 130 | $result[$walletIdasKey ? $wallets[$currency->id]->id : $currency->id] = $forSelect ? $wallets[$currency->id]->name() : $wallets[$currency->id]; |
128 | 131 | } |
129 | 132 | } |
@@ -61,21 +61,21 @@ |
||
61 | 61 | if ($first) { |
62 | 62 | $first = false; |
63 | 63 | } else { |
64 | - $string.= '<br />'; |
|
64 | + $string .= '<br />'; |
|
65 | 65 | } |
66 | - $string.= '<span style="white-space:nowrap;">'; |
|
67 | - $string.= number_format($sum, 2, '.', ' '); |
|
66 | + $string .= '<span style="white-space:nowrap;">'; |
|
67 | + $string .= number_format($sum, 2, '.', ' '); |
|
68 | 68 | if (\App::$cur->money) { |
69 | 69 | $currency = \Money\Currency::get($currency_id); |
70 | 70 | if ($currency) { |
71 | - $string.= ' ' . $currency->acronym(); |
|
71 | + $string .= ' ' . $currency->acronym(); |
|
72 | 72 | } else { |
73 | - $string.= ' руб.'; |
|
73 | + $string .= ' руб.'; |
|
74 | 74 | } |
75 | 75 | } else { |
76 | - $string.= ' руб.'; |
|
76 | + $string .= ' руб.'; |
|
77 | 77 | } |
78 | - $string.= '</span>'; |
|
78 | + $string .= '</span>'; |
|
79 | 79 | } |
80 | 80 | return $string; |
81 | 81 | } |
@@ -54,7 +54,8 @@ discard block |
||
54 | 54 | foreach ($this->sums as $currency_id => $sum) { |
55 | 55 | if ($first) { |
56 | 56 | $first = false; |
57 | - } else { |
|
57 | + } |
|
58 | + else { |
|
58 | 59 | $string.= '<br />'; |
59 | 60 | } |
60 | 61 | $string.= '<span style="white-space:nowrap;">'; |
@@ -63,10 +64,12 @@ discard block |
||
63 | 64 | $currency = \Money\Currency::get($currency_id); |
64 | 65 | if ($currency) { |
65 | 66 | $string.= ' ' . $currency->acronym(); |
66 | - } else { |
|
67 | + } |
|
68 | + else { |
|
67 | 69 | $string.= ' руб.'; |
68 | 70 | } |
69 | - } else { |
|
71 | + } |
|
72 | + else { |
|
70 | 73 | $string.= ' руб.'; |
71 | 74 | } |
72 | 75 | $string.= '</span>'; |
@@ -11,6 +11,10 @@ |
||
11 | 11 | |
12 | 12 | function indexAction() { |
13 | 13 | |
14 | + /** |
|
15 | + * @param DOMDocument $xml |
|
16 | + * @param string $nodeName |
|
17 | + */ |
|
14 | 18 | function addToXml($xml, $parent, $nodeName, $text) { |
15 | 19 | $node = $parent->appendChild($xml->createElement($nodeName)); |
16 | 20 | $node->appendChild($xml->createTextNode($text)); |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | if ($type->allow_resize && $type->options && json_decode($type->options, true)) { |
60 | 60 | $typeOptions = json_decode($type->options, true); |
61 | - list( $img_width, $img_height, $img_type, $img_tag ) = getimagesize($sitePath . $fileObject->path); |
|
61 | + list($img_width, $img_height, $img_type, $img_tag) = getimagesize($sitePath . $fileObject->path); |
|
62 | 62 | if ($img_height > $typeOptions['max_height'] || $img_width > $typeOptions['max_width']) { |
63 | 63 | Tools::resizeImage($sitePath . $fileObject->path, $typeOptions['max_width'], $typeOptions['max_height']); |
64 | 64 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | |
121 | 121 | if ($type->allow_resize && $type->options && json_decode($type->options, true)) { |
122 | 122 | $typeOptions = json_decode($type->options, true); |
123 | - list( $img_width, $img_height, $img_type, $img_tag ) = getimagesize($sitePath . $fileObject->path); |
|
123 | + list($img_width, $img_height, $img_type, $img_tag) = getimagesize($sitePath . $fileObject->path); |
|
124 | 124 | if ($img_height > $typeOptions['max_height'] || $img_width > $typeOptions['max_width']) { |
125 | 125 | Tools::resizeImage($sitePath . $fileObject->path, $typeOptions['max_width'], $typeOptions['max_height']); |
126 | 126 | } |
@@ -22,16 +22,19 @@ discard block |
||
22 | 22 | |
23 | 23 | $sitePath = App::$primary->path; |
24 | 24 | |
25 | - if (!is_uploaded_file($file['tmp_name'])) |
|
26 | - return 0; |
|
25 | + if (!is_uploaded_file($file['tmp_name'])) { |
|
26 | + return 0; |
|
27 | + } |
|
27 | 28 | |
28 | 29 | $fileinfo = pathinfo($file['name']); |
29 | - if (empty($fileinfo['extension'])) |
|
30 | - return 0; |
|
30 | + if (empty($fileinfo['extension'])) { |
|
31 | + return 0; |
|
32 | + } |
|
31 | 33 | |
32 | 34 | $type = Files\Type::get($fileinfo['extension'], 'ext'); |
33 | - if (!$type) |
|
34 | - return 0; |
|
35 | + if (!$type) { |
|
36 | + return 0; |
|
37 | + } |
|
35 | 38 | |
36 | 39 | if (!empty($options['accept_group']) && $options['accept_group'] != $type->group) { |
37 | 40 | return 0; |
@@ -47,8 +50,9 @@ discard block |
||
47 | 50 | } |
48 | 51 | $fileObject->name = $fileinfo['filename']; |
49 | 52 | $fileObject->path = $type->type_dir . date('Y-m-d') . '/' . microtime(true) . '.' . $fileinfo['extension']; |
50 | - if ($fileObject->id && file_exists($sitePath . $fileObject->path)) |
|
51 | - unlink($sitePath . $fileObject->path); |
|
53 | + if ($fileObject->id && file_exists($sitePath . $fileObject->path)) { |
|
54 | + unlink($sitePath . $fileObject->path); |
|
55 | + } |
|
52 | 56 | |
53 | 57 | Tools::createDir($sitePath . $type->type_dir . date('Y-m-d') . '/'); |
54 | 58 | |
@@ -84,12 +88,14 @@ discard block |
||
84 | 88 | $sitePath = App::$primary->path; |
85 | 89 | |
86 | 90 | $fileinfo = pathinfo($url); |
87 | - if (empty($fileinfo['extension'])) |
|
88 | - return 0; |
|
91 | + if (empty($fileinfo['extension'])) { |
|
92 | + return 0; |
|
93 | + } |
|
89 | 94 | |
90 | 95 | $type = Files\Type::get($fileinfo['extension'], 'ext'); |
91 | - if (!$type) |
|
92 | - return 0; |
|
96 | + if (!$type) { |
|
97 | + return 0; |
|
98 | + } |
|
93 | 99 | |
94 | 100 | if (!empty($options['accept_group']) && $options['accept_group'] != $type->group) { |
95 | 101 | return 0; |
@@ -105,8 +111,9 @@ discard block |
||
105 | 111 | } |
106 | 112 | $fileObject->name = $fileinfo['filename']; |
107 | 113 | $fileObject->path = $type->type_dir . date('Y-m-d') . '/' . microtime(true) . '.' . $fileinfo['extension']; |
108 | - if ($fileObject->id && file_exists($sitePath . $fileObject->path)) |
|
109 | - unlink($sitePath . $fileObject->path); |
|
114 | + if ($fileObject->id && file_exists($sitePath . $fileObject->path)) { |
|
115 | + unlink($sitePath . $fileObject->path); |
|
116 | + } |
|
110 | 117 | |
111 | 118 | Tools::createDir($sitePath . $type->type_dir . date('Y-m-d') . '/'); |
112 | 119 |