浏览代码

new info form

andre 5 月之前
父节点
当前提交
791549f6e3
共有 2 个文件被更改,包括 14 次插入4 次删除
  1. 1 0
      app/UI/Client/Setting/Forms/InfoForm.php
  2. 13 4
      app/UI/Client/Setting/Providers/InfoSettingDataProvider.php

+ 1 - 0
app/UI/Client/Setting/Forms/InfoForm.php

@@ -43,6 +43,7 @@ class InfoForm extends BaseForm implements ClientArea
         $this->addField(new Hidden("id"));
         $this->addField(new Hidden("selfdns"));
         $this->addField(new Hidden("selfdomain"));
+        $this->addField(new Hidden("dnsok"));
         $fieldl = new Text("mxthurdata");
         $fieldl->setRawTitle('MX Eintrag ThurData Vorgabe')->addHtmlAttribute('readonly','true');
         $fieldr = new Text("mxactive");

+ 13 - 4
app/UI/Client/Setting/Providers/InfoSettingDataProvider.php

@@ -69,6 +69,7 @@ class InfoSettingDataProvider extends BaseDataProvider
             );
 
         $dnsRecords['selfdns'] ? $selfDns = 1 : $selfDns = 0;
+        $this->mxthurdata = $this->getWhmcsParamByKey('serverhostname');
         if(empty($dnsRecords['mx'])){
             $mx = 'unset';
         } else {
@@ -78,7 +79,6 @@ class InfoSettingDataProvider extends BaseDataProvider
             $spf = 'unset';
         } else {
             $spf = implode('',$dnsRecords['spf']);
-//            $spf = 'Blubb';
         }
         if(empty($dnsRecords['dmarc'])) {
             $dmarc = 'unset';
@@ -90,6 +90,15 @@ class InfoSettingDataProvider extends BaseDataProvider
         } else {
             $dkim = implode('',$dnsRecords['dkim']);
         }
+        if($this->mxthurdata == $mx){
+            if($this->spfConfig == $spf && $this->dmarcConfig == $dmarc && in_array($this->domainKey, $dnsRecords['dkim'])){
+                $dnsok = 'success';
+            } else {
+                $dnsok = 'warning';
+            }
+        } else {
+            $dnsok = 'danger';
+        }
         $this->data = [
             'id' => $maildomain,
             'domain' => $maildomain,
@@ -99,12 +108,12 @@ class InfoSettingDataProvider extends BaseDataProvider
             'dkim' => $dkim,
             'selfdns' => $selfDns,
             'selfdomain' => $selfdomain,
-            'mxthurdata' => $this->getWhmcsParamByKey('serverhostname'),
+            'mxthurdata' => $this->mxthurdata,
             'spfthurdata' => $this->spfConfig,
             'dmarcthurdata' => $this->dmarcConfig,
-            'dkimthurdata' => $this->domainKey
+            'dkimthurdata' => $this->domainKey,
+            'dnsok' => $dnsok
         ];
-        $this->availableValues['dnsrecords'] = $dnsRecords;
     }
 
     public function create()