Bläddra i källkod

add cwp7CheckLimit

andre 3 år sedan
förälder
incheckning
7295287f44
1 ändrade filer med 18 tillägg och 3 borttagningar
  1. 18 3
      cwp7.php

+ 18 - 3
cwp7.php

@@ -282,8 +282,16 @@ function cwp7_ClientArea($params) {
 			$response
 		);
 	}
-	cwp7CheckLimit($params,'domain');
-
+	if(cwp7CheckLimit($params,'domain')){
+		$clientInfo['domainlimit'] = 1;
+	} else {
+		$clientInfo['domainlimit'] = 0;
+	};
+	if(cwp7CheckLimit($params,'subdomain')){
+		$clientInfo['subdomainlimit'] = 1;
+	} else {
+		$clientInfo['subdomainlimit'] = 0;
+	};
 	$domains = $response['result']['domains'];
 	$subDomains = $response['result']['subdomins'];
 	$clientInfo['domains'] = array();
@@ -487,6 +495,9 @@ function cwp7_UsageUpdate($params) {
  * @return array
  */
 function cwp7_ClientAreaCustomButtonArray ($params) {
+	if(cwp7CheckLimit($params, 'domain')) {
+		return array();
+	}
 	return array(
 		'Neue Domain' => 'newDomain',
 	);
@@ -1160,7 +1171,7 @@ function cwp7CheckSOA($domain, $nameserverIP, $nameserverName ) {
  *
  * @see https://developers.whmcs.com/provisioning-modules/supported-functions/
  *
- * @return bool 'none' -> not registered, 'self' -> registered at own or the name of an other responsible nameserver
+ * @return bool true -> limit reached, false -> limit noch reached
  */
 function cwp7CheckLimit($params, $type) {
 	$cwp7 = new cwp7_Admin($params['serverhostname'], $params['serveraccesshash']);
@@ -1172,4 +1183,8 @@ function cwp7CheckLimit($params, $type) {
 		'debug',
 		$type
 	);
+	if($response[$type]['sw'] < 1) {
+		return true;
+	}
+	return false;
 }