|
|
@@ -84,145 +84,6 @@ function zimbraSingleGetAccess()
|
|
|
return $accessData;
|
|
|
}
|
|
|
|
|
|
-/**
|
|
|
- * Helper function creates all necessary custom fields depending on selected configuration options
|
|
|
- *
|
|
|
- * @param array $packageconfigoption {
|
|
|
- * @type string 1 class of service
|
|
|
- * @type string 2 comma seperated list of maildomains
|
|
|
- * }
|
|
|
- * @return bool true in case of success or false on any error
|
|
|
- */
|
|
|
-function zimbraSingleCreateCustomFields($packageconfigoption)
|
|
|
-{
|
|
|
- $whmcs = App::self();
|
|
|
- $productID = $whmcs->get_req_var('id');
|
|
|
- try {
|
|
|
- $customFieldIDsObj = Capsule::table('tblcustomfields')
|
|
|
- ->where('relid', '=', $productID)
|
|
|
- ->select('id')
|
|
|
- ->get();
|
|
|
- $customFieldIDs = recursiveFindAll((array)$customFieldIDsObj, 'id');
|
|
|
- Capsule::table('tblcustomfields')
|
|
|
- ->updateOrInsert(
|
|
|
- array(
|
|
|
- 'id' => $customFieldIDs[0] ? $customFieldIDs[0] : '',
|
|
|
- ),
|
|
|
- array(
|
|
|
- 'type' => 'product',
|
|
|
- 'relid' => $productID,
|
|
|
- 'fieldname' => 'givenname | Vorname',
|
|
|
- 'fieldtype' => 'text',
|
|
|
- 'required' => 'on',
|
|
|
- 'showorder' => 'on',
|
|
|
- 'sortorder' => '0'
|
|
|
- )
|
|
|
- );
|
|
|
- Capsule::table('tblcustomfields')
|
|
|
- ->updateOrInsert(
|
|
|
- array(
|
|
|
- 'id' => $customFieldIDs[1] ? $customFieldIDs[1] : '',
|
|
|
- ),
|
|
|
- array(
|
|
|
- 'type' => 'product',
|
|
|
- 'relid' => $productID,
|
|
|
- 'fieldname' => 'sn | Nachname',
|
|
|
- 'fieldtype' => 'text',
|
|
|
- 'required' => 'on',
|
|
|
- 'showorder' => 'on',
|
|
|
- 'sortorder' => '1'
|
|
|
- )
|
|
|
- );
|
|
|
- Capsule::table('tblcustomfields')
|
|
|
- ->updateOrInsert(
|
|
|
- array(
|
|
|
- 'id' => $customFieldIDs[2] ? $customFieldIDs[2] : '',
|
|
|
- ),
|
|
|
- array(
|
|
|
- 'type' => 'product',
|
|
|
- 'relid' => $productID,
|
|
|
- 'fieldname' => 'username | E-Mail Name',
|
|
|
- 'fieldtype' => 'text',
|
|
|
- 'required' => 'on',
|
|
|
- 'showorder' => 'on',
|
|
|
- 'sortorder' => '2'
|
|
|
- )
|
|
|
- );
|
|
|
- Capsule::table('tblcustomfields')
|
|
|
- ->updateOrInsert(
|
|
|
- array(
|
|
|
- 'id' => $customFieldIDs[3] ? $customFieldIDs[3] : '',
|
|
|
- ),
|
|
|
- array(
|
|
|
- 'type' => 'product',
|
|
|
- 'relid' => $productID,
|
|
|
- 'fieldname' => 'maildomain | Mail Domaine',
|
|
|
- 'fieldtype' => 'dropdown',
|
|
|
- 'fieldoptions' => implode(',', $packageconfigoption[2]),
|
|
|
- 'required' => 'on',
|
|
|
- 'showorder' => 'on',
|
|
|
- 'sortorder' => '3'
|
|
|
- )
|
|
|
- );
|
|
|
- Capsule::table('tblcustomfields')
|
|
|
- ->updateOrInsert(
|
|
|
- array(
|
|
|
- 'id' => $customFieldIDs[4] ? $customFieldIDs[4] : '',
|
|
|
- ),
|
|
|
- array(
|
|
|
- 'type' => 'product',
|
|
|
- 'relid' => $productID,
|
|
|
- 'fieldname' => 'password | Password',
|
|
|
- 'fieldtype' => 'password',
|
|
|
- 'required' => 'on',
|
|
|
- 'showorder' => 'on',
|
|
|
- 'sortorder' => '4'
|
|
|
- )
|
|
|
- );
|
|
|
- Capsule::table('tblcustomfields')
|
|
|
- ->updateOrInsert(
|
|
|
- array(
|
|
|
- 'id' => $customFieldIDs[5] ? $customFieldIDs[5] : '',
|
|
|
- ),
|
|
|
- array(
|
|
|
- 'type' => 'product',
|
|
|
- 'relid' => $productID,
|
|
|
- 'fieldname' => 'pwrepeat | Password wiederholen',
|
|
|
- 'fieldtype' => 'password',
|
|
|
- 'required' => 'on',
|
|
|
- 'showorder' => 'on',
|
|
|
- 'sortorder' => '5'
|
|
|
- )
|
|
|
- );
|
|
|
- Capsule::table('tblcustomfields')
|
|
|
- ->updateOrInsert(
|
|
|
- array(
|
|
|
- 'id' => $customFieldIDs[6] ? $customFieldIDs[6] : '',
|
|
|
- ),
|
|
|
- array(
|
|
|
- 'type' => 'product',
|
|
|
- 'relid' => $productID,
|
|
|
- 'fieldname' => 'cos | Class of Service',
|
|
|
- 'fieldtype' => 'dropdown',
|
|
|
- 'fieldoptions' => $packageconfigoption[1],
|
|
|
- 'adminonly' => 'on',
|
|
|
- 'required' => 'on',
|
|
|
- 'sortorder' => '6'
|
|
|
- )
|
|
|
- );
|
|
|
- return true;
|
|
|
- } catch (\Exception $e) {
|
|
|
- logModuleCall(
|
|
|
- 'zimbrasingle',
|
|
|
- __FUNCTION__,
|
|
|
- $params,
|
|
|
- "Error: could not create custom fields",
|
|
|
- $e->getMessage()
|
|
|
- );
|
|
|
- return false;
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
/**
|
|
|
* Helper function to find values of a named key in a multidimensional arrays
|
|
|
*
|
|
|
@@ -400,33 +261,6 @@ function zimbraSingle_ClientArea($params)
|
|
|
return false;
|
|
|
}
|
|
|
$apiAccountManager = new Zm_Account($api);
|
|
|
- $quota = $apiAccountManager->getQuota($accountName);
|
|
|
- if(is_a($quota, "Exception")) {
|
|
|
- logModuleCall(
|
|
|
- 'zimbrasingle',
|
|
|
- __FUNCTION__,
|
|
|
- $params,
|
|
|
- "Error : could not find $accountName",
|
|
|
- $quota
|
|
|
- );
|
|
|
- return false;
|
|
|
- }
|
|
|
- $response = $apiAccountManager->getMailbox($accountName);
|
|
|
- if(is_a($response, "Exception")) {
|
|
|
- logModuleCall(
|
|
|
- 'zimbrasingle',
|
|
|
- __FUNCTION__,
|
|
|
- $params,
|
|
|
- "Error: could not fetch mailbox info for $accountName",
|
|
|
- $response
|
|
|
- );
|
|
|
- return false;
|
|
|
- }
|
|
|
- $mboxSize = $response['S'];
|
|
|
- $usagePercent = $mboxSize * 100 / $quota;
|
|
|
- $clientInfo['quota'] = bytesToHuman($quota);
|
|
|
- $clientInfo['size'] = bytesToHuman($mboxSize);
|
|
|
- $clientInfo['usage'] = round($usagePercent, 2);
|
|
|
$response = $apiAccountManager->getAccountInfo($accountName);
|
|
|
if(is_a($response, "Exception")) {
|
|
|
logModuleCall(
|
|
|
@@ -569,6 +403,13 @@ function zimbraSingle_ChangePassword($params)
|
|
|
*/
|
|
|
function zimbraSingle_CreateAccount($params)
|
|
|
{
|
|
|
+ logModuleCall(
|
|
|
+ 'zimbrasingle',
|
|
|
+ __FUNCTION__,
|
|
|
+ $params,
|
|
|
+ "Debug",
|
|
|
+ $whmcs
|
|
|
+ );
|
|
|
$accessData = zimbraSingleGetAccess();
|
|
|
$api = new Zm_Auth($accessData['zimbraServer'], $accessData['adminUser'], $accessData['adminPass'], "admin");
|
|
|
$login = $api->login();
|