@@ -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 | } |
@@ -325,8 +325,7 @@ |
||
325 | 325 | try { |
326 | 326 | \ini_set('memory_limit', \max($this->util->iniBytes('memory_limit'), |
327 | 327 | 2 * \strlen($queries) + \memory_get_usage() + 8e6)); |
328 | - } |
|
329 | - catch(\Exception $e) { |
|
328 | + } catch(\Exception $e) { |
|
330 | 329 | // Do nothing if the option is not modified. |
331 | 330 | } |
332 | 331 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * @param mixed $value |
39 | 39 | * |
40 | 40 | * @return string |
41 | - */ |
|
41 | + */ |
|
42 | 42 | // protected function editLink($value) |
43 | 43 | // { |
44 | 44 | // $link = ''; |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * @param array $types |
66 | 66 | * |
67 | 67 | * @return string |
68 | - */ |
|
68 | + */ |
|
69 | 69 | protected function values(array $row, array $blobs, array $types) |
70 | 70 | { |
71 | 71 | $values = []; |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | * @param int $limit |
93 | 93 | * |
94 | 94 | * @return string |
95 | - */ |
|
95 | + */ |
|
96 | 96 | private function message($statement, int $limit) |
97 | 97 | { |
98 | 98 | $numRows = $statement->rowCount(); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * @param array $orgtables |
112 | 112 | * |
113 | 113 | * @return string |
114 | - */ |
|
114 | + */ |
|
115 | 115 | // protected function indexes($field, array $orgtables) |
116 | 116 | // { |
117 | 117 | // static $links = []; // colno => orgtable - create links from these columns |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * @param int $limit |
149 | 149 | * |
150 | 150 | * @return array |
151 | - */ |
|
151 | + */ |
|
152 | 152 | protected function select($statement, $limit = 0) |
153 | 153 | { |
154 | 154 | $blobs = []; // colno => bool - display bytes for blobs |
@@ -208,9 +208,7 @@ discard block |
||
208 | 208 | |
209 | 209 | // TODO: Move this to driver implementations |
210 | 210 | $parse = '[\'"' . |
211 | - ($this->driver->jush() == "sql" ? '`#' : |
|
212 | - ($this->driver->jush() == "sqlite" ? '`[' : |
|
213 | - ($this->driver->jush() == "mssql" ? '[' : ''))) . ']|/\*|-- |$' . |
|
211 | + ($this->driver->jush() == "sql" ? '`#' : ($this->driver->jush() == "sqlite" ? '`[' : ($this->driver->jush() == "mssql" ? '[' : ''))) . ']|/\*|-- |$' . |
|
214 | 212 | ($this->driver->jush() == "pgsql" ? '|\$[^$]*\$' : ''); |
215 | 213 | // should always match |
216 | 214 | \preg_match('(' . \preg_quote($delimiter) . "\\s*|$parse)", $queries, $match, PREG_OFFSET_CAPTURE, $offset); |
@@ -225,8 +223,7 @@ discard block |
||
225 | 223 | return \intval($pos); |
226 | 224 | } |
227 | 225 | // find matching quote or comment end |
228 | - while (\preg_match('(' . ($found == '/*' ? '\*/' : ($found == '[' ? ']' : |
|
229 | - (\preg_match('~^-- |^#~', $found) ? "\n" : \preg_quote($found) . "|\\\\."))) . '|$)s', |
|
226 | + while (\preg_match('(' . ($found == '/*' ? '\*/' : ($found == '[' ? ']' : (\preg_match('~^-- |^#~', $found) ? "\n" : \preg_quote($found) . "|\\\\."))) . '|$)s', |
|
230 | 227 | $queries, $match, PREG_OFFSET_CAPTURE, $offset)) { |
231 | 228 | //! respect sql_mode NO_BACKSLASH_ESCAPES |
232 | 229 | $s = $match[0][0]; |
@@ -323,7 +320,7 @@ discard block |
||
323 | 320 | \ini_set('memory_limit', \max($this->util->iniBytes('memory_limit'), |
324 | 321 | 2 * \strlen($queries) + \memory_get_usage() + 8e6)); |
325 | 322 | } |
326 | - catch(\Exception $e) { |
|
323 | + catch (\Exception $e) { |
|
327 | 324 | // Do nothing if the option is not modified. |
328 | 325 | } |
329 | 326 | } |
@@ -379,7 +376,7 @@ discard block |
||
379 | 376 | if ($empty) { |
380 | 377 | $messages[] = $this->trans->lang('No commands to execute.'); |
381 | 378 | } elseif ($onlyErrors) { |
382 | - $messages[] = $this->trans->lang('%d query(s) executed OK.', $commands - $errors); |
|
379 | + $messages[] = $this->trans->lang('%d query(s) executed OK.', $commands - $errors); |
|
383 | 380 | // $timestamps[] = $this->trans->formatTime($total_start); |
384 | 381 | } |
385 | 382 |
@@ -279,14 +279,14 @@ discard block |
||
279 | 279 | $target .= '<b>' . $this->util->html($foreignKey->schema) . '</b>.'; |
280 | 280 | } |
281 | 281 | $target = $this->util->html($foreignKey->table) . |
282 | - '(' . \implode(', ', \array_map(function ($key) { |
|
282 | + '(' . \implode(', ', \array_map(function($key) { |
|
283 | 283 | return $this->util->html($key); |
284 | 284 | }, $foreignKey->target)) . ')'; |
285 | 285 | $details[] = [ |
286 | 286 | 'name' => $this->util->html($name), |
287 | 287 | 'source' => '<i>' . \implode( |
288 | 288 | '</i>, <i>', |
289 | - \array_map(function ($key) { |
|
289 | + \array_map(function($key) { |
|
290 | 290 | return $this->util->html($key); |
291 | 291 | }, $foreignKey->source) |
292 | 292 | ) . '</i>', |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | private function getTableAttrs(array $values, string $table = '', array $origFields = []) |
470 | 470 | { |
471 | 471 | // From create.inc.php |
472 | - $values['fields'] = (array)$values['fields']; |
|
472 | + $values['fields'] = (array) $values['fields']; |
|
473 | 473 | if ($values['autoIncrementCol']) { |
474 | 474 | $values['fields'][$values['autoIncrementCol']]['autoIncrement'] = true; |
475 | 475 | } |
@@ -486,8 +486,7 @@ discard block |
||
486 | 486 | $field = TableFieldEntity::make($field); |
487 | 487 | $foreignKey = $this->foreignKeys[$field->type] ?? null; |
488 | 488 | //! can collide with user defined type |
489 | - $typeField = ($foreignKey === null ? $field : |
|
490 | - TableFieldEntity::make($this->referencableTables[$foreignKey])); |
|
489 | + $typeField = ($foreignKey === null ? $field : TableFieldEntity::make($this->referencableTables[$foreignKey])); |
|
491 | 490 | // Originally, deleted fields have the "field" field set to an empty string. |
492 | 491 | // But in our implementation, the "name" field is not set. |
493 | 492 | if ($field->name != '') { |