|
@@ -328,6 +328,10 @@ function cwp7_ClientAreaAllowedFunctions() {
|
|
|
"Set DNS" => "setDNS",
|
|
"Set DNS" => "setDNS",
|
|
|
"Info DNS" => "infoDNS",
|
|
"Info DNS" => "infoDNS",
|
|
|
"Add Domain" => "addDomain",
|
|
"Add Domain" => "addDomain",
|
|
|
|
|
+ "Confirm Delete Domain" => "delDomainConfirm",
|
|
|
|
|
+ "Delete Domain" => "delDomain",
|
|
|
|
|
+ "Confirm Delete Subdomain" => "delSubdomainConfirm",
|
|
|
|
|
+ "Delete Subdomain" => "delSubdomain",
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -403,6 +407,98 @@ function cwp7_addSubdomain($params) {
|
|
|
return 'success';
|
|
return 'success';
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+function cwp7_delDomainConfirm($params) {
|
|
|
|
|
+ return array(
|
|
|
|
|
+ 'templatefile' => 'cwp7_del_domain_confirm',
|
|
|
|
|
+ 'vars' => array(
|
|
|
|
|
+ 'deldomain' => $_POST['d'],
|
|
|
|
|
+ ),
|
|
|
|
|
+ );
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+function cwp7_delDomain($params) {
|
|
|
|
|
+ if(!filter_var($_POST['d'], FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)){
|
|
|
|
|
+ return 'Error: invalid domain name';
|
|
|
|
|
+ }
|
|
|
|
|
+ $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(!in_array($_POST['d'], $clientdomains)) {
|
|
|
|
|
+ return 'Error: ' . $_POST['d'] . ' not in client domains';
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ logModuleCall(
|
|
|
|
|
+ 'cwp7',
|
|
|
|
|
+ __FUNCTION__,
|
|
|
|
|
+ $_POST['d'],
|
|
|
|
|
+ 'debug custom',
|
|
|
|
|
+ $clientdomains
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ return 'success';
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+function cwp7_delSubdomainConfirm($params) {
|
|
|
|
|
+ return array(
|
|
|
|
|
+ 'templatefile' => 'cwp7_del_subdomain_confirm',
|
|
|
|
|
+ 'vars' => array(
|
|
|
|
|
+ 'delsubdomain' => $_POST['d'],
|
|
|
|
|
+ ),
|
|
|
|
|
+ );
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+function cwp7_delSubdomain($params) {
|
|
|
|
|
+ if(!filter_var($_POST['d'], FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)){
|
|
|
|
|
+ return 'Error: invalid domain name';
|
|
|
|
|
+ }
|
|
|
|
|
+ $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(!in_array($_POST['d'], $clientdomains)) {
|
|
|
|
|
+ return 'Error: ' . $_POST['d'] . ' not in client domains';
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ logModuleCall(
|
|
|
|
|
+ 'cwp7',
|
|
|
|
|
+ __FUNCTION__,
|
|
|
|
|
+ $_POST['d'],
|
|
|
|
|
+ 'debug custom',
|
|
|
|
|
+ $clientdomains
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ return 'success';
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
function cwp7_enableSSL($params) {
|
|
function cwp7_enableSSL($params) {
|
|
|
logModuleCall(
|
|
logModuleCall(
|
|
|
'cwp7',
|
|
'cwp7',
|