فهرست منبع

add mailinglists

andre 2 سال پیش
والد
کامیت
d7f6612c4d
2فایلهای تغییر یافته به همراه33 افزوده شده و 0 حذف شده
  1. 14 0
      api/KerioWhmcs.php
  2. 19 0
      app/UI/Client/DistributionList/Providers/AddListDataProvider.php

+ 14 - 0
api/KerioWhmcs.php

@@ -301,6 +301,20 @@ class KerioWhmcs extends KerioConnectApi {
 		return $result['list'];
 	}
 
+	/**
+	 * Create new mailinglist
+	 *
+	 * @param	array   Mailinglist
+	 * @return	array	Result of create action
+	 */
+	public function createMailinglist($list) {
+		$method = 'MailingLists.create';
+		$params['mailingLists'] = array($list);
+		$result = $this->sendRequest($method, $params);
+
+		return $result['result'];
+	}
+
 	/**
 	 * Get list of mailing lists from a domain
 	 *

+ 19 - 0
app/UI/Client/DistributionList/Providers/AddListDataProvider.php

@@ -188,6 +188,25 @@ class AddListDataProvider extends BaseDataProvider
          */
         $hid = $this->request->get('id');
 
+        $api = new KerioWhmcs('whmcsKerioEmail', 'Thurdata', '1.0');
+        try {
+            $api->login($this->getWhmcsParamByKey('serverhostname'), $this->getWhmcsParamByKey('serverusername'), $this->getWhmcsParamByKey('serverpassword'));
+            $domainID = $api->getDomainId($this->getWhmcsParamByKey('domain'));
+        } catch (KerioApiException $error) {
+            logModuleCall(
+                'kerioEmail',
+                __FUNCTION__,
+                $error,
+                'Debug Error',
+                $error->getMessage()
+            );
+            return ['error' => $error->getMessage()];
+        }
+
+        $paramsCreate['domainId'] = $domainID;
+
+        $api->logout();
+
         logModuleCall(
             'kerioEmail',
             __FUNCTION__,