@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | */ |
6 | 6 | require_once './src/lib.inc.php'; |
7 | 7 | |
8 | -$app->post('/redirect[/{subject}]', function ($request, $response, $args) { |
|
8 | +$app->post('/redirect[/{subject}]', function($request, $response, $args) { |
|
9 | 9 | $body = $response->getBody(); |
10 | 10 | $query_string = $request->getUri()->getQuery(); |
11 | 11 | $misc = $this->misc; |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | $loginShared = $request->getParsedBodyParam('loginShared'); |
14 | 14 | $loginServer = $request->getParsedBodyParam('loginServer'); |
15 | 15 | $loginUsername = $request->getParsedBodyParam('loginUsername'); |
16 | - $loginPassword = $request->getParsedBodyParam('loginPassword_'.md5($loginServer)); |
|
16 | + $loginPassword = $request->getParsedBodyParam('loginPassword_' . md5($loginServer)); |
|
17 | 17 | |
18 | 18 | // If login action is set, then set session variables |
19 | 19 | if (boolval($loginServer) && boolval($loginUsername) && $loginPassword !== null) { |
@@ -53,47 +53,47 @@ discard block |
||
53 | 53 | } |
54 | 54 | }); |
55 | 55 | |
56 | -$app->get('/redirect[/{subject}]', function ($request, $response, $args) { |
|
56 | +$app->get('/redirect[/{subject}]', function($request, $response, $args) { |
|
57 | 57 | $subject = (isset($args['subject'])) ? $args['subject'] : 'root'; |
58 | 58 | $destinationurl = $this->utils->getDestinationWithLastTab($subject); |
59 | 59 | |
60 | 60 | return $response->withStatus(302)->withHeader('Location', $destinationurl); |
61 | 61 | }); |
62 | 62 | |
63 | -$app->get('/src/views/browser', function ($request, $response, $args) { |
|
63 | +$app->get('/src/views/browser', function($request, $response, $args) { |
|
64 | 64 | $controller = new \PHPPgAdmin\Controller\BrowserController($this, true); |
65 | 65 | |
66 | 66 | return $controller->render(); |
67 | 67 | }); |
68 | 68 | |
69 | -$app->get('/src/views/login', function ($request, $response, $args) { |
|
69 | +$app->get('/src/views/login', function($request, $response, $args) { |
|
70 | 70 | $controller = new \PHPPgAdmin\Controller\LoginController($this, true); |
71 | 71 | |
72 | 72 | return $controller->render(); |
73 | 73 | }); |
74 | 74 | |
75 | -$app->get('/src/views/servers', function ($request, $response, $args) { |
|
75 | +$app->get('/src/views/servers', function($request, $response, $args) { |
|
76 | 76 | $controller = new \PHPPgAdmin\Controller\ServersController($this, true); |
77 | 77 | |
78 | 78 | return $controller->render(); |
79 | 79 | }); |
80 | 80 | |
81 | -$app->get('/src/views/intro', function ($request, $response, $args) { |
|
81 | +$app->get('/src/views/intro', function($request, $response, $args) { |
|
82 | 82 | $controller = new \PHPPgAdmin\Controller\IntroController($this, true); |
83 | 83 | |
84 | 84 | return $controller->render(); |
85 | 85 | }); |
86 | 86 | |
87 | -$app->map(['GET', 'POST'], '/src/views/{subject}', function ($request, $response, $args) { |
|
87 | +$app->map(['GET', 'POST'], '/src/views/{subject}', function($request, $response, $args) { |
|
88 | 88 | $subject = $args['subject']; |
89 | 89 | |
90 | - $className = '\PHPPgAdmin\Controller\\'.ucfirst($subject).'Controller'; |
|
90 | + $className = '\PHPPgAdmin\Controller\\' . ucfirst($subject) . 'Controller'; |
|
91 | 91 | $controller = new $className($this); |
92 | 92 | |
93 | 93 | return $controller->render(); |
94 | 94 | }); |
95 | 95 | |
96 | -$app->get('/[{subject}]', function ($request, $response, $args) { |
|
96 | +$app->get('/[{subject}]', function($request, $response, $args) { |
|
97 | 97 | $subject = (isset($args['subject'])) ? $args['subject'] : 'intro'; |
98 | 98 | $_server_info = $this->misc->getServerInfo(); |
99 | 99 | $query_string = $request->getUri()->getQuery(); |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | } |
109 | 109 | |
110 | 110 | $viewVars = [ |
111 | - 'url' => '/src/views/'.$subject.($query_string ? '?'.$query_string : ''), |
|
111 | + 'url' => '/src/views/' . $subject . ($query_string ? '?' . $query_string : ''), |
|
112 | 112 | 'headertemplate' => 'header.twig', |
113 | 113 | ]; |
114 | 114 |
@@ -322,7 +322,7 @@ |
||
322 | 322 | |
323 | 323 | // toggle cycle yes/no |
324 | 324 | if (!is_null($cycledvalue)) { |
325 | - $sql .= (!$cycledvalue ? ' NO ' : '').' CYCLE'; |
|
325 | + $sql .= (!$cycledvalue ? ' NO ' : '') . ' CYCLE'; |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | if ($sql != '') { |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | // Ignore host if null |
37 | 37 | if ($host === null || $host == '') { |
38 | 38 | if ($port !== null && $port != '') { |
39 | - $pghost = ':'.$port; |
|
39 | + $pghost = ':' . $port; |
|
40 | 40 | } else { |
41 | 41 | $pghost = ''; |
42 | 42 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | // Add sslmode to $pghost as needed |
48 | 48 | if (($sslmode == 'disable') || ($sslmode == 'allow') || ($sslmode == 'prefer') || ($sslmode == 'require')) { |
49 | - $pghost .= ':'.$sslmode; |
|
49 | + $pghost .= ':' . $sslmode; |
|
50 | 50 | } elseif ($sslmode == 'legacy') { |
51 | 51 | $pghost .= ' requiressl=1'; |
52 | 52 | } |
@@ -251,13 +251,13 @@ |
||
251 | 251 | |
252 | 252 | if (is_array($definition)) { |
253 | 253 | $this->arrayClean($definition); |
254 | - $sql .= "'".$definition[0]."'"; |
|
254 | + $sql .= "'" . $definition[0] . "'"; |
|
255 | 255 | if ($definition[1]) { |
256 | - $sql .= ",'".$definition[1]."'"; |
|
256 | + $sql .= ",'" . $definition[1] . "'"; |
|
257 | 257 | } |
258 | 258 | } else { |
259 | 259 | $this->clean($definition); |
260 | - $sql .= "'".$definition."'"; |
|
260 | + $sql .= "'" . $definition . "'"; |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | $sql .= " LANGUAGE \"{$language}\""; |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | $values = ") VALUES ('{$value}'"; |
236 | 236 | } |
237 | 237 | } |
238 | - $sql = $fields.$values.')'; |
|
238 | + $sql = $fields . $values . ')'; |
|
239 | 239 | } |
240 | 240 | |
241 | 241 | // Check for failures |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | } |
305 | 305 | |
306 | 306 | // Check for failures |
307 | - if (!$this->conn->Execute($setClause.$whereClause)) { |
|
307 | + if (!$this->conn->Execute($setClause . $whereClause)) { |
|
308 | 308 | // Check for unique constraint failure |
309 | 309 | if (stristr($this->conn->ErrorMsg(), 'unique')) { |
310 | 310 | return -1; |
@@ -269,13 +269,13 @@ discard block |
||
269 | 269 | if (is_array($this->help_page[$help])) { |
270 | 270 | $urls = []; |
271 | 271 | foreach ($this->help_page[$help] as $link) { |
272 | - $urls[] = $this->help_base.$link; |
|
272 | + $urls[] = $this->help_base . $link; |
|
273 | 273 | } |
274 | 274 | |
275 | 275 | return $urls; |
276 | 276 | } |
277 | 277 | |
278 | - return $this->help_base.$this->help_page[$help]; |
|
278 | + return $this->help_base . $this->help_page[$help]; |
|
279 | 279 | } else { |
280 | 280 | return; |
281 | 281 | } |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | public function getHelpPages() |
289 | 289 | { |
290 | 290 | if ($this->help_page === null || $this->help_base === null) { |
291 | - $help_classname = '\PHPPgAdmin\Help\PostgresDoc'.str_replace('.', '', $this->major_version); |
|
291 | + $help_classname = '\PHPPgAdmin\Help\PostgresDoc' . str_replace('.', '', $this->major_version); |
|
292 | 292 | |
293 | 293 | $help_class = new $help_classname($this->conf, $this->major_version); |
294 | 294 | |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | // Determine actions string |
315 | 315 | $extra_str = ''; |
316 | 316 | foreach ($extras as $k => $v) { |
317 | - $extra_str .= " {$k}=\"".htmlspecialchars($v).'"'; |
|
317 | + $extra_str .= " {$k}=\"" . htmlspecialchars($v) . '"'; |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | switch (substr($type, 0, 9)) { |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | |
445 | 445 | if (isset($server_info['hiddendbs']) && $server_info['hiddendbs']) { |
446 | 446 | $hiddendbs = $server_info['hiddendbs']; |
447 | - $not_in = "('".implode("','", $hiddendbs)."')"; |
|
447 | + $not_in = "('" . implode("','", $hiddendbs) . "')"; |
|
448 | 448 | $clause .= " AND pdb.datname NOT IN {$not_in} "; |
449 | 449 | } |
450 | 450 | |
@@ -1107,7 +1107,7 @@ discard block |
||
1107 | 1107 | } |
1108 | 1108 | $this->fieldArrayClean($temp); |
1109 | 1109 | |
1110 | - $sql = 'SET SEARCH_PATH TO "'.implode('","', $temp).'"'; |
|
1110 | + $sql = 'SET SEARCH_PATH TO "' . implode('","', $temp) . '"'; |
|
1111 | 1111 | |
1112 | 1112 | return $this->execute($sql); |
1113 | 1113 | } |
@@ -1408,7 +1408,7 @@ discard block |
||
1408 | 1408 | } |
1409 | 1409 | |
1410 | 1410 | // Output a reconnect command to create the table as the correct user |
1411 | - $sql = $this->getChangeUserSQL($t->fields['relowner'])."\n\n"; |
|
1411 | + $sql = $this->getChangeUserSQL($t->fields['relowner']) . "\n\n"; |
|
1412 | 1412 | |
1413 | 1413 | // Set schema search path |
1414 | 1414 | $sql .= "SET search_path = \"{$t->fields['nspname']}\", pg_catalog;\n\n"; |
@@ -1441,7 +1441,7 @@ discard block |
||
1441 | 1441 | $sql .= ' BIGSERIAL'; |
1442 | 1442 | } |
1443 | 1443 | } else { |
1444 | - $sql .= ' '.$this->formatType($atts->fields['type'], $atts->fields['atttypmod']); |
|
1444 | + $sql .= ' ' . $this->formatType($atts->fields['type'], $atts->fields['atttypmod']); |
|
1445 | 1445 | |
1446 | 1446 | // Add NOT NULL if necessary |
1447 | 1447 | if ($this->phpBool($atts->fields['attnotnull'])) { |
@@ -1481,11 +1481,11 @@ discard block |
||
1481 | 1481 | switch ($cons->fields['contype']) { |
1482 | 1482 | case 'p': |
1483 | 1483 | $keys = $this->getAttributeNames($table, explode(' ', $cons->fields['indkey'])); |
1484 | - $sql .= 'PRIMARY KEY ('.implode(',', $keys).')'; |
|
1484 | + $sql .= 'PRIMARY KEY (' . implode(',', $keys) . ')'; |
|
1485 | 1485 | break; |
1486 | 1486 | case 'u': |
1487 | 1487 | $keys = $this->getAttributeNames($table, explode(' ', $cons->fields['indkey'])); |
1488 | - $sql .= 'UNIQUE ('.implode(',', $keys).')'; |
|
1488 | + $sql .= 'UNIQUE (' . implode(',', $keys) . ')'; |
|
1489 | 1489 | break; |
1490 | 1490 | default: |
1491 | 1491 | // Unrecognised constraint |
@@ -1629,7 +1629,7 @@ discard block |
||
1629 | 1629 | } |
1630 | 1630 | |
1631 | 1631 | // Output privileges with no GRANT OPTION |
1632 | - $sql .= 'GRANT '.implode(', ', $nongrant)." ON TABLE \"{$t->fields['relname']}\" TO "; |
|
1632 | + $sql .= 'GRANT ' . implode(', ', $nongrant) . " ON TABLE \"{$t->fields['relname']}\" TO "; |
|
1633 | 1633 | switch ($v[0]) { |
1634 | 1634 | case 'public': |
1635 | 1635 | $sql .= "PUBLIC;\n"; |
@@ -1668,7 +1668,7 @@ discard block |
||
1668 | 1668 | $sql .= "SET SESSION AUTHORIZATION '{$grantor}';\n"; |
1669 | 1669 | } |
1670 | 1670 | |
1671 | - $sql .= 'GRANT '.implode(', ', $v[4])." ON \"{$t->fields['relname']}\" TO "; |
|
1671 | + $sql .= 'GRANT ' . implode(', ', $v[4]) . " ON \"{$t->fields['relname']}\" TO "; |
|
1672 | 1672 | switch ($v[0]) { |
1673 | 1673 | case 'public': |
1674 | 1674 | $sql .= 'PUBLIC'; |
@@ -1908,7 +1908,7 @@ discard block |
||
1908 | 1908 | } elseif ($typname == 'varchar') { |
1909 | 1909 | $temp = 'character varying'; |
1910 | 1910 | if ($typmod != -1) { |
1911 | - $temp .= '('.($typmod - $varhdrsz).')'; |
|
1911 | + $temp .= '(' . ($typmod - $varhdrsz) . ')'; |
|
1912 | 1912 | } |
1913 | 1913 | } elseif ($typname == 'numeric') { |
1914 | 1914 | $temp = 'numeric'; |
@@ -1959,7 +1959,7 @@ discard block |
||
1959 | 1959 | $sql = "SELECT attnum, attname FROM pg_catalog.pg_attribute WHERE |
1960 | 1960 | attrelid=(SELECT oid FROM pg_catalog.pg_class WHERE relname='{$table}' AND |
1961 | 1961 | relnamespace=(SELECT oid FROM pg_catalog.pg_namespace WHERE nspname='{$c_schema}')) |
1962 | - AND attnum IN ('".implode("','", $atts)."')"; |
|
1962 | + AND attnum IN ('" . implode("','", $atts) . "')"; |
|
1963 | 1963 | |
1964 | 1964 | $rs = $this->selectSet($sql); |
1965 | 1965 | if ($rs->recordCount() != count($atts)) { |
@@ -2261,7 +2261,7 @@ discard block |
||
2261 | 2261 | if ($indexes->recordCount() > 0) { |
2262 | 2262 | $sql .= "\n-- Indexes\n\n"; |
2263 | 2263 | while (!$indexes->EOF) { |
2264 | - $sql .= $indexes->fields['inddef'].";\n"; |
|
2264 | + $sql .= $indexes->fields['inddef'] . ";\n"; |
|
2265 | 2265 | |
2266 | 2266 | $indexes->moveNext(); |
2267 | 2267 | } |
@@ -2296,7 +2296,7 @@ discard block |
||
2296 | 2296 | if ($rules->recordCount() > 0) { |
2297 | 2297 | $sql .= "\n-- Rules\n\n"; |
2298 | 2298 | while (!$rules->EOF) { |
2299 | - $sql .= $rules->fields['definition']."\n"; |
|
2299 | + $sql .= $rules->fields['definition'] . "\n"; |
|
2300 | 2300 | |
2301 | 2301 | $rules->moveNext(); |
2302 | 2302 | } |
@@ -2524,7 +2524,7 @@ discard block |
||
2524 | 2524 | } |
2525 | 2525 | } |
2526 | 2526 | if (count($primarykeycolumns) > 0) { |
2527 | - $sql .= ', PRIMARY KEY ('.implode(', ', $primarykeycolumns).')'; |
|
2527 | + $sql .= ', PRIMARY KEY (' . implode(', ', $primarykeycolumns) . ')'; |
|
2528 | 2528 | } |
2529 | 2529 | |
2530 | 2530 | $sql .= ')'; |
@@ -2945,7 +2945,7 @@ discard block |
||
2945 | 2945 | |
2946 | 2946 | // DEFAULT clause |
2947 | 2947 | if ($default != '') { |
2948 | - $sql .= ' DEFAULT '.$default; |
|
2948 | + $sql .= ' DEFAULT ' . $default; |
|
2949 | 2949 | } |
2950 | 2950 | } |
2951 | 2951 | |
@@ -3038,7 +3038,7 @@ discard block |
||
3038 | 3038 | $toAlter = []; |
3039 | 3039 | // Create the command for changing nullability |
3040 | 3040 | if ($notnull != $oldnotnull) { |
3041 | - $toAlter[] = "ALTER COLUMN \"{$name}\" ".($notnull ? 'SET' : 'DROP').' NOT NULL'; |
|
3041 | + $toAlter[] = "ALTER COLUMN \"{$name}\" " . ($notnull ? 'SET' : 'DROP') . ' NOT NULL'; |
|
3042 | 3042 | } |
3043 | 3043 | |
3044 | 3044 | // Add default, if it has changed |
@@ -3165,7 +3165,7 @@ discard block |
||
3165 | 3165 | $this->fieldClean($table); |
3166 | 3166 | $this->fieldClean($column); |
3167 | 3167 | |
3168 | - $sql = "ALTER TABLE \"{$f_schema}\".\"{$table}\" ALTER COLUMN \"{$column}\" ".($state ? 'DROP' : 'SET').' NOT NULL'; |
|
3168 | + $sql = "ALTER TABLE \"{$f_schema}\".\"{$table}\" ALTER COLUMN \"{$column}\" " . ($state ? 'DROP' : 'SET') . ' NOT NULL'; |
|
3169 | 3169 | |
3170 | 3170 | return $this->execute($sql); |
3171 | 3171 | } |
@@ -3284,7 +3284,7 @@ discard block |
||
3284 | 3284 | |
3285 | 3285 | // Actually retrieve the rows |
3286 | 3286 | if ($oids) { |
3287 | - $oid_str = $this->id.', '; |
|
3287 | + $oid_str = $this->id . ', '; |
|
3288 | 3288 | } else { |
3289 | 3289 | $oid_str = ''; |
3290 | 3290 | } |
@@ -3446,12 +3446,12 @@ discard block |
||
3446 | 3446 | if (isset($nulls[$i])) { |
3447 | 3447 | $sql .= ',NULL'; |
3448 | 3448 | } else { |
3449 | - $sql .= ','.$this->formatValue($types[$i], $format[$i], $value); |
|
3449 | + $sql .= ',' . $this->formatValue($types[$i], $format[$i], $value); |
|
3450 | 3450 | } |
3451 | 3451 | } |
3452 | 3452 | |
3453 | - $sql = "INSERT INTO \"{$f_schema}\".\"{$table}\" (\"".implode('","', $fields).'") |
|
3454 | - VALUES ('.substr($sql, 1).')'; |
|
3453 | + $sql = "INSERT INTO \"{$f_schema}\".\"{$table}\" (\"" . implode('","', $fields) . '") |
|
3454 | + VALUES ('.substr($sql, 1) . ')'; |
|
3455 | 3455 | |
3456 | 3456 | return $this->execute($sql); |
3457 | 3457 | } |
@@ -4067,7 +4067,7 @@ discard block |
||
4067 | 4067 | |
4068 | 4068 | // toggle cycle yes/no |
4069 | 4069 | if (!is_null($cycledvalue)) { |
4070 | - $sql .= (!$cycledvalue ? ' NO ' : '').' CYCLE'; |
|
4070 | + $sql .= (!$cycledvalue ? ' NO ' : '') . ' CYCLE'; |
|
4071 | 4071 | } |
4072 | 4072 | |
4073 | 4073 | if ($sql != '') { |
@@ -4529,9 +4529,9 @@ discard block |
||
4529 | 4529 | |
4530 | 4530 | if (is_array($columns)) { |
4531 | 4531 | $this->arrayClean($columns); |
4532 | - $sql .= '("'.implode('","', $columns).'")'; |
|
4532 | + $sql .= '("' . implode('","', $columns) . '")'; |
|
4533 | 4533 | } else { |
4534 | - $sql .= '('.$columns.')'; |
|
4534 | + $sql .= '(' . $columns . ')'; |
|
4535 | 4535 | } |
4536 | 4536 | |
4537 | 4537 | // Tablespace |
@@ -4731,7 +4731,7 @@ discard block |
||
4731 | 4731 | $sql .= "CONSTRAINT \"{$name}\" "; |
4732 | 4732 | } |
4733 | 4733 | |
4734 | - $sql .= 'PRIMARY KEY ("'.implode('","', $fields).'")'; |
|
4734 | + $sql .= 'PRIMARY KEY ("' . implode('","', $fields) . '")'; |
|
4735 | 4735 | |
4736 | 4736 | if ($tablespace != '' && $this->hasTablespaces()) { |
4737 | 4737 | $sql .= " USING INDEX TABLESPACE \"{$tablespace}\""; |
@@ -4768,7 +4768,7 @@ discard block |
||
4768 | 4768 | $sql .= "CONSTRAINT \"{$name}\" "; |
4769 | 4769 | } |
4770 | 4770 | |
4771 | - $sql .= 'UNIQUE ("'.implode('","', $fields).'")'; |
|
4771 | + $sql .= 'UNIQUE ("' . implode('","', $fields) . '")'; |
|
4772 | 4772 | |
4773 | 4773 | if ($tablespace != '' && $this->hasTablespaces()) { |
4774 | 4774 | $sql .= " USING INDEX TABLESPACE \"{$tablespace}\""; |
@@ -4920,9 +4920,9 @@ discard block |
||
4920 | 4920 | $sql .= "CONSTRAINT \"{$name}\" "; |
4921 | 4921 | } |
4922 | 4922 | |
4923 | - $sql .= 'FOREIGN KEY ("'.implode('","', $sfields).'") '; |
|
4923 | + $sql .= 'FOREIGN KEY ("' . implode('","', $sfields) . '") '; |
|
4924 | 4924 | // Target table needs to be fully qualified |
4925 | - $sql .= "REFERENCES \"{$targschema}\".\"{$targtable}\"(\"".implode('","', $tfields).'") '; |
|
4925 | + $sql .= "REFERENCES \"{$targschema}\".\"{$targtable}\"(\"" . implode('","', $tfields) . '") '; |
|
4926 | 4926 | if ($match != $this->fkmatches[0]) { |
4927 | 4927 | $sql .= " {$match}"; |
4928 | 4928 | } |
@@ -5611,13 +5611,13 @@ discard block |
||
5611 | 5611 | |
5612 | 5612 | if (is_array($definition)) { |
5613 | 5613 | $this->arrayClean($definition); |
5614 | - $sql .= "'".$definition[0]."'"; |
|
5614 | + $sql .= "'" . $definition[0] . "'"; |
|
5615 | 5615 | if ($definition[1]) { |
5616 | - $sql .= ",'".$definition[1]."'"; |
|
5616 | + $sql .= ",'" . $definition[1] . "'"; |
|
5617 | 5617 | } |
5618 | 5618 | } else { |
5619 | 5619 | $this->clean($definition); |
5620 | - $sql .= "'".$definition."'"; |
|
5620 | + $sql .= "'" . $definition . "'"; |
|
5621 | 5621 | } |
5622 | 5622 | |
5623 | 5623 | $sql .= " LANGUAGE \"{$language}\""; |
@@ -6393,7 +6393,7 @@ discard block |
||
6393 | 6393 | // Split on escaped null characters |
6394 | 6394 | $params = explode('\\000', $v); |
6395 | 6395 | for ($findx = 0; $findx < $trigger['tgnargs']; $findx++) { |
6396 | - $param = "'".str_replace('\'', '\\\'', $params[$findx])."'"; |
|
6396 | + $param = "'" . str_replace('\'', '\\\'', $params[$findx]) . "'"; |
|
6397 | 6397 | $tgdef .= $param; |
6398 | 6398 | if ($findx < ($trigger['tgnargs'] - 1)) { |
6399 | 6399 | $tgdef .= ', '; |
@@ -6625,13 +6625,13 @@ discard block |
||
6625 | 6625 | $sql = "DROP OPERATOR \"{$f_schema}\".{$opr->fields['oprname']} ("; |
6626 | 6626 | // Quoting or formatting here??? |
6627 | 6627 | if ($opr->fields['oprleftname'] !== null) { |
6628 | - $sql .= $opr->fields['oprleftname'].', '; |
|
6628 | + $sql .= $opr->fields['oprleftname'] . ', '; |
|
6629 | 6629 | } else { |
6630 | 6630 | $sql .= 'NONE, '; |
6631 | 6631 | } |
6632 | 6632 | |
6633 | 6633 | if ($opr->fields['oprrightname'] !== null) { |
6634 | - $sql .= $opr->fields['oprrightname'].')'; |
|
6634 | + $sql .= $opr->fields['oprrightname'] . ')'; |
|
6635 | 6635 | } else { |
6636 | 6636 | $sql .= 'NONE)'; |
6637 | 6637 | } |
@@ -7459,11 +7459,11 @@ discard block |
||
7459 | 7459 | FROM pg_catalog.pg_proc p, pg_catalog.pg_namespace n, pg_catalog.pg_user u, pg_catalog.pg_aggregate a |
7460 | 7460 | WHERE n.oid = p.pronamespace AND p.proowner=u.usesysid AND p.oid=a.aggfnoid |
7461 | 7461 | AND p.proisagg AND n.nspname='{$c_schema}' |
7462 | - AND p.proname='".$name."' |
|
7462 | + AND p.proname='" . $name . "' |
|
7463 | 7463 | AND CASE p.proargtypes[0] |
7464 | 7464 | WHEN 'pg_catalog.\"any\"'::pg_catalog.regtype THEN '' |
7465 | 7465 | ELSE pg_catalog.format_type(p.proargtypes[0], NULL) |
7466 | - END ='".$basetype."'"; |
|
7466 | + END ='".$basetype . "'"; |
|
7467 | 7467 | |
7468 | 7468 | return $this->selectSet($sql); |
7469 | 7469 | } |
@@ -7620,7 +7620,7 @@ discard block |
||
7620 | 7620 | public function renameAggregate($aggrschema, $aggrname, $aggrtype, $newaggrname) |
7621 | 7621 | { |
7622 | 7622 | /* this function is called from alterAggregate where params are cleaned */ |
7623 | - $sql = "ALTER AGGREGATE \"{$aggrschema}\"".'.'."\"{$aggrname}\" (\"{$aggrtype}\") RENAME TO \"{$newaggrname}\""; |
|
7623 | + $sql = "ALTER AGGREGATE \"{$aggrschema}\"" . '.' . "\"{$aggrname}\" (\"{$aggrtype}\") RENAME TO \"{$newaggrname}\""; |
|
7624 | 7624 | |
7625 | 7625 | return $this->execute($sql); |
7626 | 7626 | } |
@@ -7762,15 +7762,15 @@ discard block |
||
7762 | 7762 | } |
7763 | 7763 | |
7764 | 7764 | if (is_array($memberof) && count($memberof) > 0) { |
7765 | - $sql .= ' IN ROLE "'.implode('", "', $memberof).'"'; |
|
7765 | + $sql .= ' IN ROLE "' . implode('", "', $memberof) . '"'; |
|
7766 | 7766 | } |
7767 | 7767 | |
7768 | 7768 | if (is_array($members) && count($members) > 0) { |
7769 | - $sql .= ' ROLE "'.implode('", "', $members).'"'; |
|
7769 | + $sql .= ' ROLE "' . implode('", "', $members) . '"'; |
|
7770 | 7770 | } |
7771 | 7771 | |
7772 | 7772 | if (is_array($adminmembers) && count($adminmembers) > 0) { |
7773 | - $sql .= ' ADMIN "'.implode('", "', $adminmembers).'"'; |
|
7773 | + $sql .= ' ADMIN "' . implode('", "', $adminmembers) . '"'; |
|
7774 | 7774 | } |
7775 | 7775 | |
7776 | 7776 | return $this->execute($sql); |
@@ -7786,7 +7786,7 @@ discard block |
||
7786 | 7786 | */ |
7787 | 7787 | public function _encryptPassword($username, $password) |
7788 | 7788 | { |
7789 | - return 'md5'.md5($password.$username); |
|
7789 | + return 'md5' . md5($password . $username); |
|
7790 | 7790 | } |
7791 | 7791 | |
7792 | 7792 | /** |
@@ -8108,7 +8108,7 @@ discard block |
||
8108 | 8108 | $sql .= $createdb ? ' CREATEDB' : ' NOCREATEDB'; |
8109 | 8109 | $sql .= $createuser ? ' CREATEUSER' : ' NOCREATEUSER'; |
8110 | 8110 | if (is_array($groups) && count($groups) > 0) { |
8111 | - $sql .= ' IN GROUP "'.implode('", "', $groups).'"'; |
|
8111 | + $sql .= ' IN GROUP "' . implode('", "', $groups) . '"'; |
|
8112 | 8112 | } |
8113 | 8113 | |
8114 | 8114 | if ($expiry != '') { |
@@ -8377,7 +8377,7 @@ discard block |
||
8377 | 8377 | |
8378 | 8378 | if (is_array($users) && count($users) > 0) { |
8379 | 8379 | $this->fieldArrayClean($users); |
8380 | - $sql .= ' WITH USER "'.implode('", "', $users).'"'; |
|
8380 | + $sql .= ' WITH USER "' . implode('", "', $users) . '"'; |
|
8381 | 8381 | } |
8382 | 8382 | |
8383 | 8383 | return $this->execute($sql); |
@@ -8458,9 +8458,9 @@ discard block |
||
8458 | 8458 | } else { |
8459 | 8459 | if ($type == 'column') { |
8460 | 8460 | $this->fieldClean($object); |
8461 | - $sql .= ' '.implode(" (\"{$object}\"), ", $privileges); |
|
8461 | + $sql .= ' ' . implode(" (\"{$object}\"), ", $privileges); |
|
8462 | 8462 | } else { |
8463 | - $sql .= ' '.implode(', ', $privileges); |
|
8463 | + $sql .= ' ' . implode(', ', $privileges); |
|
8464 | 8464 | } |
8465 | 8465 | } |
8466 | 8466 | |
@@ -8840,7 +8840,7 @@ discard block |
||
8840 | 8840 | $params[] = "autovacuum_vacuum_cost_limit='{$vaccostlimit}'"; |
8841 | 8841 | } |
8842 | 8842 | |
8843 | - $sql = $sql.implode(',', $params).');'; |
|
8843 | + $sql = $sql . implode(',', $params) . ');'; |
|
8844 | 8844 | |
8845 | 8845 | return $this->execute($sql); |
8846 | 8846 | } |
@@ -9361,7 +9361,7 @@ discard block |
||
9361 | 9361 | } |
9362 | 9362 | |
9363 | 9363 | // Actually retrieve the rows, with offset and limit |
9364 | - $rs = $this->selectSet("SELECT * FROM ({$query}) AS sub {$orderby} LIMIT {$page_size} OFFSET ".($page - 1) * $page_size); |
|
9364 | + $rs = $this->selectSet("SELECT * FROM ({$query}) AS sub {$orderby} LIMIT {$page_size} OFFSET " . ($page - 1) * $page_size); |
|
9365 | 9365 | $status = $this->endTransaction(); |
9366 | 9366 | if ($status != 0) { |
9367 | 9367 | $this->rollbackTransaction(); |
@@ -9403,7 +9403,7 @@ discard block |
||
9403 | 9403 | $sql = 'SELECT "'; |
9404 | 9404 | } |
9405 | 9405 | |
9406 | - $sql .= implode('","', $show).'" FROM '; |
|
9406 | + $sql .= implode('","', $show) . '" FROM '; |
|
9407 | 9407 | } |
9408 | 9408 | |
9409 | 9409 | $this->fieldClean($table); |
@@ -9467,7 +9467,7 @@ discard block |
||
9467 | 9467 | $sql .= $k; |
9468 | 9468 | } else { |
9469 | 9469 | $this->fieldClean($k); |
9470 | - $sql .= '"'.$k.'"'; |
|
9470 | + $sql .= '"' . $k . '"'; |
|
9471 | 9471 | } |
9472 | 9472 | if (strtoupper($v) == 'DESC') { |
9473 | 9473 | $sql .= ' DESC'; |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | } |
91 | 91 | |
92 | 92 | $lang = []; |
93 | - include_once BASE_PATH.'/src/lang/english.php'; |
|
93 | + include_once BASE_PATH . '/src/lang/english.php'; |
|
94 | 94 | |
95 | 95 | // Determine language file to import: |
96 | 96 | unset($_language); |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | |
152 | 152 | // Import the language file |
153 | 153 | if (isset($_language)) { |
154 | - include BASE_PATH."/src/lang/{$_language}.php"; |
|
154 | + include BASE_PATH . "/src/lang/{$_language}.php"; |
|
155 | 155 | $_SESSION['webdbLanguage'] = $_language; |
156 | 156 | |
157 | 157 | if (array_key_exists($_language, $languages_iso_code)) { |
@@ -7,23 +7,23 @@ discard block |
||
7 | 7 | */ |
8 | 8 | defined('BASE_PATH') or define('BASE_PATH', dirname(__DIR__)); |
9 | 9 | |
10 | -define('THEME_PATH', BASE_PATH.'/src/themes'); |
|
10 | +define('THEME_PATH', BASE_PATH . '/src/themes'); |
|
11 | 11 | // Enforce PHP environment |
12 | 12 | ini_set('arg_separator.output', '&'); |
13 | 13 | |
14 | -ini_set('error_log', BASE_PATH.'/temp/logs/phppga.php_error.log'); |
|
14 | +ini_set('error_log', BASE_PATH . '/temp/logs/phppga.php_error.log'); |
|
15 | 15 | |
16 | 16 | // Check to see if the configuration file exists, if not, explain |
17 | -if (file_exists(BASE_PATH.'/config.inc.php')) { |
|
17 | +if (file_exists(BASE_PATH . '/config.inc.php')) { |
|
18 | 18 | $conf = []; |
19 | - include BASE_PATH.'/config.inc.php'; |
|
19 | + include BASE_PATH . '/config.inc.php'; |
|
20 | 20 | } else { |
21 | 21 | die('Configuration error: Copy config.inc.php-dist to config.inc.php and edit appropriately.'); |
22 | 22 | } |
23 | 23 | $debugmode = (!isset($conf['debugmode'])) ? false : boolval($conf['debugmode']); |
24 | 24 | define('DEBUGMODE', $debugmode); |
25 | 25 | |
26 | -require_once BASE_PATH.'/vendor/autoload.php'; |
|
26 | +require_once BASE_PATH . '/vendor/autoload.php'; |
|
27 | 27 | |
28 | 28 | if (!defined('ADODB_ERROR_HANDLER_TYPE')) { |
29 | 29 | define('ADODB_ERROR_HANDLER_TYPE', E_USER_ERROR); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $handler->start(); // initialize handlers*/ |
55 | 55 | \PhpConsole\Helper::register(); // it will register global PC class |
56 | 56 | |
57 | -$composerinfo = json_decode(file_get_contents(BASE_PATH.'/composer.json')); |
|
57 | +$composerinfo = json_decode(file_get_contents(BASE_PATH . '/composer.json')); |
|
58 | 58 | $appVersion = $composerinfo->version; |
59 | 59 | |
60 | 60 | $config = [ |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | // backwards incompatible changes are made to config.inc.php-dist. |
76 | 76 | 'base_version' => 60, |
77 | 77 | // Application version |
78 | - 'appVersion' => 'v'.$appVersion, |
|
78 | + 'appVersion' => 'v' . $appVersion, |
|
79 | 79 | // Application name |
80 | 80 | 'appName' => 'phpPgAdmin6', |
81 | 81 | |
@@ -95,20 +95,20 @@ discard block |
||
95 | 95 | //\Kint::dump($container->environment);die(); |
96 | 96 | |
97 | 97 | $normalized_php_self = str_replace('/src/views', '', $container->environment->get('PHP_SELF')); |
98 | -$subfolder = str_replace('/'.basename($normalized_php_self), '', $normalized_php_self); |
|
98 | +$subfolder = str_replace('/' . basename($normalized_php_self), '', $normalized_php_self); |
|
99 | 99 | define('SUBFOLDER', $subfolder); |
100 | 100 | |
101 | 101 | $container['errors'] = []; |
102 | 102 | $container['requestobj'] = $container['request']; |
103 | 103 | $container['responseobj'] = $container['response']; |
104 | 104 | |
105 | -$container['utils'] = function ($c) { |
|
105 | +$container['utils'] = function($c) { |
|
106 | 106 | $utils = new \PHPPgAdmin\ContainerUtils($c); |
107 | 107 | |
108 | 108 | return $utils; |
109 | 109 | }; |
110 | 110 | |
111 | -$container['conf'] = function ($c) use ($conf) { |
|
111 | +$container['conf'] = function($c) use ($conf) { |
|
112 | 112 | |
113 | 113 | //\Kint::dump($conf); |
114 | 114 | // Plugins are removed |
@@ -117,8 +117,8 @@ discard block |
||
117 | 117 | return $conf; |
118 | 118 | }; |
119 | 119 | |
120 | -$container['lang'] = function ($c) { |
|
121 | - include_once BASE_PATH.'/src/translations.php'; |
|
120 | +$container['lang'] = function($c) { |
|
121 | + include_once BASE_PATH . '/src/translations.php'; |
|
122 | 122 | |
123 | 123 | $c['appLangFiles'] = $appLangFiles; |
124 | 124 | $c['language'] = $_language; |
@@ -127,16 +127,16 @@ discard block |
||
127 | 127 | return $lang; |
128 | 128 | }; |
129 | 129 | |
130 | -$container['plugin_manager'] = function ($c) { |
|
130 | +$container['plugin_manager'] = function($c) { |
|
131 | 131 | $plugin_manager = new \PHPPgAdmin\PluginManager($c); |
132 | 132 | |
133 | 133 | return $plugin_manager; |
134 | 134 | }; |
135 | 135 | |
136 | -$container['serializer'] = function ($c) { |
|
136 | +$container['serializer'] = function($c) { |
|
137 | 137 | $serializerbuilder = \JMS\Serializer\SerializerBuilder::create(); |
138 | 138 | $serializer = $serializerbuilder |
139 | - ->setCacheDir(BASE_PATH.'/temp/jms') |
|
139 | + ->setCacheDir(BASE_PATH . '/temp/jms') |
|
140 | 140 | ->setDebug($c->get('settings')['debug']) |
141 | 141 | ->build(); |
142 | 142 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | }; |
145 | 145 | |
146 | 146 | // Create Misc class references |
147 | -$container['misc'] = function ($c) { |
|
147 | +$container['misc'] = function($c) { |
|
148 | 148 | $misc = new \PHPPgAdmin\Misc($c); |
149 | 149 | |
150 | 150 | $conf = $c->get('conf'); |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | |
157 | 157 | /* starting with PostgreSQL 9.0, we can set the application name */ |
158 | 158 | if (isset($_server_info['pgVersion']) && $_server_info['pgVersion'] >= 9) { |
159 | - putenv('PGAPPNAME='.$c->get('settings')['appName'].'_'.$c->get('settings')['appVersion']); |
|
159 | + putenv('PGAPPNAME=' . $c->get('settings')['appName'] . '_' . $c->get('settings')['appVersion']); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | $themefolders = []; |
@@ -168,10 +168,10 @@ discard block |
||
168 | 168 | continue; |
169 | 169 | } |
170 | 170 | |
171 | - $folderpath = THEME_PATH.DIRECTORY_SEPARATOR.$foldername; |
|
171 | + $folderpath = THEME_PATH . DIRECTORY_SEPARATOR . $foldername; |
|
172 | 172 | |
173 | 173 | // if $folderpath if indeed a folder and contains a global.css file, then it's a theme |
174 | - if (is_dir($folderpath) && is_file($folderpath.DIRECTORY_SEPARATOR.'global.css')) { |
|
174 | + if (is_dir($folderpath) && is_file($folderpath . DIRECTORY_SEPARATOR . 'global.css')) { |
|
175 | 175 | $themefolders[$foldername] = $folderpath; |
176 | 176 | } |
177 | 177 | } |
@@ -242,12 +242,12 @@ discard block |
||
242 | 242 | }; |
243 | 243 | |
244 | 244 | // Register Twig View helper |
245 | -$container['view'] = function ($c) { |
|
245 | +$container['view'] = function($c) { |
|
246 | 246 | $conf = $c->get('conf'); |
247 | 247 | $misc = $c->misc; |
248 | 248 | |
249 | - $view = new \Slim\Views\Twig(BASE_PATH.'/templates', [ |
|
250 | - 'cache' => BASE_PATH.'/temp/twigcache', |
|
249 | + $view = new \Slim\Views\Twig(BASE_PATH . '/templates', [ |
|
250 | + 'cache' => BASE_PATH . '/temp/twigcache', |
|
251 | 251 | 'auto_reload' => $c->get('settings')['debug'], |
252 | 252 | 'debug' => $c->get('settings')['debug'], |
253 | 253 | ]); |
@@ -278,18 +278,18 @@ discard block |
||
278 | 278 | return $view; |
279 | 279 | }; |
280 | 280 | |
281 | -$container['haltHandler'] = function ($c) { |
|
282 | - return function ($request, $response, $exits, $status = 500) use ($c) { |
|
281 | +$container['haltHandler'] = function($c) { |
|
282 | + return function($request, $response, $exits, $status = 500) use ($c) { |
|
283 | 283 | $title = 'PHPPgAdmin Error'; |
284 | 284 | |
285 | 285 | $html = '<p>The application could not run because of the following error:</p>'; |
286 | 286 | |
287 | 287 | $output = sprintf( |
288 | - "<html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8'>". |
|
289 | - '<title>%s</title><style>'. |
|
290 | - 'body{margin:0;padding:30px;font:12px/1.5 Helvetica,Arial,Verdana,sans-serif;}'. |
|
291 | - 'h3{margin:0;font-size:28px;font-weight:normal;line-height:30px;}'. |
|
292 | - 'span{display:inline-block;font-size:16px;}'. |
|
288 | + "<html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8'>" . |
|
289 | + '<title>%s</title><style>' . |
|
290 | + 'body{margin:0;padding:30px;font:12px/1.5 Helvetica,Arial,Verdana,sans-serif;}' . |
|
291 | + 'h3{margin:0;font-size:28px;font-weight:normal;line-height:30px;}' . |
|
292 | + 'span{display:inline-block;font-size:16px;}' . |
|
293 | 293 | '</style></head><body><h3>%s</h3><p>%s</p><span>%s</span></body></html>', |
294 | 294 | $title, |
295 | 295 | $title, |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | |
310 | 310 | // Set the requestobj and responseobj properties of the container |
311 | 311 | // as the value of $request and $response, which already contain the route |
312 | -$app->add(function ($request, $response, $next) { |
|
312 | +$app->add(function($request, $response, $next) { |
|
313 | 313 | $this['requestobj'] = $request; |
314 | 314 | $this['responseobj'] = $response; |
315 | 315 | |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | |
321 | 321 | $query_string = $request->getUri()->getQuery(); |
322 | 322 | $this->view->offsetSet('query_string', $query_string); |
323 | - $path = SUBFOLDER.'/'.$request->getUri()->getPath().($query_string ? '?'.$query_string : ''); |
|
323 | + $path = SUBFOLDER . '/' . $request->getUri()->getPath() . ($query_string ? '?' . $query_string : ''); |
|
324 | 324 | $this->view->offsetSet('path', $path); |
325 | 325 | $this->view->offsetSet('params', $request->getParams()); |
326 | 326 |
@@ -26,13 +26,13 @@ |
||
26 | 26 | $sep = '?'; |
27 | 27 | ksort($queryVars); |
28 | 28 | foreach ($queryVars as $var => $value) { |
29 | - $url .= $sep.Decorator::value_url($var, $fields).'='.Decorator::value_url($value, $fields); |
|
29 | + $url .= $sep . Decorator::value_url($var, $fields) . '=' . Decorator::value_url($value, $fields); |
|
30 | 30 | $sep = '&'; |
31 | 31 | } |
32 | 32 | } |
33 | 33 | //$this->prtrace('url before', $url); |
34 | 34 | if (SUBFOLDER !== '' && (strpos($url, '/') === 0) && (strpos($url, SUBFOLDER) === false)) { |
35 | - $url = str_replace('//', '/', SUBFOLDER.'/'.$url); |
|
35 | + $url = str_replace('//', '/', SUBFOLDER . '/' . $url); |
|
36 | 36 | } |
37 | 37 | //$this->prtrace('url after', $url); |
38 | 38 | return $url; |