@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <select class="form-control"> |
| 2 | -<?php foreach($this->options as $value => $label): ?> |
|
| 2 | +<?php foreach ($this->options as $value => $label): ?> |
|
| 3 | 3 | <option value="<?php echo htmlentities($value) ?>"><?php echo $label ?></option> |
| 4 | 4 | <?php endforeach ?> |
| 5 | 5 | </select> |
@@ -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 | } |
@@ -526,8 +526,7 @@ |
||
| 526 | 526 | } |
| 527 | 527 | |
| 528 | 528 | $this->dumpTablesAndViews($database); |
| 529 | - } |
|
| 530 | - catch (\Exception $e) { |
|
| 529 | + } catch (\Exception $e) { |
|
| 531 | 530 | return $e->getMessage(); |
| 532 | 531 | } |
| 533 | 532 | } |
@@ -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, |
@@ -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 | } |
@@ -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>'; |
@@ -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 | } |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | * @param array $types |
| 47 | 47 | * |
| 48 | 48 | * @return string |
| 49 | - */ |
|
| 49 | + */ |
|
| 50 | 50 | protected function values(array $row, array $blobs, array $types) |
| 51 | 51 | { |
| 52 | 52 | $values = []; |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | * @param int $limit |
| 74 | 74 | * |
| 75 | 75 | * @return string |
| 76 | - */ |
|
| 76 | + */ |
|
| 77 | 77 | private function message($statement, int $limit) |
| 78 | 78 | { |
| 79 | 79 | $numRows = $statement->rowCount(); |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | * @param int $limit |
| 96 | 96 | * |
| 97 | 97 | * @return array |
| 98 | - */ |
|
| 98 | + */ |
|
| 99 | 99 | protected function select($statement, $limit = 0) |
| 100 | 100 | { |
| 101 | 101 | // No resultset |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | \ini_set('memory_limit', \max($this->util->iniBytes('memory_limit'), |
| 197 | 197 | 2 * \strlen($queries) + \memory_get_usage() + 8e6)); |
| 198 | 198 | } |
| 199 | - catch(\Exception $e) { |
|
| 199 | + catch (\Exception $e) { |
|
| 200 | 200 | // Do nothing if the option is not modified. |
| 201 | 201 | } |
| 202 | 202 | } |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | if ($commands === 0) { |
| 236 | 236 | $messages[] = $this->trans->lang('No commands to execute.'); |
| 237 | 237 | } elseif ($onlyErrors) { |
| 238 | - $messages[] = $this->trans->lang('%d query(s) executed OK.', $commands - $errors); |
|
| 238 | + $messages[] = $this->trans->lang('%d query(s) executed OK.', $commands - $errors); |
|
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | return ['results' => $this->results, 'messages' => $messages]; |
@@ -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 | } |