From 897af06af9522ded99b1e0f46730299e89856ffe Mon Sep 17 00:00:00 2001 From: tbrehm <t.brehm@ispconfig.org> Date: Mon, 11 Jun 2012 05:00:57 -0400 Subject: [PATCH] Updated version number to 3.0.4.6 --- interface/web/sites/web_domain_edit.php | 27 +++++++++++++++++++-------- 1 files changed, 19 insertions(+), 8 deletions(-) diff --git a/interface/web/sites/web_domain_edit.php b/interface/web/sites/web_domain_edit.php index dff5148..e3d5ed6 100644 --- a/interface/web/sites/web_domain_edit.php +++ b/interface/web/sites/web_domain_edit.php @@ -50,7 +50,7 @@ class page_action extends tform_actions { - // Returna a "3/2/1" path hash from a numeric id '123' + //* Returna a "3/2/1" path hash from a numeric id '123' function id_hash($id,$levels) { $hash = "" . $id % 10 ; $id /= 10 ; @@ -74,6 +74,11 @@ if(!$app->tform->checkResellerLimit('limit_web_domain',"type = 'vhost'")) { $app->error('Reseller: '.$app->tform->wordbook["limit_web_domain_txt"]); } + + // Get the limits of the client + $client_group_id = $_SESSION["s"]["user"]["default_group"]; + $client = $app->db->queryOneRecord("SELECT client.default_webserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id"); + $app->tpl->setVar("server_id_value", $client['default_webserver']); } parent::onShowNew(); @@ -141,10 +146,11 @@ $records = $app->db->queryAllRecords($sql); $tmp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ".$client['client_id']); $client_select = '<option value="'.$tmp['groupid'].'">'.$client['contact_name'].'</option>'; - $tmp_data_record = $app->tform->getDataRecord($this->id); + //$tmp_data_record = $app->tform->getDataRecord($this->id); + if(is_array($records)) { foreach( $records as $rec) { - $selected = @($rec["groupid"] == $tmp_data_record["sys_groupid"])?'SELECTED':''; + $selected = @(is_array($this->dataRecord) && ($rec["groupid"] == $this->dataRecord['client_group_id'] || $rec["groupid"] == $this->dataRecord['sys_groupid']))?'SELECTED':''; $client_select .= "<option value='$rec[groupid]' $selected>$rec[name]</option>\r\n"; } } @@ -226,10 +232,11 @@ $sql = "SELECT groupid, name FROM sys_group WHERE client_id > 0 ORDER BY name"; $clients = $app->db->queryAllRecords($sql); $client_select = "<option value='0'></option>"; - $tmp_data_record = $app->tform->getDataRecord($this->id); + //$tmp_data_record = $app->tform->getDataRecord($this->id); if(is_array($clients)) { foreach( $clients as $client) { - $selected = @($client["groupid"] == $tmp_data_record["sys_groupid"])?'SELECTED':''; + //$selected = @($client["groupid"] == $tmp_data_record["sys_groupid"])?'SELECTED':''; + $selected = @(is_array($this->dataRecord) && ($client["groupid"] == $this->dataRecord['client_group_id'] || $client["groupid"] == $this->dataRecord['sys_groupid']))?'SELECTED':''; $client_select .= "<option value='$client[groupid]' $selected>$client[name]</option>\r\n"; } } @@ -536,7 +543,7 @@ function onAfterUpdate() { global $app, $conf; - // make sure that the record belongs to the clinet group and not the admin group when a admin inserts it + // make sure that the record belongs to the client group and not the admin group when a admin inserts it // also make sure that the user can not delete domain created by a admin if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) { $client_group_id = intval($this->dataRecord["client_group_id"]); @@ -562,10 +569,14 @@ $client_group_id = $_SESSION["s"]["user"]["default_group"]; $client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = $client_group_id"); $client_id = intval($client["client_id"]); - } else { - //$client_id = intval(@$web_rec["client_group_id"]); + } elseif (isset($this->dataRecord["client_group_id"])) { + $client_group_id = $this->dataRecord["client_group_id"]; $client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = ".intval(@$this->dataRecord["client_group_id"])); $client_id = intval($client["client_id"]); + } else { + $client_group_id = $web_rec['sys_groupid']; + $client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = ".intval($client_group_id)); + $client_id = intval($client["client_id"]); } if(($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) && isset($this->dataRecord["client_group_id"]) && $this->dataRecord["client_group_id"] != $this->oldDataRecord["sys_groupid"]) { -- Gitblit v1.9.1