From 0aa4efbc0b79ba9ab8a66e8facfda8cb16b7c427 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Mon, 07 May 2012 11:01:19 -0400
Subject: [PATCH] Improved mysql db library.
---
interface/web/dns/dns_slave_edit.php | 26 +++++++++++++++++---------
1 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/interface/web/dns/dns_slave_edit.php b/interface/web/dns/dns_slave_edit.php
index 9ffbf83..4564da1 100644
--- a/interface/web/dns/dns_slave_edit.php
+++ b/interface/web/dns/dns_slave_edit.php
@@ -76,10 +76,10 @@
$clients = $app->db->queryAllRecords($sql);
$client_select = '';
if($_SESSION["s"]["user"]["typ"] == 'admin') $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 = @(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";
}
}
@@ -95,15 +95,23 @@
$clients = $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($clients)) {
foreach( $clients as $client) {
- $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";
}
}
$app->tpl->setVar("client_group_id",$client_select);
+ }
+
+ if($this->id > 0) {
+ //* we are editing a existing record
+ $app->tpl->setVar("edit_disabled", 1);
+ $app->tpl->setVar("server_id_value", $this->dataRecord["server_id"]);
+ } else {
+ $app->tpl->setVar("edit_disabled", 0);
}
parent::onShowEnd();
@@ -129,11 +137,11 @@
$this->dataRecord["server_id"] = $client["default_dnsserver"];
// Check if the user may add anoter secondary domain.
- if($client["limit_slave_dns_zone"] >= 0) {
- $tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_slave WHERE sys_groupid = $client_group_id");
- if($tmp["number"] >= $client["limit_dns_slave_zone"]) {
- $app->error($app->tform->wordbook["limit_dns_slave_zone_txt"]);
- }
+ if(!$app->tform->checkClientLimit('limit_dns_slave_zone')) {
+ $app->error($app->tform->wordbook["limit_dns_slave_zone_txt"]);
+ }
+ if(!$app->tform->checkResellerLimit('limit_dns_slave_zone')) {
+ $app->error('Reseller: '.$app->tform->wordbook["limit_dns_slave_zone_txt"]);
}
}
}
--
Gitblit v1.9.1