@@ -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 | } |
@@ -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 | } |
@@ -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"; |
@@ -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 | |
@@ -167,8 +167,9 @@ |
||
| 167 | 167 | $reward = \Money\Reward::get($reward_id); |
| 168 | 168 | $reward->checkBlocked(); |
| 169 | 169 | $reward_count = \Money\Reward\Recive::getCount([ 'where' => [ 'reward_id', $reward_id ]]); |
| 170 | - if ($reward_count >= $reward->quantity && $reward->quantity) |
|
| 171 | - return false; |
|
| 170 | + if ($reward_count >= $reward->quantity && $reward->quantity) { |
|
| 171 | + return false; |
|
| 172 | + } |
|
| 172 | 173 | $types = $this->getSnippets('rewardType'); |
| 173 | 174 | foreach ($reward->levels(['order' => ['level', 'asc']]) as $level) { |
| 174 | 175 | $user = $rootUser; |
@@ -196,17 +196,20 @@ |
||
| 196 | 196 | */ |
| 197 | 197 | public function get($idn, $ltype = 'id') |
| 198 | 198 | {
|
| 199 | - if (!$idn) |
|
| 200 | - return false; |
|
| 199 | + if (!$idn) { |
|
| 200 | + return false; |
|
| 201 | + } |
|
| 201 | 202 | |
| 202 | - if (is_numeric($idn) && $ltype != 'login') |
|
| 203 | - $user = Users\User::get($idn, 'id'); |
|
| 204 | - elseif ($ltype == 'login') |
|
| 205 | - $user = Users\User::get($idn, 'login'); |
|
| 206 | - else |
|
| 207 | - $user = Users\User::get($idn, 'mail'); |
|
| 208 | - if (!$user) |
|
| 209 | - return []; |
|
| 203 | + if (is_numeric($idn) && $ltype != 'login') { |
|
| 204 | + $user = Users\User::get($idn, 'id'); |
|
| 205 | + } elseif ($ltype == 'login') { |
|
| 206 | + $user = Users\User::get($idn, 'login'); |
|
| 207 | + } else { |
|
| 208 | + $user = Users\User::get($idn, 'mail'); |
|
| 209 | + } |
|
| 210 | + if (!$user) { |
|
| 211 | + return []; |
|
| 212 | + } |
|
| 210 | 213 | |
| 211 | 214 | return $user; |
| 212 | 215 | } |
@@ -717,17 +717,21 @@ discard block |
||
| 717 | 717 | if (!$query) { |
| 718 | 718 | return false; |
| 719 | 719 | } |
| 720 | - if (!empty($options['where'])) |
|
| 721 | - $query->where($options['where']); |
|
| 720 | + if (!empty($options['where'])) { |
|
| 721 | + $query->where($options['where']); |
|
| 722 | + } |
|
| 722 | 723 | if (!empty($options['group'])) { |
| 723 | 724 | $query->group($options['group']); |
| 724 | 725 | } |
| 725 | - if (!empty($options['order'])) |
|
| 726 | - $query->order($options['order']); |
|
| 727 | - if (!empty($options['join'])) |
|
| 728 | - $query->join($options['join']); |
|
| 729 | - if (!empty($options['distinct'])) |
|
| 730 | - $query->distinct = $options['distinct']; |
|
| 726 | + if (!empty($options['order'])) { |
|
| 727 | + $query->order($options['order']); |
|
| 728 | + } |
|
| 729 | + if (!empty($options['join'])) { |
|
| 730 | + $query->join($options['join']); |
|
| 731 | + } |
|
| 732 | + if (!empty($options['distinct'])) { |
|
| 733 | + $query->distinct = $options['distinct']; |
|
| 734 | + } |
|
| 731 | 735 | |
| 732 | 736 | foreach (static::$relJoins as $join) { |
| 733 | 737 | $query->join($join[0], $join[1]); |
@@ -753,14 +757,14 @@ discard block |
||
| 753 | 757 | } |
| 754 | 758 | static::$needJoin = []; |
| 755 | 759 | |
| 756 | - if (!empty($options['limit'])) |
|
| 757 | - $limit = (int) $options['limit']; |
|
| 758 | - else { |
|
| 760 | + if (!empty($options['limit'])) { |
|
| 761 | + $limit = (int) $options['limit']; |
|
| 762 | + } else { |
|
| 759 | 763 | $limit = 0; |
| 760 | 764 | } |
| 761 | - if (!empty($options['start'])) |
|
| 762 | - $start = (int) $options['start']; |
|
| 763 | - else { |
|
| 765 | + if (!empty($options['start'])) { |
|
| 766 | + $start = (int) $options['start']; |
|
| 767 | + } else { |
|
| 764 | 768 | $start = 0; |
| 765 | 769 | } |
| 766 | 770 | if ($limit || $start) { |
@@ -1019,21 +1023,23 @@ discard block |
||
| 1019 | 1023 | if (!empty($options['where'])) { |
| 1020 | 1024 | static::fixPrefix($options['where'], 'first'); |
| 1021 | 1025 | } |
| 1022 | - if (!empty($options['where'])) |
|
| 1023 | - $query->where($options['where']); |
|
| 1024 | - if (!empty($options['join'])) |
|
| 1025 | - $query->join($options['join']); |
|
| 1026 | + if (!empty($options['where'])) { |
|
| 1027 | + $query->where($options['where']); |
|
| 1028 | + } |
|
| 1029 | + if (!empty($options['join'])) { |
|
| 1030 | + $query->join($options['join']); |
|
| 1031 | + } |
|
| 1026 | 1032 | if (!empty($options['order'])) { |
| 1027 | 1033 | $query->order($options['order']); |
| 1028 | 1034 | } |
| 1029 | - if (!empty($options['limit'])) |
|
| 1030 | - $limit = (int) $options['limit']; |
|
| 1031 | - else { |
|
| 1035 | + if (!empty($options['limit'])) { |
|
| 1036 | + $limit = (int) $options['limit']; |
|
| 1037 | + } else { |
|
| 1032 | 1038 | $limit = 0; |
| 1033 | 1039 | } |
| 1034 | - if (!empty($options['start'])) |
|
| 1035 | - $start = (int) $options['start']; |
|
| 1036 | - else { |
|
| 1040 | + if (!empty($options['start'])) { |
|
| 1041 | + $start = (int) $options['start']; |
|
| 1042 | + } else { |
|
| 1037 | 1043 | $start = 0; |
| 1038 | 1044 | } |
| 1039 | 1045 | 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 | } |
@@ -1614,8 +1623,9 @@ discard block |
||
| 1614 | 1623 | App::$cur->db->where($relation['relTablePrefix'] . $this->index(), $this->pk()); |
| 1615 | 1624 | App::$cur->db->where($relation['relTablePrefix'] . $relation['model']::index(), $objectId); |
| 1616 | 1625 | $isset = App::$cur->db->select($relation['relTable'])->fetch_assoc(); |
| 1617 | - if ($isset) |
|
| 1618 | - return true; |
|
| 1626 | + if ($isset) { |
|
| 1627 | + return true; |
|
| 1628 | + } |
|
| 1619 | 1629 | |
| 1620 | 1630 | App::$cur->db->insert($relation['relTable'], [ |
| 1621 | 1631 | $relation['relTablePrefix'] . $this->index() => $this->{$this->index()}, |
@@ -126,12 +126,14 @@ discard block |
||
| 126 | 126 | if (!is_array($order)) { |
| 127 | 127 | $this->order[] = "{$order} {$type}"; |
| 128 | 128 | } else { |
| 129 | - foreach ($order as $item) |
|
| 130 | - if (!is_array($item)) { |
|
| 129 | + foreach ($order as $item) { |
|
| 130 | + if (!is_array($item)) { |
|
| 131 | 131 | call_user_func_array(array($this, 'order'), $order); |
| 132 | + } |
|
| 132 | 133 | break; |
| 133 | - } else |
|
| 134 | - $this->order($item); |
|
| 134 | + } else { |
|
| 135 | + $this->order($item); |
|
| 136 | + } |
|
| 135 | 137 | } |
| 136 | 138 | } |
| 137 | 139 | |
@@ -140,8 +142,9 @@ discard block |
||
| 140 | 142 | $start = intval($start); |
| 141 | 143 | $len = intval($len); |
| 142 | 144 | $this->limit = "LIMIT {$start}"; |
| 143 | - if ($len !== 0) |
|
| 144 | - $this->limit .= ",{$len}"; |
|
| 145 | + if ($len !== 0) { |
|
| 146 | + $this->limit .= ",{$len}"; |
|
| 147 | + } |
|
| 145 | 148 | } |
| 146 | 149 | |
| 147 | 150 | public function buildJoin($table, $where = false, $type = 'LEFT', $alias = '') |
@@ -154,10 +157,12 @@ discard block |
||
| 154 | 157 | } |
| 155 | 158 | } else { |
| 156 | 159 | $join .= " {$type} JOIN {$this->curInstance->table_prefix}{$table}"; |
| 157 | - if ($alias) |
|
| 158 | - $join .= " AS `{$alias}`"; |
|
| 159 | - if ($where) |
|
| 160 | - $join .= " ON {$where}"; |
|
| 160 | + if ($alias) { |
|
| 161 | + $join .= " AS `{$alias}`"; |
|
| 162 | + } |
|
| 163 | + if ($where) { |
|
| 164 | + $join .= " ON {$where}"; |
|
| 165 | + } |
|
| 161 | 166 | } |
| 162 | 167 | return $join; |
| 163 | 168 | } |
@@ -177,13 +182,15 @@ discard block |
||
| 177 | 182 | $operation = '='; |
| 178 | 183 | } |
| 179 | 184 | |
| 180 | - if ($concatenation === false) |
|
| 181 | - $concatenation = 'AND'; |
|
| 182 | - elseif ($concatenation === true) |
|
| 183 | - $concatenation = ''; |
|
| 185 | + if ($concatenation === false) { |
|
| 186 | + $concatenation = 'AND'; |
|
| 187 | + } elseif ($concatenation === true) { |
|
| 188 | + $concatenation = ''; |
|
| 189 | + } |
|
| 184 | 190 | |
| 185 | - if ($this->whereString == NULL) |
|
| 186 | - $this->whereString = ' WHERE '; |
|
| 191 | + if ($this->whereString == NULL) { |
|
| 192 | + $this->whereString = ' WHERE '; |
|
| 193 | + } |
|
| 187 | 194 | |
| 188 | 195 | if (stristr($operation, 'IN') || stristr($operation, 'NOT IN')) { |
| 189 | 196 | if (is_array($value)) { |
@@ -199,22 +206,22 @@ discard block |
||
| 199 | 206 | } |
| 200 | 207 | } |
| 201 | 208 | $value = '(' . $newValue . ')'; |
| 202 | - } elseif (!preg_match('!\(!', $value) && !preg_match('![^0-9,\.\(\) ]!', $value)) |
|
| 203 | - $value = "({$value})"; |
|
| 204 | - elseif (preg_match('!\(!', $value) && preg_match('![^0-9,\.\(\) ]!', $value)) |
|
| 205 | - $value = "\"{$value}\""; |
|
| 206 | - } |
|
| 207 | - elseif (!in_array($value, array('CURRENT_TIMESTAMP'))) { |
|
| 209 | + } elseif (!preg_match('!\(!', $value) && !preg_match('![^0-9,\.\(\) ]!', $value)) { |
|
| 210 | + $value = "({$value})"; |
|
| 211 | + } elseif (preg_match('!\(!', $value) && preg_match('![^0-9,\.\(\) ]!', $value)) { |
|
| 212 | + $value = "\"{$value}\""; |
|
| 213 | + } |
|
| 214 | + } elseif (!in_array($value, array('CURRENT_TIMESTAMP'))) { |
|
| 208 | 215 | $this->params[] = $value; |
| 209 | 216 | $value = "?"; |
| 210 | 217 | } |
| 211 | 218 | |
| 212 | - if (substr($this->whereString, -1, 1) == '(' || substr($this->whereString, -2, 2) == 'E ') |
|
| 213 | - $this->whereString .= " {$where} {$operation} {$value} "; |
|
| 214 | - else |
|
| 215 | - $this->whereString .= "{$concatenation} {$where} {$operation} {$value} "; |
|
| 216 | - } |
|
| 217 | - else { |
|
| 219 | + if (substr($this->whereString, -1, 1) == '(' || substr($this->whereString, -2, 2) == 'E ') { |
|
| 220 | + $this->whereString .= " {$where} {$operation} {$value} "; |
|
| 221 | + } else { |
|
| 222 | + $this->whereString .= "{$concatenation} {$where} {$operation} {$value} "; |
|
| 223 | + } |
|
| 224 | + } else { |
|
| 218 | 225 | $i = -1; |
| 219 | 226 | while (isset($where[++$i])) { |
| 220 | 227 | $item = $where[$i]; |
@@ -229,28 +236,32 @@ discard block |
||
| 229 | 236 | $this->whereString .= "{$concatenation} "; |
| 230 | 237 | } |
| 231 | 238 | |
| 232 | - if ($this->whereString != NULL) |
|
| 233 | - $this->whereString .= '('; |
|
| 234 | - else |
|
| 235 | - $this->whereString = 'WHERE ('; |
|
| 239 | + if ($this->whereString != NULL) { |
|
| 240 | + $this->whereString .= '('; |
|
| 241 | + } else { |
|
| 242 | + $this->whereString = 'WHERE ('; |
|
| 243 | + } |
|
| 236 | 244 | } |
| 237 | 245 | |
| 238 | 246 | if (!is_array($item)) { |
| 239 | 247 | call_user_func_array(array($this, 'buildWhere'), $where); |
| 240 | 248 | break; |
| 241 | 249 | } else { |
| 242 | - if ($this->whereString != NULL && substr($this->whereString, -1, 1) != '(') |
|
| 243 | - if (!isset($item[3])) |
|
| 250 | + if ($this->whereString != NULL && substr($this->whereString, -1, 1) != '(') { |
|
| 251 | + if (!isset($item[3])) |
|
| 244 | 252 | $concatenation = 'AND'; |
| 245 | - else |
|
| 246 | - $concatenation = $item[3]; |
|
| 247 | - elseif (substr($this->whereString, -1, 1) != '(') |
|
| 248 | - $this->whereString = 'WHERE '; |
|
| 253 | + } else { |
|
| 254 | + $concatenation = $item[3]; |
|
| 255 | + } |
|
| 256 | + elseif (substr($this->whereString, -1, 1) != '(') { |
|
| 257 | + $this->whereString = 'WHERE '; |
|
| 258 | + } |
|
| 249 | 259 | |
| 250 | 260 | $this->buildWhere($item); |
| 251 | 261 | } |
| 252 | - if (!isset($where[$i + 1]) && isset($where[$i - 1])) |
|
| 253 | - $this->whereString .= ') '; |
|
| 262 | + if (!isset($where[$i + 1]) && isset($where[$i - 1])) { |
|
| 263 | + $this->whereString .= ') '; |
|
| 264 | + } |
|
| 254 | 265 | } |
| 255 | 266 | } |
| 256 | 267 | } |