diff options
author | Amenadiel <amenadiel@gmail.com> | 2017-09-30 20:42:37 +0300 |
---|---|---|
committer | Amenadiel <amenadiel@gmail.com> | 2017-09-30 20:42:37 +0300 |
commit | 77d5e24a91bc372d9983baa6f0b7027e53e71a3f (patch) | |
tree | 5b6f32182a704dfba6c519a99d7a80ad39edc3c7 | |
parent | 2177e8c4d3d0fd8143edcfe5c909c115a5ce60b5 (diff) |
Tag v 6.0.0-beta.25 display login or servers view when trying to execute query being unloggedv6.0.0-beta.25
-rw-r--r-- | composer.json | 2 | ||||
-rw-r--r-- | composer.lock | 4 | ||||
-rw-r--r-- | index.php | 10 | ||||
-rw-r--r-- | src/controllers/BaseController.php | 8 | ||||
-rw-r--r-- | src/controllers/SqleditController.php | 2 |
5 files changed, 19 insertions, 7 deletions
diff --git a/composer.json b/composer.json index 42b693c7..771b8fe9 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "huasofoundries/phppgadmin6", - "version": "6.0.0-beta.24", + "version": "6.0.0-beta.25", "description": "Like phpmyadmin but for postgres", "type": "project", "license": "MIT", diff --git a/composer.lock b/composer.lock index 5a91c6f0..7363bf97 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "68c5f9201ceb32b4f3a8b40eae0324a2", - "content-hash": "9158f461d0e6620a88ac78785aa480a2", + "hash": "98611404f2e925ba45e90c0c97d3fbd3", + "content-hash": "a89a88c75033242901704305245e2b3a", "packages": [ { "name": "adodb/adodb-php", @@ -89,6 +89,16 @@ $app->get('/src/views/intro', function ($request, $response, $args) { $app->map(['GET', 'POST'], '/src/views/{subject}', function ($request, $response, $args) { + if ($this->misc->getServerId() === null) { + return $response->withStatus(302)->withHeader('Location', SUBFOLDER . '/src/views/servers'); + } + $_server_info = $this->misc->getServerInfo(); + + if (!isset($_server_info['username'])) { + $destinationurl = SUBFOLDER . '/src/views/login?server=' . $this->misc->getServerId(); + return $response->withStatus(302)->withHeader('Location', $destinationurl); + } + $subject = $args['subject']; $className = '\PHPPgAdmin\Controller\\' . ucfirst($subject) . 'Controller'; diff --git a/src/controllers/BaseController.php b/src/controllers/BaseController.php index b7f539cb..cb6dfc18 100644 --- a/src/controllers/BaseController.php +++ b/src/controllers/BaseController.php @@ -68,16 +68,18 @@ class BaseController if ($this->misc->getNoDBConnection() === false) { if ($this->misc->getServerId() === null) { - echo $this->lang['strnoserversupplied']; + $servers_controller = new \PHPPgAdmin\Controller\ServersController($container, true); + return $servers_controller->render(); exit; } $_server_info = $this->misc->getServerInfo(); // Redirect to the login form if not logged in if (!isset($_server_info['username'])) { - $login_controller = new \PHPPgAdmin\Controller\LoginController($container); - echo $login_controller->doLoginForm($msg); + $msg = sprintf($this->lang['strlogoutmsg'], $_server_info['desc']); + $servers_controller = new \PHPPgAdmin\Controller\ServersController($container, true); + return $servers_controller->render(); exit; } } diff --git a/src/controllers/SqleditController.php b/src/controllers/SqleditController.php index 003068a5..a50c0a83 100644 --- a/src/controllers/SqleditController.php +++ b/src/controllers/SqleditController.php @@ -70,7 +70,7 @@ class SqleditController extends BaseController $default_html = $this->printTabs($misc->getNavTabs('popup'), 'sql', false); - $default_html .= '<form action="' . SUBFOLDER . '/src/views/sql.php" method="post" enctype="multipart/form-data" class="sqlform" id="sqlform" target="detail">'; + $default_html .= '<form action="' . SUBFOLDER . '/src/views/sql" method="post" enctype="multipart/form-data" class="sqlform" id="sqlform" target="detail">'; $default_html .= "\n"; $default_html .= $this->_printConnection('sql'); |