theme can be set in user manager

This commit is contained in:
Uwe Steinmann 2021-06-23 14:49:53 +02:00
parent e21ef794c4
commit f8d81bd734
3 changed files with 20 additions and 1 deletions

View File

@ -19,6 +19,7 @@
- much better form validation based on jquery validation
- secure unlocking/locking of a documents with form token to prevent CSRF attacks
- append referuri to base url to prevent redirects to arbitraty sites in op.Login.php
- theme can be set in user manager
--------------------------------------------------------------------------------
Changes in version 5.1.22

View File

@ -66,6 +66,7 @@ if ($action == "adduser") {
UI::exitError(getMLText("admin_tools"),getMLText("user_email_missing"));
}
$comment = $_POST["comment"];
$theme = $_POST["theme"];
if ($settings->_strictFormCheck && !$comment) {
UI::exitError(getMLText("admin_tools"),getMLText("user_comment_missing"));
}
@ -79,7 +80,7 @@ if ($action == "adduser") {
UI::exitError(getMLText("admin_tools"),getMLText("user_exists"));
}
$newUser = $dms->addUser($login, seed_pass_hash($pwd), $name, $email, $settings->_language, $settings->_theme, $comment, $role, $isHidden, $isDisabled, $pwdexpiration, $quota, $homefolder);
$newUser = $dms->addUser($login, seed_pass_hash($pwd), $name, $email, $settings->_language, $theme, $comment, $role, $isHidden, $isDisabled, $pwdexpiration, $quota, $homefolder);
if ($newUser) {
/* Set user image if uploaded */
@ -350,6 +351,7 @@ else if ($action == "edituser") {
$name = $_POST["name"];
$email = $_POST["email"];
$comment = $_POST["comment"];
$theme = $_POST["theme"];
$role = preg_replace('/[^0-2]+/', '', $_POST["role"]);
$isHidden = (isset($_POST["ishidden"]) && $_POST["ishidden"]==1 ? 1 : 0);
$isDisabled = (isset($_POST["isdisabled"]) && $_POST["isdisabled"]==1 ? 1 : 0);
@ -387,6 +389,8 @@ else if ($action == "edituser") {
$editedUser->setEmail($email);
if ($editedUser->getComment() != $comment)
$editedUser->setComment($comment);
if ($editedUser->getTheme() != $theme)
$editedUser->setTheme($theme);
if ($editedUser->getRole() != $role)
$editedUser->setRole($role);
if ($editedUser->getQuota() != $quota)

View File

@ -214,6 +214,7 @@ $(document).ready( function() {
function showUserForm($currUser) { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$settings = $this->params['settings'];
$users = $this->params['allusers'];
$groups = $this->params['allgroups'];
$passwordstrength = $this->params['passwordstrength'];
@ -328,6 +329,19 @@ $(document).ready( function() {
'options'=>$options
)
);
$themes = UI::getStyles();
$options = array();
foreach ($themes as $currTheme) {
$options[] = array($currTheme, $currTheme, ($currUser && ($currTheme == $currUser->getTheme())) || ($currTheme == $settings->_theme));
}
$this->formField(
getMLText("theme"),
array(
'element'=>'select',
'name'=>'theme',
'options'=>$options
)
);
$options = array();
foreach($groups as $group) {
$options[] = array($group->getID(), htmlspecialchars($group->getName()), ($currUser && $group->isMember($currUser)));