From b33d7d56dfc4490f83b896ba99de3c1aca99854e Mon Sep 17 00:00:00 2001
From: Till Brehm <tbrehm@ispconfig.org>
Date: Wed, 15 Jun 2016 04:22:08 -0400
Subject: [PATCH] Fixed issue #3955 DNS module: Limit for maximum zones can be circumvented with "import zone file" function. Removed TODO string in error template.

---
 interface/web/dns/dns_import.php |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/interface/web/dns/dns_import.php b/interface/web/dns/dns_import.php
index bd8cc84..6bb738e 100644
--- a/interface/web/dns/dns_import.php
+++ b/interface/web/dns/dns_import.php
@@ -38,11 +38,23 @@
 $error = '';
 
 // Loading the template
-$app->uses('tpl,validate_dns');
+$app->uses('tform,tpl,validate_dns');
 $app->tpl->newTemplate("form.tpl.htm");
 $app->tpl->setInclude('content_tpl', 'templates/dns_import.htm');
 $app->load_language_file('/web/dns/lib/lang/'.$_SESSION['s']['language'].'_dns_wizard.lng');
 
+// Check if dns record limit has been reached. We will check only users, not admins
+if($_SESSION["s"]["user"]["typ"] == 'user') {
+	$app->tform->formDef['db_table_idx'] = 'id';
+	$app->tform->formDef['db_table'] = 'dns_soa';
+	if(!$app->tform->checkClientLimit('limit_dns_zone')) {
+		$app->error($app->lng('limit_dns_zone_txt'));
+	}
+	if(!$app->tform->checkResellerLimit('limit_dns_zone')) {
+		$app->error('Reseller: '.$app->lng('limit_dns_zone_txt'));
+	}
+}
+
 // import variables
 $template_id = (isset($_POST['template_id']))?$app->functions->intval($_POST['template_id']):0;
 $sys_groupid = (isset($_POST['client_group_id']))?$app->functions->intval($_POST['client_group_id']):0;

--
Gitblit v1.9.1