|
@@ -64,7 +64,7 @@ function cwp7_Testconnection($params) {
|
|
|
}
|
|
}
|
|
|
return array(
|
|
return array(
|
|
|
'success' => false,
|
|
'success' => false,
|
|
|
- 'error' => $response['msj'],
|
|
|
|
|
|
|
+ 'error' => $response['error_msg'],
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -99,7 +99,7 @@ function cwp7_ConfigOptions() {
|
|
|
__FUNCTION__,
|
|
__FUNCTION__,
|
|
|
$cwp7Packages['status'],
|
|
$cwp7Packages['status'],
|
|
|
'Could not fetch packages',
|
|
'Could not fetch packages',
|
|
|
- $cwp7Packages['msj']
|
|
|
|
|
|
|
+ $cwp7Packages['error_msg']
|
|
|
);
|
|
);
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
@@ -167,16 +167,16 @@ function cwp7_CreateAccount($params) {
|
|
|
'user' => $username,
|
|
'user' => $username,
|
|
|
'pass' => $params['password'],
|
|
'pass' => $params['password'],
|
|
|
'email' => $params['clientsdetails']['email'],
|
|
'email' => $params['clientsdetails']['email'],
|
|
|
- 'inode' => $params["configoption2"],
|
|
|
|
|
- 'nofile' => $params["configoption3"],
|
|
|
|
|
- 'nproc' => $params["configoption4"],
|
|
|
|
|
- 'server_ips'=>$params["serverip"]
|
|
|
|
|
|
|
+ 'inode' => (int) $params["configoption2"],
|
|
|
|
|
+ 'nofile' => (int) $params["configoption3"],
|
|
|
|
|
+ 'nproc' => (int) $params["configoption4"],
|
|
|
|
|
+ 'server_ips'=>$params["serverip"],
|
|
|
);
|
|
);
|
|
|
$cwp7 = new cwp7_Admin($params['serverhostname'], $params['serveraccesshash']);
|
|
$cwp7 = new cwp7_Admin($params['serverhostname'], $params['serveraccesshash']);
|
|
|
$response = $cwp7->createAccount($data);
|
|
$response = $cwp7->createAccount($data);
|
|
|
}
|
|
}
|
|
|
if($response['status'] != 'OK') {
|
|
if($response['status'] != 'OK') {
|
|
|
- return 'Error: ' . $response['msj'];
|
|
|
|
|
|
|
+ return 'Error: ' . $response['error_msg'];
|
|
|
}
|
|
}
|
|
|
return 'success';
|
|
return 'success';
|
|
|
}
|
|
}
|
|
@@ -196,7 +196,7 @@ function cwp7_CreateAccount($params) {
|
|
|
function cwp7_TerminateAccount($params) {
|
|
function cwp7_TerminateAccount($params) {
|
|
|
$cwp7 = new cwp7_Admin($params['serverhostname'], $params['serveraccesshash']);
|
|
$cwp7 = new cwp7_Admin($params['serverhostname'], $params['serveraccesshash']);
|
|
|
$response = $cwp7->deleteAccount(array('user' => $params['username'], 'email' => $params['clientsdetails']['email']));
|
|
$response = $cwp7->deleteAccount(array('user' => $params['username'], 'email' => $params['clientsdetails']['email']));
|
|
|
- if($response['status'] != 'OK') {
|
|
|
|
|
|
|
+ if($response['status'] == 'Error') {
|
|
|
return 'Error: ' . $response['msj'];
|
|
return 'Error: ' . $response['msj'];
|
|
|
}
|
|
}
|
|
|
return 'success';
|
|
return 'success';
|
|
@@ -219,7 +219,7 @@ function cwp7_SuspendAccount($params) {
|
|
|
$cwp7 = new cwp7_Admin($params['serverhostname'], $params['serveraccesshash']);
|
|
$cwp7 = new cwp7_Admin($params['serverhostname'], $params['serveraccesshash']);
|
|
|
$response = $cwp7->suspendAccount($params['username']);
|
|
$response = $cwp7->suspendAccount($params['username']);
|
|
|
if($response['status'] != 'OK') {
|
|
if($response['status'] != 'OK') {
|
|
|
- return 'Error: ' . $response['msj'];
|
|
|
|
|
|
|
+ return 'Error: ' . $response['error_msg'];
|
|
|
}
|
|
}
|
|
|
return 'success';
|
|
return 'success';
|
|
|
}
|
|
}
|
|
@@ -241,7 +241,7 @@ function cwp7_UnsuspendAccount($params) {
|
|
|
$cwp7 = new cwp7_Admin($params['serverhostname'], $params['serveraccesshash']);
|
|
$cwp7 = new cwp7_Admin($params['serverhostname'], $params['serveraccesshash']);
|
|
|
$response = $cwp7->unsuspendAccount($params['username']);
|
|
$response = $cwp7->unsuspendAccount($params['username']);
|
|
|
if($response['status'] != 'OK') {
|
|
if($response['status'] != 'OK') {
|
|
|
- return 'Error: ' . $response['msj'];
|
|
|
|
|
|
|
+ return 'Error: ' . $response['error_msg'];
|
|
|
}
|
|
}
|
|
|
return 'success';
|
|
return 'success';
|
|
|
}
|
|
}
|
|
@@ -290,6 +290,7 @@ function cwp7_ClientArea($params) {
|
|
|
$clientInfo['mgmtDomain'] = $domain['domain'];
|
|
$clientInfo['mgmtDomain'] = $domain['domain'];
|
|
|
$clientInfo['mgmtEmail'] = $domain['email'];
|
|
$clientInfo['mgmtEmail'] = $domain['email'];
|
|
|
} else {
|
|
} else {
|
|
|
|
|
+ $domain['relpath'] = str_replace('/home/' . $params['username'], '~', $domain['path']);
|
|
|
if(array_key_exists($domain['domain'], $sslSites)) {
|
|
if(array_key_exists($domain['domain'], $sslSites)) {
|
|
|
$domain['ssl'] = 1;
|
|
$domain['ssl'] = 1;
|
|
|
$domain['sslexpire'] = $sslSites[$domain['domain']]['expire'];
|
|
$domain['sslexpire'] = $sslSites[$domain['domain']]['expire'];
|
|
@@ -303,6 +304,7 @@ function cwp7_ClientArea($params) {
|
|
|
foreach($subDomains as $subDomain) {
|
|
foreach($subDomains as $subDomain) {
|
|
|
if($subDomain['domain'] == $domain['domain']) {
|
|
if($subDomain['domain'] == $domain['domain']) {
|
|
|
$subFQDN = $subDomain['subdomain'] . '.' . $subDomain['domain'];
|
|
$subFQDN = $subDomain['subdomain'] . '.' . $subDomain['domain'];
|
|
|
|
|
+ $subDomain['relpath'] = str_replace('/home/' . $params['username'], '~', $subDomain['path']);
|
|
|
if(array_key_exists($subFQDN, $sslSites)) {
|
|
if(array_key_exists($subFQDN, $sslSites)) {
|
|
|
$subDomain['ssl'] = 1;
|
|
$subDomain['ssl'] = 1;
|
|
|
$subDomain['sslexpire'] = $sslSites[$subFQDN]['expire'];
|
|
$subDomain['sslexpire'] = $sslSites[$subFQDN]['expire'];
|
|
@@ -378,7 +380,7 @@ function cwp7_ChangePassword($params) {
|
|
|
$cwp7 = new cwp7_Admin($params['serverhostname'], $params['serveraccesshash']);
|
|
$cwp7 = new cwp7_Admin($params['serverhostname'], $params['serveraccesshash']);
|
|
|
$response = $cwp7->changePass(array('user' => $params['username'], 'password' => $params['password']));
|
|
$response = $cwp7->changePass(array('user' => $params['username'], 'password' => $params['password']));
|
|
|
if($response['status'] != 'OK') {
|
|
if($response['status'] != 'OK') {
|
|
|
- return 'Error: ' . $response['msj'];
|
|
|
|
|
|
|
+ return 'Error: ' . $response['error_msg'];
|
|
|
}
|
|
}
|
|
|
return 'success';
|
|
return 'success';
|
|
|
}
|
|
}
|
|
@@ -401,9 +403,18 @@ function cwp7_ChangePassword($params) {
|
|
|
*/
|
|
*/
|
|
|
function cwp7_ChangePackage($params) {
|
|
function cwp7_ChangePackage($params) {
|
|
|
$cwp7 = new cwp7_Admin($params['serverhostname'], $params['serveraccesshash']);
|
|
$cwp7 = new cwp7_Admin($params['serverhostname'], $params['serveraccesshash']);
|
|
|
- $response = $cwp7->modifyAccount(array('user' => $params['username'], 'email' => $params['clientdetails']['email'], 'package' => $params['configoption1']));
|
|
|
|
|
|
|
+ $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 = $cwp7->modifyAccount($data);
|
|
|
if($response['status'] != 'OK') {
|
|
if($response['status'] != 'OK') {
|
|
|
- return 'Error: ' . $response['msj'];
|
|
|
|
|
|
|
+ return 'Error: ' . $response['error_msg'];
|
|
|
}
|
|
}
|
|
|
return 'success';
|
|
return 'success';
|
|
|
}
|
|
}
|
|
@@ -474,25 +485,8 @@ function cwp7_UsageUpdate($params) {
|
|
|
* @return array
|
|
* @return array
|
|
|
*/
|
|
*/
|
|
|
function cwp7_ClientAreaCustomButtonArray ($params) {
|
|
function cwp7_ClientAreaCustomButtonArray ($params) {
|
|
|
- $cwp7 = new cwp7_Admin($params['serverhostname'], $params['serveraccesshash']);
|
|
|
|
|
- $response = $cwp7->getAccount($params['username']);
|
|
|
|
|
- if($response['status'] != 'OK') {
|
|
|
|
|
- logModuleCall(
|
|
|
|
|
- 'cwp7',
|
|
|
|
|
- __FUNCTION__,
|
|
|
|
|
- $params,
|
|
|
|
|
- 'debug',
|
|
|
|
|
- $response
|
|
|
|
|
- );
|
|
|
|
|
- }
|
|
|
|
|
- if(count($response['result']['domains']) < 2) {
|
|
|
|
|
- return array(
|
|
|
|
|
- 'Neue Domaine' => 'newDomain',
|
|
|
|
|
- );
|
|
|
|
|
- };
|
|
|
|
|
return array(
|
|
return array(
|
|
|
- 'Neue Domaine' => 'newDomain',
|
|
|
|
|
- 'Neue Subdomaine' => 'newSubdomain',
|
|
|
|
|
|
|
+ 'Neue Domain' => 'newDomain',
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -511,12 +505,16 @@ function cwp7_ClientAreaAllowedFunctions() {
|
|
|
"Enable SSL" => "enableSSL",
|
|
"Enable SSL" => "enableSSL",
|
|
|
"Renew SSL" => "renewSSL",
|
|
"Renew SSL" => "renewSSL",
|
|
|
"Set DNS" => "setDNS",
|
|
"Set DNS" => "setDNS",
|
|
|
|
|
+ "Unset DNS" => "unsetDNS",
|
|
|
"Confirm Enable SSL" => "enableSSLConfirm",
|
|
"Confirm Enable SSL" => "enableSSLConfirm",
|
|
|
"Confirm Renew SSL" => "renewSSLConfirm",
|
|
"Confirm Renew SSL" => "renewSSLConfirm",
|
|
|
"Confirm Set DNS" => "setDNSConfirm",
|
|
"Confirm Set DNS" => "setDNSConfirm",
|
|
|
|
|
+ "Confirm Unset DNS" => "unsetDNSConfirm",
|
|
|
"Info DNS" => "infoDNS",
|
|
"Info DNS" => "infoDNS",
|
|
|
|
|
+ "Info SSL" => "infoSSL",
|
|
|
"Add Domain" => "addDomain",
|
|
"Add Domain" => "addDomain",
|
|
|
"Add Subdomain" => "addSubdomain",
|
|
"Add Subdomain" => "addSubdomain",
|
|
|
|
|
+ "New Subdomain" => "newSubdomain",
|
|
|
"Confirm Delete Domain" => "delDomainConfirm",
|
|
"Confirm Delete Domain" => "delDomainConfirm",
|
|
|
"Delete Domain" => "delDomain",
|
|
"Delete Domain" => "delDomain",
|
|
|
"Confirm Delete Subdomain" => "delSubdomainConfirm",
|
|
"Confirm Delete Subdomain" => "delSubdomainConfirm",
|
|
@@ -536,7 +534,7 @@ function cwp7_ClientAreaAllowedFunctions() {
|
|
|
function cwp7_newDomain($params) {
|
|
function cwp7_newDomain($params) {
|
|
|
return array(
|
|
return array(
|
|
|
'breadcrumb' => array(
|
|
'breadcrumb' => array(
|
|
|
- 'clientarea.php?action=productdetails&id=' . $params['serviceid'] . '&modop=custom&a=newDomain' => 'Neue Domaine',
|
|
|
|
|
|
|
+ 'clientarea.php?action=productdetails&id=' . $params['serviceid'] . '&modop=custom&a=newDomain' => 'Neue Domain',
|
|
|
),
|
|
),
|
|
|
'templatefile' => 'cwp7_add_domain',
|
|
'templatefile' => 'cwp7_add_domain',
|
|
|
);
|
|
);
|
|
@@ -561,7 +559,7 @@ function cwp7_addDomain($params) {
|
|
|
$cwp7 = new cwp7_Admin($params['serverhostname'], $params['serveraccesshash']);
|
|
$cwp7 = new cwp7_Admin($params['serverhostname'], $params['serveraccesshash']);
|
|
|
$response = $cwp7->addDomain($vars);
|
|
$response = $cwp7->addDomain($vars);
|
|
|
if($response['status'] != 'OK') {
|
|
if($response['status'] != 'OK') {
|
|
|
- return 'Error: ' . $response['msj'];
|
|
|
|
|
|
|
+ return 'Error: ' . $response['error_msg'];
|
|
|
}
|
|
}
|
|
|
return 'success';
|
|
return 'success';
|
|
|
}
|
|
}
|
|
@@ -576,32 +574,16 @@ function cwp7_addDomain($params) {
|
|
|
* @return array template information
|
|
* @return array template information
|
|
|
*/
|
|
*/
|
|
|
function cwp7_newSubdomain($params) {
|
|
function cwp7_newSubdomain($params) {
|
|
|
- $cwp7 = new cwp7_Admin($params['serverhostname'], $params['serveraccesshash']);
|
|
|
|
|
- $response = $cwp7->getAccount($params['username']);
|
|
|
|
|
- if($response['status'] != 'OK') {
|
|
|
|
|
- logModuleCall(
|
|
|
|
|
- 'cwp7',
|
|
|
|
|
- __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(!filter_var($_POST['d'], FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)){
|
|
|
|
|
+ return 'Error: invalid domain name';
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
return array(
|
|
return array(
|
|
|
'breadcrumb' => array(
|
|
'breadcrumb' => array(
|
|
|
- 'clientarea.php?action=productdetails&id=' . $params['serviceid'] . '&modop=custom&a=newSubdomain' => 'Neue Subdomaine',
|
|
|
|
|
|
|
+ 'clientarea.php?action=productdetails&id=' . $params['serviceid'] . '&modop=custom&a=newSubdomain' => 'Neue Subdomain',
|
|
|
),
|
|
),
|
|
|
'templatefile' => 'cwp7_add_subdomain',
|
|
'templatefile' => 'cwp7_add_subdomain',
|
|
|
'vars' => array(
|
|
'vars' => array(
|
|
|
- 'domains' => $clientdomains,
|
|
|
|
|
|
|
+ 'domainselected' => $_POST['d'],
|
|
|
),
|
|
),
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
@@ -622,22 +604,16 @@ function cwp7_addSubdomain($params) {
|
|
|
if(!filter_var($_POST['s'], FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)){
|
|
if(!filter_var($_POST['s'], FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)){
|
|
|
return 'Error: invalid subdomain name';
|
|
return 'Error: invalid subdomain name';
|
|
|
}
|
|
}
|
|
|
|
|
+ if($_POST['s'] == 'www') {
|
|
|
|
|
+ return 'Error: default Subdomain www wurde bereits automatisch erstellt' ;
|
|
|
|
|
+ }
|
|
|
$vars['user'] = $params['username'];
|
|
$vars['user'] = $params['username'];
|
|
|
$vars['name'] = $_POST['s'] . '.' . $_POST['d'];
|
|
$vars['name'] = $_POST['s'] . '.' . $_POST['d'];
|
|
|
$vars['type'] = 'subdomain';
|
|
$vars['type'] = 'subdomain';
|
|
|
$cwp7 = new cwp7_Admin($params['serverhostname'], $params['serveraccesshash']);
|
|
$cwp7 = new cwp7_Admin($params['serverhostname'], $params['serveraccesshash']);
|
|
|
$response = $cwp7->addDomain($vars);
|
|
$response = $cwp7->addDomain($vars);
|
|
|
-
|
|
|
|
|
- logModuleCall(
|
|
|
|
|
- 'cwp7',
|
|
|
|
|
- __FUNCTION__,
|
|
|
|
|
- $vars,
|
|
|
|
|
- 'debug addSubdomain',
|
|
|
|
|
- $response
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
if($response['status'] != 'OK') {
|
|
if($response['status'] != 'OK') {
|
|
|
- return 'Error: ' . $response['msj'];
|
|
|
|
|
|
|
+ return 'Error: ' . $response['error_msg'];
|
|
|
}
|
|
}
|
|
|
return 'success';
|
|
return 'success';
|
|
|
}
|
|
}
|
|
@@ -707,7 +683,7 @@ function cwp7_delDomain($params) {
|
|
|
$vars['type'] = 'domain';
|
|
$vars['type'] = 'domain';
|
|
|
$response = $cwp7->deleteDomain($vars);
|
|
$response = $cwp7->deleteDomain($vars);
|
|
|
if($response['status'] != 'OK') {
|
|
if($response['status'] != 'OK') {
|
|
|
- return 'Error: ' . $response['msj'];
|
|
|
|
|
|
|
+ return 'Error: ' . $response['error_msg'];
|
|
|
}
|
|
}
|
|
|
return 'success';
|
|
return 'success';
|
|
|
}
|
|
}
|
|
@@ -777,7 +753,7 @@ function cwp7_delSubdomain($params) {
|
|
|
$vars['type'] = 'subdomain';
|
|
$vars['type'] = 'subdomain';
|
|
|
$response = $cwp7->deleteDomain($vars);
|
|
$response = $cwp7->deleteDomain($vars);
|
|
|
if($response['status'] != 'OK') {
|
|
if($response['status'] != 'OK') {
|
|
|
- return 'Error: ' . $response['msj'];
|
|
|
|
|
|
|
+ return 'Error: ' . $response['error_msg'];
|
|
|
}
|
|
}
|
|
|
return 'success';
|
|
return 'success';
|
|
|
}
|
|
}
|
|
@@ -818,7 +794,7 @@ function cwp7_enableSSL($params) {
|
|
|
$cwp7 = new cwp7_Admin($params['serverhostname'], $params['serveraccesshash']);
|
|
$cwp7 = new cwp7_Admin($params['serverhostname'], $params['serveraccesshash']);
|
|
|
$response = $cwp7->addAutoSSL($vars);
|
|
$response = $cwp7->addAutoSSL($vars);
|
|
|
if($response['status'] != 'OK') {
|
|
if($response['status'] != 'OK') {
|
|
|
- return 'Error: ' . $response['msj'];
|
|
|
|
|
|
|
+ return 'Error: ' . $response['error_msg'];
|
|
|
}
|
|
}
|
|
|
return 'success';
|
|
return 'success';
|
|
|
}
|
|
}
|
|
@@ -859,7 +835,7 @@ function cwp7_renewSSL($params) {
|
|
|
$cwp7 = new cwp7_Admin($params['serverhostname'], $params['serveraccesshash']);
|
|
$cwp7 = new cwp7_Admin($params['serverhostname'], $params['serveraccesshash']);
|
|
|
$response = $cwp7->updateAutoSSL($vars);
|
|
$response = $cwp7->updateAutoSSL($vars);
|
|
|
if($response['status'] != 'OK') {
|
|
if($response['status'] != 'OK') {
|
|
|
- return 'Error: ' . $response['msj'];
|
|
|
|
|
|
|
+ return 'Error: ' . $response['error_msg'];
|
|
|
}
|
|
}
|
|
|
return 'success';
|
|
return 'success';
|
|
|
}
|
|
}
|
|
@@ -891,6 +867,33 @@ function cwp7_setDNSConfirm($params) {
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+/**
|
|
|
|
|
+ * Opens a form to unsset a DNS record for a subdomain or domain of a CWP7 account.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param array $params common module parameters
|
|
|
|
|
+ *
|
|
|
|
|
+ * @see https://developers.whmcs.com/provisioning-modules/supported-functions/
|
|
|
|
|
+ *
|
|
|
|
|
+ * @return array template information
|
|
|
|
|
+ */
|
|
|
|
|
+function cwp7_unsetDNSConfirm($params) {
|
|
|
|
|
+ if(isset($_POST['s'])){
|
|
|
|
|
+ return array(
|
|
|
|
|
+ 'templatefile' => 'cwp7_unset_DNS_confirm',
|
|
|
|
|
+ 'vars' => array(
|
|
|
|
|
+ 'DNSdomain' => $_POST['d'],
|
|
|
|
|
+ 'DNSsubdomain' => $_POST['s'],
|
|
|
|
|
+ ),
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+ return array(
|
|
|
|
|
+ 'templatefile' => 'cwp7_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 CWP7 account.
|
|
* Update a DNS zone for a domain setting a new record for a domain or subdomain of a CWP7 account.
|
|
|
*
|
|
*
|
|
@@ -973,6 +976,58 @@ function cwp7_setDNS($params) {
|
|
|
return 'success';
|
|
return 'success';
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+/**
|
|
|
|
|
+ * Removing a DNS record for a domain or subdomain of a CWP7 account.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param array $params common module parameters
|
|
|
|
|
+ *
|
|
|
|
|
+ * @see https://developers.whmcs.com/provisioning-modules/supported-functions/
|
|
|
|
|
+ *
|
|
|
|
|
+ * @return string "success" or an error message
|
|
|
|
|
+ */
|
|
|
|
|
+function cwp7_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';
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Opens a form to inform about the DNS status of a subdomain or domain of a CWP7 account.
|
|
* Opens a form to inform about the DNS status of a subdomain or domain of a CWP7 account.
|
|
|
*
|
|
*
|
|
@@ -996,6 +1051,27 @@ function cwp7_infoDNS($params) {
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+/**
|
|
|
|
|
+ * Opens a form to inform about the SSL status of a subdomain or domain of a CWP7 account.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param array $params common module parameters
|
|
|
|
|
+ *
|
|
|
|
|
+ * @see https://developers.whmcs.com/provisioning-modules/supported-functions/
|
|
|
|
|
+ *
|
|
|
|
|
+ * @return array template information
|
|
|
|
|
+ */
|
|
|
|
|
+function cwp7_infoSSL($params) {
|
|
|
|
|
+ if(!filter_var($_POST['d'], FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)){
|
|
|
|
|
+ return 'Error: invalid domain name';
|
|
|
|
|
+ }
|
|
|
|
|
+ return array(
|
|
|
|
|
+ 'templatefile' => 'cwp7_help_ssl',
|
|
|
|
|
+ 'vars' => array(
|
|
|
|
|
+ 'infodomain' => $_POST['d'],
|
|
|
|
|
+ ),
|
|
|
|
|
+ );
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Ask nameservers for a IP adress of a given host.
|
|
* Ask nameservers for a IP adress of a given host.
|
|
|
*
|
|
*
|