From 89e4329a8068e3631d3f64f6896fa3907c687cf5 Mon Sep 17 00:00:00 2001 From: Marius Cramer <m.cramer@pixcept.de> Date: Thu, 08 Jan 2015 09:08:50 -0500 Subject: [PATCH] Layout fix: tab toggle and monitor tables --- interface/web/sites/webdav_user_edit.php | 36 ++++++++++++++++++++++++++---------- 1 files changed, 26 insertions(+), 10 deletions(-) diff --git a/interface/web/sites/webdav_user_edit.php b/interface/web/sites/webdav_user_edit.php index 97b2bcc..fcea99e 100644 --- a/interface/web/sites/webdav_user_edit.php +++ b/interface/web/sites/webdav_user_edit.php @@ -81,7 +81,11 @@ $app->tpl->setVar("username", $app->tools_sites->removePrefix($this->dataRecord['username'], $this->dataRecord['username_prefix'], $webdavuser_prefix)); } - $app->tpl->setVar("username_prefix", $app->tools_sites->getPrefix($this->dataRecord['username_prefix'], $webdavuser_prefix, $global_config['webdavuser_prefix'])); + if($this->dataRecord['username'] == "") { + $app->tpl->setVar("username_prefix", $webdavuser_prefix); + } else { + $app->tpl->setVar("username_prefix", $app->tools_sites->getPrefix($this->dataRecord['username_prefix'], $webdavuser_prefix, $global_config['webdavuser_prefix'])); + } if($this->id > 0) { //* we are editing a existing record @@ -139,15 +143,6 @@ */ $hash = md5($this->dataRecord["username"] . ':' . $this->dataRecord["dir"] . ':' . $this->dataRecord["password"]); $this->dataRecord["password"] = $hash; - - /* - * Get the data of the domain, owning the webdav user - */ - $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->dataRecord["parent_domain_id"])); - /* The server is the server of the domain */ - $this->dataRecord["server_id"] = $web["server_id"]; - /* The Webdav user shall be owned by the same group then the website */ - $this->dataRecord["sys_groupid"] = $web['sys_groupid']; } parent::onBeforeInsert(); @@ -155,6 +150,15 @@ function onAfterInsert() { global $app, $conf; + + $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->dataRecord["parent_domain_id"])); + $server_id = $app->functions->intval($web["server_id"]); + + // The webdav user shall be owned by the same group then the website + $sys_groupid = $app->functions->intval($web['sys_groupid']); + + $sql = "UPDATE webdav_user SET server_id = $server_id, sys_groupid = '$sys_groupid' WHERE webdav_user_id = ".$this->id; + $app->db->query($sql); } function onBeforeUpdate() { @@ -184,6 +188,18 @@ function onAfterUpdate() { global $app, $conf; + + //* When the site of the webdav user has been changed + if(isset($this->dataRecord['parent_domain_id']) && $this->oldDataRecord['parent_domain_id'] != $this->dataRecord['parent_domain_id']) { + $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->dataRecord["parent_domain_id"])); + $server_id = $app->functions->intval($web["server_id"]); + + // The webdav user shall be owned by the same group then the website + $sys_groupid = $app->functions->intval($web['sys_groupid']); + + $sql = "UPDATE webdav_user SET server_id = $server_id, sys_groupid = '$sys_groupid' WHERE webdav_user_id = ".$this->id; + $app->db->query($sql); + } } } -- Gitblit v1.9.1