@@ -1,5 +1,5 @@ |
||
1 | 1 | <select class="form-control"> |
2 | -<?php foreach($this->options as $option): ?> |
|
2 | +<?php foreach ($this->options as $option): ?> |
|
3 | 3 | <option class="<?php echo $this->optionClass ?>" value="<?php |
4 | 4 | echo htmlentities($option) ?>"><?php echo $option ?></option> |
5 | 5 | <?php endforeach ?> |
@@ -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 | } |
@@ -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 |