Explorar o código

cleanup clientarea

andre hai 8 meses
pai
achega
acfb2bc4c9
Modificáronse 1 ficheiros con 30 adicións e 692 borrados
  1. 30 692
      siteBuilder.php

+ 30 - 692
siteBuilder.php

@@ -332,91 +332,42 @@ function siteBuilder_UnsuspendAccount($params) {
 function siteBuilder_ClientArea($params) {
 function siteBuilder_ClientArea($params) {
 	$clientInfo = array('moduleclientarea' => '1');
 	$clientInfo = array('moduleclientarea' => '1');
 	$siteBuilder = new ApiClient(getSiteBuilderApiURL($params), $params['serveraccesshash']);
 	$siteBuilder = new ApiClient(getSiteBuilderApiURL($params), $params['serveraccesshash']);
-	$response = $siteBuilder->getSSLDays($params['domain'],$params['username']);
-	if($response['status'] == 'OK') {
-		$sslSites = array();
-		foreach($response['msj'] as $sslSite) {
-			$sslSites[$sslSite['ssl']] = array(
-				'auotssl'	=> $sslSite['autossl'],
-				'expire'	=> $sslSite['exp'],
-			);
-		}
-	}
-	$response = $siteBuilder->getAccount($params['username']);
-	if($response['status'] != 'OK') {
+	$responseSSL = $siteBuilder->getSSLDays($params['domain'],$params['username']);
+
+	logModuleCall(
+		'siteBuilder',
+		__FUNCTION__,
+		$params,
+		'debug',
+		$responseSSL
+	);
+
+    $accountObj = Capsule::table('sitePro_acc')
+        ->select('*')
+        ->where('pid', '=', $params['serverid'])
+        ->get();
+
 		logModuleCall(
 		logModuleCall(
 			'siteBuilder',
 			'siteBuilder',
 			__FUNCTION__,
 			__FUNCTION__,
 			$params,
 			$params,
 			'debug',
 			'debug',
-			$response
+			$accountObj
 		);
 		);
-	}
-	if(siteBuilderCheckLimit($params,'domains')){
-		$clientInfo['domainlimit'] = 1;
-	} else {
-		$clientInfo['domainlimit'] = 0;
-	};
-	if(siteBuilderCheckLimit($params,'subdomins')){
-		$clientInfo['subdomainlimit'] = 1;
-	} else {
-		$clientInfo['subdomainlimit'] = 0;
-	};
-	$clientInfo['db_max'] = $response['result']['account_info']['db_max'];
-	$clientInfo['db_used'] = $response['result']['account_info']['db_used'];
-	$clientInfo['ftp_accounts'] = $response['result']['account_info']['ftp_accounts'];
-	$clientInfo['ftp_accounts_used'] = $response['result']['account_info']['ftp_accounts_used'];
-	$clientInfo['addons_domains'] = $response['result']['account_info']['addons_domains'];
-	$clientInfo['addons_domains_used'] = $response['result']['account_info']['addons_domains_used'];
-	$clientInfo['sub_domains'] = $response['result']['account_info']['sub_domains'];
-	$clientInfo['sub_domains_used'] = $response['result']['account_info']['sub_domains_used'];
-	$clientInfo['space_usage'] = $response['result']['account_info']['space_usage'];
-	$clientInfo['space_disk'] = $response['result']['account_info']['space_disk'];
-	$clientInfo['bandwidth_used'] = $response['result']['account_info']['bandwidth_used'];
-	$clientInfo['bandwidth'] = $response['result']['account_info']['bandwidth'];
-	$domains = $response['result']['domains'];
-	$subDomains = $response['result']['subdomins'];
-	$clientInfo['domains'] = array();
-	foreach($domains as $domain) {
-		if($domain['path'] == '/home/' . $params['username'] . '/public_html') {
-			$clientInfo['mgmtDomain'] = $domain['domain'];
-			$clientInfo['mgmtEmail'] = $domain['email'];
-		} else {
-			$domain['relpath'] = str_replace('/home/' . $params['username'], '~', $domain['path']);
-			if(array_key_exists($domain['domain'], $sslSites)) {
-				$domain['ssl'] = 1;
-				$domain['sslexpire'] = $sslSites[$domain['domain']]['expire'];
-				$domain['autossl'] = $sslSites[$domain['domain']]['auotssl'];
-			}
-			if(siteBuilderCheckA($domain['domain'],$params['serverip'],$params['configoption5']) == 1) {
-				$domain['DNS'] = 1;
-			}
-			$domain['domainNS'] = siteBuilderCheckSOA($domain['domain'],$params['configoption5']);
-			$domain['subdomains'] = array();
-			foreach($subDomains as $subDomain) {
-				if($subDomain['domain'] == $domain['domain']) {
-					$subFQDN = $subDomain['subdomain'] . '.' . $subDomain['domain'];
-					$subDomain['relpath'] = str_replace('/home/' . $params['username'], '~', $subDomain['path']);
-					if(array_key_exists($subFQDN, $sslSites)) {
-						$subDomain['ssl'] = 1;
-						$subDomain['sslexpire'] = $sslSites[$subFQDN]['expire'];
-						$subDomain['autossl'] = $sslSites[$subFQDN]['auotssl'];
-					} else {
-						unset($subDomain['ssl']);
-						unset($subDomain['sslexpire']);
-						unset($subDomain['autossl']);
-					}
-					if(siteBuilderCheckA($subFQDN,$params['serverip'],$params['configoption5']) == 1) {
-						$subDomain['DNS'] = 1;
-					} else {
-						unset($subDomain['DNS']);
-					}
-				array_push($domain['subdomains'], $subDomain);
-				}
-			}
-			array_push($clientInfo['domains'], $domain);
-		}
-	}
+
+	$domainsObj =  Capsule::table('sitePro_acc')
+		->select('*')
+		->where('relid', '=', $params['serverid'])
+		->get();
+
+		logModuleCall(
+			'siteBuilder',
+			__FUNCTION__,
+			$params,
+			'debug',
+			$domainsObj
+		);
+
 	return array(
 	return array(
         'tabOverviewReplacementTemplate' => 'clientarea',
         'tabOverviewReplacementTemplate' => 'clientarea',
         'vars' => $clientInfo,
         'vars' => $clientInfo,
@@ -435,46 +386,6 @@ function siteBuilder_ClientArea($params) {
  * @return array
  * @return array
  */
  */
 function siteBuilder_ServiceSingleSignOn($params) {
 function siteBuilder_ServiceSingleSignOn($params) {
-	$siteBuilder = new ApiClient(getSiteBuilderApiURL($params), $params['serveraccesshash']);
-	$response = $siteBuilder->getLoginLink($params['username']);
-	if($response['status'] == 'OK') {
-		$link = $response['msj']['details'];
-		$linkautologin = $link[0]['url'];
-		return array(
-			'success' => true,
-			'redirectTo' => $linkautologin,
-		);
-	} else {
-		return array(
-			'success' => false,
-			'redirectTo' => '',
-		);
-	}
-}
-
-/**
- * Change the password for a siteBuilder account.
- *
- * Called when a password change is requested. This can occur either due to a
- * client requesting it via the client area or an admin requesting it from the
- * admin side.
- *
- * This option is only available to client end users when the product is in an
- * active status.
- *
- * @param array $params common module parameters
- *
- * @see https://developers.whmcs.com/provisioning-modules/supported-functions/
- *
- * @return string "success" or an error message
- */
-function siteBuilder_ChangePassword($params) {
-	$siteBuilder = new siteBuilder_Admin($params['serverhostname'], $params['serveraccesshash']);
-	$response = $siteBuilder->changePass(array('user' => $params['username'], 'password' => $params['password']));
-	if($response['status'] != 'OK') {
-		return 'Error: ' . $response['error_msg'];
-	}
-	return 'success';
 }
 }
 
 
 /**
 /**
@@ -494,20 +405,6 @@ function siteBuilder_ChangePassword($params) {
  * @return string "success" or an error message
  * @return string "success" or an error message
  */
  */
 function siteBuilder_ChangePackage($params) {
 function siteBuilder_ChangePackage($params) {
-	$siteBuilder = new siteBuilder_Admin($params['serverhostname'], $params['serveraccesshash']);
-	$data = array(
-		'user' => $params['username'],
-		'email' => $params['clientsdetails']['email'],
-		'package' => $params['configoption1'],
-		'inode' => (int) $params["configoption2"],
-		'openfiles' => (int) $params["configoption3"],
-		'processes' => (int) $params["configoption4"],
-		'server_ips'=> $params["serverip"],
-	);
-	$response = $siteBuilder->modifyAccount($data);
-	if($response['status'] != 'OK') {
-		return 'Error: ' . $response['error_msg'];
-	}
 	return 'success';
 	return 'success';
 }
 }
 
 
@@ -521,48 +418,6 @@ function siteBuilder_ChangePackage($params) {
  * @see https://developers.whmcs.com/provisioning-modules/usage-update/
  * @see https://developers.whmcs.com/provisioning-modules/usage-update/
  */
  */
 function siteBuilder_UsageUpdate($params) {
 function siteBuilder_UsageUpdate($params) {
-	$siteBuilder = new siteBuilder_Admin($params['serverhostname'], $params['serveraccesshash']);
-	$response = $siteBuilder->getAllAccounts();
-	if($response['status'] == 'OK'){
-		$results = $response['msj'];
-		for($i = 0; $i < count($results); $i++){
-			if($results[$i]['diskusage'] == '') { 
-				$diskusage = 0;
-			} else {
-				$diskusage = trim($results[$i]['diskusage']);
-			}
-			if($results[$i]['disklimit'] == '') {
-				$disklimit = 0;
-			} else {
-				$disklimit = trim($results[$i]['disklimit']);
-			}
-			if($results[$i]['bandwidth'] == '') {
-				$bandwidth = 0;
-			} else {
-				$bandwidth  =trim($results[$i]['bandwidth']);
-			}
-			if($results[$i]['bwlimit'] == '') {
-				$bwlimit = 0;
-			} else {
-				$bwlimit = trim($results[$i]['bwlimit']);
-			}
-			$domain = trim($results[$i]['domain']);
-			try {
-				\WHMCS\Database\Capsule::table('tblhosting')
-					->where('server', $params['serverid'])
-					->where('domain', $domain)
-					->update([
-						'diskusage' => $diskusage,
-						'disklimit' => $disklimit,
-						'bwusage' => $bandwidth,
-						'bwlimit' => $bwlimit,
-						'lastupdate' => date('Y-m-d H:i:S'),
-					]);
-			} catch (\Exception $e) {
-				logActivity('ERROR: Unable to update server usage: ' . $e->getMessage());
-			}
-		}
-	}
 }
 }
 
 
 /**
 /**
@@ -577,9 +432,6 @@ function siteBuilder_UsageUpdate($params) {
  * @return array
  * @return array
  */
  */
 function siteBuilder_ClientAreaCustomButtonArray ($params) {
 function siteBuilder_ClientAreaCustomButtonArray ($params) {
-	if(siteBuilderCheckLimit($params, 'domains')) {
-		return array();
-	}
 	return array(
 	return array(
 		'Neue Domain' => 'newDomain',
 		'Neue Domain' => 'newDomain',
 	);
 	);
@@ -597,12 +449,6 @@ function siteBuilder_ClientAreaCustomButtonArray ($params) {
  */
  */
 function siteBuilder_ClientAreaAllowedFunctions() {
 function siteBuilder_ClientAreaAllowedFunctions() {
 	return array(
 	return array(
-		"Enable SSL" => "enableSSL",
-		"Renew SSL" => "renewSSL",
-		"Set DNS" => "setDNS",
-		"Unset DNS" => "unsetDNS",
-		"Confirm Enable SSL" => "enableSSLConfirm",
-		"Confirm Renew SSL" => "renewSSLConfirm",
 		"Confirm Set DNS" => "setDNSConfirm",
 		"Confirm Set DNS" => "setDNSConfirm",
 		"Confirm Unset DNS" => "unsetDNSConfirm",
 		"Confirm Unset DNS" => "unsetDNSConfirm",
 		"Info DNS" => "infoDNS",
 		"Info DNS" => "infoDNS",
@@ -649,17 +495,6 @@ function siteBuilder_addDomain($params) {
 	if(!filter_var($_POST['d'], FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)){
 	if(!filter_var($_POST['d'], FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)){
 		return 'Error: invalid domain name';
 		return 'Error: invalid domain name';
 	}
 	}
-	if(siteBuilderCheckLimit($params, 'domains')) {
-		return 'Error: domain limit exceeded';
-	}
-	$vars['user'] = $params['username'];
-	$vars['name'] = $_POST['d'];
-	$vars['type'] = 'domain';
-	$siteBuilder = new siteBuilder_Admin($params['serverhostname'], $params['serveraccesshash']);
-	$response = $siteBuilder->addDomain($vars);
-	if($response['status'] != 'OK') {
-		return 'Error: ' . $response['error_msg'];
-	}
 	return 'success';
 	return 'success';
 }
 }
 
 
@@ -706,17 +541,6 @@ function siteBuilder_addSubdomain($params) {
 	if($_POST['s'] == 'www') {
 	if($_POST['s'] == 'www') {
 		return 'Error: default Subdomain www wurde bereits automatisch erstellt' ;
 		return 'Error: default Subdomain www wurde bereits automatisch erstellt' ;
 	}
 	}
-	if(siteBuilderCheckLimit($params, 'subdomins')) {
-		return 'Error: subdomain limit exceeded';
-	}
-	$vars['user'] = $params['username'];
-	$vars['name'] = $_POST['s'] . '.' . $_POST['d'];
-	$vars['type'] = 'subdomain';
-	$siteBuilder = new siteBuilder_Admin($params['serverhostname'], $params['serveraccesshash']);
-	$response = $siteBuilder->addDomain($vars);
-	if($response['status'] != 'OK') {
-		return 'Error: ' . $response['error_msg'];
-	}
 	return 'success';
 	return 'success';
 }
 }
 
 
@@ -751,42 +575,6 @@ function siteBuilder_delDomain($params) {
 	if(!filter_var($_POST['d'], FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)){
 	if(!filter_var($_POST['d'], FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)){
 		return 'Error: invalid domain name';
 		return 'Error: invalid domain name';
 	}
 	}
-	$siteBuilder = new siteBuilder_Admin($params['serverhostname'], $params['serveraccesshash']);
-	$response = $siteBuilder->getAccount($params['username']);
-	if($response['status'] != 'OK') {
-		logModuleCall(
-			'siteBuilder',
-			__FUNCTION__,
-			$params,
-			'debug',
-			$response
-		);
-	}
-	$domains = $response['result']['domains'];
-	$clientdomains = array();
-	foreach($domains as $domain){
-		if($domain['domain'] != $params['domain']) {
-			array_push($clientdomains, $domain['domain']);
-		}
-	}
-	if(!in_array($_POST['d'], $clientdomains)) {
-		logModuleCall(
-			'siteBuilder',
-			__FUNCTION__,
-			$_POST,
-			'POST DATA VIOLATION',
-			$params
-		);
-		return 'Error: ' . $_POST['d'] . ' not in client domains';
-	}
-	// do delete domain
-	$vars['user'] = $params['username'];
-	$vars['name'] = $_POST['d'];
-	$vars['type'] = 'domain';
-	$response = $siteBuilder->deleteDomain($vars);
-	if($response['status'] != 'OK') {
-		return 'Error: ' . $response['error_msg'];
-	}
 	return 'success';
 	return 'success';
 }
 }
 
 
@@ -821,459 +609,9 @@ function siteBuilder_delSubdomain($params) {
 	if(!filter_var($_POST['d'], FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)){
 	if(!filter_var($_POST['d'], FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)){
 		return 'Error: invalid domain name';
 		return 'Error: invalid domain name';
 	}
 	}
-	$siteBuilder = new siteBuilder_Admin($params['serverhostname'], $params['serveraccesshash']);
-	$response = $siteBuilder->getAccount($params['username']);
-	if($response['status'] != 'OK') {
-		logModuleCall(
-			'siteBuilder',
-			__FUNCTION__,
-			$params,
-			'debug',
-			$response
-		);
-	}
-	$subdomains = $response['result']['subdomins'];
-	$clientsubdomains = array();
-	foreach($subdomains as $subdomain){
-		if($subdomain['domain'] != $params['domain']) {
-			array_push($clientsubdomains, $subdomain['subdomain'] . "." . $subdomain['domain']);
-		}
-	}
-	if(!in_array($_POST['d'], $clientsubdomains)) {
-		logModuleCall(
-			'siteBuilder',
-			__FUNCTION__,
-			$_POST,
-			'POST DATA VIOLATION',
-			$params
-		);
-		return 'Error: ' . $_POST['d'] . ' not in client subdomains';
-	}
-	// do delete subdomain
-	$vars['user'] = $params['username'];
-	$vars['name'] = $_POST['d'];
-	$vars['type'] = 'subdomain';
-	$response = $siteBuilder->deleteDomain($vars);
-	if($response['status'] != 'OK') {
-		return 'Error: ' . $response['error_msg'];
-	}
-	return 'success';
-}
-
-/**
- * Opens a form to enable SSL for a subdomain or domain of a siteBuilder account.
- *
- * @param array $params common module parameters
- *
- * @see https://developers.whmcs.com/provisioning-modules/supported-functions/
- *
- * @return array template information
- */
-function siteBuilder_enableSSLConfirm($params) {
-	return array(
-		'templatefile' => 'siteBuilder_enable_SSL_confirm',
-		'vars' => array(
-			'SSLdomain' => $_POST['d'],
-		),
-    );
-}
-
-/**
- * Aktivate siteBuilder AutoSSL for a subdomain or domain of a siteBuilder account.
- *
- * @param array $params common module parameters
- *
- * @see https://developers.whmcs.com/provisioning-modules/supported-functions/
- *
- * @return string "success" or an error message
- */
-function siteBuilder_enableSSL($params) {
-	if(!filter_var($_POST['d'], FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)){
-		return 'Error: invalid domain name';
-	}
-	$vars['user'] = $params['username'];
-	$vars['name'] = $_POST['d'];
-	$siteBuilder = new siteBuilder_Admin($params['serverhostname'], $params['serveraccesshash']);
-	$response = $siteBuilder->addAutoSSL($vars);
-	if($response['status'] != 'OK') {
-		return 'Error: ' . $response['error_msg'];
-	}
-	return 'success';
-}
-
-/**
- * Opens a form to renew a SSL certificate for a subdomain or domain of a siteBuilder account.
- *
- * @param array $params common module parameters
- *
- * @see https://developers.whmcs.com/provisioning-modules/supported-functions/
- *
- * @return array template information
- */
-function siteBuilder_renewSSLConfirm($params) {
-	return array(
-		'templatefile' => 'siteBuilder_renew_SSL_confirm',
-		'vars' => array(
-			'SSLdomain' => $_POST['d'],
-		),
-    );
-}
-
-/**
- * Renews a SSL certificate for a subdomain or domain of a siteBuilder account.
- *
- * @param array $params common module parameters
- *
- * @see https://developers.whmcs.com/provisioning-modules/supported-functions/
- *
- * @return string "success" or an error message
- */
-function siteBuilder_renewSSL($params) {
-	if(!filter_var($_POST['d'], FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)){
-		return 'Error: invalid domain name';
-	}
-	$vars['user'] = $params['username'];
-	$vars['name'] = $_POST['d'];
-	$siteBuilder = new siteBuilder_Admin($params['serverhostname'], $params['serveraccesshash']);
-	$response = $siteBuilder->updateAutoSSL($vars);
-	if($response['status'] != 'OK') {
-		return 'Error: ' . $response['error_msg'];
-	}
-	return 'success';
-}
-
-/**
- * Opens a form to set a DNS record for a subdomain or domain of a siteBuilder account.
- *
- * @param array $params common module parameters
- *
- * @see https://developers.whmcs.com/provisioning-modules/supported-functions/
- *
- * @return array template information
- */
-function siteBuilder_setDNSConfirm($params) {
-	if(isset($_POST['s'])){
-		return array(
-			'templatefile' => 'siteBuilder_set_DNS_confirm',
-			'vars' => array(
-				'DNSdomain' => $_POST['d'],
-				'DNSsubdomain' => $_POST['s'],
-			),
-		);
-	}
-	return array(
-		'templatefile' => 'siteBuilder_set_DNS_confirm',
-		'vars' => array(
-			'DNSdomain' => $_POST['d'],
-		),
-    );
-}
-
-/**
- * Opens a form to unsset a DNS record for a subdomain or domain of a siteBuilder account.
- *
- * @param array $params common module parameters
- *
- * @see https://developers.whmcs.com/provisioning-modules/supported-functions/
- *
- * @return array template information
- */
-function siteBuilder_unsetDNSConfirm($params) {
-	if(isset($_POST['s'])){
-		return array(
-			'templatefile' => 'siteBuilder_unset_DNS_confirm',
-			'vars' => array(
-				'DNSdomain' => $_POST['d'],
-				'DNSsubdomain' => $_POST['s'],
-			),
-		);
-	}
-	return array(
-		'templatefile' => 'siteBuilder_unset_DNS_confirm',
-		'vars' => array(
-			'DNSdomain' => $_POST['d'],
-		),
-    );
-}
-
-/**
- * Update a DNS zone for a domain setting a new record for a domain or subdomain of a siteBuilder account.
- *
- * @param array $params common module parameters
- *
- * @see https://developers.whmcs.com/provisioning-modules/supported-functions/
- *
- * @return string "success" or an error message
- */
-function siteBuilder_setDNS($params) {
-	if(!filter_var($_POST['d'], FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)){
-		return 'Error: invalid domain name';
-	}
-	$domainName = $_POST['d'];
-    $zoneRecords = array();
-	if(isset($_POST['s'])){
-		if(!filter_var($_POST['s'], FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)){
-			return 'Error: invalid subdomain name';
-		}
-		$hostName = $_POST['s'] . '.' . $domainName . '.';
-		$newRecord = array(
-			'line' => $hostName.'|A|0',
-			'name' => $hostName,
-			'type' => 'A',
-			'class' => 'IN',
-			'data' => array(
-				'address' => $params['serverip'],
-			),
-		);
-		array_push($zoneRecords, $newRecord);
-	} else {
-		$hostName = $domainName . '.';
-		$domainRecord = array(
-			'line' => $hostName.'|A|0',
-			'name' => $hostName,
-			'type' => 'A',
-			'class' => 'IN',
-			'data' => array(
-				'address' => $params['serverip'],
-			),
-		);
-		array_push($zoneRecords, $domainRecord);
-		$wwwRecord = array(
-			'line' => 'www'.$hostName.'|A|0',
-			'name' => 'www'.$hostName,
-			'type' => 'A',
-			'class' => 'IN',
-			'data' => array(
-				'address' => $params['serverip'],
-			),
-		);
-		array_push($zoneRecords, $wwwRecord);
-	}
-	$zoneIDcollection = Capsule::table('dns_manager2_zone')
-		->select('id')
-		->where('name', '=', $domainName)
-		->where('clientid', '=', $params['userid'])
-		->get();
-	$zoneIDobj = $zoneIDcollection[0];
-	$zoneID = $zoneIDobj->{'id'};
-	if(!isset($zoneID)) {
-		return 'Error: Zone for domain ' . $domainName . ' or not owned by client';
-	}
-	$dnsZone = localAPI('dnsmanager', array( 'dnsaction' => 'getZone', 'zone_id' => $zoneID));
-    foreach($dnsZone['data']->records as $record) {
-        if(($record->name != $hostName) || ($record->type != 'A' && $record->type != 'CNAME')) {
-            array_push($zoneRecords, $record);
-        };
-    }
-    $result = localAPI('dnsmanager' ,
-        array(
-            'dnsaction' => 'updateZone',
-            'zone_id' => $zoneID,
-            'records' => $zoneRecords,
-        )
-	);
-    if($result['result'] != 'success') {
-        return 'Error: ' . $result['message'];
-    }
-	return 'success';
-}
-
-/**
- * Removing a DNS record for a domain or subdomain of a siteBuilder account.
- *
- * @param array $params common module parameters
- *
- * @see https://developers.whmcs.com/provisioning-modules/supported-functions/
- *
- * @return string "success" or an error message
- */
-function siteBuilder_unsetDNS($params) {
-	if(!filter_var($_POST['d'], FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)){
-		return 'Error: invalid domain name';
-	}
-	$domainName = $_POST['d'];
-    $zoneRecords = array();
-	if(isset($_POST['s'])){
-		if(!filter_var($_POST['s'], FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)){
-			return 'Error: invalid subdomain name';
-		}
-		$hostName = $_POST['s'] . '.' . $domainName . '.';
-	} else {
-		$hostName = $domainName . '.';
-	}
-	$zoneIDcollection = Capsule::table('dns_manager2_zone')
-		->select('id')
-		->where('name', '=', $domainName)
-		->where('clientid', '=', $params['userid'])
-		->get();
-	$zoneIDobj = $zoneIDcollection[0];
-	$zoneID = $zoneIDobj->{'id'};
-	if(!isset($zoneID)) {
-		return 'Error: Zone for domain ' . $domainName . ' or not owned by client';
-	}
-	$dnsZone = localAPI('dnsmanager', array( 'dnsaction' => 'getZone', 'zone_id' => $zoneID));
-    foreach($dnsZone['data']->records as $record) {
-        if(($record->name != $hostName) || ($record->type != 'A' && $record->type != 'CNAME')) {
-            array_push($zoneRecords, $record);
-        };
-    }
-    $result = localAPI('dnsmanager' ,
-        array(
-            'dnsaction' => 'updateZone',
-            'zone_id' => $zoneID,
-            'records' => $zoneRecords,
-        )
-	);
-    if($result['result'] != 'success') {
-        return 'Error: ' . $result['message'];
-    }
 	return 'success';
 	return 'success';
 }
 }
 
 
-/**
- * Opens a form to inform about the DNS status of a subdomain or domain of a siteBuilder account.
- *
- * @param array $params common module parameters
- *
- * @see https://developers.whmcs.com/provisioning-modules/supported-functions/
- *
- * @return array template information
- */
-function siteBuilder_infoDNS($params) {
-	if(!filter_var($_POST['d'], FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)){
-		return 'Error: invalid domain name';
-	}
-	$siteBuildernameserver = siteBuilderCheckSOA($_POST['d'],$params['configoption5']);
-	return array(
-        'templatefile' => 'siteBuilder_help_dns',
-        'vars' => array(
-            'infodomain' => $_POST['d'],
-            'siteBuildernameserver' => $siteBuildernameserver,
-        ),
-    );
-}
-
-/**
- * Opens a form to inform about the SSL status of a subdomain or domain of a siteBuilder account.
- *
- * @param array $params common module parameters
- *
- * @see https://developers.whmcs.com/provisioning-modules/supported-functions/
- *
- * @return array template information
- */
-function siteBuilder_infoSSL($params) {
-	if(!filter_var($_POST['d'], FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)){
-		return 'Error: invalid domain name';
-	}
-	return array(
-        'templatefile' => 'siteBuilder_help_ssl',
-        'vars' => array(
-            'infodomain' => $_POST['d'],
-        ),
-    );
-}
-
-/**
- * Ask nameservers for a IP adress of a given host.
- *
- * @param string $host hostname
- * @param string $serverIP siteBuilder server IP
- * @param string $nameserverIP polled name server IP
- * @param int $recurse optional -> used to follow CNAME responses
- *
- * @see https://developers.whmcs.com/provisioning-modules/supported-functions/
- *
- * @return bool
- */
-function siteBuilderCheckA($host, $serverIP, $nameserverIP, $recurse = 0) {
-	if($recurse > 3) {
-		return false;
-	}
-	$nameserver = array($nameserverIP);
-    # try NS1
-    $resolver = new Net_DNS2_Resolver(array('nameservers' => $nameserver));
-    try {
-        $result = $resolver->query($host, 'A');
-    } catch(Net_DNS2_Exception $e) {
-    # try default nameserver
-        $resolver = new Net_DNS2_Resolver();
-        try {
-            $result = $resolver->query($host, 'A');
-        } catch(Net_DNS2_Exception $e) {
-			logModuleCall(
-				'siteBuilder',
-				__FUNCTION__,
-				$e,
-				'DNS lookup exception',
-				$e->getMessage()
-			);
-			return false;
-		}
-    }
-	$hostA = $result->answer;
-	if($hostA[0]->type == 'CNAME') {
-		if(siteBuilderCheckA($hostA[0]->cname, $serverIP, $nameserverIP, $recurse++)) {
-			return true;
-		}
-	}
-	if($hostA[0]->type == 'A') {
-		if($hostA[0]->address == $serverIP){
-			return true;
-		}
-	}
-	return false;
-}
-
-/**
- * Ask nameservers for the authority of a domain.
- *
- * @param string $domain domain name
- * @param string $nameserverIP polled name server IP
- * @param string $nameserverName name of the own namesever
- *
- * @see https://developers.whmcs.com/provisioning-modules/supported-functions/
- *
- * @return string 'none' -> not registered, 'self' -> registered at own or the name of an other responsible nameserver
- */
-function siteBuilderCheckSOA($domain, $nameserverIP) {
-	$nameserver = array($nameserverIP);
-    # try NS1
-	$resolver = new Net_DNS2_Resolver(array('nameservers' => $nameserver));
-    try {
-            $result = $resolver->query($domain, 'SOA');
-            return 'self';
-    } catch(Net_DNS2_Exception $e) {
-    # try default NS
-    	$resolver = new Net_DNS2_Resolver();
-        try {
-            $result = $resolver->query($domain, 'SOA');
-        } catch(Net_DNS2_Exception $e) {
-            return 'none';
-        }
-    }
-	return $result->answer[0]->mname;
-}
-
-/**
- * Check limits for a service of an account .
- *
- * @param array $params common module parameters
- * @param string $type domains|subdomins
- *
- * @see https://developers.whmcs.com/provisioning-modules/supported-functions/
- *
- * @return bool true -> limit reached, false -> limit not reached
- */
-function siteBuilderCheckLimit($params, $type) {
-	$siteBuilder = new siteBuilder_Admin($params['serverhostname'], $params['serveraccesshash']);
-	$response = $siteBuilder->getQuota($params['username']);
-	if($response[$type]['sw'] < 1) {
-		return true;
-	}
-	return false;
-}
-
 /**
 /**
  * Returns API Url .
  * Returns API Url .
  *
  *