@@ -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 | } |
@@ -242,15 +241,14 @@ discard block |
||
242 | 241 | $value = ( |
243 | 242 | $row !== null ? ( |
244 | 243 | $row[$name] != "" && $this->driver->jush() == "sql" && \preg_match("~enum|set~", $field->type) ? |
245 | - (\is_array($row[$name]) ? \array_sum($row[$name]) : +$row[$name]) : |
|
246 | - (\is_bool($row[$name]) ? +$row[$name] : $row[$name]) |
|
244 | + (\is_array($row[$name]) ? \array_sum($row[$name]) : +$row[$name]) : (\is_bool($row[$name]) ? +$row[$name] : $row[$name]) |
|
247 | 245 | ) : ( |
248 | 246 | !$update && $field->autoIncrement ? "" : (isset($queryOptions["select"]) ? false : $default) |
249 | 247 | ) |
250 | 248 | ); |
251 | 249 | $function = ( |
252 | 250 | $queryOptions["save"] |
253 | - ? (string)$queryOptions["function"][$name] |
|
251 | + ? (string) $queryOptions["function"][$name] |
|
254 | 252 | : ( |
255 | 253 | $update && \preg_match('~^CURRENT_TIMESTAMP~i', $field->onUpdate) |
256 | 254 | ? "now" |
@@ -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')); |
@@ -510,9 +510,8 @@ discard block |
||
510 | 510 | \preg_match_all("~'((?:[^']|'')*)'~", $field->length, $matches); |
511 | 511 | foreach ($matches[1] as $i => $val) { |
512 | 512 | $val = \stripcslashes(\str_replace("''", "'", $val)); |
513 | - $checked = (\is_int($value) ? $value == $i + 1 : |
|
514 | - (\is_array($value) ? \in_array($i+1, $value) : $value === $val)); |
|
515 | - $inputs[] = "<label><input type='$type'$attrs value='" . ($i+1) . "'" . |
|
513 | + $checked = (\is_int($value) ? $value == $i + 1 : (\is_array($value) ? \in_array($i + 1, $value) : $value === $val)); |
|
514 | + $inputs[] = "<label><input type='$type'$attrs value='" . ($i + 1) . "'" . |
|
516 | 515 | ($checked ? ' checked' : '') . '>' . $this->html($val) . '</label>'; |
517 | 516 | } |
518 | 517 | |
@@ -576,8 +575,7 @@ discard block |
||
576 | 575 | } |
577 | 576 | $enumLength = $this->driver->enumLength(); |
578 | 577 | return (\preg_match("~^\\s*\\(?\\s*$enumLength(?:\\s*,\\s*$enumLength)*+\\s*\\)?\\s*\$~", $length) && |
579 | - \preg_match_all("~$enumLength~", $length, $matches) ? '(' . \implode(',', $matches[0]) . ')' : |
|
580 | - \preg_replace('~^[0-9].*~', '(\0)', \preg_replace('~[^-0-9,+()[\]]~', '', $length)) |
|
578 | + \preg_match_all("~$enumLength~", $length, $matches) ? '(' . \implode(',', $matches[0]) . ')' : \preg_replace('~^[0-9].*~', '(\0)', \preg_replace('~[^-0-9,+()[\]]~', '', $length)) |
|
581 | 579 | ); |
582 | 580 | } |
583 | 581 | |
@@ -759,7 +757,7 @@ discard block |
||
759 | 757 | $expressions = []; |
760 | 758 | foreach ($indexes as $i => $index) { |
761 | 759 | if ($index->type == 'FULLTEXT' && $this->input->values['fulltext'][$i] != '') { |
762 | - $columns = \array_map(function ($column) { |
|
760 | + $columns = \array_map(function($column) { |
|
763 | 761 | return $this->driver->escapeId($column); |
764 | 762 | }, $index->columns); |
765 | 763 | $expressions[] = 'MATCH (' . \implode(', ', $columns) . ') AGAINST (' . |
@@ -874,8 +872,7 @@ discard block |
||
874 | 872 | */ |
875 | 873 | private function _selectValue($value, string $link, string $type, $original) |
876 | 874 | { |
877 | - $clause = ($value === null ? '<i>NULL</i>' : |
|
878 | - (\preg_match('~char|binary|boolean~', $type) && !\preg_match('~var~', $type) ? |
|
875 | + $clause = ($value === null ? '<i>NULL</i>' : (\preg_match('~char|binary|boolean~', $type) && !\preg_match('~var~', $type) ? |
|
879 | 876 | "<code>$value</code>" : $value)); |
880 | 877 | if (\preg_match('~blob|bytea|raw|file~', $type) && !$this->isUtf8($value)) { |
881 | 878 | $clause = '<i>' . $this->trans->lang('%d byte(s)', \strlen($original)) . '</i>'; |