|
|
@@ -546,12 +546,31 @@ function cwp7_renewSSL($params) {
|
|
|
}
|
|
|
|
|
|
function cwp7_setDNS($params) {
|
|
|
+ if(!filter_var($_POST['d'], FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)){
|
|
|
+ return 'Error: invalid domain name';
|
|
|
+ }
|
|
|
+ if(isset($_POST['s'])){
|
|
|
+ if(!filter_var($_POST['s'], FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)){
|
|
|
+ return 'Error: invalid domain name';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $zoneIDcollection = Capsule::table('dns_manager2_zone')
|
|
|
+ ->select('id')
|
|
|
+ ->where('name', '=', $_POST['d'])
|
|
|
+ ->get();
|
|
|
+ $zoneIDobj = $zoneIDcollection[0];
|
|
|
+ $zoneID = $zoneIDobj->{'id'};
|
|
|
+ if(!isset($zoneID)) {
|
|
|
+ return 'Error: zone ID not found for domain ' . $params['domain'];
|
|
|
+ }
|
|
|
+ $dnsZone = localAPI('dnsmanager', array( 'dnsaction' => 'getZone', 'zone_id' => $zoneID));
|
|
|
+
|
|
|
logModuleCall(
|
|
|
'cwp7',
|
|
|
__FUNCTION__,
|
|
|
$_POST,
|
|
|
'debug custom',
|
|
|
- $params
|
|
|
+ $dnsZone
|
|
|
);
|
|
|
return 'success';
|
|
|
}
|