瀏覽代碼

add chat control

andre 2 月之前
父節點
當前提交
33ed6e80c1

+ 10 - 6
app/UI/Client/Setting/Providers/EditSettingDataProvider.php

@@ -31,7 +31,7 @@ class EditSettingDataProvider extends BaseDataProvider
         try {
             $api->login($this->getWhmcsParamByKey('serverhostname'), $this->getWhmcsParamByKey('serverusername'), $this->getWhmcsParamByKey('serverpassword'));
             $dkimSet = $api->getDkimDnsRecord($maildomain);
-            $securitys = $api->getDomains(['id','name','isDkimEnabled','twoFAEnabled']);
+            $features = $api->getDomains(['id','name','isDkimEnabled','twoFAEnabled','isInstantMessagingEnabled']);
         } catch (KerioApiException $error) {
             logModuleCall(
                 'kerioEmail',
@@ -44,11 +44,12 @@ class EditSettingDataProvider extends BaseDataProvider
         }
         $api->logout();
         // find own domain
-        foreach($securitys as $security) {
-            if($security['name'] === $maildomain){ 
-                $domainID = $security['id'];
-                $security['twoFAEnabled'] == true ? $tfaenabled = 'on' : $tfaenabled = 'off' ;
-                $security['isDkimEnabled'] == true ? $dkimsigenabled = 'on' : $dkimsigenabled = 'off';
+        foreach($features as $feature) {
+            if($feature['name'] === $maildomain){ 
+                $domainID = $feature['id'];
+                $feature['twoFAEnabled'] == true ? $tfaenabled = 'on' : $tfaenabled = 'off' ;
+                $feature['isDkimEnabled'] == true ? $dkimsigenabled = 'on' : $dkimsigenabled = 'off';
+                $feature['isInstantMessagingEnabled'] == true ? $chatenabled = 'on' : $chatenabled = 'off';
             }
         }
         // format dkim response
@@ -133,6 +134,7 @@ class EditSettingDataProvider extends BaseDataProvider
             'dmarcmulti' => $dmarcmulti,
             'spfmulti' => $spfmulti,
             'tfaenabled' => $tfaenabled,
+            'chatenabled' => $chatenabled,
             'dkimsigenabled' => $dkimsigenabled,
             'domainid' => $domainID
         ];
@@ -152,6 +154,7 @@ class EditSettingDataProvider extends BaseDataProvider
             'editdkim',
             'dkimname',
             'tfaenabled',
+            'chatenabled',
             'dkimsigenabled',
             'domainid'
         ];
@@ -166,6 +169,7 @@ class EditSettingDataProvider extends BaseDataProvider
         if ($maildomain == $domain) {
             $this->formData['dkimsigenabled'] == 'on' ? $attr['isDkimEnabled'] = true : $attr['isDkimEnabled'] = false;
             $this->formData['tfaenabled'] == 'on' ? $attr['twoFAEnabled'] = true : $attr['twoFAEnabled'] = false;
+            $this->formData['chatenabled'] == 'on' ? $attr['isInstantMessagingEnabled'] = true : $attr['isInstantMessagingEnabled'] = false;
             $api = new KerioWhmcs('whmcsKerioEmail', 'Thurdata', '1.0');
             try {
                 $api->login($this->getWhmcsParamByKey('serverhostname'), $this->getWhmcsParamByKey('serverusername'), $this->getWhmcsParamByKey('serverpassword'));

+ 8 - 6
app/UI/Client/Setting/Providers/InfoSettingDataProvider.php

@@ -28,7 +28,7 @@ class InfoSettingDataProvider extends BaseDataProvider
         try {
             $api->login($this->getWhmcsParamByKey('serverhostname'), $this->getWhmcsParamByKey('serverusername'), $this->getWhmcsParamByKey('serverpassword'));
             $dkimSet = $api->getDkimDnsRecord($maildomain);
-            $securitys = $api->getDomains(['id','name','isDkimEnabled','twoFAEnabled']);
+            $features = $api->getDomains(['id','name','isDkimEnabled','twoFAEnabled','isInstantMessagingEnabled']);
         } catch (KerioApiException $error) {
             logModuleCall(
                 'kerioEmail',
@@ -41,11 +41,12 @@ class InfoSettingDataProvider extends BaseDataProvider
         }
         $api->logout();
         // find own domain
-        foreach($securitys as $security) {
-            if($security['name'] === $domain){ 
-                $domainID = $security['id'];
-                $security['twoFAEnabled'] == true ? $tfaenabled = 'on' : $tfaenabled = 'off' ;
-                $security['isDkimEnabled'] == true ? $dkimsigenabled = 'on' : $dkimsigenabled = 'off';
+        foreach($features as $feature) {
+            if($feature['name'] === $domain){ 
+                $domainID = $feature['id'];
+                $feature['twoFAEnabled'] == true ? $tfaenabled = 'on' : $tfaenabled = 'off' ;
+                $feature['isDkimEnabled'] == true ? $dkimsigenabled = 'on' : $dkimsigenabled = 'off';
+                $feature['isInstantMessagingEnabled'] == true ? $chatenabled = 'on' : $chatenabled = 'off';
             }
         }
         // format dkim response
@@ -131,6 +132,7 @@ class InfoSettingDataProvider extends BaseDataProvider
             'dmarcmulti' => $dmarcmulti,
             'spfmulti' => $spfmulti,
             'tfaenabled' => $tfaenabled,
+            'chatenabled' => $chatenabled,
             'dkimsigenabled' => $dkimsigenabled
         ];
     }

+ 3 - 0
app/UI/Client/Setting/Sections/AdditionalSection.php

@@ -41,6 +41,9 @@ class AdditionalSection extends FreeFieldsSection
         $tfaenabled = new Switcher('tfaenabled');
         $tfaenabled->addHtmlAttribute('disabled', true);
         $this->generateDoubleSection([$tfaenabled]);
+        $chatenabled = new Switcher('chatenabled');
+        $chatenabled->addHtmlAttribute('disabled', true);
+        $this->generateDoubleSection([$chatenabled]);
 
     }
 }

+ 2 - 0
app/UI/Client/Setting/Sections/EditAdditionalSection.php

@@ -33,6 +33,8 @@ class EditAdditionalSection extends FreeFieldsSection
             $this->addField($dkimsigenabled);
             $tfaenabled = new Switcher('tfaenabled');
             $this->addField($tfaenabled);
+            $chatenabled = new Switcher('chatenabled');
+            $this->addField($chatenabled);
             $this->addField(new Hidden('domainid'));
         } else {
             $infoalias = new Info('infoaliasdomain');