getRequestValue('id'))->first(); $api = new KerioWhmcs('whmcsKerioEmail', 'Thurdata', '1.0'); try { $api->login($this->getWhmcsParamByKey('serverhostname'), $this->getWhmcsParamByKey('serverusername'), $this->getWhmcsParamByKey('serverpassword')); $domainID = $api->getDomainId($this->getWhmcsParamByKey('domain')); } catch (KerioApiException $error) { logModuleCall( 'kerioEmail', __FUNCTION__, $error, 'Debug Error', $error->getMessage() ); return ['error' => $error->getMessage()]; } $api->logout(); $this->data['domainId'] = $domainID; $this->data['domain'] = $this->getWhmcsParamByKey('domain'); } public function update() { } public function create() { $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__, $aliasList, 'Debug Error', $domains ); return (new HtmlDataJsonResponse())->setMessageAndTranslate('domainAliasHasBeenCreated')->setStatusSuccess(); } }