@@ -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']); |
@@ -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) |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | * Generate params string for col by name |
434 | 434 | * |
435 | 435 | * @param string $colName |
436 | - * @return boolean|string |
|
436 | + * @return false|string |
|
437 | 437 | */ |
438 | 438 | public static function genColParams($colName) |
439 | 439 | { |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | /** |
574 | 574 | * return relations list |
575 | 575 | * |
576 | - * @return array |
|
576 | + * @return string |
|
577 | 577 | */ |
578 | 578 | public static function relations() |
579 | 579 | { |
@@ -1065,7 +1065,7 @@ discard block |
||
1065 | 1065 | * |
1066 | 1066 | * @param array $params |
1067 | 1067 | * @param array $where |
1068 | - * @return boolean |
|
1068 | + * @return false|null |
|
1069 | 1069 | */ |
1070 | 1070 | public static function update($params, $where = []) |
1071 | 1071 | { |
@@ -718,17 +718,21 @@ discard block |
||
718 | 718 | if (!$query) { |
719 | 719 | return []; |
720 | 720 | } |
721 | - if (!empty($options['where'])) |
|
722 | - $query->where($options['where']); |
|
721 | + if (!empty($options['where'])) { |
|
722 | + $query->where($options['where']); |
|
723 | + } |
|
723 | 724 | if (!empty($options['group'])) { |
724 | 725 | $query->group($options['group']); |
725 | 726 | } |
726 | - if (!empty($options['order'])) |
|
727 | - $query->order($options['order']); |
|
728 | - if (!empty($options['join'])) |
|
729 | - $query->join($options['join']); |
|
730 | - if (!empty($options['distinct'])) |
|
731 | - $query->distinct = $options['distinct']; |
|
727 | + if (!empty($options['order'])) { |
|
728 | + $query->order($options['order']); |
|
729 | + } |
|
730 | + if (!empty($options['join'])) { |
|
731 | + $query->join($options['join']); |
|
732 | + } |
|
733 | + if (!empty($options['distinct'])) { |
|
734 | + $query->distinct = $options['distinct']; |
|
735 | + } |
|
732 | 736 | |
733 | 737 | foreach (static::$relJoins as $join) { |
734 | 738 | $query->join($join[0], $join[1]); |
@@ -754,14 +758,14 @@ discard block |
||
754 | 758 | } |
755 | 759 | static::$needJoin = []; |
756 | 760 | |
757 | - if (!empty($options['limit'])) |
|
758 | - $limit = (int) $options['limit']; |
|
759 | - else { |
|
761 | + if (!empty($options['limit'])) { |
|
762 | + $limit = (int) $options['limit']; |
|
763 | + } else { |
|
760 | 764 | $limit = 0; |
761 | 765 | } |
762 | - if (!empty($options['start'])) |
|
763 | - $start = (int) $options['start']; |
|
764 | - else { |
|
766 | + if (!empty($options['start'])) { |
|
767 | + $start = (int) $options['start']; |
|
768 | + } else { |
|
765 | 769 | $start = 0; |
766 | 770 | } |
767 | 771 | if ($limit || $start) { |
@@ -1020,21 +1024,23 @@ discard block |
||
1020 | 1024 | if (!empty($options['where'])) { |
1021 | 1025 | static::fixPrefix($options['where'], 'first'); |
1022 | 1026 | } |
1023 | - if (!empty($options['where'])) |
|
1024 | - $query->where($options['where']); |
|
1025 | - if (!empty($options['join'])) |
|
1026 | - $query->join($options['join']); |
|
1027 | + if (!empty($options['where'])) { |
|
1028 | + $query->where($options['where']); |
|
1029 | + } |
|
1030 | + if (!empty($options['join'])) { |
|
1031 | + $query->join($options['join']); |
|
1032 | + } |
|
1027 | 1033 | if (!empty($options['order'])) { |
1028 | 1034 | $query->order($options['order']); |
1029 | 1035 | } |
1030 | - if (!empty($options['limit'])) |
|
1031 | - $limit = (int) $options['limit']; |
|
1032 | - else { |
|
1036 | + if (!empty($options['limit'])) { |
|
1037 | + $limit = (int) $options['limit']; |
|
1038 | + } else { |
|
1033 | 1039 | $limit = 0; |
1034 | 1040 | } |
1035 | - if (!empty($options['start'])) |
|
1036 | - $start = (int) $options['start']; |
|
1037 | - else { |
|
1041 | + if (!empty($options['start'])) { |
|
1042 | + $start = (int) $options['start']; |
|
1043 | + } else { |
|
1038 | 1044 | $start = 0; |
1039 | 1045 | } |
1040 | 1046 | if ($limit || $start) { |
@@ -1112,8 +1118,9 @@ discard block |
||
1112 | 1118 | |
1113 | 1119 | $values = []; |
1114 | 1120 | foreach ($cols as $col => $param) { |
1115 | - if (isset($params[$col])) |
|
1116 | - $values[$col] = $params[$col]; |
|
1121 | + if (isset($params[$col])) { |
|
1122 | + $values[$col] = $params[$col]; |
|
1123 | + } |
|
1117 | 1124 | } |
1118 | 1125 | if (empty($values)) { |
1119 | 1126 | return false; |
@@ -1296,8 +1303,9 @@ discard block |
||
1296 | 1303 | $values = []; |
1297 | 1304 | |
1298 | 1305 | foreach ($this->cols() as $col => $param) { |
1299 | - if (isset($this->_params[$col])) |
|
1300 | - $values[$col] = $this->_params[$col]; |
|
1306 | + if (isset($this->_params[$col])) { |
|
1307 | + $values[$col] = $this->_params[$col]; |
|
1308 | + } |
|
1301 | 1309 | } |
1302 | 1310 | if (empty($values) && empty($options['empty'])) { |
1303 | 1311 | return false; |
@@ -1457,8 +1465,9 @@ discard block |
||
1457 | 1465 | { |
1458 | 1466 | |
1459 | 1467 | foreach (static::relations() as $relName => $rel) { |
1460 | - if ($rel['col'] == $col) |
|
1461 | - return $relName; |
|
1468 | + if ($rel['col'] == $col) { |
|
1469 | + return $relName; |
|
1470 | + } |
|
1462 | 1471 | } |
1463 | 1472 | return NULL; |
1464 | 1473 | } |
@@ -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'] = []; |
@@ -15,8 +15,9 @@ discard block |
||
15 | 15 | if (!$app) { |
16 | 16 | $app = $this->app->type; |
17 | 17 | } |
18 | - if (!empty($this->config['access']['accessTree'][$app]['deniedUrl'])) |
|
19 | - return $this->config['access']['accessTree'][$app]['deniedUrl']; |
|
18 | + if (!empty($this->config['access']['accessTree'][$app]['deniedUrl'])) { |
|
19 | + return $this->config['access']['accessTree'][$app]['deniedUrl']; |
|
20 | + } |
|
20 | 21 | |
21 | 22 | return '/'; |
22 | 23 | } |
@@ -50,8 +51,9 @@ discard block |
||
50 | 51 | return true; |
51 | 52 | } |
52 | 53 | |
53 | - if ((!$user->group_id && !empty($access)) || ($user->group_id && !empty($access) && !in_array($user->group_id, $access))) |
|
54 | - return false; |
|
54 | + if ((!$user->group_id && !empty($access)) || ($user->group_id && !empty($access) && !in_array($user->group_id, $access))) { |
|
55 | + return false; |
|
56 | + } |
|
55 | 57 | |
56 | 58 | return true; |
57 | 59 | } |
@@ -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,23 +2,38 @@ |
||
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>Название компании</label> |
9 | - <input class ="form-control" type = 'text' name = 'company_name' value = '<?php if (!empty(\App::$primary->config['site']['company_name'])) echo \App::$primary->config['site']['company_name']; ?>' /> |
|
12 | + <input class ="form-control" type = 'text' name = 'company_name' value = '<?php if (!empty(\App::$primary->config['site']['company_name'])) { |
|
13 | + echo \App::$primary->config['site']['company_name']; |
|
14 | +} |
|
15 | +?>' /> |
|
10 | 16 | </div> |
11 | 17 | <div class ="form-group"> |
12 | 18 | <label>Контактный email</label> |
13 | - <input class ="form-control" type = 'text' name = 'site_email' value = '<?php if (!empty(\App::$primary->config['site']['email'])) echo \App::$primary->config['site']['email']; ?>' /> |
|
19 | + <input class ="form-control" type = 'text' name = 'site_email' value = '<?php if (!empty(\App::$primary->config['site']['email'])) { |
|
20 | + echo \App::$primary->config['site']['email']; |
|
21 | +} |
|
22 | +?>' /> |
|
14 | 23 | </div> |
15 | 24 | <div class ="form-group"> |
16 | 25 | <label>Ключевые слова</label> |
17 | - <input class ="form-control" type = 'text' name = 'site_keywords' value = '<?php if (!empty(\App::$primary->config['site']['keywords'])) echo \App::$primary->config['site']['keywords']; ?>' /> |
|
26 | + <input class ="form-control" type = 'text' name = 'site_keywords' value = '<?php if (!empty(\App::$primary->config['site']['keywords'])) { |
|
27 | + echo \App::$primary->config['site']['keywords']; |
|
28 | +} |
|
29 | +?>' /> |
|
18 | 30 | </div> |
19 | 31 | <div class ="form-group"> |
20 | 32 | <label>Краткое описание сайта</label> |
21 | - <input class ="form-control" type = 'text' name = 'site_description' value = '<?php if (!empty(\App::$primary->config['site']['description'])) echo \App::$primary->config['site']['description']; ?>' /> |
|
33 | + <input class ="form-control" type = 'text' name = 'site_description' value = '<?php if (!empty(\App::$primary->config['site']['description'])) { |
|
34 | + echo \App::$primary->config['site']['description']; |
|
35 | +} |
|
36 | +?>' /> |
|
22 | 37 | </div> |
23 | 38 | <?php |
24 | 39 | $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 { |
@@ -30,14 +30,18 @@ |
||
30 | 30 | public function init($connect_options) |
31 | 31 | { |
32 | 32 | extract($connect_options); |
33 | - if (isset($db_name)) |
|
34 | - $this->db_name = $db_name; |
|
35 | - if (isset($encoding)) |
|
36 | - $this->encoding = $encoding; |
|
37 | - if (isset($table_prefix)) |
|
38 | - $this->table_prefix = $table_prefix; |
|
39 | - if (isset($noConnectAbort)) |
|
40 | - $this->noConnectAbort = $noConnectAbort; |
|
33 | + if (isset($db_name)) { |
|
34 | + $this->db_name = $db_name; |
|
35 | + } |
|
36 | + if (isset($encoding)) { |
|
37 | + $this->encoding = $encoding; |
|
38 | + } |
|
39 | + if (isset($table_prefix)) { |
|
40 | + $this->table_prefix = $table_prefix; |
|
41 | + } |
|
42 | + if (isset($noConnectAbort)) { |
|
43 | + $this->noConnectAbort = $noConnectAbort; |
|
44 | + } |
|
41 | 45 | |
42 | 46 | $dsn = "mysql:host=$host;port=$port;dbname=$db_name;charset=$encoding"; |
43 | 47 | $dt = new \DateTime(); |
@@ -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 = ''; |
@@ -307,7 +307,7 @@ |
||
307 | 307 | if (is_array($counts)) { |
308 | 308 | $sum = 0; |
309 | 309 | foreach ($counts as $count) { |
310 | - $sum +=$count['count']; |
|
310 | + $sum += $count['count']; |
|
311 | 311 | } |
312 | 312 | return $sum; |
313 | 313 | } |