From 526b997c9891a796b152cdbab8e329b356b1f596 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Fri, 22 Feb 2013 08:59:02 -0500
Subject: [PATCH] Merged revisions 3803-3844 from stable branch.

---
 interface/web/sites/aps_install_package.php |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/interface/web/sites/aps_install_package.php b/interface/web/sites/aps_install_package.php
index be60121..b7bed71 100644
--- a/interface/web/sites/aps_install_package.php
+++ b/interface/web/sites/aps_install_package.php
@@ -37,7 +37,7 @@
 $app->auth->check_module_permissions('sites');
 
 // Load needed classes
-$app->uses('tpl');
+$app->uses('tpl,tform');
 $app->tpl->newTemplate("form.tpl.htm");
 $app->tpl->setInclude('content_tpl', 'templates/aps_install_package.htm');
 
@@ -46,6 +46,19 @@
 require_once($lngfile);
 $app->tpl->setVar($wb);
 $app->load_language_file('web/sites/'.$lngfile);
+
+// we will check only users, not admins
+if($_SESSION["s"]["user"]["typ"] == 'user') {		
+	$app->tform->formDef['db_table_idx'] = 'client_id';
+	$app->tform->formDef['db_table'] = 'client';
+	if(!$app->tform->checkClientLimit('limit_aps')) {
+		$app->error($app->lng("limit_aps_txt"));
+	}
+	if(!$app->tform->checkResellerLimit('limit_aps')) {
+		$app->error('Reseller: '.$wb["limit_aps_txt"]);
+	}		
+}
+
 
 $adminflag = ($_SESSION['s']['user']['typ'] == 'admin') ? true : false;
 $gui = new ApsGUIController($app);
@@ -74,7 +87,7 @@
 $domain_for_user = '';
 if(!$adminflag) $domain_for_user = "AND (sys_userid = '".$app->db->quote($_SESSION['s']['user']['userid'])."' 
     OR sys_groupid = '".$app->db->quote($_SESSION['s']['user']['userid'])."' )";
-$domains_assoc = $app->db->queryAllRecords("SELECT domain FROM web_domain WHERE document_root != '' ".$domain_for_user." ORDER BY domain;");
+$domains_assoc = $app->db->queryAllRecords("SELECT domain FROM web_domain WHERE document_root != '' AND (type = 'vhost' OR type = 'vhostsubdomain') AND active = 'y' ".$domain_for_user." ORDER BY domain;");
 if(!empty($domains_assoc)) foreach($domains_assoc as $domain) $domains[] = $domain['domain'];
 
 // If data has been submitted, validate it

--
Gitblit v1.9.1