@@ -101,8 +101,7 @@ discard block |
||
| 101 | 101 | $maxlength = (!\preg_match('~int~', $field->type) && |
| 102 | 102 | \preg_match('~^(\d+)(,(\d+))?$~', $field->length, $match) ? |
| 103 | 103 | ((\preg_match("~binary~", $field->type) ? 2 : 1) * $match[1] + (($match[3] ?? null) ? 1 : 0) + |
| 104 | - (($match[2] ?? false) && !$unsigned ? 1 : 0)) : |
|
| 105 | - ($this->driver->typeExists($field->type) ? $this->driver->type($field->type) + ($unsigned ? 0 : 1) : 0)); |
|
| 104 | + (($match[2] ?? false) && !$unsigned ? 1 : 0)) : ($this->driver->typeExists($field->type) ? $this->driver->type($field->type) + ($unsigned ? 0 : 1) : 0)); |
|
| 106 | 105 | if ($this->driver->jush() == 'sql' && $this->driver->minVersion(5.6) && \preg_match('~time~', $field->type)) { |
| 107 | 106 | $maxlength += 7; // microtime |
| 108 | 107 | } |
@@ -243,8 +242,7 @@ discard block |
||
| 243 | 242 | $value = ( |
| 244 | 243 | $row !== null ? ( |
| 245 | 244 | $row[$name] != "" && $this->driver->jush() == "sql" && \preg_match("~enum|set~", $field->type) ? |
| 246 | - (\is_array($row[$name]) ? \array_sum($row[$name]) : +$row[$name]) : |
|
| 247 | - (\is_bool($row[$name]) ? +$row[$name] : $row[$name]) |
|
| 245 | + (\is_array($row[$name]) ? \array_sum($row[$name]) : +$row[$name]) : (\is_bool($row[$name]) ? +$row[$name] : $row[$name]) |
|
| 248 | 246 | ) : ( |
| 249 | 247 | !$update && $field->autoIncrement ? "" : (isset($queryOptions["select"]) ? false : $default) |
| 250 | 248 | ) |
@@ -254,7 +252,7 @@ discard block |
||
| 254 | 252 | } |
| 255 | 253 | $function = ( |
| 256 | 254 | $queryOptions["save"] |
| 257 | - ? (string)$queryOptions["function"][$name] |
|
| 255 | + ? (string) $queryOptions["function"][$name] |
|
| 258 | 256 | : ( |
| 259 | 257 | $update && \preg_match('~^CURRENT_TIMESTAMP~i', $field->onUpdate) |
| 260 | 258 | ? "now" |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | { |
| 24 | 24 | return [ |
| 25 | 25 | 'select' => $select, |
| 26 | - 'values' => (array)$options["columns"], |
|
| 26 | + 'values' => (array) $options["columns"], |
|
| 27 | 27 | 'columns' => $columns, |
| 28 | 28 | 'functions' => $this->driver->functions(), |
| 29 | 29 | 'grouping' => $this->driver->grouping(), |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | } |
| 48 | 48 | return [ |
| 49 | 49 | // 'where' => $where, |
| 50 | - 'values' => (array)$options["where"], |
|
| 50 | + 'values' => (array) $options["where"], |
|
| 51 | 51 | 'columns' => $columns, |
| 52 | 52 | 'indexes' => $indexes, |
| 53 | 53 | 'operators' => $this->driver->operators(), |
@@ -66,8 +66,8 @@ discard block |
||
| 66 | 66 | private function getSortingOptions(array $columns, array $options) |
| 67 | 67 | { |
| 68 | 68 | $values = []; |
| 69 | - $descs = (array)$options["desc"]; |
|
| 70 | - foreach ((array)$options["order"] as $key => $value) { |
|
| 69 | + $descs = (array) $options["desc"]; |
|
| 70 | + foreach ((array) $options["order"] as $key => $value) { |
|
| 71 | 71 | $values[] = [ |
| 72 | 72 | 'col' => $value, |
| 73 | 73 | 'desc' => $descs[$key] ?? 0, |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | public function html(?string $string) |
| 82 | 82 | { |
| 83 | - if(!$string) { |
|
| 83 | + if (!$string) { |
|
| 84 | 84 | return $string; |
| 85 | 85 | } |
| 86 | 86 | return \str_replace("\0", '�', \htmlspecialchars($string, ENT_QUOTES, 'utf-8')); |
@@ -520,9 +520,8 @@ discard block |
||
| 520 | 520 | \preg_match_all("~'((?:[^']|'')*)'~", $field->length, $matches); |
| 521 | 521 | foreach ($matches[1] as $i => $val) { |
| 522 | 522 | $val = \stripcslashes(\str_replace("''", "'", $val)); |
| 523 | - $checked = (\is_int($value) ? $value == $i + 1 : |
|
| 524 | - (\is_array($value) ? \in_array($i+1, $value) : $value === $val)); |
|
| 525 | - $inputs[] = "<label><input type='$type'$attrs value='" . ($i+1) . "'" . |
|
| 523 | + $checked = (\is_int($value) ? $value == $i + 1 : (\is_array($value) ? \in_array($i + 1, $value) : $value === $val)); |
|
| 524 | + $inputs[] = "<label><input type='$type'$attrs value='" . ($i + 1) . "'" . |
|
| 526 | 525 | ($checked ? ' checked' : '') . '>' . $this->html($this->editValue($val, $field)) . '</label>'; |
| 527 | 526 | } |
| 528 | 527 | |
@@ -586,8 +585,7 @@ discard block |
||
| 586 | 585 | } |
| 587 | 586 | $enumLength = $this->driver->enumLength(); |
| 588 | 587 | return (\preg_match("~^\\s*\\(?\\s*$enumLength(?:\\s*,\\s*$enumLength)*+\\s*\\)?\\s*\$~", $length) && |
| 589 | - \preg_match_all("~$enumLength~", $length, $matches) ? '(' . \implode(',', $matches[0]) . ')' : |
|
| 590 | - \preg_replace('~^[0-9].*~', '(\0)', \preg_replace('~[^-0-9,+()[\]]~', '', $length)) |
|
| 588 | + \preg_match_all("~$enumLength~", $length, $matches) ? '(' . \implode(',', $matches[0]) . ')' : \preg_replace('~^[0-9].*~', '(\0)', \preg_replace('~[^-0-9,+()[\]]~', '', $length)) |
|
| 591 | 589 | ); |
| 592 | 590 | } |
| 593 | 591 | |
@@ -769,7 +767,7 @@ discard block |
||
| 769 | 767 | $expressions = []; |
| 770 | 768 | foreach ($indexes as $i => $index) { |
| 771 | 769 | if ($index->type == 'FULLTEXT' && $this->input->values['fulltext'][$i] != '') { |
| 772 | - $columns = \array_map(function ($column) { |
|
| 770 | + $columns = \array_map(function($column) { |
|
| 773 | 771 | return $this->driver->escapeId($column); |
| 774 | 772 | }, $index->columns); |
| 775 | 773 | $expressions[] = 'MATCH (' . \implode(', ', $columns) . ') AGAINST (' . |
@@ -884,8 +882,7 @@ discard block |
||
| 884 | 882 | */ |
| 885 | 883 | private function _selectValue($value, string $link, string $type, string $original) |
| 886 | 884 | { |
| 887 | - $clause = ($value === null ? '<i>NULL</i>' : |
|
| 888 | - (\preg_match('~char|binary|boolean~', $type) && !\preg_match('~var~', $type) ? |
|
| 885 | + $clause = ($value === null ? '<i>NULL</i>' : (\preg_match('~char|binary|boolean~', $type) && !\preg_match('~var~', $type) ? |
|
| 889 | 886 | "<code>$value</code>" : $value)); |
| 890 | 887 | if (\preg_match('~blob|bytea|raw|file~', $type) && !$this->isUtf8($value)) { |
| 891 | 888 | $clause = '<i>' . $this->trans->lang('%d byte(s)', \strlen($original)) . '</i>'; |
@@ -924,11 +924,9 @@ |
||
| 924 | 924 | if ($link === '') { |
| 925 | 925 | if ($this->isMail($value)) { |
| 926 | 926 | $link = "mailto:$value"; |
| 927 | - } |
|
| 928 | - elseif ($this->isUrl($value)) { |
|
| 927 | + } elseif ($this->isUrl($value)) { |
|
| 929 | 928 | $link = $value; // IE 11 and all modern browsers hide referrer |
| 930 | - } |
|
| 931 | - else { |
|
| 929 | + } else { |
|
| 932 | 930 | $link = ''; |
| 933 | 931 | } |
| 934 | 932 | } |