diff options
author | Felipe Figueroa <amenadiel@gmail.com> | 2018-05-22 17:04:40 +0300 |
---|---|---|
committer | Felipe Figueroa <amenadiel@gmail.com> | 2018-05-22 17:04:40 +0300 |
commit | ec17a24e74cc12632274738652e707c1b231e03f (patch) | |
tree | 526c82fc7c55bed312918b84733a5662e39aeacf /src/controllers/TablespacesController.php | |
parent | f1eb3c80f7d44d7f2fafd4ab4a07351fa3f80860 (diff) |
uses coalesceArr
Diffstat (limited to 'src/controllers/TablespacesController.php')
-rw-r--r-- | src/controllers/TablespacesController.php | 38 |
1 files changed, 11 insertions, 27 deletions
diff --git a/src/controllers/TablespacesController.php b/src/controllers/TablespacesController.php index ca17ebab..9a5ea5a2 100644 --- a/src/controllers/TablespacesController.php +++ b/src/controllers/TablespacesController.php @@ -183,19 +183,13 @@ class TablespacesController extends BaseController $users = $data->getUsers(); if ($tablespace->recordCount() > 0) { - if (!isset($_POST['name'])) { - $_POST['name'] = $tablespace->fields['spcname']; - } + $this->coalesceArr($_POST, 'name', $tablespace->fields['spcname']); - if (!isset($_POST['owner'])) { - $_POST['owner'] = $tablespace->fields['spcowner']; - } + $this->coalesceArr($_POST, 'owner', $tablespace->fields['spcowner']); - if (!isset($_POST['comment'])) { - $_POST['comment'] = ($data->hasSharedComments()) ? $tablespace->fields['spccomment'] : ''; - } + $this->coalesceArr($_POST, 'comment', ($data->hasSharedComments()) ? $tablespace->fields['spccomment'] : ''); - echo '<form action="'.\SUBFOLDER."/src/views/tablespaces\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/tablespaces\" method=\"post\">\n"; echo $this->misc->form; echo "<table>\n"; echo "<tr><th class=\"data left required\">{$this->lang['strname']}</th>\n"; @@ -268,7 +262,7 @@ class TablespacesController extends BaseController echo '<p>', sprintf($this->lang['strconfdroptablespace'], $this->misc->printVal($_REQUEST['tablespace'])), "</p>\n"; - echo '<form action="'.\SUBFOLDER."/src/views/tablespaces\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/tablespaces\" method=\"post\">\n"; echo $this->misc->form; echo "<input type=\"hidden\" name=\"action\" value=\"drop\" />\n"; echo '<input type="hidden" name="tablespace" value="', htmlspecialchars($_REQUEST['tablespace']), "\" />\n"; @@ -296,21 +290,13 @@ class TablespacesController extends BaseController $server_info = $this->misc->getServerInfo(); - if (!isset($_POST['formSpcname'])) { - $_POST['formSpcname'] = ''; - } + $this->coalesceArr($_POST, 'formSpcname', ''); - if (!isset($_POST['formOwner'])) { - $_POST['formOwner'] = $server_info['username']; - } + $this->coalesceArr($_POST, 'formOwner', $server_info['username']); - if (!isset($_POST['formLoc'])) { - $_POST['formLoc'] = ''; - } + $this->coalesceArr($_POST, 'formLoc', ''); - if (!isset($_POST['formComment'])) { - $_POST['formComment'] = ''; - } + $this->coalesceArr($_POST, 'formComment', ''); // Fetch all users $users = $data->getUsers(); @@ -319,7 +305,7 @@ class TablespacesController extends BaseController $this->printTitle($this->lang['strcreatetablespace'], 'pg.tablespace.create'); $this->printMsg($msg); - echo '<form action="'.\SUBFOLDER."/src/views/tablespaces\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/tablespaces\" method=\"post\">\n"; echo $this->misc->form; echo "<table>\n"; echo "\t<tr>\n\t\t<th class=\"data left required\">{$this->lang['strname']}</th>\n"; @@ -362,9 +348,7 @@ class TablespacesController extends BaseController $this->doCreate($this->lang['strtablespaceneedsloc']); } else { // Default comment to blank if it isn't set - if (!isset($_POST['formComment'])) { - $_POST['formComment'] = null; - } + $this->coalesceArr($_POST, 'formComment', null); $status = $data->createTablespace($_POST['formSpcname'], $_POST['formOwner'], $_POST['formLoc'], $_POST['formComment']); if (0 == $status) { |