Test Setup Failed
Push — master ( 12c298...4a14e0 )
by Ralf
22:03
created
api/src/Auth/Backend.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	 * @param string $passwd_type ='text' 'text' for cleartext passwords (default)
26 26
 	 * @return boolean true if successful authenticated, false otherwise
27 27
 	 */
28
-	function authenticate($username, $passwd, $passwd_type='text');
28
+	function authenticate($username, $passwd, $passwd_type = 'text');
29 29
 
30 30
 	/**
31 31
 	 * changes password in sql datababse
@@ -36,5 +36,5 @@  discard block
 block discarded – undo
36 36
 	 * @throws Exception to give a verbose error, why changing password failed
37 37
 	 * @return boolean true if password successful changed, false otherwise
38 38
 	 */
39
-	function change_password($old_passwd, $new_passwd, $account_id=0);
39
+	function change_password($old_passwd, $new_passwd, $account_id = 0);
40 40
 }
Please login to merge, or discard this patch.
api/src/Auth/Cas.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,18 +29,18 @@  discard block
 block discarded – undo
29 29
 	 * @param string $passwd_type ='text' 'text' for cleartext passwords (default)
30 30
 	 * @return boolean true if successful authenticated, false otherwise
31 31
 	 */
32
-	function authenticate($username, $passwd, $passwd_type='text')
32
+	function authenticate($username, $passwd, $passwd_type = 'text')
33 33
 	{
34 34
 		/* if program goes here, authenticate is, normaly, already verified by CAS */
35 35
 		if ($GLOBALS['egw_info']['server']['account_repository'] != 'ldap' &&
36 36
 			$GLOBALS['egw_info']['server']['account_repository'] != 'ldsq') /* For anonymous LDAP connection */
37 37
 		{
38
-			if (!($id = $GLOBALS['egw']->accounts->name2id($username,'account_lid','u')) &&
38
+			if (!($id = $GLOBALS['egw']->accounts->name2id($username, 'account_lid', 'u')) &&
39 39
 				$GLOBALS['egw_info']['server']['auto_create_acct'])
40 40
 			{
41 41
 				// create a global array with all availible info about that account
42 42
 				$GLOBALS['auto_create_acct'] = array();
43
-				foreach(array(
43
+				foreach (array(
44 44
 					'givenname' => 'firstname',
45 45
 					'sn'        => 'lastname',
46 46
 					'uidnumber' => 'id',
@@ -48,11 +48,11 @@  discard block
 block discarded – undo
48 48
 					'gidnumber' => 'primary_group',
49 49
 					) as $ldap_name => $acct_name)
50 50
 				{
51
-					$GLOBALS['auto_create_acct'][$acct_name] = Api\Translation::convert($allValues[0][$ldap_name][0],'utf-8');
51
+					$GLOBALS['auto_create_acct'][$acct_name] = Api\Translation::convert($allValues[0][$ldap_name][0], 'utf-8');
52 52
 				}
53 53
 				return True;
54 54
 			}
55
-			return $id && $GLOBALS['egw']->accounts->id2name($id,'account_status') == 'A' && phpCAS::checkAuthentication();
55
+			return $id && $GLOBALS['egw']->accounts->id2name($id, 'account_status') == 'A' && phpCAS::checkAuthentication();
56 56
 		}
57 57
 		return phpCAS::checkAuthentication();
58 58
 	}
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	 * @param int $account_id =0 account id of user whose passwd should be changed
66 66
 	 * @return boolean true if password successful changed, false otherwise
67 67
 	 */
68
-	function change_password($old_passwd, $new_passwd, $account_id=0)
68
+	function change_password($old_passwd, $new_passwd, $account_id = 0)
69 69
 	{
70 70
 		/* Not allowed */
71 71
 		return false;
Please login to merge, or discard this patch.
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,13 +33,16 @@
 block discarded – undo
33 33
 	{
34 34
 		/* if program goes here, authenticate is, normaly, already verified by CAS */
35 35
 		if ($GLOBALS['egw_info']['server']['account_repository'] != 'ldap' &&
36
-			$GLOBALS['egw_info']['server']['account_repository'] != 'ldsq') /* For anonymous LDAP connection */
36
+			$GLOBALS['egw_info']['server']['account_repository'] != 'ldsq')
37
+		{
38
+			/* For anonymous LDAP connection */
37 39
 		{
38 40
 			if (!($id = $GLOBALS['egw']->accounts->name2id($username,'account_lid','u')) &&
39 41
 				$GLOBALS['egw_info']['server']['auto_create_acct'])
40 42
 			{
41 43
 				// create a global array with all availible info about that account
42 44
 				$GLOBALS['auto_create_acct'] = array();
45
+		}
43 46
 				foreach(array(
44 47
 					'givenname' => 'firstname',
45 48
 					'sn'        => 'lastname',
Please login to merge, or discard this patch.
api/src/Mail/Smtp.php 2 patches
Spacing   +16 added lines, -18 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 *
80 80
 	 * @param string $defaultDomain =null
81 81
 	 */
82
-	function __construct($defaultDomain=null)
82
+	function __construct($defaultDomain = null)
83 83
 	{
84 84
 		$this->defaultDomain = $defaultDomain ? $defaultDomain : $GLOBALS['egw_info']['server']['mail_suffix'];
85 85
 
@@ -104,12 +104,10 @@  discard block
 block discarded – undo
104 104
 	 */
105 105
 	function addAccount($_hookValues)
106 106
 	{
107
-		$mailLocalAddress = $_hookValues['account_email'] ? $_hookValues['account_email'] :
108
-			Api\Accounts::email($_hookValues['account_firstname'],
109
-				$_hookValues['account_lastname'],$_hookValues['account_lid'],$this->defaultDomain);
107
+		$mailLocalAddress = $_hookValues['account_email'] ? $_hookValues['account_email'] : Api\Accounts::email($_hookValues['account_firstname'],
108
+				$_hookValues['account_lastname'], $_hookValues['account_lid'], $this->defaultDomain);
110 109
 
111
-		$account_id = !empty($_hookValues['account_id']) ? $_hookValues['account_id'] :
112
-			$this->accounts->name2id($_hookValues['account_lid'], 'account_lid', 'u');
110
+		$account_id = !empty($_hookValues['account_id']) ? $_hookValues['account_id'] : $this->accounts->name2id($_hookValues['account_lid'], 'account_lid', 'u');
113 111
 
114 112
 		if ($this->accounts->exists($account_id) != 1)
115 113
 		{
@@ -126,7 +124,7 @@  discard block
 block discarded – undo
126 124
 	 */
127 125
 	function deleteAccount($_hookValues)
128 126
 	{
129
-		unset($_hookValues);	// not used, but required by function signature
127
+		unset($_hookValues); // not used, but required by function signature
130 128
 
131 129
 		return true;
132 130
 	}
@@ -139,12 +137,12 @@  discard block
 block discarded – undo
139 137
 	 */
140 138
 	function getAccountEmailAddress($_accountName)
141 139
 	{
142
-		$emailAddresses	= array();
140
+		$emailAddresses = array();
143 141
 
144 142
 		if (($account_id = $this->accounts->name2id($_accountName, 'account_lid', 'u')))
145 143
 		{
146
-			$realName = trim($GLOBALS['egw_info']['user']['account_firstname'] . (!empty($GLOBALS['egw_info']['user']['account_firstname']) ? ' ' : '') . $GLOBALS['egw_info']['user']['account_lastname']);
147
-			$emailAddresses[] = array (
144
+			$realName = trim($GLOBALS['egw_info']['user']['account_firstname'].(!empty($GLOBALS['egw_info']['user']['account_firstname']) ? ' ' : '').$GLOBALS['egw_info']['user']['account_lastname']);
145
+			$emailAddresses[] = array(
148 146
 				'name'		=> $realName,
149 147
 				'address'	=> $this->accounts->id2name($account_id, 'account_email'),
150 148
 				'type'		=> 'default',
@@ -161,9 +159,9 @@  discard block
 block discarded – undo
161 159
 	 * @return array with values for keys 'mailLocalAddress', 'mailAlternateAddress' (array), 'mailForwardingAddress' (array),
162 160
 	 * 	'accountStatus' ("active"), 'quotaLimit' and 'deliveryMode' ("forwardOnly")
163 161
 	 */
164
-	function getUserData($user, $match_uid_at_domain=false)
162
+	function getUserData($user, $match_uid_at_domain = false)
165 163
 	{
166
-		unset($user, $match_uid_at_domain);	// not used, but required by function signature
164
+		unset($user, $match_uid_at_domain); // not used, but required by function signature
167 165
 
168 166
 		$userData = array();
169 167
 
@@ -201,9 +199,9 @@  discard block
 block discarded – undo
201 199
 	 * @return boolean true on success, false on error writing to ldap
202 200
 	 */
203 201
 	function setUserData($_uidnumber, array $_mailAlternateAddress, array $_mailForwardingAddress, $_deliveryMode,
204
-		$_accountStatus, $_mailLocalAddress, $_quota, $_forwarding_only=false, $_setMailbox=null)
202
+		$_accountStatus, $_mailLocalAddress, $_quota, $_forwarding_only = false, $_setMailbox = null)
205 203
 	{
206
-		unset($_uidnumber, $_mailAlternateAddress, $_mailForwardingAddress,	// not used, but require by function signature
204
+		unset($_uidnumber, $_mailAlternateAddress, $_mailForwardingAddress, // not used, but require by function signature
207 205
 			$_deliveryMode, $_accountStatus, $_mailLocalAddress, $_quota, $_forwarding_only, $_setMailbox);
208 206
 
209 207
 		return true;
@@ -217,7 +215,7 @@  discard block
 block discarded – undo
217 215
 	 */
218 216
 	function updateAccount($_hookValues)
219 217
 	{
220
-		unset($_hookValues);	// not used, but required by function signature
218
+		unset($_hookValues); // not used, but required by function signature
221 219
 
222 220
 		return true;
223 221
 	}
@@ -233,15 +231,15 @@  discard block
 block discarded – undo
233 231
 	 * 	default use $this->loginType
234 232
 	 * @return string
235 233
 	 */
236
-	/*static*/ public function mailbox_addr($account,$domain=null,$mail_login_type=null)
234
+	/*static*/ public function mailbox_addr($account, $domain = null, $mail_login_type = null)
237 235
 	{
238 236
 		if (is_null($domain)) $domain = $this->defaultDomain;
239 237
 		if (is_null($mail_login_type)) $mail_login_type = $this->loginType;
240 238
 
241
-		switch($mail_login_type)
239
+		switch ($mail_login_type)
242 240
 		{
243 241
 			case 'email':
244
-				$mbox = is_array($account) ? $account['account_email'] : $GLOBALS['egw']->accounts->id2name($account,'account_email');
242
+				$mbox = is_array($account) ? $account['account_email'] : $GLOBALS['egw']->accounts->id2name($account, 'account_email');
245 243
 				break;
246 244
 
247 245
 			case 'uidNumber':
Please login to merge, or discard this patch.
Braces   +12 added lines, -3 removed lines patch added patch discarded remove patch
@@ -235,8 +235,14 @@  discard block
 block discarded – undo
235 235
 	 */
236 236
 	/*static*/ public function mailbox_addr($account,$domain=null,$mail_login_type=null)
237 237
 	{
238
-		if (is_null($domain)) $domain = $this->defaultDomain;
239
-		if (is_null($mail_login_type)) $mail_login_type = $this->loginType;
238
+		if (is_null($domain))
239
+		{
240
+			$domain = $this->defaultDomain;
241
+		}
242
+		if (is_null($mail_login_type))
243
+		{
244
+			$mail_login_type = $this->loginType;
245
+		}
240 246
 
241 247
 		switch($mail_login_type)
242 248
 		{
@@ -245,7 +251,10 @@  discard block
 block discarded – undo
245 251
 				break;
246 252
 
247 253
 			case 'uidNumber':
248
-				if (is_array($account)) $account = $account['account_id'];
254
+				if (is_array($account))
255
+				{
256
+					$account = $account['account_id'];
257
+				}
249 258
 				$mbox = 'u'.$account.'@'.$domain;
250 259
 				break;
251 260
 
Please login to merge, or discard this patch.
api/src/Mail/Imap.php 3 patches
Switch Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -580,16 +580,16 @@  discard block
 block discarded – undo
580 580
 		$mailbox = '';
581 581
 		if ( is_int( $restriction_search ) ){
582 582
 			switch ( $restriction_search ) {
583
-			case 0:
584
-				$searchstring = $reference."*";
585
-				break;
586
-			case 1:
587
-				$mailbox = $searchstring = $reference;
588
-				//$reference = '%';
589
-				break;
590
-			case 2:
591
-				$searchstring = $reference."%";
592
-				break;
583
+				case 0:
584
+					$searchstring = $reference."*";
585
+					break;
586
+				case 1:
587
+					$mailbox = $searchstring = $reference;
588
+					//$reference = '%';
589
+					break;
590
+				case 2:
591
+					$searchstring = $reference."%";
592
+					break;
593 593
 			}
594 594
 		}else{
595 595
 			if ( is_string( $restriction_search ) ){
@@ -664,16 +664,16 @@  discard block
 block discarded – undo
664 664
 		$mailbox = '';
665 665
 		if ( is_int( $restriction_search ) ){
666 666
 			switch ( $restriction_search ) {
667
-			case 0:
668
-				$searchstring = $reference."*";
669
-				break;
670
-			case 1:
671
-				$mailbox = $searchstring = $reference;
672
-				//$reference = '%';
673
-				break;
674
-			case 2:
675
-				$searchstring = $reference."%";
676
-				break;
667
+				case 0:
668
+					$searchstring = $reference."*";
669
+					break;
670
+				case 1:
671
+					$mailbox = $searchstring = $reference;
672
+					//$reference = '%';
673
+					break;
674
+				case 2:
675
+					$searchstring = $reference."%";
676
+					break;
677 677
 			}
678 678
 		}else{
679 679
 			if ( is_string( $restriction_search ) ){
@@ -730,16 +730,16 @@  discard block
 block discarded – undo
730 730
 
731 731
 		if ( is_int( $restriction_search ) ){
732 732
 			switch ( $restriction_search ) {
733
-			case 0:
734
-				$mailbox = $reference."*";
735
-				break;
736
-			case 1:
737
-				$mailbox = $reference;
738
-				$reference = '%';
739
-				break;
740
-			case 2:
741
-				$mailbox = "%";
742
-				break;
733
+				case 0:
734
+					$mailbox = $reference."*";
735
+					break;
736
+				case 1:
737
+					$mailbox = $reference;
738
+					$reference = '%';
739
+					break;
740
+				case 2:
741
+					$mailbox = "%";
742
+					break;
743 743
 			}
744 744
 		}else{
745 745
 			if ( is_string( $restriction_search ) ){
Please login to merge, or discard this patch.
Spacing   +138 added lines, -138 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	static public $default_params = array(
67 67
 		//'debug' => '/tmp/imap.log', // uncomment to log communitcation with IMAP server
68 68
 		//'debug_literal' => true,    // uncomment to log mail contents returned by IMAP server
69
-		'cache' => true,              // default caching via Cache / Api\Cache
69
+		'cache' => true, // default caching via Cache / Api\Cache
70 70
 	);
71 71
 
72 72
 	/**
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 * @param int $_timeout =null timeout in secs, if none given fmail pref or default of 20 is used
145 145
 	 * @return void
146 146
 	 */
147
-	function __construct(array $params, $_adminConnection=false, $_timeout=null)
147
+	function __construct(array $params, $_adminConnection = false, $_timeout = null)
148 148
 	{
149 149
 		if (function_exists('mb_convert_encoding'))
150 150
 		{
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 		$this->loginType = $this->params['acc_imap_logintype'];
157 157
 		$this->domainName = $this->params['acc_domain'];
158 158
 
159
-		if (is_null($_timeout)) $_timeout = $this->params['acc_imap_timeout']?$this->params['acc_imap_timeout']:self::getTimeOut ();
159
+		if (is_null($_timeout)) $_timeout = $this->params['acc_imap_timeout'] ? $this->params['acc_imap_timeout'] : self::getTimeOut();
160 160
 
161 161
 		// Horde use locale for translation of error messages
162 162
 		// need to set LC_CTYPE for charachter classification (eg. Umlauts)
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 			'port' => $this->params['acc_imap_port'],
178 178
 			'secure' => Account::ssl2secure($this->params['acc_imap_ssl']),
179 179
 			'timeout' => $_timeout,
180
-		)+self::$default_params;
180
+		) + self::$default_params;
181 181
 
182 182
 		if ($parent_params['cache'] === true)
183 183
 		{
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 				// as we have no way to tell this apart we ignore BINARY this affects
205 205
 				// Horde_Imap_Client_Fetch_Query::bodyPart for its fetch parameter decode=true is ignored
206 206
 				// (other functionality depending on BINARY is, of cause, affected too)
207
-				$parent_params['capability_ignore']= array_merge((array)$parent_params['capability_ignore'],array('BINARY'));
207
+				$parent_params['capability_ignore'] = array_merge((array)$parent_params['capability_ignore'], array('BINARY'));
208 208
 				break;
209 209
 		}
210 210
 		parent::__construct($parent_params);
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 	 *
218 218
 	 * @param string $_username =true create an admin connection for given user or $this->acc_imap_username
219 219
 	 */
220
-	function adminConnection($_username=true)
220
+	function adminConnection($_username = true)
221 221
 	{
222 222
 		if ($this->isAdminConnection !== $_username)
223 223
 		{
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 	 * @param string $_username =null create an admin connection for given user or $this->acc_imap_username
235 235
 	 * @throws Horde_IMAP_Client_Exception
236 236
 	 */
237
-	public function checkAdminConnection($_username=true)
237
+	public function checkAdminConnection($_username = true)
238 238
 	{
239 239
 		if ($this->acc_imap_administration)
240 240
 		{
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 	 *
249 249
 	 * @var array
250 250
 	 */
251
-	protected $run_on_login=array();
251
+	protected $run_on_login = array();
252 252
 
253 253
 	/**
254 254
 	 * Run given function on successful login
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 	 * @param callable $func
257 257
 	 * @param array $params =array()
258 258
 	 */
259
-	public function runOnLogin($func, array $params=array())
259
+	public function runOnLogin($func, array $params = array())
260 260
 	{
261 261
 		$this->run_on_login[] = array($func, $params);
262 262
 	}
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 	{
271 271
 		parent::login();
272 272
 
273
-		foreach($this->run_on_login as $key => $data)
273
+		foreach ($this->run_on_login as $key => $data)
274 274
 		{
275 275
 			call_user_func_array($data[0], $data[1]);
276 276
 
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 	 */
287 287
 	public function __get($name)
288 288
 	{
289
-		switch($name)
289
+		switch ($name)
290 290
 		{
291 291
 			case 'acc_imap_administration':
292 292
 				return !empty($this->params['acc_imap_admin_username']);
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 				{
305 305
 					return $this->$name;
306 306
 				}
307
-				if (array_key_exists($name,$this->params))
307
+				if (array_key_exists($name, $this->params))
308 308
 				{
309 309
 					return $this->params[$name];
310 310
 				}
@@ -325,9 +325,9 @@  discard block
 block discarded – undo
325 325
 	 * @deprecated allready called by constructor automatic, parameters must be passed to constructor!
326 326
 	 * @throws Api\Exception\WrongParameter
327 327
 	 */
328
-	function openConnection($_adminConnection=false, $_timeout=null)
328
+	function openConnection($_adminConnection = false, $_timeout = null)
329 329
 	{
330
-		unset($_timeout);	// not used
330
+		unset($_timeout); // not used
331 331
 		if ($_adminConnection !== $this->params['adminConnection'])
332 332
 		{
333 333
 			throw new Api\Exception\WrongParameter('need to set parameters on calling Account->imapServer()!');
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 	 * @param string _use decide if the use is for IMAP or SIEVE, by now only the default differs
341 341
 	 * @return int - timeout (either set or default 20/10)
342 342
 	 */
343
-	static function getTimeOut($_use='IMAP')
343
+	static function getTimeOut($_use = 'IMAP')
344 344
 	{
345 345
 		$timeout = $GLOBALS['egw_info']['user']['preferences']['mail']['connectionTimeout'];
346 346
 		if (empty($timeout) || !($timeout > 0)) $timeout = $_use == 'SIEVE' ? 10 : 20; // this is the default value
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 	 */
366 366
 	function addAccount($_hookValues)
367 367
 	{
368
-		unset($_hookValues);	// not used
368
+		unset($_hookValues); // not used
369 369
 		return true;
370 370
 	}
371 371
 
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 	 */
378 378
 	function updateAccount($_hookValues)
379 379
 	{
380
-		unset($_hookValues);	// not used
380
+		unset($_hookValues); // not used
381 381
 		return true;
382 382
 	}
383 383
 
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 	 */
390 390
 	function deleteAccount($_hookValues)
391 391
 	{
392
-		unset($_hookValues);	// not used
392
+		unset($_hookValues); // not used
393 393
 		return true;
394 394
 	}
395 395
 
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
 	 */
407 407
 	function encodeFolderName($_folderName)
408 408
 	{
409
-		if($this->mbAvailable) {
409
+		if ($this->mbAvailable) {
410 410
 			return mb_convert_encoding($_folderName, "UTF7-IMAP", Api\Translation::charset());
411 411
 		}
412 412
 
@@ -423,17 +423,17 @@  discard block
 block discarded – undo
423 423
 	 */
424 424
 	function getMailbox($mailbox)
425 425
 	{
426
-		$mailboxes = $this->listMailboxes($mailbox,Horde_Imap_Client::MBOX_ALL);
427
-		if (empty($mailboxes)) $mailboxes = $this->listMailboxes($mailbox,Horde_Imap_Client::MBOX_UNSUBSCRIBED);
426
+		$mailboxes = $this->listMailboxes($mailbox, Horde_Imap_Client::MBOX_ALL);
427
+		if (empty($mailboxes)) $mailboxes = $this->listMailboxes($mailbox, Horde_Imap_Client::MBOX_UNSUBSCRIBED);
428 428
 		//error_log(__METHOD__.__LINE__.'->'.$mailbox.'/'.array2string($mailboxes));
429 429
 		$mboxes = new Horde_Imap_Client_Mailbox_List($mailboxes);
430 430
 		//_debug_array($mboxes->count());
431 431
 		foreach ($mboxes->getIterator() as $k =>$box)
432 432
 		{
433 433
 			//error_log(__METHOD__.__LINE__.'->'.$k);
434
-			if ($k!='user' && $k != '' && $k==$mailbox) return $box['mailbox']; //_debug_array(array($k => $client->status($k)));
434
+			if ($k != 'user' && $k != '' && $k == $mailbox) return $box['mailbox']; //_debug_array(array($k => $client->status($k)));
435 435
 		}
436
-		return ($this->mailboxExist($mailbox)?$mailbox:false);
436
+		return ($this->mailboxExist($mailbox) ? $mailbox : false);
437 437
 	}
438 438
 
439 439
 	/**
@@ -449,23 +449,23 @@  discard block
 block discarded – undo
449 449
 			//error_log(__METHOD__.__LINE__.':'.$mailbox);
450 450
 			$currentMailbox = $this->currentMailbox();
451 451
 		}
452
-		catch(\Exception $e)
452
+		catch (\Exception $e)
453 453
 		{
454 454
 			//error_log(__METHOD__.__LINE__.' failed detecting currentMailbox:'.$currentMailbox.':'.$e->getMessage());
455
-			$currentMailbox=null;
455
+			$currentMailbox = null;
456 456
 			unset($e);
457 457
 		}
458 458
 		try
459 459
 		{
460 460
 			//error_log(__METHOD__.__LINE__.':'.$mailbox);
461 461
 			$this->openMailbox($mailbox);
462
-			$returnvalue=true;
462
+			$returnvalue = true;
463 463
 		}
464
-		catch(\Exception $e)
464
+		catch (\Exception $e)
465 465
 		{
466 466
 			//error_log(__METHOD__.__LINE__.' failed opening:'.$mailbox.':'.$e->getMessage().' Called by:'.function_backtrace());
467 467
 			unset($e);
468
-			$returnvalue=false;
468
+			$returnvalue = false;
469 469
 		}
470 470
 		if (!empty($currentMailbox) && $currentMailbox['mailbox'] != $mailbox)
471 471
 		{
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
 				//error_log(__METHOD__.__LINE__.':'.$currentMailbox .'<->'.$mailbox);
475 475
 				$this->openMailbox($currentMailbox['mailbox']);
476 476
 			}
477
-			catch(\Exception $e)
477
+			catch (\Exception $e)
478 478
 			{
479 479
 				//error_log(__METHOD__.__LINE__.' failed reopening:'.$currentMailbox.':'.$e->getMessage());
480 480
 				unset($e);
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
 		{
495 495
 			$mailbox = $this->currentMailbox();
496 496
 		}
497
-		catch(\Exception $e)
497
+		catch (\Exception $e)
498 498
 		{
499 499
 			error_log(__METHOD__.' ('.__LINE__.') failed fetching currentMailbox:'.$e->getMessage());
500 500
 			//throw new egw_exception(__METHOD__.' ('.__LINE__.") failed to ".__METHOD__." :".$e->getMessage());
@@ -512,16 +512,16 @@  discard block
 block discarded – undo
512 512
 	 */
513 513
 	function getSpecialUseFolders()
514 514
 	{
515
-		$mailboxes = $this->getMailboxes('',0,true);
515
+		$mailboxes = $this->getMailboxes('', 0, true);
516 516
 		$suF = array();
517 517
 		foreach ($mailboxes as $box)
518 518
 		{
519
-			if ($box['MAILBOX']!='user' && $box['MAILBOX'] != '')
519
+			if ($box['MAILBOX'] != 'user' && $box['MAILBOX'] != '')
520 520
 			{
521 521
 				//error_log(__METHOD__.__LINE__.$k.'->'.array2string($box));
522
-				if (isset($box['ATTRIBUTES'])&&!empty($box['ATTRIBUTES'])&&
523
-					stripos(strtolower(array2string($box['ATTRIBUTES'])),'\noselect')=== false&&
524
-					stripos(strtolower(array2string($box['ATTRIBUTES'])),'\nonexistent')=== false)
522
+				if (isset($box['ATTRIBUTES']) && !empty($box['ATTRIBUTES']) &&
523
+					stripos(strtolower(array2string($box['ATTRIBUTES'])), '\noselect') === false &&
524
+					stripos(strtolower(array2string($box['ATTRIBUTES'])), '\nonexistent') === false)
525 525
 				{
526 526
 					$suF[$box['MAILBOX']] = $box;
527 527
 				}
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
 			$status = $this->status($mailbox);
544 544
 			foreach ($status as $key => $v)
545 545
 			{
546
-				$_status[strtoupper($key)]=$v;
546
+				$_status[strtoupper($key)] = $v;
547 547
 			}
548 548
 			return $_status;
549 549
 		}
@@ -561,9 +561,9 @@  discard block
 block discarded – undo
561 561
 	 * @param ignoreStatusCache bool ignore the cache used for counters
562 562
 	 * @return array with counters
563 563
 	 */
564
-	function getStatus($mailbox, $ignoreStatusCache=false)
564
+	function getStatus($mailbox, $ignoreStatusCache = false)
565 565
 	{
566
-		$mailboxes = $this->listMailboxes($mailbox,Horde_Imap_Client::MBOX_ALL,array(
566
+		$mailboxes = $this->listMailboxes($mailbox, Horde_Imap_Client::MBOX_ALL, array(
567 567
 				'attributes'=>true,
568 568
 				'children'=>true, //child info
569 569
 				'delimiter'=>true,
@@ -577,16 +577,16 @@  discard block
 block discarded – undo
577 577
 		//error_log(__METHOD__.__LINE__.array2string($mboxes->count()));
578 578
 		foreach ($mboxes->getIterator() as $k =>$box)
579 579
 		{
580
-			if ($k!='user' && $k != '' && $k==$mailbox)
580
+			if ($k != 'user' && $k != '' && $k == $mailbox)
581 581
 			{
582
-				if (stripos(array2string($box['attributes']),'\noselect')=== false)
582
+				if (stripos(array2string($box['attributes']), '\noselect') === false)
583 583
 				{
584 584
 					$status = $this->status($k, $flags);
585 585
 					foreach ($status as $key => $v)
586 586
 					{
587
-						$_status[strtoupper($key)]=$v;
587
+						$_status[strtoupper($key)] = $v;
588 588
 					}
589
-					$_status['HIERACHY_DELIMITER'] = $_status['delimiter'] = ($box['delimiter']?$box['delimiter']:$this->getDelimiter('personal'));
589
+					$_status['HIERACHY_DELIMITER'] = $_status['delimiter'] = ($box['delimiter'] ? $box['delimiter'] : $this->getDelimiter('personal'));
590 590
 					$_status['ATTRIBUTES'] = $box['attributes'];
591 591
 					//error_log(__METHOD__.__LINE__.$k.'->'.array2string($_status));
592 592
 					return $_status;
@@ -612,14 +612,14 @@  discard block
 block discarded – undo
612 612
 	 *
613 613
 	 * @return  mixed   array of mailboxes
614 614
 	 */
615
-	function getMailboxes($reference = ''  , $restriction_search = 0, $returnAttributes = false)
615
+	function getMailboxes($reference = '', $restriction_search = 0, $returnAttributes = false)
616 616
 	{
617
-		if ( is_bool($restriction_search) ){
618
-			$restriction_search = (int) $restriction_search;
617
+		if (is_bool($restriction_search)) {
618
+			$restriction_search = (int)$restriction_search;
619 619
 		}
620 620
 		$mailbox = '';
621
-		if ( is_int( $restriction_search ) ){
622
-			switch ( $restriction_search ) {
621
+		if (is_int($restriction_search)) {
622
+			switch ($restriction_search) {
623 623
 			case 0:
624 624
 				$searchstring = $reference."*";
625 625
 				break;
@@ -631,8 +631,8 @@  discard block
 block discarded – undo
631 631
 				$searchstring = $reference."%";
632 632
 				break;
633 633
 			}
634
-		}else{
635
-			if ( is_string( $restriction_search ) ){
634
+		} else {
635
+			if (is_string($restriction_search)) {
636 636
 				$mailbox = $searchstring = $restriction_search;
637 637
 			}
638 638
 		}
@@ -645,35 +645,35 @@  discard block
 block discarded – undo
645 645
 				'special_use'=>true,
646 646
 				'sort'=>true,
647 647
 			);
648
-		if ($returnAttributes==false)
648
+		if ($returnAttributes == false)
649 649
 		{
650 650
 			unset($options['attributes']);
651 651
 			unset($options['children']);
652 652
 			unset($options['special_use']);
653 653
 		}
654
-		$mailboxes = $this->listMailboxes($searchstring,Horde_Imap_Client::MBOX_ALL, $options);
654
+		$mailboxes = $this->listMailboxes($searchstring, Horde_Imap_Client::MBOX_ALL, $options);
655 655
 		//$mboxes = new Horde_Imap_Client_Mailbox_List($mailboxes);
656 656
 		//_debug_array($mboxes->count());
657 657
 		foreach ((array)$mailboxes as $k =>$box)
658 658
 		{
659 659
 			//error_log(__METHOD__.__LINE__.' Box:'.$k.'->'.array2string($box));
660
-			$ret[$k]=array('MAILBOX'=>$k,'ATTRIBUTES'=>$box['attributes'],'delimiter'=>($box['delimiter']?$box['delimiter']:$this->getDelimiter('personal')),'SUBSCRIBED'=>true);
660
+			$ret[$k] = array('MAILBOX'=>$k, 'ATTRIBUTES'=>$box['attributes'], 'delimiter'=>($box['delimiter'] ? $box['delimiter'] : $this->getDelimiter('personal')), 'SUBSCRIBED'=>true);
661 661
 		}
662 662
 		// for unknown reasons on ALL, UNSUBSCRIBED are not returned
663 663
 		//always fetch unsubscribed, think about only fetching it when $options['attributes'] is set
664 664
 		//but then allMailboxes are not all, ....
665 665
 		//if (!empty($mailbox) && !isset($ret[$mailbox]))
666 666
 		{
667
-			$unsub_mailboxes = $this->listMailboxes($searchstring,Horde_Imap_Client::MBOX_UNSUBSCRIBED, $options);
667
+			$unsub_mailboxes = $this->listMailboxes($searchstring, Horde_Imap_Client::MBOX_UNSUBSCRIBED, $options);
668 668
 			//$mboxes = new Horde_Imap_Client_Mailbox_List($mailboxes);
669 669
 			//_debug_array($mboxes->count());
670 670
 			//error_log(__METHOD__.__LINE__.' '.$mailbox.':'.count((array)$mailboxes).'->'.function_backtrace());
671 671
 			foreach ((array)$unsub_mailboxes as $k =>$box)
672 672
 			{
673 673
 				//error_log(__METHOD__.__LINE__.' Box:'.$k.' already In?'.array_key_exists($k,$boxexists).'->'.array2string($box));
674
-				if(!array_key_exists($k,$ret))
674
+				if (!array_key_exists($k, $ret))
675 675
 				{
676
-					$ret[$k]=array('MAILBOX'=>$k,'ATTRIBUTES'=>$box['attributes'],'delimiter'=>($box['delimiter']?$box['delimiter']:$this->getDelimiter('personal')),'SUBSCRIBED'=>false);
676
+					$ret[$k] = array('MAILBOX'=>$k, 'ATTRIBUTES'=>$box['attributes'], 'delimiter'=>($box['delimiter'] ? $box['delimiter'] : $this->getDelimiter('personal')), 'SUBSCRIBED'=>false);
677 677
 				}
678 678
 				else
679 679
 				{
@@ -696,14 +696,14 @@  discard block
 block discarded – undo
696 696
 	 *
697 697
 	 * @return  mixed   array of mailboxes
698 698
 	 */
699
-	function listSubscribedMailboxes($reference = ''  , $restriction_search = 0, $returnAttributes = false)
699
+	function listSubscribedMailboxes($reference = '', $restriction_search = 0, $returnAttributes = false)
700 700
 	{
701
-		if ( is_bool($restriction_search) ){
702
-			$restriction_search = (int) $restriction_search;
701
+		if (is_bool($restriction_search)) {
702
+			$restriction_search = (int)$restriction_search;
703 703
 		}
704 704
 		$mailbox = '';
705
-		if ( is_int( $restriction_search ) ){
706
-			switch ( $restriction_search ) {
705
+		if (is_int($restriction_search)) {
706
+			switch ($restriction_search) {
707 707
 			case 0:
708 708
 				$searchstring = $reference."*";
709 709
 				break;
@@ -715,8 +715,8 @@  discard block
 block discarded – undo
715 715
 				$searchstring = $reference."%";
716 716
 				break;
717 717
 			}
718
-		}else{
719
-			if ( is_string( $restriction_search ) ){
718
+		} else {
719
+			if (is_string($restriction_search)) {
720 720
 				$mailbox = $searchstring = $restriction_search;
721 721
 			}
722 722
 		}
@@ -728,25 +728,25 @@  discard block
 block discarded – undo
728 728
 				'special_use'=>true,
729 729
 				'sort'=>true,
730 730
 			);
731
-		if ($returnAttributes==false)
731
+		if ($returnAttributes == false)
732 732
 		{
733 733
 			unset($options['attributes']);
734 734
 			unset($options['children']);
735 735
 			unset($options['special_use']);
736 736
 		}
737
-		$mailboxes = $this->listMailboxes($searchstring,Horde_Imap_Client::MBOX_SUBSCRIBED_EXISTS, $options);
737
+		$mailboxes = $this->listMailboxes($searchstring, Horde_Imap_Client::MBOX_SUBSCRIBED_EXISTS, $options);
738 738
 		//$mboxes = new Horde_Imap_Client_Mailbox_List($mailboxes);
739 739
 		//_debug_array($mboxes->count());
740 740
 		foreach ((array)$mailboxes as $k =>$box)
741 741
 		{
742 742
 			//error_log(__METHOD__.__LINE__.' Searched for:'.$mailbox.' got Box:'.$k.'->'.array2string($box).function_backtrace());
743
-			if ($returnAttributes==false)
743
+			if ($returnAttributes == false)
744 744
 			{
745
-				$ret[]=$k;
745
+				$ret[] = $k;
746 746
 			}
747 747
 			else
748 748
 			{
749
-				$ret[$k]=array('MAILBOX'=>$k,'ATTRIBUTES'=>$box['attributes'],'delimiter'=>($box['delimiter']?$box['delimiter']:$this->getDelimiter('personal')),'SUBSCRIBED'=>true);
749
+				$ret[$k] = array('MAILBOX'=>$k, 'ATTRIBUTES'=>$box['attributes'], 'delimiter'=>($box['delimiter'] ? $box['delimiter'] : $this->getDelimiter('personal')), 'SUBSCRIBED'=>true);
750 750
 			}
751 751
 		}
752 752
 		return $ret;
@@ -762,14 +762,14 @@  discard block
 block discarded – undo
762 762
 	 *
763 763
 	 * @return  mixed   array of mailboxes
764 764
 	 */
765
-	function listUnSubscribedMailboxes($reference = ''  , $restriction_search = 0)
765
+	function listUnSubscribedMailboxes($reference = '', $restriction_search = 0)
766 766
 	{
767
-		if ( is_bool($restriction_search) ){
768
-			$restriction_search = (int) $restriction_search;
767
+		if (is_bool($restriction_search)) {
768
+			$restriction_search = (int)$restriction_search;
769 769
 		}
770 770
 
771
-		if ( is_int( $restriction_search ) ){
772
-			switch ( $restriction_search ) {
771
+		if (is_int($restriction_search)) {
772
+			switch ($restriction_search) {
773 773
 			case 0:
774 774
 				$mailbox = $reference."*";
775 775
 				break;
@@ -781,8 +781,8 @@  discard block
 block discarded – undo
781 781
 				$mailbox = "%";
782 782
 				break;
783 783
 			}
784
-		}else{
785
-			if ( is_string( $restriction_search ) ){
784
+		} else {
785
+			if (is_string($restriction_search)) {
786 786
 				$mailbox = $restriction_search;
787 787
 			}
788 788
 		}
@@ -791,17 +791,17 @@  discard block
 block discarded – undo
791 791
 			'sort'=>true,
792 792
 			//'flat'=>true,
793 793
 		);
794
-		$mailboxes = $this->listMailboxes($mailbox,Horde_Imap_Client::MBOX_SUBSCRIBED_EXISTS, $options);
794
+		$mailboxes = $this->listMailboxes($mailbox, Horde_Imap_Client::MBOX_SUBSCRIBED_EXISTS, $options);
795 795
 		foreach ($mailboxes as $box)
796 796
 		{
797 797
 			//error_log(__METHOD__.__LINE__.' Box:'.$k.'->'.array2string($box['mailbox']->utf8));
798
-			$sret[]=$box['mailbox']->utf8;
798
+			$sret[] = $box['mailbox']->utf8;
799 799
 		}
800
-		$unsubscribed = $this->listMailboxes($mailbox,Horde_Imap_Client::MBOX_UNSUBSCRIBED, $options);
800
+		$unsubscribed = $this->listMailboxes($mailbox, Horde_Imap_Client::MBOX_UNSUBSCRIBED, $options);
801 801
 		foreach ($unsubscribed as $box)
802 802
 		{
803 803
 			//error_log(__METHOD__.__LINE__.' Box:'.$k.'->'.array2string($box['mailbox']->utf8));
804
-			if (!in_array($box['mailbox']->utf8,$sret) && $box['mailbox']->utf8!='INBOX') $ret[]=$box['mailbox']->utf8;
804
+			if (!in_array($box['mailbox']->utf8, $sret) && $box['mailbox']->utf8 != 'INBOX') $ret[] = $box['mailbox']->utf8;
805 805
 		}
806 806
 		return $ret;
807 807
 	}
@@ -813,12 +813,12 @@  discard block
 block discarded – undo
813 813
 	 * @param int $flags =null default Horde_Imap_Client::STATUS_ALL | Horde_Imap_Client::STATUS_FLAGS | Horde_Imap_Client::STATUS_PERMFLAGS
814 814
 	 * @return array of counters for mailbox
815 815
 	 */
816
-	function examineMailbox($mailbox, $flags=null)
816
+	function examineMailbox($mailbox, $flags = null)
817 817
 	{
818
-		if ($mailbox=='') return false;
818
+		if ($mailbox == '') return false;
819 819
 		$mailboxes = $this->listMailboxes($mailbox);
820 820
 
821
-		if (is_null($flags)) $flags = Horde_Imap_Client::STATUS_ALL | Horde_Imap_Client::STATUS_FLAGS | Horde_Imap_Client::STATUS_PERMFLAGS;
821
+		if (is_null($flags)) $flags = Horde_Imap_Client::STATUS_ALL|Horde_Imap_Client::STATUS_FLAGS|Horde_Imap_Client::STATUS_PERMFLAGS;
822 822
 
823 823
 		$mboxes = new Horde_Imap_Client_Mailbox_List($mailboxes);
824 824
 		//_debug_array($mboxes->count());
@@ -826,18 +826,18 @@  discard block
 block discarded – undo
826 826
 		{
827 827
 			//error_log(__METHOD__.__LINE__.array2string($box));
828 828
 			unset($box);
829
-			if ($k!='user' && $k != '' && $k==$mailbox)
829
+			if ($k != 'user' && $k != '' && $k == $mailbox)
830 830
 			{
831 831
 				$status = $this->status($k, $flags);
832 832
 				//error_log(__METHOD__.__LINE__.array2string($status));
833 833
 				foreach ($status as $key => $v)
834 834
 				{
835
-					$_status[strtoupper($key)]=$v;
835
+					$_status[strtoupper($key)] = $v;
836 836
 				}
837
-				if ($flags & (Horde_Imap_Client::STATUS_FLAGS|Horde_Imap_Client::STATUS_PERMFLAGS))
837
+				if ($flags&(Horde_Imap_Client::STATUS_FLAGS|Horde_Imap_Client::STATUS_PERMFLAGS))
838 838
 				{
839 839
 					self::$supports_keywords[$this->ImapServerId] = stripos(implode('', $status['flags']), '$label') !== false ||
840
-						in_array('\\*', $status['permflags']);	// arbitrary keyswords also allow keywords
840
+						in_array('\\*', $status['permflags']); // arbitrary keyswords also allow keywords
841 841
 				}
842 842
 				return $_status;
843 843
 			}
@@ -876,7 +876,7 @@  discard block
 block discarded – undo
876 876
 	 */
877 877
 	function hasCapability($capability)
878 878
 	{
879
-		if ($capability=='SUPPORTS_KEYWORDS')
879
+		if ($capability == 'SUPPORTS_KEYWORDS')
880 880
 		{
881 881
 			// if pseudo-flag is not set, call examineMailbox now to set it (no STATUS_ALL = counters necessary)
882 882
 			if (!isset(self::$supports_keywords[$this->ImapServerId]))
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
 				catch (\Exception $e)
889 889
 				{
890 890
 					error_log(__METHOD__.__LINE__.' (examineServer for detection) '.$capability.'->'.array2string(self::$supports_keywords).' failed '.function_backtrace());
891
-					self::$supports_keywords[$this->ImapServerId]=false;
891
+					self::$supports_keywords[$this->ImapServerId] = false;
892 892
 				}
893 893
 			}
894 894
 			//error_log(__METHOD__.__LINE__.' '.$capability.'->'.array2string(self::$supports_keywords).' '.function_backtrace());
@@ -938,9 +938,9 @@  discard block
 block discarded – undo
938 938
 	 */
939 939
 	static function getFolderPrefixFromNamespace($_nameSpace, $_folderName)
940 940
 	{
941
-		foreach($_nameSpace as &$singleNameSpace)
941
+		foreach ($_nameSpace as &$singleNameSpace)
942 942
 		{
943
-			if (substr($_folderName,0,strlen($singleNameSpace['prefix'])) == $singleNameSpace['prefix']) return $singleNameSpace['prefix'];
943
+			if (substr($_folderName, 0, strlen($singleNameSpace['prefix'])) == $singleNameSpace['prefix']) return $singleNameSpace['prefix'];
944 944
 		}
945 945
 		return "";
946 946
 	}
@@ -955,33 +955,33 @@  discard block
 block discarded – undo
955 955
 	 * @param string $reclevel = 0, counter to keep track of the current recursionlevel
956 956
 	 * @return array of mailboxes
957 957
 	 */
958
-	function getMailBoxesRecursive($_mailbox, $delimiter, $prefix, $reclevel=0)
958
+	function getMailBoxesRecursive($_mailbox, $delimiter, $prefix, $reclevel = 0)
959 959
 	{
960 960
 		if ($reclevel > 25) {
961
-			error_log( __METHOD__." Recursion Level Exeeded ($reclevel) while looking up $_mailbox$delimiter ");
961
+			error_log(__METHOD__." Recursion Level Exeeded ($reclevel) while looking up $_mailbox$delimiter ");
962 962
 			return array();
963 963
 		}
964 964
 		$reclevel++;
965 965
 		// clean up double delimiters
966
-		$mailbox = preg_replace('~'.($delimiter == '.' ? "\\".$delimiter:$delimiter).'+~s',$delimiter,$_mailbox);
966
+		$mailbox = preg_replace('~'.($delimiter == '.' ? "\\".$delimiter : $delimiter).'+~s', $delimiter, $_mailbox);
967 967
 		//get that mailbox in question
968
-		$mbx = $this->getMailboxes($mailbox,1,true);
968
+		$mbx = $this->getMailboxes($mailbox, 1, true);
969 969
 		$mbxkeys = array_keys($mbx);
970 970
 
971 971
 		// Example: Array([INBOX/GaGa] => Array([MAILBOX] => INBOX/GaGa[ATTRIBUTES] => Array([0] => \\unmarked)[delimiter] => /))
972
-		if (is_array($mbx[$mbxkeys[0]]["ATTRIBUTES"]) && (in_array('\HasChildren',$mbx[$mbxkeys[0]]["ATTRIBUTES"]) || in_array('\Haschildren',$mbx[$mbxkeys[0]]["ATTRIBUTES"]) || in_array('\haschildren',$mbx[$mbxkeys[0]]["ATTRIBUTES"])))
972
+		if (is_array($mbx[$mbxkeys[0]]["ATTRIBUTES"]) && (in_array('\HasChildren', $mbx[$mbxkeys[0]]["ATTRIBUTES"]) || in_array('\Haschildren', $mbx[$mbxkeys[0]]["ATTRIBUTES"]) || in_array('\haschildren', $mbx[$mbxkeys[0]]["ATTRIBUTES"])))
973 973
 		{
974
-			$buff = $this->getMailboxes($mbx[$mbxkeys[0]]['MAILBOX'].($mbx[$mbxkeys[0]]['MAILBOX'] == $prefix ? '':$delimiter),2,false);
974
+			$buff = $this->getMailboxes($mbx[$mbxkeys[0]]['MAILBOX'].($mbx[$mbxkeys[0]]['MAILBOX'] == $prefix ? '' : $delimiter), 2, false);
975 975
 			$allMailboxes = array();
976 976
 			foreach ($buff as $mbxname) {
977
-				$mbxname = preg_replace('~'.($delimiter == '.' ? "\\".$delimiter:$delimiter).'+~s',$delimiter,$mbxname['MAILBOX']);
977
+				$mbxname = preg_replace('~'.($delimiter == '.' ? "\\".$delimiter : $delimiter).'+~s', $delimiter, $mbxname['MAILBOX']);
978 978
 				#echo "About to recur in level $reclevel:".$mbxname."<br>";
979
-				if ( $mbxname != $mbx[$mbxkeys[0]]['MAILBOX'] && $mbxname != $prefix  && $mbxname != $mbx[$mbxkeys[0]]['MAILBOX'].$delimiter)
979
+				if ($mbxname != $mbx[$mbxkeys[0]]['MAILBOX'] && $mbxname != $prefix && $mbxname != $mbx[$mbxkeys[0]]['MAILBOX'].$delimiter)
980 980
 				{
981 981
 					$allMailboxes = array_merge($allMailboxes, self::getMailBoxesRecursive($mbxname, $delimiter, $prefix, $reclevel));
982 982
 				}
983 983
 			}
984
-			if (!(in_array('\NoSelect',$mbx[$mbxkeys[0]]["ATTRIBUTES"]) || in_array('\Noselect',$mbx[$mbxkeys[0]]["ATTRIBUTES"]) || in_array('\noselect',$mbx[$mbxkeys[0]]["ATTRIBUTES"]))) $allMailboxes[] = $mbx[$mbxkeys[0]]['MAILBOX'];
984
+			if (!(in_array('\NoSelect', $mbx[$mbxkeys[0]]["ATTRIBUTES"]) || in_array('\Noselect', $mbx[$mbxkeys[0]]["ATTRIBUTES"]) || in_array('\noselect', $mbx[$mbxkeys[0]]["ATTRIBUTES"]))) $allMailboxes[] = $mbx[$mbxkeys[0]]['MAILBOX'];
985 985
 			return $allMailboxes;
986 986
 		}
987 987
 		else
@@ -1000,24 +1000,24 @@  discard block
 block discarded – undo
1000 1000
 	 */
1001 1001
 	function getNameSpace()
1002 1002
 	{
1003
-		static $nameSpace=null;
1003
+		static $nameSpace = null;
1004 1004
 		$foldersNameSpace = array();
1005 1005
 		$delimiter = $this->getDelimiter();
1006
-		if (empty($delimiter)) $delimiter='/';
1006
+		if (empty($delimiter)) $delimiter = '/';
1007 1007
 		if (is_null($nameSpace)) $nameSpace = $this->getNameSpaceArray();
1008 1008
 		if (is_array($nameSpace)) {
1009
-			foreach($nameSpace as $type => $singleNameSpaceArray)
1009
+			foreach ($nameSpace as $type => $singleNameSpaceArray)
1010 1010
 			{
1011 1011
 				foreach ($singleNameSpaceArray as $singleNameSpace)
1012 1012
 				{
1013 1013
 					$_foldersNameSpace = array();
1014
-					if($type == 'personal' && $singleNameSpace['name'] == '#mh/' && ($this->folderExists('Mail')||$this->folderExists('INBOX')))
1014
+					if ($type == 'personal' && $singleNameSpace['name'] == '#mh/' && ($this->folderExists('Mail') || $this->folderExists('INBOX')))
1015 1015
 					{
1016 1016
 						$_foldersNameSpace['prefix_present'] = 'forced';
1017 1017
 						// uw-imap server with mailbox prefix or dovecot maybe
1018
-						$_foldersNameSpace['prefix'] = ($this->folderExists('Mail')?'Mail':(!empty($singleNameSpace['name'])?$singleNameSpace['name']:''));
1018
+						$_foldersNameSpace['prefix'] = ($this->folderExists('Mail') ? 'Mail' : (!empty($singleNameSpace['name']) ? $singleNameSpace['name'] : ''));
1019 1019
 					}
1020
-					elseif($type == 'personal' && ($singleNameSpace['name'] == '#mh/') && $this->folderExists('mail'))
1020
+					elseif ($type == 'personal' && ($singleNameSpace['name'] == '#mh/') && $this->folderExists('mail'))
1021 1021
 					{
1022 1022
 						$_foldersNameSpace['prefix_present'] = 'forced';
1023 1023
 						// uw-imap server with mailbox prefix or dovecot maybe
@@ -1026,9 +1026,9 @@  discard block
 block discarded – undo
1026 1026
 						$_foldersNameSpace['prefix_present'] = !empty($singleNameSpace['name']);
1027 1027
 						$_foldersNameSpace['prefix'] = $singleNameSpace['name'];
1028 1028
 					}
1029
-					$_foldersNameSpace['delimiter'] = ($singleNameSpace['delimiter']?$singleNameSpace['delimiter']:$delimiter);
1029
+					$_foldersNameSpace['delimiter'] = ($singleNameSpace['delimiter'] ? $singleNameSpace['delimiter'] : $delimiter);
1030 1030
 					$_foldersNameSpace['type'] = $type;
1031
-					$foldersNameSpace[] =$_foldersNameSpace;
1031
+					$foldersNameSpace[] = $_foldersNameSpace;
1032 1032
 				}
1033 1033
 			}
1034 1034
 		}
@@ -1040,29 +1040,29 @@  discard block
 block discarded – undo
1040 1040
 	 * @param mixed _type (1=personal, 2=user/other, 3=shared)
1041 1041
 	 * @return string the delimimiter
1042 1042
 	 */
1043
-	function getDelimiter($_type=1)
1043
+	function getDelimiter($_type = 1)
1044 1044
 	{
1045 1045
 		switch ($_type)
1046 1046
 		{
1047 1047
 			case 'user':
1048 1048
 			case 'other':
1049 1049
 			case 2:
1050
-				$type=2;
1050
+				$type = 2;
1051 1051
 				break;
1052 1052
 			case 'shared':
1053 1053
 			case '':
1054 1054
 			case 3:
1055
-				$type=3;
1055
+				$type = 3;
1056 1056
 				break;
1057 1057
 			case 'personal':
1058 1058
 			case 1:
1059 1059
 			default:
1060
-				$type=1;
1060
+				$type = 1;
1061 1061
 		}
1062 1062
 		$namespaces = $this->getNamespaces();
1063 1063
 		foreach ($namespaces as $nsp)
1064 1064
 		{
1065
-			if ($nsp['type']==$type && $nsp['delimiter']) return $nsp['delimiter'];
1065
+			if ($nsp['type'] == $type && $nsp['delimiter']) return $nsp['delimiter'];
1066 1066
 		}
1067 1067
 		return "/";
1068 1068
 	}
@@ -1090,7 +1090,7 @@  discard block
 block discarded – undo
1090 1090
 	{
1091 1091
 		if (is_numeric($_username))
1092 1092
 		{
1093
-			$_username = $GLOBALS['egw']->accounts->id2name($accountID=$_username);
1093
+			$_username = $GLOBALS['egw']->accounts->id2name($accountID = $_username);
1094 1094
 		}
1095 1095
 		else
1096 1096
 		{
@@ -1099,7 +1099,7 @@  discard block
 block discarded – undo
1099 1099
 		switch ($this->loginType)
1100 1100
 		{
1101 1101
 			case 'email':
1102
-				$_username = $GLOBALS['egw']->accounts->id2name($accountID,'account_email');
1102
+				$_username = $GLOBALS['egw']->accounts->id2name($accountID, 'account_email');
1103 1103
 				break;
1104 1104
 
1105 1105
 			case 'vmailmgr':
@@ -1114,8 +1114,8 @@  discard block
 block discarded – undo
1114 1114
 				if (empty($this->loginType))
1115 1115
 				{
1116 1116
 					// try to figure out by params['acc_imap_username']
1117
-					list($lusername,$domain) = explode('@',$this->params['acc_imap_username'],2);
1118
-					if (strpos($_username,'@')===false && !empty($domain) && !empty($lusername))
1117
+					list($lusername, $domain) = explode('@', $this->params['acc_imap_username'], 2);
1118
+					if (strpos($_username, '@') === false && !empty($domain) && !empty($lusername))
1119 1119
 					{
1120 1120
 						$_username = $_username.'@'.$domain;
1121 1121
 					}
@@ -1154,20 +1154,20 @@  discard block
 block discarded – undo
1154 1154
 	 * @param string $_folderName=''
1155 1155
 	 * @return string utf-7 encoded (done in getMailboxName)
1156 1156
 	 */
1157
-	function getUserMailboxString($_username, $_folderName='')
1157
+	function getUserMailboxString($_username, $_folderName = '')
1158 1158
 	{
1159 1159
 		$nameSpaces = $this->getNameSpaceArray();
1160 1160
 
1161
-		if(!isset($nameSpaces['others'])) {
1161
+		if (!isset($nameSpaces['others'])) {
1162 1162
 			return false;
1163 1163
 		}
1164 1164
 
1165 1165
 		$username = $this->getMailBoxUserName($_username);
1166
-		if($this->loginType == 'vmailmgr' || $this->loginType == 'uidNumber') {
1167
-			$username .= '@'. $this->domainName;
1166
+		if ($this->loginType == 'vmailmgr' || $this->loginType == 'uidNumber') {
1167
+			$username .= '@'.$this->domainName;
1168 1168
 		}
1169 1169
 
1170
-		$mailboxString = $nameSpaces['others'][0]['name'] . $username . (!empty($_folderName) ? ($nameSpaces['others'][0]['delimiter']?$nameSpaces['others'][0]['delimiter']:'/') . $_folderName : '');
1170
+		$mailboxString = $nameSpaces['others'][0]['name'].$username.(!empty($_folderName) ? ($nameSpaces['others'][0]['delimiter'] ? $nameSpaces['others'][0]['delimiter'] : '/').$_folderName : '');
1171 1171
 
1172 1172
 		return $mailboxString;
1173 1173
 	}
@@ -1186,7 +1186,7 @@  discard block
 block discarded – undo
1186 1186
 		);
1187 1187
 		//error_log(__METHOD__.__LINE__.array2string($types));
1188 1188
 		$result = array();
1189
-		foreach($this->getNamespaces() as $data)
1189
+		foreach ($this->getNamespaces() as $data)
1190 1190
 		{
1191 1191
 			//error_log(__METHOD__.__LINE__.array2string($data));
1192 1192
 			if (isset($types[$data['type']]))
@@ -1196,7 +1196,7 @@  discard block
 block discarded – undo
1196 1196
 					'name' => $data['name'],
1197 1197
 					'prefix' => $data['name'],
1198 1198
 					'prefix_present' => !empty($data['name']),
1199
-					'delimiter' => ($data['delimiter']?$data['delimiter']:'/'),
1199
+					'delimiter' => ($data['delimiter'] ? $data['delimiter'] : '/'),
1200 1200
 				);
1201 1201
 			}
1202 1202
 		}
@@ -1217,7 +1217,7 @@  discard block
 block discarded – undo
1217 1217
 		{
1218 1218
 			if ($qInfo['storage'])
1219 1219
 			{
1220
-				return array('USED'=>$qInfo['storage']['usage'],'QMAX'=>$qInfo['storage']['limit']);
1220
+				return array('USED'=>$qInfo['storage']['usage'], 'QMAX'=>$qInfo['storage']['limit']);
1221 1221
 			}
1222 1222
 		}
1223 1223
 		return false;
@@ -1231,7 +1231,7 @@  discard block
 block discarded – undo
1231 1231
 	 * @param string $_what - what to retrieve either limit/QMAX, usage/USED or ALL is supported
1232 1232
 	 * @return int|array|boolean the quota for specified user (by what) or array with values for "limit" and "usage", or false
1233 1233
 	 */
1234
-	function getQuotaByUser($_username, $_what='QMAX')
1234
+	function getQuotaByUser($_username, $_what = 'QMAX')
1235 1235
 	{
1236 1236
 		$mailboxName = $this->getUserMailboxString($_username);
1237 1237
 		$storageQuota = $this->getQuotaRoot($mailboxName);
@@ -1240,7 +1240,7 @@  discard block
 block discarded – undo
1240 1240
 		if (is_array($storageQuota) && isset($storageQuota[$mailboxName]) && is_array($storageQuota[$mailboxName]) &&
1241 1241
 			isset($storageQuota[$mailboxName]['storage']) && is_array($storageQuota[$mailboxName]['storage']))
1242 1242
 		{
1243
-			switch($_what)
1243
+			switch ($_what)
1244 1244
 			{
1245 1245
 				case 'QMAX':
1246 1246
 					$_what = 'limit';
@@ -1266,7 +1266,7 @@  discard block
 block discarded – undo
1266 1266
 	 */
1267 1267
 	function getUserData($_username)
1268 1268
 	{
1269
-		unset($_username);	// not used
1269
+		unset($_username); // not used
1270 1270
 		return array();
1271 1271
 	}
1272 1272
 
@@ -1279,7 +1279,7 @@  discard block
 block discarded – undo
1279 1279
 	 */
1280 1280
 	function setUserData($_username, $_quota)
1281 1281
 	{
1282
-		unset($_username, $_quota);	// not used
1282
+		unset($_username, $_quota); // not used
1283 1283
 		return true;
1284 1284
 	}
1285 1285
 
@@ -1313,10 +1313,10 @@  discard block
 block discarded – undo
1313 1313
 	 * @param array $params
1314 1314
 	 * @throws Api\Exception\WrongParameter
1315 1315
 	 */
1316
-	public function __call($name,array $params=null)
1316
+	public function __call($name, array $params = null)
1317 1317
 	{
1318 1318
 		if ($this->debug) error_log(__METHOD__.'->'.$name.' with params:'.array2string($params));
1319
-		switch($name)
1319
+		switch ($name)
1320 1320
 		{
1321 1321
 			case 'installScript':
1322 1322
 			case 'getScript':
@@ -1331,9 +1331,9 @@  discard block
 block discarded – undo
1331 1331
 				if (is_null($this->sieve))
1332 1332
 				{
1333 1333
 					$this->sieve = new Sieve($this);
1334
-					$this->error =& $this->sieve->error;
1334
+					$this->error = & $this->sieve->error;
1335 1335
 				}
1336
-				$ret = call_user_func_array(array($this->sieve,$name),$params);
1336
+				$ret = call_user_func_array(array($this->sieve, $name), $params);
1337 1337
 				//error_log(__CLASS__.'->'.$name.'('.array2string($params).') returns '.array2string($ret));
1338 1338
 				return $ret;
1339 1339
 		}
@@ -1348,7 +1348,7 @@  discard block
 block discarded – undo
1348 1348
 	 * @param string $_scriptName =null
1349 1349
 	 * @return boolean
1350 1350
 	 */
1351
-	public function setVacationUser($_euser, array $_vacation, $_scriptName=null)
1351
+	public function setVacationUser($_euser, array $_vacation, $_scriptName = null)
1352 1352
 	{
1353 1353
 		if ($this->debug) error_log(__METHOD__.' User:'.array2string($_euser).' Scriptname:'.array2string($_scriptName).' VacationMessage:'.array2string($_vacation));
1354 1354
 
@@ -1360,8 +1360,8 @@  discard block
 block discarded – undo
1360 1360
 		{
1361 1361
 			$this->adminConnection($_euser);
1362 1362
 			$this->sieve = new Sieve($this, $_euser, $_scriptName);
1363
-			$this->scriptName =& $this->sieve->scriptName;
1364
-			$this->error =& $this->sieve->error;
1363
+			$this->scriptName = & $this->sieve->scriptName;
1364
+			$this->error = & $this->sieve->error;
1365 1365
 		}
1366 1366
 		$ret = $this->setVacation($_vacation, $_scriptName);
1367 1367
 
@@ -1376,7 +1376,7 @@  discard block
 block discarded – undo
1376 1376
 	 * @throws Exception on connection error or authentication failure
1377 1377
 	 * @return array
1378 1378
 	 */
1379
-	public function getVacationUser($_euser, $_scriptName=null)
1379
+	public function getVacationUser($_euser, $_scriptName = null)
1380 1380
 	{
1381 1381
 		if ($this->debug) error_log(__METHOD__.' User:'.array2string($_euser));
1382 1382
 
@@ -1388,8 +1388,8 @@  discard block
 block discarded – undo
1388 1388
 		{
1389 1389
 			$this->adminConnection($_euser);
1390 1390
 			$this->sieve = new Sieve($this, $_euser, $_scriptName);
1391
-			$this->error =& $this->sieve->error;
1392
-			$this->scriptName =& $this->sieve->scriptName;
1391
+			$this->error = & $this->sieve->error;
1392
+			$this->scriptName = & $this->sieve->scriptName;
1393 1393
 		}
1394 1394
 		return $this->sieve->getVacation();
1395 1395
 	}
@@ -1409,7 +1409,7 @@  discard block
 block discarded – undo
1409 1409
 	 */
1410 1410
 	public static function init_static()
1411 1411
 	{
1412
-		self::$supports_keywords =& Api\Cache::getSession (__CLASS__, 'supports_keywords');
1412
+		self::$supports_keywords = & Api\Cache::getSession(__CLASS__, 'supports_keywords');
1413 1413
 	}
1414 1414
 }
1415 1415
 Imap::init_static();
Please login to merge, or discard this patch.
Braces   +130 added lines, -42 removed lines patch added patch discarded remove patch
@@ -156,7 +156,10 @@  discard block
 block discarded – undo
156 156
 		$this->loginType = $this->params['acc_imap_logintype'];
157 157
 		$this->domainName = $this->params['acc_domain'];
158 158
 
159
-		if (is_null($_timeout)) $_timeout = $this->params['acc_imap_timeout']?$this->params['acc_imap_timeout']:self::getTimeOut ();
159
+		if (is_null($_timeout))
160
+		{
161
+			$_timeout = $this->params['acc_imap_timeout']?$this->params['acc_imap_timeout']:self::getTimeOut ();
162
+		}
160 163
 
161 164
 		// Horde use locale for translation of error messages
162 165
 		// need to set LC_CTYPE for charachter classification (eg. Umlauts)
@@ -169,7 +172,10 @@  discard block
 block discarded – undo
169 172
 		{
170 173
 			$username = $this->getMailBoxUserName($username);
171 174
 		}
172
-		if ($_adminConnection) $this->adminConnection($username);
175
+		if ($_adminConnection)
176
+		{
177
+			$this->adminConnection($username);
178
+		}
173 179
 		$parent_params = array(
174 180
 			'username' => $this->params[$_adminConnection ? 'acc_imap_admin_username' : 'acc_imap_username'],
175 181
 			'password' => $this->params[$_adminConnection ? 'acc_imap_admin_password' : 'acc_imap_password'],
@@ -343,7 +349,11 @@  discard block
 block discarded – undo
343 349
 	static function getTimeOut($_use='IMAP')
344 350
 	{
345 351
 		$timeout = $GLOBALS['egw_info']['user']['preferences']['mail']['connectionTimeout'];
346
-		if (empty($timeout) || !($timeout > 0)) $timeout = $_use == 'SIEVE' ? 10 : 20; // this is the default value
352
+		if (empty($timeout) || !($timeout > 0))
353
+		{
354
+			$timeout = $_use == 'SIEVE' ? 10 : 20;
355
+		}
356
+		// this is the default value
347 357
 		return $timeout;
348 358
 	}
349 359
 
@@ -406,7 +416,8 @@  discard block
 block discarded – undo
406 416
 	 */
407 417
 	function encodeFolderName($_folderName)
408 418
 	{
409
-		if($this->mbAvailable) {
419
+		if($this->mbAvailable)
420
+		{
410 421
 			return mb_convert_encoding($_folderName, "UTF7-IMAP", Api\Translation::charset());
411 422
 		}
412 423
 
@@ -424,14 +435,21 @@  discard block
 block discarded – undo
424 435
 	function getMailbox($mailbox)
425 436
 	{
426 437
 		$mailboxes = $this->listMailboxes($mailbox,Horde_Imap_Client::MBOX_ALL);
427
-		if (empty($mailboxes)) $mailboxes = $this->listMailboxes($mailbox,Horde_Imap_Client::MBOX_UNSUBSCRIBED);
438
+		if (empty($mailboxes))
439
+		{
440
+			$mailboxes = $this->listMailboxes($mailbox,Horde_Imap_Client::MBOX_UNSUBSCRIBED);
441
+		}
428 442
 		//error_log(__METHOD__.__LINE__.'->'.$mailbox.'/'.array2string($mailboxes));
429 443
 		$mboxes = new Horde_Imap_Client_Mailbox_List($mailboxes);
430 444
 		//_debug_array($mboxes->count());
431 445
 		foreach ($mboxes->getIterator() as $k =>$box)
432 446
 		{
433 447
 			//error_log(__METHOD__.__LINE__.'->'.$k);
434
-			if ($k!='user' && $k != '' && $k==$mailbox) return $box['mailbox']; //_debug_array(array($k => $client->status($k)));
448
+			if ($k!='user' && $k != '' && $k==$mailbox)
449
+			{
450
+				return $box['mailbox'];
451
+			}
452
+			//_debug_array(array($k => $client->status($k)));
435 453
 		}
436 454
 		return ($this->mailboxExist($mailbox)?$mailbox:false);
437 455
 	}
@@ -500,8 +518,14 @@  discard block
 block discarded – undo
500 518
 			//throw new egw_exception(__METHOD__.' ('.__LINE__.") failed to ".__METHOD__." :".$e->getMessage());
501 519
 			unset($e);
502 520
 		}
503
-		if (!empty($mailbox)) return $mailbox['mailbox'];
504
-		if (empty($mailbox) && $this->mailboxExist('INBOX')) return 'INBOX';
521
+		if (!empty($mailbox))
522
+		{
523
+			return $mailbox['mailbox'];
524
+		}
525
+		if (empty($mailbox) && $this->mailboxExist('INBOX'))
526
+		{
527
+			return 'INBOX';
528
+		}
505 529
 		return null;
506 530
 	}
507 531
 
@@ -571,7 +595,10 @@  discard block
 block discarded – undo
571 595
 			));
572 596
 
573 597
 		$flags = Horde_Imap_Client::STATUS_ALL;
574
-		if ($ignoreStatusCache) $flags |= Horde_Imap_Client::STATUS_FORCE_REFRESH;
598
+		if ($ignoreStatusCache)
599
+		{
600
+			$flags |= Horde_Imap_Client::STATUS_FORCE_REFRESH;
601
+		}
575 602
 
576 603
 		$mboxes = new Horde_Imap_Client_Mailbox_List($mailboxes);
577 604
 		//error_log(__METHOD__.__LINE__.array2string($mboxes->count()));
@@ -614,12 +641,15 @@  discard block
 block discarded – undo
614 641
 	 */
615 642
 	function getMailboxes($reference = ''  , $restriction_search = 0, $returnAttributes = false)
616 643
 	{
617
-		if ( is_bool($restriction_search) ){
644
+		if ( is_bool($restriction_search) )
645
+		{
618 646
 			$restriction_search = (int) $restriction_search;
619 647
 		}
620 648
 		$mailbox = '';
621
-		if ( is_int( $restriction_search ) ){
622
-			switch ( $restriction_search ) {
649
+		if ( is_int( $restriction_search ) )
650
+		{
651
+			switch ( $restriction_search )
652
+			{
623 653
 			case 0:
624 654
 				$searchstring = $reference."*";
625 655
 				break;
@@ -631,8 +661,11 @@  discard block
 block discarded – undo
631 661
 				$searchstring = $reference."%";
632 662
 				break;
633 663
 			}
634
-		}else{
635
-			if ( is_string( $restriction_search ) ){
664
+		}
665
+		else
666
+		{
667
+			if ( is_string( $restriction_search ) )
668
+			{
636 669
 				$mailbox = $searchstring = $restriction_search;
637 670
 			}
638 671
 		}
@@ -698,12 +731,15 @@  discard block
 block discarded – undo
698 731
 	 */
699 732
 	function listSubscribedMailboxes($reference = ''  , $restriction_search = 0, $returnAttributes = false)
700 733
 	{
701
-		if ( is_bool($restriction_search) ){
734
+		if ( is_bool($restriction_search) )
735
+		{
702 736
 			$restriction_search = (int) $restriction_search;
703 737
 		}
704 738
 		$mailbox = '';
705
-		if ( is_int( $restriction_search ) ){
706
-			switch ( $restriction_search ) {
739
+		if ( is_int( $restriction_search ) )
740
+		{
741
+			switch ( $restriction_search )
742
+			{
707 743
 			case 0:
708 744
 				$searchstring = $reference."*";
709 745
 				break;
@@ -715,8 +751,11 @@  discard block
 block discarded – undo
715 751
 				$searchstring = $reference."%";
716 752
 				break;
717 753
 			}
718
-		}else{
719
-			if ( is_string( $restriction_search ) ){
754
+		}
755
+		else
756
+		{
757
+			if ( is_string( $restriction_search ) )
758
+			{
720 759
 				$mailbox = $searchstring = $restriction_search;
721 760
 			}
722 761
 		}
@@ -764,12 +803,15 @@  discard block
 block discarded – undo
764 803
 	 */
765 804
 	function listUnSubscribedMailboxes($reference = ''  , $restriction_search = 0)
766 805
 	{
767
-		if ( is_bool($restriction_search) ){
806
+		if ( is_bool($restriction_search) )
807
+		{
768 808
 			$restriction_search = (int) $restriction_search;
769 809
 		}
770 810
 
771
-		if ( is_int( $restriction_search ) ){
772
-			switch ( $restriction_search ) {
811
+		if ( is_int( $restriction_search ) )
812
+		{
813
+			switch ( $restriction_search )
814
+			{
773 815
 			case 0:
774 816
 				$mailbox = $reference."*";
775 817
 				break;
@@ -781,8 +823,11 @@  discard block
 block discarded – undo
781 823
 				$mailbox = "%";
782 824
 				break;
783 825
 			}
784
-		}else{
785
-			if ( is_string( $restriction_search ) ){
826
+		}
827
+		else
828
+		{
829
+			if ( is_string( $restriction_search ) )
830
+			{
786 831
 				$mailbox = $restriction_search;
787 832
 			}
788 833
 		}
@@ -801,7 +846,10 @@  discard block
 block discarded – undo
801 846
 		foreach ($unsubscribed as $box)
802 847
 		{
803 848
 			//error_log(__METHOD__.__LINE__.' Box:'.$k.'->'.array2string($box['mailbox']->utf8));
804
-			if (!in_array($box['mailbox']->utf8,$sret) && $box['mailbox']->utf8!='INBOX') $ret[]=$box['mailbox']->utf8;
849
+			if (!in_array($box['mailbox']->utf8,$sret) && $box['mailbox']->utf8!='INBOX')
850
+			{
851
+				$ret[]=$box['mailbox']->utf8;
852
+			}
805 853
 		}
806 854
 		return $ret;
807 855
 	}
@@ -815,10 +863,16 @@  discard block
 block discarded – undo
815 863
 	 */
816 864
 	function examineMailbox($mailbox, $flags=null)
817 865
 	{
818
-		if ($mailbox=='') return false;
866
+		if ($mailbox=='')
867
+		{
868
+			return false;
869
+		}
819 870
 		$mailboxes = $this->listMailboxes($mailbox);
820 871
 
821
-		if (is_null($flags)) $flags = Horde_Imap_Client::STATUS_ALL | Horde_Imap_Client::STATUS_FLAGS | Horde_Imap_Client::STATUS_PERMFLAGS;
872
+		if (is_null($flags))
873
+		{
874
+			$flags = Horde_Imap_Client::STATUS_ALL | Horde_Imap_Client::STATUS_FLAGS | Horde_Imap_Client::STATUS_PERMFLAGS;
875
+		}
822 876
 
823 877
 		$mboxes = new Horde_Imap_Client_Mailbox_List($mailboxes);
824 878
 		//_debug_array($mboxes->count());
@@ -900,7 +954,10 @@  discard block
 block discarded – undo
900 954
 		}
901 955
 		catch (\Exception $e)
902 956
 		{
903
-			if ($this->debug) error_log(__METHOD__.__LINE__.' error querying for capability:'.$capability.' ->'.$e->getMessage());
957
+			if ($this->debug)
958
+			{
959
+				error_log(__METHOD__.__LINE__.' error querying for capability:'.$capability.' ->'.$e->getMessage());
960
+			}
904 961
 			return false;
905 962
 		}
906 963
 		if (!is_array($cap))
@@ -940,7 +997,10 @@  discard block
 block discarded – undo
940 997
 	{
941 998
 		foreach($_nameSpace as &$singleNameSpace)
942 999
 		{
943
-			if (substr($_folderName,0,strlen($singleNameSpace['prefix'])) == $singleNameSpace['prefix']) return $singleNameSpace['prefix'];
1000
+			if (substr($_folderName,0,strlen($singleNameSpace['prefix'])) == $singleNameSpace['prefix'])
1001
+			{
1002
+				return $singleNameSpace['prefix'];
1003
+			}
944 1004
 		}
945 1005
 		return "";
946 1006
 	}
@@ -957,7 +1017,8 @@  discard block
 block discarded – undo
957 1017
 	 */
958 1018
 	function getMailBoxesRecursive($_mailbox, $delimiter, $prefix, $reclevel=0)
959 1019
 	{
960
-		if ($reclevel > 25) {
1020
+		if ($reclevel > 25)
1021
+		{
961 1022
 			error_log( __METHOD__." Recursion Level Exeeded ($reclevel) while looking up $_mailbox$delimiter ");
962 1023
 			return array();
963 1024
 		}
@@ -973,7 +1034,8 @@  discard block
 block discarded – undo
973 1034
 		{
974 1035
 			$buff = $this->getMailboxes($mbx[$mbxkeys[0]]['MAILBOX'].($mbx[$mbxkeys[0]]['MAILBOX'] == $prefix ? '':$delimiter),2,false);
975 1036
 			$allMailboxes = array();
976
-			foreach ($buff as $mbxname) {
1037
+			foreach ($buff as $mbxname)
1038
+			{
977 1039
 				$mbxname = preg_replace('~'.($delimiter == '.' ? "\\".$delimiter:$delimiter).'+~s',$delimiter,$mbxname['MAILBOX']);
978 1040
 				#echo "About to recur in level $reclevel:".$mbxname."<br>";
979 1041
 				if ( $mbxname != $mbx[$mbxkeys[0]]['MAILBOX'] && $mbxname != $prefix  && $mbxname != $mbx[$mbxkeys[0]]['MAILBOX'].$delimiter)
@@ -981,7 +1043,10 @@  discard block
 block discarded – undo
981 1043
 					$allMailboxes = array_merge($allMailboxes, self::getMailBoxesRecursive($mbxname, $delimiter, $prefix, $reclevel));
982 1044
 				}
983 1045
 			}
984
-			if (!(in_array('\NoSelect',$mbx[$mbxkeys[0]]["ATTRIBUTES"]) || in_array('\Noselect',$mbx[$mbxkeys[0]]["ATTRIBUTES"]) || in_array('\noselect',$mbx[$mbxkeys[0]]["ATTRIBUTES"]))) $allMailboxes[] = $mbx[$mbxkeys[0]]['MAILBOX'];
1046
+			if (!(in_array('\NoSelect',$mbx[$mbxkeys[0]]["ATTRIBUTES"]) || in_array('\Noselect',$mbx[$mbxkeys[0]]["ATTRIBUTES"]) || in_array('\noselect',$mbx[$mbxkeys[0]]["ATTRIBUTES"])))
1047
+			{
1048
+				$allMailboxes[] = $mbx[$mbxkeys[0]]['MAILBOX'];
1049
+			}
985 1050
 			return $allMailboxes;
986 1051
 		}
987 1052
 		else
@@ -1003,9 +1068,16 @@  discard block
 block discarded – undo
1003 1068
 		static $nameSpace=null;
1004 1069
 		$foldersNameSpace = array();
1005 1070
 		$delimiter = $this->getDelimiter();
1006
-		if (empty($delimiter)) $delimiter='/';
1007
-		if (is_null($nameSpace)) $nameSpace = $this->getNameSpaceArray();
1008
-		if (is_array($nameSpace)) {
1071
+		if (empty($delimiter))
1072
+		{
1073
+			$delimiter='/';
1074
+		}
1075
+		if (is_null($nameSpace))
1076
+		{
1077
+			$nameSpace = $this->getNameSpaceArray();
1078
+		}
1079
+		if (is_array($nameSpace))
1080
+		{
1009 1081
 			foreach($nameSpace as $type => $singleNameSpaceArray)
1010 1082
 			{
1011 1083
 				foreach ($singleNameSpaceArray as $singleNameSpace)
@@ -1022,7 +1094,9 @@  discard block
 block discarded – undo
1022 1094
 						$_foldersNameSpace['prefix_present'] = 'forced';
1023 1095
 						// uw-imap server with mailbox prefix or dovecot maybe
1024 1096
 						$_foldersNameSpace['prefix'] = 'mail';
1025
-					} else {
1097
+					}
1098
+					else
1099
+					{
1026 1100
 						$_foldersNameSpace['prefix_present'] = !empty($singleNameSpace['name']);
1027 1101
 						$_foldersNameSpace['prefix'] = $singleNameSpace['name'];
1028 1102
 					}
@@ -1062,7 +1136,10 @@  discard block
 block discarded – undo
1062 1136
 		$namespaces = $this->getNamespaces();
1063 1137
 		foreach ($namespaces as $nsp)
1064 1138
 		{
1065
-			if ($nsp['type']==$type && $nsp['delimiter']) return $nsp['delimiter'];
1139
+			if ($nsp['type']==$type && $nsp['delimiter'])
1140
+			{
1141
+				return $nsp['delimiter'];
1142
+			}
1066 1143
 		}
1067 1144
 		return "/";
1068 1145
 	}
@@ -1158,12 +1235,14 @@  discard block
 block discarded – undo
1158 1235
 	{
1159 1236
 		$nameSpaces = $this->getNameSpaceArray();
1160 1237
 
1161
-		if(!isset($nameSpaces['others'])) {
1238
+		if(!isset($nameSpaces['others']))
1239
+		{
1162 1240
 			return false;
1163 1241
 		}
1164 1242
 
1165 1243
 		$username = $this->getMailBoxUserName($_username);
1166
-		if($this->loginType == 'vmailmgr' || $this->loginType == 'uidNumber') {
1244
+		if($this->loginType == 'vmailmgr' || $this->loginType == 'uidNumber')
1245
+		{
1167 1246
 			$username .= '@'. $this->domainName;
1168 1247
 		}
1169 1248
 
@@ -1315,7 +1394,10 @@  discard block
 block discarded – undo
1315 1394
 	 */
1316 1395
 	public function __call($name,array $params=null)
1317 1396
 	{
1318
-		if ($this->debug) error_log(__METHOD__.'->'.$name.' with params:'.array2string($params));
1397
+		if ($this->debug)
1398
+		{
1399
+			error_log(__METHOD__.'->'.$name.' with params:'.array2string($params));
1400
+		}
1319 1401
 		switch($name)
1320 1402
 		{
1321 1403
 			case 'installScript':
@@ -1350,7 +1432,10 @@  discard block
 block discarded – undo
1350 1432
 	 */
1351 1433
 	public function setVacationUser($_euser, array $_vacation, $_scriptName=null)
1352 1434
 	{
1353
-		if ($this->debug) error_log(__METHOD__.' User:'.array2string($_euser).' Scriptname:'.array2string($_scriptName).' VacationMessage:'.array2string($_vacation));
1435
+		if ($this->debug)
1436
+		{
1437
+			error_log(__METHOD__.' User:'.array2string($_euser).' Scriptname:'.array2string($_scriptName).' VacationMessage:'.array2string($_vacation));
1438
+		}
1354 1439
 
1355 1440
 		if (is_numeric($_euser))
1356 1441
 		{
@@ -1378,7 +1463,10 @@  discard block
 block discarded – undo
1378 1463
 	 */
1379 1464
 	public function getVacationUser($_euser, $_scriptName=null)
1380 1465
 	{
1381
-		if ($this->debug) error_log(__METHOD__.' User:'.array2string($_euser));
1466
+		if ($this->debug)
1467
+		{
1468
+			error_log(__METHOD__.' User:'.array2string($_euser));
1469
+		}
1382 1470
 
1383 1471
 		if (is_numeric($_euser))
1384 1472
 		{
Please login to merge, or discard this patch.
api/src/Mail/Imap/Cyrus.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
 	function deleteAccount($_hookValues)
63 63
 	{
64 64
 		// some precausion to really delete just _one_ account
65
-		if (strpos($_hookValues['account_lid'],'%') !== false ||
66
-			strpos($_hookValues['account_lid'],'*') !== false)
65
+		if (strpos($_hookValues['account_lid'], '%') !== false ||
66
+			strpos($_hookValues['account_lid'], '*') !== false)
67 67
 		{
68 68
 			return false;
69 69
 		}
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
 	 * @return string $username='%' username containing wildcards, default '%' for all users of a domain
79 79
 	 * @return int|boolean number of deleted mailboxes on success or false on error
80 80
 	 */
81
-	function deleteUsers($username='%')
81
+	function deleteUsers($username = '%')
82 82
 	{
83
-		if(!$this->acc_imap_administration || empty($username))
83
+		if (!$this->acc_imap_administration || empty($username))
84 84
 		{
85 85
 			return false;
86 86
 		}
@@ -94,14 +94,14 @@  discard block
 block discarded – undo
94 94
 			$mboxes = (array)$this->getMailboxes($mailboxName, 1);
95 95
 			//error_log(__METHOD__."('$username') getMailboxes('$reference','$username$restriction') = ".array2string($mboxes));
96 96
 
97
-			foreach(array_keys($mboxes) as $mbox)
97
+			foreach (array_keys($mboxes) as $mbox)
98 98
 			{
99 99
 				// give the admin account the rights to delete this mailbox
100 100
 				$this->setACL($mbox, $this->acc_imap_admin_username, array('rights' => 'aeiklprstwx'));
101 101
 				$this->deleteMailbox($mbox);
102 102
 			}
103 103
 		}
104
-		catch(Horde_Imap_Client_Exception $e) {
104
+		catch (Horde_Imap_Client_Exception $e) {
105 105
 			_egw_log_exception($e);
106 106
 			$this->disconnect();
107 107
 			return false;
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 		if ($_username !== $GLOBALS['egw_info']['user']['account_lid']) $this->adminConnection();
125 125
 		$userData = array();
126 126
 
127
-		if(($quota = $this->getQuotaByUser($_username,'ALL')))
127
+		if (($quota = $this->getQuotaByUser($_username, 'ALL')))
128 128
 		{
129 129
 			$userData['quotaLimit'] = (int)($quota['limit'] / 1024);
130 130
 			$userData['quotaUsed'] = (int)($quota['usage'] / 1024);
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	 */
146 146
 	function setUserData($_username, $_quota)
147 147
 	{
148
-		if(!$this->acc_imap_administration)
148
+		if (!$this->acc_imap_administration)
149 149
 		{
150 150
 			return false;
151 151
 		}
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 
156 156
 		$mailboxName = $this->getUserMailboxString($_username);
157 157
 
158
-		$this->setQuota($mailboxName, array('STORAGE' => (int)$_quota > 0 ? (int)$_quota*1024 : -1));
158
+		$this->setQuota($mailboxName, array('STORAGE' => (int)$_quota > 0 ? (int)$_quota * 1024 : -1));
159 159
 
160 160
 		$this->disconnect();
161 161
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 	 */
170 170
 	function updateAccount($_hookValues)
171 171
 	{
172
-		if(!$this->acc_imap_administration)
172
+		if (!$this->acc_imap_administration)
173 173
 		{
174 174
 			return false;
175 175
 		}
@@ -182,14 +182,14 @@  discard block
 block discarded – undo
182 182
 		// make sure we use the correct username here.
183 183
 		$username = $this->getMailBoxUserName($_hookValues['account_lid']);
184 184
 		$folderInfo = $this->getMailboxes('', $mailboxName, true);
185
-		if(empty($folderInfo))
185
+		if (empty($folderInfo))
186 186
 		{
187 187
 			try {
188 188
 				$this->createMailbox($mailboxName);
189 189
 				$this->setACL($mailboxName, $username, array('rights' => 'aeiklprstwx'));
190 190
 				// create defined folders and subscribe them (have to use user-credentials to subscribe!)
191 191
 				$userimap = null;
192
-				foreach($this->params as $name => $value)
192
+				foreach ($this->params as $name => $value)
193 193
 				{
194 194
 					if (substr($name, 0, 11) == 'acc_folder_' && !empty($value))
195 195
 					{
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 				}
207 207
 				if (isset($userimap)) $userimap->logout();
208 208
 			}
209
-			catch(Horde_Imap_Client_Exception $e) {
209
+			catch (Horde_Imap_Client_Exception $e) {
210 210
 				_egw_log_exception($e);
211 211
 			}
212 212
 		}
@@ -220,9 +220,9 @@  discard block
 block discarded – undo
220 220
 	 * @param array $params
221 221
 	 * @throws Exception
222 222
 	 */
223
-	public function __call($name,array $params=null)
223
+	public function __call($name, array $params = null)
224 224
 	{
225
-		switch($name)
225
+		switch ($name)
226 226
 		{
227 227
 			case 'setRules':	// call setRules with 3. param of true, to enable utf7imap fileinto for Cyrus
228 228
 				$params += array(null, null, true);
Please login to merge, or discard this patch.
Braces   +12 added lines, -3 removed lines patch added patch discarded remove patch
@@ -121,7 +121,10 @@  discard block
 block discarded – undo
121 121
 	function getUserData($_username)
122 122
 	{
123 123
 		// no need to switch to admin-connection for reading quota of current user
124
-		if ($_username !== $GLOBALS['egw_info']['user']['account_lid']) $this->adminConnection();
124
+		if ($_username !== $GLOBALS['egw_info']['user']['account_lid'])
125
+		{
126
+			$this->adminConnection();
127
+		}
125 128
 		$userData = array();
126 129
 
127 130
 		if(($quota = $this->getQuotaByUser($_username,'ALL')))
@@ -131,7 +134,10 @@  discard block
 block discarded – undo
131 134
 		}
132 135
 		//error_log(__LINE__.': '.__METHOD__."('$_username') quota=".array2string($quota).' returning '.array2string($userData));
133 136
 
134
-		if ($_username !== $GLOBALS['egw_info']['user']['account_lid']) $this->disconnect();
137
+		if ($_username !== $GLOBALS['egw_info']['user']['account_lid'])
138
+		{
139
+			$this->disconnect();
140
+		}
135 141
 
136 142
 		return $userData;
137 143
 	}
@@ -204,7 +210,10 @@  discard block
 block discarded – undo
204 210
 						$userimap->subscribeMailbox($value);
205 211
 					}
206 212
 				}
207
-				if (isset($userimap)) $userimap->logout();
213
+				if (isset($userimap))
214
+				{
215
+					$userimap->logout();
216
+				}
208 217
 			}
209 218
 			catch(Horde_Imap_Client_Exception $e) {
210 219
 				_egw_log_exception($e);
Please login to merge, or discard this patch.
api/src/Mail/Imap/Dbmailuser.php 2 patches
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -47,16 +47,16 @@  discard block
 block discarded – undo
47 47
 
48 48
 		$ds = Ldap::factory();
49 49
 
50
-		if(!is_resource($ds)) {
50
+		if (!is_resource($ds)) {
51 51
 			return false;
52 52
 		}
53 53
 
54
-		$filter		= '(&(objectclass=posixaccount)(uid='. $_username .')(dbmailGID='. sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id'])) .'))';
54
+		$filter		= '(&(objectclass=posixaccount)(uid='.$_username.')(dbmailGID='.sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id'])).'))';
55 55
 		$justthese	= array('dn', 'objectclass', 'mailQuota');
56
-		if(($sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese))) {
56
+		if (($sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese))) {
57 57
 
58
-			if(($info = ldap_get_entries($ds, $sri))) {
59
-				if(isset($info[0]['mailquota'][0])) {
58
+			if (($info = ldap_get_entries($ds, $sri))) {
59
+				if (isset($info[0]['mailquota'][0])) {
60 60
 					$userData['quotaLimit'] = $info[0]['mailquota'][0] / 1048576;
61 61
 				}
62 62
 			}
@@ -66,40 +66,40 @@  discard block
 block discarded – undo
66 66
 
67 67
 	function updateAccount($_hookValues)
68 68
 	{
69
-		if(!$uidnumber = (int)$_hookValues['account_id']) {
69
+		if (!$uidnumber = (int)$_hookValues['account_id']) {
70 70
 			return false;
71 71
 		}
72 72
 
73 73
 		$ds = Ldap::factory();
74 74
 
75
-		if(!is_resource($ds)) {
75
+		if (!is_resource($ds)) {
76 76
 			return false;
77 77
 		}
78 78
 
79
-		$filter		= '(&(objectclass=posixaccount)(uidnumber='. $uidnumber .'))';
80
-		$justthese	= array('dn', 'objectclass', 'dbmailUID', 'dbmailGID', 'mail');
79
+		$filter = '(&(objectclass=posixaccount)(uidnumber='.$uidnumber.'))';
80
+		$justthese = array('dn', 'objectclass', 'dbmailUID', 'dbmailGID', 'mail');
81 81
 		$sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese);
82 82
 
83
-		if(($info = ldap_get_entries($ds, $sri))) {
84
-			if((!in_array('dbmailuser',$info[0]['objectclass']) && !in_array('dbmailUser',$info[0]['objectclass'])) && $info[0]['mail']) {
83
+		if (($info = ldap_get_entries($ds, $sri))) {
84
+			if ((!in_array('dbmailuser', $info[0]['objectclass']) && !in_array('dbmailUser', $info[0]['objectclass'])) && $info[0]['mail']) {
85 85
 				$newData['objectclass'] = $info[0]['objectclass'];
86 86
 				unset($newData['objectclass']['count']);
87 87
 				$newData['objectclass'][] = 'dbmailuser';
88 88
 				sort($newData['objectclass']);
89 89
 				$newData['dbmailGID']	= sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
90
-				$newData['dbmailUID']	= (!empty($this->domainName)) ? $_hookValues['account_lid'] .'@'. $this->domainName : $_hookValues['account_lid'];
90
+				$newData['dbmailUID']	= (!empty($this->domainName)) ? $_hookValues['account_lid'].'@'.$this->domainName : $_hookValues['account_lid'];
91 91
 
92
-				if(!ldap_modify($ds, $info[0]['dn'], $newData)) {
92
+				if (!ldap_modify($ds, $info[0]['dn'], $newData)) {
93 93
 					#print ldap_error($ds);
94 94
 				}
95 95
 
96 96
 				return true;
97 97
 			} else {
98 98
 				$newData = array();
99
-				$newData['dbmailUID']	= (!empty($this->domainName)) ? $_hookValues['account_lid'] .'@'. $this->domainName : $_hookValues['account_lid'];
99
+				$newData['dbmailUID']	= (!empty($this->domainName)) ? $_hookValues['account_lid'].'@'.$this->domainName : $_hookValues['account_lid'];
100 100
 				$newData['dbmailGID']	= sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
101 101
 
102
-				if(!ldap_modify($ds, $info[0]['dn'], $newData)) {
102
+				if (!ldap_modify($ds, $info[0]['dn'], $newData)) {
103 103
 					print ldap_error($ds);
104 104
 					_debug_array($newData);
105 105
 					exit;
@@ -115,63 +115,63 @@  discard block
 block discarded – undo
115 115
 	{
116 116
 		$ds = Ldap::factory();
117 117
 
118
-		if(!is_resource($ds)) {
118
+		if (!is_resource($ds)) {
119 119
 			return false;
120 120
 		}
121 121
 
122
-		$filter		= '(&(objectclass=posixaccount)(uid='. $_username .'))';
123
-		$justthese	= array('dn', 'objectclass', 'dbmailGID', 'dbmailUID', 'mail');
122
+		$filter = '(&(objectclass=posixaccount)(uid='.$_username.'))';
123
+		$justthese = array('dn', 'objectclass', 'dbmailGID', 'dbmailUID', 'mail');
124 124
 		$sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese);
125 125
 
126
-		if(($info = ldap_get_entries($ds, $sri))) {
126
+		if (($info = ldap_get_entries($ds, $sri))) {
127 127
 			$validLDAPConfig = false;
128
-			if(in_array('dbmailuser',$info[0]['objectclass']) || in_array('dbmailUser',$info[0]['objectclass'])) {
128
+			if (in_array('dbmailuser', $info[0]['objectclass']) || in_array('dbmailUser', $info[0]['objectclass'])) {
129 129
 				$validLDAPConfig = true;
130 130
 			}
131 131
 
132
-			if(!in_array('dbmailuser',$info[0]['objectclass']) && !in_array('dbmailUser',$info[0]['objectclass']) && $info[0]['mail']) {
132
+			if (!in_array('dbmailuser', $info[0]['objectclass']) && !in_array('dbmailUser', $info[0]['objectclass']) && $info[0]['mail']) {
133 133
 				$newData['objectclass'] = $info[0]['objectclass'];
134 134
 				unset($newData['objectclass']['count']);
135 135
 				$newData['objectclass'][] = 'dbmailUser';
136 136
 				sort($newData['objectclass']);
137 137
 				$newData['dbmailGID']	= sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
138
-				$newData['dbmailUID']	= (!empty($this->domainName)) ? $_username .'@'. $this->domainName : $_username;
138
+				$newData['dbmailUID']	= (!empty($this->domainName)) ? $_username.'@'.$this->domainName : $_username;
139 139
 
140
-				if(ldap_modify($ds, $info[0]['dn'], $newData)) {
140
+				if (ldap_modify($ds, $info[0]['dn'], $newData)) {
141 141
 					$validLDAPConfig = true;
142 142
 				}
143 143
 			} else {
144
-				if ((in_array('dbmailuser',$info[0]['objectclass']) || in_array('dbmailUser',$info[0]['objectclass'])) && !$info[0]['dbmailuid']) {
144
+				if ((in_array('dbmailuser', $info[0]['objectclass']) || in_array('dbmailUser', $info[0]['objectclass'])) && !$info[0]['dbmailuid']) {
145 145
 					$newData = array();
146
-					$newData['dbmailUID']	= (!empty($this->domainName)) ? $_username .'@'. $this->domainName : $_username;
146
+					$newData['dbmailUID'] = (!empty($this->domainName)) ? $_username.'@'.$this->domainName : $_username;
147 147
 
148
-					if(!ldap_modify($ds, $info[0]['dn'], $newData)) {
148
+					if (!ldap_modify($ds, $info[0]['dn'], $newData)) {
149 149
 						#print ldap_error($ds);
150 150
 						#return false;
151 151
 					}
152 152
 				}
153 153
 
154
-				if ((in_array('dbmailuser',$info[0]['objectclass']) || in_array('dbmailUser',$info[0]['objectclass'])) && !$info[0]['dbmailgid']) {
154
+				if ((in_array('dbmailuser', $info[0]['objectclass']) || in_array('dbmailUser', $info[0]['objectclass'])) && !$info[0]['dbmailgid']) {
155 155
 					$newData = array();
156
-					$newData['dbmailGID']	= sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
156
+					$newData['dbmailGID'] = sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
157 157
 
158
-					if(!ldap_modify($ds, $info[0]['dn'], $newData)) {
158
+					if (!ldap_modify($ds, $info[0]['dn'], $newData)) {
159 159
 						#print ldap_error($ds);
160 160
 						#return false;
161 161
 					}
162 162
 				}
163 163
 			}
164 164
 
165
-			if($validLDAPConfig) {
165
+			if ($validLDAPConfig) {
166 166
 				$newData = array();
167 167
 
168
-				if((int)$_quota >= 0) {
168
+				if ((int)$_quota >= 0) {
169 169
 					$newData['mailQuota'] = (int)$_quota * 1048576;
170 170
 				} else {
171 171
 					$newData['mailQuota'] = array();
172 172
 				}
173 173
 
174
-				if(!ldap_modify($ds, $info[0]['dn'], $newData)) {
174
+				if (!ldap_modify($ds, $info[0]['dn'], $newData)) {
175 175
 					#print ldap_error($ds);
176 176
 					return false;
177 177
 				}
Please login to merge, or discard this patch.
Braces   +53 added lines, -25 removed lines patch added patch discarded remove patch
@@ -47,16 +47,20 @@  discard block
 block discarded – undo
47 47
 
48 48
 		$ds = Ldap::factory();
49 49
 
50
-		if(!is_resource($ds)) {
50
+		if(!is_resource($ds))
51
+		{
51 52
 			return false;
52 53
 		}
53 54
 
54 55
 		$filter		= '(&(objectclass=posixaccount)(uid='. $_username .')(dbmailGID='. sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id'])) .'))';
55 56
 		$justthese	= array('dn', 'objectclass', 'mailQuota');
56
-		if(($sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese))) {
57
+		if(($sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese)))
58
+		{
57 59
 
58
-			if(($info = ldap_get_entries($ds, $sri))) {
59
-				if(isset($info[0]['mailquota'][0])) {
60
+			if(($info = ldap_get_entries($ds, $sri)))
61
+			{
62
+				if(isset($info[0]['mailquota'][0]))
63
+				{
60 64
 					$userData['quotaLimit'] = $info[0]['mailquota'][0] / 1048576;
61 65
 				}
62 66
 			}
@@ -66,13 +70,15 @@  discard block
 block discarded – undo
66 70
 
67 71
 	function updateAccount($_hookValues)
68 72
 	{
69
-		if(!$uidnumber = (int)$_hookValues['account_id']) {
73
+		if(!$uidnumber = (int)$_hookValues['account_id'])
74
+		{
70 75
 			return false;
71 76
 		}
72 77
 
73 78
 		$ds = Ldap::factory();
74 79
 
75
-		if(!is_resource($ds)) {
80
+		if(!is_resource($ds))
81
+		{
76 82
 			return false;
77 83
 		}
78 84
 
@@ -80,8 +86,10 @@  discard block
 block discarded – undo
80 86
 		$justthese	= array('dn', 'objectclass', 'dbmailUID', 'dbmailGID', 'mail');
81 87
 		$sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese);
82 88
 
83
-		if(($info = ldap_get_entries($ds, $sri))) {
84
-			if((!in_array('dbmailuser',$info[0]['objectclass']) && !in_array('dbmailUser',$info[0]['objectclass'])) && $info[0]['mail']) {
89
+		if(($info = ldap_get_entries($ds, $sri)))
90
+		{
91
+			if((!in_array('dbmailuser',$info[0]['objectclass']) && !in_array('dbmailUser',$info[0]['objectclass'])) && $info[0]['mail'])
92
+			{
85 93
 				$newData['objectclass'] = $info[0]['objectclass'];
86 94
 				unset($newData['objectclass']['count']);
87 95
 				$newData['objectclass'][] = 'dbmailuser';
@@ -89,17 +97,21 @@  discard block
 block discarded – undo
89 97
 				$newData['dbmailGID']	= sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
90 98
 				$newData['dbmailUID']	= (!empty($this->domainName)) ? $_hookValues['account_lid'] .'@'. $this->domainName : $_hookValues['account_lid'];
91 99
 
92
-				if(!ldap_modify($ds, $info[0]['dn'], $newData)) {
100
+				if(!ldap_modify($ds, $info[0]['dn'], $newData))
101
+				{
93 102
 					#print ldap_error($ds);
94 103
 				}
95 104
 
96 105
 				return true;
97
-			} else {
106
+			}
107
+			else
108
+			{
98 109
 				$newData = array();
99 110
 				$newData['dbmailUID']	= (!empty($this->domainName)) ? $_hookValues['account_lid'] .'@'. $this->domainName : $_hookValues['account_lid'];
100 111
 				$newData['dbmailGID']	= sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
101 112
 
102
-				if(!ldap_modify($ds, $info[0]['dn'], $newData)) {
113
+				if(!ldap_modify($ds, $info[0]['dn'], $newData))
114
+				{
103 115
 					print ldap_error($ds);
104 116
 					_debug_array($newData);
105 117
 					exit;
@@ -115,7 +127,8 @@  discard block
 block discarded – undo
115 127
 	{
116 128
 		$ds = Ldap::factory();
117 129
 
118
-		if(!is_resource($ds)) {
130
+		if(!is_resource($ds))
131
+		{
119 132
 			return false;
120 133
 		}
121 134
 
@@ -123,13 +136,16 @@  discard block
 block discarded – undo
123 136
 		$justthese	= array('dn', 'objectclass', 'dbmailGID', 'dbmailUID', 'mail');
124 137
 		$sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese);
125 138
 
126
-		if(($info = ldap_get_entries($ds, $sri))) {
139
+		if(($info = ldap_get_entries($ds, $sri)))
140
+		{
127 141
 			$validLDAPConfig = false;
128
-			if(in_array('dbmailuser',$info[0]['objectclass']) || in_array('dbmailUser',$info[0]['objectclass'])) {
142
+			if(in_array('dbmailuser',$info[0]['objectclass']) || in_array('dbmailUser',$info[0]['objectclass']))
143
+			{
129 144
 				$validLDAPConfig = true;
130 145
 			}
131 146
 
132
-			if(!in_array('dbmailuser',$info[0]['objectclass']) && !in_array('dbmailUser',$info[0]['objectclass']) && $info[0]['mail']) {
147
+			if(!in_array('dbmailuser',$info[0]['objectclass']) && !in_array('dbmailUser',$info[0]['objectclass']) && $info[0]['mail'])
148
+			{
133 149
 				$newData['objectclass'] = $info[0]['objectclass'];
134 150
 				unset($newData['objectclass']['count']);
135 151
 				$newData['objectclass'][] = 'dbmailUser';
@@ -137,41 +153,53 @@  discard block
 block discarded – undo
137 153
 				$newData['dbmailGID']	= sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
138 154
 				$newData['dbmailUID']	= (!empty($this->domainName)) ? $_username .'@'. $this->domainName : $_username;
139 155
 
140
-				if(ldap_modify($ds, $info[0]['dn'], $newData)) {
156
+				if(ldap_modify($ds, $info[0]['dn'], $newData))
157
+				{
141 158
 					$validLDAPConfig = true;
142 159
 				}
143
-			} else {
144
-				if ((in_array('dbmailuser',$info[0]['objectclass']) || in_array('dbmailUser',$info[0]['objectclass'])) && !$info[0]['dbmailuid']) {
160
+			}
161
+			else
162
+			{
163
+				if ((in_array('dbmailuser',$info[0]['objectclass']) || in_array('dbmailUser',$info[0]['objectclass'])) && !$info[0]['dbmailuid'])
164
+				{
145 165
 					$newData = array();
146 166
 					$newData['dbmailUID']	= (!empty($this->domainName)) ? $_username .'@'. $this->domainName : $_username;
147 167
 
148
-					if(!ldap_modify($ds, $info[0]['dn'], $newData)) {
168
+					if(!ldap_modify($ds, $info[0]['dn'], $newData))
169
+					{
149 170
 						#print ldap_error($ds);
150 171
 						#return false;
151 172
 					}
152 173
 				}
153 174
 
154
-				if ((in_array('dbmailuser',$info[0]['objectclass']) || in_array('dbmailUser',$info[0]['objectclass'])) && !$info[0]['dbmailgid']) {
175
+				if ((in_array('dbmailuser',$info[0]['objectclass']) || in_array('dbmailUser',$info[0]['objectclass'])) && !$info[0]['dbmailgid'])
176
+				{
155 177
 					$newData = array();
156 178
 					$newData['dbmailGID']	= sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
157 179
 
158
-					if(!ldap_modify($ds, $info[0]['dn'], $newData)) {
180
+					if(!ldap_modify($ds, $info[0]['dn'], $newData))
181
+					{
159 182
 						#print ldap_error($ds);
160 183
 						#return false;
161 184
 					}
162 185
 				}
163 186
 			}
164 187
 
165
-			if($validLDAPConfig) {
188
+			if($validLDAPConfig)
189
+			{
166 190
 				$newData = array();
167 191
 
168
-				if((int)$_quota >= 0) {
192
+				if((int)$_quota >= 0)
193
+				{
169 194
 					$newData['mailQuota'] = (int)$_quota * 1048576;
170
-				} else {
195
+				}
196
+				else
197
+				{
171 198
 					$newData['mailQuota'] = array();
172 199
 				}
173 200
 
174
-				if(!ldap_modify($ds, $info[0]['dn'], $newData)) {
201
+				if(!ldap_modify($ds, $info[0]['dn'], $newData))
202
+				{
175 203
 					#print ldap_error($ds);
176 204
 					return false;
177 205
 				}
Please login to merge, or discard this patch.
api/src/Mail/Imap/Dbmailqmailuser.php 2 patches
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -47,16 +47,16 @@  discard block
 block discarded – undo
47 47
 
48 48
 		$ds = Ldap::factory();
49 49
 
50
-		if(!is_resource($ds)) {
50
+		if (!is_resource($ds)) {
51 51
 			return false;
52 52
 		}
53 53
 
54
-		$filter		= '(&(objectclass=posixaccount)(uid='. $_username .')(qmailGID='. sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id'])) .'))';
54
+		$filter		= '(&(objectclass=posixaccount)(uid='.$_username.')(qmailGID='.sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id'])).'))';
55 55
 		$justthese	= array('dn', 'objectclass', 'mailQuota');
56
-		if(($sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese))) {
56
+		if (($sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese))) {
57 57
 
58
-			if(($info = ldap_get_entries($ds, $sri))) {
59
-				if(isset($info[0]['mailquota'][0])) {
58
+			if (($info = ldap_get_entries($ds, $sri))) {
59
+				if (isset($info[0]['mailquota'][0])) {
60 60
 					$userData['quotaLimit'] = $info[0]['mailquota'][0] / 1048576;
61 61
 				}
62 62
 			}
@@ -65,27 +65,27 @@  discard block
 block discarded – undo
65 65
 	}
66 66
 
67 67
 	function updateAccount($_hookValues) {
68
-		if(!$uidnumber = (int)$_hookValues['account_id']) {
68
+		if (!$uidnumber = (int)$_hookValues['account_id']) {
69 69
 			return false;
70 70
 		}
71 71
 
72 72
 		$ds = Ldap::factory();
73 73
 
74
-		if(!is_resource($ds)) {
74
+		if (!is_resource($ds)) {
75 75
 			return false;
76 76
 		}
77 77
 
78
-		$filter		= '(&(objectclass=posixaccount)(uidnumber='. $uidnumber .'))';
79
-		$justthese	= array('dn', 'objectclass', 'qmailUID', 'qmailGID', 'mail');
78
+		$filter = '(&(objectclass=posixaccount)(uidnumber='.$uidnumber.'))';
79
+		$justthese = array('dn', 'objectclass', 'qmailUID', 'qmailGID', 'mail');
80 80
 		$sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese);
81 81
 
82
-		if(($info = ldap_get_entries($ds, $sri))) {
83
-			if(!in_array('qmailuser',$info[0]['objectclass']) && $info[0]['email']) {
82
+		if (($info = ldap_get_entries($ds, $sri))) {
83
+			if (!in_array('qmailuser', $info[0]['objectclass']) && $info[0]['email']) {
84 84
 				$newData['objectclass'] = $info[0]['objectclass'];
85 85
 				unset($newData['objectclass']['count']);
86 86
 				$newData['objectclass'][] = 'qmailuser';
87 87
 				sort($newData['objectclass']);
88
-				$newData['qmailGID']	= sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
88
+				$newData['qmailGID'] = sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
89 89
 				#$newData['qmailUID']	= (!empty($this->domainName)) ? $_username .'@'. $this->domainName : $_username;
90 90
 
91 91
 				ldap_modify($ds, $info[0]['dn'], $newData);
@@ -93,10 +93,10 @@  discard block
 block discarded – undo
93 93
 				return true;
94 94
 			} else {
95 95
 				$newData = array();
96
-				$newData['qmailGID']	= sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
96
+				$newData['qmailGID'] = sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
97 97
 				#$newData['qmailUID']	= (!empty($this->domainName)) ? $_username .'@'. $this->domainName : $_username;
98 98
 
99
-				if(!ldap_modify($ds, $info[0]['dn'], $newData)) {
99
+				if (!ldap_modify($ds, $info[0]['dn'], $newData)) {
100 100
 					#print ldap_error($ds);
101 101
 					#return false;
102 102
 				}
@@ -109,30 +109,30 @@  discard block
 block discarded – undo
109 109
 	function setUserData($_username, $_quota) {
110 110
 		$ds = Ldap::factory();
111 111
 
112
-		if(!is_resource($ds)) {
112
+		if (!is_resource($ds)) {
113 113
 			return false;
114 114
 		}
115 115
 
116
-		$filter		= '(&(objectclass=posixaccount)(uid='. $_username .'))';
117
-		$justthese	= array('dn', 'objectclass', 'qmailGID', 'mail');
116
+		$filter = '(&(objectclass=posixaccount)(uid='.$_username.'))';
117
+		$justthese = array('dn', 'objectclass', 'qmailGID', 'mail');
118 118
 		$sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese);
119 119
 
120
-		if(($info = ldap_get_entries($ds, $sri))) {
120
+		if (($info = ldap_get_entries($ds, $sri))) {
121 121
 			#_debug_array($info);
122
-			if(!in_array('qmailuser',$info[0]['objectclass']) && $info[0]['email']) {
122
+			if (!in_array('qmailuser', $info[0]['objectclass']) && $info[0]['email']) {
123 123
 				$newData['objectclass'] = $info[0]['objectclass'];
124 124
 				unset($newData['objectclass']['count']);
125 125
 				$newData['objectclass'][] = 'qmailuser';
126 126
 				sort($newData['objectclass']);
127
-				$newData['qmailGID']	= sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
127
+				$newData['qmailGID'] = sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
128 128
 
129 129
 				ldap_modify($ds, $info[0]['dn'], $newData);
130 130
 			} else {
131
-				if (in_array('qmailuser',$info[0]['objectclass']) && !$info[0]['qmailgid']) {
131
+				if (in_array('qmailuser', $info[0]['objectclass']) && !$info[0]['qmailgid']) {
132 132
 					$newData = array();
133
-					$newData['qmailGID']	= sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
133
+					$newData['qmailGID'] = sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
134 134
 
135
-					if(!ldap_modify($ds, $info[0]['dn'], $newData)) {
135
+					if (!ldap_modify($ds, $info[0]['dn'], $newData)) {
136 136
 						#print ldap_error($ds);
137 137
 						#return false;
138 138
 					}
@@ -141,13 +141,13 @@  discard block
 block discarded – undo
141 141
 
142 142
 			$newData = array();
143 143
 
144
-			if((int)$_quota >= 0) {
144
+			if ((int)$_quota >= 0) {
145 145
 				$newData['mailQuota'] = (int)$_quota * 1048576;
146 146
 			} else {
147 147
 				$newData['mailQuota'] = array();
148 148
 			}
149 149
 
150
-			if(!ldap_modify($ds, $info[0]['dn'], $newData)) {
150
+			if (!ldap_modify($ds, $info[0]['dn'], $newData)) {
151 151
 				#print ldap_error($ds);
152 152
 				return false;
153 153
 			}
Please login to merge, or discard this patch.
Braces   +45 added lines, -21 removed lines patch added patch discarded remove patch
@@ -47,16 +47,20 @@  discard block
 block discarded – undo
47 47
 
48 48
 		$ds = Ldap::factory();
49 49
 
50
-		if(!is_resource($ds)) {
50
+		if(!is_resource($ds))
51
+		{
51 52
 			return false;
52 53
 		}
53 54
 
54 55
 		$filter		= '(&(objectclass=posixaccount)(uid='. $_username .')(qmailGID='. sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id'])) .'))';
55 56
 		$justthese	= array('dn', 'objectclass', 'mailQuota');
56
-		if(($sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese))) {
57
+		if(($sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese)))
58
+		{
57 59
 
58
-			if(($info = ldap_get_entries($ds, $sri))) {
59
-				if(isset($info[0]['mailquota'][0])) {
60
+			if(($info = ldap_get_entries($ds, $sri)))
61
+			{
62
+				if(isset($info[0]['mailquota'][0]))
63
+				{
60 64
 					$userData['quotaLimit'] = $info[0]['mailquota'][0] / 1048576;
61 65
 				}
62 66
 			}
@@ -64,14 +68,17 @@  discard block
 block discarded – undo
64 68
 		return $userData;
65 69
 	}
66 70
 
67
-	function updateAccount($_hookValues) {
68
-		if(!$uidnumber = (int)$_hookValues['account_id']) {
71
+	function updateAccount($_hookValues)
72
+	{
73
+		if(!$uidnumber = (int)$_hookValues['account_id'])
74
+		{
69 75
 			return false;
70 76
 		}
71 77
 
72 78
 		$ds = Ldap::factory();
73 79
 
74
-		if(!is_resource($ds)) {
80
+		if(!is_resource($ds))
81
+		{
75 82
 			return false;
76 83
 		}
77 84
 
@@ -79,8 +86,10 @@  discard block
 block discarded – undo
79 86
 		$justthese	= array('dn', 'objectclass', 'qmailUID', 'qmailGID', 'mail');
80 87
 		$sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese);
81 88
 
82
-		if(($info = ldap_get_entries($ds, $sri))) {
83
-			if(!in_array('qmailuser',$info[0]['objectclass']) && $info[0]['email']) {
89
+		if(($info = ldap_get_entries($ds, $sri)))
90
+		{
91
+			if(!in_array('qmailuser',$info[0]['objectclass']) && $info[0]['email'])
92
+			{
84 93
 				$newData['objectclass'] = $info[0]['objectclass'];
85 94
 				unset($newData['objectclass']['count']);
86 95
 				$newData['objectclass'][] = 'qmailuser';
@@ -91,12 +100,15 @@  discard block
 block discarded – undo
91 100
 				ldap_modify($ds, $info[0]['dn'], $newData);
92 101
 
93 102
 				return true;
94
-			} else {
103
+			}
104
+			else
105
+			{
95 106
 				$newData = array();
96 107
 				$newData['qmailGID']	= sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
97 108
 				#$newData['qmailUID']	= (!empty($this->domainName)) ? $_username .'@'. $this->domainName : $_username;
98 109
 
99
-				if(!ldap_modify($ds, $info[0]['dn'], $newData)) {
110
+				if(!ldap_modify($ds, $info[0]['dn'], $newData))
111
+				{
100 112
 					#print ldap_error($ds);
101 113
 					#return false;
102 114
 				}
@@ -106,10 +118,12 @@  discard block
 block discarded – undo
106 118
 		return false;
107 119
 	}
108 120
 
109
-	function setUserData($_username, $_quota) {
121
+	function setUserData($_username, $_quota)
122
+	{
110 123
 		$ds = Ldap::factory();
111 124
 
112
-		if(!is_resource($ds)) {
125
+		if(!is_resource($ds))
126
+		{
113 127
 			return false;
114 128
 		}
115 129
 
@@ -117,9 +131,11 @@  discard block
 block discarded – undo
117 131
 		$justthese	= array('dn', 'objectclass', 'qmailGID', 'mail');
118 132
 		$sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese);
119 133
 
120
-		if(($info = ldap_get_entries($ds, $sri))) {
134
+		if(($info = ldap_get_entries($ds, $sri)))
135
+		{
121 136
 			#_debug_array($info);
122
-			if(!in_array('qmailuser',$info[0]['objectclass']) && $info[0]['email']) {
137
+			if(!in_array('qmailuser',$info[0]['objectclass']) && $info[0]['email'])
138
+			{
123 139
 				$newData['objectclass'] = $info[0]['objectclass'];
124 140
 				unset($newData['objectclass']['count']);
125 141
 				$newData['objectclass'][] = 'qmailuser';
@@ -127,12 +143,16 @@  discard block
 block discarded – undo
127 143
 				$newData['qmailGID']	= sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
128 144
 
129 145
 				ldap_modify($ds, $info[0]['dn'], $newData);
130
-			} else {
131
-				if (in_array('qmailuser',$info[0]['objectclass']) && !$info[0]['qmailgid']) {
146
+			}
147
+			else
148
+			{
149
+				if (in_array('qmailuser',$info[0]['objectclass']) && !$info[0]['qmailgid'])
150
+				{
132 151
 					$newData = array();
133 152
 					$newData['qmailGID']	= sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
134 153
 
135
-					if(!ldap_modify($ds, $info[0]['dn'], $newData)) {
154
+					if(!ldap_modify($ds, $info[0]['dn'], $newData))
155
+					{
136 156
 						#print ldap_error($ds);
137 157
 						#return false;
138 158
 					}
@@ -141,13 +161,17 @@  discard block
 block discarded – undo
141 161
 
142 162
 			$newData = array();
143 163
 
144
-			if((int)$_quota >= 0) {
164
+			if((int)$_quota >= 0)
165
+			{
145 166
 				$newData['mailQuota'] = (int)$_quota * 1048576;
146
-			} else {
167
+			}
168
+			else
169
+			{
147 170
 				$newData['mailQuota'] = array();
148 171
 			}
149 172
 
150
-			if(!ldap_modify($ds, $info[0]['dn'], $newData)) {
173
+			if(!ldap_modify($ds, $info[0]['dn'], $newData))
174
+			{
151 175
 				#print ldap_error($ds);
152 176
 				return false;
153 177
 			}
Please login to merge, or discard this patch.
api/src/Mail/Imap/Dovecot.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	 *
57 57
 	 * @var string
58 58
 	 */
59
-	var $user_home;	// = '/var/dovecot/imap/%d/%u';
59
+	var $user_home; // = '/var/dovecot/imap/%d/%u';
60 60
 
61 61
 	/**
62 62
 	 * Ensure we use an admin connection
@@ -65,12 +65,12 @@  discard block
 block discarded – undo
65 65
 	 *
66 66
 	 * @param string $_username =true create an admin connection for given user or $this->acc_imap_username
67 67
 	 */
68
-	function adminConnection($_username=true)
68
+	function adminConnection($_username = true)
69 69
 	{
70 70
 		// generate admin user name of $username
71 71
 		if (($pos = strpos($this->acc_imap_admin_username, '*')) !== false)	// remove evtl. set username
72 72
 		{
73
-			$this->params['acc_imap_admin_username'] = substr($this->acc_imap_admin_username, $pos+1);
73
+			$this->params['acc_imap_admin_username'] = substr($this->acc_imap_admin_username, $pos + 1);
74 74
 		}
75 75
 		$this->params['acc_imap_admin_username'] = (is_string($_username) ? $_username : $this->acc_imap_username).
76 76
 			'*'.$this->acc_imap_admin_username;
@@ -87,16 +87,16 @@  discard block
 block discarded – undo
87 87
 	 * @param string $_folderName =''
88 88
 	 * @return string utf-7 encoded (done in getMailboxName)
89 89
 	 */
90
-	function getUserMailboxString($_username, $_folderName='')
90
+	function getUserMailboxString($_username, $_folderName = '')
91 91
 	{
92
-		unset($_username);	// not used, but required by function signature
92
+		unset($_username); // not used, but required by function signature
93 93
 
94 94
 		$mailboxString = 'INBOX';
95 95
 
96 96
 		if (!empty($_folderName))
97 97
 		{
98 98
 			$nameSpaces = $this->getNameSpaceArray();
99
-			$mailboxString .= $nameSpaces['others'][0]['delimiter'] . $_folderName;
99
+			$mailboxString .= $nameSpaces['others'][0]['delimiter'].$_folderName;
100 100
 		}
101 101
 		return $mailboxString;
102 102
 	}
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
 	function deleteAccount($_hookValues)
120 120
 	{
121 121
 		// some precausion to really delete just _one_ account
122
-		if (strpos($_hookValues['account_lid'],'%') !== false ||
123
-			strpos($_hookValues['account_lid'],'*') !== false)
122
+		if (strpos($_hookValues['account_lid'], '%') !== false ||
123
+			strpos($_hookValues['account_lid'], '*') !== false)
124 124
 		{
125 125
 			return false;
126 126
 		}
@@ -135,9 +135,9 @@  discard block
 block discarded – undo
135 135
 	 * @return string $username='%' username containing wildcards, default '%' for all users of a domain
136 136
 	 * @return int|boolean number of deleted mailboxes on success or false on error
137 137
 	 */
138
-	function deleteUsers($username='%')
138
+	function deleteUsers($username = '%')
139 139
 	{
140
-		if(!$this->acc_imap_administration || empty($username))
140
+		if (!$this->acc_imap_administration || empty($username))
141 141
 		{
142 142
 			return false;
143 143
 		}
@@ -155,9 +155,9 @@  discard block
 block discarded – undo
155 155
 			{
156 156
 				throw new Api\Exception\AssertionFailed("user_home='$this->user_home' contains no domain-part '%d'!");
157 157
 			}
158
-			$home = strtr(substr($this->user_home, 0, $pos+2), $replace);
158
+			$home = strtr(substr($this->user_home, 0, $pos + 2), $replace);
159 159
 
160
-			$ret = count(scandir($home))-2;
160
+			$ret = count(scandir($home)) - 2;
161 161
 		}
162 162
 		else
163 163
 		{
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 	{
184 184
 		if (is_dir($path))
185 185
 		{
186
-			foreach(scandir($path) as $file)
186
+			foreach (scandir($path) as $file)
187 187
 			{
188 188
 				if ($file == '.' || $file == '..') continue;
189 189
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 				return false;
202 202
 			}
203 203
 		}
204
-		elseif(!unlink($path))
204
+		elseif (!unlink($path))
205 205
 		{
206 206
 			return false;
207 207
 		}
@@ -235,10 +235,10 @@  discard block
 block discarded – undo
235 235
 
236 236
 		$userData = array();
237 237
 		// we are authenticated with master but for current user
238
-		if(($quota = $this->getStorageQuotaRoot('INBOX')))
238
+		if (($quota = $this->getStorageQuotaRoot('INBOX')))
239 239
 		{
240
-			$userData['quotaLimit'] = (int) ($quota['QMAX'] / 1024);
241
-			$userData['quotaUsed'] = (int) ($quota['USED'] / 1024);
240
+			$userData['quotaLimit'] = (int)($quota['QMAX'] / 1024);
241
+			$userData['quotaUsed'] = (int)($quota['USED'] / 1024);
242 242
 		}
243 243
 		$this->username = $bufferUsername;
244 244
 		$this->loginName = $bufferLoginName;
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 	 */
261 261
 	function setUserData($_username, $_quota)
262 262
 	{
263
-		unset($_username); unset($_quota);	// not used, but required by function signature
263
+		unset($_username); unset($_quota); // not used, but required by function signature
264 264
 
265 265
 		return true;
266 266
 	}
@@ -272,9 +272,9 @@  discard block
 block discarded – undo
272 272
 	 */
273 273
 	function updateAccount($_hookValues)
274 274
 	{
275
-		unset($_hookValues);	// not used, but required by function signature
275
+		unset($_hookValues); // not used, but required by function signature
276 276
 
277
-		if(!$this->acc_imap_administration)
277
+		if (!$this->acc_imap_administration)
278 278
 		{
279 279
 			return false;
280 280
 		}
Please login to merge, or discard this patch.
Braces   +16 added lines, -4 removed lines patch added patch discarded remove patch
@@ -68,10 +68,13 @@  discard block
 block discarded – undo
68 68
 	function adminConnection($_username=true)
69 69
 	{
70 70
 		// generate admin user name of $username
71
-		if (($pos = strpos($this->acc_imap_admin_username, '*')) !== false)	// remove evtl. set username
71
+		if (($pos = strpos($this->acc_imap_admin_username, '*')) !== false)
72
+		{
73
+			// remove evtl. set username
72 74
 		{
73 75
 			$this->params['acc_imap_admin_username'] = substr($this->acc_imap_admin_username, $pos+1);
74 76
 		}
77
+		}
75 78
 		$this->params['acc_imap_admin_username'] = (is_string($_username) ? $_username : $this->acc_imap_username).
76 79
 			'*'.$this->acc_imap_admin_username;
77 80
 
@@ -185,7 +188,10 @@  discard block
 block discarded – undo
185 188
 		{
186 189
 			foreach(scandir($path) as $file)
187 190
 			{
188
-				if ($file == '.' || $file == '..') continue;
191
+				if ($file == '.' || $file == '..')
192
+				{
193
+					continue;
194
+				}
189 195
 
190 196
 				if (is_dir($path))
191 197
 				{
@@ -217,8 +223,14 @@  discard block
 block discarded – undo
217 223
 	 */
218 224
 	function getUserData($_username)
219 225
 	{
220
-		if (isset($this->username)) $bufferUsername = $this->username;
221
-		if (isset($this->loginName)) $bufferLoginName = $this->loginName;
226
+		if (isset($this->username))
227
+		{
228
+			$bufferUsername = $this->username;
229
+		}
230
+		if (isset($this->loginName))
231
+		{
232
+			$bufferLoginName = $this->loginName;
233
+		}
222 234
 		$this->username = $this->loginName = $_username;
223 235
 
224 236
 		// now disconnect to be able to reestablish the connection with the targetUser while we go on
Please login to merge, or discard this patch.
api/src/Mail/Imap/Iface.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -14,9 +14,9 @@  discard block
 block discarded – undo
14 14
 namespace EGroupware\Api\Mail\Imap;
15 15
 
16 16
 define('IMAP_NAMESPACE_PERSONAL', 'personal');
17
-define('IMAP_NAMESPACE_OTHERS'	, 'others');
18
-define('IMAP_NAMESPACE_SHARED'	, 'shared');
19
-define('IMAP_NAMESPACE_ALL'	, 'all');
17
+define('IMAP_NAMESPACE_OTHERS', 'others');
18
+define('IMAP_NAMESPACE_SHARED', 'shared');
19
+define('IMAP_NAMESPACE_ALL', 'all');
20 20
 
21 21
 /**
22 22
  * This class holds all information about the imap connection.
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 * @param string $_folderName=''
88 88
 	 * @return string utf-7 encoded (done in getMailboxName)
89 89
 	 */
90
-	function getUserMailboxString($_username, $_folderName='');
90
+	function getUserMailboxString($_username, $_folderName = '');
91 91
 
92 92
 	/**
93 93
 	 * get list of namespaces
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	 * @param string $_what - what to retrieve either QMAX, USED or ALL is supported
104 104
 	 * @return mixed the quota for specified user (by what) or array with all available Quota Information, or false
105 105
 	 */
106
-	function getQuotaByUser($_username, $_what='QMAX');
106
+	function getQuotaByUser($_username, $_what = 'QMAX');
107 107
 
108 108
 	/**
109 109
 	 * returns information about a user
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	 * @param int $_timeout =null timeout in secs, if none given fmail pref or default of 20 is used
123 123
 	 * @throws Exception on error
124 124
 	 */
125
-	function openConnection($_adminConnection=false, $_timeout=null);
125
+	function openConnection($_adminConnection = false, $_timeout = null);
126 126
 
127 127
 	/**
128 128
 	 * set userdata
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 	 * @param string $_scriptName =null
150 150
 	 * @return boolean
151 151
 	 */
152
-	public function setVacationUser($_euser, array $_vacation, $_scriptName=null);
152
+	public function setVacationUser($_euser, array $_vacation, $_scriptName = null);
153 153
 
154 154
 	/**
155 155
 	 * Get vacation message for given user
@@ -159,5 +159,5 @@  discard block
 block discarded – undo
159 159
 	 * @throws Exception on connection error or authentication failure
160 160
 	 * @return array
161 161
 	 */
162
-	public function getVacationUser($_euser, $_scriptName=null);
162
+	public function getVacationUser($_euser, $_scriptName = null);
163 163
 }
Please login to merge, or discard this patch.