Passed
Branch main (26cc78)
by Thierry
02:40
created
templates/views/bootstrap3/sql/export.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -6,10 +6,10 @@  discard block
 block discarded – undo
6 6
                     <label for="output" class="col-md-3 control-label"><?php
7 7
                         echo $this->options['output']['label'] ?></label>
8 8
                     <div class="col-md-8">
9
-<?php foreach($this->options['output']['options'] as $value => $label): ?>
9
+<?php foreach ($this->options['output']['options'] as $value => $label): ?>
10 10
                         <label class="radio-inline">
11 11
                             <input type="radio" name="output" value="<?php echo $value ?>" <?php
12
-                                if($this->options['output']['value'] === $value): ?>checked <?php
12
+                                if ($this->options['output']['value'] === $value): ?>checked <?php
13 13
                                 endif ?>/> <?php echo $label ?>
14 14
                         </label>
15 15
 <?php endforeach ?>
@@ -19,48 +19,48 @@  discard block
 block discarded – undo
19 19
                     <label for="format" class="col-md-3 control-label"><?php
20 20
                         echo $this->options['format']['label'] ?></label>
21 21
                     <div class="col-md-8">
22
-<?php foreach($this->options['format']['options'] as $value => $label): ?>
22
+<?php foreach ($this->options['format']['options'] as $value => $label): ?>
23 23
                         <label class="radio-inline">
24 24
                             <input type="radio" name="format" value="<?php echo $value ?>" <?php
25
-                                if($this->options['format']['value'] === $value): ?>checked <?php
25
+                                if ($this->options['format']['value'] === $value): ?>checked <?php
26 26
                                 endif ?>/> <?php echo $label ?>
27 27
                         </label>
28 28
 <?php endforeach ?>
29 29
                     </div>
30 30
                 </div>
31
-<?php if(array_key_exists('db_style', $this->options)): ?>
31
+<?php if (array_key_exists('db_style', $this->options)): ?>
32 32
                 <div class="form-group">
33 33
                     <label for="db_style" class="col-md-3 control-label"><?php
34 34
                         echo $this->options['db_style']['label'] ?></label>
35 35
                     <div class="col-md-8">
36 36
                         <select name="db_style" class="form-control">
37
-<?php foreach($this->options['db_style']['options'] as $label): ?>
37
+<?php foreach ($this->options['db_style']['options'] as $label): ?>
38 38
                             <option <?php
39
-                                if($this->options['db_style']['value'] == $label): ?>selected<?php
39
+                                if ($this->options['db_style']['value'] == $label): ?>selected<?php
40 40
                                 endif ?>> <?php echo $label ?></option>
41 41
 <?php endforeach ?>
42 42
                         </select>
43 43
                     </div>
44 44
                 </div>
45
-<?php if(array_key_exists('routines', $this->options) || array_key_exists('events', $this->options)): ?>
45
+<?php if (array_key_exists('routines', $this->options) || array_key_exists('events', $this->options)): ?>
46 46
                 <div class="form-group">
47 47
                     <label class="col-md-3 control-label">&nbsp;</label>
48
-<?php if(array_key_exists('routines', $this->options)): ?>
48
+<?php if (array_key_exists('routines', $this->options)): ?>
49 49
                     <div class="col-md-4">
50 50
                         <div class="checkbox">
51 51
                             <label><input type="checkbox" name="routines" value="<?php
52 52
                                 echo $this->options['routines']['value'] ?>" <?php
53
-                                if($this->options['routines']['checked']): ?>checked <?php
53
+                                if ($this->options['routines']['checked']): ?>checked <?php
54 54
                                 endif ?>/> <?php echo $this->options['routines']['label'] ?></label>
55 55
                         </div>
56 56
                     </div>
57 57
 <?php endif ?>
58
-<?php if(array_key_exists('events', $this->options)): ?>
58
+<?php if (array_key_exists('events', $this->options)): ?>
59 59
                     <div class="col-md-4">
60 60
                         <div class="checkbox">
61 61
                             <label><input type="checkbox" name="events" value="<?php
62 62
                                 echo $this->options['events']['value'] ?>" <?php
63
-                                if($this->options['events']['checked']): ?>checked <?php
63
+                                if ($this->options['events']['checked']): ?>checked <?php
64 64
                                 endif ?>/> <?php echo $this->options['events']['label'] ?></label>
65 65
                         </div>
66 66
                     </div>
@@ -73,9 +73,9 @@  discard block
 block discarded – undo
73 73
                         echo $this->options['table_style']['label'] ?></label>
74 74
                     <div class="col-md-8">
75 75
                         <select name="table_style" class="form-control">
76
-<?php foreach($this->options['table_style']['options'] as $label): ?>
76
+<?php foreach ($this->options['table_style']['options'] as $label): ?>
77 77
                             <option <?php
78
-                                if($this->options['table_style']['value'] == $label): ?>selected<?php
78
+                                if ($this->options['table_style']['value'] == $label): ?>selected<?php
79 79
                                 endif ?>> <?php echo $label ?></option>
80 80
 <?php endforeach ?>
81 81
                         </select>
@@ -87,16 +87,16 @@  discard block
 block discarded – undo
87 87
                         <div class="checkbox">
88 88
                             <label><input type="checkbox" name="auto_increment" value="<?php
89 89
                                 echo $this->options['auto_increment']['value'] ?>" <?php
90
-                                if($this->options['auto_increment']['checked']): ?>checked <?php
90
+                                if ($this->options['auto_increment']['checked']): ?>checked <?php
91 91
                                 endif ?>/> <?php echo $this->options['auto_increment']['label'] ?></label>
92 92
                         </div>
93 93
                     </div>
94
-<?php if(array_key_exists('triggers', $this->options)): ?>
94
+<?php if (array_key_exists('triggers', $this->options)): ?>
95 95
                     <div class="col-md-4">
96 96
                         <div class="checkbox">
97 97
                             <label><input type="checkbox" name="triggers" value="<?php
98 98
                                 echo $this->options['triggers']['value'] ?>" <?php
99
-                                if($this->options['triggers']['checked']): ?>checked <?php
99
+                                if ($this->options['triggers']['checked']): ?>checked <?php
100 100
                                 endif ?>/> <?php echo $this->options['triggers']['label'] ?></label>
101 101
                         </div>
102 102
                     </div>
@@ -107,9 +107,9 @@  discard block
 block discarded – undo
107 107
                         echo $this->options['data_style']['label'] ?></label>
108 108
                     <div class="col-md-8">
109 109
                         <select name="data_style" class="form-control">
110
-<?php foreach($this->options['data_style']['options'] as $label): ?>
110
+<?php foreach ($this->options['data_style']['options'] as $label): ?>
111 111
                             <option <?php
112
-                                if($this->options['data_style']['value'] == $label): ?>selected<?php
112
+                                if ($this->options['data_style']['value'] == $label): ?>selected<?php
113 113
                                 endif ?>> <?php echo $label ?></option>
114 114
 <?php endforeach ?>
115 115
                         </select>
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
             </div>
126 126
             <div class="col-md-4">
127 127
                 <div class="table-responsive">
128
-<?php if(isset($this->databases)): ?>
128
+<?php if (isset($this->databases)): ?>
129 129
                     <table class="table table-bordered">
130 130
                         <thead>
131 131
                             <tr>
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
                             </tr>
143 143
                         </thead>
144 144
                         <tbody>
145
-<?php foreach($this->databases['details'] as $database): ?>
145
+<?php foreach ($this->databases['details'] as $database): ?>
146 146
                             <tr>
147 147
                                 <td>
148 148
                                     <input type="checkbox" name="database_list[]" class="<?php
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
                         </tbody>
161 161
                     </table>
162 162
 <?php endif ?>
163
-<?php if(isset($this->tables)): ?>
163
+<?php if (isset($this->tables)): ?>
164 164
                     <table class="table table-bordered">
165 165
                         <thead>
166 166
                             <tr>
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
                             </tr>
178 178
                         </thead>
179 179
                         <tbody>
180
-<?php foreach($this->tables['details'] as $table): ?>
180
+<?php foreach ($this->tables['details'] as $table): ?>
181 181
                             <tr>
182 182
                                 <td>
183 183
                                     <input type="checkbox" name="table_list[]" class="<?php
Please login to merge, or discard this patch.
templates/views/bootstrap3/sql/results.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,44 +1,44 @@
 block discarded – undo
1
-<?php foreach($this->results as $result): ?>
1
+<?php foreach ($this->results as $result): ?>
2 2
             <div class="row">
3
-<?php if(count($result['errors']) > 0): ?>
3
+<?php if (count($result['errors']) > 0): ?>
4 4
                 <div class="panel panel-danger">
5 5
                     <div class="panel-heading">
6 6
                         <?php echo $result['query'] ?>
7 7
                     </div>
8 8
                     <div class="panel-body" style="padding:5px 15px">
9
-<?php foreach($result['errors'] as $error): ?>
9
+<?php foreach ($result['errors'] as $error): ?>
10 10
                         <p style="margin:0"><?php echo $error ?></p>
11 11
 <?php endforeach ?>
12 12
                     </div>
13 13
                 </div>
14 14
 <?php endif ?>
15
-<?php if(count($result['messages']) > 0): ?>
15
+<?php if (count($result['messages']) > 0): ?>
16 16
                 <div class="panel panel-info">
17 17
                     <div class="panel-heading">
18 18
                         <?php echo $result['query'] ?>
19 19
                     </div>
20 20
                     <div class="panel-body" style="padding:5px 15px">
21
-<?php foreach($result['messages'] as $message): ?>
21
+<?php foreach ($result['messages'] as $message): ?>
22 22
                         <p style="margin:0"><?php echo $message ?></p>
23 23
 <?php endforeach ?>
24 24
                     </div>
25 25
                 </div>
26 26
 <?php endif ?>
27 27
 
28
-<?php if(($result['select'])): ?>
28
+<?php if (($result['select'])): ?>
29 29
                 <div class="table-responsive">
30 30
                     <table class="table table-bordered">
31 31
                         <thead>
32 32
                             <tr>
33
-<?php foreach($result['select']['headers'] as $header): ?>
33
+<?php foreach ($result['select']['headers'] as $header): ?>
34 34
                                 <th><?php echo $header ?></th>
35 35
 <?php endforeach ?>
36 36
                             </tr>
37 37
                         </thead>
38 38
                         <tbody>
39
-<?php foreach($result['select']['details'] as $details): ?>
39
+<?php foreach ($result['select']['details'] as $details): ?>
40 40
                             <tr>
41
-<?php foreach($details as $detail): ?>
41
+<?php foreach ($details as $detail): ?>
42 42
                                 <td><?php echo $detail ?></td>
43 43
 <?php endforeach ?>
44 44
                             </tr>
Please login to merge, or discard this patch.
translations/gl.inc.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -273,7 +273,7 @@
 block discarded – undo
273 273
     'Modify' => 'Modificar',
274 274
     'Loading' => 'Cargando',
275 275
     'Load more data' => 'Cargar máis datos',
276
-    '%d / ' => array('%d / ','%d / '),
276
+    '%d / ' => array('%d / ', '%d / '),
277 277
     'Limit rows' => 'Limitar filas',
278 278
     'Default value' => 'Valor por defecto',
279 279
     'Full table scan' => 'Escaneo completo da táboa',
Please login to merge, or discard this patch.
src/DbAdmin/TableSelectAdmin.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     {
23 23
         return [
24 24
             'select' => $select,
25
-            'values' => (array)$options["columns"],
25
+            'values' => (array) $options["columns"],
26 26
             'columns' => $columns,
27 27
             'functions' => $this->driver->functions(),
28 28
             'grouping' => $this->driver->grouping(),
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
         }
46 46
         return [
47 47
             // 'where' => $where,
48
-            'values' => (array)$options["where"],
48
+            'values' => (array) $options["where"],
49 49
             'columns' => $columns,
50 50
             'indexes' => $indexes,
51 51
             'operators' => $this->driver->operators(),
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
     private function getSortingOptions(array $order, array $columns, array $indexes, array $options)
65 65
     {
66 66
         $values = [];
67
-        $descs = (array)$options["desc"];
68
-        foreach ((array)$options["order"] as $key => $value) {
67
+        $descs = (array) $options["desc"];
68
+        foreach ((array) $options["order"] as $key => $value) {
69 69
             $values[] = [
70 70
                 'col' => $value,
71 71
                 'desc' => $descs[$key] ?? 0,
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
                     \preg_match('~char|text|enum|set~', $type) && strlen($value) > 64) {
441 441
                     $key = (\strpos($key, '(') ? $key : $this->driver->escapeId($key)); //! columns looking like functions
442 442
                     $key = "MD5(" . ($this->driver->jush() != 'sql' || \preg_match("~^utf8~", $collation) ?
443
-                        $key : "CONVERT($key USING " . $this->driver−>charset() . ")") . ")";
443
+                        $key : "CONVERT($key USING " . $this->driver− > charset() . ")") . ")";
444 444
                     $value = \md5($value);
445 445
                 }
446 446
                 if ($value !== null) {
Please login to merge, or discard this patch.
src/DbAdmin/ExportAdmin.php 1 patch
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -239,8 +239,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
                         }
Please login to merge, or discard this patch.
src/DbAdmin/TableAdmin.php 1 patch
Spacing   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -273,14 +273,14 @@  discard block
 block discarded – undo
273 273
                 $target .= '<b>' . $this->util->html($foreignKey->schema) . '</b>.';
274 274
             }
275 275
             $target = $this->util->html($foreignKey->table) .
276
-                '(' . \implode(', ', \array_map(function ($key) {
276
+                '(' . \implode(', ', \array_map(function($key) {
277 277
                     return $this->util->html($key);
278 278
                 }, $foreignKey->target)) . ')';
279 279
             $details[] = [
280 280
                 'name' => $this->util->html($name),
281 281
                 'source' => '<i>' . \implode(
282 282
                     '</i>, <i>',
283
-                    \array_map(function ($key) {
283
+                    \array_map(function($key) {
284 284
                         return $this->util->html($key);
285 285
                     }, $foreignKey->source)
286 286
                 ) . '</i>',
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
     private function createOrAlterTable(array $values, string $table = '', array $origFields = [])
465 465
     {
466 466
         // From create.inc.php
467
-        $values['fields'] = (array)$values['fields'];
467
+        $values['fields'] = (array) $values['fields'];
468 468
         if ($values['autoIncrementCol']) {
469 469
             $values['fields'][$values['autoIncrementCol']]['autoIncrement'] = true;
470 470
         }
@@ -483,8 +483,7 @@  discard block
 block discarded – undo
483 483
             $field = TableFieldEntity::make($field);
484 484
             $foreignKey = $this->foreignKeys[$field->type] ?? null;
485 485
             //! can collide with user defined type
486
-            $typeField = ($foreignKey === null ? $field :
487
-                TableFieldEntity::make($this->referencableTables[$foreignKey]));
486
+            $typeField = ($foreignKey === null ? $field : TableFieldEntity::make($this->referencableTables[$foreignKey]));
488 487
             // Originally, deleted fields have the "field" field set to an empty string.
489 488
             // But in our implementation, the "name" field is not set.
490 489
             if ($field->name != '') {
Please login to merge, or discard this patch.
src/DbAdmin/UserAdmin.php 1 patch
Spacing   +4 added lines, -6 removed lines patch added patch discarded remove patch
@@ -60,8 +60,7 @@  discard block
 block discarded – undo
60 60
         foreach ($grants as $object => $grant) {
61 61
             //! separate db, table, columns, PROCEDURE|FUNCTION, routine
62 62
             $headers[] = $object === '*.*' ?
63
-                '<input type="hidden" name="objects[' . $i . ']" value="*.*" />*.*' :
64
-                '<input name="objects[' . $i . ']" value="' . $this->util->html($object) . '" autocapitalize="off" />';
63
+                '<input type="hidden" name="objects[' . $i . ']" value="*.*" />*.*' : '<input name="objects[' . $i . ']" value="' . $this->util->html($object) . '" autocapitalize="off" />';
65 64
             $i++;
66 65
         }
67 66
 
@@ -116,8 +115,7 @@  discard block
 block discarded – undo
116 115
         foreach ($grants as $object => $grant) {
117 116
             //! separate db, table, columns, PROCEDURE|FUNCTION, routine
118 117
             $headers[] = $object === '*.*' ?
119
-                '<input type="hidden" name="objects[' . $i . ']" value="*.*" />*.*' :
120
-                '<input name="objects[' . $i . ']" value="' .
118
+                '<input type="hidden" name="objects[' . $i . ']" value="*.*" />*.*' : '<input name="objects[' . $i . ']" value="' .
121 119
                     $this->util->html($object) . '" autocapitalize="off" />';
122 120
             $i++;
123 121
         }
@@ -135,11 +133,11 @@  discard block
 block discarded – undo
135 133
             ],
136 134
             'pass' => [
137 135
                 'label' => $this->trans->lang('Password'),
138
-                'value' => $password ,
136
+                'value' => $password,
139 137
             ],
140 138
             'hashed' => [
141 139
                 'label' => $this->trans->lang('Hashed'),
142
-                'value' => ($password  != ''),
140
+                'value' => ($password != ''),
143 141
             ],
144 142
         ];
145 143
 
Please login to merge, or discard this patch.
src/DbAdmin/CommandAdmin.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
      * @param int
44 44
      *
45 45
      * @return array
46
-    */
46
+     */
47 47
     protected function select($statement, $orgtables = [], $limit = 0)
48 48
     {
49 49
         $links = []; // colno => orgtable - create links from these columns
Please login to merge, or discard this patch.
Spacing   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -96,8 +96,7 @@  discard block
 block discarded – undo
96 96
         if ($rowCount > 0) {
97 97
             $numRows = $statement->rowCount();
98 98
             $message = ($numRows ? ($limit && $numRows > $limit ?
99
-                $this->trans->lang('%d / ', $limit) :
100
-                "") . $this->trans->lang('%d row(s)', $numRows) : "");
99
+                $this->trans->lang('%d / ', $limit) : "") . $this->trans->lang('%d row(s)', $numRows) : "");
101 100
         }
102 101
 
103 102
         // Table header
@@ -179,9 +178,7 @@  discard block
 block discarded – undo
179 178
         $timestamps = [];
180 179
         // TODO: Move this to driver implementations
181 180
         $parse = '[\'"' .
182
-            ($this->driver->jush() == "sql" ? '`#' :
183
-            ($this->driver->jush() == "sqlite" ? '`[' :
184
-            ($this->driver->jush() == "mssql" ? '[' : ''))) . ']|/\*|-- |$' .
181
+            ($this->driver->jush() == "sql" ? '`#' : ($this->driver->jush() == "sqlite" ? '`[' : ($this->driver->jush() == "mssql" ? '[' : ''))) . ']|/\*|-- |$' .
185 182
             ($this->driver->jush() == "pgsql" ? '|\$[^$]*\$' : '');
186 183
         // $total_start = \microtime(true);
187 184
         // \parse_str($_COOKIE["adminer_export"], $adminer_export);
@@ -207,8 +204,7 @@  discard block
 block discarded – undo
207 204
 
208 205
             if ($found && \rtrim($found) != $delimiter) {
209 206
                 // find matching quote or comment end
210
-                while (\preg_match('(' . ($found == '/*' ? '\*/' : ($found == '[' ? ']' :
211
-                    (\preg_match('~^-- |^#~', $found) ? "\n" : \preg_quote($found) .
207
+                while (\preg_match('(' . ($found == '/*' ? '\*/' : ($found == '[' ? ']' : (\preg_match('~^-- |^#~', $found) ? "\n" : \preg_quote($found) .
212 208
                     "|\\\\."))) . '|$)s', $queries, $match, PREG_OFFSET_CAPTURE, $offset)) {
213 209
                     //! respect sql_mode NO_BACKSLASH_ESCAPES
214 210
                     $s = $match[0][0];
@@ -303,7 +299,7 @@  discard block
 block discarded – undo
303 299
         if ($empty) {
304 300
             $messages[] = $this->trans->lang('No commands to execute.');
305 301
         } elseif ($onlyErrors) {
306
-            $messages[] =  $this->trans->lang('%d query(s) executed OK.', $commands - \count($errors));
302
+            $messages[] = $this->trans->lang('%d query(s) executed OK.', $commands - \count($errors));
307 303
             // $timestamps[] = $this->trans->formatTime($total_start);
308 304
         }
309 305
         // elseif($errors && $commands > 1)
Please login to merge, or discard this patch.
src/DbAdmin/TableQueryAdmin.php 1 patch
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -101,8 +101,7 @@  discard block
 block discarded – undo
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
             }
@@ -261,7 +260,7 @@  discard block
 block discarded – undo
261 260
                 }
262 261
                 $function = (
263 262
                     $queryOptions["save"]
264
-                    ? (string)$queryOptions["function"][$name]
263
+                    ? (string) $queryOptions["function"][$name]
265 264
                     : (
266 265
                         $update && \preg_match('~^CURRENT_TIMESTAMP~i', $field->onUpdate)
267 266
                         ? "now"
Please login to merge, or discard this patch.