Completed
Push — 17.1 ( 8c3b94...29ee37 )
by Ralf
20:39 queued 11:58
created
api/src/Cache/Files.php 1 patch
Braces   +24 added lines, -6 removed lines patch added patch discarded remove patch
@@ -50,7 +50,10 @@  discard block
 block discarded – undo
50 50
 		else
51 51
 		{
52 52
 			$this->base_path = Api\Cache::get_system_config('temp_dir', false);
53
-			if (isset($this->base_path)) $this->base_path .= '/egw_cache';
53
+			if (isset($this->base_path))
54
+			{
55
+				$this->base_path .= '/egw_cache';
56
+			}
54 57
 		}
55 58
 		if (!isset($this->base_path) || !file_exists($this->base_path) && !mkdir($this->base_path,0700,true))
56 59
 		{
@@ -86,7 +89,10 @@  discard block
 block discarded – undo
86 89
 		{
87 90
 			flock($ret, LOCK_EX);
88 91
 			$ok = fwrite($ret, serialize($data));
89
-			if ((int)$expiration > 0) file_put_contents($fname.self::EXPIRATION_EXTENSION,(string)$expiration);
92
+			if ((int)$expiration > 0)
93
+			{
94
+				file_put_contents($fname.self::EXPIRATION_EXTENSION,(string)$expiration);
95
+			}
90 96
 			flock($ret, LOCK_UN);
91 97
 			fclose($ret);
92 98
 			$ret = $ok !== false;
@@ -106,7 +112,10 @@  discard block
 block discarded – undo
106 112
 	{
107 113
 		if (($ret = @file_put_contents($fname=$this->filename($keys,true),serialize($data),LOCK_EX) > 0))
108 114
 		{
109
-			if ((int)$expiration > 0) file_put_contents($fname.self::EXPIRATION_EXTENSION,(string)$expiration);
115
+			if ((int)$expiration > 0)
116
+			{
117
+				file_put_contents($fname.self::EXPIRATION_EXTENSION,(string)$expiration);
118
+			}
110 119
 		}
111 120
 		return $ret;
112 121
 	}
@@ -182,17 +191,26 @@  discard block
 block discarded – undo
182 191
 		}
183 192
 		foreach(scandir($path) as $file)
184 193
 		{
185
-			if ($file == '.' || $file == '..') continue;
194
+			if ($file == '.' || $file == '..')
195
+			{
196
+				continue;
197
+			}
186 198
 
187 199
 			$file = $path.'/'.$file;
188 200
 
189 201
 			if (is_dir($file))
190 202
 			{
191
-				if (!self::rm_recursive($file)) return false;
203
+				if (!self::rm_recursive($file))
204
+				{
205
+					return false;
206
+				}
192 207
 			}
193 208
 			else
194 209
 			{
195
-				if (!unlink($file)) return false;
210
+				if (!unlink($file))
211
+				{
212
+					return false;
213
+				}
196 214
 			}
197 215
 		}
198 216
 		return rmdir($path);
Please login to merge, or discard this patch.
api/src/Cache/Exception.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,4 +18,6 @@
 block discarded – undo
18 18
 /**
19 19
  * Exception thrown by Cache classes
20 20
  */
21
-class Exception extends Api\Exception {}
21
+class Exception extends Api\Exception
22
+{
23
+}
Please login to merge, or discard this patch.
api/src/Country.php 1 patch
Braces   +21 added lines, -5 removed lines patch added patch discarded remove patch
@@ -368,7 +368,10 @@  discard block
 block discarded – undo
368 368
 	{
369 369
 		if ($translated)
370 370
 		{
371
-			if (!self::$countries_translated) self::_translate_countries();
371
+			if (!self::$countries_translated)
372
+			{
373
+				self::_translate_countries();
374
+			}
372 375
 
373 376
 			return self::$countries_translated[strtoupper($code)];
374 377
 		}
@@ -383,7 +386,11 @@  discard block
 block discarded – undo
383 386
 	 */
384 387
 	public static function country_code($name)
385 388
 	{
386
-		if (!$name) return '';	// nothing to do
389
+		if (!$name)
390
+		{
391
+			return '';
392
+		}
393
+		// nothing to do
387 394
 
388 395
 		if (strlen($name) == 2 && isset(self::$country_array[$name]))
389 396
 		{
@@ -394,7 +401,10 @@  discard block
 block discarded – undo
394 401
 		{
395 402
 			return $code;
396 403
 		}
397
-		if (!self::$countries_translated) self::_translate_countries();
404
+		if (!self::$countries_translated)
405
+		{
406
+			self::_translate_countries();
407
+		}
398 408
 
399 409
 		if (($code = array_search(strtoupper($name),self::$countries_translated)) !== false ||
400 410
 			($code = array_search($name,self::$countries_translated)) !== false)
@@ -429,7 +439,10 @@  discard block
 block discarded – undo
429 439
 	{
430 440
 		if ($translated)
431 441
 		{
432
-			if (!self::$countries_translated) self::_translate_countries();
442
+			if (!self::$countries_translated)
443
+			{
444
+				self::_translate_countries();
445
+			}
433 446
 
434 447
 			return self::$countries_translated;
435 448
 		}
@@ -443,7 +456,10 @@  discard block
 block discarded – undo
443 456
 	 */
444 457
 	protected static function _translate_countries()
445 458
 	{
446
-		if (self::$countries_translated) return;
459
+		if (self::$countries_translated)
460
+		{
461
+			return;
462
+		}
447 463
 
448 464
 		self::$countries_translated = self::$country_array;
449 465
 		// try to translate them and sort alphabetic
Please login to merge, or discard this patch.
api/src/Auth/Ads.php 1 patch
Braces   +16 added lines, -4 removed lines patch added patch discarded remove patch
@@ -90,7 +90,10 @@  discard block
 block discarded – undo
90 90
 			if (($id = $GLOBALS['egw']->accounts->name2id($username,'account_lid','u')))
91 91
 			{
92 92
 				$ret = $GLOBALS['egw']->accounts->id2name($id,'account_status') == 'A';
93
-				if (!$ret) error_log(__METHOD__."('$username') account_status check returning ".array2string($ret));
93
+				if (!$ret)
94
+				{
95
+					error_log(__METHOD__."('$username') account_status check returning ".array2string($ret));
96
+				}
94 97
 				return $ret;
95 98
 			}
96 99
 			// store homedirectory for egw_session->read_repositories
@@ -158,7 +161,10 @@  discard block
 block discarded – undo
158 161
 	static function setLastPwdChange($account_id=0, $passwd=NULL, $lastpwdchange=NULL, $return_mod=false)
159 162
 	{
160 163
 		unset($passwd);	// not used but required by function signature
161
-		if (!($adldap = Api\Accounts\Ads::get_adldap())) return false;
164
+		if (!($adldap = Api\Accounts\Ads::get_adldap()))
165
+		{
166
+			return false;
167
+		}
162 168
 
163 169
 		if ($lastpwdchange)
164 170
 		{
@@ -166,7 +172,10 @@  discard block
 block discarded – undo
166 172
 			$ldapServerInfo = Api\Ldap\ServerInfo::get($adldap->getLdapConnection(), $GLOBALS['egw_info']['server']['ads_host']);
167 173
 			if ($ldapServerInfo->serverType == Api\Ldap\ServerInfo::SAMBA4)
168 174
 			{
169
-				if ($lastpwdchange == -1) $lastpwdchange = time();
175
+				if ($lastpwdchange == -1)
176
+				{
177
+					$lastpwdchange = time();
178
+				}
170 179
 			}
171 180
 			// while Windows only allows to set -1 for current time (or 0 to force user to change password)
172 181
 			else
@@ -179,7 +188,10 @@  discard block
 block discarded – undo
179 188
 			$lastpwdchange = Api\Accounts\Ads::convertUnixTimeToWindowsTime($lastpwdchange);
180 189
 		}
181 190
 		$mod = array('pwdlastset' => $lastpwdchange);
182
-		if ($return_mod) return $mod;
191
+		if ($return_mod)
192
+		{
193
+			return $mod;
194
+		}
183 195
 
184 196
 		$ret = false;
185 197
 		if ($account_id && ($username = Api\Accounts::id2name($account_id, 'account_lid')) &&
Please login to merge, or discard this patch.
api/src/Auth/Mail.php 1 patch
Braces   +24 added lines, -6 removed lines patch added patch discarded remove patch
@@ -70,7 +70,10 @@  discard block
 block discarded – undo
70 70
 			}
71 71
 			catch(Horde_Imap_Client_Exception $e) {
72 72
 				// throw everything but authentication failed as exception
73
-				if ($e->getCode() != Horde_Imap_Client_Exception::LOGIN_AUTHENTICATIONFAILED) throw $e;
73
+				if ($e->getCode() != Horde_Imap_Client_Exception::LOGIN_AUTHENTICATIONFAILED)
74
+				{
75
+					throw $e;
76
+				}
74 77
 
75 78
 				$mailauth = false;
76 79
 			}
@@ -84,23 +87,38 @@  discard block
 block discarded – undo
84 87
 			{
85 88
 				case 'imap':
86 89
 				default:
87
-					if (!isset($port)) $port = 143;
90
+					if (!isset($port))
91
+					{
92
+						$port = 143;
93
+					}
88 94
 					$mailauth = imap_open('{'.$host.':'.$port.'/imap/novalidate-cert}INBOX', $username , $passwd);
89 95
 					break;
90 96
 				case 'imaps':
91
-					if (!isset($port)) $port = 993;
97
+					if (!isset($port))
98
+					{
99
+						$port = 993;
100
+					}
92 101
 					$mailauth = imap_open('{'.$host.'/imap/ssl/novalidate-cert:'.$port.'}INBOX', $username , $passwd);
93 102
 					break;
94 103
 				case 'pop3':
95
-					if (!isset($port)) $port = 110;
104
+					if (!isset($port))
105
+					{
106
+						$port = 110;
107
+					}
96 108
 					$mailauth = imap_open('{'.$host.'/pop3/novalidate-cert:'.$port.'}INBOX', $username , $passwd);
97 109
 					break;
98 110
 				case 'pop3s':
99
-					if (!isset($port)) $port = 995;
111
+					if (!isset($port))
112
+					{
113
+						$port = 995;
114
+					}
100 115
 					$mailauth = imap_open('{'.$host.'/pop3/ssl/novalidate-cert:'.$port.'}INBOX', $username , $passwd);
101 116
 					break;
102 117
 			}
103
-			if ($mailauth) imap_close($mailauth);
118
+			if ($mailauth)
119
+			{
120
+				imap_close($mailauth);
121
+			}
104 122
 		}
105 123
 		return !!$mailauth;
106 124
 	}
Please login to merge, or discard this patch.
api/src/Auth/Cas.php 1 patch
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,13 +33,16 @@
 block discarded – undo
33 33
 	{
34 34
 		/* if program goes here, authenticate is, normaly, already verified by CAS */
35 35
 		if ($GLOBALS['egw_info']['server']['account_repository'] != 'ldap' &&
36
-			$GLOBALS['egw_info']['server']['account_repository'] != 'ldsq') /* For anonymous LDAP connection */
36
+			$GLOBALS['egw_info']['server']['account_repository'] != 'ldsq')
37
+		{
38
+			/* For anonymous LDAP connection */
37 39
 		{
38 40
 			if (!($id = $GLOBALS['egw']->accounts->name2id($username,'account_lid','u')) &&
39 41
 				$GLOBALS['egw_info']['server']['auto_create_acct'])
40 42
 			{
41 43
 				// create a global array with all availible info about that account
42 44
 				$GLOBALS['auto_create_acct'] = array();
45
+		}
43 46
 				foreach(array(
44 47
 					'givenname' => 'firstname',
45 48
 					'sn'        => 'lastname',
Please login to merge, or discard this patch.
api/src/Csrf.php 1 patch
Braces   +8 added lines, -2 removed lines patch added patch discarded remove patch
@@ -64,10 +64,16 @@
 block discarded – undo
64 64
 		if (!isset($stored_purpose) || $stored_purpose !== $_purpose)
65 65
 		{
66 66
 			error_log('CSRF detected from IP '.$_SERVER['REMOTE_ADDR'].' to '.$_SERVER['REQUEST_METHOD'].' '.$_SERVER['REQUEST_URI']);
67
-			if ($_POST) error_log(array2string($_POST));
67
+			if ($_POST)
68
+			{
69
+				error_log(array2string($_POST));
70
+			}
68 71
 			// we are not throwing an exception here, but die, to not allow catching it!
69 72
 			die("CSRF detected, request terminated!");
70 73
 		}
71
-		if ($_delete_token) Cache::unsetSession(__CLASS__, $_token);
74
+		if ($_delete_token)
75
+		{
76
+			Cache::unsetSession(__CLASS__, $_token);
77
+		}
72 78
 	}
73 79
 }
74 80
\ No newline at end of file
Please login to merge, or discard this patch.
api/src/Image.php 1 patch
Braces   +48 added lines, -12 removed lines patch added patch discarded remove patch
@@ -33,7 +33,10 @@  discard block
 block discarded – undo
33 33
 	{
34 34
 		$svg = Header\UserAgent::mobile() ? null : $_svg; // ATM we use svg icons only for mobile theme
35 35
 		static $image_map_no_svg = null, $image_map_svg = null;
36
-		if (is_null($svg)) $svg = self::svg_usable ();
36
+		if (is_null($svg))
37
+		{
38
+			$svg = self::svg_usable ();
39
+		}
37 40
 		if ($svg)
38 41
 		{
39 42
 			$image_map =& $image_map_svg;
@@ -42,7 +45,10 @@  discard block
 block discarded – undo
42 45
 		{
43 46
 			$image_map =& $image_map_no_svg;
44 47
 		}
45
-		if (is_null($image_map)) $image_map = self::map(null, $svg);
48
+		if (is_null($image_map))
49
+		{
50
+			$image_map = self::map(null, $svg);
51
+		}
46 52
 
47 53
 		// array of images in descending precedence
48 54
 		if (is_array($image))
@@ -152,15 +158,24 @@  discard block
 block discarded – undo
152 158
 		$img_types = array('png','jpg','gif','ico');
153 159
 
154 160
 		// if we want svg, prepend it to img-types
155
-		if ($svg) array_unshift ($img_types, 'svg');
161
+		if ($svg)
162
+		{
163
+			array_unshift ($img_types, 'svg');
164
+		}
156 165
 
157 166
 		$map = array();
158 167
 		foreach(scandir(EGW_SERVER_ROOT) as $app)
159 168
 		{
160
-			if ($app[0] == '.' || !is_dir(EGW_SERVER_ROOT.'/'.$app) || !file_exists(EGW_SERVER_ROOT.'/'.$app.'/templates')) continue;
169
+			if ($app[0] == '.' || !is_dir(EGW_SERVER_ROOT.'/'.$app) || !file_exists(EGW_SERVER_ROOT.'/'.$app.'/templates'))
170
+			{
171
+				continue;
172
+			}
161 173
 
162 174
 			$app_map =& $map[$app];
163
-			if (true) $app_map = array();
175
+			if (true)
176
+			{
177
+				$app_map = array();
178
+			}
164 179
 			$imagedirs = array();
165 180
 			if (Header\UserAgent::mobile())
166 181
 			{
@@ -174,24 +189,39 @@  discard block
 block discarded – undo
174 189
 			{
175 190
 				$imagedirs[] = '/'.$app.'/templates/'.$template_set.'/images';
176 191
 			}
177
-			if ($template_set != 'idots') $imagedirs[] = '/'.$app.'/templates/idots/images';
192
+			if ($template_set != 'idots')
193
+			{
194
+				$imagedirs[] = '/'.$app.'/templates/idots/images';
195
+			}
178 196
 			$imagedirs[] = '/'.$app.'/templates/default/images';
179 197
 
180 198
 			foreach($imagedirs as $imagedir)
181 199
 			{
182
-				if (!file_exists($dir = EGW_SERVER_ROOT.$imagedir) || !is_readable($dir)) continue;
200
+				if (!file_exists($dir = EGW_SERVER_ROOT.$imagedir) || !is_readable($dir))
201
+				{
202
+					continue;
203
+				}
183 204
 
184 205
 				foreach(scandir($dir) as $img)
185 206
 				{
186
-					if ($img[0] == '.') continue;
207
+					if ($img[0] == '.')
208
+					{
209
+						continue;
210
+					}
187 211
 
188 212
 					$subdir = null;
189 213
 					foreach(is_dir($dir.'/'.$img) ? scandir($dir.'/'.($subdir=$img)) : (array) $img as $img)
190 214
 					{
191 215
 						$name = null;
192
-						if (!in_array($ext = self::get_extension($img, $name), $img_types) || empty($name)) continue;
216
+						if (!in_array($ext = self::get_extension($img, $name), $img_types) || empty($name))
217
+						{
218
+							continue;
219
+						}
193 220
 
194
-						if (isset($subdir)) $name = $subdir.'/'.$name;
221
+						if (isset($subdir))
222
+						{
223
+							$name = $subdir.'/'.$name;
224
+						}
195 225
 
196 226
 						if (!isset($app_map[$name]) || array_search($ext, $img_types) < array_search(self::get_extension($app_map[$name]), $img_types))
197 227
 						{
@@ -202,12 +232,18 @@  discard block
 block discarded – undo
202 232
 			}
203 233
 		}
204 234
 		$app_map =& $map['vfs'];
205
-		if (true) $app_map = array();
235
+		if (true)
236
+		{
237
+			$app_map = array();
238
+		}
206 239
 		if (($dir = $GLOBALS['egw_info']['server']['vfs_image_dir']) && Vfs::file_exists($dir) && Vfs::is_readable($dir))
207 240
 		{
208 241
 			foreach(Vfs::find($dir) as $img)
209 242
 			{
210
-				if (!in_array($ext = self::get_extension($img, $name), $img_types) || empty($name)) continue;
243
+				if (!in_array($ext = self::get_extension($img, $name), $img_types) || empty($name))
244
+				{
245
+					continue;
246
+				}
211 247
 
212 248
 				if (!isset($app_map[$name]) || array_search($ext, $img_types) < array_search(self::get_extension($app_map[$name]), $img_types))
213 249
 				{
Please login to merge, or discard this patch.
api/src/Mail/Smtp.php 1 patch
Braces   +12 added lines, -3 removed lines patch added patch discarded remove patch
@@ -235,8 +235,14 @@  discard block
 block discarded – undo
235 235
 	 */
236 236
 	/*static*/ public function mailbox_addr($account,$domain=null,$mail_login_type=null)
237 237
 	{
238
-		if (is_null($domain)) $domain = $this->defaultDomain;
239
-		if (is_null($mail_login_type)) $mail_login_type = $this->loginType;
238
+		if (is_null($domain))
239
+		{
240
+			$domain = $this->defaultDomain;
241
+		}
242
+		if (is_null($mail_login_type))
243
+		{
244
+			$mail_login_type = $this->loginType;
245
+		}
240 246
 
241 247
 		switch($mail_login_type)
242 248
 		{
@@ -245,7 +251,10 @@  discard block
 block discarded – undo
245 251
 				break;
246 252
 
247 253
 			case 'uidNumber':
248
-				if (is_array($account)) $account = $account['account_id'];
254
+				if (is_array($account))
255
+				{
256
+					$account = $account['account_id'];
257
+				}
249 258
 				$mbox = 'u'.$account.'@'.$domain;
250 259
 				break;
251 260
 
Please login to merge, or discard this patch.