@@ -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']); |
@@ -437,6 +437,9 @@ discard block |
||
| 437 | 437 | } |
| 438 | 438 | } |
| 439 | 439 | |
| 440 | + /** |
|
| 441 | + * @param boolean $new |
|
| 442 | + */ |
|
| 440 | 443 | public function logChanges($new) { |
| 441 | 444 | if (!App::$cur->db->connect || !App::$cur->dashboard) { |
| 442 | 445 | return false; |
@@ -539,7 +542,7 @@ discard block |
||
| 539 | 542 | /** |
| 540 | 543 | * Information extractor for col relations path |
| 541 | 544 | * |
| 542 | - * @param string|array $info |
|
| 545 | + * @param string $info |
|
| 543 | 546 | * @return array |
| 544 | 547 | */ |
| 545 | 548 | public static function parseColRecursion($info) { |
@@ -625,7 +628,7 @@ discard block |
||
| 625 | 628 | * Generate params string for col by name |
| 626 | 629 | * |
| 627 | 630 | * @param string $colName |
| 628 | - * @return boolean|string |
|
| 631 | + * @return false|string |
|
| 629 | 632 | */ |
| 630 | 633 | public static function genColParams($colName) { |
| 631 | 634 | if (empty(static::$cols[$colName]) || static::$storage['type'] == 'moduleConfig') { |
@@ -780,7 +783,7 @@ discard block |
||
| 780 | 783 | /** |
| 781 | 784 | * return relations list |
| 782 | 785 | * |
| 783 | - * @return array |
|
| 786 | + * @return string |
|
| 784 | 787 | */ |
| 785 | 788 | public static function relations() { |
| 786 | 789 | return []; |
@@ -1303,7 +1306,7 @@ discard block |
||
| 1303 | 1306 | * |
| 1304 | 1307 | * @param array $params |
| 1305 | 1308 | * @param array $where |
| 1306 | - * @return boolean |
|
| 1309 | + * @return false|null |
|
| 1307 | 1310 | */ |
| 1308 | 1311 | public static function update($params, $where = []) { |
| 1309 | 1312 | static::fixPrefix($params); |
@@ -898,22 +898,27 @@ discard block |
||
| 898 | 898 | if (!$query) { |
| 899 | 899 | return []; |
| 900 | 900 | } |
| 901 | - if (!empty($options['where'])) |
|
| 902 | - $query->where($options['where']); |
|
| 903 | - if (!empty($options['cols'])) |
|
| 904 | - $query->cols = $options['cols']; |
|
| 901 | + if (!empty($options['where'])) { |
|
| 902 | + $query->where($options['where']); |
|
| 903 | + } |
|
| 904 | + if (!empty($options['cols'])) { |
|
| 905 | + $query->cols = $options['cols']; |
|
| 906 | + } |
|
| 905 | 907 | if (!empty($options['group'])) { |
| 906 | 908 | $query->group($options['group']); |
| 907 | 909 | } |
| 908 | 910 | if (!empty($options['having'])) { |
| 909 | 911 | $query->having($options['having']); |
| 910 | 912 | } |
| 911 | - if (!empty($options['order'])) |
|
| 912 | - $query->order($options['order']); |
|
| 913 | - if (!empty($options['join'])) |
|
| 914 | - $query->join($options['join']); |
|
| 915 | - if (!empty($options['distinct'])) |
|
| 916 | - $query->distinct = $options['distinct']; |
|
| 913 | + if (!empty($options['order'])) { |
|
| 914 | + $query->order($options['order']); |
|
| 915 | + } |
|
| 916 | + if (!empty($options['join'])) { |
|
| 917 | + $query->join($options['join']); |
|
| 918 | + } |
|
| 919 | + if (!empty($options['distinct'])) { |
|
| 920 | + $query->distinct = $options['distinct']; |
|
| 921 | + } |
|
| 917 | 922 | |
| 918 | 923 | foreach (static::$relJoins as $join) { |
| 919 | 924 | $query->join($join[0], $join[1]); |
@@ -939,14 +944,14 @@ discard block |
||
| 939 | 944 | } |
| 940 | 945 | static::$needJoin = []; |
| 941 | 946 | |
| 942 | - if (!empty($options['limit'])) |
|
| 943 | - $limit = (int) $options['limit']; |
|
| 944 | - else { |
|
| 947 | + if (!empty($options['limit'])) { |
|
| 948 | + $limit = (int) $options['limit']; |
|
| 949 | + } else { |
|
| 945 | 950 | $limit = 0; |
| 946 | 951 | } |
| 947 | - if (!empty($options['start'])) |
|
| 948 | - $start = (int) $options['start']; |
|
| 949 | - else { |
|
| 952 | + if (!empty($options['start'])) { |
|
| 953 | + $start = (int) $options['start']; |
|
| 954 | + } else { |
|
| 950 | 955 | $start = 0; |
| 951 | 956 | } |
| 952 | 957 | if ($limit || $start) { |
@@ -1221,21 +1226,23 @@ discard block |
||
| 1221 | 1226 | if (!empty($options['group'])) { |
| 1222 | 1227 | static::fixPrefix($options['group'], 'first'); |
| 1223 | 1228 | } |
| 1224 | - if (!empty($options['where'])) |
|
| 1225 | - $query->where($options['where']); |
|
| 1226 | - if (!empty($options['join'])) |
|
| 1227 | - $query->join($options['join']); |
|
| 1229 | + if (!empty($options['where'])) { |
|
| 1230 | + $query->where($options['where']); |
|
| 1231 | + } |
|
| 1232 | + if (!empty($options['join'])) { |
|
| 1233 | + $query->join($options['join']); |
|
| 1234 | + } |
|
| 1228 | 1235 | if (!empty($options['order'])) { |
| 1229 | 1236 | $query->order($options['order']); |
| 1230 | 1237 | } |
| 1231 | - if (!empty($options['limit'])) |
|
| 1232 | - $limit = (int) $options['limit']; |
|
| 1233 | - else { |
|
| 1238 | + if (!empty($options['limit'])) { |
|
| 1239 | + $limit = (int) $options['limit']; |
|
| 1240 | + } else { |
|
| 1234 | 1241 | $limit = 0; |
| 1235 | 1242 | } |
| 1236 | - if (!empty($options['start'])) |
|
| 1237 | - $start = (int) $options['start']; |
|
| 1238 | - else { |
|
| 1243 | + if (!empty($options['start'])) { |
|
| 1244 | + $start = (int) $options['start']; |
|
| 1245 | + } else { |
|
| 1239 | 1246 | $start = 0; |
| 1240 | 1247 | } |
| 1241 | 1248 | if ($limit || $start) { |
@@ -1312,8 +1319,9 @@ discard block |
||
| 1312 | 1319 | |
| 1313 | 1320 | $values = []; |
| 1314 | 1321 | foreach ($cols as $col => $param) { |
| 1315 | - if (isset($params[$col])) |
|
| 1316 | - $values[$col] = $params[$col]; |
|
| 1322 | + if (isset($params[$col])) { |
|
| 1323 | + $values[$col] = $params[$col]; |
|
| 1324 | + } |
|
| 1317 | 1325 | } |
| 1318 | 1326 | if (empty($values)) { |
| 1319 | 1327 | return false; |
@@ -1650,8 +1658,9 @@ discard block |
||
| 1650 | 1658 | public static function findRelation($col) { |
| 1651 | 1659 | |
| 1652 | 1660 | foreach (static::relations() as $relName => $rel) { |
| 1653 | - if ($rel['col'] == $col) |
|
| 1654 | - return $relName; |
|
| 1661 | + if ($rel['col'] == $col) { |
|
| 1662 | + return $relName; |
|
| 1663 | + } |
|
| 1655 | 1664 | } |
| 1656 | 1665 | return NULL; |
| 1657 | 1666 | } |
@@ -1653,7 +1653,7 @@ discard block |
||
| 1653 | 1653 | if ($rel['col'] == $col) |
| 1654 | 1654 | return $relName; |
| 1655 | 1655 | } |
| 1656 | - return NULL; |
|
| 1656 | + return null; |
|
| 1657 | 1657 | } |
| 1658 | 1658 | |
| 1659 | 1659 | /** |
@@ -1765,7 +1765,7 @@ discard block |
||
| 1765 | 1765 | $options = [$relation['col'], $this->pk()]; |
| 1766 | 1766 | break; |
| 1767 | 1767 | default: |
| 1768 | - if ($this->$relation['col'] === NULL) { |
|
| 1768 | + if ($this->$relation['col'] === null) { |
|
| 1769 | 1769 | return null; |
| 1770 | 1770 | } |
| 1771 | 1771 | $getType = 'get'; |
@@ -1786,7 +1786,7 @@ discard block |
||
| 1786 | 1786 | } |
| 1787 | 1787 | return $this->loadedRelations[$name][json_encode($params)]; |
| 1788 | 1788 | } |
| 1789 | - return NULL; |
|
| 1789 | + return null; |
|
| 1790 | 1790 | } |
| 1791 | 1791 | |
| 1792 | 1792 | /** |
@@ -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 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | public function checkAccess($element, $user = null) { |
| 30 | - $access = NULL; |
|
| 30 | + $access = null; |
|
| 31 | 31 | foreach ($this->accessCheckers as $getter) { |
| 32 | 32 | foreach ($getter['classes'] as $className) { |
| 33 | 33 | if ($element instanceof $className) { |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | } elseif (!$path) { |
| 70 | 70 | return $array; |
| 71 | 71 | } else { |
| 72 | - return NULL; |
|
| 72 | + return null; |
|
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | |
@@ -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 = ''; |
@@ -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; |
@@ -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 | } |
@@ -268,7 +268,7 @@ |
||
| 268 | 268 | $result->send(); |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | - $item->sales ++; |
|
| 271 | + $item->sales++; |
|
| 272 | 272 | $item->save(); |
| 273 | 273 | |
| 274 | 274 | if (empty($_GET['count'])) |
@@ -270,10 +270,11 @@ |
||
| 270 | 270 | $item->sales ++; |
| 271 | 271 | $item->save(); |
| 272 | 272 | |
| 273 | - if (empty($_GET['count'])) |
|
| 274 | - $count = 1; |
|
| 275 | - else |
|
| 276 | - $count = (float) $_GET['count']; |
|
| 273 | + if (empty($_GET['count'])) { |
|
| 274 | + $count = 1; |
|
| 275 | + } else { |
|
| 276 | + $count = (float) $_GET['count']; |
|
| 277 | + } |
|
| 277 | 278 | |
| 278 | 279 | $cart = $this->ecommerce->getCurCart(); |
| 279 | 280 | |
@@ -72,12 +72,12 @@ |
||
| 72 | 72 | { |
| 73 | 73 | $warehouse = Offer\Warehouse::get([['count', '0', '>'], ['item_offer_id', $this->id]]); |
| 74 | 74 | if ($warehouse) { |
| 75 | - $warehouse->count +=(float) $count; |
|
| 75 | + $warehouse->count += (float) $count; |
|
| 76 | 76 | $warehouse->save(); |
| 77 | 77 | } else { |
| 78 | 78 | $warehouse = Offer\Warehouse::get([['item_offer_id', $this->id]]); |
| 79 | 79 | if ($warehouse) { |
| 80 | - $warehouse->count +=(float) $count; |
|
| 80 | + $warehouse->count += (float) $count; |
|
| 81 | 81 | $warehouse->save(); |
| 82 | 82 | } |
| 83 | 83 | } |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | static $forms = [ |
| 40 | 40 | 'manager' => [ |
| 41 | 41 | 'map' => [ |
| 42 | - ['price', 'currency_id',], |
|
| 42 | + ['price', 'currency_id', ], |
|
| 43 | 43 | ['item_offer_price_type_id', 'item_offer_id'] |
| 44 | 44 | ] |
| 45 | 45 | ]]; |