Merge branch 'seeddms-5.1.x' into seeddms-6.0.x

This commit is contained in:
Uwe Steinmann 2021-06-23 17:18:21 +02:00
commit 8cbf9c803f
5 changed files with 45 additions and 1 deletions

View File

@ -220,6 +220,8 @@
- much better form validation based on jquery validation - much better form validation based on jquery validation
- secure unlocking/locking of a documents with form token to prevent CSRF attacks - 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 - append referuri to base url to prevent redirects to arbitraty sites in op.Login.php
- theme can be set in user manager
- fields in configuration can be omitted from display
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
Changes in version 5.1.22 Changes in version 5.1.22

View File

@ -24,6 +24,8 @@ class Settings { /* {{{ */
// Config File Path // Config File Path
var $_configFilePath = null; var $_configFilePath = null;
// Fields not shown in gui
var $_hiddenConfFields = '';
// Name of site // Name of site
var $_siteName = "SeedDMS"; var $_siteName = "SeedDMS";
// Message to display at the bottom of every page. // Message to display at the bottom of every page.
@ -720,6 +722,7 @@ class Settings { /* {{{ */
$this->_useHomeAsRootFolder = Settings::boolval($tab["useHomeAsRootFolder"]); $this->_useHomeAsRootFolder = Settings::boolval($tab["useHomeAsRootFolder"]);
$this->_titleDisplayHack = Settings::boolval($tab["titleDisplayHack"]); $this->_titleDisplayHack = Settings::boolval($tab["titleDisplayHack"]);
$this->_showMissingTranslations = Settings::boolval($tab["showMissingTranslations"]); $this->_showMissingTranslations = Settings::boolval($tab["showMissingTranslations"]);
$this->_hiddenConfFields = strval($tab["hiddenConfFields"]);
} }
// XML Path: /configuration/advanced/authentication // XML Path: /configuration/advanced/authentication
@ -1080,6 +1083,7 @@ class Settings { /* {{{ */
$this->setXMLAttributValue($node, "useHomeAsRootFolder", $this->_useHomeAsRootFolder); $this->setXMLAttributValue($node, "useHomeAsRootFolder", $this->_useHomeAsRootFolder);
$this->setXMLAttributValue($node, "titleDisplayHack", $this->_titleDisplayHack); $this->setXMLAttributValue($node, "titleDisplayHack", $this->_titleDisplayHack);
$this->setXMLAttributValue($node, "showMissingTranslations", $this->_showMissingTranslations); $this->setXMLAttributValue($node, "showMissingTranslations", $this->_showMissingTranslations);
$this->setXMLAttributValue($node, "hiddenConfFields", $this->_hiddenConfFields);
// XML Path: /configuration/advanced/authentication // XML Path: /configuration/advanced/authentication
$node = $this->getXMLNode($xml, '/configuration/advanced', 'authentication'); $node = $this->getXMLNode($xml, '/configuration/advanced', 'authentication');

View File

@ -66,6 +66,7 @@ if ($action == "adduser") {
UI::exitError(getMLText("admin_tools"),getMLText("user_email_missing")); UI::exitError(getMLText("admin_tools"),getMLText("user_email_missing"));
} }
$comment = $_POST["comment"]; $comment = $_POST["comment"];
$theme = $_POST["theme"];
if ($settings->_strictFormCheck && !$comment) { if ($settings->_strictFormCheck && !$comment) {
UI::exitError(getMLText("admin_tools"),getMLText("user_comment_missing")); UI::exitError(getMLText("admin_tools"),getMLText("user_comment_missing"));
} }
@ -79,7 +80,7 @@ if ($action == "adduser") {
UI::exitError(getMLText("admin_tools"),getMLText("user_exists")); 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) { if ($newUser) {
/* Set user image if uploaded */ /* Set user image if uploaded */
@ -371,6 +372,7 @@ else if ($action == "edituser") {
$name = $_POST["name"]; $name = $_POST["name"];
$email = $_POST["email"]; $email = $_POST["email"];
$comment = $_POST["comment"]; $comment = $_POST["comment"];
$theme = $_POST["theme"];
$role = $dms->getRole($_POST["role"]); $role = $dms->getRole($_POST["role"]);
$isHidden = (isset($_POST["ishidden"]) && $_POST["ishidden"]==1 ? 1 : 0); $isHidden = (isset($_POST["ishidden"]) && $_POST["ishidden"]==1 ? 1 : 0);
$isDisabled = (isset($_POST["isdisabled"]) && $_POST["isdisabled"]==1 ? 1 : 0); $isDisabled = (isset($_POST["isdisabled"]) && $_POST["isdisabled"]==1 ? 1 : 0);
@ -408,6 +410,8 @@ else if ($action == "edituser") {
$editedUser->setEmail($email); $editedUser->setEmail($email);
if ($editedUser->getComment() != $comment) if ($editedUser->getComment() != $comment)
$editedUser->setComment($comment); $editedUser->setComment($comment);
if ($editedUser->getTheme() != $theme)
$editedUser->setTheme($theme);
if ($editedUser->getRole() != $role) if ($editedUser->getRole() != $role)
$editedUser->setRole($role); $editedUser->setRole($role);
if ($editedUser->getQuota() != $quota) if ($editedUser->getQuota() != $quota)

View File

@ -88,6 +88,24 @@ class SeedDMS_View_Settings extends SeedDMS_Theme_Style {
$this->showRawConfigHeadline(htmlspecialchars(getMLText($title))); $this->showRawConfigHeadline(htmlspecialchars(getMLText($title)));
} /* }}} */ } /* }}} */
/**
* Show a text input configuration option
*
* @param string $title title of the option
* @param string $name name of html input field
* @param string $type can be 'password', 'array'
* @param string $placeholder placeholder for input field
*/
protected function isVisible($name) { /* {{{ */
$settings = $this->params['settings'];
if(!($hcf = $settings->_hiddenConfFields))
return true;
$hcfa = explode(';', $hcf);
if(in_array($name, $hcfa))
return false;
return true;
} /* }}} */
/** /**
* Show a text input configuration option * Show a text input configuration option
* *
@ -98,6 +116,8 @@ class SeedDMS_View_Settings extends SeedDMS_Theme_Style {
*/ */
protected function showConfigText($title, $name, $type='', $placeholder='') { /* {{{ */ protected function showConfigText($title, $name, $type='', $placeholder='') { /* {{{ */
$settings = $this->params['settings']; $settings = $this->params['settings'];
if(!$this->isVisible($name))
return;
?> ?>
<tr title="<?= getMLText($title."_desc") ?>"> <tr title="<?= getMLText($title."_desc") ?>">
<td><?= getMLText($title) ?>:</td> <td><?= getMLText($title) ?>:</td>

View File

@ -237,6 +237,7 @@ $(document).ready( function() {
function showUserForm($currUser) { /* {{{ */ function showUserForm($currUser) { /* {{{ */
$dms = $this->params['dms']; $dms = $this->params['dms'];
$user = $this->params['user']; $user = $this->params['user'];
$settings = $this->params['settings'];
$users = $this->params['allusers']; $users = $this->params['allusers'];
$groups = $this->params['allgroups']; $groups = $this->params['allgroups'];
$roles = $this->params['allroles']; $roles = $this->params['allroles'];
@ -352,6 +353,19 @@ $(document).ready( function() {
'options'=>$options '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(); $options = array();
foreach($groups as $group) { foreach($groups as $group) {
$options[] = array($group->getID(), htmlspecialchars($group->getName()), ($currUser && $group->isMember($currUser))); $options[] = array($group->getID(), htmlspecialchars($group->getName()), ($currUser && $group->isMember($currUser)));