Parcourir la source

new settings section

andre il y a 5 mois
Parent
commit
068fc3beaa
2 fichiers modifiés avec 18 ajouts et 14 suppressions
  1. 18 9
      app/UI/Client/Setting/Pages/Settings.php
  2. 0 5
      core/Helper/DnsHelper.php

+ 18 - 9
app/UI/Client/Setting/Pages/Settings.php

@@ -11,6 +11,7 @@ use ThurData\Servers\KerioEmail\Core\UI\Interfaces\ClientArea;
 use ThurData\Servers\KerioEmail\Core\UI\Widget\DataTable\DataProviders\Providers\ArrayDataProvider;
 use ThurData\Servers\KerioEmail\Core\UI\Widget\DataTable\DataTable;
 use ThurData\Servers\KerioEmail\Api\KerioWhmcs;
+use ThurData\Servers\KerioEmail\App\Libs\Product\ProductManager;
 
 /**
  *
@@ -109,6 +110,7 @@ class Settings extends DataTable implements ClientArea
      */
     public function loadData()
     {
+        $maildomain = $this->getWhmcsParamByKey('domain');
         $api = new KerioWhmcs('whmcsKerioEmail', 'Thurdata', '1.0');
         try {
             $api->login($this->getWhmcsParamByKey('serverhostname'), $this->getWhmcsParamByKey('serverusername'), $this->getWhmcsParamByKey('serverpassword'));
@@ -124,29 +126,36 @@ class Settings extends DataTable implements ClientArea
             return ['error' => $error->getMessage()];
         }
 
+        $api->logout();
+
         logModuleCall(
             'kerioEmail',
             __FUNCTION__,
             $domains,
             'Debug Settings',
-            'Debug Settings'
+            $this->params
         );
 
         foreach($domains as $domain) {
-            if(($domain['name']) === $this->getWhmcsParamByKey('domain')){ 
+            if(($domain['name']) === $maildomain){ 
                 $aliasList = $domain['aliasList'];
             }
         }
-            logModuleCall(
-                'kerioEmail',
-                __FUNCTION__,
-                $error,
-                'Debug Error',
-                $error->getMessage()
-            );
+        $dkimSet = $api->getDkimDnsRecord($maildomain);
+        $dkimArray = explode(PHP_EOL,$dkimSet['detail']);
+        $dkimValue = explode(":",$dkimArray[1]);
+        $this->domainKey = ltrim($dkimValue[1]);
+        $dkimName = explode(":",$dkimArray[0]);
+        $this->dkimName = ltrim($dkimName[1]);
 
         $api->logout();
 
+        // get settings from product configuration
+        $productManager = new ProductManager();
+        $productManager->loadById($this->params['pid']);
+        $this->spfConfig = $productManager->get('spf_string');
+        $this->dmarcConfig = $productManager->get('dmarc_string');
+
         /**
          * format model to array
          */

+ 0 - 5
core/Helper/DnsHelper.php

@@ -2,7 +2,6 @@
 
 namespace ThurData\Servers\KerioEmail\Core\Helper;
 use ThurData\Servers\KerioEmail\Core\Models\Whmcs\Server;
-use ThurData\Servers\KerioEmail\App\Libs\Product\ProductManager;
 use ThurData\Servers\KerioEmail\Api\KerioWhmcs;
 use \WHMCS\Database\Capsule;
 
@@ -25,10 +24,6 @@ class DnsHelper
 //        $this->nameserver = array(trim($this->server->nameserver1ip), trim($this->server->nameserver2ip));
         $this->nameserver = array('127.0.0.1', '127.0.0.2'); //test
         $this->clientDomains = localAPI('GetClientsDomains', array('clientid' => $this->params['userid']));
-        $productManager = new ProductManager();
-        $productManager->loadById($this->params['pid']);
-        $this->spfConfig = $productManager->get('spf_string');
-        $this->dmarcConfig = $productManager->get('dmarc_string');
         $api = new KerioWhmcs('whmcsKerioEmail', 'Thurdata', '1.0');
         try {
         	$api->login($this->params['serverhostname'], $this->params['serverusername'], $this->params['serverpassword']);