diff options
Diffstat (limited to 'src/controllers/UsersController.php')
-rw-r--r-- | src/controllers/UsersController.php | 165 |
1 files changed, 136 insertions, 29 deletions
diff --git a/src/controllers/UsersController.php b/src/controllers/UsersController.php index eef40e7b..0786d961 100644 --- a/src/controllers/UsersController.php +++ b/src/controllers/UsersController.php @@ -208,8 +208,17 @@ class UsersController extends BaseController $userdata->fields['usesuper'] = $data->phpBool($userdata->fields['usesuper']); $userdata->fields['usecreatedb'] = $data->phpBool($userdata->fields['usecreatedb']); echo '<table>' . \PHP_EOL; - echo "<tr><th class=\"data\">{$this->lang['strusername']}</th><th class=\"data\">{$this->lang['strsuper']}</th><th class=\"data\">{$this->lang['strcreatedb']}</th><th class=\"data\">{$this->lang['strexpires']}</th>"; - echo "<th class=\"data\">{$this->lang['strsessiondefaults']}</th>"; + echo \sprintf( + '<tr><th class="data">%s</th><th class="data">%s</th><th class="data">%s</th><th class="data">%s</th>', + $this->lang['strusername'], + $this->lang['strsuper'], + $this->lang['strcreatedb'], + $this->lang['strexpires'] + ); + echo \sprintf( + '<th class="data">%s</th>', + $this->lang['strsessiondefaults'] + ); echo '</tr>' . \PHP_EOL; echo "<tr>\n\t<td class=\"data1\">", $this->misc->printVal($userdata->fields['usename']), '</td>' . \PHP_EOL; echo "\t<td class=\"data1\">", $this->misc->printVal($userdata->fields['usesuper'], 'yesno'), '</td>' . \PHP_EOL; @@ -218,7 +227,10 @@ class UsersController extends BaseController echo "\t<td class=\"data1\">", $this->misc->printVal($userdata->fields['useconfig']), '</td>' . \PHP_EOL; echo "</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' => [ @@ -259,17 +271,31 @@ class UsersController extends BaseController echo '<form action="' . \containerInstance()->subFolder . '/src/views/users" 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 @@ -333,31 +359,68 @@ class UsersController extends BaseController echo '<form action="' . \containerInstance()->subFolder . '/src/views/users" method="post">' . \PHP_EOL; echo '<table>' . \PHP_EOL; - echo "\t<tr>\n\t\t<th class=\"data left\">{$this->lang['strusername']}</th>" . \PHP_EOL; - echo "\t\t<td class=\"data1\">", ($canRename ? "<input name=\"newname\" size=\"15\" maxlength=\"{$data->_maxNameLen}\" value=\"" . \htmlspecialchars($_POST['newname']) . '" />' : $this->misc->printVal($userdata->fields['usename'])), "</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">%s</th>', + $this->lang['strusername'] + ) . \PHP_EOL; + echo "\t\t<td class=\"data1\">", ($canRename ? \sprintf( + '<input name="newname" size="15" maxlength="%s" value="', + $data->_maxNameLen + ) . \htmlspecialchars($_POST['newname']) . '" />' : $this->misc->printVal($userdata->fields['usename'])), "</td>\n\t</tr>" . \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\">{$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=\"16\" name=\"formExpires\" value=\"", \htmlspecialchars($_POST['formExpires']), "\" /></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">%s</th>', + $this->lang['strpassword'] + ) . \PHP_EOL; echo "\t\t<td class=\"data1\"><input type=\"password\" size=\"16\" 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=\"16\" name=\"formConfirm\" value=\"\" /></td>\n\t</tr>" . \PHP_EOL; echo '</table>' . \PHP_EOL; echo '<p><input type="hidden" name="action" value="save_edit" />' . \PHP_EOL; echo '<input type="hidden" name="username" value="', \htmlspecialchars($_REQUEST['username']), '" />' . \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; } else { - echo "<p>{$this->lang['strnodata']}</p>" . \PHP_EOL; + echo \sprintf( + '<p>%s</p>', + $this->lang['strnodata'] + ) . \PHP_EOL; } } @@ -401,14 +464,24 @@ class UsersController extends BaseController $this->printTrail('user'); $this->printTitle($this->lang['strdrop'], 'pg.user.drop'); - echo '<p>', \sprintf($this->lang['strconfdropuser'], $this->misc->printVal($_REQUEST['username'])), '</p>' . \PHP_EOL; + echo '<p>', \sprintf( + $this->lang['strconfdropuser'], + $this->misc->printVal($_REQUEST['username']) + ), '</p>' . \PHP_EOL; echo '<form action="' . \containerInstance()->subFolder . '/src/views/users" method="post">' . \PHP_EOL; echo '<p><input type="hidden" name="action" value="drop" />' . \PHP_EOL; echo '<input type="hidden" name="username" value="', \htmlspecialchars($_REQUEST['username']), '" />' . \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->dropUser($_REQUEST['username']); @@ -444,27 +517,61 @@ class UsersController extends BaseController echo '<form action="' . \containerInstance()->subFolder . '/src/views/users" method="post">' . \PHP_EOL; echo '<table>' . \PHP_EOL; - echo "\t<tr>\n\t\t<th class=\"data left required\">{$this->lang['strusername']}</th>" . \PHP_EOL; - echo "\t\t<td class=\"data1\"><input size=\"15\" maxlength=\"{$data->_maxNameLen}\" name=\"formUsername\" value=\"", \htmlspecialchars($_POST['formUsername']), "\" /></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">%s</th>', + $this->lang['strusername'] + ) . \PHP_EOL; + echo \sprintf( + ' <td class="data1"><input size="15" maxlength="%s" name="formUsername" value="', + $data->_maxNameLen + ), \htmlspecialchars($_POST['formUsername']), "\" /></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\">{$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=\"30\" name=\"formExpires\" value=\"", \htmlspecialchars($_POST['formExpires']), "\" /></td>\n\t</tr>" . \PHP_EOL; 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; } |