|
|
@@ -17,6 +17,7 @@ use ThurData\Servers\KerioEmail\Core\UI\Widget\DataTable\DataProviders\DataProvi
|
|
|
use ThurData\Servers\KerioEmail\Core\UI\Widget\DataTable\DataProviders\Providers\ArrayDataProvider;
|
|
|
use ThurData\Servers\KerioEmail\Core\UI\Widget\DataTable\DataTable;
|
|
|
use ThurData\Servers\KerioEmail\Core\UI\Widget\Others\Label;
|
|
|
+use ThurData\Servers\KerioEmail\Api\KerioWhmcs;
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
@@ -66,30 +67,59 @@ class Aliases extends DataTable implements ClientArea
|
|
|
*/
|
|
|
$hosting = Hosting::where('id', $this->getRequestValue('id'))->first();
|
|
|
|
|
|
- /**
|
|
|
- * load api
|
|
|
- */
|
|
|
+ $api = new KerioWhmcs('whmcsKerioEmail', 'Thurdata', '1.0');
|
|
|
+ try {
|
|
|
+ $api->login($this->getWhmcsParamByKey('serverhostname'), $this->getWhmcsParamByKey('serverusername'), $this->getWhmcsParamByKey('serverpassword'));
|
|
|
+ $domains = $api->getDomains(['id','name']);
|
|
|
+ } catch (KerioApiException $error) {
|
|
|
+ logModuleCall(
|
|
|
+ 'kerioEmail',
|
|
|
+ __FUNCTION__,
|
|
|
+ $error,
|
|
|
+ 'Debug Error',
|
|
|
+ $error->getMessage()
|
|
|
+ );
|
|
|
+ return ['error' => $error->getMessage()];
|
|
|
+ }
|
|
|
+ foreach($domains as $maildomain) {
|
|
|
+ if(($maildomain['name']) === $this->getWhmcsParamByKey('domain')){
|
|
|
+ $this->maildomainID = $maildomain['id'];
|
|
|
+ $this->maildomain = $maildomain['name'];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ logModuleCall(
|
|
|
+ 'kerioEmail',
|
|
|
+ __FUNCTION__,
|
|
|
+ $this->maildomainID,
|
|
|
+ 'Debug Error',
|
|
|
+ $this->maildomain
|
|
|
+ );
|
|
|
+
|
|
|
+ $api->logout();
|
|
|
+
|
|
|
+ /*
|
|
|
$aliases = (new KerioManager())
|
|
|
->getApiByServer($hosting->server)
|
|
|
->soap->repository()
|
|
|
->accounts
|
|
|
->getAccountAliasesByDomainName($hosting->domain);
|
|
|
-
|
|
|
+*/
|
|
|
/**
|
|
|
* format model to array
|
|
|
*/
|
|
|
$data = [];
|
|
|
- foreach ($aliases as $alias)
|
|
|
- {
|
|
|
- /* @var $alias AccountAlias */
|
|
|
- $tmp = [
|
|
|
- 'id' => base64_encode(json_encode(['alias' => $alias->getAlias(), 'accId' => $alias->getAccountId()])),
|
|
|
- 'email_alias' => $alias->getAlias(),
|
|
|
- 'account' => $alias->getAccountName()
|
|
|
- ];
|
|
|
-
|
|
|
- $data[] = $tmp;
|
|
|
- }
|
|
|
+// foreach ($aliases as $alias)
|
|
|
+// {
|
|
|
+// /* @var $alias AccountAlias */
|
|
|
+// $tmp = [
|
|
|
+// 'id' => base64_encode(json_encode(['alias' => $alias->getAlias(), 'accId' => $alias->getAccountId()])),
|
|
|
+// 'email_alias' => $alias->getAlias(),
|
|
|
+// 'account' => $alias->getAccountName()
|
|
|
+// ];
|
|
|
+
|
|
|
+// $data[] = $tmp;
|
|
|
+// }
|
|
|
|
|
|
$dataProv = new ArrayDataProvider();
|
|
|
$dataProv->setDefaultSorting('account', 'ASC')->setData($data);
|
|
|
@@ -111,12 +141,12 @@ class Aliases extends DataTable implements ClientArea
|
|
|
*/
|
|
|
$hosting = Hosting::where('id', $hid)->first();
|
|
|
|
|
|
- $accounts =(new KerioManager())
|
|
|
- ->getApiByHosting($hid)
|
|
|
- ->soap
|
|
|
- ->repository()
|
|
|
- ->accounts
|
|
|
- ->getByDomainName($hosting->domain);
|
|
|
+// $accounts =(new KerioManager())
|
|
|
+// ->getApiByHosting($hid)
|
|
|
+// ->soap
|
|
|
+// ->repository()
|
|
|
+// ->accounts
|
|
|
+// ->getByDomainName($hosting->domain);
|
|
|
|
|
|
return !(count($accounts) > 0);
|
|
|
}
|