| | |
| | | $app->tpl->setVar("username", $app->tools_sites->removePrefix($this->dataRecord['username'], $this->dataRecord['username_prefix'], $shelluser_prefix)); |
| | | } |
| | | |
| | | $app->tpl->setVar("username_prefix", $app->tools_sites->getPrefix($this->dataRecord['username_prefix'], $shelluser_prefix, $global_config['shelluser_prefix'])); |
| | | if($this->dataRecord['username'] == "") { |
| | | $app->tpl->setVar("username_prefix", $shelluser_prefix); |
| | | } else { |
| | | $app->tpl->setVar("username_prefix", $app->tools_sites->getPrefix($this->dataRecord['username_prefix'], $shelluser_prefix, $global_config['shelluser_prefix'])); |
| | | } |
| | | |
| | | if($this->id > 0) { |
| | | //* we are editing a existing record |
| | |
| | | global $app, $conf; |
| | | |
| | | // Get the record of the parent domain |
| | | //$parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]) . " AND ".$app->tform->getAuthSQL('r')); |
| | | //if(!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm"); |
| | | if(isset($this->dataRecord["parent_domain_id"])) { |
| | | $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]) . " AND ".$app->tform->getAuthSQL('r')); |
| | | $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ? AND ".$app->tform->getAuthSQL('r'), @$this->dataRecord["parent_domain_id"]); |
| | | if(!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm"); |
| | | } else { |
| | | $tmp = $app->tform->getDataRecord($this->id); |
| | | $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval($tmp["parent_domain_id"]) . " AND ".$app->tform->getAuthSQL('r')); |
| | | $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ? AND ".$app->tform->getAuthSQL('r'), $tmp["parent_domain_id"]); |
| | | if(!$parent_domain) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm"); |
| | | unset($tmp); |
| | | } |
| | |
| | | function onAfterInsert() { |
| | | global $app, $conf; |
| | | |
| | | $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->dataRecord["parent_domain_id"])); |
| | | $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ?", $this->dataRecord["parent_domain_id"]); |
| | | |
| | | $server_id = $app->functions->intval($web["server_id"]); |
| | | $dir = $app->db->quote($web["document_root"]); |
| | | $uid = $app->db->quote($web["system_user"]); |
| | | $gid = $app->db->quote($web["system_group"]); |
| | | $dir = $web["document_root"]; |
| | | $uid = $web["system_user"]; |
| | | $gid = $web["system_group"]; |
| | | |
| | | // Check system user and group |
| | | if($app->functions->is_allowed_user($uid) == false || $app->functions->is_allowed_group($gid) == false) { |
| | |
| | | // The FTP user shall be owned by the same group then the website |
| | | $sys_groupid = $app->functions->intval($web['sys_groupid']); |
| | | |
| | | $sql = "UPDATE shell_user SET server_id = $server_id, dir = '$dir', puser = '$uid', pgroup = '$gid', sys_groupid = '$sys_groupid' WHERE shell_user_id = ".$this->id; |
| | | $app->db->query($sql); |
| | | $sql = "UPDATE shell_user SET server_id = ?, dir = ?, puser = ?, pgroup = ?, sys_groupid = ? WHERE shell_user_id = ?"; |
| | | $app->db->query($sql, $server_id, $dir, $uid, $gid, $sys_groupid, $this->id); |
| | | |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | unset($blacklist); |
| | | |
| | | // Check system user and group |
| | | if(isset($this->dataRecord['puser'])) { |
| | | if($app->functions->is_allowed_user(strtolower($this->dataRecord['puser']),true) == false || $app->functions->is_allowed_group(strtolower($this->dataRecord['pgroup']),true) == false) { |
| | | $app->tform->errorMessage .= $app->tform->lng('invalid_system_user_or_group_txt'); |
| | | } |
| | | } |
| | | |
| | | /* |
| | | * If the names should be restricted -> do it! |