@@ -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; |
@@ -50,33 +50,33 @@ discard block |
||
50 | 50 | } |
51 | 51 | }); |
52 | 52 | |
53 | -$app->get('/redirect[/{subject}]', function ($request, $response, $args) { |
|
53 | +$app->get('/redirect[/{subject}]', function($request, $response, $args) { |
|
54 | 54 | $subject = (isset($args['subject'])) ? $args['subject'] : 'root'; |
55 | 55 | $destinationurl = $this->utils->getDestinationWithLastTab($subject); |
56 | 56 | return $response->withStatus(302)->withHeader('Location', $destinationurl); |
57 | 57 | }); |
58 | 58 | |
59 | -$app->get('/src/views/browser', function ($request, $response, $args) { |
|
59 | +$app->get('/src/views/browser', function($request, $response, $args) { |
|
60 | 60 | $controller = new \PHPPgAdmin\Controller\BrowserController($this, true); |
61 | 61 | return $controller->render(); |
62 | 62 | }); |
63 | 63 | |
64 | -$app->get('/src/views/login', function ($request, $response, $args) { |
|
64 | +$app->get('/src/views/login', function($request, $response, $args) { |
|
65 | 65 | $controller = new \PHPPgAdmin\Controller\LoginController($this, true); |
66 | 66 | return $controller->render(); |
67 | 67 | }); |
68 | 68 | |
69 | -$app->get('/src/views/servers', function ($request, $response, $args) { |
|
69 | +$app->get('/src/views/servers', function($request, $response, $args) { |
|
70 | 70 | $controller = new \PHPPgAdmin\Controller\ServersController($this, true); |
71 | 71 | return $controller->render(); |
72 | 72 | }); |
73 | 73 | |
74 | -$app->get('/src/views/intro', function ($request, $response, $args) { |
|
74 | +$app->get('/src/views/intro', function($request, $response, $args) { |
|
75 | 75 | $controller = new \PHPPgAdmin\Controller\IntroController($this, true); |
76 | 76 | return $controller->render(); |
77 | 77 | }); |
78 | 78 | |
79 | -$app->map(['GET', 'POST'], '/src/views/{subject}', function ($request, $response, $args) { |
|
79 | +$app->map(['GET', 'POST'], '/src/views/{subject}', function($request, $response, $args) { |
|
80 | 80 | if ($this->misc->getServerId() === null) { |
81 | 81 | return $response->withStatus(302)->withHeader('Location', SUBFOLDER . '/src/views/servers'); |
82 | 82 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | return $controller->render(); |
95 | 95 | }); |
96 | 96 | |
97 | -$app->get('/[{subject}]', function ($request, $response, $args) { |
|
97 | +$app->get('/[{subject}]', function($request, $response, $args) { |
|
98 | 98 | $subject = (isset($args['subject'])) ? $args['subject'] : 'intro'; |
99 | 99 | $_server_info = $this->misc->getServerInfo(); |
100 | 100 | $query_string = $request->getUri()->getQuery(); |
@@ -113,7 +113,7 @@ |
||
113 | 113 | $lang = $this->lang; |
114 | 114 | $data = $misc->getDatabaseAccessor(); |
115 | 115 | |
116 | - $cnPre = function (&$rowdata) use ($data) { |
|
116 | + $cnPre = function(&$rowdata) use ($data) { |
|
117 | 117 | if (is_null($rowdata->fields['consrc'])) { |
118 | 118 | $atts = $data->getAttributeNames($_REQUEST['table'], explode(' ', $rowdata->fields['indkey'])); |
119 | 119 | $rowdata->fields['+definition'] = ($rowdata->fields['contype'] == 'u' ? 'UNIQUE (' : 'PRIMARY KEY (') . join(',', $atts) . ')'; |
@@ -472,6 +472,8 @@ discard block |
||
472 | 472 | |
473 | 473 | /** |
474 | 474 | * Confirm and then actually add a PRIMARY KEY or UNIQUE constraint |
475 | + * @param string $type |
|
476 | + * @param boolean $confirm |
|
475 | 477 | */ |
476 | 478 | public function addPrimaryOrUniqueKey($type, $confirm, $msg = '') |
477 | 479 | { |
@@ -615,6 +617,7 @@ discard block |
||
615 | 617 | |
616 | 618 | /** |
617 | 619 | * Confirm and then actually add a CHECK constraint |
620 | + * @param boolean $confirm |
|
618 | 621 | */ |
619 | 622 | public function addCheck($confirm, $msg = '') |
620 | 623 | { |
@@ -671,6 +674,7 @@ discard block |
||
671 | 674 | |
672 | 675 | /** |
673 | 676 | * Show confirmation of drop and perform actual drop |
677 | + * @param boolean $confirm |
|
674 | 678 | */ |
675 | 679 | public function doDrop($confirm) |
676 | 680 | { |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $lang = $this->lang; |
99 | 99 | $data = $misc->getDatabaseAccessor(); |
100 | 100 | |
101 | - $attPre = function (&$rowdata, $actions) use ($data) { |
|
101 | + $attPre = function(&$rowdata, $actions) use ($data) { |
|
102 | 102 | $rowdata->fields['+type'] = $data->formatType($rowdata->fields['type'], $rowdata->fields['atttypmod']); |
103 | 103 | $attname = $rowdata->fields['attname']; |
104 | 104 | $table = $_REQUEST['table']; |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | return $actions; |
112 | 112 | }; |
113 | 113 | |
114 | - $cstrRender = function ($s, $p) use ($misc, $data) { |
|
114 | + $cstrRender = function($s, $p) use ($misc, $data) { |
|
115 | 115 | $str = ''; |
116 | 116 | foreach ($p['keys'] as $k => $c) { |
117 | 117 | if (is_null($p['keys'][$k]['consrc'])) { |
@@ -840,6 +840,7 @@ |
||
840 | 840 | |
841 | 841 | /** |
842 | 842 | * Show confirmation of drop column and perform actual drop |
843 | + * @param boolean $confirm |
|
843 | 844 | */ |
844 | 845 | public function doDrop($confirm) |
845 | 846 | { |
@@ -103,12 +103,12 @@ discard block |
||
103 | 103 | $container['requestobj'] = $container['request']; |
104 | 104 | $container['responseobj'] = $container['response']; |
105 | 105 | |
106 | -$container['utils'] = function ($c) { |
|
106 | +$container['utils'] = function($c) { |
|
107 | 107 | $utils = new \PHPPgAdmin\ContainerUtils($c); |
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,7 +117,7 @@ discard block |
||
117 | 117 | return $conf; |
118 | 118 | }; |
119 | 119 | |
120 | -$container['lang'] = function ($c) { |
|
120 | +$container['lang'] = function($c) { |
|
121 | 121 | include_once BASE_PATH . '/src/translations.php'; |
122 | 122 | |
123 | 123 | $c['appLangFiles'] = $appLangFiles; |
@@ -127,12 +127,12 @@ 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 | return $plugin_manager; |
133 | 133 | }; |
134 | 134 | |
135 | -$container['serializer'] = function ($c) { |
|
135 | +$container['serializer'] = function($c) { |
|
136 | 136 | $serializerbuilder = \JMS\Serializer\SerializerBuilder::create(); |
137 | 137 | $serializer = $serializerbuilder |
138 | 138 | ->setCacheDir(BASE_PATH . '/temp/jms') |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | }; |
143 | 143 | |
144 | 144 | // Create Misc class references |
145 | -$container['misc'] = function ($c) { |
|
145 | +$container['misc'] = function($c) { |
|
146 | 146 | $misc = new \PHPPgAdmin\Misc($c); |
147 | 147 | |
148 | 148 | $conf = $c->get('conf'); |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | }; |
241 | 241 | |
242 | 242 | // Register Twig View helper |
243 | -$container['view'] = function ($c) { |
|
243 | +$container['view'] = function($c) { |
|
244 | 244 | $conf = $c->get('conf'); |
245 | 245 | $misc = $c->misc; |
246 | 246 | |
@@ -276,8 +276,8 @@ discard block |
||
276 | 276 | return $view; |
277 | 277 | }; |
278 | 278 | |
279 | -$container['haltHandler'] = function ($c) { |
|
280 | - return function ($request, $response, $exits, $status = 500) use ($c) { |
|
279 | +$container['haltHandler'] = function($c) { |
|
280 | + return function($request, $response, $exits, $status = 500) use ($c) { |
|
281 | 281 | $title = 'PHPPgAdmin Error'; |
282 | 282 | |
283 | 283 | $html = '<p>The application could not run because of the following error:</p>'; |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | |
308 | 308 | // Set the requestobj and responseobj properties of the container |
309 | 309 | // as the value of $request and $response, which already contain the route |
310 | -$app->add(function ($request, $response, $next) { |
|
310 | +$app->add(function($request, $response, $next) { |
|
311 | 311 | $this['requestobj'] = $request; |
312 | 312 | $this['responseobj'] = $response; |
313 | 313 |
@@ -25,6 +25,11 @@ |
||
25 | 25 | public $host = ''; |
26 | 26 | public $database = ''; |
27 | 27 | |
28 | + /** |
|
29 | + * @param string $errmsg |
|
30 | + * @param string $p1 |
|
31 | + * @param string $p2 |
|
32 | + */ |
|
28 | 33 | public function __construct($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection) |
29 | 34 | { |
30 | 35 | switch ($fn) { |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | /** |
121 | 121 | * Displays link to the context help. |
122 | 122 | * @param $str - the string that the context help is related to (already escaped) |
123 | - * @param $help - help section identifier |
|
123 | + * @param string $help - help section identifier |
|
124 | 124 | * @param $do_print true to echo, false to return |
125 | 125 | */ |
126 | 126 | public function printHelp($str, $help = null, $do_print = true) |
@@ -345,6 +345,9 @@ discard block |
||
345 | 345 | return $this->data; |
346 | 346 | } |
347 | 347 | |
348 | + /** |
|
349 | + * @param string $server_id |
|
350 | + */ |
|
348 | 351 | public function getConnection($database = '', $server_id = null) |
349 | 352 | { |
350 | 353 | $lang = $this->lang; |
@@ -449,7 +452,7 @@ discard block |
||
449 | 452 | |
450 | 453 | /** |
451 | 454 | * Set server information. |
452 | - * @param $key parameter name to set, or null to replace all |
|
455 | + * @param null|string $key parameter name to set, or null to replace all |
|
453 | 456 | * params with the assoc-array in $value. |
454 | 457 | * @param $value the new value, or null to unset the parameter |
455 | 458 | * @param $server_id the server identifier, or null for current |
@@ -388,6 +388,7 @@ |
||
388 | 388 | |
389 | 389 | /** |
390 | 390 | * Show confirmation of drop and perform actual drop of the aggregate function selected |
391 | + * @param boolean $confirm |
|
391 | 392 | */ |
392 | 393 | public function doDrop($confirm) |
393 | 394 | { |
@@ -239,6 +239,7 @@ discard block |
||
239 | 239 | |
240 | 240 | /** |
241 | 241 | * Display a form for alter and perform actual alter |
242 | + * @param boolean $confirm |
|
242 | 243 | */ |
243 | 244 | public function doAlter($confirm) |
244 | 245 | { |
@@ -311,6 +312,7 @@ discard block |
||
311 | 312 | |
312 | 313 | /** |
313 | 314 | * Show confirmation of drop and perform actual drop |
315 | + * @param boolean $confirm |
|
314 | 316 | */ |
315 | 317 | public function doDrop($confirm) |
316 | 318 | { |
@@ -162,9 +162,9 @@ discard block |
||
162 | 162 | * @param [type] &$tabledata [description] |
163 | 163 | * @param [type] &$columns [description] |
164 | 164 | * @param [type] &$actions [description] |
165 | - * @param [type] $place [description] |
|
165 | + * @param string $place [description] |
|
166 | 166 | * @param [type] $nodata [description] |
167 | - * @param [type] $pre_fn [description] |
|
167 | + * @param \Closure $pre_fn [description] |
|
168 | 168 | * @return [type] [description] |
169 | 169 | */ |
170 | 170 | public function printTable(&$tabledata, &$columns, &$actions, $place, $nodata = null, $pre_fn = null) |
@@ -179,6 +179,9 @@ discard block |
||
179 | 179 | return $tree->adjustTabsForTree($tabs); |
180 | 180 | } |
181 | 181 | |
182 | + /** |
|
183 | + * @param string $section |
|
184 | + */ |
|
182 | 185 | public function printTree(&$_treedata, &$attrs, $section, $print = true) |
183 | 186 | { |
184 | 187 | $tree = $this->getTreeController(); |
@@ -192,6 +195,9 @@ discard block |
||
192 | 195 | return $html_trail->printTrail($trail, $do_print, $from); |
193 | 196 | } |
194 | 197 | |
198 | + /** |
|
199 | + * @param string $place |
|
200 | + */ |
|
195 | 201 | public function printNavLinks($navlinks, $place, $env = [], $do_print = true) |
196 | 202 | { |
197 | 203 | $from = __METHOD__; |
@@ -199,6 +205,9 @@ discard block |
||
199 | 205 | return $html_trail->printNavLinks($navlinks, $place, $env, $do_print, $from); |
200 | 206 | } |
201 | 207 | |
208 | + /** |
|
209 | + * @param string $activetab |
|
210 | + */ |
|
202 | 211 | public function printTabs($tabs, $activetab, $do_print = true) |
203 | 212 | { |
204 | 213 | $from = __METHOD__; |
@@ -212,6 +221,9 @@ discard block |
||
212 | 221 | return $html_trail->getLastTabURL($section); |
213 | 222 | } |
214 | 223 | |
224 | + /** |
|
225 | + * @param string $from |
|
226 | + */ |
|
215 | 227 | public function printLink($link, $do_print = true, $from = null) |
216 | 228 | { |
217 | 229 | if ($from === null) { |
@@ -222,12 +234,18 @@ discard block |
||
222 | 234 | return $html_trail->printLink($link, $do_print, $from); |
223 | 235 | } |
224 | 236 | |
237 | + /** |
|
238 | + * @param boolean $flag |
|
239 | + */ |
|
225 | 240 | public function setReloadDropDatabase($flag) |
226 | 241 | { |
227 | 242 | $footer_controller = $this->getFooterController(); |
228 | 243 | return $footer_controller->setReloadDropDatabase($flag); |
229 | 244 | } |
230 | 245 | |
246 | + /** |
|
247 | + * @param boolean $flag |
|
248 | + */ |
|
231 | 249 | public function setNoBottomLink($flag) |
232 | 250 | { |
233 | 251 | $footer_controller = $this->getFooterController(); |
@@ -248,7 +266,7 @@ discard block |
||
248 | 266 | |
249 | 267 | /** |
250 | 268 | * Outputs JavaScript to set default focus |
251 | - * @param $object eg. forms[0].username |
|
269 | + * @param string $object eg. forms[0].username |
|
252 | 270 | */ |
253 | 271 | public function setFocus($object) |
254 | 272 | { |
@@ -258,7 +276,7 @@ discard block |
||
258 | 276 | |
259 | 277 | /** |
260 | 278 | * Outputs JavaScript to set the name of the browser window. |
261 | - * @param $name the window name |
|
279 | + * @param string $name the window name |
|
262 | 280 | * @param $addServer if true (default) then the server id is |
263 | 281 | * attached to the name. |
264 | 282 | */ |
@@ -268,12 +286,18 @@ discard block |
||
268 | 286 | return $footer_controller->setWindowName($name, $addServer); |
269 | 287 | } |
270 | 288 | |
289 | + /** |
|
290 | + * @param boolean $flag |
|
291 | + */ |
|
271 | 292 | public function setNoOutput($flag) |
272 | 293 | { |
273 | 294 | $header_controller = $this->getHeaderController(); |
274 | 295 | return $header_controller->setNoOutput(boolval($flag)); |
275 | 296 | } |
276 | 297 | |
298 | + /** |
|
299 | + * @param string $script |
|
300 | + */ |
|
277 | 301 | public function printHeader($title = '', $script = null, $do_print = true, $template = 'header.twig') |
278 | 302 | { |
279 | 303 | $header_controller = $this->getHeaderController(); |
@@ -286,6 +310,9 @@ discard block |
||
286 | 310 | return $header_controller->printBody($doBody, $bodyClass); |
287 | 311 | } |
288 | 312 | |
313 | + /** |
|
314 | + * @param string $help |
|
315 | + */ |
|
289 | 316 | public function printTitle($title, $help = null, $do_print = true) |
290 | 317 | { |
291 | 318 | $header_controller = $this->getHeaderController(); |