11<?php
22
33/**
4- * PHPPgAdmin 6.0.1
4+ * PHPPgAdmin 6.0.0
55 */
66
77namespace PHPPgAdmin ;
@@ -65,55 +65,55 @@ class ContainerUtils
6565 public function __construct ()
6666 {
6767 $ composerinfo = \json_decode (\file_get_contents (BASE_PATH . '/composer.json ' ));
68- $ appVersion = $ composerinfo ->extra ->version ;
68+ $ appVersion = $ composerinfo ->extra ->version ;
6969
7070 $ phpMinVer = (\str_replace (['< ' , '> ' , '= ' ], '' , $ composerinfo ->require ->php ));
7171 //$this->prtrace($appVersion);
7272 //$this->dump($composerinfo);
7373 $ settings = [
7474 'determineRouteBeforeAppMiddleware ' => true ,
75- 'base_path ' => self ::BASE_PATH ,
76- 'subfolder ' => self ::SUBFOLDER ,
77- 'debug ' => self ::DEBUGMODE ,
75+ 'base_path ' => self ::BASE_PATH ,
76+ 'subfolder ' => self ::SUBFOLDER ,
77+ 'debug ' => self ::DEBUGMODE ,
7878
7979 // Configuration file version. If this is greater than that in config.inc.php, then
8080 // the app will refuse to run. This and $conf['version'] should be incremented whenever
8181 // backwards incompatible changes are made to config.inc.php-dist.
82- 'base_version ' => 61 ,
82+ 'base_version ' => 61 ,
8383 // Application version
84- 'appVersion ' => 'v ' . $ appVersion ,
84+ 'appVersion ' => 'v ' . $ appVersion ,
8585 // Application name
86- 'appName ' => 'phpPgAdmin6 ' ,
86+ 'appName ' => 'phpPgAdmin6 ' ,
8787
8888 // PostgreSQL and PHP minimum version
89- 'postgresqlMinVer ' => '9.3 ' ,
90- 'phpMinVer ' => $ phpMinVer ,
91- 'displayErrorDetails ' => self ::DEBUGMODE ,
92- 'addContentLengthHeader ' => false ,
89+ 'postgresqlMinVer ' => '9.3 ' ,
90+ 'phpMinVer ' => $ phpMinVer ,
91+ 'displayErrorDetails ' => self ::DEBUGMODE ,
92+ 'addContentLengthHeader ' => false ,
9393 ];
9494
9595 if (!self ::DEBUGMODE && !IN_TEST ) {
9696 $ settings ['routerCacheFile ' ] = self ::BASE_PATH . '/temp/route.cache.php ' ;
9797 }
9898 $ config = [
99- 'msg ' => '' ,
99+ 'msg ' => '' ,
100100 'appThemes ' => [
101- 'default ' => 'Default ' ,
101+ 'default ' => 'Default ' ,
102102 'cappuccino ' => 'Cappuccino ' ,
103- 'gotar ' => 'Blue/Green ' ,
104- 'bootstrap ' => 'Bootstrap3 ' ,
103+ 'gotar ' => 'Blue/Green ' ,
104+ 'bootstrap ' => 'Bootstrap3 ' ,
105105 ],
106- 'settings ' => $ settings ,
106+ 'settings ' => $ settings ,
107107 ];
108108
109109 $ this ->_app = new App ($ config );
110110
111111 // Fetch DI Container
112- $ container = $ this ->_app ->getContainer ();
113- $ container ['utils ' ] = $ this ;
114- $ container ['version ' ] = 'v ' . $ appVersion ;
115- $ container ['errors ' ] = [];
116- $ container ['requestobj ' ] = $ container ['request ' ];
112+ $ container = $ this ->_app ->getContainer ();
113+ $ container ['utils ' ] = $ this ;
114+ $ container ['version ' ] = 'v ' . $ appVersion ;
115+ $ container ['errors ' ] = [];
116+ $ container ['requestobj ' ] = $ container ['request ' ];
117117 $ container ['responseobj ' ] = $ container ['response ' ];
118118
119119 $ this ->container = $ container ;
@@ -172,62 +172,21 @@ public static function createContainer($conf)
172172 return [$ _instance ->container , self ::$ _instance ->_app ];
173173 }
174174
175- private function setConf ($ conf )
176- {
177- $ container = self ::getContainerInstance ();
178- $ conf ['plugins ' ] = [];
179-
180- $ container ['conf ' ] = static function ($ c ) use ($ conf ) {
181- $ display_sizes = $ conf ['display_sizes ' ];
182-
183- if (\is_array ($ display_sizes )) {
184- $ conf ['display_sizes ' ] = [
185- 'schemas ' => (bool ) isset ($ display_sizes ['schemas ' ]) && true === $ display_sizes ['schemas ' ],
186- 'tables ' => (bool ) isset ($ display_sizes ['tables ' ]) && true === $ display_sizes ['tables ' ],
187- ];
188- } else {
189- $ conf ['display_sizes ' ] = [
190- 'schemas ' => (bool ) $ display_sizes ,
191- 'tables ' => (bool ) $ display_sizes ,
192- ];
193- }
194-
195- if (!isset ($ conf ['theme ' ])) {
196- $ conf ['theme ' ] = 'default ' ;
197- }
198-
199- foreach ($ conf ['servers ' ] as &$ server ) {
200- if (!isset ($ server ['port ' ])) {
201- $ server ['port ' ] = 5432 ;
202- }
203-
204- if (!isset ($ server ['sslmode ' ])) {
205- $ server ['sslmode ' ] = 'unspecified ' ;
206- }
207- }
208-
209- return $ conf ;
210- };
211- $ container ->subfolder = self ::SUBFOLDER ;
212-
213- return $ this ;
214- }
215-
216175 public function maybeRenderIframes ($ response , $ subject , $ query_string )
217176 {
218177 $ c = self ::getContainerInstance ();
219178
220179 $ in_test = $ c ->view ->offsetGet ('in_test ' );
221180
222181 if ('1 ' === $ in_test ) {
223- $ className = '\PHPPgAdmin\Controller \\' . \ucfirst ($ subject ) . 'Controller ' ;
182+ $ className = '\PHPPgAdmin\Controller \\' . \ucfirst ($ subject ) . 'Controller ' ;
224183 $ controller = new $ className ($ c );
225184
226185 return $ controller ->render ();
227186 }
228187
229188 $ viewVars = [
230- 'url ' => '/src/views/ ' . $ subject . ($ query_string ? '? ' . $ query_string : '' ),
189+ 'url ' => '/src/views/ ' . $ subject . ($ query_string ? '? ' . $ query_string : '' ),
231190 'headertemplate ' => 'header.twig ' ,
232191 ];
233192
@@ -348,10 +307,10 @@ public function getDestinationWithLastTab($subject)
348307 $ urlvars [$ key ] = \PHPPgAdmin \Decorators \Decorator::get_sanitized_value ($ urlvar , $ _REQUEST );
349308 }
350309 $ _REQUEST = \array_merge ($ _REQUEST , $ urlvars );
351- $ _GET = \array_merge ($ _GET , $ urlvars );
310+ $ _GET = \array_merge ($ _GET , $ urlvars );
352311 }
353312
354- $ actionurl = \PHPPgAdmin \Decorators \Decorator::actionurl ($ url ['url ' ], $ _GET );
313+ $ actionurl = \PHPPgAdmin \Decorators \Decorator::actionurl ($ url ['url ' ], $ _GET );
355314 $ destinationurl = $ actionurl ->value ($ _GET );
356315 }
357316 $ destinationurl = \str_replace ('views/? ' , "views/ {$ subject }? " , $ destinationurl );
@@ -369,13 +328,54 @@ public function getDestinationWithLastTab($subject)
369328 public function addError (string $ errormsg ): ContainerInterface
370329 {
371330 //dump($errormsg);
372- $ errors = $ this ->container ->get ('errors ' );
331+ $ errors = $ this ->container ->get ('errors ' );
373332 $ errors [] = $ errormsg ;
374333 $ this ->container ->offsetSet ('errors ' , $ errors );
375334
376335 return $ this ->container ;
377336 }
378337
338+ private function setConf ($ conf )
339+ {
340+ $ container = self ::getContainerInstance ();
341+ $ conf ['plugins ' ] = [];
342+
343+ $ container ['conf ' ] = static function ($ c ) use ($ conf ) {
344+ $ display_sizes = $ conf ['display_sizes ' ];
345+
346+ if (\is_array ($ display_sizes )) {
347+ $ conf ['display_sizes ' ] = [
348+ 'schemas ' => (bool ) isset ($ display_sizes ['schemas ' ]) && true === $ display_sizes ['schemas ' ],
349+ 'tables ' => (bool ) isset ($ display_sizes ['tables ' ]) && true === $ display_sizes ['tables ' ],
350+ ];
351+ } else {
352+ $ conf ['display_sizes ' ] = [
353+ 'schemas ' => (bool ) $ display_sizes ,
354+ 'tables ' => (bool ) $ display_sizes ,
355+ ];
356+ }
357+
358+ if (!isset ($ conf ['theme ' ])) {
359+ $ conf ['theme ' ] = 'default ' ;
360+ }
361+
362+ foreach ($ conf ['servers ' ] as &$ server ) {
363+ if (!isset ($ server ['port ' ])) {
364+ $ server ['port ' ] = 5432 ;
365+ }
366+
367+ if (!isset ($ server ['sslmode ' ])) {
368+ $ server ['sslmode ' ] = 'unspecified ' ;
369+ }
370+ }
371+
372+ return $ conf ;
373+ };
374+ $ container ->subfolder = self ::SUBFOLDER ;
375+
376+ return $ this ;
377+ }
378+
379379 /**
380380 * Sets the views.
381381 *
@@ -391,9 +391,9 @@ private function setViews()
391391 $ container ['view ' ] = static function ($ c ) {
392392 $ misc = $ c ->misc ;
393393 $ view = new ViewManager (BASE_PATH . '/assets/templates ' , [
394- 'cache ' => BASE_PATH . '/temp/twigcache ' ,
394+ 'cache ' => BASE_PATH . '/temp/twigcache ' ,
395395 'auto_reload ' => $ c ->get ('settings ' )['debug ' ],
396- 'debug ' => $ c ->get ('settings ' )['debug ' ],
396+ 'debug ' => $ c ->get ('settings ' )['debug ' ],
397397 ], $ c );
398398
399399 $ misc ->setView ($ view );
@@ -411,7 +411,7 @@ private function setViews()
411411 */
412412 private function setMisc ()
413413 {
414- $ container = self ::getContainerInstance ();
414+ $ container = self ::getContainerInstance ();
415415 $ container ['misc ' ] = static function ($ c ) {
416416 $ misc = new \PHPPgAdmin \Misc ($ c );
417417
@@ -433,7 +433,7 @@ private function setMisc()
433433
434434 private function setExtra ()
435435 {
436- $ container = self ::getContainerInstance ();
436+ $ container = self ::getContainerInstance ();
437437 $ container ['flash ' ] = static function () {
438438 return new \Slim \Flash \Messages ();
439439 };
0 commit comments