|
|
@@ -25,65 +25,6 @@ require_once("api/Zm/Account.php");
|
|
|
require_once("api/Zm/Domain.php");
|
|
|
require_once("api/Zm/Server.php");
|
|
|
|
|
|
-/**
|
|
|
- * Helper function to get the zimbra server access data from whmcs database
|
|
|
- *
|
|
|
- * @return array $accessData {
|
|
|
- * @type string 'zimbraServer' zimbra server IP address
|
|
|
- * @type string 'adminUser' zimbra admin username
|
|
|
- * @type string 'password' zimbra admin password
|
|
|
- * } or false in case of error
|
|
|
- */
|
|
|
-function zimbraSingleGetAccess()
|
|
|
-{
|
|
|
- $accessData = array('zimbraServer' => '', 'adminUser' => '', 'adminPass' => '');
|
|
|
- $whmcs = App::self();
|
|
|
- $serverGroupID = $whmcs->get_req_var('servergroup');
|
|
|
- $action = $whmcs->get_req_var('action');
|
|
|
- if(($action == 'module-settings') || ($action == 'ConfigOptions') || ($action == 'save')) {
|
|
|
- $productID = $whmcs->get_req_var('id');
|
|
|
- $serverGroupIDObj = Capsule::table('tblproducts')
|
|
|
- ->select('servergroup')
|
|
|
- ->where('id', '=', $productID)
|
|
|
- ->get();
|
|
|
- $serverGroupID = $serverGroupIDObj[0]->servergroup;
|
|
|
- $serverIDObj = Capsule::table('tblservergroupsrel')
|
|
|
- ->select('serverid')
|
|
|
- ->where('groupid', '=', $serverGroupID)
|
|
|
- ->get();
|
|
|
- $serverID = $serverIDObj[0]->serverid;
|
|
|
- } else {
|
|
|
- $id = $whmcs->get_req_var('id');
|
|
|
- $serverIDObj = Capsule::table('tblhosting')
|
|
|
- ->select('server')
|
|
|
- ->where('id', '=', $id)
|
|
|
- ->get();
|
|
|
- $serverID = $serverIDObj[0]->server;
|
|
|
- }
|
|
|
- $server = Capsule::table('tblservers')
|
|
|
- ->select('ipaddress', 'username', 'password')
|
|
|
- ->where('id', '=', $serverID)
|
|
|
- ->where('active', '=', 1)
|
|
|
- ->get();
|
|
|
- $accessData['zimbraServer'] = $server[0]->ipaddress;
|
|
|
- $accessData['adminUser'] = $server[0]->username;
|
|
|
- $adminPassCrypt = $server[0]->password;
|
|
|
- $adminPassDecrypt = localAPI('DecryptPassword', array('password2' => $adminPassCrypt));
|
|
|
- if ($adminPassDecrypt['result'] == 'success') {
|
|
|
- $accessData['adminPass'] = $adminPassDecrypt['password'];
|
|
|
- } else {
|
|
|
- logModuleCall(
|
|
|
- 'zimbrasingle',
|
|
|
- __FUNCTION__,
|
|
|
- $adminPassCrypt,
|
|
|
- "Error: cloud not decrypt admin password" ,
|
|
|
- $adminPassDecrypt
|
|
|
- );
|
|
|
- return false;
|
|
|
- }
|
|
|
- return $accessData;
|
|
|
-}
|
|
|
-
|
|
|
/**
|
|
|
* Helper function to find values of a named key in a multidimensional arrays
|
|
|
*
|
|
|
@@ -735,25 +676,5 @@ function zimbraSingle_ConfigOptions($params)
|
|
|
"Options" => implode(',', $cosNames),
|
|
|
"Description" => "Select COS",
|
|
|
);
|
|
|
- $apiDomainManager = new Zm_Domain($api);
|
|
|
- $response = $apiDomainManager->getAllDomains();
|
|
|
- if(is_a($response, "Exception")) {
|
|
|
- logModuleCall(
|
|
|
- 'zimbrasingle',
|
|
|
- __FUNCTION__,
|
|
|
- $params,
|
|
|
- "Error: could fetch available maildomains",
|
|
|
- $response
|
|
|
- );
|
|
|
- return false;
|
|
|
- }
|
|
|
- $domainNames = recursiveFindAll($response, 'NAME');
|
|
|
- $configOptions['maildomains'] = array(
|
|
|
- "FriendlyName" => "Mail Domain",
|
|
|
- "Type" => "dropdown",
|
|
|
- "Multiple" => true,
|
|
|
- "Options" => implode(',', $domainNames),
|
|
|
- "Description" => "Info: Available Maildomains",
|
|
|
- );
|
|
|
return $configOptions;
|
|
|
}
|