@@ -1,15 +1,15 @@ |
||
1 | 1 | <nav aria-label=""> |
2 | 2 | <ul class="pagination"> |
3 | 3 | <?php |
4 | - if(($this->prev)) |
|
4 | + if (($this->prev)) |
|
5 | 5 | { |
6 | 6 | echo $this->prev; |
7 | 7 | } |
8 | - foreach($this->links as $link) |
|
8 | + foreach ($this->links as $link) |
|
9 | 9 | { |
10 | 10 | echo $link; |
11 | 11 | } |
12 | - if(($this->next)) |
|
12 | + if (($this->next)) |
|
13 | 13 | { |
14 | 14 | echo $this->next; |
15 | 15 | } |
@@ -100,8 +100,7 @@ discard block |
||
100 | 100 | $maxlength = (!\preg_match('~int~', $field->type) && |
101 | 101 | \preg_match('~^(\d+)(,(\d+))?$~', $field->length, $match) ? |
102 | 102 | ((\preg_match("~binary~", $field->type) ? 2 : 1) * $match[1] + (($match[3] ?? null) ? 1 : 0) + |
103 | - (($match[2] ?? false) && !$unsigned ? 1 : 0)) : |
|
104 | - ($this->driver->typeExists($field->type) ? $this->driver->type($field->type) + ($unsigned ? 0 : 1) : 0)); |
|
103 | + (($match[2] ?? false) && !$unsigned ? 1 : 0)) : ($this->driver->typeExists($field->type) ? $this->driver->type($field->type) + ($unsigned ? 0 : 1) : 0)); |
|
105 | 104 | if ($this->driver->jush() == 'sql' && $this->driver->minVersion(5.6) && \preg_match('~time~', $field->type)) { |
106 | 105 | $maxlength += 7; // microtime |
107 | 106 | } |
@@ -241,12 +240,8 @@ discard block |
||
241 | 240 | // } |
242 | 241 | $value = ($row !== null ? |
243 | 242 | ($row[$name] != "" && $this->driver->jush() == "sql" && \preg_match("~enum|set~", $field->type) ? |
244 | - (\is_array($row[$name]) ? \array_sum($row[$name]) : +$row[$name]) : |
|
245 | - (\is_bool($row[$name]) ? +$row[$name] : $row[$name])) : |
|
246 | - (!$update && $field->autoIncrement ? "" : (isset($queryOptions["select"]) ? false : $default))); |
|
247 | - $function = ($queryOptions["save"] ? (string)$queryOptions["function"][$name] : |
|
248 | - ($update && \preg_match('~^CURRENT_TIMESTAMP~i', $field->onUpdate) ? "now" : |
|
249 | - ($value === false ? null : ($value !== null ? '' : 'NULL')))); |
|
243 | + (\is_array($row[$name]) ? \array_sum($row[$name]) : +$row[$name]) : (\is_bool($row[$name]) ? +$row[$name] : $row[$name])) : (!$update && $field->autoIncrement ? "" : (isset($queryOptions["select"]) ? false : $default))); |
|
244 | + $function = ($queryOptions["save"] ? (string) $queryOptions["function"][$name] : ($update && \preg_match('~^CURRENT_TIMESTAMP~i', $field->onUpdate) ? "now" : ($value === false ? null : ($value !== null ? '' : 'NULL')))); |
|
250 | 245 | if (!$update && $value == $field->default && \preg_match('~^[\w.]+\(~', $value)) { |
251 | 246 | $function = "SQL"; |
252 | 247 | } |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | { |
202 | 202 | $servers = $this->getConfig()->getOption('servers', []); |
203 | 203 | $default = $this->getConfig()->getOption('default', ''); |
204 | - if(array_key_exists($default, $servers)) |
|
204 | + if (array_key_exists($default, $servers)) |
|
205 | 205 | { |
206 | 206 | return $default; |
207 | 207 | } |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | */ |
257 | 257 | public function getReadyScript() |
258 | 258 | { |
259 | - if(!($server = $this->getDefaultServer())) |
|
259 | + if (!($server = $this->getDefaultServer())) |
|
260 | 260 | { |
261 | 261 | return ''; |
262 | 262 | } |
@@ -449,9 +449,8 @@ discard block |
||
449 | 449 | \preg_match_all("~'((?:[^']|'')*)'~", $field->length, $matches); |
450 | 450 | foreach ($matches[1] as $i => $val) { |
451 | 451 | $val = \stripcslashes(\str_replace("''", "'", $val)); |
452 | - $checked = (\is_int($value) ? $value == $i + 1 : |
|
453 | - (\is_array($value) ? \in_array($i+1, $value) : $value === $val)); |
|
454 | - $inputs[] = "<label><input type='$type'$attrs value='" . ($i+1) . "'" . |
|
452 | + $checked = (\is_int($value) ? $value == $i + 1 : (\is_array($value) ? \in_array($i + 1, $value) : $value === $val)); |
|
453 | + $inputs[] = "<label><input type='$type'$attrs value='" . ($i + 1) . "'" . |
|
455 | 454 | ($checked ? ' checked' : '') . '>' . $this->html($val) . '</label>'; |
456 | 455 | } |
457 | 456 | |
@@ -515,8 +514,7 @@ discard block |
||
515 | 514 | } |
516 | 515 | $enumLength = $this->driver->enumLength(); |
517 | 516 | return (\preg_match("~^\\s*\\(?\\s*$enumLength(?:\\s*,\\s*$enumLength)*+\\s*\\)?\\s*\$~", $length) && |
518 | - \preg_match_all("~$enumLength~", $length, $matches) ? '(' . \implode(',', $matches[0]) . ')' : |
|
519 | - \preg_replace('~^[0-9].*~', '(\0)', \preg_replace('~[^-0-9,+()[\]]~', '', $length)) |
|
517 | + \preg_match_all("~$enumLength~", $length, $matches) ? '(' . \implode(',', $matches[0]) . ')' : \preg_replace('~^[0-9].*~', '(\0)', \preg_replace('~[^-0-9,+()[\]]~', '', $length)) |
|
520 | 518 | ); |
521 | 519 | } |
522 | 520 | |
@@ -703,7 +701,7 @@ discard block |
||
703 | 701 | $expressions = []; |
704 | 702 | foreach ($indexes as $i => $index) { |
705 | 703 | if ($index->type == 'FULLTEXT' && $this->input->values['fulltext'][$i] != '') { |
706 | - $columns = \array_map(function ($column) { |
|
704 | + $columns = \array_map(function($column) { |
|
707 | 705 | return $this->driver->escapeId($column); |
708 | 706 | }, $index->columns); |
709 | 707 | $expressions[] = 'MATCH (' . \implode(', ', $columns) . ') AGAINST (' . |
@@ -818,8 +816,7 @@ discard block |
||
818 | 816 | */ |
819 | 817 | private function _selectValue($value, string $link, string $type, $original): string |
820 | 818 | { |
821 | - $clause = ($value === null ? '<i>NULL</i>' : |
|
822 | - (\preg_match('~char|binary|boolean~', $type) && !\preg_match('~var~', $type) ? |
|
819 | + $clause = ($value === null ? '<i>NULL</i>' : (\preg_match('~char|binary|boolean~', $type) && !\preg_match('~var~', $type) ? |
|
823 | 820 | "<code>$value</code>" : $value)); |
824 | 821 | if (\preg_match('~blob|bytea|raw|file~', $type) && !$this->isUtf8($value)) { |
825 | 822 | $clause = '<i>' . $this->trans->lang('%d byte(s)', \strlen($original)) . '</i>'; |
@@ -858,8 +858,7 @@ |
||
858 | 858 | if ($link === '') { |
859 | 859 | if ($this->isMail($value)) { |
860 | 860 | $link = "mailto:$value"; |
861 | - } |
|
862 | - elseif ($this->isUrl($value)) { |
|
861 | + } elseif ($this->isUrl($value)) { |
|
863 | 862 | $link = $value; // IE 11 and all modern browsers hide referrer |
864 | 863 | } |
865 | 864 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | { |
39 | 39 | return [ |
40 | 40 | 'select' => $select, |
41 | - 'values' => (array)$options["columns"], |
|
41 | + 'values' => (array) $options["columns"], |
|
42 | 42 | 'columns' => $columns, |
43 | 43 | 'functions' => $this->driver->functions(), |
44 | 44 | 'grouping' => $this->driver->grouping(), |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | } |
63 | 63 | return [ |
64 | 64 | // 'where' => $where, |
65 | - 'values' => (array)$options["where"], |
|
65 | + 'values' => (array) $options["where"], |
|
66 | 66 | 'columns' => $columns, |
67 | 67 | 'indexes' => $indexes, |
68 | 68 | 'operators' => $this->driver->operators(), |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | private function getSortingOptions(array $columns, array $options): array |
82 | 82 | { |
83 | 83 | $values = []; |
84 | - $descs = (array)$options["desc"]; |
|
85 | - foreach ((array)$options["order"] as $key => $value) { |
|
84 | + $descs = (array) $options["desc"]; |
|
85 | + foreach ((array) $options["order"] as $key => $value) { |
|
86 | 86 | $values[] = [ |
87 | 87 | 'col' => $value, |
88 | 88 | 'desc' => $descs[$key] ?? 0, |
@@ -607,8 +607,8 @@ discard block |
||
607 | 607 | */ |
608 | 608 | public function execSelect(string $table, array $queryOptions): array |
609 | 609 | { |
610 | - list(, $query, $select, $fields, , , $indexes, $where, $group, , $limit, $page, |
|
611 | - $textLength, , $unselected) = $this->prepareSelect($table, $queryOptions); |
|
610 | + list(, $query, $select, $fields,,, $indexes, $where, $group,, $limit, $page, |
|
611 | + $textLength,, $unselected) = $this->prepareSelect($table, $queryOptions); |
|
612 | 612 | |
613 | 613 | list($rows, $duration) = $this->executeQuery($query, $page); |
614 | 614 | if (!$rows) { |