|
|
@@ -161,47 +161,50 @@ class EditSettingDataProvider extends BaseDataProvider
|
|
|
$value = in_array($field, $fieldToProtection) ? htmlentities($value) : $value;
|
|
|
}
|
|
|
|
|
|
- // $maildomain = $this->actionElementId;
|
|
|
-
|
|
|
- $this->formData['dkimsigenabled'] == 'on' ? $attr['isDkimEnabled'] = true : $attr['isDkimEnabled'] = false;
|
|
|
- $this->formData['tfaenabled'] == 'on' ? $attr['twoFAEnabled'] = true : $attr['twoFAEnabled'] = false;
|
|
|
- $api = new KerioWhmcs('whmcsKerioEmail', 'Thurdata', '1.0');
|
|
|
- try {
|
|
|
- $api->login($this->getWhmcsParamByKey('serverhostname'), $this->getWhmcsParamByKey('serverusername'), $this->getWhmcsParamByKey('serverpassword'));
|
|
|
- $result = $api->modifyDomain($this->formData['domainid'], $attr);
|
|
|
- } catch (KerioApiException $error) {
|
|
|
- logModuleCall(
|
|
|
- 'kerioEmail',
|
|
|
- __FUNCTION__,
|
|
|
- $error,
|
|
|
- 'Debug Error',
|
|
|
- $error->getMessage()
|
|
|
- );
|
|
|
- return ['error' => $error->getMessage()];
|
|
|
+ $maildomain = $this->actionElementId;
|
|
|
+ $domain = $this->getWhmcsParamByKey('domain');
|
|
|
+ if ($maildomain == $domain) {
|
|
|
+ $this->formData['dkimsigenabled'] == 'on' ? $attr['isDkimEnabled'] = true : $attr['isDkimEnabled'] = false;
|
|
|
+ $this->formData['tfaenabled'] == 'on' ? $attr['twoFAEnabled'] = true : $attr['twoFAEnabled'] = false;
|
|
|
+ $api = new KerioWhmcs('whmcsKerioEmail', 'Thurdata', '1.0');
|
|
|
+ try {
|
|
|
+ $api->login($this->getWhmcsParamByKey('serverhostname'), $this->getWhmcsParamByKey('serverusername'), $this->getWhmcsParamByKey('serverpassword'));
|
|
|
+ $result = $api->modifyDomain($this->formData['domainid'], $attr);
|
|
|
+ } catch (KerioApiException $error) {
|
|
|
+ logModuleCall(
|
|
|
+ 'kerioEmail',
|
|
|
+ __FUNCTION__,
|
|
|
+ $error,
|
|
|
+ 'Debug Error',
|
|
|
+ $error->getMessage()
|
|
|
+ );
|
|
|
+ return (new HtmlDataJsonResponse())->setMessageAndTranslate('updateHasBeenFailed')->setStatusError();
|
|
|
+ }
|
|
|
+ $api->logout();
|
|
|
}
|
|
|
- $api->logout();
|
|
|
-
|
|
|
- $dnsParams = array(
|
|
|
- 'maildomain' => $this->formData['editmaildomain'],
|
|
|
- 'mx' => $this->formData['editmxactive'],
|
|
|
- 'spf' => $this->formData['editspf'],
|
|
|
- 'dmarc' => $this->formData['editdmarc'],
|
|
|
- 'dkim' => $this->formData['editdkim'],
|
|
|
- 'dkimname' => $this->formData['dkimname']
|
|
|
- );
|
|
|
-
|
|
|
- $dns = new DnsHelper();
|
|
|
-
|
|
|
- $result = $dns->updateDNS($this->formData['zoneid'],$dnsParams);
|
|
|
- if($result != 'success') {
|
|
|
- logModuleCall(
|
|
|
- 'kerioEmail',
|
|
|
- __FUNCTION__,
|
|
|
- $result,
|
|
|
- 'Debug result updateDNS zoneID: ' . $this->formData['zoneid'],
|
|
|
- $dnsParams
|
|
|
+ if ($this->formData['zoneid'] > 0 ){
|
|
|
+ $dnsParams = array(
|
|
|
+ 'maildomain' => $this->formData['editmaildomain'],
|
|
|
+ 'mx' => $this->formData['editmxactive'],
|
|
|
+ 'spf' => $this->formData['editspf'],
|
|
|
+ 'dmarc' => $this->formData['editdmarc'],
|
|
|
+ 'dkim' => $this->formData['editdkim'],
|
|
|
+ 'dkimname' => $this->formData['dkimname']
|
|
|
);
|
|
|
- return (new HtmlDataJsonResponse())->setMessageAndTranslate('updateHasBeenFailed')->setStatusError();
|
|
|
+
|
|
|
+ $dns = new DnsHelper();
|
|
|
+
|
|
|
+ $result = $dns->updateDNS($this->formData['zoneid'],$dnsParams);
|
|
|
+ if($result != 'success') {
|
|
|
+ logModuleCall(
|
|
|
+ 'kerioEmail',
|
|
|
+ __FUNCTION__,
|
|
|
+ $result,
|
|
|
+ 'Debug result updateDNS zoneID: ' . $this->formData['zoneid'],
|
|
|
+ $dnsParams
|
|
|
+ );
|
|
|
+ return (new HtmlDataJsonResponse())->setMessageAndTranslate('updateHasBeenFailed')->setStatusError();
|
|
|
+ }
|
|
|
}
|
|
|
return (new HtmlDataJsonResponse())->setMessageAndTranslate('settingHasBeenUpdated')->setStatusSuccess();
|
|
|
}
|