@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <div class="input-group"> |
| 2 | -<?php if(isset($this->schemas) && ($this->schemas)): ?> |
|
| 2 | +<?php if (isset($this->schemas) && ($this->schemas)): ?> |
|
| 3 | 3 | <select class="form-control" id="adminer-schema-select"> |
| 4 | -<?php foreach($this->schemas as $schema): ?> |
|
| 4 | +<?php foreach ($this->schemas as $schema): ?> |
|
| 5 | 5 | <option value="<?php echo $schema ?>"><?php echo $schema ?></option> |
| 6 | 6 | <?php endforeach ?> |
| 7 | 7 | </select> |
@@ -139,7 +139,7 @@ |
||
| 139 | 139 | } |
| 140 | 140 | } |
| 141 | 141 | if (\preg_match("~ IDENTIFIED BY PASSWORD '([^']+)~", $row[0], $match)) { |
| 142 | - $password = $match[1]; |
|
| 142 | + $password = $match[1]; |
|
| 143 | 143 | } |
| 144 | 144 | } |
| 145 | 145 | } |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | $this->viewAdmin = new ViewAdmin(); |
| 53 | 53 | $this->viewAdmin->init($this->admin()); |
| 54 | 54 | } |
| 55 | - return $this->viewAdmin ; |
|
| 55 | + return $this->viewAdmin; |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
@@ -239,8 +239,7 @@ discard block |
||
| 239 | 239 | $row[$key] = '"' . \str_replace('"', '""', $val) . '"'; |
| 240 | 240 | } |
| 241 | 241 | } |
| 242 | - $separator = $this->options['format'] == 'csv' ? ',' : |
|
| 243 | - ($this->options['format'] == 'tsv' ? "\t" : ';'); |
|
| 242 | + $separator = $this->options['format'] == 'csv' ? ',' : ($this->options['format'] == 'tsv' ? "\t" : ';'); |
|
| 244 | 243 | $this->queries[] = \implode($separator, $row); |
| 245 | 244 | } |
| 246 | 245 | |
@@ -354,7 +353,7 @@ discard block |
||
| 354 | 353 | } else { |
| 355 | 354 | if (!$insert) { |
| 356 | 355 | $insert = 'INSERT INTO ' . $this->driver->table($table) . ' (' . |
| 357 | - \implode(', ', \array_map(function ($key) { |
|
| 356 | + \implode(', ', \array_map(function($key) { |
|
| 358 | 357 | return $this->driver->escapeId($key); |
| 359 | 358 | }, $keys)) . ') VALUES'; |
| 360 | 359 | } |
@@ -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>'; |
@@ -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 | |
@@ -299,14 +299,14 @@ discard block |
||
| 299 | 299 | $target .= '<b>' . $this->util->html($foreignKey->schema) . '</b>.'; |
| 300 | 300 | } |
| 301 | 301 | $target = $this->util->html($foreignKey->table) . |
| 302 | - '(' . \implode(', ', \array_map(function ($key) { |
|
| 302 | + '(' . \implode(', ', \array_map(function($key) { |
|
| 303 | 303 | return $this->util->html($key); |
| 304 | 304 | }, $foreignKey->target)) . ')'; |
| 305 | 305 | $details[] = [ |
| 306 | 306 | 'name' => $this->util->html($name), |
| 307 | 307 | 'source' => '<i>' . \implode( |
| 308 | 308 | '</i>, <i>', |
| 309 | - \array_map(function ($key) { |
|
| 309 | + \array_map(function($key) { |
|
| 310 | 310 | return $this->util->html($key); |
| 311 | 311 | }, $foreignKey->source) |
| 312 | 312 | ) . '</i>', |
@@ -486,8 +486,7 @@ discard block |
||
| 486 | 486 | { |
| 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 | $processedField = $this->util->processField($field, $typeField); |
| 492 | 491 | $origField = $this->fields[$this->fieldName] ?? null; |
| 493 | 492 | if ($this->fieldName === '') { |
@@ -569,7 +568,7 @@ discard block |
||
| 569 | 568 | private function makeTableAttrs(array $values, string $table = '') |
| 570 | 569 | { |
| 571 | 570 | // From create.inc.php |
| 572 | - $values['fields'] = (array)$values['fields']; |
|
| 571 | + $values['fields'] = (array) $values['fields']; |
|
| 573 | 572 | if ($values['autoIncrementCol']) { |
| 574 | 573 | $values['fields'][$values['autoIncrementCol']]['autoIncrement'] = true; |
| 575 | 574 | } |