@@ -35,7 +35,7 @@ |
||
35 | 35 | } |
36 | 36 | } |
37 | 37 | |
38 | -require_once( INJI_SYSTEM_DIR . '/init.php' ); |
|
38 | +require_once(INJI_SYSTEM_DIR . '/init.php'); |
|
39 | 39 | /** |
40 | 40 | * System error messages |
41 | 41 | */ |
@@ -24,7 +24,7 @@ |
||
24 | 24 | $html = "<{$tag}"; |
25 | 25 | if ($attributes && is_array($attributes)) { |
26 | 26 | foreach ($attributes as $key => $value) { |
27 | - $html .=" {$key} = '"; |
|
27 | + $html .= " {$key} = '"; |
|
28 | 28 | if (!is_array($value)) { |
29 | 29 | $html .= addcslashes($value, "'"); |
30 | 30 | } else { |
@@ -86,7 +86,7 @@ |
||
86 | 86 | echo "<tr><td>{$log['name']}</td><td" . (round(($log['end'] - $log['start']), 5) > 0.1 ? ' class ="danger"' : '') . ">" . round(($log['end'] - $log['start']), 5) . "</td></tr>"; |
87 | 87 | } |
88 | 88 | } |
89 | - echo '<tr><th>Summary</th><th>' . round(( microtime(true) - $this->startTime), 5) . '</th></tr>'; |
|
89 | + echo '<tr><th>Summary</th><th>' . round((microtime(true) - $this->startTime), 5) . '</th></tr>'; |
|
90 | 90 | echo '<tr><th>Memory</th><th>' . $this->convertSize(memory_get_peak_usage()) . ' of ' . ini_get('memory_limit') . '</th></tr></table></div>'; |
91 | 91 | } |
92 | 92 |
@@ -79,10 +79,12 @@ discard block |
||
79 | 79 | if (!empty($log['status'])) { |
80 | 80 | echo "<tr class = '{$log['status']}'><td>{$log['name']}</td><td>{$log['status']}</td></tr>"; |
81 | 81 | } else { |
82 | - if (empty($log['end'])) |
|
83 | - $log['end'] = microtime(true); |
|
84 | - if (empty($log['start'])) |
|
85 | - $log['start'] = microtime(true); |
|
82 | + if (empty($log['end'])) { |
|
83 | + $log['end'] = microtime(true); |
|
84 | + } |
|
85 | + if (empty($log['start'])) { |
|
86 | + $log['start'] = microtime(true); |
|
87 | + } |
|
86 | 88 | echo "<tr><td>{$log['name']}</td><td" . (round(($log['end'] - $log['start']), 5) > 0.1 ? ' class ="danger"' : '') . ">" . round(($log['end'] - $log['start']), 5) . "</td></tr>"; |
87 | 89 | } |
88 | 90 | } |
@@ -93,12 +95,13 @@ discard block |
||
93 | 95 | function convertSize($size) |
94 | 96 | { |
95 | 97 | |
96 | - if ($size < 1024) |
|
97 | - return $size . "B"; |
|
98 | - elseif ($size < 1048576) |
|
99 | - return round($size / 1024, 2) . "KB"; |
|
100 | - else |
|
101 | - return round($size / 1048576, 2) . "MB"; |
|
98 | + if ($size < 1024) { |
|
99 | + return $size . "B"; |
|
100 | + } elseif ($size < 1048576) { |
|
101 | + return round($size / 1024, 2) . "KB"; |
|
102 | + } else { |
|
103 | + return round($size / 1048576, 2) . "MB"; |
|
104 | + } |
|
102 | 105 | } |
103 | 106 | |
104 | 107 | function __destruct() |
@@ -1035,7 +1035,7 @@ |
||
1035 | 1035 | } else { |
1036 | 1036 | $cols .= '*'; |
1037 | 1037 | } |
1038 | - $cols .=') as `count`' . (!empty($options['cols']) ? ',' . $options['cols'] : ''); |
|
1038 | + $cols .= ') as `count`' . (!empty($options['cols']) ? ',' . $options['cols'] : ''); |
|
1039 | 1039 | App::$cur->db->cols = $cols; |
1040 | 1040 | if (!empty($options['group'])) { |
1041 | 1041 | App::$cur->db->group($options['group']); |
@@ -680,17 +680,21 @@ discard block |
||
680 | 680 | { |
681 | 681 | |
682 | 682 | $return = array(); |
683 | - if (!empty($options['where'])) |
|
684 | - App::$cur->db->where($options['where']); |
|
683 | + if (!empty($options['where'])) { |
|
684 | + App::$cur->db->where($options['where']); |
|
685 | + } |
|
685 | 686 | if (!empty($options['group'])) { |
686 | 687 | App::$cur->db->group($options['group']); |
687 | 688 | } |
688 | - if (!empty($options['order'])) |
|
689 | - App::$cur->db->order($options['order']); |
|
690 | - if (!empty($options['join'])) |
|
691 | - App::$cur->db->join($options['join']); |
|
692 | - if (!empty($options['distinct'])) |
|
693 | - App::$cur->db->distinct = $options['distinct']; |
|
689 | + if (!empty($options['order'])) { |
|
690 | + App::$cur->db->order($options['order']); |
|
691 | + } |
|
692 | + if (!empty($options['join'])) { |
|
693 | + App::$cur->db->join($options['join']); |
|
694 | + } |
|
695 | + if (!empty($options['distinct'])) { |
|
696 | + App::$cur->db->distinct = $options['distinct']; |
|
697 | + } |
|
694 | 698 | |
695 | 699 | foreach (static::$relJoins as $join) { |
696 | 700 | App::$cur->db->join($join[0], $join[1]); |
@@ -716,14 +720,14 @@ discard block |
||
716 | 720 | } |
717 | 721 | static::$needJoin = []; |
718 | 722 | |
719 | - if (!empty($options['limit'])) |
|
720 | - $limit = (int) $options['limit']; |
|
721 | - else { |
|
723 | + if (!empty($options['limit'])) { |
|
724 | + $limit = (int) $options['limit']; |
|
725 | + } else { |
|
722 | 726 | $limit = 0; |
723 | 727 | } |
724 | - if (!empty($options['start'])) |
|
725 | - $start = (int) $options['start']; |
|
726 | - else { |
|
728 | + if (!empty($options['start'])) { |
|
729 | + $start = (int) $options['start']; |
|
730 | + } else { |
|
727 | 731 | $start = 0; |
728 | 732 | } |
729 | 733 | if ($limit || $start) { |
@@ -980,21 +984,23 @@ discard block |
||
980 | 984 | static::fixPrefix($options['where'], 'first'); |
981 | 985 | } |
982 | 986 | $return = array(); |
983 | - if (!empty($options['where'])) |
|
984 | - App::$cur->db->where($options['where']); |
|
985 | - if (!empty($options['join'])) |
|
986 | - App::$cur->db->join($options['join']); |
|
987 | + if (!empty($options['where'])) { |
|
988 | + App::$cur->db->where($options['where']); |
|
989 | + } |
|
990 | + if (!empty($options['join'])) { |
|
991 | + App::$cur->db->join($options['join']); |
|
992 | + } |
|
987 | 993 | if (!empty($options['order'])) { |
988 | 994 | App::$cur->db->order($options['order']); |
989 | 995 | } |
990 | - if (!empty($options['limit'])) |
|
991 | - $limit = (int) $options['limit']; |
|
992 | - else { |
|
996 | + if (!empty($options['limit'])) { |
|
997 | + $limit = (int) $options['limit']; |
|
998 | + } else { |
|
993 | 999 | $limit = 0; |
994 | 1000 | } |
995 | - if (!empty($options['start'])) |
|
996 | - $start = (int) $options['start']; |
|
997 | - else { |
|
1001 | + if (!empty($options['start'])) { |
|
1002 | + $start = (int) $options['start']; |
|
1003 | + } else { |
|
998 | 1004 | $start = 0; |
999 | 1005 | } |
1000 | 1006 | if ($limit || $start) { |
@@ -1072,11 +1078,13 @@ discard block |
||
1072 | 1078 | |
1073 | 1079 | $values = array(); |
1074 | 1080 | foreach ($cols as $col => $param) { |
1075 | - if (isset($params[$col])) |
|
1076 | - $values[$col] = $params[$col]; |
|
1081 | + if (isset($params[$col])) { |
|
1082 | + $values[$col] = $params[$col]; |
|
1083 | + } |
|
1084 | + } |
|
1085 | + if (!$values) { |
|
1086 | + return false; |
|
1077 | 1087 | } |
1078 | - if (!$values) |
|
1079 | - return false; |
|
1080 | 1088 | |
1081 | 1089 | |
1082 | 1090 | if ($where) { |
@@ -1257,11 +1265,13 @@ discard block |
||
1257 | 1265 | $values = array(); |
1258 | 1266 | |
1259 | 1267 | foreach ($this->cols() as $col => $param) { |
1260 | - if (isset($this->_params[$col])) |
|
1261 | - $values[$col] = $this->_params[$col]; |
|
1268 | + if (isset($this->_params[$col])) { |
|
1269 | + $values[$col] = $this->_params[$col]; |
|
1270 | + } |
|
1271 | + } |
|
1272 | + if (!$values && empty($options['empty'])) { |
|
1273 | + return false; |
|
1262 | 1274 | } |
1263 | - if (!$values && empty($options['empty'])) |
|
1264 | - return false; |
|
1265 | 1275 | |
1266 | 1276 | if ($this->pk()) { |
1267 | 1277 | $new = false; |
@@ -1417,8 +1427,9 @@ discard block |
||
1417 | 1427 | { |
1418 | 1428 | |
1419 | 1429 | foreach (static::relations() as $relName => $rel) { |
1420 | - if ($rel['col'] == $col) |
|
1421 | - return $relName; |
|
1430 | + if ($rel['col'] == $col) { |
|
1431 | + return $relName; |
|
1432 | + } |
|
1422 | 1433 | } |
1423 | 1434 | return NULL; |
1424 | 1435 | } |
@@ -1574,8 +1585,9 @@ discard block |
||
1574 | 1585 | App::$cur->db->where($relation['relTablePrefix'] . $this->index(), $this->pk()); |
1575 | 1586 | App::$cur->db->where($relation['relTablePrefix'] . $relation['model']::index(), $objectId); |
1576 | 1587 | $isset = App::$cur->db->select($relation['relTable'])->fetch_assoc(); |
1577 | - if ($isset) |
|
1578 | - return true; |
|
1588 | + if ($isset) { |
|
1589 | + return true; |
|
1590 | + } |
|
1579 | 1591 | |
1580 | 1592 | App::$cur->db->insert($relation['relTable'], [ |
1581 | 1593 | $relation['relTablePrefix'] . $this->index() => $this->{$this->index()}, |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | /** |
358 | 358 | * Information extractor for col relations path |
359 | 359 | * |
360 | - * @param string|array $info |
|
360 | + * @param string $info |
|
361 | 361 | * @return array |
362 | 362 | */ |
363 | 363 | public static function parseColRecursion($info) |
@@ -429,6 +429,9 @@ discard block |
||
429 | 429 | return Model::$cols[static::table()]; |
430 | 430 | } |
431 | 431 | |
432 | + /** |
|
433 | + * @param string $colName |
|
434 | + */ |
|
432 | 435 | public static function genColParams($colName) |
433 | 436 | { |
434 | 437 | if (empty(static::$cols[$colName]) || static::$storage['type'] == 'moduleConfig') { |
@@ -482,7 +485,7 @@ discard block |
||
482 | 485 | * Create new col in data base |
483 | 486 | * |
484 | 487 | * @param string $colName |
485 | - * @return boolean |
|
488 | + * @return false|null |
|
486 | 489 | */ |
487 | 490 | public static function createCol($colName) |
488 | 491 | { |
@@ -567,7 +570,7 @@ discard block |
||
567 | 570 | /** |
568 | 571 | * return relations list |
569 | 572 | * |
570 | - * @return array |
|
573 | + * @return string |
|
571 | 574 | */ |
572 | 575 | public static function relations() |
573 | 576 | { |
@@ -1063,7 +1066,7 @@ discard block |
||
1063 | 1066 | * |
1064 | 1067 | * @param array $params |
1065 | 1068 | * @param array $where |
1066 | - * @return boolean |
|
1069 | + * @return false|null |
|
1067 | 1070 | */ |
1068 | 1071 | public static function update($params, $where = []) |
1069 | 1072 | { |
@@ -22,7 +22,7 @@ |
||
22 | 22 | if (!empty($_SESSION['_INJI_MSG'])) { |
23 | 23 | foreach ($_SESSION['_INJI_MSG'] as $key => $msg) { |
24 | 24 | if ($msg['text'] == $text) { |
25 | - $msg['count'] ++; |
|
25 | + $msg['count']++; |
|
26 | 26 | return true; |
27 | 27 | } |
28 | 28 | } |
@@ -52,8 +52,9 @@ |
||
52 | 52 | */ |
53 | 53 | static function get($clean = false) |
54 | 54 | { |
55 | - if (empty($_SESSION['_INJI_MSG'])) |
|
56 | - return []; |
|
55 | + if (empty($_SESSION['_INJI_MSG'])) { |
|
56 | + return []; |
|
57 | + } |
|
57 | 58 | $msgs = $_SESSION['_INJI_MSG']; |
58 | 59 | if ($clean) { |
59 | 60 | $_SESSION['_INJI_MSG'] = []; |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <div class = 'callbacks'> |
2 | 2 | <h1>Отзывы</h1> |
3 | 3 | <?php |
4 | - $callbacks = Callbacks\Callback::getList(['where' => ['view', '1'], 'order' => ['weight', 'asc']]); |
|
5 | - foreach ($callbacks as $callback) { |
|
6 | - echo "<h3>{$callback->name}<div class = 'time'>{$callback->date_create}</div></h3>"; |
|
7 | - echo "<p>" . nl2br($callback->text) . "</p>"; |
|
8 | - } |
|
9 | - ?> |
|
4 | + $callbacks = Callbacks\Callback::getList(['where' => ['view', '1'], 'order' => ['weight', 'asc']]); |
|
5 | + foreach ($callbacks as $callback) { |
|
6 | + echo "<h3>{$callback->name}<div class = 'time'>{$callback->date_create}</div></h3>"; |
|
7 | + echo "<p>" . nl2br($callback->text) . "</p>"; |
|
8 | + } |
|
9 | + ?> |
|
10 | 10 | </div> |
11 | 11 | <h3>Можете и вы в свободной форме оставить свой отзыв</h3> |
12 | 12 | <?php |
@@ -9,7 +9,7 @@ |
||
9 | 9 | } |
10 | 10 | |
11 | 11 | $widgetSize = !empty($section['size']) ? $section['size'] : 1; |
12 | - $rowSum+=$widgetSize; |
|
12 | + $rowSum += $widgetSize; |
|
13 | 13 | ?> |
14 | 14 | <div class="col-sm-<?= $widgetSize * 4; ?>" style="margin-bottom: 10px;"><?= $section['widget'](); ?></div> |
15 | 15 | <?php |
@@ -17,9 +17,9 @@ |
||
17 | 17 | <input class ="form-control" type = 'text' name = 'site_description' value = '<?php if (!empty(\App::$primary->config['site']['description'])) echo \App::$primary->config['site']['description']; ?>' /> |
18 | 18 | </div> |
19 | 19 | <?php |
20 | - $form = new Ui\Form(); |
|
21 | - $form->input('image', 'site_logo', 'Лого сайта', ['value' => !empty(\App::$primary->config['site']['site_logo']) ? \App::$primary->config['site']['site_logo'] : '']); |
|
22 | - ?> |
|
20 | + $form = new Ui\Form(); |
|
21 | + $form->input('image', 'site_logo', 'Лого сайта', ['value' => !empty(\App::$primary->config['site']['site_logo']) ? \App::$primary->config['site']['site_logo'] : '']); |
|
22 | + ?> |
|
23 | 23 | <h2>Дополнительные мета теги</h2> |
24 | 24 | <div class ="form-group"> |
25 | 25 | <button type = 'button' class = 'btn btn-primary ' onclick = 'addMeta()'>Добавить <i class = 'glyphicon glyphicon-plus'></i></button> |
@@ -2,19 +2,31 @@ |
||
2 | 2 | <form action = '' method = 'POST' enctype="multipart/form-data"> |
3 | 3 | <div class ="form-group"> |
4 | 4 | <label>Название сайта</label> |
5 | - <input class ="form-control" type = 'text' name = 'site_name' value = '<?php if (!empty(\App::$primary->config['site']['name'])) echo \App::$primary->config['site']['name']; ?>' /> |
|
5 | + <input class ="form-control" type = 'text' name = 'site_name' value = '<?php if (!empty(\App::$primary->config['site']['name'])) { |
|
6 | + echo \App::$primary->config['site']['name']; |
|
7 | +} |
|
8 | +?>' /> |
|
6 | 9 | </div> |
7 | 10 | <div class ="form-group"> |
8 | 11 | <label>Контактный email</label> |
9 | - <input class ="form-control" type = 'text' name = 'site_email' value = '<?php if (!empty(\App::$primary->config['site']['email'])) echo \App::$primary->config['site']['email']; ?>' /> |
|
12 | + <input class ="form-control" type = 'text' name = 'site_email' value = '<?php if (!empty(\App::$primary->config['site']['email'])) { |
|
13 | + echo \App::$primary->config['site']['email']; |
|
14 | +} |
|
15 | +?>' /> |
|
10 | 16 | </div> |
11 | 17 | <div class ="form-group"> |
12 | 18 | <label>Ключевые слова</label> |
13 | - <input class ="form-control" type = 'text' name = 'site_keywords' value = '<?php if (!empty(\App::$primary->config['site']['keywords'])) echo \App::$primary->config['site']['keywords']; ?>' /> |
|
19 | + <input class ="form-control" type = 'text' name = 'site_keywords' value = '<?php if (!empty(\App::$primary->config['site']['keywords'])) { |
|
20 | + echo \App::$primary->config['site']['keywords']; |
|
21 | +} |
|
22 | +?>' /> |
|
14 | 23 | </div> |
15 | 24 | <div class ="form-group"> |
16 | 25 | <label>Краткое описание сайта</label> |
17 | - <input class ="form-control" type = 'text' name = 'site_description' value = '<?php if (!empty(\App::$primary->config['site']['description'])) echo \App::$primary->config['site']['description']; ?>' /> |
|
26 | + <input class ="form-control" type = 'text' name = 'site_description' value = '<?php if (!empty(\App::$primary->config['site']['description'])) { |
|
27 | + echo \App::$primary->config['site']['description']; |
|
28 | +} |
|
29 | +?>' /> |
|
18 | 30 | </div> |
19 | 31 | <?php |
20 | 32 | $form = new Ui\Form(); |
@@ -55,7 +55,7 @@ |
||
55 | 55 | |
56 | 56 | function newQuery() |
57 | 57 | { |
58 | - if($this->QueryClassName) { |
|
58 | + if ($this->QueryClassName) { |
|
59 | 59 | return new $this->QueryClassName($this->connection); |
60 | 60 | } |
61 | 61 | return false; |
@@ -16,8 +16,9 @@ |
||
16 | 16 | $param = isset($this->config['default']) ? $this->config['default'] : 'local'; |
17 | 17 | } |
18 | 18 | if (!is_array($param)) { |
19 | - if (!($dbOption = Db\Options::get($param, 'connect_alias', ['array' => true]))) |
|
20 | - return false; |
|
19 | + if (!($dbOption = Db\Options::get($param, 'connect_alias', ['array' => true]))) { |
|
20 | + return false; |
|
21 | + } |
|
21 | 22 | |
22 | 23 | $db = $dbOption; |
23 | 24 | } else { |