Passed
Push — 17.1 ( 431f3f...4dae72 )
by Ralf
01:23 queued 12s
created
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/Cache.php 4 patches
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -29,15 +29,15 @@  discard block
 block discarded – undo
29 29
 	 */
30 30
 	const LEVEL = Api\Cache::INSTANCE;
31 31
 
32
-    /**
33
-     * Retrieve cached data.
34
-     *
35
-     * @param string $key        Object ID to query.
36
-     * @param integer $lifetime  Lifetime of the object in seconds.
37
-     *
38
-     * @return mixed  Cached data, or false if none was found.
39
-     */
40
-    public function get($key, $lifetime = 0)
32
+	/**
33
+	 * Retrieve cached data.
34
+	 *
35
+	 * @param string $key        Object ID to query.
36
+	 * @param integer $lifetime  Lifetime of the object in seconds.
37
+	 *
38
+	 * @return mixed  Cached data, or false if none was found.
39
+	 */
40
+	public function get($key, $lifetime = 0)
41 41
 	{
42 42
 		unset($lifetime);	// not (yet) used, but required by function signature
43 43
 
@@ -46,54 +46,54 @@  discard block
 block discarded – undo
46 46
 		return !is_null($ret) ? $ret : false;
47 47
 	}
48 48
 
49
-    /**
50
-     * Store an object in the cache.
51
-     *
52
-     * @param string $key        Object ID used as the caching key.
53
-     * @param mixed $data        Data to store in the cache.
54
-     * @param integer $lifetime  Object lifetime - i.e. the time before the
55
-     *                           data becomes available for garbage
56
-     *                           collection. If 0 will not be GC'd.
57
-     */
58
-    public function set($key, $data, $lifetime = 0)
49
+	/**
50
+	 * Store an object in the cache.
51
+	 *
52
+	 * @param string $key        Object ID used as the caching key.
53
+	 * @param mixed $data        Data to store in the cache.
54
+	 * @param integer $lifetime  Object lifetime - i.e. the time before the
55
+	 *                           data becomes available for garbage
56
+	 *                           collection. If 0 will not be GC'd.
57
+	 */
58
+	public function set($key, $data, $lifetime = 0)
59 59
 	{
60 60
 		Api\Cache::setCache(self::LEVEL, 'mail', $key, $data, $lifetime);
61 61
 	}
62 62
 
63
-    /**
64
-     * Checks if a given key exists in the cache, valid for the given
65
-     * lifetime.
66
-     *
67
-     * @param string $key        Cache key to check.
68
-     * @param integer $lifetime  Lifetime of the key in seconds.
69
-     *
70
-     * @return boolean  Existence.
71
-     */
72
-    public function exists($key, $lifetime = 0)
63
+	/**
64
+	 * Checks if a given key exists in the cache, valid for the given
65
+	 * lifetime.
66
+	 *
67
+	 * @param string $key        Cache key to check.
68
+	 * @param integer $lifetime  Lifetime of the key in seconds.
69
+	 *
70
+	 * @return boolean  Existence.
71
+	 */
72
+	public function exists($key, $lifetime = 0)
73 73
 	{
74 74
 		unset($lifetime);	// not (yet) used, but required by function signature
75 75
 
76 76
 		return !is_null(Api\Cache::getCache(self::LEVEL, 'mail', $key));
77 77
 	}
78 78
 
79
-    /**
80
-     * Expire any existing data for the given key.
81
-     *
82
-     * @param string $key  Cache key to expire.
83
-     *
84
-     * @return boolean  Success or failure.
85
-     */
86
-    public function expire($key)
79
+	/**
80
+	 * Expire any existing data for the given key.
81
+	 *
82
+	 * @param string $key  Cache key to expire.
83
+	 *
84
+	 * @return boolean  Success or failure.
85
+	 */
86
+	public function expire($key)
87 87
 	{
88 88
 		Api\Cache::unsetCache(self::LEVEL, 'mail', $key);
89 89
 	}
90 90
 
91
-    /**
92
-     * Clears all data from the cache.
93
-     *
94
-     * @throws Horde_Cache_Exception
95
-     */
96
-    public function clear()
91
+	/**
92
+	 * Clears all data from the cache.
93
+	 *
94
+	 * @throws Horde_Cache_Exception
95
+	 */
96
+	public function clear()
97 97
 	{
98 98
 		Api\Cache::flush(self::LEVEL, self::APP);
99 99
 	}
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
      */
40 40
     public function get($key, $lifetime = 0)
41 41
 	{
42
-		unset($lifetime);	// not (yet) used, but required by function signature
42
+		unset($lifetime); // not (yet) used, but required by function signature
43 43
 
44 44
 		$ret = Api\Cache::getCache(self::LEVEL, 'mail', $key);
45 45
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
      */
72 72
     public function exists($key, $lifetime = 0)
73 73
 	{
74
-		unset($lifetime);	// not (yet) used, but required by function signature
74
+		unset($lifetime); // not (yet) used, but required by function signature
75 75
 
76 76
 		return !is_null(Api\Cache::getCache(self::LEVEL, 'mail', $key));
77 77
 	}
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@
 block discarded – undo
81 81
      *
82 82
      * @param string $key  Cache key to expire.
83 83
      *
84
-     * @return boolean  Success or failure.
84
+     * @return boolean|null  Success or failure.
85 85
      */
86 86
     public function expire($key)
87 87
 	{
Please login to merge, or discard this patch.
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      * @return mixed  Cached data, or false if none was found.
39 39
      */
40 40
     public function get($key, $lifetime = 0)
41
-	{
41
+    {
42 42
 		unset($lifetime);	// not (yet) used, but required by function signature
43 43
 
44 44
 		$ret = Api\Cache::getCache(self::LEVEL, 'mail', $key);
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      *                           collection. If 0 will not be GC'd.
57 57
      */
58 58
     public function set($key, $data, $lifetime = 0)
59
-	{
59
+    {
60 60
 		Api\Cache::setCache(self::LEVEL, 'mail', $key, $data, $lifetime);
61 61
 	}
62 62
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
      * @return boolean  Existence.
71 71
      */
72 72
     public function exists($key, $lifetime = 0)
73
-	{
73
+    {
74 74
 		unset($lifetime);	// not (yet) used, but required by function signature
75 75
 
76 76
 		return !is_null(Api\Cache::getCache(self::LEVEL, 'mail', $key));
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
      * @return boolean  Success or failure.
85 85
      */
86 86
     public function expire($key)
87
-	{
87
+    {
88 88
 		Api\Cache::unsetCache(self::LEVEL, 'mail', $key);
89 89
 	}
90 90
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
      * @throws Horde_Cache_Exception
95 95
      */
96 96
     public function clear()
97
-	{
97
+    {
98 98
 		Api\Cache::flush(self::LEVEL, self::APP);
99 99
 	}
100 100
 }
Please login to merge, or discard this patch.
api/src/Mail/Smtp/Ads.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 */
134 134
 	protected function getLdapConnection()
135 135
 	{
136
-		static $ldap=null;
136
+		static $ldap = null;
137 137
 
138 138
 		if (is_null($ldap))
139 139
 		{
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	 *
152 152
 	 * @param string $defaultDomain =null
153 153
 	 */
154
-	function __construct($defaultDomain=null)
154
+	function __construct($defaultDomain = null)
155 155
 	{
156 156
 		parent::__construct($defaultDomain);
157 157
 
Please login to merge, or discard this patch.
api/src/Mail/Smtp/Oldqmailuser.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
 	/**
46 46
 	 * Primary mail address required as an alias too: true or false
47 47
 	 */
48
-	const REQUIRE_MAIL_AS_ALIAS=false;
48
+	const REQUIRE_MAIL_AS_ALIAS = false;
49 49
 
50 50
 	/**
51 51
 	 * Attribute for forwards OR false if not possible
Please login to merge, or discard this patch.
api/src/Mail/Smtp/Univention.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	/**
51 51
 	 * Primary mail address required as an alias too: true or false
52 52
 	 */
53
-	const REQUIRE_MAIL_AS_ALIAS=false;
53
+	const REQUIRE_MAIL_AS_ALIAS = false;
54 54
 
55 55
 	/**
56 56
 	 * Attribute for forwards OR false if not possible
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	function addAccountExtra(array $_hookValues, array $allValues, array &$newData)
97 97
 	{
98
-		unset($_hookValues);	// not used, but required by function signature
98
+		unset($_hookValues); // not used, but required by function signature
99 99
 
100 100
 		if (empty($allValues['univentionmailhomeserver'][0]) && $newData[self::MAIL_ENABLE_ATTR])
101 101
 		{
Please login to merge, or discard this patch.
api/src/Mail/Smtp/Sql.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 *
64 64
 	 * @param string $defaultDomain =null
65 65
 	 */
66
-	function __construct($defaultDomain=null)
66
+	function __construct($defaultDomain = null)
67 67
 	{
68 68
 		parent::__construct($defaultDomain);
69 69
 
@@ -78,16 +78,16 @@  discard block
 block discarded – undo
78 78
 	 */
79 79
 	function getAccountEmailAddress($_accountName)
80 80
 	{
81
-		$emailAddresses	= parent::getAccountEmailAddress($_accountName);
81
+		$emailAddresses = parent::getAccountEmailAddress($_accountName);
82 82
 
83 83
 		if (($account_id = $this->accounts->name2id($_accountName, 'account_lid', 'u')))
84 84
 		{
85
-			foreach($this->db->select(self::TABLE, 'mail_value', array(
85
+			foreach ($this->db->select(self::TABLE, 'mail_value', array(
86 86
 				'account_id' => $account_id,
87 87
 				'mail_type' => self::TYPE_ALIAS,
88 88
 			), __LINE__, __FILE__, false, 'ORDER BY mail_value', self::APP) as $row)
89 89
 			{
90
-				$emailAddresses[] = array (
90
+				$emailAddresses[] = array(
91 91
 					'name'		=> $emailAddresses[0]['name'],
92 92
 					'address'	=> $row['mail_value'],
93 93
 					'type'		=> 'alternate',
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 * @return array with values for keys 'mailLocalAddress', 'mailAlternateAddress' (array), 'mailForwardingAddress' (array),
112 112
 	 * 	'accountStatus' ("active"), 'quotaLimit' and 'deliveryMode' ("forwardOnly")
113 113
 	 */
114
-	function getUserData($user, $match_uid_at_domain=false)
114
+	function getUserData($user, $match_uid_at_domain = false)
115 115
 	{
116 116
 		$userData = array();
117 117
 
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 			{
141 141
 				$account_id[] = $id;
142 142
 			}
143
-			foreach($this->db->select(self::TABLE, 'account_id', array(
143
+			foreach ($this->db->select(self::TABLE, 'account_id', array(
144 144
 				'mail_type' => self::TYPE_ALIAS,
145 145
 				'mail_value' => $user,
146 146
 			), __LINE__, __FILE__, false, '', self::APP) as $row)
@@ -156,11 +156,11 @@  discard block
 block discarded – undo
156 156
 				$userData['mailLocalAddress'] = $this->accounts->id2name($account_id, 'account_email');
157 157
 			}
158 158
 			$enabled = $forwardOnly = array();
159
-			foreach($this->db->select(self::TABLE, '*', array(
159
+			foreach ($this->db->select(self::TABLE, '*', array(
160 160
 				'account_id' => $account_id,
161 161
 			), __LINE__, __FILE__, false, 'ORDER BY mail_type,mail_value', self::APP) as $row)
162 162
 			{
163
-				switch($row['mail_type'])
163
+				switch ($row['mail_type'])
164 164
 				{
165 165
 					case self::TYPE_ENABLED:
166 166
 						$userData['accountStatus'] = $row['mail_value'];
@@ -203,11 +203,11 @@  discard block
 block discarded – undo
203 203
 			if (is_array($account_id))
204 204
 			{
205 205
 				// add group-members for groups as forward (that way we dont need to store&update them)
206
-				foreach($account_id as $id)
206
+				foreach ($account_id as $id)
207 207
 				{
208 208
 					if ($id < 0 && ($members = $this->accounts->members($id, true)))
209 209
 					{
210
-						foreach($members as $member)
210
+						foreach ($members as $member)
211 211
 						{
212 212
 							if (($email = $this->accounts->id2name($member, 'account_email')) && !in_array($email, (array)$userData['forward']))
213 213
 							{
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 	 * @return boolean true on success, false on error writing to ldap
239 239
 	 */
240 240
 	function setUserData($_uidnumber, array $_mailAlternateAddress, array $_mailForwardingAddress, $_deliveryMode,
241
-		$_accountStatus, $_mailLocalAddress, $_quota, $_forwarding_only=false, $_setMailbox=null)
241
+		$_accountStatus, $_mailLocalAddress, $_quota, $_forwarding_only = false, $_setMailbox = null)
242 242
 	{
243 243
 		if ($this->debug) error_log(__METHOD__."($_uidnumber, ".array2string($_mailAlternateAddress).', '.array2string($_mailForwardingAddress).", '$_deliveryMode', '$_accountStatus', '$_mailLocalAddress', $_quota, forwarding_only=".array2string($_forwarding_only).') '.function_backtrace());
244 244
 
@@ -257,22 +257,22 @@  discard block
 block discarded – undo
257 257
 		if ($_forwarding_only) $where['mail_type'] = array(self::TYPE_FORWARD, self::TYPE_DELIVERY);
258 258
 		// find all invalid values: either delete or update them
259 259
 		$delete_ids = array();
260
-		foreach($this->db->select(self::TABLE, '*', $where, __LINE__, __FILE__, false, '', self::APP) as $row)
260
+		foreach ($this->db->select(self::TABLE, '*', $where, __LINE__, __FILE__, false, '', self::APP) as $row)
261 261
 		{
262
-			switch($row['mail_type'])
262
+			switch ($row['mail_type'])
263 263
 			{
264 264
 				case self::TYPE_ALIAS:
265
-					$new_addresses =& $_mailAlternateAddress;
265
+					$new_addresses = & $_mailAlternateAddress;
266 266
 					// fall-throught
267 267
 				case self::TYPE_FORWARD:
268
-					if ($row['mail_type'] == self::TYPE_FORWARD) $new_addresses =& $_mailForwardingAddress;
268
+					if ($row['mail_type'] == self::TYPE_FORWARD) $new_addresses = & $_mailForwardingAddress;
269 269
 					if (($key = array_search($row['mail_value'], $new_addresses)) === false)
270 270
 					{
271 271
 						$delete_ids[] = $row['mail_id'];
272 272
 					}
273 273
 					else
274 274
 					{
275
-						unset($new_addresses[$key]);	// no need to store
275
+						unset($new_addresses[$key]); // no need to store
276 276
 					}
277 277
 					break;
278 278
 
@@ -322,14 +322,14 @@  discard block
 block discarded – undo
322 322
 			));
323 323
 		}
324 324
 		// store all new values
325
-		foreach($flags+array(
325
+		foreach ($flags + array(
326 326
 			self::TYPE_ALIAS => $_mailAlternateAddress,
327 327
 			self::TYPE_FORWARD => $_mailForwardingAddress,
328 328
 		) as $type => $values)
329 329
 		{
330 330
 			if ($values && (!$_forwarding_only || in_array($type, array(self::TYPE_FORWARD, self::TYPE_DELIVERY))))
331 331
 			{
332
-				foreach((array)$values as $value)
332
+				foreach ((array)$values as $value)
333 333
 				{
334 334
 					$this->db->insert(self::TABLE, array(
335 335
 						'account_id' => $_uidnumber,
@@ -363,11 +363,11 @@  discard block
 block discarded – undo
363 363
 			$join .= ' JOIN '.self::TABLE.' active ON active.account_id='.self::TABLE.'.account_id AND active.mail_type='.self::TYPE_ENABLED;
364 364
 		}
365 365
 		$mailboxes = array();
366
-		foreach($this->db->select(self::TABLE, 'account_lid AS uid,'.self::TABLE.'.mail_value AS mailbox',
366
+		foreach ($this->db->select(self::TABLE, 'account_lid AS uid,'.self::TABLE.'.mail_value AS mailbox',
367 367
 			self::TABLE.'.mail_type='.self::TYPE_MAILBOX,
368 368
 			__LINE__, __FILE__, false, 'ORDER BY account_lid', self::APP, 0, $join) as $row)
369 369
 		{
370
-			if ($row['uid'] == 'anonymous') continue;	// anonymous is never a mail-user!
370
+			if ($row['uid'] == 'anonymous') continue; // anonymous is never a mail-user!
371 371
 			list($mailbox) = explode('@', $row['mailbox']);
372 372
 			$mailboxes[$row['uid']] = $mailbox;
373 373
 		}
Please login to merge, or discard this patch.
Braces   +29 added lines, -7 removed lines patch added patch discarded remove patch
@@ -94,7 +94,10 @@  discard block
 block discarded – undo
94 94
 				);
95 95
 			}
96 96
 		}
97
-		if ($this->debug) error_log(__METHOD__."('$_accountName') returning ".array2string($emailAddresses));
97
+		if ($this->debug)
98
+		{
99
+			error_log(__METHOD__."('$_accountName') returning ".array2string($emailAddresses));
100
+		}
98 101
 
99 102
 		return $emailAddresses;
100 103
 	}
@@ -145,7 +148,10 @@  discard block
 block discarded – undo
145 148
 				'mail_value' => $user,
146 149
 			), __LINE__, __FILE__, false, '', self::APP) as $row)
147 150
 			{
148
-				if (!in_array($row['account_id'], $account_id)) $account_id[] = $row['account_id'];
151
+				if (!in_array($row['account_id'], $account_id))
152
+				{
153
+					$account_id[] = $row['account_id'];
154
+				}
149 155
 			}
150 156
 			//error_log(__METHOD__."('$user') account_id=".array2string($account_id));
151 157
 		}
@@ -218,7 +224,10 @@  discard block
 block discarded – undo
218 224
 				}
219 225
 			}
220 226
 		}
221
-		if ($this->debug) error_log(__METHOD__."('$user') returning ".array2string($userData));
227
+		if ($this->debug)
228
+		{
229
+			error_log(__METHOD__."('$user') returning ".array2string($userData));
230
+		}
222 231
 
223 232
 		return $userData;
224 233
 	}
@@ -240,7 +249,10 @@  discard block
 block discarded – undo
240 249
 	function setUserData($_uidnumber, array $_mailAlternateAddress, array $_mailForwardingAddress, $_deliveryMode,
241 250
 		$_accountStatus, $_mailLocalAddress, $_quota, $_forwarding_only=false, $_setMailbox=null)
242 251
 	{
243
-		if ($this->debug) error_log(__METHOD__."($_uidnumber, ".array2string($_mailAlternateAddress).', '.array2string($_mailForwardingAddress).", '$_deliveryMode', '$_accountStatus', '$_mailLocalAddress', $_quota, forwarding_only=".array2string($_forwarding_only).') '.function_backtrace());
252
+		if ($this->debug)
253
+		{
254
+			error_log(__METHOD__."($_uidnumber, ".array2string($_mailAlternateAddress).', '.array2string($_mailForwardingAddress).", '$_deliveryMode', '$_accountStatus', '$_mailLocalAddress', $_quota, forwarding_only=".array2string($_forwarding_only).') '.function_backtrace());
255
+		}
244 256
 
245 257
 		if (!$_forwarding_only && $this->accounts->id2name($_uidnumber, 'account_email') !== $_mailLocalAddress)
246 258
 		{
@@ -254,7 +266,10 @@  discard block
 block discarded – undo
254 266
 			self::TYPE_QUOTA => $_quota,
255 267
 		);
256 268
 		$where = array('account_id' => $_uidnumber);
257
-		if ($_forwarding_only) $where['mail_type'] = array(self::TYPE_FORWARD, self::TYPE_DELIVERY);
269
+		if ($_forwarding_only)
270
+		{
271
+			$where['mail_type'] = array(self::TYPE_FORWARD, self::TYPE_DELIVERY);
272
+		}
258 273
 		// find all invalid values: either delete or update them
259 274
 		$delete_ids = array();
260 275
 		foreach($this->db->select(self::TABLE, '*', $where, __LINE__, __FILE__, false, '', self::APP) as $row)
@@ -265,7 +280,10 @@  discard block
 block discarded – undo
265 280
 					$new_addresses =& $_mailAlternateAddress;
266 281
 					// fall-throught
267 282
 				case self::TYPE_FORWARD:
268
-					if ($row['mail_type'] == self::TYPE_FORWARD) $new_addresses =& $_mailForwardingAddress;
283
+					if ($row['mail_type'] == self::TYPE_FORWARD)
284
+					{
285
+						$new_addresses =& $_mailForwardingAddress;
286
+					}
269 287
 					if (($key = array_search($row['mail_value'], $new_addresses)) === false)
270 288
 					{
271 289
 						$delete_ids[] = $row['mail_id'];
@@ -367,7 +385,11 @@  discard block
 block discarded – undo
367 385
 			self::TABLE.'.mail_type='.self::TYPE_MAILBOX,
368 386
 			__LINE__, __FILE__, false, 'ORDER BY account_lid', self::APP, 0, $join) as $row)
369 387
 		{
370
-			if ($row['uid'] == 'anonymous') continue;	// anonymous is never a mail-user!
388
+			if ($row['uid'] == 'anonymous')
389
+			{
390
+				continue;
391
+			}
392
+			// anonymous is never a mail-user!
371 393
 			list($mailbox) = explode('@', $row['mailbox']);
372 394
 			$mailboxes[$row['uid']] = $mailbox;
373 395
 		}
Please login to merge, or discard this patch.
api/src/Mail/Types.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -25,10 +25,10 @@  discard block
 block discarded – undo
25 25
 	 *
26 26
 	 * @return array classname => label pairs
27 27
 	 */
28
-	static public function getSMTPServerTypes($extended=true)
28
+	static public function getSMTPServerTypes($extended = true)
29 29
 	{
30 30
 		$retData = self::server_types(false, $extended);
31
-		foreach(Api\Hooks::process(array(
31
+		foreach (Api\Hooks::process(array(
32 32
 			'location' => 'smtp_server_types',
33 33
 			'extended' => $extended,
34 34
 		), array('managementserver'), true) as $app => $data)
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
 	 * @param boolean $extended =true
56 56
 	 * @return array classname => label pairs
57 57
 	 */
58
-	static public function getIMAPServerTypes($extended=true)
58
+	static public function getIMAPServerTypes($extended = true)
59 59
 	{
60 60
 		$retData = self::server_types(true, $extended);
61
-		foreach(Api\Hooks::process(array(
61
+		foreach (Api\Hooks::process(array(
62 62
 			'location' => 'imap_server_types',
63 63
 			'extended' => $extended,
64 64
 		), array('managementserver'), true) as $app => $data)
@@ -84,11 +84,11 @@  discard block
 block discarded – undo
84 84
 	 * @param boolean $extended =false
85 85
 	 * @return array
86 86
 	 */
87
-	protected static function server_types($imap=true, $extended=false)
87
+	protected static function server_types($imap = true, $extended = false)
88 88
 	{
89 89
 		$types = array();
90 90
 		$prefix = $imap ? 'Imap' : 'Smtp';
91
-		foreach(scandir($dir=__DIR__.'/'.$prefix) as $file)
91
+		foreach (scandir($dir = __DIR__.'/'.$prefix) as $file)
92 92
 		{
93 93
 			if ($file == '..')
94 94
 			{
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 
107 107
 			$type = array(
108 108
 				'classname' => $class_name,
109
-				'description' => is_callable($function=$class_name.'::description') ? call_user_func($function) : $class_name,
109
+				'description' => is_callable($function = $class_name.'::description') ? call_user_func($function) : $class_name,
110 110
 			);
111 111
 			if ($imap) $type['protocol'] = 'imap';
112 112
 
Please login to merge, or discard this patch.
Braces   +20 added lines, -6 removed lines patch added patch discarded remove patch
@@ -33,10 +33,14 @@  discard block
 block discarded – undo
33 33
 			'extended' => $extended,
34 34
 		), array('managementserver'), true) as $app => $data)
35 35
 		{
36
-			if ($data && $app != 'emailadmin') $retData += $data;
36
+			if ($data && $app != 'emailadmin')
37
+			{
38
+				$retData += $data;
39
+			}
37 40
 		}
38 41
 
39
-		uksort($retData, function($a, $b) {
42
+		uksort($retData, function($a, $b)
43
+		{
40 44
 			static $prio = array(	// not explicitly mentioned get 0
41 45
 				'EGroupware\\Api\\Mail\\Smtp' => 9,
42 46
 				'EGroupware\\Api\\Mail\\Smtp\\Sql' => 8,
@@ -63,9 +67,13 @@  discard block
 block discarded – undo
63 67
 			'extended' => $extended,
64 68
 		), array('managementserver'), true) as $app => $data)
65 69
 		{
66
-			if ($data && $app != 'emailadmin') $retData += $data;
70
+			if ($data && $app != 'emailadmin')
71
+			{
72
+				$retData += $data;
73
+			}
67 74
 		}
68
-		uksort($retData, function($a, $b) {
75
+		uksort($retData, function($a, $b)
76
+		{
69 77
 			static $prio = array(	// not explicitly mentioned get 0
70 78
 				'EGroupware\\Api\\Mail\\Imap' => 9,
71 79
 				'managementserver_imap' => 8,
@@ -102,13 +110,19 @@  discard block
 block discarded – undo
102 110
 			{
103 111
 				continue;
104 112
 			}
105
-			if (!class_exists($class_name)) continue;
113
+			if (!class_exists($class_name))
114
+			{
115
+				continue;
116
+			}
106 117
 
107 118
 			$type = array(
108 119
 				'classname' => $class_name,
109 120
 				'description' => is_callable($function=$class_name.'::description') ? call_user_func($function) : $class_name,
110 121
 			);
111
-			if ($imap) $type['protocol'] = 'imap';
122
+			if ($imap)
123
+			{
124
+				$type['protocol'] = 'imap';
125
+			}
112 126
 
113 127
 			$types[$class_name] = $extended ? $type : $type['description'];
114 128
 		}
Please login to merge, or discard this patch.
api/src/Mail/Notifications.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	 * @param boolean $return_empty_marker =false should we return null
53 53
 	 * @return array with values for "notify_folders", "notify_use_default"
54 54
 	 */
55
-	public static function read($acc_id, $account_id=null, $return_empty_marker=false)
55
+	public static function read($acc_id, $account_id = null, $return_empty_marker = false)
56 56
 	{
57 57
 		if (is_null($account_id))
58 58
 		{
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 			//error_log(__METHOD__."($acc_id, ".array2string($account_id).") nothing in cache");
72 72
 		}
73 73
 		$account_specific = 0;
74
-		foreach($rows as $row)
74
+		foreach ($rows as $row)
75 75
 		{
76 76
 			if ($row['account_id'])
77 77
 			{
@@ -109,19 +109,19 @@  discard block
 block discarded – undo
109 109
 	{
110 110
 		if (!is_numeric($account_id) || !($account_id >= 0))
111 111
 		{
112
-			return 0;	// nothing to save, happens eg. in setup
112
+			return 0; // nothing to save, happens eg. in setup
113 113
 		}
114 114
 
115 115
 		if ($account_id && !$folders && ($default = self::read($acc_id, 0)) && $default['notify_folders'])
116 116
 		{
117
-			$folders[] = null;	// we need to write a marker, that user wants no notifications!
117
+			$folders[] = null; // we need to write a marker, that user wants no notifications!
118 118
 		}
119
-		$old = self::read($acc_id, $account_id, true);	// true = return empty marker
120
-		if ($account_id && !$old['notify_account_id']) $old['notify_folders'] = array();	// ignore returned default
119
+		$old = self::read($acc_id, $account_id, true); // true = return empty marker
120
+		if ($account_id && !$old['notify_account_id']) $old['notify_folders'] = array(); // ignore returned default
121 121
 
122 122
 		$changed = 0;
123 123
 		// insert newly added ones
124
-		foreach(array_diff($folders, $old['notify_folders']) as $folder)
124
+		foreach (array_diff($folders, $old['notify_folders']) as $folder)
125 125
 		{
126 126
 			self::$db->insert(self::TABLE, array(
127 127
 				'acc_id' => $acc_id,
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 	 * @param int|array $account_id =null
157 157
 	 * @return int number of rows deleted
158 158
 	 */
159
-	public static function delete($acc_id, $account_id=null)
159
+	public static function delete($acc_id, $account_id = null)
160 160
 	{
161 161
 		if (!($acc_id > 0) && !isset($account_id))
162 162
 		{
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 		self::$db->delete(self::TABLE, $where, __LINE__, __FILE__, self::APP);
170 170
 
171 171
 		// invalidate cache: we allways unset everything about an account to simplify cache handling
172
-		foreach($acc_id > 0 ? (array)$acc_id : array_keys(self::$cache) as $acc_id)
172
+		foreach ($acc_id > 0 ? (array)$acc_id : array_keys(self::$cache) as $acc_id)
173 173
 		{
174 174
 			unset(self::$cache[$acc_id]);
175 175
 		}
Please login to merge, or discard this patch.
Braces   +17 added lines, -4 removed lines patch added patch discarded remove patch
@@ -88,7 +88,10 @@  discard block
 block discarded – undo
88 88
 			}
89 89
 		}
90 90
 		$folders = (array)self::$cache[$acc_id][$account_specific];
91
-		if (!$return_empty_marker && $folders == array(null)) $folders = array();
91
+		if (!$return_empty_marker && $folders == array(null))
92
+		{
93
+			$folders = array();
94
+		}
92 95
 		$result = array(
93 96
 			'notify_folders' => $folders,
94 97
 			'notify_account_id' => $account_specific,
@@ -117,7 +120,11 @@  discard block
 block discarded – undo
117 120
 			$folders[] = null;	// we need to write a marker, that user wants no notifications!
118 121
 		}
119 122
 		$old = self::read($acc_id, $account_id, true);	// true = return empty marker
120
-		if ($account_id && !$old['notify_account_id']) $old['notify_folders'] = array();	// ignore returned default
123
+		if ($account_id && !$old['notify_account_id'])
124
+		{
125
+			$old['notify_folders'] = array();
126
+		}
127
+		// ignore returned default
121 128
 
122 129
 		$changed = 0;
123 130
 		// insert newly added ones
@@ -163,8 +170,14 @@  discard block
 block discarded – undo
163 170
 			throw new Api\Exception\WrongParameter(__METHOD__."() no acc_id AND no account_id parameter!");
164 171
 		}
165 172
 		$where = array();
166
-		if ($acc_id > 0) $where['acc_id'] = $acc_id;
167
-		if (isset($account_id)) $where['account_id'] = $account_id;
173
+		if ($acc_id > 0)
174
+		{
175
+			$where['acc_id'] = $acc_id;
176
+		}
177
+		if (isset($account_id))
178
+		{
179
+			$where['account_id'] = $account_id;
180
+		}
168 181
 
169 182
 		self::$db->delete(self::TABLE, $where, __LINE__, __FILE__, self::APP);
170 183
 
Please login to merge, or discard this patch.