Răsfoiți Sursa

clientareafunctions

andre 3 ani în urmă
părinte
comite
467a7c33d2
2 a modificat fișierele cu 22 adăugiri și 2 ștergeri
  1. 2 1
      clientarea.tpl
  2. 20 1
      cwp7.php

+ 2 - 1
clientarea.tpl

@@ -315,7 +315,8 @@
                                                 <input type="hidden" name="id" value="{$serviceid}" />
                                                 <input type="hidden" name="modop" value="custom" />
                                                 <input type="hidden" name="a" value="setDNS" />
-                                                <input type="hidden" name="d" value="{$subdomain.subdomain}.{$subdomain.domain}" />
+                                                <input type="hidden" name="d" value="{$subdomain.domain}" />
+                                                <input type="hidden" name="s" value="{$subdomain.subdomain}" />
                                                 <button type="submit" class="fabutton" style="background:none;padding:0px;border:none;">
                                                   <i class="fas fa-power-off fa-fw"></i>
                                                 </button>

+ 20 - 1
cwp7.php

@@ -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';
 }