|
|
@@ -40,6 +40,7 @@ class AddDomainAliasDataProvider extends BaseDataProvider
|
|
|
);
|
|
|
return ['error' => $error->getMessage()];
|
|
|
}
|
|
|
+ $api->logout();
|
|
|
$this->data['domainId'] = $domainID;
|
|
|
$this->data['domain'] = $this->getWhmcsParamByKey('domain');
|
|
|
|
|
|
@@ -52,19 +53,40 @@ class AddDomainAliasDataProvider extends BaseDataProvider
|
|
|
|
|
|
public function create()
|
|
|
{
|
|
|
- /**
|
|
|
- * hosting id
|
|
|
- */
|
|
|
- $hid = $this->request->get('id');
|
|
|
+
|
|
|
+ $api = new KerioWhmcs('whmcsKerioEmail', 'Thurdata', '1.0');
|
|
|
+ try {
|
|
|
+ $api->login($this->getWhmcsParamByKey('serverhostname'), $this->getWhmcsParamByKey('serverusername'), $this->getWhmcsParamByKey('serverpassword'));
|
|
|
+ $domains = $api->getDomains(['id','name','aliasList']);
|
|
|
+ } catch (KerioApiException $error) {
|
|
|
+ logModuleCall(
|
|
|
+ 'kerioEmail',
|
|
|
+ __FUNCTION__,
|
|
|
+ $error,
|
|
|
+ 'Debug Error',
|
|
|
+ $error->getMessage()
|
|
|
+ );
|
|
|
+ return ['error' => $error->getMessage()];
|
|
|
+ }
|
|
|
+ $api->logout();
|
|
|
+ foreach($domains as $domain) {
|
|
|
+ if(($domain['name']) === $this->getWhmcsParamByKey('domain')){
|
|
|
+ $domainID = $domain['id'];
|
|
|
+ $aliasList = $domain['aliasList'];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ array_push($aliasList, $this->formData['alias']);
|
|
|
|
|
|
logModuleCall(
|
|
|
'kerioEmail',
|
|
|
__FUNCTION__,
|
|
|
- $this,
|
|
|
+ $aliasList,
|
|
|
'Debug Error',
|
|
|
$this->formData
|
|
|
);
|
|
|
|
|
|
+
|
|
|
+
|
|
|
return (new HtmlDataJsonResponse())->setMessageAndTranslate('domainAliasHasBeenCreated')->setStatusSuccess();
|
|
|
}
|
|
|
|