Completed
Push — 16.1 ( 7ccc73...046888 )
by Nathan
64:46 queued 51:15
created
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.
api/src/Ldap.php 3 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -31,17 +31,17 @@
 block discarded – undo
31 31
 class Ldap
32 32
 {
33 33
 	/**
34
-	* Holds the LDAP link identifier
35
-	*
36
-	* @var resource $ds
37
-	*/
34
+	 * Holds the LDAP link identifier
35
+	 *
36
+	 * @var resource $ds
37
+	 */
38 38
 	var $ds;
39 39
 
40 40
 	/**
41
-	* Holds the detected information about the connected ldap server
42
-	*
43
-	* @var Ldap\ServerInfo $ldapserverinfo
44
-	*/
41
+	 * Holds the detected information about the connected ldap server
42
+	 *
43
+	 * @var Ldap\ServerInfo $ldapserverinfo
44
+	 */
45 45
 	var $ldapserverinfo;
46 46
 
47 47
 	/**
Please login to merge, or discard this patch.
Braces   +36 added lines, -9 removed lines patch added patch discarded remove patch
@@ -129,12 +129,18 @@  discard block
 block discarded – undo
129 129
 	 */
130 130
 	static function result2array($ldap)
131 131
 	{
132
-		if (!is_array($ldap)) return false;
132
+		if (!is_array($ldap))
133
+		{
134
+			return false;
135
+		}
133 136
 
134 137
 		$arr = array();
135 138
 		foreach($ldap as $var => $val)
136 139
 		{
137
-			if (is_int($var) || $var == 'count') continue;
140
+			if (is_int($var) || $var == 'count')
141
+			{
142
+				continue;
143
+			}
138 144
 
139 145
 			if (is_array($val) && $val['count'] == 1)
140 146
 			{
@@ -142,7 +148,10 @@  discard block
 block discarded – undo
142 148
 			}
143 149
 			else
144 150
 			{
145
-				if (is_array($val)) unset($val['count']);
151
+				if (is_array($val))
152
+				{
153
+					unset($val['count']);
154
+				}
146 155
 
147 156
 				$arr[$var] = $val;
148 157
 			}
@@ -168,7 +177,10 @@  discard block
 block discarded – undo
168 177
 	{
169 178
 		if(!function_exists('ldap_connect'))
170 179
 		{
171
-			if ($this->exception_on_error) throw new Exception\AssertionFailed('LDAP support unavailable!');
180
+			if ($this->exception_on_error)
181
+			{
182
+				throw new Exception\AssertionFailed('LDAP support unavailable!');
183
+			}
172 184
 
173 185
 			printf('<b>Error: LDAP support unavailable</b><br>',$host);
174 186
 			return False;
@@ -194,10 +206,13 @@  discard block
 block discarded – undo
194 206
 			{
195 207
 				if ($h !== $host)
196 208
 				{
197
-					if (isset($_SESSION))	// store working host as first choice in session
209
+					if (isset($_SESSION))
210
+					{
211
+						// store working host as first choice in session
198 212
 					{
199 213
 						$_SESSION['ldapConnect'][$host] = implode(' ',array_unique(array_merge(array($h),$hosts)));
200 214
 					}
215
+					}
201 216
 				}
202 217
 				return $this->ds;
203 218
 			}
@@ -206,7 +221,10 @@  discard block
 block discarded – undo
206 221
 				' '.function_backtrace());
207 222
 		}
208 223
 		// give visible error, only if we cant connect to any ldap server
209
-		if ($this->exception_on_error) throw new Exception\NoPermission("Can't connect/bind to LDAP server '$host' and dn='$dn'!");
224
+		if ($this->exception_on_error)
225
+		{
226
+			throw new Exception\NoPermission("Can't connect/bind to LDAP server '$host' and dn='$dn'!");
227
+		}
210 228
 
211 229
 		return false;
212 230
 	}
@@ -242,7 +260,10 @@  discard block
 block discarded – undo
242 260
 		{
243 261
 			$supportedLDAPVersion = 2;
244 262
 		}
245
-		if ($use_tls) ldap_start_tls($this->ds);
263
+		if ($use_tls)
264
+		{
265
+			ldap_start_tls($this->ds);
266
+		}
246 267
 
247 268
 		if (!isset($this->ldapserverinfo) ||
248 269
 			!is_a($this->ldapserverinfo,'EGroupware\Ldap\ServerInfo') ||
@@ -281,10 +302,13 @@  discard block
 block discarded – undo
281 302
 	 */
282 303
 	function restoreSessionData()
283 304
 	{
284
-		if (isset($GLOBALS['egw']->session))	// no availible in setup
305
+		if (isset($GLOBALS['egw']->session))
306
+		{
307
+			// no availible in setup
285 308
 		{
286 309
 			$this->ldapserverinfo = Cache::getSession(__CLASS__, 'ldapServerInfo');
287 310
 		}
311
+		}
288 312
 	}
289 313
 
290 314
 	/**
@@ -292,9 +316,12 @@  discard block
 block discarded – undo
292 316
 	 */
293 317
 	function saveSessionData()
294 318
 	{
295
-		if (isset($GLOBALS['egw']->session))	// no availible in setup
319
+		if (isset($GLOBALS['egw']->session))
320
+		{
321
+			// no availible in setup
296 322
 		{
297 323
 			Cache::setSession(__CLASS__, 'ldapServerInfo', $this->ldapserverinfo);
298 324
 		}
325
+		}
299 326
 	}
300 327
 }
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -49,14 +49,14 @@  discard block
 block discarded – undo
49 49
 	 *
50 50
 	 * @var boolean $exception_on_error
51 51
 	 */
52
-	var $exception_on_error=false;
52
+	var $exception_on_error = false;
53 53
 
54 54
 	/**
55 55
 	 * Constructor
56 56
 	 *
57 57
 	 * @param boolean $exception_on_error =false true: throw Exceptions in ldapConnect instead of echoing error and returning false
58 58
 	 */
59
-	function __construct($exception_on_error=false)
59
+	function __construct($exception_on_error = false)
60 60
 	{
61 61
 		$this->exception_on_error = $exception_on_error;
62 62
 		$this->restoreSessionData();
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 * @throws Exception\AssertingFailed 'LDAP support unavailable!' (no ldap extension)
84 84
 	 * @throws Exception\NoPermission if bind fails
85 85
 	 */
86
-	public static function factory($ressource=true, $host='', $dn='', $passwd='')
86
+	public static function factory($ressource = true, $host = '', $dn = '', $passwd = '')
87 87
 	{
88 88
 		$key = md5($host.':'.$dn.':'.$passwd);
89 89
 
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 	 */
119 119
 	static function quote($string)
120 120
 	{
121
-		return str_replace(array('\\','*','(',')','\0',' '),array('\\\\','\*','\(','\)','\\0','\20'),$string);
121
+		return str_replace(array('\\', '*', '(', ')', '\0', ' '), array('\\\\', '\*', '\(', '\)', '\\0', '\20'), $string);
122 122
 	}
123 123
 
124 124
 	/**
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 		if (!is_array($ldap)) return false;
133 133
 
134 134
 		$arr = array();
135
-		foreach($ldap as $var => $val)
135
+		foreach ($ldap as $var => $val)
136 136
 		{
137 137
 			if (is_int($var) || $var == 'count') continue;
138 138
 
@@ -164,13 +164,13 @@  discard block
 block discarded – undo
164 164
 	 * @throws Exception\AssertingFailed 'LDAP support unavailable!' (no ldap extension)
165 165
 	 * @throws Exception\NoPermission if bind fails
166 166
 	 */
167
-	function ldapConnect($host='', $dn='', $passwd='')
167
+	function ldapConnect($host = '', $dn = '', $passwd = '')
168 168
 	{
169
-		if(!function_exists('ldap_connect'))
169
+		if (!function_exists('ldap_connect'))
170 170
 		{
171 171
 			if ($this->exception_on_error) throw new Exception\AssertionFailed('LDAP support unavailable!');
172 172
 
173
-			printf('<b>Error: LDAP support unavailable</b><br>',$host);
173
+			printf('<b>Error: LDAP support unavailable</b><br>', $host);
174 174
 			return False;
175 175
 		}
176 176
 		if (empty($host))
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 		{
189 189
 			$host = $_SESSION['ldapConnect'][$host];
190 190
 		}
191
-		foreach($hosts=preg_split('/[ ,;]+/', $host) as $h)
191
+		foreach ($hosts = preg_split('/[ ,;]+/', $host) as $h)
192 192
 		{
193 193
 			if ($this->_connect($h, $dn, $passwd))
194 194
 			{
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 				{
197 197
 					if (isset($_SESSION))	// store working host as first choice in session
198 198
 					{
199
-						$_SESSION['ldapConnect'][$host] = implode(' ',array_unique(array_merge(array($h),$hosts)));
199
+						$_SESSION['ldapConnect'][$host] = implode(' ', array_unique(array_merge(array($h), $hosts)));
200 200
 					}
201 201
 				}
202 202
 				return $this->ds;
@@ -221,20 +221,20 @@  discard block
 block discarded – undo
221 221
 	 */
222 222
 	private function _connect($host, $dn, $passwd)
223 223
 	{
224
-		if (($use_tls = substr($host,0,6) == 'tls://'))
224
+		if (($use_tls = substr($host, 0, 6) == 'tls://'))
225 225
 		{
226
-			$port = parse_url($host,PHP_URL_PORT);
227
-			$host = parse_url($host,PHP_URL_HOST);
226
+			$port = parse_url($host, PHP_URL_PORT);
227
+			$host = parse_url($host, PHP_URL_HOST);
228 228
 		}
229 229
 		// connect to ldap server (never fails, as connection happens in bind!)
230
-		if(!$host || !($this->ds = !empty($port) ? ldap_connect($host, $port) : ldap_connect($host)))
230
+		if (!$host || !($this->ds = !empty($port) ? ldap_connect($host, $port) : ldap_connect($host)))
231 231
 		{
232 232
 			return False;
233 233
 		}
234 234
 		// set network timeout to not block for minutes
235 235
 		ldap_set_option($this->ds, LDAP_OPT_NETWORK_TIMEOUT, 5);
236 236
 
237
-		if(ldap_set_option($this->ds, LDAP_OPT_PROTOCOL_VERSION, 3))
237
+		if (ldap_set_option($this->ds, LDAP_OPT_PROTOCOL_VERSION, 3))
238 238
 		{
239 239
 			$supportedLDAPVersion = 3;
240 240
 		}
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 		if ($use_tls) ldap_start_tls($this->ds);
246 246
 
247 247
 		if (!isset($this->ldapserverinfo) ||
248
-			!is_a($this->ldapserverinfo,'EGroupware\Ldap\ServerInfo') ||
248
+			!is_a($this->ldapserverinfo, 'EGroupware\Ldap\ServerInfo') ||
249 249
 			$this->ldapserverinfo->host != $host)
250 250
 		{
251 251
 			//error_log("no ldap server info found");
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 			$this->saveSessionData();
256 256
 		}
257 257
 
258
-		if(!@ldap_bind($this->ds, $dn, $passwd))
258
+		if (!@ldap_bind($this->ds, $dn, $passwd))
259 259
 		{
260 260
 			return False;
261 261
 		}
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 	 */
269 269
 	function ldapDisconnect()
270 270
 	{
271
-		if(is_resource($this->ds))
271
+		if (is_resource($this->ds))
272 272
 		{
273 273
 			ldap_unbind($this->ds);
274 274
 			unset($this->ds);
Please login to merge, or discard this patch.
api/asyncwrapper.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -11,14 +11,14 @@
 block discarded – undo
11 11
  * @version $Id$
12 12
  */
13 13
 
14
-$path_to_egroupware = realpath(__DIR__.'/..');	//  need to be adapted if this script is moved somewhere else
14
+$path_to_egroupware = realpath(__DIR__.'/..'); //  need to be adapted if this script is moved somewhere else
15 15
 $php = isset($_ENV['_']) ? $_ENV['_'] : $_SERVER['_'];
16 16
 
17
-foreach(file($path_to_egroupware. '/header.inc.php') as $line)
17
+foreach (file($path_to_egroupware.'/header.inc.php') as $line)
18 18
 {
19
-	if(preg_match("/GLOBALS\['egw_domain']\['(.*)']/", $line, $matches))
19
+	if (preg_match("/GLOBALS\['egw_domain']\['(.*)']/", $line, $matches))
20 20
 	{
21 21
 		// -d memory_limit=-1 --> no memory limit
22
-		system($php. ' -q -d memory_limit=-1 '.$path_to_egroupware.'/api/asyncservices.php '. $matches[1]);
22
+		system($php.' -q -d memory_limit=-1 '.$path_to_egroupware.'/api/asyncservices.php '.$matches[1]);
23 23
 	}
24 24
 }
Please login to merge, or discard this patch.
api/config.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 $etag = '"'.md5($config.$link_registry).'"';
33 33
 
34 34
 // headers to allow caching, egw_framework specifies etag on url to force reload, even with Expires header
35
-Api\Session::cache_control(86400);	// cache for one day
35
+Api\Session::cache_control(86400); // cache for one day
36 36
 Header('Content-Type: text/javascript; charset=utf-8');
37 37
 Header('ETag: '.$etag);
38 38
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 $content .= 'egw.set_link_registry('.$link_registry.", undefined, egw && egw.window !== window);\n";
48 48
 
49 49
 // we run our own gzip compression, to set a correct Content-Length of the encoded content
50
-if (in_array('gzip', explode(',',$_SERVER['HTTP_ACCEPT_ENCODING'])) && function_exists('gzencode'))
50
+if (in_array('gzip', explode(',', $_SERVER['HTTP_ACCEPT_ENCODING'])) && function_exists('gzencode'))
51 51
 {
52 52
 	$content = gzencode($content);
53 53
 	header('Content-Encoding: gzip');
Please login to merge, or discard this patch.