1
1
<?php
2
2
3
3
/**
4
- * PHPPgAdmin 6.0.1
4
+ * PHPPgAdmin 6.0.0
5
5
*/
6
6
7
7
namespace PHPPgAdmin ;
@@ -65,55 +65,55 @@ class ContainerUtils
65
65
public function __construct ()
66
66
{
67
67
$ composerinfo = \json_decode (\file_get_contents (BASE_PATH . '/composer.json ' ));
68
- $ appVersion = $ composerinfo ->extra ->version ;
68
+ $ appVersion = $ composerinfo ->extra ->version ;
69
69
70
70
$ phpMinVer = (\str_replace (['< ' , '> ' , '= ' ], '' , $ composerinfo ->require ->php ));
71
71
//$this->prtrace($appVersion);
72
72
//$this->dump($composerinfo);
73
73
$ settings = [
74
74
'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 ,
78
78
79
79
// Configuration file version. If this is greater than that in config.inc.php, then
80
80
// the app will refuse to run. This and $conf['version'] should be incremented whenever
81
81
// backwards incompatible changes are made to config.inc.php-dist.
82
- 'base_version ' => 61 ,
82
+ 'base_version ' => 61 ,
83
83
// Application version
84
- 'appVersion ' => 'v ' . $ appVersion ,
84
+ 'appVersion ' => 'v ' . $ appVersion ,
85
85
// Application name
86
- 'appName ' => 'phpPgAdmin6 ' ,
86
+ 'appName ' => 'phpPgAdmin6 ' ,
87
87
88
88
// 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 ,
93
93
];
94
94
95
95
if (!self ::DEBUGMODE && !IN_TEST ) {
96
96
$ settings ['routerCacheFile ' ] = self ::BASE_PATH . '/temp/route.cache.php ' ;
97
97
}
98
98
$ config = [
99
- 'msg ' => '' ,
99
+ 'msg ' => '' ,
100
100
'appThemes ' => [
101
- 'default ' => 'Default ' ,
101
+ 'default ' => 'Default ' ,
102
102
'cappuccino ' => 'Cappuccino ' ,
103
- 'gotar ' => 'Blue/Green ' ,
104
- 'bootstrap ' => 'Bootstrap3 ' ,
103
+ 'gotar ' => 'Blue/Green ' ,
104
+ 'bootstrap ' => 'Bootstrap3 ' ,
105
105
],
106
- 'settings ' => $ settings ,
106
+ 'settings ' => $ settings ,
107
107
];
108
108
109
109
$ this ->_app = new App ($ config );
110
110
111
111
// 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 ' ];
117
117
$ container ['responseobj ' ] = $ container ['response ' ];
118
118
119
119
$ this ->container = $ container ;
@@ -172,62 +172,21 @@ public static function createContainer($conf)
172
172
return [$ _instance ->container , self ::$ _instance ->_app ];
173
173
}
174
174
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
-
216
175
public function maybeRenderIframes ($ response , $ subject , $ query_string )
217
176
{
218
177
$ c = self ::getContainerInstance ();
219
178
220
179
$ in_test = $ c ->view ->offsetGet ('in_test ' );
221
180
222
181
if ('1 ' === $ in_test ) {
223
- $ className = '\PHPPgAdmin\Controller \\' . \ucfirst ($ subject ) . 'Controller ' ;
182
+ $ className = '\PHPPgAdmin\Controller \\' . \ucfirst ($ subject ) . 'Controller ' ;
224
183
$ controller = new $ className ($ c );
225
184
226
185
return $ controller ->render ();
227
186
}
228
187
229
188
$ viewVars = [
230
- 'url ' => '/src/views/ ' . $ subject . ($ query_string ? '? ' . $ query_string : '' ),
189
+ 'url ' => '/src/views/ ' . $ subject . ($ query_string ? '? ' . $ query_string : '' ),
231
190
'headertemplate ' => 'header.twig ' ,
232
191
];
233
192
@@ -348,10 +307,10 @@ public function getDestinationWithLastTab($subject)
348
307
$ urlvars [$ key ] = \PHPPgAdmin \Decorators \Decorator::get_sanitized_value ($ urlvar , $ _REQUEST );
349
308
}
350
309
$ _REQUEST = \array_merge ($ _REQUEST , $ urlvars );
351
- $ _GET = \array_merge ($ _GET , $ urlvars );
310
+ $ _GET = \array_merge ($ _GET , $ urlvars );
352
311
}
353
312
354
- $ actionurl = \PHPPgAdmin \Decorators \Decorator::actionurl ($ url ['url ' ], $ _GET );
313
+ $ actionurl = \PHPPgAdmin \Decorators \Decorator::actionurl ($ url ['url ' ], $ _GET );
355
314
$ destinationurl = $ actionurl ->value ($ _GET );
356
315
}
357
316
$ destinationurl = \str_replace ('views/? ' , "views/ {$ subject }? " , $ destinationurl );
@@ -369,13 +328,54 @@ public function getDestinationWithLastTab($subject)
369
328
public function addError (string $ errormsg ): ContainerInterface
370
329
{
371
330
//dump($errormsg);
372
- $ errors = $ this ->container ->get ('errors ' );
331
+ $ errors = $ this ->container ->get ('errors ' );
373
332
$ errors [] = $ errormsg ;
374
333
$ this ->container ->offsetSet ('errors ' , $ errors );
375
334
376
335
return $ this ->container ;
377
336
}
378
337
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
+
379
379
/**
380
380
* Sets the views.
381
381
*
@@ -391,9 +391,9 @@ private function setViews()
391
391
$ container ['view ' ] = static function ($ c ) {
392
392
$ misc = $ c ->misc ;
393
393
$ view = new ViewManager (BASE_PATH . '/assets/templates ' , [
394
- 'cache ' => BASE_PATH . '/temp/twigcache ' ,
394
+ 'cache ' => BASE_PATH . '/temp/twigcache ' ,
395
395
'auto_reload ' => $ c ->get ('settings ' )['debug ' ],
396
- 'debug ' => $ c ->get ('settings ' )['debug ' ],
396
+ 'debug ' => $ c ->get ('settings ' )['debug ' ],
397
397
], $ c );
398
398
399
399
$ misc ->setView ($ view );
@@ -411,7 +411,7 @@ private function setViews()
411
411
*/
412
412
private function setMisc ()
413
413
{
414
- $ container = self ::getContainerInstance ();
414
+ $ container = self ::getContainerInstance ();
415
415
$ container ['misc ' ] = static function ($ c ) {
416
416
$ misc = new \PHPPgAdmin \Misc ($ c );
417
417
@@ -433,7 +433,7 @@ private function setMisc()
433
433
434
434
private function setExtra ()
435
435
{
436
- $ container = self ::getContainerInstance ();
436
+ $ container = self ::getContainerInstance ();
437
437
$ container ['flash ' ] = static function () {
438
438
return new \Slim \Flash \Messages ();
439
439
};
0 commit comments