|
|
@@ -1,14 +1,9 @@
|
|
|
<?php
|
|
|
namespace ThurData\Servers\KerioEmail\App\UI\Client\DistributionList\Pages;
|
|
|
-use ThurData\Servers\KerioEmail\App\Helpers\KerioManager;
|
|
|
-use ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Models\DistributionList;
|
|
|
-use ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Repository;
|
|
|
-use ThurData\Servers\KerioEmail\App\UI\Admin\Custom\Fields\EnabledField;
|
|
|
use ThurData\Servers\KerioEmail\App\UI\Client\DistributionList\Buttons\AddListButton;
|
|
|
use ThurData\Servers\KerioEmail\App\UI\Client\DistributionList\Buttons\DeleteListButton;
|
|
|
use ThurData\Servers\KerioEmail\App\UI\Client\DistributionList\Buttons\EditListButton;
|
|
|
use ThurData\Servers\KerioEmail\App\UI\Client\DistributionList\Buttons\MassDeleteListButton;
|
|
|
-use function ThurData\Servers\KerioEmail\Core\Helper\di;
|
|
|
use ThurData\Servers\KerioEmail\Core\Models\Whmcs\Hosting;
|
|
|
use ThurData\Servers\KerioEmail\Core\UI\Interfaces\ClientArea;
|
|
|
use ThurData\Servers\KerioEmail\Core\UI\Widget\DataTable\Column;
|
|
|
@@ -58,10 +53,7 @@ class Lists extends DataTable implements ClientArea
|
|
|
|
|
|
public function loadData()
|
|
|
{
|
|
|
- /**
|
|
|
- * load hosting
|
|
|
- */
|
|
|
- $hosting = Hosting::where('id', $this->getRequestValue('id'))->first();
|
|
|
+ $domain = $this->getWhmcsParamByKey('domain');
|
|
|
$fields = array(
|
|
|
"id",
|
|
|
"name",
|
|
|
@@ -70,7 +62,7 @@ class Lists extends DataTable implements ClientArea
|
|
|
$api = new KerioWhmcs('whmcsKerioEmail', 'Thurdata', '1.0');
|
|
|
try {
|
|
|
$api->login($this->getWhmcsParamByKey('serverhostname'), $this->getWhmcsParamByKey('serverusername'), $this->getWhmcsParamByKey('serverpassword'));
|
|
|
- $domains = $api->getDomains(['id','name']);
|
|
|
+ $domainID = $api->getDomainId($domain);
|
|
|
} catch (KerioApiException $error) {
|
|
|
logModuleCall(
|
|
|
'kerioEmail',
|
|
|
@@ -81,14 +73,8 @@ class Lists extends DataTable implements ClientArea
|
|
|
);
|
|
|
return ['error' => $error->getMessage()];
|
|
|
}
|
|
|
- foreach($domains as $maildomain) {
|
|
|
- if(($maildomain['name']) === $this->getWhmcsParamByKey('domain')){
|
|
|
- $this->maildomainID = $maildomain['id'];
|
|
|
- $this->maildomain = $maildomain['name'];
|
|
|
- }
|
|
|
- }
|
|
|
try {
|
|
|
- $lists = $api->getMailingLists($fields,$this->maildomainID);
|
|
|
+ $lists = $api->getMailingLists($fields,$domainID);
|
|
|
} catch (KerioApiException $error) {
|
|
|
logModuleCall(
|
|
|
'kerioEmail',
|
|
|
@@ -132,7 +118,7 @@ class Lists extends DataTable implements ClientArea
|
|
|
}
|
|
|
$tmp = [
|
|
|
'id' => $list['id'],
|
|
|
- 'email' => $list['name'] . '@' . $this->maildomain,
|
|
|
+ 'email' => $list['name'] . '@' . $domain,
|
|
|
'description' => $list['description'],
|
|
|
'members' => $memberCount,
|
|
|
'moderator' => $moderator
|