Test Setup Failed
Push — master ( 12c298...4a14e0 )
by Ralf
22:03
created
api/src/Auth/Pam.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -30,9 +30,9 @@  discard block
 block discarded – undo
30 30
 	 * @param string $passwd_type ='text' 'text' for cleartext passwords (default)
31 31
 	 * @return boolean true if successful authenticated, false otherwise
32 32
 	 */
33
-	function authenticate($username, $passwd, $passwd_type='text')
33
+	function authenticate($username, $passwd, $passwd_type = 'text')
34 34
 	{
35
-		unset($passwd_type);	// not used but required by interface
35
+		unset($passwd_type); // not used but required by interface
36 36
 
37 37
 		if (pam_auth($username, get_magic_quotes_gpc() ? stripslashes($passwd) : $passwd))
38 38
 		{
@@ -40,12 +40,12 @@  discard block
 block discarded – undo
40 40
 			if (!$GLOBALS['egw']->accounts->name2id($username) &&
41 41
 				function_exists('posix_getpwnam') && ($data = posix_getpwnam($username)))
42 42
 			{
43
-				list($fullname) = explode(',',$data['gecos']);
44
-				$parts = explode(' ',$fullname);
43
+				list($fullname) = explode(',', $data['gecos']);
44
+				$parts = explode(' ', $fullname);
45 45
 				if (count($parts) > 1)
46 46
 				{
47 47
 					$lastname = array_pop($parts);
48
-					$firstname = implode(' ',$parts);
48
+					$firstname = implode(' ', $parts);
49 49
 					$email = Api\Accounts::email($firstname, $lastname, $username);
50 50
 
51 51
 					$GLOBALS['auto_create_acct'] = array(
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
 	 * @param int $account_id =0 account id of user whose passwd should be changed
70 70
 	 * @return boolean true if password successful changed, false otherwise
71 71
 	 */
72
-	function change_password($old_passwd, $new_passwd, $account_id=0)
72
+	function change_password($old_passwd, $new_passwd, $account_id = 0)
73 73
 	{
74
-		unset($old_passwd, $new_passwd, $account_id);	// not used but required by interface
74
+		unset($old_passwd, $new_passwd, $account_id); // not used but required by interface
75 75
 
76 76
 		// deny password changes.
77 77
 		return False;
Please login to merge, or discard this patch.
api/src/Auth/Mail.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -34,14 +34,14 @@  discard block
 block discarded – undo
34 34
 	 * @param string $passwd_type ='text' 'text' for cleartext passwords (default)
35 35
 	 * @return boolean true if successful authenticated, false otherwise
36 36
 	 */
37
-	function authenticate($username, $passwd, $passwd_type='text')
37
+	function authenticate($username, $passwd, $passwd_type = 'text')
38 38
 	{
39
-		unset($passwd_type);	// not used but required by function signature
39
+		unset($passwd_type); // not used but required by function signature
40 40
 
41 41
 		switch ($GLOBALS['egw_info']['server']['mail_login_type'])
42 42
 		{
43 43
 			case 'vmailmgr':
44
-				$username = $username . '@' . $GLOBALS['egw_info']['server']['mail_suffix'];
44
+				$username = $username.'@'.$GLOBALS['egw_info']['server']['mail_suffix'];
45 45
 				break;
46 46
 			case 'email':
47 47
 				$username = $GLOBALS['egw']->accounts->id2name($username, 'account_email');
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 				$mailauth = true;
69 69
 				$imap->logout();
70 70
 			}
71
-			catch(Horde_Imap_Client_Exception $e) {
71
+			catch (Horde_Imap_Client_Exception $e) {
72 72
 				// throw everything but authentication failed as exception
73 73
 				if ($e->getCode() != Horde_Imap_Client_Exception::LOGIN_AUTHENTICATIONFAILED) throw $e;
74 74
 
@@ -85,19 +85,19 @@  discard block
 block discarded – undo
85 85
 				case 'imap':
86 86
 				default:
87 87
 					if (!isset($port)) $port = 143;
88
-					$mailauth = imap_open('{'.$host.':'.$port.'/imap/novalidate-cert}INBOX', $username , $passwd);
88
+					$mailauth = imap_open('{'.$host.':'.$port.'/imap/novalidate-cert}INBOX', $username, $passwd);
89 89
 					break;
90 90
 				case 'imaps':
91 91
 					if (!isset($port)) $port = 993;
92
-					$mailauth = imap_open('{'.$host.'/imap/ssl/novalidate-cert:'.$port.'}INBOX', $username , $passwd);
92
+					$mailauth = imap_open('{'.$host.'/imap/ssl/novalidate-cert:'.$port.'}INBOX', $username, $passwd);
93 93
 					break;
94 94
 				case 'pop3':
95 95
 					if (!isset($port)) $port = 110;
96
-					$mailauth = imap_open('{'.$host.'/pop3/novalidate-cert:'.$port.'}INBOX', $username , $passwd);
96
+					$mailauth = imap_open('{'.$host.'/pop3/novalidate-cert:'.$port.'}INBOX', $username, $passwd);
97 97
 					break;
98 98
 				case 'pop3s':
99 99
 					if (!isset($port)) $port = 995;
100
-					$mailauth = imap_open('{'.$host.'/pop3/ssl/novalidate-cert:'.$port.'}INBOX', $username , $passwd);
100
+					$mailauth = imap_open('{'.$host.'/pop3/ssl/novalidate-cert:'.$port.'}INBOX', $username, $passwd);
101 101
 					break;
102 102
 			}
103 103
 			if ($mailauth) imap_close($mailauth);
@@ -113,9 +113,9 @@  discard block
 block discarded – undo
113 113
 	 * @param int $account_id =0 account id of user whose passwd should be changed
114 114
 	 * @return boolean true if password successful changed, false otherwise
115 115
 	 */
116
-	function change_password($old_passwd, $new_passwd, $account_id=0)
116
+	function change_password($old_passwd, $new_passwd, $account_id = 0)
117 117
 	{
118
-		unset($old_passwd, $new_passwd, $account_id);	// not used but required by function sigature
118
+		unset($old_passwd, $new_passwd, $account_id); // not used but required by function sigature
119 119
 
120 120
 		return False;
121 121
 	}
Please login to merge, or discard this patch.
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 1 patch
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.
api/src/Mail/Smtp.php 1 patch
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.
api/src/Mail/Imap/Cyrus.php 1 patch
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.
api/src/Mail/Imap/Dbmailuser.php 1 patch
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.
api/src/Mail/Imap/Dbmailqmailuser.php 1 patch
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.
api/src/Mail/Imap/Dovecot.php 1 patch
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.