From 419403a8957857d5a438860624bf71deed471a58 Mon Sep 17 00:00:00 2001
From: ftimme <ft@falkotimme.com>
Date: Thu, 21 Feb 2013 11:24:39 -0500
Subject: [PATCH] - Fixed FS#2617 - Limit for APS packages missing in client limits.

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

diff --git a/interface/web/sites/aps_install_package.php b/interface/web/sites/aps_install_package.php
index be60121..b10c686 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');
 
@@ -47,6 +47,19 @@
 $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);
 $pkg_id = (isset($_GET['id'])) ? $app->db->quote($_GET['id']) : '';

--
Gitblit v1.9.1