AddDomainAliasDataProvider.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. namespace ThurData\Servers\KerioEmail\App\UI\Client\DomainAlias\Providers;
  3. use ThurData\Servers\KerioEmail\App\Helpers\KerioManager;
  4. use ThurData\Servers\KerioEmail\App\Libs\Product\ProductManager;
  5. use ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Repository;
  6. use ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Services\Create\CreateDistributionList;
  7. use ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Services\Create\CreateDomainAlias;
  8. use ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Services\Delete\DeleteDomainAlias;
  9. use ThurData\Servers\KerioEmail\Core\Models\Whmcs\Hosting;
  10. use ThurData\Servers\KerioEmail\Core\UI\ResponseTemplates\HtmlDataJsonResponse;
  11. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\DataProviders\BaseDataProvider;
  12. use ThurData\Servers\KerioEmail\Api\KerioWhmcs;
  13. /**
  14. *
  15. * Created by PhpStorm.
  16. * User: ThurData
  17. * Date: 18.09.19
  18. * Time: 13:39
  19. * Class AddDomainAliasDataProvider
  20. */
  21. class AddDomainAliasDataProvider extends BaseDataProvider
  22. {
  23. public function read()
  24. {
  25. $hosting = Hosting::where('id', $this->getRequestValue('id'))->first();
  26. $api = new KerioWhmcs('whmcsKerioEmail', 'Thurdata', '1.0');
  27. try {
  28. $api->login($this->getWhmcsParamByKey('serverhostname'), $this->getWhmcsParamByKey('serverusername'), $this->getWhmcsParamByKey('serverpassword'));
  29. $domainID = $api->getDomainId($this->getWhmcsParamByKey('domain'));
  30. } catch (KerioApiException $error) {
  31. logModuleCall(
  32. 'kerioEmail',
  33. __FUNCTION__,
  34. $error,
  35. 'Debug Error',
  36. $error->getMessage()
  37. );
  38. return ['error' => $error->getMessage()];
  39. }
  40. $this->data['domainId'] = $domainID;
  41. $this->data['domain'] = $this->getWhmcsParamByKey('domain');
  42. }
  43. public function update()
  44. {
  45. }
  46. public function create()
  47. {
  48. /**
  49. * hosting id
  50. */
  51. $hid = $this->request->get('id');
  52. logModuleCall(
  53. 'kerioEmail',
  54. __FUNCTION__,
  55. $this,
  56. 'Debug Error',
  57. $this->formData
  58. );
  59. return (new HtmlDataJsonResponse())->setMessageAndTranslate('domainAliasHasBeenCreated')->setStatusSuccess();
  60. }
  61. }