Jelajahi Sumber

new dns helper class

andre 6 bulan lalu
induk
melakukan
804bf3654f
3 mengubah file dengan 16 tambahan dan 20 penghapusan
  1. 0 9
      app/Traits/ServerParams.php
  2. 14 10
      core/Helper/DnsHelper.php
  3. 2 1
      core/Http/Response.php

+ 0 - 9
app/Traits/ServerParams.php

@@ -59,15 +59,6 @@ trait ServerParams
     public function getServerParamsById($id)
     {
         $server = Server::where('id', $id)->first();
-
-        logModuleCall(
-    		'ServerParams',
-	    	__FUNCTION__,
-            $id,
-    		'Debug',
-	    	$server
-    	);
-
         if ($server)
         {
             return [

+ 14 - 10
core/Helper/DnsHelper.php

@@ -2,6 +2,8 @@
 
 namespace ThurData\Servers\KerioEmail\Core\Helper;
 
+use ThurData\Servers\KerioEmail\App\Traits\ServerParams;
+
 require_once '/usr/share/php/Net/DNS2.php';
 use \Net\DNS2\Net_DNS2_Resolver as Net_DNS2_Resolver;
 
@@ -16,7 +18,8 @@ class DnsHelper
     const NS2 = '185.163.51.131';
     const SPF = 'v=spf1 mx a:mail3.seecure.ch ip4:185.163.51.0/24 ip4:89.35.78.0/23 ~all';
     const DMARC = 'v=DMARC1; p=reject; rua=mailto:technik@thurdata.ch; ruf=mailto:technik@thurdata.ch';
-    public static function KerioEmailCheckDNS($params)
+    use ServerParams;
+    public function KerioEmailCheckDNS($params)
     {
         unset($zoneID);
         unset($mxStatus);
@@ -24,6 +27,16 @@ class DnsHelper
         unset($vars);
         $vars['maildomain'] = $params['domain'];
         $clientDomains = localAPI('GetClientsDomains', array('clientid' => $params['userid']));
+        $serverParams = $this->getServerParamsByHostingId($params['serviceid']);
+
+        logModuleCall(
+    		'kerioEmail',
+	    	__FUNCTION__,
+		    $params,
+    		'Debug',
+	    	$serverParams
+    	);
+
         $nameserver = array(
             NS1,
             NS2);
@@ -136,15 +149,6 @@ class DnsHelper
                 $var['mx'] = 'wrong';
             }
         }
-
-        logModuleCall(
-    		'kerioEmail',
-	    	__FUNCTION__,
-		    $params,
-    		'Debug',
-	    	$testselect
-    	);
-
         return $vars;
     }
 }

+ 2 - 1
core/Http/Response.php

@@ -165,6 +165,7 @@ class Response extends SymfonyRespose
         $action = $pageController->getControllerMethod();
 
         $mainMenu = DependencyInjection::create(MainMenu::class)->buildBreadcrumb($controller,  $action, []);
+        $dns = new DnsHelper();
         $menu = $mainMenu->getMenu();
 
         $addon = ServiceLocator::call(Config::class);
@@ -189,7 +190,7 @@ class Response extends SymfonyRespose
             'tagImageModule'           => $addon->getConfigValue('moduleIcon'),
             'isDebug'                  => (bool)((int)$addon->getConfigValue('debug', "0")),
             'errorPageDetails'         => $this->getErrorPageData($responseResolver),
-            'dnsvars'                  => DnsHelper::KerioEmailCheckDNS($params)
+            'dnsvars'                  => $dns->KerioEmailCheckDNS($params)
         ];
 
         logModuleCall(