|
@@ -22,21 +22,47 @@ function zimbraSingle_MetaData()
|
|
|
*/
|
|
*/
|
|
|
function zimbraSingleGetAccess()
|
|
function zimbraSingleGetAccess()
|
|
|
{
|
|
{
|
|
|
|
|
+ global $packageid;
|
|
|
$accessData = array('zimbraServer' => '', 'adminUser' => '', 'adminPass' => '');
|
|
$accessData = array('zimbraServer' => '', 'adminUser' => '', 'adminPass' => '');
|
|
|
$whmcs = App::self();
|
|
$whmcs = App::self();
|
|
|
|
|
+ $productID = $whmcs->get_req_var('id');
|
|
|
$serverGroupID = $whmcs->get_req_var('servergroup');
|
|
$serverGroupID = $whmcs->get_req_var('servergroup');
|
|
|
- $serverID = Capsule::table('tblservergroupsrel')
|
|
|
|
|
- ->select('serverid')
|
|
|
|
|
- ->where('groupid', '=', $serverGroupID)
|
|
|
|
|
- ->get();
|
|
|
|
|
- $servers = Capsule::table('tblservers')
|
|
|
|
|
|
|
+ if($productID) {
|
|
|
|
|
+ $serverIDObj = Capsule::table('tblhosting')
|
|
|
|
|
+ ->select('server')
|
|
|
|
|
+ ->where('id', '=', $productID)
|
|
|
|
|
+ ->get();
|
|
|
|
|
+ $serverID = $serverIDObj[0]->server;
|
|
|
|
|
+ } elseif($serverGroupID) {
|
|
|
|
|
+ $serverIDObj = Capsule::table('tblservergroupsrel')
|
|
|
|
|
+ ->select('serverid')
|
|
|
|
|
+ ->where('groupid', '=', $serverGroupID)
|
|
|
|
|
+ ->get();
|
|
|
|
|
+ $serverID = $serverIDObj[0]->serverid;
|
|
|
|
|
+ } elseif($packageid) {
|
|
|
|
|
+ $serverIDObj = Capsule::table('tblhosting')
|
|
|
|
|
+ ->select('server')
|
|
|
|
|
+ ->where('packageid', '=', $packageid)
|
|
|
|
|
+ ->get();
|
|
|
|
|
+ $serverID = $serverIDObj[0]->server;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ logModuleCall(
|
|
|
|
|
+ 'zimbrasingle',
|
|
|
|
|
+ __FUNCTION__,
|
|
|
|
|
+ $params,
|
|
|
|
|
+ "Error: could not get accessdata 3",
|
|
|
|
|
+ ""
|
|
|
|
|
+ );
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ $server = Capsule::table('tblservers')
|
|
|
->select('ipaddress', 'username', 'password')
|
|
->select('ipaddress', 'username', 'password')
|
|
|
- ->where('id', '=', $serverID[0]->serverid)
|
|
|
|
|
|
|
+ ->where('id', '=', $serverID)
|
|
|
->where('active', '=', 1)
|
|
->where('active', '=', 1)
|
|
|
->get();
|
|
->get();
|
|
|
- $accessData['zimbraServer'] = $servers[0]->ipaddress;
|
|
|
|
|
- $accessData['adminUser'] = $servers[0]->username;
|
|
|
|
|
- $adminPassCrypt = $servers[0]->password;
|
|
|
|
|
|
|
+ $accessData['zimbraServer'] = $server[0]->ipaddress;
|
|
|
|
|
+ $accessData['adminUser'] = $server[0]->username;
|
|
|
|
|
+ $adminPassCrypt = $server[0]->password;
|
|
|
$adminPassDecrypt = localAPI('DecryptPassword', array('password2' => $adminPassCrypt));
|
|
$adminPassDecrypt = localAPI('DecryptPassword', array('password2' => $adminPassCrypt));
|
|
|
if ($adminPassDecrypt['result'] == 'success') {
|
|
if ($adminPassDecrypt['result'] == 'success') {
|
|
|
$accessData['adminPass'] = $adminPassDecrypt['password'];
|
|
$accessData['adminPass'] = $adminPassDecrypt['password'];
|
|
@@ -55,7 +81,6 @@ function zimbraSingleDoesEMailExist($emailNameOnly, $domainName)
|
|
|
{
|
|
{
|
|
|
$account_name = $emailNameOnly . "@" . $domainName;
|
|
$account_name = $emailNameOnly . "@" . $domainName;
|
|
|
$accessData = zimbraSingleGetAccess();
|
|
$accessData = zimbraSingleGetAccess();
|
|
|
-
|
|
|
|
|
$api = new Zm_Auth($accessData['zimbraServer'], $accessData['adminUser'], $accessData['adminPass'], "admin");
|
|
$api = new Zm_Auth($accessData['zimbraServer'], $accessData['adminUser'], $accessData['adminPass'], "admin");
|
|
|
$login = $api->login();
|
|
$login = $api->login();
|
|
|
if(is_a($login, "Exception")) {
|
|
if(is_a($login, "Exception")) {
|
|
@@ -91,7 +116,6 @@ function zimbraSingleCreateAccount($userData)
|
|
|
$userData['password'] = $passDecrypt['password'];
|
|
$userData['password'] = $passDecrypt['password'];
|
|
|
}
|
|
}
|
|
|
$account_name = $userData['username'] . '@' . $userData['maildomain'];
|
|
$account_name = $userData['username'] . '@' . $userData['maildomain'];
|
|
|
-
|
|
|
|
|
$api = new Zm_Auth($accessData['zimbraServer'], $accessData['adminUser'], $accessData['adminPass'], "admin");
|
|
$api = new Zm_Auth($accessData['zimbraServer'], $accessData['adminUser'], $accessData['adminPass'], "admin");
|
|
|
$login = $api->login();
|
|
$login = $api->login();
|
|
|
if(is_a($login, "Exception")) {
|
|
if(is_a($login, "Exception")) {
|
|
@@ -113,7 +137,7 @@ function zimbraSingleCreateAccount($userData)
|
|
|
__FUNCTION__,
|
|
__FUNCTION__,
|
|
|
$params,
|
|
$params,
|
|
|
"Error : serviceclass $cosName not available",
|
|
"Error : serviceclass $cosName not available",
|
|
|
- ""
|
|
|
|
|
|
|
+ $userData
|
|
|
);
|
|
);
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
@@ -125,7 +149,7 @@ function zimbraSingleCreateAccount($userData)
|
|
|
__FUNCTION__,
|
|
__FUNCTION__,
|
|
|
$params,
|
|
$params,
|
|
|
"Error : account $account_name not created",
|
|
"Error : account $account_name not created",
|
|
|
- ""
|
|
|
|
|
|
|
+ $id
|
|
|
);
|
|
);
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
@@ -170,7 +194,6 @@ function zimbraSingleUnsuspendAccount($userData)
|
|
|
{
|
|
{
|
|
|
$accessData = zimbraSingleGetAccess();
|
|
$accessData = zimbraSingleGetAccess();
|
|
|
$account_name = $userData['username'] . '@' . $userData['maildomain'];
|
|
$account_name = $userData['username'] . '@' . $userData['maildomain'];
|
|
|
-
|
|
|
|
|
$api = new Zm_Auth($accessData['zimbraServer'], $accessData['adminUser'], $accessData['adminPass'], "admin");
|
|
$api = new Zm_Auth($accessData['zimbraServer'], $accessData['adminUser'], $accessData['adminPass'], "admin");
|
|
|
$login = $api->login();
|
|
$login = $api->login();
|
|
|
if(is_a($login, "Exception")) {
|
|
if(is_a($login, "Exception")) {
|
|
@@ -203,8 +226,7 @@ function zimbraSingleUnsuspendAccount($userData)
|
|
|
function zimbraSingleDeleteAccount($userData)
|
|
function zimbraSingleDeleteAccount($userData)
|
|
|
{
|
|
{
|
|
|
$accessData = zimbraSingleGetAccess();
|
|
$accessData = zimbraSingleGetAccess();
|
|
|
- $account_name = $userData['username'] . '@' . $userData['maildomain'];
|
|
|
|
|
-
|
|
|
|
|
|
|
+ $accountName = $userData['username'] . '@' . $userData['maildomain'];
|
|
|
$api = new Zm_Auth($accessData['zimbraServer'], $accessData['adminUser'], $accessData['adminPass'], "admin");
|
|
$api = new Zm_Auth($accessData['zimbraServer'], $accessData['adminUser'], $accessData['adminPass'], "admin");
|
|
|
$login = $api->login();
|
|
$login = $api->login();
|
|
|
if(is_a($login, "Exception")) {
|
|
if(is_a($login, "Exception")) {
|
|
@@ -216,35 +238,34 @@ function zimbraSingleDeleteAccount($userData)
|
|
|
""
|
|
""
|
|
|
);
|
|
);
|
|
|
return false;
|
|
return false;
|
|
|
- } else {
|
|
|
|
|
- $apiAccountManager = new Zm_Account($api);
|
|
|
|
|
- $response = $apiAccountManager->getAccountStatus($account_name);
|
|
|
|
|
- if(is_a($response, "Exception")) {
|
|
|
|
|
- logModuleCall(
|
|
|
|
|
- 'zimbrasingle',
|
|
|
|
|
- __FUNCTION__,
|
|
|
|
|
- $params,
|
|
|
|
|
- "Error : account $account_name could not verified",
|
|
|
|
|
- ""
|
|
|
|
|
- );
|
|
|
|
|
- return false;
|
|
|
|
|
- }
|
|
|
|
|
- if ($response != 'locked') {
|
|
|
|
|
- return "Account $account_name active, suspend account first";
|
|
|
|
|
- }
|
|
|
|
|
- $response = $apiAccountManager->deleteAccount($account_name);
|
|
|
|
|
- if(is_a($response, "Exception")) {
|
|
|
|
|
- logModuleCall(
|
|
|
|
|
- 'zimbrasingle',
|
|
|
|
|
- __FUNCTION__,
|
|
|
|
|
- $params,
|
|
|
|
|
- "Error : account $account_name could not removed",
|
|
|
|
|
- ""
|
|
|
|
|
- );
|
|
|
|
|
- return false;
|
|
|
|
|
- }
|
|
|
|
|
- return 'success';
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+ $apiAccountManager = new Zm_Account($api);
|
|
|
|
|
+ $response = $apiAccountManager->getAccountStatus($accountName);
|
|
|
|
|
+ if(is_a($response, "Exception")) {
|
|
|
|
|
+ logModuleCall(
|
|
|
|
|
+ 'zimbrasingle',
|
|
|
|
|
+ __FUNCTION__,
|
|
|
|
|
+ $params,
|
|
|
|
|
+ "Error : account $accountName could not verified",
|
|
|
|
|
+ ""
|
|
|
|
|
+ );
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ if ($response != 'locked') {
|
|
|
|
|
+ return "Account $accountName active, suspend account first";
|
|
|
|
|
+ }
|
|
|
|
|
+ $response = $apiAccountManager->deleteAccount($accountName);
|
|
|
|
|
+ if(is_a($response, "Exception")) {
|
|
|
|
|
+ logModuleCall(
|
|
|
|
|
+ 'zimbrasingle',
|
|
|
|
|
+ __FUNCTION__,
|
|
|
|
|
+ $params,
|
|
|
|
|
+ "Error : account $accountName could not removed",
|
|
|
|
|
+ ""
|
|
|
|
|
+ );
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ return 'success';
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function zimbraSingleChangePassword($userData) {
|
|
function zimbraSingleChangePassword($userData) {
|
|
@@ -257,7 +278,6 @@ function zimbraSingleChangePassword($userData) {
|
|
|
return $checkPW;
|
|
return $checkPW;
|
|
|
}
|
|
}
|
|
|
$account_name = $userData['username'] . '@' . $userData['maildomain'];
|
|
$account_name = $userData['username'] . '@' . $userData['maildomain'];
|
|
|
-
|
|
|
|
|
$api = new Zm_Auth($accessData['zimbraServer'], $accessData['adminUser'], $accessData['adminPass'], "admin");
|
|
$api = new Zm_Auth($accessData['zimbraServer'], $accessData['adminUser'], $accessData['adminPass'], "admin");
|
|
|
$login = $api->login();
|
|
$login = $api->login();
|
|
|
if(is_a($login, "Exception")) {
|
|
if(is_a($login, "Exception")) {
|
|
@@ -269,28 +289,25 @@ function zimbraSingleChangePassword($userData) {
|
|
|
""
|
|
""
|
|
|
);
|
|
);
|
|
|
return false;
|
|
return false;
|
|
|
- } else {
|
|
|
|
|
- $apiAccountManager = new Zm_Account($api);
|
|
|
|
|
- $response = $apiAccountManager->setAccountPassword($account_name, $userData['password']);
|
|
|
|
|
- if(is_a($response, "Exception")) {
|
|
|
|
|
- logModuleCall(
|
|
|
|
|
- 'zimbrasingle',
|
|
|
|
|
- __FUNCTION__,
|
|
|
|
|
- $params,
|
|
|
|
|
- "Error : password for $account_name could not be set",
|
|
|
|
|
- ""
|
|
|
|
|
- );
|
|
|
|
|
- return false;
|
|
|
|
|
- } else {
|
|
|
|
|
- return $response;
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+ $apiAccountManager = new Zm_Account($api);
|
|
|
|
|
+ $response = $apiAccountManager->setAccountPassword($account_name, $userData['password']);
|
|
|
|
|
+ if(is_a($response, "Exception")) {
|
|
|
|
|
+ logModuleCall(
|
|
|
|
|
+ 'zimbrasingle',
|
|
|
|
|
+ __FUNCTION__,
|
|
|
|
|
+ $params,
|
|
|
|
|
+ "Error : password for $account_name could not be set",
|
|
|
|
|
+ ""
|
|
|
|
|
+ );
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ return 'success';
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function zimbraSingleChangePackage($userData) {
|
|
function zimbraSingleChangePackage($userData) {
|
|
|
$accessData = zimbraSingleGetAccess();
|
|
$accessData = zimbraSingleGetAccess();
|
|
|
$account_name = $userData['username'] . '@' . $userData['maildomain'];
|
|
$account_name = $userData['username'] . '@' . $userData['maildomain'];
|
|
|
-
|
|
|
|
|
$api = new Zm_Auth($accessData['zimbraServer'], $accessData['adminUser'], $accessData['adminPass'], "admin");
|
|
$api = new Zm_Auth($accessData['zimbraServer'], $accessData['adminUser'], $accessData['adminPass'], "admin");
|
|
|
$login = $api->login();
|
|
$login = $api->login();
|
|
|
if(is_a($login, "Exception")) {
|
|
if(is_a($login, "Exception")) {
|
|
@@ -321,8 +338,8 @@ function zimbraSingleChangePackage($userData) {
|
|
|
function zimbraSingleClientArea($userData)
|
|
function zimbraSingleClientArea($userData)
|
|
|
{
|
|
{
|
|
|
$accessData = zimbraSingleGetAccess();
|
|
$accessData = zimbraSingleGetAccess();
|
|
|
|
|
+ $clientInfo = array();
|
|
|
$account_name = $userData['username'] . '@' . $userData['maildomain'];
|
|
$account_name = $userData['username'] . '@' . $userData['maildomain'];
|
|
|
-
|
|
|
|
|
$api = new Zm_Auth($accessData['zimbraServer'], $accessData['adminUser'], $accessData['adminPass'], "admin");
|
|
$api = new Zm_Auth($accessData['zimbraServer'], $accessData['adminUser'], $accessData['adminPass'], "admin");
|
|
|
$login = $api->login();
|
|
$login = $api->login();
|
|
|
if(is_a($login, "Exception")) {
|
|
if(is_a($login, "Exception")) {
|
|
@@ -334,30 +351,49 @@ function zimbraSingleClientArea($userData)
|
|
|
""
|
|
""
|
|
|
);
|
|
);
|
|
|
return false;
|
|
return false;
|
|
|
- } else {
|
|
|
|
|
- $apiAccountManager = new Zm_Account($api);
|
|
|
|
|
- $response = $apiAccountManager->getAccountInfo($account_name);
|
|
|
|
|
- if(is_a($response, "Exception")) {
|
|
|
|
|
- logModuleCall(
|
|
|
|
|
- 'zimbrasingle',
|
|
|
|
|
- __FUNCTION__,
|
|
|
|
|
- $params,
|
|
|
|
|
- "Error : could not gather informations for $account_name",
|
|
|
|
|
- ""
|
|
|
|
|
- );
|
|
|
|
|
- return false;
|
|
|
|
|
- } else {
|
|
|
|
|
- $webMailURL = recursiveFindAll( $response, 'PUBLICMAILURL');
|
|
|
|
|
- logModuleCall(
|
|
|
|
|
- 'zimbrasingle',
|
|
|
|
|
- __FUNCTION__,
|
|
|
|
|
- $params,
|
|
|
|
|
- "debug",
|
|
|
|
|
- $webMailURL
|
|
|
|
|
- );
|
|
|
|
|
- return $webMailURL;
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+ $apiAccountManager = new Zm_Account($api);
|
|
|
|
|
+ $quota = $apiAccountManager->getQuota($account_name);
|
|
|
|
|
+ if(is_a($quota, "Exception")) {
|
|
|
|
|
+ logModuleCall(
|
|
|
|
|
+ 'zimbrasingle',
|
|
|
|
|
+ __FUNCTION__,
|
|
|
|
|
+ $params,
|
|
|
|
|
+ "Error : could not find $account_name",
|
|
|
|
|
+ ""
|
|
|
|
|
+ );
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ $response = $apiAccountManager->getMailbox($account_name);
|
|
|
|
|
+ if(is_a($response, "Exception")) {
|
|
|
|
|
+ logModuleCall(
|
|
|
|
|
+ 'zimbrasingle',
|
|
|
|
|
+ __FUNCTION__,
|
|
|
|
|
+ $params,
|
|
|
|
|
+ "Error : could not fetch mailbox info for $account_name",
|
|
|
|
|
+ ""
|
|
|
|
|
+ );
|
|
|
|
|
+ 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($account_name);
|
|
|
|
|
+ if(is_a($response, "Exception")) {
|
|
|
|
|
+ logModuleCall(
|
|
|
|
|
+ 'zimbrasingle',
|
|
|
|
|
+ __FUNCTION__,
|
|
|
|
|
+ $params,
|
|
|
|
|
+ "Error : could not gather informations for $account_name",
|
|
|
|
|
+ ""
|
|
|
|
|
+ );
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ $webmailUrl = recursiveFindAll( $response, 'PUBLICMAILURL');
|
|
|
|
|
+ $clientInfo['webmailurl'] = $webmailUrl[0]['DATA'];
|
|
|
|
|
+ return $clientInfo;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function zimbraSingleConfigOptions($params) {
|
|
function zimbraSingleConfigOptions($params) {
|
|
@@ -435,7 +471,7 @@ function zimbraSingleCreateCustomFields($packageconfigoption)
|
|
|
'showorder' => 'on',
|
|
'showorder' => 'on',
|
|
|
'sortorder' => '0'
|
|
'sortorder' => '0'
|
|
|
)
|
|
)
|
|
|
- );
|
|
|
|
|
|
|
+ );
|
|
|
Capsule::table('tblcustomfields')
|
|
Capsule::table('tblcustomfields')
|
|
|
->insert(
|
|
->insert(
|
|
|
array(
|
|
array(
|
|
@@ -447,7 +483,7 @@ function zimbraSingleCreateCustomFields($packageconfigoption)
|
|
|
'showorder' => 'on',
|
|
'showorder' => 'on',
|
|
|
'sortorder' => '1'
|
|
'sortorder' => '1'
|
|
|
)
|
|
)
|
|
|
- );
|
|
|
|
|
|
|
+ );
|
|
|
Capsule::table('tblcustomfields')
|
|
Capsule::table('tblcustomfields')
|
|
|
->insert(
|
|
->insert(
|
|
|
array(
|
|
array(
|
|
@@ -459,7 +495,7 @@ function zimbraSingleCreateCustomFields($packageconfigoption)
|
|
|
'showorder' => 'on',
|
|
'showorder' => 'on',
|
|
|
'sortorder' => '2'
|
|
'sortorder' => '2'
|
|
|
)
|
|
)
|
|
|
- );
|
|
|
|
|
|
|
+ );
|
|
|
Capsule::table('tblcustomfields')
|
|
Capsule::table('tblcustomfields')
|
|
|
->insert(
|
|
->insert(
|
|
|
array(
|
|
array(
|
|
@@ -472,7 +508,7 @@ function zimbraSingleCreateCustomFields($packageconfigoption)
|
|
|
'showorder' => 'on',
|
|
'showorder' => 'on',
|
|
|
'sortorder' => '3'
|
|
'sortorder' => '3'
|
|
|
)
|
|
)
|
|
|
- );
|
|
|
|
|
|
|
+ );
|
|
|
Capsule::table('tblcustomfields')
|
|
Capsule::table('tblcustomfields')
|
|
|
->insert(
|
|
->insert(
|
|
|
array(
|
|
array(
|
|
@@ -484,7 +520,7 @@ function zimbraSingleCreateCustomFields($packageconfigoption)
|
|
|
'showorder' => 'on',
|
|
'showorder' => 'on',
|
|
|
'sortorder' => '4'
|
|
'sortorder' => '4'
|
|
|
)
|
|
)
|
|
|
- );
|
|
|
|
|
|
|
+ );
|
|
|
Capsule::table('tblcustomfields')
|
|
Capsule::table('tblcustomfields')
|
|
|
->insert(
|
|
->insert(
|
|
|
array(
|
|
array(
|
|
@@ -497,7 +533,7 @@ function zimbraSingleCreateCustomFields($packageconfigoption)
|
|
|
'required' => 'on',
|
|
'required' => 'on',
|
|
|
'sortorder' => '5'
|
|
'sortorder' => '5'
|
|
|
)
|
|
)
|
|
|
- );
|
|
|
|
|
|
|
+ );
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function recursiveFindAll($haystack, $needle)
|
|
function recursiveFindAll($haystack, $needle)
|
|
@@ -520,29 +556,26 @@ function zimbraSingleCheckPassword($pwd)
|
|
|
{
|
|
{
|
|
|
$message = '';
|
|
$message = '';
|
|
|
if (strlen($pwd) < 9) {
|
|
if (strlen($pwd) < 9) {
|
|
|
- $message .= "Das das Passwort ist zu kurz. Es werden mind. 9 Zeichen benötigt<br>";
|
|
|
|
|
|
|
+ $message .= "Das das Passwort ist zu kurz. Es werden mind. 9 Zeichen benötigt" . PHP_EOL;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
if (!preg_match("#[0-9]+#", $pwd)) {
|
|
if (!preg_match("#[0-9]+#", $pwd)) {
|
|
|
- $message .= "Das Passwort muss mindestens eine Zahl enthalten<br>";
|
|
|
|
|
|
|
+ $message .= "Das Passwort muss mindestens eine Zahl enthalten" . PHP_EOL;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
if (!preg_match("#[A-Z]+#", $pwd)) {
|
|
if (!preg_match("#[A-Z]+#", $pwd)) {
|
|
|
- $message .= "Das Passwort muss mindestens einen Grossbuchstaben (A-Z) enthalten<br>";
|
|
|
|
|
|
|
+ $message .= "Das Passwort muss mindestens einen Grossbuchstaben (A-Z) enthalten" . PHP_EOL;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
if (!preg_match("#[a-z]+#", $pwd)) {
|
|
if (!preg_match("#[a-z]+#", $pwd)) {
|
|
|
- $message .= "Das Passwort muss mindestens einen Kleinbuchstaben (a-z) enthalten<br>";
|
|
|
|
|
|
|
+ $message .= "Das Passwort muss mindestens einen Kleinbuchstaben (a-z) enthalten" . PHP_EOL;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
if (!preg_match("#[^\w]+#", $pwd)) {
|
|
if (!preg_match("#[^\w]+#", $pwd)) {
|
|
|
- $message .= "Das Passwort muss mindestens ein Sonderzeichen (.,-:=) enthalten<br>";
|
|
|
|
|
|
|
+ $message .= "Das Passwort muss mindestens ein Sonderzeichen (.,-:=) enthalten" . PHP_EOL;
|
|
|
}
|
|
}
|
|
|
return $message;
|
|
return $message;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-function zimbraSingleTestFunction()
|
|
|
|
|
|
|
+function bytesToHuman($bytes)
|
|
|
{
|
|
{
|
|
|
- return 'blubb';
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
|
|
+ $units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'];
|
|
|
|
|
+ for ($i = 0; $bytes > 1024; $i++) $bytes /= 1024;
|
|
|
|
|
+ return round($bytes, 2) . ' ' . $units[$i];
|
|
|
|
|
+}
|