Completed
Push — 16.1 ( 7ccc73...046888 )
by Nathan
64:46 queued 51:15
created
api/src/Auth/Mail.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -34,14 +34,14 @@  discard block
 block discarded – undo
34 34
 	 * @param string $passwd_type ='text' 'text' for cleartext passwords (default)
35 35
 	 * @return boolean true if successful authenticated, false otherwise
36 36
 	 */
37
-	function authenticate($username, $passwd, $passwd_type='text')
37
+	function authenticate($username, $passwd, $passwd_type = 'text')
38 38
 	{
39
-		unset($passwd_type);	// not used but required by function signature
39
+		unset($passwd_type); // not used but required by function signature
40 40
 
41 41
 		switch ($GLOBALS['egw_info']['server']['mail_login_type'])
42 42
 		{
43 43
 			case 'vmailmgr':
44
-				$username = $username . '@' . $GLOBALS['egw_info']['server']['mail_suffix'];
44
+				$username = $username.'@'.$GLOBALS['egw_info']['server']['mail_suffix'];
45 45
 				break;
46 46
 			case 'email':
47 47
 				$username = $GLOBALS['egw']->accounts->id2name($username, 'account_email');
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 				$mailauth = true;
69 69
 				$imap->logout();
70 70
 			}
71
-			catch(Horde_Imap_Client_Exception $e) {
71
+			catch (Horde_Imap_Client_Exception $e) {
72 72
 				// throw everything but authentication failed as exception
73 73
 				if ($e->getCode() != Horde_Imap_Client_Exception::LOGIN_AUTHENTICATIONFAILED) throw $e;
74 74
 
@@ -85,19 +85,19 @@  discard block
 block discarded – undo
85 85
 				case 'imap':
86 86
 				default:
87 87
 					if (!isset($port)) $port = 143;
88
-					$mailauth = imap_open('{'.$host.':'.$port.'/imap/novalidate-cert}INBOX', $username , $passwd);
88
+					$mailauth = imap_open('{'.$host.':'.$port.'/imap/novalidate-cert}INBOX', $username, $passwd);
89 89
 					break;
90 90
 				case 'imaps':
91 91
 					if (!isset($port)) $port = 993;
92
-					$mailauth = imap_open('{'.$host.'/imap/ssl/novalidate-cert:'.$port.'}INBOX', $username , $passwd);
92
+					$mailauth = imap_open('{'.$host.'/imap/ssl/novalidate-cert:'.$port.'}INBOX', $username, $passwd);
93 93
 					break;
94 94
 				case 'pop3':
95 95
 					if (!isset($port)) $port = 110;
96
-					$mailauth = imap_open('{'.$host.'/pop3/novalidate-cert:'.$port.'}INBOX', $username , $passwd);
96
+					$mailauth = imap_open('{'.$host.'/pop3/novalidate-cert:'.$port.'}INBOX', $username, $passwd);
97 97
 					break;
98 98
 				case 'pop3s':
99 99
 					if (!isset($port)) $port = 995;
100
-					$mailauth = imap_open('{'.$host.'/pop3/ssl/novalidate-cert:'.$port.'}INBOX', $username , $passwd);
100
+					$mailauth = imap_open('{'.$host.'/pop3/ssl/novalidate-cert:'.$port.'}INBOX', $username, $passwd);
101 101
 					break;
102 102
 			}
103 103
 			if ($mailauth) imap_close($mailauth);
@@ -113,9 +113,9 @@  discard block
 block discarded – undo
113 113
 	 * @param int $account_id =0 account id of user whose passwd should be changed
114 114
 	 * @return boolean true if password successful changed, false otherwise
115 115
 	 */
116
-	function change_password($old_passwd, $new_passwd, $account_id=0)
116
+	function change_password($old_passwd, $new_passwd, $account_id = 0)
117 117
 	{
118
-		unset($old_passwd, $new_passwd, $account_id);	// not used but required by function sigature
118
+		unset($old_passwd, $new_passwd, $account_id); // not used but required by function sigature
119 119
 
120 120
 		return False;
121 121
 	}
Please login to merge, or discard this patch.
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/Backend.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	 * @param string $passwd_type ='text' 'text' for cleartext passwords (default)
26 26
 	 * @return boolean true if successful authenticated, false otherwise
27 27
 	 */
28
-	function authenticate($username, $passwd, $passwd_type='text');
28
+	function authenticate($username, $passwd, $passwd_type = 'text');
29 29
 
30 30
 	/**
31 31
 	 * changes password in sql datababse
@@ -36,5 +36,5 @@  discard block
 block discarded – undo
36 36
 	 * @throws Exception to give a verbose error, why changing password failed
37 37
 	 * @return boolean true if password successful changed, false otherwise
38 38
 	 */
39
-	function change_password($old_passwd, $new_passwd, $account_id=0);
39
+	function change_password($old_passwd, $new_passwd, $account_id = 0);
40 40
 }
Please login to merge, or discard this patch.
api/src/Auth/Cas.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,18 +29,18 @@  discard block
 block discarded – undo
29 29
 	 * @param string $passwd_type ='text' 'text' for cleartext passwords (default)
30 30
 	 * @return boolean true if successful authenticated, false otherwise
31 31
 	 */
32
-	function authenticate($username, $passwd, $passwd_type='text')
32
+	function authenticate($username, $passwd, $passwd_type = 'text')
33 33
 	{
34 34
 		/* if program goes here, authenticate is, normaly, already verified by CAS */
35 35
 		if ($GLOBALS['egw_info']['server']['account_repository'] != 'ldap' &&
36 36
 			$GLOBALS['egw_info']['server']['account_repository'] != 'ldsq') /* For anonymous LDAP connection */
37 37
 		{
38
-			if (!($id = $GLOBALS['egw']->accounts->name2id($username,'account_lid','u')) &&
38
+			if (!($id = $GLOBALS['egw']->accounts->name2id($username, 'account_lid', 'u')) &&
39 39
 				$GLOBALS['egw_info']['server']['auto_create_acct'])
40 40
 			{
41 41
 				// create a global array with all availible info about that account
42 42
 				$GLOBALS['auto_create_acct'] = array();
43
-				foreach(array(
43
+				foreach (array(
44 44
 					'givenname' => 'firstname',
45 45
 					'sn'        => 'lastname',
46 46
 					'uidnumber' => 'id',
@@ -48,11 +48,11 @@  discard block
 block discarded – undo
48 48
 					'gidnumber' => 'primary_group',
49 49
 					) as $ldap_name => $acct_name)
50 50
 				{
51
-					$GLOBALS['auto_create_acct'][$acct_name] = Api\Translation::convert($allValues[0][$ldap_name][0],'utf-8');
51
+					$GLOBALS['auto_create_acct'][$acct_name] = Api\Translation::convert($allValues[0][$ldap_name][0], 'utf-8');
52 52
 				}
53 53
 				return True;
54 54
 			}
55
-			return $id && $GLOBALS['egw']->accounts->id2name($id,'account_status') == 'A' && phpCAS::checkAuthentication();
55
+			return $id && $GLOBALS['egw']->accounts->id2name($id, 'account_status') == 'A' && phpCAS::checkAuthentication();
56 56
 		}
57 57
 		return phpCAS::checkAuthentication();
58 58
 	}
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	 * @param int $account_id =0 account id of user whose passwd should be changed
66 66
 	 * @return boolean true if password successful changed, false otherwise
67 67
 	 */
68
-	function change_password($old_passwd, $new_passwd, $account_id=0)
68
+	function change_password($old_passwd, $new_passwd, $account_id = 0)
69 69
 	{
70 70
 		/* Not allowed */
71 71
 		return false;
Please login to merge, or discard this patch.
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,13 +33,16 @@
 block discarded – undo
33 33
 	{
34 34
 		/* if program goes here, authenticate is, normaly, already verified by CAS */
35 35
 		if ($GLOBALS['egw_info']['server']['account_repository'] != 'ldap' &&
36
-			$GLOBALS['egw_info']['server']['account_repository'] != 'ldsq') /* For anonymous LDAP connection */
36
+			$GLOBALS['egw_info']['server']['account_repository'] != 'ldsq')
37
+		{
38
+			/* For anonymous LDAP connection */
37 39
 		{
38 40
 			if (!($id = $GLOBALS['egw']->accounts->name2id($username,'account_lid','u')) &&
39 41
 				$GLOBALS['egw_info']['server']['auto_create_acct'])
40 42
 			{
41 43
 				// create a global array with all availible info about that account
42 44
 				$GLOBALS['auto_create_acct'] = array();
45
+		}
43 46
 				foreach(array(
44 47
 					'givenname' => 'firstname',
45 48
 					'sn'        => 'lastname',
Please login to merge, or discard this patch.
api/src/Csrf.php 2 patches
Spacing   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 * @param mixed $_purpose =true if given it need to be used in validate too! (It must NOT be NULL)
33 33
 	 * @return string CSRF token
34 34
 	 */
35
-	public static function token($_purpose=true)
35
+	public static function token($_purpose = true)
36 36
 	{
37 37
 		if (is_null($_purpose))
38 38
 		{
@@ -40,8 +40,7 @@  discard block
 block discarded – undo
40 40
 		}
41 41
 		// generate random token (using oppenssl if available otherwise mt_rand based Auth::randomstring)
42 42
 		$token = function_exists('openssl_random_pseudo_bytes') ?
43
-			base64_encode(openssl_random_pseudo_bytes(64)) :
44
-			Auth::randomstring(64);
43
+			base64_encode(openssl_random_pseudo_bytes(64)) : Auth::randomstring(64);
45 44
 
46 45
 		// store it in session for later validation
47 46
 		Cache::setSession(__CLASS__, $token, $_purpose);
@@ -56,7 +55,7 @@  discard block
 block discarded – undo
56 55
 	 * @param string $_purpose =true optional purpose string passed to token method
57 56
 	 * @param boolean $_delete_token =true true if token should be deleted after validation, it will validate no second time
58 57
 	 */
59
-	public static function validate($_token, $_purpose=true, $_delete_token=true)
58
+	public static function validate($_token, $_purpose = true, $_delete_token = true)
60 59
 	{
61 60
 		$stored_purpose = Cache::getSession(__CLASS__, $_token);
62 61
 
Please login to merge, or discard this 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 2 patches
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -29,25 +29,25 @@  discard block
 block discarded – undo
29 29
 	 *	true: always return svg, false: never return svg (current default), null: browser dependent, see svg_usable()
30 30
 	 * @return string url of image or null if not found
31 31
 	 */
32
-	static function find($app,$image,$extension='',$_svg=false)
32
+	static function find($app, $image, $extension = '', $_svg = false)
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)) $svg = self::svg_usable();
37 37
 		if ($svg)
38 38
 		{
39
-			$image_map =& $image_map_svg;
39
+			$image_map = & $image_map_svg;
40 40
 		}
41 41
 		else
42 42
 		{
43
-			$image_map =& $image_map_no_svg;
43
+			$image_map = & $image_map_no_svg;
44 44
 		}
45 45
 		if (is_null($image_map)) $image_map = self::map(null, $svg);
46 46
 
47 47
 		// array of images in descending precedence
48 48
 		if (is_array($image))
49 49
 		{
50
-			foreach($image as $img)
50
+			foreach ($image as $img)
51 51
 			{
52 52
 				if (($url = self::find($app, $img, $extension)))
53 53
 				{
@@ -66,16 +66,16 @@  discard block
 block discarded – undo
66 66
 			return $webserver_url.$image_map['vfs'][$image.$extension];
67 67
 		}
68 68
 		// then app specific ones
69
-		if(isset($image_map[$app][$image.$extension]))
69
+		if (isset($image_map[$app][$image.$extension]))
70 70
 		{
71 71
 			return $webserver_url.$image_map[$app][$image.$extension];
72 72
 		}
73 73
 		// then api
74
-		if(isset($image_map['api'][$image.$extension]))
74
+		if (isset($image_map['api'][$image.$extension]))
75 75
 		{
76 76
 			return $webserver_url.$image_map['api'][$image.$extension];
77 77
 		}
78
-		if(isset($image_map['phpgwapi'][$image.$extension]))
78
+		if (isset($image_map['phpgwapi'][$image.$extension]))
79 79
 		{
80 80
 			return $webserver_url.$image_map['phpgwapi'][$image.$extension];
81 81
 		}
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	 * @param string &$name on return basename without extension
99 99
 	 * @return string extension without dot, eg. 'php'
100 100
 	 */
101
-	protected static function get_extension($path, &$name=null)
101
+	protected static function get_extension($path, &$name = null)
102 102
 	{
103 103
 		$parts = explode('.', basename($path));
104 104
 		$ext = array_pop($parts);
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	 * @param boolean $svg =null prefer svg images, default for all browsers but IE<9
131 131
 	 * @return array of application => image-name => full path
132 132
 	 */
133
-	public static function map($template_set=null, $svg=null)
133
+	public static function map($template_set = null, $svg = null)
134 134
 	{
135 135
 		if (is_null($template_set))
136 136
 		{
@@ -149,17 +149,17 @@  discard block
 block discarded – undo
149 149
 		//$starttime = microtime(true);
150 150
 
151 151
 		// priority: : PNG->JPG->GIF
152
-		$img_types = array('png','jpg','gif','ico');
152
+		$img_types = array('png', 'jpg', 'gif', 'ico');
153 153
 
154 154
 		// if we want svg, prepend it to img-types
155
-		if ($svg) array_unshift ($img_types, 'svg');
155
+		if ($svg) array_unshift($img_types, 'svg');
156 156
 
157 157
 		$map = array();
158
-		foreach(scandir(EGW_SERVER_ROOT) as $app)
158
+		foreach (scandir(EGW_SERVER_ROOT) as $app)
159 159
 		{
160 160
 			if ($app[0] == '.' || !is_dir(EGW_SERVER_ROOT.'/'.$app) || !file_exists(EGW_SERVER_ROOT.'/'.$app.'/templates')) continue;
161 161
 
162
-			$app_map =& $map[$app];
162
+			$app_map = & $map[$app];
163 163
 			if (true) $app_map = array();
164 164
 			$imagedirs = array();
165 165
 			if (Header\UserAgent::mobile())
@@ -177,16 +177,16 @@  discard block
 block discarded – undo
177 177
 			if ($template_set != 'idots') $imagedirs[] = '/'.$app.'/templates/idots/images';
178 178
 			$imagedirs[] = '/'.$app.'/templates/default/images';
179 179
 
180
-			foreach($imagedirs as $imagedir)
180
+			foreach ($imagedirs as $imagedir)
181 181
 			{
182 182
 				if (!file_exists($dir = EGW_SERVER_ROOT.$imagedir) || !is_readable($dir)) continue;
183 183
 
184
-				foreach(scandir($dir) as $img)
184
+				foreach (scandir($dir) as $img)
185 185
 				{
186 186
 					if ($img[0] == '.') continue;
187 187
 
188 188
 					$subdir = null;
189
-					foreach(is_dir($dir.'/'.$img) ? scandir($dir.'/'.($subdir=$img)) : (array) $img as $img)
189
+					foreach (is_dir($dir.'/'.$img) ? scandir($dir.'/'.($subdir = $img)) : (array)$img as $img)
190 190
 					{
191 191
 						$name = null;
192 192
 						if (!in_array($ext = self::get_extension($img, $name), $img_types) || empty($name)) continue;
@@ -201,11 +201,11 @@  discard block
 block discarded – undo
201 201
 				}
202 202
 			}
203 203
 		}
204
-		$app_map =& $map['vfs'];
204
+		$app_map = & $map['vfs'];
205 205
 		if (true) $app_map = array();
206 206
 		if (($dir = $GLOBALS['egw_info']['server']['vfs_image_dir']) && Vfs::file_exists($dir) && Vfs::is_readable($dir))
207 207
 		{
208
-			foreach(Vfs::find($dir) as $img)
208
+			foreach (Vfs::find($dir) as $img)
209 209
 			{
210 210
 				if (!in_array($ext = self::get_extension($img, $name), $img_types) || empty($name)) continue;
211 211
 
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 			return $map;
221 221
 		}
222 222
 		//error_log(__METHOD__."('$template_set') took ".(microtime(true)-$starttime).' secs');
223
-		Cache::setInstance(__CLASS__, $cache_name, $map, 86400);	// cache for one day
223
+		Cache::setInstance(__CLASS__, $cache_name, $map, 86400); // cache for one day
224 224
 		//echo "<p>template_set=".array2string($template_set)."</p>\n"; _debug_array($map);
225 225
 		return $map;
226 226
 	}
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 			$templates[] = $template_set;
237 237
 		}
238 238
 		//error_log(__METHOD__."() for templates ".array2string($templates));
239
-		foreach($templates as $template_set)
239
+		foreach ($templates as $template_set)
240 240
 		{
241 241
 			Cache::unsetInstance(__CLASS__, 'image_map_'.$template_set);
242 242
 			Cache::unsetInstance(__CLASS__, 'image_map_'.$template_set.'_svg');
Please login to merge, or discard this 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/Imap/Cyrus.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
 	function deleteAccount($_hookValues)
63 63
 	{
64 64
 		// some precausion to really delete just _one_ account
65
-		if (strpos($_hookValues['account_lid'],'%') !== false ||
66
-			strpos($_hookValues['account_lid'],'*') !== false)
65
+		if (strpos($_hookValues['account_lid'], '%') !== false ||
66
+			strpos($_hookValues['account_lid'], '*') !== false)
67 67
 		{
68 68
 			return false;
69 69
 		}
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
 	 * @return string $username='%' username containing wildcards, default '%' for all users of a domain
79 79
 	 * @return int|boolean number of deleted mailboxes on success or false on error
80 80
 	 */
81
-	function deleteUsers($username='%')
81
+	function deleteUsers($username = '%')
82 82
 	{
83
-		if(!$this->acc_imap_administration || empty($username))
83
+		if (!$this->acc_imap_administration || empty($username))
84 84
 		{
85 85
 			return false;
86 86
 		}
@@ -94,14 +94,14 @@  discard block
 block discarded – undo
94 94
 			$mboxes = (array)$this->getMailboxes($mailboxName, 1);
95 95
 			//error_log(__METHOD__."('$username') getMailboxes('$reference','$username$restriction') = ".array2string($mboxes));
96 96
 
97
-			foreach(array_keys($mboxes) as $mbox)
97
+			foreach (array_keys($mboxes) as $mbox)
98 98
 			{
99 99
 				// give the admin account the rights to delete this mailbox
100 100
 				$this->setACL($mbox, $this->acc_imap_admin_username, array('rights' => 'aeiklprstwx'));
101 101
 				$this->deleteMailbox($mbox);
102 102
 			}
103 103
 		}
104
-		catch(Horde_Imap_Client_Exception $e) {
104
+		catch (Horde_Imap_Client_Exception $e) {
105 105
 			_egw_log_exception($e);
106 106
 			$this->disconnect();
107 107
 			return false;
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 		if ($_username !== $GLOBALS['egw_info']['user']['account_lid']) $this->adminConnection();
125 125
 		$userData = array();
126 126
 
127
-		if(($quota = $this->getQuotaByUser($_username,'ALL')))
127
+		if (($quota = $this->getQuotaByUser($_username, 'ALL')))
128 128
 		{
129 129
 			$userData['quotaLimit'] = (int)($quota['limit'] / 1024);
130 130
 			$userData['quotaUsed'] = (int)($quota['usage'] / 1024);
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	 */
146 146
 	function setUserData($_username, $_quota)
147 147
 	{
148
-		if(!$this->acc_imap_administration)
148
+		if (!$this->acc_imap_administration)
149 149
 		{
150 150
 			return false;
151 151
 		}
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 
156 156
 		$mailboxName = $this->getUserMailboxString($_username);
157 157
 
158
-		$this->setQuota($mailboxName, array('STORAGE' => (int)$_quota > 0 ? (int)$_quota*1024 : -1));
158
+		$this->setQuota($mailboxName, array('STORAGE' => (int)$_quota > 0 ? (int)$_quota * 1024 : -1));
159 159
 
160 160
 		$this->disconnect();
161 161
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 	 */
170 170
 	function updateAccount($_hookValues)
171 171
 	{
172
-		if(!$this->acc_imap_administration)
172
+		if (!$this->acc_imap_administration)
173 173
 		{
174 174
 			return false;
175 175
 		}
@@ -182,14 +182,14 @@  discard block
 block discarded – undo
182 182
 		// make sure we use the correct username here.
183 183
 		$username = $this->getMailBoxUserName($_hookValues['account_lid']);
184 184
 		$folderInfo = $this->getMailboxes('', $mailboxName, true);
185
-		if(empty($folderInfo))
185
+		if (empty($folderInfo))
186 186
 		{
187 187
 			try {
188 188
 				$this->createMailbox($mailboxName);
189 189
 				$this->setACL($mailboxName, $username, array('rights' => 'aeiklprstwx'));
190 190
 				// create defined folders and subscribe them (have to use user-credentials to subscribe!)
191 191
 				$userimap = null;
192
-				foreach($this->params as $name => $value)
192
+				foreach ($this->params as $name => $value)
193 193
 				{
194 194
 					if (substr($name, 0, 11) == 'acc_folder_' && !empty($value))
195 195
 					{
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 				}
207 207
 				if (isset($userimap)) $userimap->logout();
208 208
 			}
209
-			catch(Horde_Imap_Client_Exception $e) {
209
+			catch (Horde_Imap_Client_Exception $e) {
210 210
 				_egw_log_exception($e);
211 211
 			}
212 212
 		}
@@ -220,9 +220,9 @@  discard block
 block discarded – undo
220 220
 	 * @param array $params
221 221
 	 * @throws Exception
222 222
 	 */
223
-	public function __call($name,array $params=null)
223
+	public function __call($name, array $params = null)
224 224
 	{
225
-		switch($name)
225
+		switch ($name)
226 226
 		{
227 227
 			case 'setRules':	// call setRules with 3. param of true, to enable utf7imap fileinto for Cyrus
228 228
 				$params += array(null, null, true);
Please login to merge, or discard this patch.
Braces   +12 added lines, -3 removed lines patch added patch discarded remove patch
@@ -121,7 +121,10 @@  discard block
 block discarded – undo
121 121
 	function getUserData($_username)
122 122
 	{
123 123
 		// no need to switch to admin-connection for reading quota of current user
124
-		if ($_username !== $GLOBALS['egw_info']['user']['account_lid']) $this->adminConnection();
124
+		if ($_username !== $GLOBALS['egw_info']['user']['account_lid'])
125
+		{
126
+			$this->adminConnection();
127
+		}
125 128
 		$userData = array();
126 129
 
127 130
 		if(($quota = $this->getQuotaByUser($_username,'ALL')))
@@ -131,7 +134,10 @@  discard block
 block discarded – undo
131 134
 		}
132 135
 		//error_log(__LINE__.': '.__METHOD__."('$_username') quota=".array2string($quota).' returning '.array2string($userData));
133 136
 
134
-		if ($_username !== $GLOBALS['egw_info']['user']['account_lid']) $this->disconnect();
137
+		if ($_username !== $GLOBALS['egw_info']['user']['account_lid'])
138
+		{
139
+			$this->disconnect();
140
+		}
135 141
 
136 142
 		return $userData;
137 143
 	}
@@ -204,7 +210,10 @@  discard block
 block discarded – undo
204 210
 						$userimap->subscribeMailbox($value);
205 211
 					}
206 212
 				}
207
-				if (isset($userimap)) $userimap->logout();
213
+				if (isset($userimap))
214
+				{
215
+					$userimap->logout();
216
+				}
208 217
 			}
209 218
 			catch(Horde_Imap_Client_Exception $e) {
210 219
 				_egw_log_exception($e);
Please login to merge, or discard this patch.
api/src/Mail/Imap/Dbmailuser.php 2 patches
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -47,16 +47,16 @@  discard block
 block discarded – undo
47 47
 
48 48
 		$ds = Ldap::factory();
49 49
 
50
-		if(!is_resource($ds)) {
50
+		if (!is_resource($ds)) {
51 51
 			return false;
52 52
 		}
53 53
 
54
-		$filter		= '(&(objectclass=posixaccount)(uid='. $_username .')(dbmailGID='. sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id'])) .'))';
54
+		$filter		= '(&(objectclass=posixaccount)(uid='.$_username.')(dbmailGID='.sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id'])).'))';
55 55
 		$justthese	= array('dn', 'objectclass', 'mailQuota');
56
-		if(($sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese))) {
56
+		if (($sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese))) {
57 57
 
58
-			if(($info = ldap_get_entries($ds, $sri))) {
59
-				if(isset($info[0]['mailquota'][0])) {
58
+			if (($info = ldap_get_entries($ds, $sri))) {
59
+				if (isset($info[0]['mailquota'][0])) {
60 60
 					$userData['quotaLimit'] = $info[0]['mailquota'][0] / 1048576;
61 61
 				}
62 62
 			}
@@ -66,40 +66,40 @@  discard block
 block discarded – undo
66 66
 
67 67
 	function updateAccount($_hookValues)
68 68
 	{
69
-		if(!$uidnumber = (int)$_hookValues['account_id']) {
69
+		if (!$uidnumber = (int)$_hookValues['account_id']) {
70 70
 			return false;
71 71
 		}
72 72
 
73 73
 		$ds = Ldap::factory();
74 74
 
75
-		if(!is_resource($ds)) {
75
+		if (!is_resource($ds)) {
76 76
 			return false;
77 77
 		}
78 78
 
79
-		$filter		= '(&(objectclass=posixaccount)(uidnumber='. $uidnumber .'))';
80
-		$justthese	= array('dn', 'objectclass', 'dbmailUID', 'dbmailGID', 'mail');
79
+		$filter = '(&(objectclass=posixaccount)(uidnumber='.$uidnumber.'))';
80
+		$justthese = array('dn', 'objectclass', 'dbmailUID', 'dbmailGID', 'mail');
81 81
 		$sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese);
82 82
 
83
-		if(($info = ldap_get_entries($ds, $sri))) {
84
-			if((!in_array('dbmailuser',$info[0]['objectclass']) && !in_array('dbmailUser',$info[0]['objectclass'])) && $info[0]['mail']) {
83
+		if (($info = ldap_get_entries($ds, $sri))) {
84
+			if ((!in_array('dbmailuser', $info[0]['objectclass']) && !in_array('dbmailUser', $info[0]['objectclass'])) && $info[0]['mail']) {
85 85
 				$newData['objectclass'] = $info[0]['objectclass'];
86 86
 				unset($newData['objectclass']['count']);
87 87
 				$newData['objectclass'][] = 'dbmailuser';
88 88
 				sort($newData['objectclass']);
89 89
 				$newData['dbmailGID']	= sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
90
-				$newData['dbmailUID']	= (!empty($this->domainName)) ? $_hookValues['account_lid'] .'@'. $this->domainName : $_hookValues['account_lid'];
90
+				$newData['dbmailUID']	= (!empty($this->domainName)) ? $_hookValues['account_lid'].'@'.$this->domainName : $_hookValues['account_lid'];
91 91
 
92
-				if(!ldap_modify($ds, $info[0]['dn'], $newData)) {
92
+				if (!ldap_modify($ds, $info[0]['dn'], $newData)) {
93 93
 					#print ldap_error($ds);
94 94
 				}
95 95
 
96 96
 				return true;
97 97
 			} else {
98 98
 				$newData = array();
99
-				$newData['dbmailUID']	= (!empty($this->domainName)) ? $_hookValues['account_lid'] .'@'. $this->domainName : $_hookValues['account_lid'];
99
+				$newData['dbmailUID']	= (!empty($this->domainName)) ? $_hookValues['account_lid'].'@'.$this->domainName : $_hookValues['account_lid'];
100 100
 				$newData['dbmailGID']	= sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
101 101
 
102
-				if(!ldap_modify($ds, $info[0]['dn'], $newData)) {
102
+				if (!ldap_modify($ds, $info[0]['dn'], $newData)) {
103 103
 					print ldap_error($ds);
104 104
 					_debug_array($newData);
105 105
 					exit;
@@ -115,63 +115,63 @@  discard block
 block discarded – undo
115 115
 	{
116 116
 		$ds = Ldap::factory();
117 117
 
118
-		if(!is_resource($ds)) {
118
+		if (!is_resource($ds)) {
119 119
 			return false;
120 120
 		}
121 121
 
122
-		$filter		= '(&(objectclass=posixaccount)(uid='. $_username .'))';
123
-		$justthese	= array('dn', 'objectclass', 'dbmailGID', 'dbmailUID', 'mail');
122
+		$filter = '(&(objectclass=posixaccount)(uid='.$_username.'))';
123
+		$justthese = array('dn', 'objectclass', 'dbmailGID', 'dbmailUID', 'mail');
124 124
 		$sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese);
125 125
 
126
-		if(($info = ldap_get_entries($ds, $sri))) {
126
+		if (($info = ldap_get_entries($ds, $sri))) {
127 127
 			$validLDAPConfig = false;
128
-			if(in_array('dbmailuser',$info[0]['objectclass']) || in_array('dbmailUser',$info[0]['objectclass'])) {
128
+			if (in_array('dbmailuser', $info[0]['objectclass']) || in_array('dbmailUser', $info[0]['objectclass'])) {
129 129
 				$validLDAPConfig = true;
130 130
 			}
131 131
 
132
-			if(!in_array('dbmailuser',$info[0]['objectclass']) && !in_array('dbmailUser',$info[0]['objectclass']) && $info[0]['mail']) {
132
+			if (!in_array('dbmailuser', $info[0]['objectclass']) && !in_array('dbmailUser', $info[0]['objectclass']) && $info[0]['mail']) {
133 133
 				$newData['objectclass'] = $info[0]['objectclass'];
134 134
 				unset($newData['objectclass']['count']);
135 135
 				$newData['objectclass'][] = 'dbmailUser';
136 136
 				sort($newData['objectclass']);
137 137
 				$newData['dbmailGID']	= sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
138
-				$newData['dbmailUID']	= (!empty($this->domainName)) ? $_username .'@'. $this->domainName : $_username;
138
+				$newData['dbmailUID']	= (!empty($this->domainName)) ? $_username.'@'.$this->domainName : $_username;
139 139
 
140
-				if(ldap_modify($ds, $info[0]['dn'], $newData)) {
140
+				if (ldap_modify($ds, $info[0]['dn'], $newData)) {
141 141
 					$validLDAPConfig = true;
142 142
 				}
143 143
 			} else {
144
-				if ((in_array('dbmailuser',$info[0]['objectclass']) || in_array('dbmailUser',$info[0]['objectclass'])) && !$info[0]['dbmailuid']) {
144
+				if ((in_array('dbmailuser', $info[0]['objectclass']) || in_array('dbmailUser', $info[0]['objectclass'])) && !$info[0]['dbmailuid']) {
145 145
 					$newData = array();
146
-					$newData['dbmailUID']	= (!empty($this->domainName)) ? $_username .'@'. $this->domainName : $_username;
146
+					$newData['dbmailUID'] = (!empty($this->domainName)) ? $_username.'@'.$this->domainName : $_username;
147 147
 
148
-					if(!ldap_modify($ds, $info[0]['dn'], $newData)) {
148
+					if (!ldap_modify($ds, $info[0]['dn'], $newData)) {
149 149
 						#print ldap_error($ds);
150 150
 						#return false;
151 151
 					}
152 152
 				}
153 153
 
154
-				if ((in_array('dbmailuser',$info[0]['objectclass']) || in_array('dbmailUser',$info[0]['objectclass'])) && !$info[0]['dbmailgid']) {
154
+				if ((in_array('dbmailuser', $info[0]['objectclass']) || in_array('dbmailUser', $info[0]['objectclass'])) && !$info[0]['dbmailgid']) {
155 155
 					$newData = array();
156
-					$newData['dbmailGID']	= sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
156
+					$newData['dbmailGID'] = sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
157 157
 
158
-					if(!ldap_modify($ds, $info[0]['dn'], $newData)) {
158
+					if (!ldap_modify($ds, $info[0]['dn'], $newData)) {
159 159
 						#print ldap_error($ds);
160 160
 						#return false;
161 161
 					}
162 162
 				}
163 163
 			}
164 164
 
165
-			if($validLDAPConfig) {
165
+			if ($validLDAPConfig) {
166 166
 				$newData = array();
167 167
 
168
-				if((int)$_quota >= 0) {
168
+				if ((int)$_quota >= 0) {
169 169
 					$newData['mailQuota'] = (int)$_quota * 1048576;
170 170
 				} else {
171 171
 					$newData['mailQuota'] = array();
172 172
 				}
173 173
 
174
-				if(!ldap_modify($ds, $info[0]['dn'], $newData)) {
174
+				if (!ldap_modify($ds, $info[0]['dn'], $newData)) {
175 175
 					#print ldap_error($ds);
176 176
 					return false;
177 177
 				}
Please login to merge, or discard this patch.
Braces   +53 added lines, -25 removed lines patch added patch discarded remove patch
@@ -47,16 +47,20 @@  discard block
 block discarded – undo
47 47
 
48 48
 		$ds = Ldap::factory();
49 49
 
50
-		if(!is_resource($ds)) {
50
+		if(!is_resource($ds))
51
+		{
51 52
 			return false;
52 53
 		}
53 54
 
54 55
 		$filter		= '(&(objectclass=posixaccount)(uid='. $_username .')(dbmailGID='. sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id'])) .'))';
55 56
 		$justthese	= array('dn', 'objectclass', 'mailQuota');
56
-		if(($sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese))) {
57
+		if(($sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese)))
58
+		{
57 59
 
58
-			if(($info = ldap_get_entries($ds, $sri))) {
59
-				if(isset($info[0]['mailquota'][0])) {
60
+			if(($info = ldap_get_entries($ds, $sri)))
61
+			{
62
+				if(isset($info[0]['mailquota'][0]))
63
+				{
60 64
 					$userData['quotaLimit'] = $info[0]['mailquota'][0] / 1048576;
61 65
 				}
62 66
 			}
@@ -66,13 +70,15 @@  discard block
 block discarded – undo
66 70
 
67 71
 	function updateAccount($_hookValues)
68 72
 	{
69
-		if(!$uidnumber = (int)$_hookValues['account_id']) {
73
+		if(!$uidnumber = (int)$_hookValues['account_id'])
74
+		{
70 75
 			return false;
71 76
 		}
72 77
 
73 78
 		$ds = Ldap::factory();
74 79
 
75
-		if(!is_resource($ds)) {
80
+		if(!is_resource($ds))
81
+		{
76 82
 			return false;
77 83
 		}
78 84
 
@@ -80,8 +86,10 @@  discard block
 block discarded – undo
80 86
 		$justthese	= array('dn', 'objectclass', 'dbmailUID', 'dbmailGID', 'mail');
81 87
 		$sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese);
82 88
 
83
-		if(($info = ldap_get_entries($ds, $sri))) {
84
-			if((!in_array('dbmailuser',$info[0]['objectclass']) && !in_array('dbmailUser',$info[0]['objectclass'])) && $info[0]['mail']) {
89
+		if(($info = ldap_get_entries($ds, $sri)))
90
+		{
91
+			if((!in_array('dbmailuser',$info[0]['objectclass']) && !in_array('dbmailUser',$info[0]['objectclass'])) && $info[0]['mail'])
92
+			{
85 93
 				$newData['objectclass'] = $info[0]['objectclass'];
86 94
 				unset($newData['objectclass']['count']);
87 95
 				$newData['objectclass'][] = 'dbmailuser';
@@ -89,17 +97,21 @@  discard block
 block discarded – undo
89 97
 				$newData['dbmailGID']	= sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
90 98
 				$newData['dbmailUID']	= (!empty($this->domainName)) ? $_hookValues['account_lid'] .'@'. $this->domainName : $_hookValues['account_lid'];
91 99
 
92
-				if(!ldap_modify($ds, $info[0]['dn'], $newData)) {
100
+				if(!ldap_modify($ds, $info[0]['dn'], $newData))
101
+				{
93 102
 					#print ldap_error($ds);
94 103
 				}
95 104
 
96 105
 				return true;
97
-			} else {
106
+			}
107
+			else
108
+			{
98 109
 				$newData = array();
99 110
 				$newData['dbmailUID']	= (!empty($this->domainName)) ? $_hookValues['account_lid'] .'@'. $this->domainName : $_hookValues['account_lid'];
100 111
 				$newData['dbmailGID']	= sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
101 112
 
102
-				if(!ldap_modify($ds, $info[0]['dn'], $newData)) {
113
+				if(!ldap_modify($ds, $info[0]['dn'], $newData))
114
+				{
103 115
 					print ldap_error($ds);
104 116
 					_debug_array($newData);
105 117
 					exit;
@@ -115,7 +127,8 @@  discard block
 block discarded – undo
115 127
 	{
116 128
 		$ds = Ldap::factory();
117 129
 
118
-		if(!is_resource($ds)) {
130
+		if(!is_resource($ds))
131
+		{
119 132
 			return false;
120 133
 		}
121 134
 
@@ -123,13 +136,16 @@  discard block
 block discarded – undo
123 136
 		$justthese	= array('dn', 'objectclass', 'dbmailGID', 'dbmailUID', 'mail');
124 137
 		$sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese);
125 138
 
126
-		if(($info = ldap_get_entries($ds, $sri))) {
139
+		if(($info = ldap_get_entries($ds, $sri)))
140
+		{
127 141
 			$validLDAPConfig = false;
128
-			if(in_array('dbmailuser',$info[0]['objectclass']) || in_array('dbmailUser',$info[0]['objectclass'])) {
142
+			if(in_array('dbmailuser',$info[0]['objectclass']) || in_array('dbmailUser',$info[0]['objectclass']))
143
+			{
129 144
 				$validLDAPConfig = true;
130 145
 			}
131 146
 
132
-			if(!in_array('dbmailuser',$info[0]['objectclass']) && !in_array('dbmailUser',$info[0]['objectclass']) && $info[0]['mail']) {
147
+			if(!in_array('dbmailuser',$info[0]['objectclass']) && !in_array('dbmailUser',$info[0]['objectclass']) && $info[0]['mail'])
148
+			{
133 149
 				$newData['objectclass'] = $info[0]['objectclass'];
134 150
 				unset($newData['objectclass']['count']);
135 151
 				$newData['objectclass'][] = 'dbmailUser';
@@ -137,41 +153,53 @@  discard block
 block discarded – undo
137 153
 				$newData['dbmailGID']	= sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
138 154
 				$newData['dbmailUID']	= (!empty($this->domainName)) ? $_username .'@'. $this->domainName : $_username;
139 155
 
140
-				if(ldap_modify($ds, $info[0]['dn'], $newData)) {
156
+				if(ldap_modify($ds, $info[0]['dn'], $newData))
157
+				{
141 158
 					$validLDAPConfig = true;
142 159
 				}
143
-			} else {
144
-				if ((in_array('dbmailuser',$info[0]['objectclass']) || in_array('dbmailUser',$info[0]['objectclass'])) && !$info[0]['dbmailuid']) {
160
+			}
161
+			else
162
+			{
163
+				if ((in_array('dbmailuser',$info[0]['objectclass']) || in_array('dbmailUser',$info[0]['objectclass'])) && !$info[0]['dbmailuid'])
164
+				{
145 165
 					$newData = array();
146 166
 					$newData['dbmailUID']	= (!empty($this->domainName)) ? $_username .'@'. $this->domainName : $_username;
147 167
 
148
-					if(!ldap_modify($ds, $info[0]['dn'], $newData)) {
168
+					if(!ldap_modify($ds, $info[0]['dn'], $newData))
169
+					{
149 170
 						#print ldap_error($ds);
150 171
 						#return false;
151 172
 					}
152 173
 				}
153 174
 
154
-				if ((in_array('dbmailuser',$info[0]['objectclass']) || in_array('dbmailUser',$info[0]['objectclass'])) && !$info[0]['dbmailgid']) {
175
+				if ((in_array('dbmailuser',$info[0]['objectclass']) || in_array('dbmailUser',$info[0]['objectclass'])) && !$info[0]['dbmailgid'])
176
+				{
155 177
 					$newData = array();
156 178
 					$newData['dbmailGID']	= sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
157 179
 
158
-					if(!ldap_modify($ds, $info[0]['dn'], $newData)) {
180
+					if(!ldap_modify($ds, $info[0]['dn'], $newData))
181
+					{
159 182
 						#print ldap_error($ds);
160 183
 						#return false;
161 184
 					}
162 185
 				}
163 186
 			}
164 187
 
165
-			if($validLDAPConfig) {
188
+			if($validLDAPConfig)
189
+			{
166 190
 				$newData = array();
167 191
 
168
-				if((int)$_quota >= 0) {
192
+				if((int)$_quota >= 0)
193
+				{
169 194
 					$newData['mailQuota'] = (int)$_quota * 1048576;
170
-				} else {
195
+				}
196
+				else
197
+				{
171 198
 					$newData['mailQuota'] = array();
172 199
 				}
173 200
 
174
-				if(!ldap_modify($ds, $info[0]['dn'], $newData)) {
201
+				if(!ldap_modify($ds, $info[0]['dn'], $newData))
202
+				{
175 203
 					#print ldap_error($ds);
176 204
 					return false;
177 205
 				}
Please login to merge, or discard this patch.
api/src/Mail/Imap/Dbmailqmailuser.php 2 patches
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -47,16 +47,16 @@  discard block
 block discarded – undo
47 47
 
48 48
 		$ds = Ldap::factory();
49 49
 
50
-		if(!is_resource($ds)) {
50
+		if (!is_resource($ds)) {
51 51
 			return false;
52 52
 		}
53 53
 
54
-		$filter		= '(&(objectclass=posixaccount)(uid='. $_username .')(qmailGID='. sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id'])) .'))';
54
+		$filter		= '(&(objectclass=posixaccount)(uid='.$_username.')(qmailGID='.sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id'])).'))';
55 55
 		$justthese	= array('dn', 'objectclass', 'mailQuota');
56
-		if(($sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese))) {
56
+		if (($sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese))) {
57 57
 
58
-			if(($info = ldap_get_entries($ds, $sri))) {
59
-				if(isset($info[0]['mailquota'][0])) {
58
+			if (($info = ldap_get_entries($ds, $sri))) {
59
+				if (isset($info[0]['mailquota'][0])) {
60 60
 					$userData['quotaLimit'] = $info[0]['mailquota'][0] / 1048576;
61 61
 				}
62 62
 			}
@@ -65,27 +65,27 @@  discard block
 block discarded – undo
65 65
 	}
66 66
 
67 67
 	function updateAccount($_hookValues) {
68
-		if(!$uidnumber = (int)$_hookValues['account_id']) {
68
+		if (!$uidnumber = (int)$_hookValues['account_id']) {
69 69
 			return false;
70 70
 		}
71 71
 
72 72
 		$ds = Ldap::factory();
73 73
 
74
-		if(!is_resource($ds)) {
74
+		if (!is_resource($ds)) {
75 75
 			return false;
76 76
 		}
77 77
 
78
-		$filter		= '(&(objectclass=posixaccount)(uidnumber='. $uidnumber .'))';
79
-		$justthese	= array('dn', 'objectclass', 'qmailUID', 'qmailGID', 'mail');
78
+		$filter = '(&(objectclass=posixaccount)(uidnumber='.$uidnumber.'))';
79
+		$justthese = array('dn', 'objectclass', 'qmailUID', 'qmailGID', 'mail');
80 80
 		$sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese);
81 81
 
82
-		if(($info = ldap_get_entries($ds, $sri))) {
83
-			if(!in_array('qmailuser',$info[0]['objectclass']) && $info[0]['email']) {
82
+		if (($info = ldap_get_entries($ds, $sri))) {
83
+			if (!in_array('qmailuser', $info[0]['objectclass']) && $info[0]['email']) {
84 84
 				$newData['objectclass'] = $info[0]['objectclass'];
85 85
 				unset($newData['objectclass']['count']);
86 86
 				$newData['objectclass'][] = 'qmailuser';
87 87
 				sort($newData['objectclass']);
88
-				$newData['qmailGID']	= sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
88
+				$newData['qmailGID'] = sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
89 89
 				#$newData['qmailUID']	= (!empty($this->domainName)) ? $_username .'@'. $this->domainName : $_username;
90 90
 
91 91
 				ldap_modify($ds, $info[0]['dn'], $newData);
@@ -93,10 +93,10 @@  discard block
 block discarded – undo
93 93
 				return true;
94 94
 			} else {
95 95
 				$newData = array();
96
-				$newData['qmailGID']	= sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
96
+				$newData['qmailGID'] = sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
97 97
 				#$newData['qmailUID']	= (!empty($this->domainName)) ? $_username .'@'. $this->domainName : $_username;
98 98
 
99
-				if(!ldap_modify($ds, $info[0]['dn'], $newData)) {
99
+				if (!ldap_modify($ds, $info[0]['dn'], $newData)) {
100 100
 					#print ldap_error($ds);
101 101
 					#return false;
102 102
 				}
@@ -109,30 +109,30 @@  discard block
 block discarded – undo
109 109
 	function setUserData($_username, $_quota) {
110 110
 		$ds = Ldap::factory();
111 111
 
112
-		if(!is_resource($ds)) {
112
+		if (!is_resource($ds)) {
113 113
 			return false;
114 114
 		}
115 115
 
116
-		$filter		= '(&(objectclass=posixaccount)(uid='. $_username .'))';
117
-		$justthese	= array('dn', 'objectclass', 'qmailGID', 'mail');
116
+		$filter = '(&(objectclass=posixaccount)(uid='.$_username.'))';
117
+		$justthese = array('dn', 'objectclass', 'qmailGID', 'mail');
118 118
 		$sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese);
119 119
 
120
-		if(($info = ldap_get_entries($ds, $sri))) {
120
+		if (($info = ldap_get_entries($ds, $sri))) {
121 121
 			#_debug_array($info);
122
-			if(!in_array('qmailuser',$info[0]['objectclass']) && $info[0]['email']) {
122
+			if (!in_array('qmailuser', $info[0]['objectclass']) && $info[0]['email']) {
123 123
 				$newData['objectclass'] = $info[0]['objectclass'];
124 124
 				unset($newData['objectclass']['count']);
125 125
 				$newData['objectclass'][] = 'qmailuser';
126 126
 				sort($newData['objectclass']);
127
-				$newData['qmailGID']	= sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
127
+				$newData['qmailGID'] = sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
128 128
 
129 129
 				ldap_modify($ds, $info[0]['dn'], $newData);
130 130
 			} else {
131
-				if (in_array('qmailuser',$info[0]['objectclass']) && !$info[0]['qmailgid']) {
131
+				if (in_array('qmailuser', $info[0]['objectclass']) && !$info[0]['qmailgid']) {
132 132
 					$newData = array();
133
-					$newData['qmailGID']	= sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
133
+					$newData['qmailGID'] = sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
134 134
 
135
-					if(!ldap_modify($ds, $info[0]['dn'], $newData)) {
135
+					if (!ldap_modify($ds, $info[0]['dn'], $newData)) {
136 136
 						#print ldap_error($ds);
137 137
 						#return false;
138 138
 					}
@@ -141,13 +141,13 @@  discard block
 block discarded – undo
141 141
 
142 142
 			$newData = array();
143 143
 
144
-			if((int)$_quota >= 0) {
144
+			if ((int)$_quota >= 0) {
145 145
 				$newData['mailQuota'] = (int)$_quota * 1048576;
146 146
 			} else {
147 147
 				$newData['mailQuota'] = array();
148 148
 			}
149 149
 
150
-			if(!ldap_modify($ds, $info[0]['dn'], $newData)) {
150
+			if (!ldap_modify($ds, $info[0]['dn'], $newData)) {
151 151
 				#print ldap_error($ds);
152 152
 				return false;
153 153
 			}
Please login to merge, or discard this patch.
Braces   +45 added lines, -21 removed lines patch added patch discarded remove patch
@@ -47,16 +47,20 @@  discard block
 block discarded – undo
47 47
 
48 48
 		$ds = Ldap::factory();
49 49
 
50
-		if(!is_resource($ds)) {
50
+		if(!is_resource($ds))
51
+		{
51 52
 			return false;
52 53
 		}
53 54
 
54 55
 		$filter		= '(&(objectclass=posixaccount)(uid='. $_username .')(qmailGID='. sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id'])) .'))';
55 56
 		$justthese	= array('dn', 'objectclass', 'mailQuota');
56
-		if(($sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese))) {
57
+		if(($sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese)))
58
+		{
57 59
 
58
-			if(($info = ldap_get_entries($ds, $sri))) {
59
-				if(isset($info[0]['mailquota'][0])) {
60
+			if(($info = ldap_get_entries($ds, $sri)))
61
+			{
62
+				if(isset($info[0]['mailquota'][0]))
63
+				{
60 64
 					$userData['quotaLimit'] = $info[0]['mailquota'][0] / 1048576;
61 65
 				}
62 66
 			}
@@ -64,14 +68,17 @@  discard block
 block discarded – undo
64 68
 		return $userData;
65 69
 	}
66 70
 
67
-	function updateAccount($_hookValues) {
68
-		if(!$uidnumber = (int)$_hookValues['account_id']) {
71
+	function updateAccount($_hookValues)
72
+	{
73
+		if(!$uidnumber = (int)$_hookValues['account_id'])
74
+		{
69 75
 			return false;
70 76
 		}
71 77
 
72 78
 		$ds = Ldap::factory();
73 79
 
74
-		if(!is_resource($ds)) {
80
+		if(!is_resource($ds))
81
+		{
75 82
 			return false;
76 83
 		}
77 84
 
@@ -79,8 +86,10 @@  discard block
 block discarded – undo
79 86
 		$justthese	= array('dn', 'objectclass', 'qmailUID', 'qmailGID', 'mail');
80 87
 		$sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese);
81 88
 
82
-		if(($info = ldap_get_entries($ds, $sri))) {
83
-			if(!in_array('qmailuser',$info[0]['objectclass']) && $info[0]['email']) {
89
+		if(($info = ldap_get_entries($ds, $sri)))
90
+		{
91
+			if(!in_array('qmailuser',$info[0]['objectclass']) && $info[0]['email'])
92
+			{
84 93
 				$newData['objectclass'] = $info[0]['objectclass'];
85 94
 				unset($newData['objectclass']['count']);
86 95
 				$newData['objectclass'][] = 'qmailuser';
@@ -91,12 +100,15 @@  discard block
 block discarded – undo
91 100
 				ldap_modify($ds, $info[0]['dn'], $newData);
92 101
 
93 102
 				return true;
94
-			} else {
103
+			}
104
+			else
105
+			{
95 106
 				$newData = array();
96 107
 				$newData['qmailGID']	= sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
97 108
 				#$newData['qmailUID']	= (!empty($this->domainName)) ? $_username .'@'. $this->domainName : $_username;
98 109
 
99
-				if(!ldap_modify($ds, $info[0]['dn'], $newData)) {
110
+				if(!ldap_modify($ds, $info[0]['dn'], $newData))
111
+				{
100 112
 					#print ldap_error($ds);
101 113
 					#return false;
102 114
 				}
@@ -106,10 +118,12 @@  discard block
 block discarded – undo
106 118
 		return false;
107 119
 	}
108 120
 
109
-	function setUserData($_username, $_quota) {
121
+	function setUserData($_username, $_quota)
122
+	{
110 123
 		$ds = Ldap::factory();
111 124
 
112
-		if(!is_resource($ds)) {
125
+		if(!is_resource($ds))
126
+		{
113 127
 			return false;
114 128
 		}
115 129
 
@@ -117,9 +131,11 @@  discard block
 block discarded – undo
117 131
 		$justthese	= array('dn', 'objectclass', 'qmailGID', 'mail');
118 132
 		$sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese);
119 133
 
120
-		if(($info = ldap_get_entries($ds, $sri))) {
134
+		if(($info = ldap_get_entries($ds, $sri)))
135
+		{
121 136
 			#_debug_array($info);
122
-			if(!in_array('qmailuser',$info[0]['objectclass']) && $info[0]['email']) {
137
+			if(!in_array('qmailuser',$info[0]['objectclass']) && $info[0]['email'])
138
+			{
123 139
 				$newData['objectclass'] = $info[0]['objectclass'];
124 140
 				unset($newData['objectclass']['count']);
125 141
 				$newData['objectclass'][] = 'qmailuser';
@@ -127,12 +143,16 @@  discard block
 block discarded – undo
127 143
 				$newData['qmailGID']	= sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
128 144
 
129 145
 				ldap_modify($ds, $info[0]['dn'], $newData);
130
-			} else {
131
-				if (in_array('qmailuser',$info[0]['objectclass']) && !$info[0]['qmailgid']) {
146
+			}
147
+			else
148
+			{
149
+				if (in_array('qmailuser',$info[0]['objectclass']) && !$info[0]['qmailgid'])
150
+				{
132 151
 					$newData = array();
133 152
 					$newData['qmailGID']	= sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
134 153
 
135
-					if(!ldap_modify($ds, $info[0]['dn'], $newData)) {
154
+					if(!ldap_modify($ds, $info[0]['dn'], $newData))
155
+					{
136 156
 						#print ldap_error($ds);
137 157
 						#return false;
138 158
 					}
@@ -141,13 +161,17 @@  discard block
 block discarded – undo
141 161
 
142 162
 			$newData = array();
143 163
 
144
-			if((int)$_quota >= 0) {
164
+			if((int)$_quota >= 0)
165
+			{
145 166
 				$newData['mailQuota'] = (int)$_quota * 1048576;
146
-			} else {
167
+			}
168
+			else
169
+			{
147 170
 				$newData['mailQuota'] = array();
148 171
 			}
149 172
 
150
-			if(!ldap_modify($ds, $info[0]['dn'], $newData)) {
173
+			if(!ldap_modify($ds, $info[0]['dn'], $newData))
174
+			{
151 175
 				#print ldap_error($ds);
152 176
 				return false;
153 177
 			}
Please login to merge, or discard this patch.
api/src/Mail/Imap/Dovecot.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	 *
57 57
 	 * @var string
58 58
 	 */
59
-	var $user_home;	// = '/var/dovecot/imap/%d/%u';
59
+	var $user_home; // = '/var/dovecot/imap/%d/%u';
60 60
 
61 61
 	/**
62 62
 	 * Ensure we use an admin connection
@@ -65,12 +65,12 @@  discard block
 block discarded – undo
65 65
 	 *
66 66
 	 * @param string $_username =true create an admin connection for given user or $this->acc_imap_username
67 67
 	 */
68
-	function adminConnection($_username=true)
68
+	function adminConnection($_username = true)
69 69
 	{
70 70
 		// generate admin user name of $username
71 71
 		if (($pos = strpos($this->acc_imap_admin_username, '*')) !== false)	// remove evtl. set username
72 72
 		{
73
-			$this->params['acc_imap_admin_username'] = substr($this->acc_imap_admin_username, $pos+1);
73
+			$this->params['acc_imap_admin_username'] = substr($this->acc_imap_admin_username, $pos + 1);
74 74
 		}
75 75
 		$this->params['acc_imap_admin_username'] = (is_string($_username) ? $_username : $this->acc_imap_username).
76 76
 			'*'.$this->acc_imap_admin_username;
@@ -87,16 +87,16 @@  discard block
 block discarded – undo
87 87
 	 * @param string $_folderName =''
88 88
 	 * @return string utf-7 encoded (done in getMailboxName)
89 89
 	 */
90
-	function getUserMailboxString($_username, $_folderName='')
90
+	function getUserMailboxString($_username, $_folderName = '')
91 91
 	{
92
-		unset($_username);	// not used, but required by function signature
92
+		unset($_username); // not used, but required by function signature
93 93
 
94 94
 		$mailboxString = 'INBOX';
95 95
 
96 96
 		if (!empty($_folderName))
97 97
 		{
98 98
 			$nameSpaces = $this->getNameSpaceArray();
99
-			$mailboxString .= $nameSpaces['others'][0]['delimiter'] . $_folderName;
99
+			$mailboxString .= $nameSpaces['others'][0]['delimiter'].$_folderName;
100 100
 		}
101 101
 		return $mailboxString;
102 102
 	}
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
 	function deleteAccount($_hookValues)
120 120
 	{
121 121
 		// some precausion to really delete just _one_ account
122
-		if (strpos($_hookValues['account_lid'],'%') !== false ||
123
-			strpos($_hookValues['account_lid'],'*') !== false)
122
+		if (strpos($_hookValues['account_lid'], '%') !== false ||
123
+			strpos($_hookValues['account_lid'], '*') !== false)
124 124
 		{
125 125
 			return false;
126 126
 		}
@@ -135,9 +135,9 @@  discard block
 block discarded – undo
135 135
 	 * @return string $username='%' username containing wildcards, default '%' for all users of a domain
136 136
 	 * @return int|boolean number of deleted mailboxes on success or false on error
137 137
 	 */
138
-	function deleteUsers($username='%')
138
+	function deleteUsers($username = '%')
139 139
 	{
140
-		if(!$this->acc_imap_administration || empty($username))
140
+		if (!$this->acc_imap_administration || empty($username))
141 141
 		{
142 142
 			return false;
143 143
 		}
@@ -155,9 +155,9 @@  discard block
 block discarded – undo
155 155
 			{
156 156
 				throw new Api\Exception\AssertionFailed("user_home='$this->user_home' contains no domain-part '%d'!");
157 157
 			}
158
-			$home = strtr(substr($this->user_home, 0, $pos+2), $replace);
158
+			$home = strtr(substr($this->user_home, 0, $pos + 2), $replace);
159 159
 
160
-			$ret = count(scandir($home))-2;
160
+			$ret = count(scandir($home)) - 2;
161 161
 		}
162 162
 		else
163 163
 		{
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 	{
184 184
 		if (is_dir($path))
185 185
 		{
186
-			foreach(scandir($path) as $file)
186
+			foreach (scandir($path) as $file)
187 187
 			{
188 188
 				if ($file == '.' || $file == '..') continue;
189 189
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 				return false;
202 202
 			}
203 203
 		}
204
-		elseif(!unlink($path))
204
+		elseif (!unlink($path))
205 205
 		{
206 206
 			return false;
207 207
 		}
@@ -235,10 +235,10 @@  discard block
 block discarded – undo
235 235
 
236 236
 		$userData = array();
237 237
 		// we are authenticated with master but for current user
238
-		if(($quota = $this->getStorageQuotaRoot('INBOX')))
238
+		if (($quota = $this->getStorageQuotaRoot('INBOX')))
239 239
 		{
240
-			$userData['quotaLimit'] = (int) ($quota['QMAX'] / 1024);
241
-			$userData['quotaUsed'] = (int) ($quota['USED'] / 1024);
240
+			$userData['quotaLimit'] = (int)($quota['QMAX'] / 1024);
241
+			$userData['quotaUsed'] = (int)($quota['USED'] / 1024);
242 242
 		}
243 243
 		$this->username = $bufferUsername;
244 244
 		$this->loginName = $bufferLoginName;
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 	 */
261 261
 	function setUserData($_username, $_quota)
262 262
 	{
263
-		unset($_username); unset($_quota);	// not used, but required by function signature
263
+		unset($_username); unset($_quota); // not used, but required by function signature
264 264
 
265 265
 		return true;
266 266
 	}
@@ -272,9 +272,9 @@  discard block
 block discarded – undo
272 272
 	 */
273 273
 	function updateAccount($_hookValues)
274 274
 	{
275
-		unset($_hookValues);	// not used, but required by function signature
275
+		unset($_hookValues); // not used, but required by function signature
276 276
 
277
-		if(!$this->acc_imap_administration)
277
+		if (!$this->acc_imap_administration)
278 278
 		{
279 279
 			return false;
280 280
 		}
Please login to merge, or discard this patch.
Braces   +16 added lines, -4 removed lines patch added patch discarded remove patch
@@ -68,10 +68,13 @@  discard block
 block discarded – undo
68 68
 	function adminConnection($_username=true)
69 69
 	{
70 70
 		// generate admin user name of $username
71
-		if (($pos = strpos($this->acc_imap_admin_username, '*')) !== false)	// remove evtl. set username
71
+		if (($pos = strpos($this->acc_imap_admin_username, '*')) !== false)
72
+		{
73
+			// remove evtl. set username
72 74
 		{
73 75
 			$this->params['acc_imap_admin_username'] = substr($this->acc_imap_admin_username, $pos+1);
74 76
 		}
77
+		}
75 78
 		$this->params['acc_imap_admin_username'] = (is_string($_username) ? $_username : $this->acc_imap_username).
76 79
 			'*'.$this->acc_imap_admin_username;
77 80
 
@@ -185,7 +188,10 @@  discard block
 block discarded – undo
185 188
 		{
186 189
 			foreach(scandir($path) as $file)
187 190
 			{
188
-				if ($file == '.' || $file == '..') continue;
191
+				if ($file == '.' || $file == '..')
192
+				{
193
+					continue;
194
+				}
189 195
 
190 196
 				if (is_dir($path))
191 197
 				{
@@ -217,8 +223,14 @@  discard block
 block discarded – undo
217 223
 	 */
218 224
 	function getUserData($_username)
219 225
 	{
220
-		if (isset($this->username)) $bufferUsername = $this->username;
221
-		if (isset($this->loginName)) $bufferLoginName = $this->loginName;
226
+		if (isset($this->username))
227
+		{
228
+			$bufferUsername = $this->username;
229
+		}
230
+		if (isset($this->loginName))
231
+		{
232
+			$bufferLoginName = $this->loginName;
233
+		}
222 234
 		$this->username = $this->loginName = $_username;
223 235
 
224 236
 		// now disconnect to be able to reestablish the connection with the targetUser while we go on
Please login to merge, or discard this patch.