@@ -11,13 +11,14 @@ |
||
| 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/editTemplate/' . $template . '">Редактировать</a>' |
| 20 | 20 | ]); |
| 21 | +} |
|
| 21 | 22 | } |
| 22 | 23 | $table->draw(); |
| 23 | 24 | ?> |
| 24 | 25 | \ No newline at end of file |
@@ -36,8 +36,9 @@ |
||
| 36 | 36 | $params = json_decode($widget->widget_params, true); |
| 37 | 37 | if ($params) { |
| 38 | 38 | foreach ($params as $param) { |
| 39 | - if (!isset($widgetCode[$i])) |
|
| 40 | - break; |
|
| 39 | + if (!isset($widgetCode[$i])) { |
|
| 40 | + break; |
|
| 41 | + } |
|
| 41 | 42 | if ($param['type'] == 'select') { |
| 42 | 43 | $item = $param['model']::get($widgetCode[$i++]); |
| 43 | 44 | if ($item) { |
@@ -35,10 +35,11 @@ |
||
| 35 | 35 | ?> |
| 36 | 36 | </select> |
| 37 | 37 | <?php |
| 38 | -if (false) |
|
| 38 | +if (false) { |
|
| 39 | 39 | foreach ($widgets as $widget) { |
| 40 | 40 | if ($widget->widget_params) { |
| 41 | 41 | $params = json_decode($widget->widget_params, true); |
| 42 | +} |
|
| 42 | 43 | if ($params) { |
| 43 | 44 | echo "<div id = 'params{$widget->widget_id}' class = 'widgetParams' style='display:none;'>"; |
| 44 | 45 | echo "<h3>Параметры</h3>"; |
@@ -13,20 +13,22 @@ |
||
| 13 | 13 | static function genArray($data, $level = 0) |
| 14 | 14 | { |
| 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 | - if (!is_array($item)) |
|
| 21 | - $return .= "'{$item}',"; |
|
| 22 | - else { |
|
| 21 | + if (!is_array($item)) { |
|
| 22 | + $return .= "'{$item}',"; |
|
| 23 | + } else { |
|
| 23 | 24 | $return .= "["; |
| 24 | 25 | $return .= rtrim(self::genArray($item, $level + 1), ','); |
| 25 | 26 | $return .= "\n" . str_repeat(' ', ( $level * 4 + 4)) . "],"; |
| 26 | 27 | } |
| 27 | 28 | } |
| 28 | - if ($level == 0) |
|
| 29 | - $return = rtrim($return, ',') . "\n];"; |
|
| 29 | + if ($level == 0) { |
|
| 30 | + $return = rtrim($return, ',') . "\n];"; |
|
| 31 | + } |
|
| 30 | 32 | |
| 31 | 33 | return $return; |
| 32 | 34 | } |
@@ -205,7 +205,9 @@ discard block |
||
| 205 | 205 | foreach ($arr as $k => $v) { |
| 206 | 206 | if (preg_match('!^'.preg_quote($this->_punycode_prefix, '!').'!', $v)) { |
| 207 | 207 | $conv = $this->_decode($v); |
| 208 | - if ($conv) $arr[$k] = $conv; |
|
| 208 | + if ($conv) { |
|
| 209 | + $arr[$k] = $conv; |
|
| 210 | + } |
|
| 209 | 211 | } |
| 210 | 212 | } |
| 211 | 213 | $input = join('.', $arr); |
@@ -213,7 +215,9 @@ discard block |
||
| 213 | 215 | foreach ($arr as $k => $v) { |
| 214 | 216 | if (preg_match('!^'.preg_quote($this->_punycode_prefix, '!').'!', $v)) { |
| 215 | 217 | $conv = $this->_decode($v); |
| 216 | - if ($conv) $arr[$k] = $conv; |
|
| 218 | + if ($conv) { |
|
| 219 | + $arr[$k] = $conv; |
|
| 220 | + } |
|
| 217 | 221 | } |
| 218 | 222 | } |
| 219 | 223 | $email_pref = join('.', $arr); |
@@ -229,7 +233,9 @@ discard block |
||
| 229 | 233 | $arr = explode('.', $parsed['host']); |
| 230 | 234 | foreach ($arr as $k => $v) { |
| 231 | 235 | $conv = $this->_decode($v); |
| 232 | - if ($conv) $arr[$k] = $conv; |
|
| 236 | + if ($conv) { |
|
| 237 | + $arr[$k] = $conv; |
|
| 238 | + } |
|
| 233 | 239 | } |
| 234 | 240 | $parsed['host'] = join('.', $arr); |
| 235 | 241 | $return = |
@@ -250,7 +256,9 @@ discard block |
||
| 250 | 256 | } |
| 251 | 257 | } else { // Otherwise we consider it being a pure domain name string |
| 252 | 258 | $return = $this->_decode($input); |
| 253 | - if (!$return) $return = $input; |
|
| 259 | + if (!$return) { |
|
| 260 | + $return = $input; |
|
| 261 | + } |
|
| 254 | 262 | } |
| 255 | 263 | // The output is UTF-8 by default, other output formats need conversion here |
| 256 | 264 | // If one time encoding is given, use this, else the objects property |
@@ -294,7 +302,9 @@ discard block |
||
| 294 | 302 | } |
| 295 | 303 | |
| 296 | 304 | // No input, no output, what else did you expect? |
| 297 | - if (empty($decoded)) return ''; |
|
| 305 | + if (empty($decoded)) { |
|
| 306 | + return ''; |
|
| 307 | + } |
|
| 298 | 308 | |
| 299 | 309 | // Anchors for iteration |
| 300 | 310 | $last_begin = 0; |
@@ -371,7 +381,9 @@ discard block |
||
| 371 | 381 | $arr = explode('.', $parsed['host']); |
| 372 | 382 | foreach ($arr as $k => $v) { |
| 373 | 383 | $conv = $this->encode($v, 'utf8'); |
| 374 | - if ($conv) $arr[$k] = $conv; |
|
| 384 | + if ($conv) { |
|
| 385 | + $arr[$k] = $conv; |
|
| 386 | + } |
|
| 375 | 387 | } |
| 376 | 388 | $parsed['host'] = join('.', $arr); |
| 377 | 389 | $return = |
@@ -436,7 +448,9 @@ discard block |
||
| 436 | 448 | $idx += $digit * $w; |
| 437 | 449 | $t = ($k <= $bias) ? $this->_tmin : |
| 438 | 450 | (($k >= $bias + $this->_tmax) ? $this->_tmax : ($k - $bias)); |
| 439 | - if ($digit < $t) break; |
|
| 451 | + if ($digit < $t) { |
|
| 452 | + break; |
|
| 453 | + } |
|
| 440 | 454 | $w = (int) ($w * ($this->_base - $t)); |
| 441 | 455 | } |
| 442 | 456 | $bias = $this->_adapt($idx - $old_idx, $deco_len + 1, $is_first); |
@@ -445,7 +459,9 @@ discard block |
||
| 445 | 459 | $idx %= ($deco_len + 1); |
| 446 | 460 | if ($deco_len > 0) { |
| 447 | 461 | // Make room for the decoded char |
| 448 | - for ($i = $deco_len; $i > $idx; $i--) $decoded[$i] = $decoded[($i - 1)]; |
|
| 462 | + for ($i = $deco_len; $i > $idx; $i--) { |
|
| 463 | + $decoded[$i] = $decoded[($i - 1)]; |
|
| 464 | + } |
|
| 449 | 465 | } |
| 450 | 466 | $decoded[$idx++] = $char; |
| 451 | 467 | } |
@@ -482,9 +498,15 @@ discard block |
||
| 482 | 498 | } |
| 483 | 499 | // Do NAMEPREP |
| 484 | 500 | $decoded = $this->_nameprep($decoded); |
| 485 | - if (!$decoded || !is_array($decoded)) return false; // NAMEPREP failed |
|
| 501 | + if (!$decoded || !is_array($decoded)) { |
|
| 502 | + return false; |
|
| 503 | + } |
|
| 504 | + // NAMEPREP failed |
|
| 486 | 505 | $deco_len = count($decoded); |
| 487 | - if (!$deco_len) return false; // Empty array |
|
| 506 | + if (!$deco_len) { |
|
| 507 | + return false; |
|
| 508 | + } |
|
| 509 | + // Empty array |
|
| 488 | 510 | $codecount = 0; // How many chars have been consumed |
| 489 | 511 | $encoded = ''; |
| 490 | 512 | // Copy all basic code points to output |
@@ -497,12 +519,17 @@ discard block |
||
| 497 | 519 | $codecount++; |
| 498 | 520 | } |
| 499 | 521 | } |
| 500 | - if ($codecount == $deco_len) return $encoded; // All codepoints were basic ones |
|
| 522 | + if ($codecount == $deco_len) { |
|
| 523 | + return $encoded; |
|
| 524 | + } |
|
| 525 | + // All codepoints were basic ones |
|
| 501 | 526 | |
| 502 | 527 | // Start with the prefix; copy it to output |
| 503 | 528 | $encoded = $this->_punycode_prefix.$encoded; |
| 504 | 529 | // If we have basic code points in output, add an hyphen to the end |
| 505 | - if ($codecount) $encoded .= '-'; |
|
| 530 | + if ($codecount) { |
|
| 531 | + $encoded .= '-'; |
|
| 532 | + } |
|
| 506 | 533 | // Now find and encode all non-basic code points |
| 507 | 534 | $is_first = true; |
| 508 | 535 | $cur_code = $this->_initial_n; |
@@ -527,7 +554,9 @@ discard block |
||
| 527 | 554 | for ($q = $delta, $k = $this->_base; 1; $k += $this->_base) { |
| 528 | 555 | $t = ($k <= $bias) ? $this->_tmin : |
| 529 | 556 | (($k >= $bias + $this->_tmax) ? $this->_tmax : $k - $bias); |
| 530 | - if ($q < $t) break; |
|
| 557 | + if ($q < $t) { |
|
| 558 | + break; |
|
| 559 | + } |
|
| 531 | 560 | $encoded .= $this->_encode_digit(intval($t + (($q - $t) % ($this->_base - $t)))); //v0.4.5 Changed from ceil() to intval() |
| 532 | 561 | $q = (int) (($q - $t) / ($this->_base - $t)); |
| 533 | 562 | } |
@@ -607,7 +636,9 @@ discard block |
||
| 607 | 636 | // While mapping required chars we apply the cannonical ordering |
| 608 | 637 | foreach ($input as $v) { |
| 609 | 638 | // Map to nothing == skip that code point |
| 610 | - if (in_array($v, self::$NP['map_nothing'])) continue; |
|
| 639 | + if (in_array($v, self::$NP['map_nothing'])) { |
|
| 640 | + continue; |
|
| 641 | + } |
|
| 611 | 642 | // Try to find prohibited input |
| 612 | 643 | if (in_array($v, self::$NP['prohibit']) || in_array($v, self::$NP['general_prohibited'])) { |
| 613 | 644 | $this->_error('NAMEPREP: Prohibited input U+'.sprintf('%08X', $v)); |
@@ -654,7 +685,9 @@ discard block |
||
| 654 | 685 | if ($out) { |
| 655 | 686 | $output[$last_starter] = $out; |
| 656 | 687 | if (count($out) != $seq_len) { |
| 657 | - for ($j = $i+1; $j < $out_len; ++$j) $output[$j-1] = $output[$j]; |
|
| 688 | + for ($j = $i+1; $j < $out_len; ++$j) { |
|
| 689 | + $output[$j-1] = $output[$j]; |
|
| 690 | + } |
|
| 658 | 691 | unset($output[$out_len]); |
| 659 | 692 | } |
| 660 | 693 | // Rewind the for loop by one, since there can be more possible compositions |
@@ -665,7 +698,9 @@ discard block |
||
| 665 | 698 | } |
| 666 | 699 | } |
| 667 | 700 | // The current class is 0 |
| 668 | - if (!$class) $last_starter = $i; |
|
| 701 | + if (!$class) { |
|
| 702 | + $last_starter = $i; |
|
| 703 | + } |
|
| 669 | 704 | $last_class = $class; |
| 670 | 705 | } |
| 671 | 706 | return $output; |
@@ -680,12 +715,16 @@ discard block |
||
| 680 | 715 | protected function _hangul_decompose($char) |
| 681 | 716 | { |
| 682 | 717 | $sindex = (int) $char - $this->_sbase; |
| 683 | - if ($sindex < 0 || $sindex >= $this->_scount) return array($char); |
|
| 718 | + if ($sindex < 0 || $sindex >= $this->_scount) { |
|
| 719 | + return array($char); |
|
| 720 | + } |
|
| 684 | 721 | $result = array(); |
| 685 | 722 | $result[] = (int) $this->_lbase + $sindex / $this->_ncount; |
| 686 | 723 | $result[] = (int) $this->_vbase + ($sindex % $this->_ncount) / $this->_tcount; |
| 687 | 724 | $T = intval($this->_tbase + $sindex % $this->_tcount); |
| 688 | - if ($T != $this->_tbase) $result[] = $T; |
|
| 725 | + if ($T != $this->_tbase) { |
|
| 726 | + $result[] = $T; |
|
| 727 | + } |
|
| 689 | 728 | return $result; |
| 690 | 729 | } |
| 691 | 730 | /** |
@@ -697,7 +736,9 @@ discard block |
||
| 697 | 736 | protected function _hangul_compose($input) |
| 698 | 737 | { |
| 699 | 738 | $inp_len = count($input); |
| 700 | - if (!$inp_len) return array(); |
|
| 739 | + if (!$inp_len) { |
|
| 740 | + return array(); |
|
| 741 | + } |
|
| 701 | 742 | $result = array(); |
| 702 | 743 | $last = (int) $input[0]; |
| 703 | 744 | $result[] = $last; // copy first char from input to output |
@@ -757,7 +798,9 @@ discard block |
||
| 757 | 798 | if ($next != 0 && $last > $next) { |
| 758 | 799 | // Move item leftward until it fits |
| 759 | 800 | for ($j = $i + 1; $j > 0; --$j) { |
| 760 | - if ($this->_get_combining_class(intval($input[$j-1])) <= $next) break; |
|
| 801 | + if ($this->_get_combining_class(intval($input[$j-1])) <= $next) { |
|
| 802 | + break; |
|
| 803 | + } |
|
| 761 | 804 | $t = intval($input[$j]); |
| 762 | 805 | $input[$j] = intval($input[$j-1]); |
| 763 | 806 | $input[$j-1] = $t; |
@@ -784,8 +827,12 @@ discard block |
||
| 784 | 827 | return false; |
| 785 | 828 | } |
| 786 | 829 | foreach (self::$NP['replacemaps'] as $np_src => $np_target) { |
| 787 | - if ($np_target[0] != $input[0]) continue; |
|
| 788 | - if (count($np_target) != $inp_len) continue; |
|
| 830 | + if ($np_target[0] != $input[0]) { |
|
| 831 | + continue; |
|
| 832 | + } |
|
| 833 | + if (count($np_target) != $inp_len) { |
|
| 834 | + continue; |
|
| 835 | + } |
|
| 789 | 836 | $hit = false; |
| 790 | 837 | foreach ($input as $k2 => $v2) { |
| 791 | 838 | if ($v2 == $np_target[$k2]) { |
@@ -795,7 +842,9 @@ discard block |
||
| 795 | 842 | break; |
| 796 | 843 | } |
| 797 | 844 | } |
| 798 | - if ($hit) return $np_src; |
|
| 845 | + if ($hit) { |
|
| 846 | + return $np_src; |
|
| 847 | + } |
|
| 799 | 848 | } |
| 800 | 849 | return false; |
| 801 | 850 | } |
@@ -948,7 +997,9 @@ discard block |
||
| 948 | 997 | return false; |
| 949 | 998 | } |
| 950 | 999 | // Empty input - return empty output |
| 951 | - if (!$inp_len) return $output; |
|
| 1000 | + if (!$inp_len) { |
|
| 1001 | + return $output; |
|
| 1002 | + } |
|
| 952 | 1003 | for ($i = 0, $out_len = -1; $i < $inp_len; ++$i) { |
| 953 | 1004 | // Increment output position every 4 input bytes |
| 954 | 1005 | if (!($i % 4)) { |
@@ -47,8 +47,9 @@ |
||
| 47 | 47 | return self::$_configs['custom'][$path]; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - if (!file_exists($path)) |
|
| 51 | - return []; |
|
| 50 | + if (!file_exists($path)) { |
|
| 51 | + return []; |
|
| 52 | + } |
|
| 52 | 53 | |
| 53 | 54 | return self::$_configs['custom'][$path] = include $path; |
| 54 | 55 | } |
@@ -685,17 +685,21 @@ discard block |
||
| 685 | 685 | */ |
| 686 | 686 | public static function get_list($options = []) |
| 687 | 687 | { |
| 688 | - if (!empty($options['where'])) |
|
| 689 | - App::$cur->db->where($options['where']); |
|
| 688 | + if (!empty($options['where'])) { |
|
| 689 | + App::$cur->db->where($options['where']); |
|
| 690 | + } |
|
| 690 | 691 | if (!empty($options['group'])) { |
| 691 | 692 | App::$cur->db->group($options['group']); |
| 692 | 693 | } |
| 693 | - if (!empty($options['order'])) |
|
| 694 | - App::$cur->db->order($options['order']); |
|
| 695 | - if (!empty($options['join'])) |
|
| 696 | - App::$cur->db->join($options['join']); |
|
| 697 | - if (!empty($options['distinct'])) |
|
| 698 | - App::$cur->db->distinct = $options['distinct']; |
|
| 694 | + if (!empty($options['order'])) { |
|
| 695 | + App::$cur->db->order($options['order']); |
|
| 696 | + } |
|
| 697 | + if (!empty($options['join'])) { |
|
| 698 | + App::$cur->db->join($options['join']); |
|
| 699 | + } |
|
| 700 | + if (!empty($options['distinct'])) { |
|
| 701 | + App::$cur->db->distinct = $options['distinct']; |
|
| 702 | + } |
|
| 699 | 703 | |
| 700 | 704 | foreach (static::$relJoins as $join) { |
| 701 | 705 | App::$cur->db->join($join[0], $join[1]); |
@@ -721,14 +725,14 @@ discard block |
||
| 721 | 725 | } |
| 722 | 726 | static::$needJoin = []; |
| 723 | 727 | |
| 724 | - if (!empty($options['limit'])) |
|
| 725 | - $limit = (int) $options['limit']; |
|
| 726 | - else { |
|
| 728 | + if (!empty($options['limit'])) { |
|
| 729 | + $limit = (int) $options['limit']; |
|
| 730 | + } else { |
|
| 727 | 731 | $limit = 0; |
| 728 | 732 | } |
| 729 | - if (!empty($options['start'])) |
|
| 730 | - $start = (int) $options['start']; |
|
| 731 | - else { |
|
| 733 | + if (!empty($options['start'])) { |
|
| 734 | + $start = (int) $options['start']; |
|
| 735 | + } else { |
|
| 732 | 736 | $start = 0; |
| 733 | 737 | } |
| 734 | 738 | if ($limit || $start) { |
@@ -983,21 +987,23 @@ discard block |
||
| 983 | 987 | if (!empty($options['where'])) { |
| 984 | 988 | static::fixPrefix($options['where'], 'first'); |
| 985 | 989 | } |
| 986 | - if (!empty($options['where'])) |
|
| 987 | - App::$cur->db->where($options['where']); |
|
| 988 | - if (!empty($options['join'])) |
|
| 989 | - App::$cur->db->join($options['join']); |
|
| 990 | + if (!empty($options['where'])) { |
|
| 991 | + App::$cur->db->where($options['where']); |
|
| 992 | + } |
|
| 993 | + if (!empty($options['join'])) { |
|
| 994 | + App::$cur->db->join($options['join']); |
|
| 995 | + } |
|
| 990 | 996 | if (!empty($options['order'])) { |
| 991 | 997 | App::$cur->db->order($options['order']); |
| 992 | 998 | } |
| 993 | - if (!empty($options['limit'])) |
|
| 994 | - $limit = (int) $options['limit']; |
|
| 995 | - else { |
|
| 999 | + if (!empty($options['limit'])) { |
|
| 1000 | + $limit = (int) $options['limit']; |
|
| 1001 | + } else { |
|
| 996 | 1002 | $limit = 0; |
| 997 | 1003 | } |
| 998 | - if (!empty($options['start'])) |
|
| 999 | - $start = (int) $options['start']; |
|
| 1000 | - else { |
|
| 1004 | + if (!empty($options['start'])) { |
|
| 1005 | + $start = (int) $options['start']; |
|
| 1006 | + } else { |
|
| 1001 | 1007 | $start = 0; |
| 1002 | 1008 | } |
| 1003 | 1009 | if ($limit || $start) { |
@@ -1075,8 +1081,9 @@ discard block |
||
| 1075 | 1081 | |
| 1076 | 1082 | $values = []; |
| 1077 | 1083 | foreach ($cols as $col => $param) { |
| 1078 | - if (isset($params[$col])) |
|
| 1079 | - $values[$col] = $params[$col]; |
|
| 1084 | + if (isset($params[$col])) { |
|
| 1085 | + $values[$col] = $params[$col]; |
|
| 1086 | + } |
|
| 1080 | 1087 | } |
| 1081 | 1088 | if (empty($values)) { |
| 1082 | 1089 | return false; |
@@ -1259,8 +1266,9 @@ discard block |
||
| 1259 | 1266 | $values = []; |
| 1260 | 1267 | |
| 1261 | 1268 | foreach ($this->cols() as $col => $param) { |
| 1262 | - if (isset($this->_params[$col])) |
|
| 1263 | - $values[$col] = $this->_params[$col]; |
|
| 1269 | + if (isset($this->_params[$col])) { |
|
| 1270 | + $values[$col] = $this->_params[$col]; |
|
| 1271 | + } |
|
| 1264 | 1272 | } |
| 1265 | 1273 | if (empty($values) && empty($options['empty'])) { |
| 1266 | 1274 | return false; |
@@ -1420,8 +1428,9 @@ discard block |
||
| 1420 | 1428 | { |
| 1421 | 1429 | |
| 1422 | 1430 | foreach (static::relations() as $relName => $rel) { |
| 1423 | - if ($rel['col'] == $col) |
|
| 1424 | - return $relName; |
|
| 1431 | + if ($rel['col'] == $col) { |
|
| 1432 | + return $relName; |
|
| 1433 | + } |
|
| 1425 | 1434 | } |
| 1426 | 1435 | return NULL; |
| 1427 | 1436 | } |
@@ -1577,8 +1586,9 @@ discard block |
||
| 1577 | 1586 | App::$cur->db->where($relation['relTablePrefix'] . $this->index(), $this->pk()); |
| 1578 | 1587 | App::$cur->db->where($relation['relTablePrefix'] . $relation['model']::index(), $objectId); |
| 1579 | 1588 | $isset = App::$cur->db->select($relation['relTable'])->fetch_assoc(); |
| 1580 | - if ($isset) |
|
| 1581 | - return true; |
|
| 1589 | + if ($isset) { |
|
| 1590 | + return true; |
|
| 1591 | + } |
|
| 1582 | 1592 | |
| 1583 | 1593 | App::$cur->db->insert($relation['relTable'], [ |
| 1584 | 1594 | $relation['relTablePrefix'] . $this->index() => $this->{$this->index()}, |
@@ -189,17 +189,20 @@ |
||
| 189 | 189 | |
| 190 | 190 | public function get($idn = false, $ltype = 'id') |
| 191 | 191 | { |
| 192 | - if (!$idn) |
|
| 193 | - return false; |
|
| 192 | + if (!$idn) { |
|
| 193 | + return false; |
|
| 194 | + } |
|
| 194 | 195 | |
| 195 | - if (is_numeric($idn) && $ltype != 'login') |
|
| 196 | - $user = Users\User::get($idn, 'id'); |
|
| 197 | - elseif ($ltype == 'login') |
|
| 198 | - $user = Users\User::get($idn, 'login'); |
|
| 199 | - else |
|
| 200 | - $user = Users\User::get($idn, 'mail'); |
|
| 201 | - if (!$user) |
|
| 202 | - return []; |
|
| 196 | + if (is_numeric($idn) && $ltype != 'login') { |
|
| 197 | + $user = Users\User::get($idn, 'id'); |
|
| 198 | + } elseif ($ltype == 'login') { |
|
| 199 | + $user = Users\User::get($idn, 'login'); |
|
| 200 | + } else { |
|
| 201 | + $user = Users\User::get($idn, 'mail'); |
|
| 202 | + } |
|
| 203 | + if (!$user) { |
|
| 204 | + return []; |
|
| 205 | + } |
|
| 203 | 206 | |
| 204 | 207 | return $user; |
| 205 | 208 | } |
@@ -140,8 +140,9 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | private function parseRaw($source) |
| 142 | 142 | { |
| 143 | - if (!$source) |
|
| 144 | - return []; |
|
| 143 | + if (!$source) { |
|
| 144 | + return []; |
|
| 145 | + } |
|
| 145 | 146 | |
| 146 | 147 | preg_match_all("|{([^}]+)}|", $source, $result); |
| 147 | 148 | return $result[1]; |
@@ -327,10 +328,11 @@ discard block |
||
| 327 | 328 | $this->ResolveCssHref($css, $type, $hrefs); |
| 328 | 329 | continue; |
| 329 | 330 | } |
| 330 | - if (strpos($css, '//') !== false) |
|
| 331 | - $href = $css; |
|
| 332 | - else |
|
| 333 | - $href = ($this->app->type != 'app' ? '/' . $this->app->name : '' ) . $css; |
|
| 331 | + if (strpos($css, '//') !== false) { |
|
| 332 | + $href = $css; |
|
| 333 | + } else { |
|
| 334 | + $href = ($this->app->type != 'app' ? '/' . $this->app->name : '' ) . $css; |
|
| 335 | + } |
|
| 334 | 336 | $hrefs[$href] = $href; |
| 335 | 337 | } |
| 336 | 338 | break; |
@@ -340,10 +342,11 @@ discard block |
||
| 340 | 342 | $this->ResolveCssHref($css, $type, $hrefs); |
| 341 | 343 | continue; |
| 342 | 344 | } |
| 343 | - if (strpos($css, '://') !== false) |
|
| 344 | - $href = $css; |
|
| 345 | - else |
|
| 346 | - $href = $this->app->templatesPath . "/{$this->template->name}/css/{$css}"; |
|
| 345 | + if (strpos($css, '://') !== false) { |
|
| 346 | + $href = $css; |
|
| 347 | + } else { |
|
| 348 | + $href = $this->app->templatesPath . "/{$this->template->name}/css/{$css}"; |
|
| 349 | + } |
|
| 347 | 350 | $hrefs[$href] = $href; |
| 348 | 351 | } |
| 349 | 352 | break; |
@@ -353,10 +356,11 @@ discard block |
||
| 353 | 356 | $this->ResolveCssHref($css, $type, $hrefs); |
| 354 | 357 | continue; |
| 355 | 358 | } |
| 356 | - if (strpos($css, '//') !== false) |
|
| 357 | - $href = $css; |
|
| 358 | - else |
|
| 359 | - $href = ($this->app->type != 'app' ? '/' . $this->app->name : '' ) . $css; |
|
| 359 | + if (strpos($css, '//') !== false) { |
|
| 360 | + $href = $css; |
|
| 361 | + } else { |
|
| 362 | + $href = ($this->app->type != 'app' ? '/' . $this->app->name : '' ) . $css; |
|
| 363 | + } |
|
| 360 | 364 | $hrefs[$href] = $href; |
| 361 | 365 | } |
| 362 | 366 | break; |
@@ -410,8 +414,9 @@ discard block |
||
| 410 | 414 | $noParsedScripts = []; |
| 411 | 415 | foreach ($scripts as $script) { |
| 412 | 416 | if (is_string($script)) { |
| 413 | - if (!empty($urls[$script])) |
|
| 414 | - continue; |
|
| 417 | + if (!empty($urls[$script])) { |
|
| 418 | + continue; |
|
| 419 | + } |
|
| 415 | 420 | |
| 416 | 421 | $path = $this->app->staticLoader->parsePath($script); |
| 417 | 422 | if (file_exists($path)) { |
@@ -422,8 +427,9 @@ discard block |
||
| 422 | 427 | $noParsedScripts[$script] = $script; |
| 423 | 428 | } |
| 424 | 429 | } elseif (!empty($script['file'])) { |
| 425 | - if (!empty($urls[$script['file']])) |
|
| 426 | - continue; |
|
| 430 | + if (!empty($urls[$script['file']])) { |
|
| 431 | + continue; |
|
| 432 | + } |
|
| 427 | 433 | |
| 428 | 434 | $path = $this->app->staticLoader->parsePath($script['file']); |
| 429 | 435 | if (file_exists($path)) { |
@@ -482,12 +488,14 @@ discard block |
||
| 482 | 488 | $this->genScriptArray($js, $type, $resultArray); |
| 483 | 489 | continue; |
| 484 | 490 | } |
| 485 | - if (strpos($js, '//') !== false) |
|
| 486 | - $href = $js; |
|
| 487 | - else |
|
| 488 | - $href = $this->getHref('js', $js); |
|
| 489 | - if (!$href) |
|
| 490 | - continue; |
|
| 491 | + if (strpos($js, '//') !== false) { |
|
| 492 | + $href = $js; |
|
| 493 | + } else { |
|
| 494 | + $href = $this->getHref('js', $js); |
|
| 495 | + } |
|
| 496 | + if (!$href) { |
|
| 497 | + continue; |
|
| 498 | + } |
|
| 491 | 499 | |
| 492 | 500 | $resultArray[] = $href; |
| 493 | 501 | } |
@@ -498,10 +506,11 @@ discard block |
||
| 498 | 506 | $this->genScriptArray($js, $type, $resultArray); |
| 499 | 507 | continue; |
| 500 | 508 | } |
| 501 | - if (strpos($js, '//') !== false) |
|
| 502 | - $href = $js; |
|
| 503 | - else |
|
| 504 | - $href = $this->app->templatesPath . "/{$this->template->name}/js/{$js}"; |
|
| 509 | + if (strpos($js, '//') !== false) { |
|
| 510 | + $href = $js; |
|
| 511 | + } else { |
|
| 512 | + $href = $this->app->templatesPath . "/{$this->template->name}/js/{$js}"; |
|
| 513 | + } |
|
| 505 | 514 | $resultArray[] = $href; |
| 506 | 515 | } |
| 507 | 516 | break; |
@@ -517,8 +526,9 @@ discard block |
||
| 517 | 526 | $asset = []; |
| 518 | 527 | } |
| 519 | 528 | $asset['file'] = $this->getHref('js', $js); |
| 520 | - if (!$asset['file']) |
|
| 521 | - continue; |
|
| 529 | + if (!$asset['file']) { |
|
| 530 | + continue; |
|
| 531 | + } |
|
| 522 | 532 | $resultArray[] = $asset; |
| 523 | 533 | } |
| 524 | 534 | break; |
@@ -568,8 +578,9 @@ discard block |
||
| 568 | 578 | $paramArray = true; |
| 569 | 579 | } |
| 570 | 580 | } |
| 571 | - if (!$paramArray) |
|
| 572 | - $lineParams = ':' . implode(':', $_params); |
|
| 581 | + if (!$paramArray) { |
|
| 582 | + $lineParams = ':' . implode(':', $_params); |
|
| 583 | + } |
|
| 573 | 584 | } |
| 574 | 585 | } |
| 575 | 586 | echo "<!--start:{WIDGET:{$_widgetName}{$lineParams}}-->\n"; |