Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/HuasoFoundries/phpPgAdmin6.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/controllers/RolesController.php')
-rw-r--r--src/controllers/RolesController.php394
1 files changed, 323 insertions, 71 deletions
diff --git a/src/controllers/RolesController.php b/src/controllers/RolesController.php
index 85c932dd..9f44e697 100644
--- a/src/controllers/RolesController.php
+++ b/src/controllers/RolesController.php
@@ -6,6 +6,7 @@
namespace PHPPgAdmin\Controller;
+use ADORecordSet;
use PHPPgAdmin\Decorators\Decorator;
/**
@@ -116,7 +117,10 @@ class RolesController extends BaseController
'role' => [
'title' => $this->lang['strrole'],
'field' => Decorator::field('rolname'),
- 'url' => \containerInstance()->subFolder . "/redirect/role?action=properties&{$this->misc->href}&",
+ 'url' => \containerInstance()->subFolder . \sprintf(
+ '/redirect/role?action=properties&%s&',
+ $this->misc->href
+ ),
'vars' => ['rolename' => 'rolname'],
],
'group' => [
@@ -242,42 +246,92 @@ class RolesController extends BaseController
echo '<form action="' . \containerInstance()->subFolder . '/src/views/roles" method="post">' . \PHP_EOL;
echo '<table>' . \PHP_EOL;
- echo "\t<tr>\n\t\t<th class=\"data left required\" style=\"width: 130px\">{$this->lang['strname']}</th>" . \PHP_EOL;
- echo "\t\t<td class=\"data1\"><input size=\"15\" maxlength=\"{$data->_maxNameLen}\" name=\"formRolename\" value=\"", \htmlspecialchars($_POST['formRolename']), "\" /></td>\n\t</tr>" . \PHP_EOL;
- echo "\t<tr>\n\t\t<th class=\"data left\">{$this->lang['strpassword']}</th>" . \PHP_EOL;
+ echo \sprintf(
+ ' <tr>
+ <th class="data left required" style="width: 130px">%s</th>',
+ $this->lang['strname']
+ ) . \PHP_EOL;
+ echo \sprintf(
+ ' <td class="data1"><input size="15" maxlength="%s" name="formRolename" value="',
+ $data->_maxNameLen
+ ), \htmlspecialchars($_POST['formRolename']), "\" /></td>\n\t</tr>" . \PHP_EOL;
+ echo \sprintf(
+ ' <tr>
+ <th class="data left">%s</th>',
+ $this->lang['strpassword']
+ ) . \PHP_EOL;
echo "\t\t<td class=\"data1\"><input size=\"15\" type=\"password\" name=\"formPassword\" value=\"", \htmlspecialchars($_POST['formPassword']), "\" /></td>\n\t</tr>" . \PHP_EOL;
- echo "\t<tr>\n\t\t<th class=\"data left\">{$this->lang['strconfirm']}</th>" . \PHP_EOL;
+ echo \sprintf(
+ ' <tr>
+ <th class="data left">%s</th>',
+ $this->lang['strconfirm']
+ ) . \PHP_EOL;
echo "\t\t<td class=\"data1\"><input size=\"15\" type=\"password\" name=\"formConfirm\" value=\"", \htmlspecialchars($_POST['formConfirm']), "\" /></td>\n\t</tr>" . \PHP_EOL;
- echo "\t<tr>\n\t\t<th class=\"data left\"><label for=\"formSuper\">{$this->lang['strsuper']}</label></th>" . \PHP_EOL;
+ echo \sprintf(
+ ' <tr>
+ <th class="data left"><label for="formSuper">%s</label></th>',
+ $this->lang['strsuper']
+ ) . \PHP_EOL;
echo "\t\t<td class=\"data1\"><input type=\"checkbox\" id=\"formSuper\" name=\"formSuper\"",
(isset($_POST['formSuper'])) ? ' checked="checked"' : '', " /></td>\n\t</tr>" . \PHP_EOL;
- echo "\t<tr>\n\t\t<th class=\"data left\"><label for=\"formCreateDB\">{$this->lang['strcreatedb']}</label></th>" . \PHP_EOL;
+ echo \sprintf(
+ ' <tr>
+ <th class="data left"><label for="formCreateDB">%s</label></th>',
+ $this->lang['strcreatedb']
+ ) . \PHP_EOL;
echo "\t\t<td class=\"data1\"><input type=\"checkbox\" id=\"formCreateDB\" name=\"formCreateDB\"",
(isset($_POST['formCreateDB'])) ? ' checked="checked"' : '', " /></td>\n\t</tr>" . \PHP_EOL;
- echo "\t<tr>\n\t\t<th class=\"data left\"><label for=\"formCreateRole\">{$this->lang['strcancreaterole']}</label></th>" . \PHP_EOL;
+ echo \sprintf(
+ ' <tr>
+ <th class="data left"><label for="formCreateRole">%s</label></th>',
+ $this->lang['strcancreaterole']
+ ) . \PHP_EOL;
echo "\t\t<td class=\"data1\"><input type=\"checkbox\" id=\"formCreateRole\" name=\"formCreateRole\"",
(isset($_POST['formCreateRole'])) ? ' checked="checked"' : '', " /></td>\n\t</tr>" . \PHP_EOL;
- echo "\t<tr>\n\t\t<th class=\"data left\"><label for=\"formInherits\">{$this->lang['strinheritsprivs']}</label></th>" . \PHP_EOL;
+ echo \sprintf(
+ ' <tr>
+ <th class="data left"><label for="formInherits">%s</label></th>',
+ $this->lang['strinheritsprivs']
+ ) . \PHP_EOL;
echo "\t\t<td class=\"data1\"><input type=\"checkbox\" id=\"formInherits\" name=\"formInherits\"",
(isset($_POST['formInherits'])) ? ' checked="checked"' : '', " /></td>\n\t</tr>" . \PHP_EOL;
- echo "\t<tr>\n\t\t<th class=\"data left\"><label for=\"formCanLogin\">{$this->lang['strcanlogin']}</label></th>" . \PHP_EOL;
+ echo \sprintf(
+ ' <tr>
+ <th class="data left"><label for="formCanLogin">%s</label></th>',
+ $this->lang['strcanlogin']
+ ) . \PHP_EOL;
echo "\t\t<td class=\"data1\"><input type=\"checkbox\" id=\"formCanLogin\" name=\"formCanLogin\"",
(isset($_POST['formCanLogin'])) ? ' checked="checked"' : '', " /></td>\n\t</tr>" . \PHP_EOL;
- echo "\t<tr>\n\t\t<th class=\"data left\">{$this->lang['strconnlimit']}</th>" . \PHP_EOL;
+ echo \sprintf(
+ ' <tr>
+ <th class="data left">%s</th>',
+ $this->lang['strconnlimit']
+ ) . \PHP_EOL;
echo "\t\t<td class=\"data1\"><input size=\"4\" name=\"formConnLimit\" value=\"", \htmlspecialchars($_POST['formConnLimit']), "\" /></td>\n\t</tr>" . \PHP_EOL;
- echo "\t<tr>\n\t\t<th class=\"data left\">{$this->lang['strexpires']}</th>" . \PHP_EOL;
+ echo \sprintf(
+ ' <tr>
+ <th class="data left">%s</th>',
+ $this->lang['strexpires']
+ ) . \PHP_EOL;
echo "\t\t<td class=\"data1\"><input size=\"23\" name=\"formExpires\" value=\"", \htmlspecialchars($_POST['formExpires']), "\" /></td>\n\t</tr>" . \PHP_EOL;
$roles = $data->getRoles();
if (0 < $roles->recordCount()) {
- echo "\t<tr>\n\t\t<th class=\"data left\">{$this->lang['strmemberof']}</th>" . \PHP_EOL;
+ echo \sprintf(
+ ' <tr>
+ <th class="data left">%s</th>',
+ $this->lang['strmemberof']
+ ) . \PHP_EOL;
echo "\t\t<td class=\"data\">" . \PHP_EOL;
echo "\t\t\t<select name=\"memberof[]\" multiple=\"multiple\" size=\"", \min(20, $roles->recordCount()), '">' . \PHP_EOL;
while (!$roles->EOF) {
$rolename = $roles->fields['rolname'];
- echo "\t\t\t\t<option value=\"{$rolename}\"",
+ echo \sprintf(
+ ' <option value="%s"',
+ $rolename
+ ),
(\in_array($rolename, $_POST['memberof'], true) ? ' selected="selected"' : ''), '>', $this->misc->printVal($rolename), '</option>' . \PHP_EOL;
$roles->moveNext();
}
@@ -285,13 +339,20 @@ class RolesController extends BaseController
echo "\t\t</td>\n\t</tr>" . \PHP_EOL;
$roles->moveFirst();
- echo "\t<tr>\n\t\t<th class=\"data left\">{$this->lang['strmembers']}</th>" . \PHP_EOL;
+ echo \sprintf(
+ ' <tr>
+ <th class="data left">%s</th>',
+ $this->lang['strmembers']
+ ) . \PHP_EOL;
echo "\t\t<td class=\"data\">" . \PHP_EOL;
echo "\t\t\t<select name=\"members[]\" multiple=\"multiple\" size=\"", \min(20, $roles->recordCount()), '">' . \PHP_EOL;
while (!$roles->EOF) {
$rolename = $roles->fields['rolname'];
- echo "\t\t\t\t<option value=\"{$rolename}\"",
+ echo \sprintf(
+ ' <option value="%s"',
+ $rolename
+ ),
(\in_array($rolename, $_POST['members'], true) ? ' selected="selected"' : ''), '>', $this->misc->printVal($rolename), '</option>' . \PHP_EOL;
$roles->moveNext();
}
@@ -299,13 +360,20 @@ class RolesController extends BaseController
echo "\t\t</td>\n\t</tr>" . \PHP_EOL;
$roles->moveFirst();
- echo "\t<tr>\n\t\t<th class=\"data left\">{$this->lang['stradminmembers']}</th>" . \PHP_EOL;
+ echo \sprintf(
+ ' <tr>
+ <th class="data left">%s</th>',
+ $this->lang['stradminmembers']
+ ) . \PHP_EOL;
echo "\t\t<td class=\"data\">" . \PHP_EOL;
echo "\t\t\t<select name=\"adminmembers[]\" multiple=\"multiple\" size=\"", \min(20, $roles->recordCount()), '">' . \PHP_EOL;
while (!$roles->EOF) {
$rolename = $roles->fields['rolname'];
- echo "\t\t\t\t<option value=\"{$rolename}\"",
+ echo \sprintf(
+ ' <option value="%s"',
+ $rolename
+ ),
(\in_array($rolename, $_POST['adminmembers'], true) ? ' selected="selected"' : ''), '>', $this->misc->printVal($rolename), '</option>' . \PHP_EOL;
$roles->moveNext();
}
@@ -316,8 +384,15 @@ class RolesController extends BaseController
echo '</table>' . \PHP_EOL;
echo '<p><input type="hidden" name="action" value="save_create" />' . \PHP_EOL;
echo $this->view->form;
- echo "<input type=\"submit\" name=\"create\" value=\"{$this->lang['strcreate']}\" />" . \PHP_EOL;
- echo \sprintf('<input type="submit" name="cancel" value="%s" /></p>%s', $this->lang['strcancel'], \PHP_EOL);
+ echo \sprintf(
+ '<input type="submit" name="create" value="%s" />',
+ $this->lang['strcreate']
+ ) . \PHP_EOL;
+ echo \sprintf(
+ '<input type="submit" name="cancel" value="%s" /></p>%s',
+ $this->lang['strcancel'],
+ \PHP_EOL
+ );
echo '</form>' . \PHP_EOL;
}
@@ -379,7 +454,10 @@ class RolesController extends BaseController
$roledata = $data->getRole($_REQUEST['rolename']);
if (0 >= $roledata->recordCount()) {
- echo "<p>{$this->lang['strnodata']}</p>" . \PHP_EOL;
+ echo \sprintf(
+ '<p>%s</p>',
+ $this->lang['strnodata']
+ ) . \PHP_EOL;
return;
}
@@ -395,30 +473,73 @@ class RolesController extends BaseController
echo '<form action="' . \containerInstance()->subFolder . '/src/views/roles" method="post">' . \PHP_EOL;
echo '<table>' . \PHP_EOL;
- echo "\t<tr>\n\t\t<th class=\"data left\" style=\"width: 130px\">{$this->lang['strname']}</th>" . \PHP_EOL;
- echo "\t\t<td class=\"data1\">", ($canRename ? "<input name=\"formNewRoleName\" size=\"15\" maxlength=\"{$data->_maxNameLen}\" value=\"" . \htmlspecialchars($_POST['formNewRoleName']) . '" />' : $this->misc->printVal($roledata->fields['rolname'])), "</td>\n\t</tr>" . \PHP_EOL;
- echo "\t<tr>\n\t\t<th class=\"data left\">{$this->lang['strpassword']}</th>" . \PHP_EOL;
+ echo \sprintf(
+ ' <tr>
+ <th class="data left" style="width: 130px">%s</th>',
+ $this->lang['strname']
+ ) . \PHP_EOL;
+ echo "\t\t<td class=\"data1\">", ($canRename ? \sprintf(
+ '<input name="formNewRoleName" size="15" maxlength="%s" value="',
+ $data->_maxNameLen
+ ) . \htmlspecialchars($_POST['formNewRoleName']) . '" />' : $this->misc->printVal($roledata->fields['rolname'])), "</td>\n\t</tr>" . \PHP_EOL;
+ echo \sprintf(
+ ' <tr>
+ <th class="data left">%s</th>',
+ $this->lang['strpassword']
+ ) . \PHP_EOL;
echo "\t\t<td class=\"data1\"><input type=\"password\" size=\"15\" name=\"formPassword\" value=\"", \htmlspecialchars($_POST['formPassword']), "\" /></td>\n\t</tr>" . \PHP_EOL;
- echo "\t<tr>\n\t\t<th class=\"data left\">{$this->lang['strconfirm']}</th>" . \PHP_EOL;
+ echo \sprintf(
+ ' <tr>
+ <th class="data left">%s</th>',
+ $this->lang['strconfirm']
+ ) . \PHP_EOL;
echo "\t\t<td class=\"data1\"><input type=\"password\" size=\"15\" name=\"formConfirm\" value=\"\" /></td>\n\t</tr>" . \PHP_EOL;
- echo "\t<tr>\n\t\t<th class=\"data left\"><label for=\"formSuper\">{$this->lang['strsuper']}</label></th>" . \PHP_EOL;
+ echo \sprintf(
+ ' <tr>
+ <th class="data left"><label for="formSuper">%s</label></th>',
+ $this->lang['strsuper']
+ ) . \PHP_EOL;
echo "\t\t<td class=\"data1\"><input type=\"checkbox\" id=\"formSuper\" name=\"formSuper\"",
(isset($_POST['formSuper'])) ? ' checked="checked"' : '', " /></td>\n\t</tr>" . \PHP_EOL;
- echo "\t<tr>\n\t\t<th class=\"data left\"><label for=\"formCreateDB\">{$this->lang['strcreatedb']}</label></th>" . \PHP_EOL;
+ echo \sprintf(
+ ' <tr>
+ <th class="data left"><label for="formCreateDB">%s</label></th>',
+ $this->lang['strcreatedb']
+ ) . \PHP_EOL;
echo "\t\t<td class=\"data1\"><input type=\"checkbox\" id=\"formCreateDB\" name=\"formCreateDB\"",
(isset($_POST['formCreateDB'])) ? ' checked="checked"' : '', " /></td>\n\t</tr>" . \PHP_EOL;
- echo "\t<tr>\n\t\t<th class=\"data left\"><label for=\"formCreateRole\">{$this->lang['strcancreaterole']}</label></th>" . \PHP_EOL;
+ echo \sprintf(
+ ' <tr>
+ <th class="data left"><label for="formCreateRole">%s</label></th>',
+ $this->lang['strcancreaterole']
+ ) . \PHP_EOL;
echo "\t\t<td class=\"data1\"><input type=\"checkbox\" id=\"formCreateRole\" name=\"formCreateRole\"",
(isset($_POST['formCreateRole'])) ? ' checked="checked"' : '', " /></td>\n\t</tr>" . \PHP_EOL;
- echo "\t<tr>\n\t\t<th class=\"data left\"><label for=\"formInherits\">{$this->lang['strinheritsprivs']}</label></th>" . \PHP_EOL;
+ echo \sprintf(
+ ' <tr>
+ <th class="data left"><label for="formInherits">%s</label></th>',
+ $this->lang['strinheritsprivs']
+ ) . \PHP_EOL;
echo "\t\t<td class=\"data1\"><input type=\"checkbox\" id=\"formInherits\" name=\"formInherits\"",
(isset($_POST['formInherits'])) ? ' checked="checked"' : '', " /></td>\n\t</tr>" . \PHP_EOL;
- echo "\t<tr>\n\t\t<th class=\"data left\"><label for=\"formCanLogin\">{$this->lang['strcanlogin']}</label></th>" . \PHP_EOL;
+ echo \sprintf(
+ ' <tr>
+ <th class="data left"><label for="formCanLogin">%s</label></th>',
+ $this->lang['strcanlogin']
+ ) . \PHP_EOL;
echo "\t\t<td class=\"data1\"><input type=\"checkbox\" id=\"formCanLogin\" name=\"formCanLogin\"",
(isset($_POST['formCanLogin'])) ? ' checked="checked"' : '', " /></td>\n\t</tr>" . \PHP_EOL;
- echo "\t<tr>\n\t\t<th class=\"data left\">{$this->lang['strconnlimit']}</th>" . \PHP_EOL;
+ echo \sprintf(
+ ' <tr>
+ <th class="data left">%s</th>',
+ $this->lang['strconnlimit']
+ ) . \PHP_EOL;
echo "\t\t<td class=\"data1\"><input size=\"4\" name=\"formConnLimit\" value=\"", \htmlspecialchars($_POST['formConnLimit']), "\" /></td>\n\t</tr>" . \PHP_EOL;
- echo "\t<tr>\n\t\t<th class=\"data left\">{$this->lang['strexpires']}</th>" . \PHP_EOL;
+ echo \sprintf(
+ ' <tr>
+ <th class="data left">%s</th>',
+ $this->lang['strexpires']
+ ) . \PHP_EOL;
echo "\t\t<td class=\"data1\"><input size=\"23\" name=\"formExpires\" value=\"", \htmlspecialchars($_POST['formExpires']), "\" /></td>\n\t</tr>" . \PHP_EOL;
$this->_populateMemberof($data);
@@ -433,13 +554,20 @@ class RolesController extends BaseController
$roles = $data->getRoles($_REQUEST['rolename']);
if (0 < $roles->recordCount()) {
- echo "\t<tr>\n\t\t<th class=\"data left\">{$this->lang['strmemberof']}</th>" . \PHP_EOL;
+ echo \sprintf(
+ ' <tr>
+ <th class="data left">%s</th>',
+ $this->lang['strmemberof']
+ ) . \PHP_EOL;
echo "\t\t<td class=\"data\">" . \PHP_EOL;
echo "\t\t\t<select name=\"memberof[]\" multiple=\"multiple\" size=\"", \min(20, $roles->recordCount()), '">' . \PHP_EOL;
while (!$roles->EOF) {
$rolename = $roles->fields['rolname'];
- echo "\t\t\t\t<option value=\"{$rolename}\"",
+ echo \sprintf(
+ ' <option value="%s"',
+ $rolename
+ ),
(\in_array($rolename, $_POST['memberof'], true) ? ' selected="selected"' : ''), '>', $this->misc->printVal($rolename), '</option>' . \PHP_EOL;
$roles->moveNext();
}
@@ -447,13 +575,20 @@ class RolesController extends BaseController
echo "\t\t</td>\n\t</tr>" . \PHP_EOL;
$roles->moveFirst();
- echo "\t<tr>\n\t\t<th class=\"data left\">{$this->lang['strmembers']}</th>" . \PHP_EOL;
+ echo \sprintf(
+ ' <tr>
+ <th class="data left">%s</th>',
+ $this->lang['strmembers']
+ ) . \PHP_EOL;
echo "\t\t<td class=\"data\">" . \PHP_EOL;
echo "\t\t\t<select name=\"members[]\" multiple=\"multiple\" size=\"", \min(20, $roles->recordCount()), '">' . \PHP_EOL;
while (!$roles->EOF) {
$rolename = $roles->fields['rolname'];
- echo "\t\t\t\t<option value=\"{$rolename}\"",
+ echo \sprintf(
+ ' <option value="%s"',
+ $rolename
+ ),
(\in_array($rolename, $_POST['members'], true) ? ' selected="selected"' : ''), '>', $this->misc->printVal($rolename), '</option>' . \PHP_EOL;
$roles->moveNext();
}
@@ -461,13 +596,20 @@ class RolesController extends BaseController
echo "\t\t</td>\n\t</tr>" . \PHP_EOL;
$roles->moveFirst();
- echo "\t<tr>\n\t\t<th class=\"data left\">{$this->lang['stradminmembers']}</th>" . \PHP_EOL;
+ echo \sprintf(
+ ' <tr>
+ <th class="data left">%s</th>',
+ $this->lang['stradminmembers']
+ ) . \PHP_EOL;
echo "\t\t<td class=\"data\">" . \PHP_EOL;
echo "\t\t\t<select name=\"adminmembers[]\" multiple=\"multiple\" size=\"", \min(20, $roles->recordCount()), '">' . \PHP_EOL;
while (!$roles->EOF) {
$rolename = $roles->fields['rolname'];
- echo "\t\t\t\t<option value=\"{$rolename}\"",
+ echo \sprintf(
+ ' <option value="%s"',
+ $rolename
+ ),
(\in_array($rolename, $_POST['adminmembers'], true) ? ' selected="selected"' : ''), '>', $this->misc->printVal($rolename), '</option>' . \PHP_EOL;
$roles->moveNext();
}
@@ -482,8 +624,15 @@ class RolesController extends BaseController
echo '<input type="hidden" name="membersold" value="', $_POST['membersold'] ?? \htmlspecialchars($membersold), '" />' . \PHP_EOL;
echo '<input type="hidden" name="adminmembersold" value="', $_POST['adminmembersold'] ?? \htmlspecialchars($adminmembersold), '" />' . \PHP_EOL;
echo $this->view->form;
- echo "<input type=\"submit\" name=\"alter\" value=\"{$this->lang['stralter']}\" />" . \PHP_EOL;
- echo \sprintf('<input type="submit" name="cancel" value="%s" /></p>%s', $this->lang['strcancel'], \PHP_EOL);
+ echo \sprintf(
+ '<input type="submit" name="alter" value="%s" />',
+ $this->lang['stralter']
+ ) . \PHP_EOL;
+ echo \sprintf(
+ '<input type="submit" name="cancel" value="%s" /></p>%s',
+ $this->lang['strcancel'],
+ \PHP_EOL
+ );
echo '</form>' . \PHP_EOL;
}
@@ -533,14 +682,24 @@ class RolesController extends BaseController
$this->printTrail('role');
$this->printTitle($this->lang['strdroprole'], 'pg.role.drop');
- echo '<p>', \sprintf($this->lang['strconfdroprole'], $this->misc->printVal($_REQUEST['rolename'])), '</p>' . \PHP_EOL;
+ echo '<p>', \sprintf(
+ $this->lang['strconfdroprole'],
+ $this->misc->printVal($_REQUEST['rolename'])
+ ), '</p>' . \PHP_EOL;
echo '<form action="' . \containerInstance()->subFolder . '/src/views/roles" method="post">' . \PHP_EOL;
echo '<p><input type="hidden" name="action" value="drop" />' . \PHP_EOL;
echo '<input type="hidden" name="rolename" value="', \htmlspecialchars($_REQUEST['rolename']), '" />' . \PHP_EOL;
echo $this->view->form;
- echo "<input type=\"submit\" name=\"drop\" value=\"{$this->lang['strdrop']}\" />" . \PHP_EOL;
- echo \sprintf('<input type="submit" name="cancel" value="%s" /></p>%s', $this->lang['strcancel'], \PHP_EOL);
+ echo \sprintf(
+ '<input type="submit" name="drop" value="%s" />',
+ $this->lang['strdrop']
+ ) . \PHP_EOL;
+ echo \sprintf(
+ '<input type="submit" name="cancel" value="%s" /></p>%s',
+ $this->lang['strcancel'],
+ \PHP_EOL
+ );
echo '</form>' . \PHP_EOL;
} else {
$status = $data->dropRole($_REQUEST['rolename']);
@@ -578,25 +737,65 @@ class RolesController extends BaseController
echo '<table>' . \PHP_EOL;
echo "\t<tr>\n\t\t<th class=\"data\" style=\"width: 130px\">Description</th>" . \PHP_EOL;
echo "\t\t<th class=\"data\" style=\"width: 120\">Value</th>\n\t</tr>" . \PHP_EOL;
- echo "\t<tr>\n\t\t<td class=\"data1\">{$this->lang['strname']}</td>" . \PHP_EOL;
+ echo \sprintf(
+ ' <tr>
+ <td class="data1">%s</td>',
+ $this->lang['strname']
+ ) . \PHP_EOL;
echo "\t\t<td class=\"data1\">", \htmlspecialchars($_REQUEST['rolename']), "</td>\n\t</tr>" . \PHP_EOL;
- echo "\t<tr>\n\t\t<td class=\"data2\">{$this->lang['strsuper']}</td>" . \PHP_EOL;
+ echo \sprintf(
+ ' <tr>
+ <td class="data2">%s</td>',
+ $this->lang['strsuper']
+ ) . \PHP_EOL;
echo "\t\t<td class=\"data2\">", (($roledata->fields['rolsuper']) ? $this->lang['stryes'] : $this->lang['strno']), "</td>\n\t</tr>" . \PHP_EOL;
- echo "\t<tr>\n\t\t<td class=\"data1\">{$this->lang['strcreatedb']}</td>" . \PHP_EOL;
+ echo \sprintf(
+ ' <tr>
+ <td class="data1">%s</td>',
+ $this->lang['strcreatedb']
+ ) . \PHP_EOL;
echo "\t\t<td class=\"data1\">", (($roledata->fields['rolcreatedb']) ? $this->lang['stryes'] : $this->lang['strno']), '</td>' . \PHP_EOL;
- echo "\t<tr>\n\t\t<td class=\"data2\">{$this->lang['strcancreaterole']}</td>" . \PHP_EOL;
+ echo \sprintf(
+ ' <tr>
+ <td class="data2">%s</td>',
+ $this->lang['strcancreaterole']
+ ) . \PHP_EOL;
echo "\t\t<td class=\"data2\">", (($roledata->fields['rolcreaterole']) ? $this->lang['stryes'] : $this->lang['strno']), '</td>' . \PHP_EOL;
- echo "\t<tr>\n\t\t<td class=\"data1\">{$this->lang['strinheritsprivs']}</td>" . \PHP_EOL;
+ echo \sprintf(
+ ' <tr>
+ <td class="data1">%s</td>',
+ $this->lang['strinheritsprivs']
+ ) . \PHP_EOL;
echo "\t\t<td class=\"data1\">", (($roledata->fields['rolinherit']) ? $this->lang['stryes'] : $this->lang['strno']), '</td>' . \PHP_EOL;
- echo "\t<tr>\n\t\t<td class=\"data2\">{$this->lang['strcanlogin']}</td>" . \PHP_EOL;
+ echo \sprintf(
+ ' <tr>
+ <td class="data2">%s</td>',
+ $this->lang['strcanlogin']
+ ) . \PHP_EOL;
echo "\t\t<td class=\"data2\">", (($roledata->fields['rolcanlogin']) ? $this->lang['stryes'] : $this->lang['strno']), '</td>' . \PHP_EOL;
- echo "\t<tr>\n\t\t<td class=\"data1\">{$this->lang['strconnlimit']}</td>" . \PHP_EOL;
+ echo \sprintf(
+ ' <tr>
+ <td class="data1">%s</td>',
+ $this->lang['strconnlimit']
+ ) . \PHP_EOL;
echo "\t\t<td class=\"data1\">", ('-1' === $roledata->fields['rolconnlimit'] ? $this->lang['strnolimit'] : $this->misc->printVal($roledata->fields['rolconnlimit'])), '</td>' . \PHP_EOL;
- echo "\t<tr>\n\t\t<td class=\"data2\">{$this->lang['strexpires']}</td>" . \PHP_EOL;
+ echo \sprintf(
+ ' <tr>
+ <td class="data2">%s</td>',
+ $this->lang['strexpires']
+ ) . \PHP_EOL;
echo "\t\t<td class=\"data2\">", ('infinity' === $roledata->fields['rolvaliduntil'] || null === $roledata->fields['rolvaliduntil'] ? $this->lang['strnever'] : $this->misc->printVal($roledata->fields['rolvaliduntil'])), '</td>' . \PHP_EOL;
- echo "\t<tr>\n\t\t<td class=\"data1\">{$this->lang['strsessiondefaults']}</td>" . \PHP_EOL;
+ echo \sprintf(
+ ' <tr>
+ <td class="data1">%s</td>',
+ $this->lang['strsessiondefaults']
+ ) . \PHP_EOL;
echo "\t\t<td class=\"data1\">", $this->misc->printVal($roledata->fields['rolconfig']), '</td>' . \PHP_EOL;
- echo "\t<tr>\n\t\t<td class=\"data2\">{$this->lang['strmemberof']}</td>" . \PHP_EOL;
+ echo \sprintf(
+ ' <tr>
+ <td class="data2">%s</td>',
+ $this->lang['strmemberof']
+ ) . \PHP_EOL;
echo "\t\t<td class=\"data2\">";
$memberof = $data->getMemberOf($_REQUEST['rolename']);
@@ -607,7 +806,11 @@ class RolesController extends BaseController
}
}
echo "</td>\n\t</tr>" . \PHP_EOL;
- echo "\t<tr>\n\t\t<td class=\"data1\">{$this->lang['strmembers']}</td>" . \PHP_EOL;
+ echo \sprintf(
+ ' <tr>
+ <td class="data1">%s</td>',
+ $this->lang['strmembers']
+ ) . \PHP_EOL;
echo "\t\t<td class=\"data1\">";
$members = $data->getMembers($_REQUEST['rolename']);
@@ -618,7 +821,11 @@ class RolesController extends BaseController
}
}
echo "</td>\n\t</tr>" . \PHP_EOL;
- echo "\t<tr>\n\t\t<td class=\"data2\">{$this->lang['stradminmembers']}</td>" . \PHP_EOL;
+ echo \sprintf(
+ ' <tr>
+ <td class="data2">%s</td>',
+ $this->lang['stradminmembers']
+ ) . \PHP_EOL;
echo "\t\t<td class=\"data2\">";
$adminmembers = $data->getMembers($_REQUEST['rolename'], 't');
@@ -631,7 +838,10 @@ class RolesController extends BaseController
echo "</td>\n\t</tr>" . \PHP_EOL;
echo '</table>' . \PHP_EOL;
} else {
- echo "<p>{$this->lang['strnodata']}</p>" . \PHP_EOL;
+ echo \sprintf(
+ '<p>%s</p>',
+ $this->lang['strnodata']
+ ) . \PHP_EOL;
}
$navlinks = [
@@ -704,14 +914,39 @@ class RolesController extends BaseController
$roledata->fields['rolcreaterole'] = $data->phpBool($roledata->fields['rolcreaterole']);
$roledata->fields['rolinherit'] = $data->phpBool($roledata->fields['rolinherit']);
echo '<table>' . \PHP_EOL;
- echo "\t<tr>\n\t\t<th class=\"data\">{$this->lang['strname']}</th>" . \PHP_EOL;
- echo "\t\t<th class=\"data\">{$this->lang['strsuper']}</th>" . \PHP_EOL;
- echo "\t\t<th class=\"data\">{$this->lang['strcreatedb']}</th>" . \PHP_EOL;
- echo "\t\t<th class=\"data\">{$this->lang['strcancreaterole']}</th>" . \PHP_EOL;
- echo "\t\t<th class=\"data\">{$this->lang['strinheritsprivs']}</th>" . \PHP_EOL;
- echo "\t\t<th class=\"data\">{$this->lang['strconnlimit']}</th>" . \PHP_EOL;
- echo "\t\t<th class=\"data\">{$this->lang['strexpires']}</th>" . \PHP_EOL;
- echo "\t\t<th class=\"data\">{$this->lang['strsessiondefaults']}</th>" . \PHP_EOL;
+ echo \sprintf(
+ ' <tr>
+ <th class="data">%s</th>',
+ $this->lang['strname']
+ ) . \PHP_EOL;
+ echo \sprintf(
+ ' <th class="data">%s</th>',
+ $this->lang['strsuper']
+ ) . \PHP_EOL;
+ echo \sprintf(
+ ' <th class="data">%s</th>',
+ $this->lang['strcreatedb']
+ ) . \PHP_EOL;
+ echo \sprintf(
+ ' <th class="data">%s</th>',
+ $this->lang['strcancreaterole']
+ ) . \PHP_EOL;
+ echo \sprintf(
+ ' <th class="data">%s</th>',
+ $this->lang['strinheritsprivs']
+ ) . \PHP_EOL;
+ echo \sprintf(
+ ' <th class="data">%s</th>',
+ $this->lang['strconnlimit']
+ ) . \PHP_EOL;
+ echo \sprintf(
+ ' <th class="data">%s</th>',
+ $this->lang['strexpires']
+ ) . \PHP_EOL;
+ echo \sprintf(
+ ' <th class="data">%s</th>',
+ $this->lang['strsessiondefaults']
+ ) . \PHP_EOL;
echo "\t</tr>" . \PHP_EOL;
echo "\t<tr>\n\t\t<td class=\"data1\">", $this->misc->printVal($roledata->fields['rolname']), '</td>' . \PHP_EOL;
echo "\t\t<td class=\"data1\">", $this->misc->printVal($roledata->fields['rolsuper'], 'yesno'), '</td>' . \PHP_EOL;
@@ -723,7 +958,10 @@ class RolesController extends BaseController
echo "\t\t<td class=\"data1\">", $this->misc->printVal($roledata->fields['rolconfig']), '</td>' . \PHP_EOL;
echo "\t</tr>\n</table>" . \PHP_EOL;
} else {
- echo "<p>{$this->lang['strnodata']}</p>" . \PHP_EOL;
+ echo \sprintf(
+ '<p>%s</p>',
+ $this->lang['strnodata']
+ ) . \PHP_EOL;
}
$this->printNavLinks(['changepassword' => [
@@ -764,16 +1002,30 @@ class RolesController extends BaseController
echo '<form action="' . \containerInstance()->subFolder . '/src/views/roles" method="post">' . \PHP_EOL;
echo '<table>' . \PHP_EOL;
- echo "\t<tr>\n\t\t<th class=\"data left required\">{$this->lang['strpassword']}</th>" . \PHP_EOL;
+ echo \sprintf(
+ ' <tr>
+ <th class="data left required">%s</th>',
+ $this->lang['strpassword']
+ ) . \PHP_EOL;
echo "\t\t<td><input type=\"password\" name=\"password\" size=\"32\" value=\"",
\htmlspecialchars($_POST['password']), "\" /></td>\n\t</tr>" . \PHP_EOL;
- echo "\t<tr>\n\t\t<th class=\"data left required\">{$this->lang['strconfirm']}</th>" . \PHP_EOL;
+ echo \sprintf(
+ ' <tr>
+ <th class="data left required">%s</th>',
+ $this->lang['strconfirm']
+ ) . \PHP_EOL;
echo "\t\t<td><input type=\"password\" name=\"confirm\" size=\"32\" value=\"\" /></td>\n\t</tr>" . \PHP_EOL;
echo '</table>' . \PHP_EOL;
echo '<p><input type="hidden" name="action" value="changepassword" />' . \PHP_EOL;
echo $this->view->form;
- echo "<input type=\"submit\" name=\"ok\" value=\"{$this->lang['strok']}\" />" . \PHP_EOL;
- echo "<input type=\"submit\" name=\"cancel\" value=\"{$this->lang['strcancel']}\" />" . \PHP_EOL;
+ echo \sprintf(
+ '<input type="submit" name="ok" value="%s" />',
+ $this->lang['strok']
+ ) . \PHP_EOL;
+ echo \sprintf(
+ '<input type="submit" name="cancel" value="%s" />',
+ $this->lang['strcancel']
+ ) . \PHP_EOL;
echo '</p></form>' . \PHP_EOL;
} else {
// Check that password is minimum length
@@ -797,8 +1049,8 @@ class RolesController extends BaseController
/**
* Adjusts the content of the $_POST superglobal according to role data.
*
- * @param \ADORecordSet $roledata The roledata
- * @param bool $canRename Indicates if role can be renamed
+ * @param ADORecordSet $roledata The roledata
+ * @param bool $canRename Indicates if role can be renamed
*/
private function _adjustPostVars($roledata, $canRename): void
{