|
@@ -27,21 +27,6 @@ class DnsHelper
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public function getMX($domain){
|
|
public function getMX($domain){
|
|
|
-// $zoneID = selfDns($domain);
|
|
|
|
|
-// if($zoneID){
|
|
|
|
|
- // use local API
|
|
|
|
|
-// $dnsZone = localAPI('dnsmanager', array( 'dnsaction' => 'getZone', 'zone_id' => $zoneID));
|
|
|
|
|
-
|
|
|
|
|
- logModuleCall(
|
|
|
|
|
- 'kerioEmail',
|
|
|
|
|
- __FUNCTION__,
|
|
|
|
|
- $zoneID,
|
|
|
|
|
- 'DEbug',
|
|
|
|
|
- $domain
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
-// } else {
|
|
|
|
|
- // use resolver
|
|
|
|
|
try {
|
|
try {
|
|
|
$result = $this->resolver->query($domain, 'MX');
|
|
$result = $this->resolver->query($domain, 'MX');
|
|
|
|
|
|
|
@@ -68,7 +53,6 @@ class DnsHelper
|
|
|
$var['mx'] = 'wrong';
|
|
$var['mx'] = 'wrong';
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-// }
|
|
|
|
|
return $vars;
|
|
return $vars;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -195,6 +179,19 @@ class DnsHelper
|
|
|
return $zoneIDobj->{'id'};
|
|
return $zoneIDobj->{'id'};
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public function getZone($zoneID) {
|
|
|
|
|
+ $dnsZone = localAPI('dnsmanager', array( 'dnsaction' => 'getZone', 'zone_id' => $zoneID));
|
|
|
|
|
+ if($dnsZone['result'] != 'success') {
|
|
|
|
|
+ return 'Error: cloud not fetch zone for ID ' . $zoneID;
|
|
|
|
|
+ }
|
|
|
|
|
+ $zoneRecords = array();
|
|
|
|
|
+ foreach($dnsZone['data']->records as $record) {
|
|
|
|
|
+ if(in_array($record->type, ['MX', 'TXT'])){
|
|
|
|
|
+ array_push($zoneRecords, $record);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return $zoneRecords;
|
|
|
|
|
+ }
|
|
|
function KerioEmailsetDNS()
|
|
function KerioEmailsetDNS()
|
|
|
{
|
|
{
|
|
|
return 'success';
|
|
return 'success';
|