Completed
Push — 16.1 ( 2b6741...abc73d )
by Nathan
50:22 queued 36:36
created
api/src/Csrf.php 1 patch
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.
api/src/Image.php 1 patch
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.
api/src/Mail/Smtp.php 1 patch
Spacing   +16 added lines, -18 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 *
80 80
 	 * @param string $defaultDomain =null
81 81
 	 */
82
-	function __construct($defaultDomain=null)
82
+	function __construct($defaultDomain = null)
83 83
 	{
84 84
 		$this->defaultDomain = $defaultDomain ? $defaultDomain : $GLOBALS['egw_info']['server']['mail_suffix'];
85 85
 
@@ -104,12 +104,10 @@  discard block
 block discarded – undo
104 104
 	 */
105 105
 	function addAccount($_hookValues)
106 106
 	{
107
-		$mailLocalAddress = $_hookValues['account_email'] ? $_hookValues['account_email'] :
108
-			Api\Accounts::email($_hookValues['account_firstname'],
109
-				$_hookValues['account_lastname'],$_hookValues['account_lid'],$this->defaultDomain);
107
+		$mailLocalAddress = $_hookValues['account_email'] ? $_hookValues['account_email'] : Api\Accounts::email($_hookValues['account_firstname'],
108
+				$_hookValues['account_lastname'], $_hookValues['account_lid'], $this->defaultDomain);
110 109
 
111
-		$account_id = !empty($_hookValues['account_id']) ? $_hookValues['account_id'] :
112
-			$this->accounts->name2id($_hookValues['account_lid'], 'account_lid', 'u');
110
+		$account_id = !empty($_hookValues['account_id']) ? $_hookValues['account_id'] : $this->accounts->name2id($_hookValues['account_lid'], 'account_lid', 'u');
113 111
 
114 112
 		if ($this->accounts->exists($account_id) != 1)
115 113
 		{
@@ -126,7 +124,7 @@  discard block
 block discarded – undo
126 124
 	 */
127 125
 	function deleteAccount($_hookValues)
128 126
 	{
129
-		unset($_hookValues);	// not used, but required by function signature
127
+		unset($_hookValues); // not used, but required by function signature
130 128
 
131 129
 		return true;
132 130
 	}
@@ -139,12 +137,12 @@  discard block
 block discarded – undo
139 137
 	 */
140 138
 	function getAccountEmailAddress($_accountName)
141 139
 	{
142
-		$emailAddresses	= array();
140
+		$emailAddresses = array();
143 141
 
144 142
 		if (($account_id = $this->accounts->name2id($_accountName, 'account_lid', 'u')))
145 143
 		{
146
-			$realName = trim($GLOBALS['egw_info']['user']['account_firstname'] . (!empty($GLOBALS['egw_info']['user']['account_firstname']) ? ' ' : '') . $GLOBALS['egw_info']['user']['account_lastname']);
147
-			$emailAddresses[] = array (
144
+			$realName = trim($GLOBALS['egw_info']['user']['account_firstname'].(!empty($GLOBALS['egw_info']['user']['account_firstname']) ? ' ' : '').$GLOBALS['egw_info']['user']['account_lastname']);
145
+			$emailAddresses[] = array(
148 146
 				'name'		=> $realName,
149 147
 				'address'	=> $this->accounts->id2name($account_id, 'account_email'),
150 148
 				'type'		=> 'default',
@@ -161,9 +159,9 @@  discard block
 block discarded – undo
161 159
 	 * @return array with values for keys 'mailLocalAddress', 'mailAlternateAddress' (array), 'mailForwardingAddress' (array),
162 160
 	 * 	'accountStatus' ("active"), 'quotaLimit' and 'deliveryMode' ("forwardOnly")
163 161
 	 */
164
-	function getUserData($user, $match_uid_at_domain=false)
162
+	function getUserData($user, $match_uid_at_domain = false)
165 163
 	{
166
-		unset($user, $match_uid_at_domain);	// not used, but required by function signature
164
+		unset($user, $match_uid_at_domain); // not used, but required by function signature
167 165
 
168 166
 		$userData = array();
169 167
 
@@ -201,9 +199,9 @@  discard block
 block discarded – undo
201 199
 	 * @return boolean true on success, false on error writing to ldap
202 200
 	 */
203 201
 	function setUserData($_uidnumber, array $_mailAlternateAddress, array $_mailForwardingAddress, $_deliveryMode,
204
-		$_accountStatus, $_mailLocalAddress, $_quota, $_forwarding_only=false, $_setMailbox=null)
202
+		$_accountStatus, $_mailLocalAddress, $_quota, $_forwarding_only = false, $_setMailbox = null)
205 203
 	{
206
-		unset($_uidnumber, $_mailAlternateAddress, $_mailForwardingAddress,	// not used, but require by function signature
204
+		unset($_uidnumber, $_mailAlternateAddress, $_mailForwardingAddress, // not used, but require by function signature
207 205
 			$_deliveryMode, $_accountStatus, $_mailLocalAddress, $_quota, $_forwarding_only, $_setMailbox);
208 206
 
209 207
 		return true;
@@ -217,7 +215,7 @@  discard block
 block discarded – undo
217 215
 	 */
218 216
 	function updateAccount($_hookValues)
219 217
 	{
220
-		unset($_hookValues);	// not used, but required by function signature
218
+		unset($_hookValues); // not used, but required by function signature
221 219
 
222 220
 		return true;
223 221
 	}
@@ -233,15 +231,15 @@  discard block
 block discarded – undo
233 231
 	 * 	default use $this->loginType
234 232
 	 * @return string
235 233
 	 */
236
-	/*static*/ public function mailbox_addr($account,$domain=null,$mail_login_type=null)
234
+	/*static*/ public function mailbox_addr($account, $domain = null, $mail_login_type = null)
237 235
 	{
238 236
 		if (is_null($domain)) $domain = $this->defaultDomain;
239 237
 		if (is_null($mail_login_type)) $mail_login_type = $this->loginType;
240 238
 
241
-		switch($mail_login_type)
239
+		switch ($mail_login_type)
242 240
 		{
243 241
 			case 'email':
244
-				$mbox = is_array($account) ? $account['account_email'] : $GLOBALS['egw']->accounts->id2name($account,'account_email');
242
+				$mbox = is_array($account) ? $account['account_email'] : $GLOBALS['egw']->accounts->id2name($account, 'account_email');
245 243
 				break;
246 244
 
247 245
 			case 'uidNumber':
Please login to merge, or discard this patch.
api/src/Mail/Imap/Cyrus.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
 	function deleteAccount($_hookValues)
63 63
 	{
64 64
 		// some precausion to really delete just _one_ account
65
-		if (strpos($_hookValues['account_lid'],'%') !== false ||
66
-			strpos($_hookValues['account_lid'],'*') !== false)
65
+		if (strpos($_hookValues['account_lid'], '%') !== false ||
66
+			strpos($_hookValues['account_lid'], '*') !== false)
67 67
 		{
68 68
 			return false;
69 69
 		}
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
 	 * @return string $username='%' username containing wildcards, default '%' for all users of a domain
79 79
 	 * @return int|boolean number of deleted mailboxes on success or false on error
80 80
 	 */
81
-	function deleteUsers($username='%')
81
+	function deleteUsers($username = '%')
82 82
 	{
83
-		if(!$this->acc_imap_administration || empty($username))
83
+		if (!$this->acc_imap_administration || empty($username))
84 84
 		{
85 85
 			return false;
86 86
 		}
@@ -94,14 +94,14 @@  discard block
 block discarded – undo
94 94
 			$mboxes = (array)$this->getMailboxes($mailboxName, 1);
95 95
 			//error_log(__METHOD__."('$username') getMailboxes('$reference','$username$restriction') = ".array2string($mboxes));
96 96
 
97
-			foreach(array_keys($mboxes) as $mbox)
97
+			foreach (array_keys($mboxes) as $mbox)
98 98
 			{
99 99
 				// give the admin account the rights to delete this mailbox
100 100
 				$this->setACL($mbox, $this->acc_imap_admin_username, array('rights' => 'aeiklprstwx'));
101 101
 				$this->deleteMailbox($mbox);
102 102
 			}
103 103
 		}
104
-		catch(Horde_Imap_Client_Exception $e) {
104
+		catch (Horde_Imap_Client_Exception $e) {
105 105
 			_egw_log_exception($e);
106 106
 			$this->disconnect();
107 107
 			return false;
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 		if ($_username !== $GLOBALS['egw_info']['user']['account_lid']) $this->adminConnection();
125 125
 		$userData = array();
126 126
 
127
-		if(($quota = $this->getQuotaByUser($_username,'ALL')))
127
+		if (($quota = $this->getQuotaByUser($_username, 'ALL')))
128 128
 		{
129 129
 			$userData['quotaLimit'] = (int)($quota['limit'] / 1024);
130 130
 			$userData['quotaUsed'] = (int)($quota['usage'] / 1024);
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	 */
146 146
 	function setUserData($_username, $_quota)
147 147
 	{
148
-		if(!$this->acc_imap_administration)
148
+		if (!$this->acc_imap_administration)
149 149
 		{
150 150
 			return false;
151 151
 		}
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 
156 156
 		$mailboxName = $this->getUserMailboxString($_username);
157 157
 
158
-		$this->setQuota($mailboxName, array('STORAGE' => (int)$_quota > 0 ? (int)$_quota*1024 : -1));
158
+		$this->setQuota($mailboxName, array('STORAGE' => (int)$_quota > 0 ? (int)$_quota * 1024 : -1));
159 159
 
160 160
 		$this->disconnect();
161 161
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 	 */
170 170
 	function updateAccount($_hookValues)
171 171
 	{
172
-		if(!$this->acc_imap_administration)
172
+		if (!$this->acc_imap_administration)
173 173
 		{
174 174
 			return false;
175 175
 		}
@@ -182,14 +182,14 @@  discard block
 block discarded – undo
182 182
 		// make sure we use the correct username here.
183 183
 		$username = $this->getMailBoxUserName($_hookValues['account_lid']);
184 184
 		$folderInfo = $this->getMailboxes('', $mailboxName, true);
185
-		if(empty($folderInfo))
185
+		if (empty($folderInfo))
186 186
 		{
187 187
 			try {
188 188
 				$this->createMailbox($mailboxName);
189 189
 				$this->setACL($mailboxName, $username, array('rights' => 'aeiklprstwx'));
190 190
 				// create defined folders and subscribe them (have to use user-credentials to subscribe!)
191 191
 				$userimap = null;
192
-				foreach($this->params as $name => $value)
192
+				foreach ($this->params as $name => $value)
193 193
 				{
194 194
 					if (substr($name, 0, 11) == 'acc_folder_' && !empty($value))
195 195
 					{
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 				}
207 207
 				if (isset($userimap)) $userimap->logout();
208 208
 			}
209
-			catch(Horde_Imap_Client_Exception $e) {
209
+			catch (Horde_Imap_Client_Exception $e) {
210 210
 				_egw_log_exception($e);
211 211
 			}
212 212
 		}
@@ -220,9 +220,9 @@  discard block
 block discarded – undo
220 220
 	 * @param array $params
221 221
 	 * @throws Exception
222 222
 	 */
223
-	public function __call($name,array $params=null)
223
+	public function __call($name, array $params = null)
224 224
 	{
225
-		switch($name)
225
+		switch ($name)
226 226
 		{
227 227
 			case 'setRules':	// call setRules with 3. param of true, to enable utf7imap fileinto for Cyrus
228 228
 				$params += array(null, null, true);
Please login to merge, or discard this patch.
api/src/Mail/Imap/Dbmailuser.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -47,16 +47,16 @@  discard block
 block discarded – undo
47 47
 
48 48
 		$ds = Ldap::factory();
49 49
 
50
-		if(!is_resource($ds)) {
50
+		if (!is_resource($ds)) {
51 51
 			return false;
52 52
 		}
53 53
 
54
-		$filter		= '(&(objectclass=posixaccount)(uid='. $_username .')(dbmailGID='. sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id'])) .'))';
54
+		$filter		= '(&(objectclass=posixaccount)(uid='.$_username.')(dbmailGID='.sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id'])).'))';
55 55
 		$justthese	= array('dn', 'objectclass', 'mailQuota');
56
-		if(($sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese))) {
56
+		if (($sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese))) {
57 57
 
58
-			if(($info = ldap_get_entries($ds, $sri))) {
59
-				if(isset($info[0]['mailquota'][0])) {
58
+			if (($info = ldap_get_entries($ds, $sri))) {
59
+				if (isset($info[0]['mailquota'][0])) {
60 60
 					$userData['quotaLimit'] = $info[0]['mailquota'][0] / 1048576;
61 61
 				}
62 62
 			}
@@ -66,40 +66,40 @@  discard block
 block discarded – undo
66 66
 
67 67
 	function updateAccount($_hookValues)
68 68
 	{
69
-		if(!$uidnumber = (int)$_hookValues['account_id']) {
69
+		if (!$uidnumber = (int)$_hookValues['account_id']) {
70 70
 			return false;
71 71
 		}
72 72
 
73 73
 		$ds = Ldap::factory();
74 74
 
75
-		if(!is_resource($ds)) {
75
+		if (!is_resource($ds)) {
76 76
 			return false;
77 77
 		}
78 78
 
79
-		$filter		= '(&(objectclass=posixaccount)(uidnumber='. $uidnumber .'))';
80
-		$justthese	= array('dn', 'objectclass', 'dbmailUID', 'dbmailGID', 'mail');
79
+		$filter = '(&(objectclass=posixaccount)(uidnumber='.$uidnumber.'))';
80
+		$justthese = array('dn', 'objectclass', 'dbmailUID', 'dbmailGID', 'mail');
81 81
 		$sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese);
82 82
 
83
-		if(($info = ldap_get_entries($ds, $sri))) {
84
-			if((!in_array('dbmailuser',$info[0]['objectclass']) && !in_array('dbmailUser',$info[0]['objectclass'])) && $info[0]['mail']) {
83
+		if (($info = ldap_get_entries($ds, $sri))) {
84
+			if ((!in_array('dbmailuser', $info[0]['objectclass']) && !in_array('dbmailUser', $info[0]['objectclass'])) && $info[0]['mail']) {
85 85
 				$newData['objectclass'] = $info[0]['objectclass'];
86 86
 				unset($newData['objectclass']['count']);
87 87
 				$newData['objectclass'][] = 'dbmailuser';
88 88
 				sort($newData['objectclass']);
89 89
 				$newData['dbmailGID']	= sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
90
-				$newData['dbmailUID']	= (!empty($this->domainName)) ? $_hookValues['account_lid'] .'@'. $this->domainName : $_hookValues['account_lid'];
90
+				$newData['dbmailUID']	= (!empty($this->domainName)) ? $_hookValues['account_lid'].'@'.$this->domainName : $_hookValues['account_lid'];
91 91
 
92
-				if(!ldap_modify($ds, $info[0]['dn'], $newData)) {
92
+				if (!ldap_modify($ds, $info[0]['dn'], $newData)) {
93 93
 					#print ldap_error($ds);
94 94
 				}
95 95
 
96 96
 				return true;
97 97
 			} else {
98 98
 				$newData = array();
99
-				$newData['dbmailUID']	= (!empty($this->domainName)) ? $_hookValues['account_lid'] .'@'. $this->domainName : $_hookValues['account_lid'];
99
+				$newData['dbmailUID']	= (!empty($this->domainName)) ? $_hookValues['account_lid'].'@'.$this->domainName : $_hookValues['account_lid'];
100 100
 				$newData['dbmailGID']	= sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
101 101
 
102
-				if(!ldap_modify($ds, $info[0]['dn'], $newData)) {
102
+				if (!ldap_modify($ds, $info[0]['dn'], $newData)) {
103 103
 					print ldap_error($ds);
104 104
 					_debug_array($newData);
105 105
 					exit;
@@ -115,63 +115,63 @@  discard block
 block discarded – undo
115 115
 	{
116 116
 		$ds = Ldap::factory();
117 117
 
118
-		if(!is_resource($ds)) {
118
+		if (!is_resource($ds)) {
119 119
 			return false;
120 120
 		}
121 121
 
122
-		$filter		= '(&(objectclass=posixaccount)(uid='. $_username .'))';
123
-		$justthese	= array('dn', 'objectclass', 'dbmailGID', 'dbmailUID', 'mail');
122
+		$filter = '(&(objectclass=posixaccount)(uid='.$_username.'))';
123
+		$justthese = array('dn', 'objectclass', 'dbmailGID', 'dbmailUID', 'mail');
124 124
 		$sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese);
125 125
 
126
-		if(($info = ldap_get_entries($ds, $sri))) {
126
+		if (($info = ldap_get_entries($ds, $sri))) {
127 127
 			$validLDAPConfig = false;
128
-			if(in_array('dbmailuser',$info[0]['objectclass']) || in_array('dbmailUser',$info[0]['objectclass'])) {
128
+			if (in_array('dbmailuser', $info[0]['objectclass']) || in_array('dbmailUser', $info[0]['objectclass'])) {
129 129
 				$validLDAPConfig = true;
130 130
 			}
131 131
 
132
-			if(!in_array('dbmailuser',$info[0]['objectclass']) && !in_array('dbmailUser',$info[0]['objectclass']) && $info[0]['mail']) {
132
+			if (!in_array('dbmailuser', $info[0]['objectclass']) && !in_array('dbmailUser', $info[0]['objectclass']) && $info[0]['mail']) {
133 133
 				$newData['objectclass'] = $info[0]['objectclass'];
134 134
 				unset($newData['objectclass']['count']);
135 135
 				$newData['objectclass'][] = 'dbmailUser';
136 136
 				sort($newData['objectclass']);
137 137
 				$newData['dbmailGID']	= sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
138
-				$newData['dbmailUID']	= (!empty($this->domainName)) ? $_username .'@'. $this->domainName : $_username;
138
+				$newData['dbmailUID']	= (!empty($this->domainName)) ? $_username.'@'.$this->domainName : $_username;
139 139
 
140
-				if(ldap_modify($ds, $info[0]['dn'], $newData)) {
140
+				if (ldap_modify($ds, $info[0]['dn'], $newData)) {
141 141
 					$validLDAPConfig = true;
142 142
 				}
143 143
 			} else {
144
-				if ((in_array('dbmailuser',$info[0]['objectclass']) || in_array('dbmailUser',$info[0]['objectclass'])) && !$info[0]['dbmailuid']) {
144
+				if ((in_array('dbmailuser', $info[0]['objectclass']) || in_array('dbmailUser', $info[0]['objectclass'])) && !$info[0]['dbmailuid']) {
145 145
 					$newData = array();
146
-					$newData['dbmailUID']	= (!empty($this->domainName)) ? $_username .'@'. $this->domainName : $_username;
146
+					$newData['dbmailUID'] = (!empty($this->domainName)) ? $_username.'@'.$this->domainName : $_username;
147 147
 
148
-					if(!ldap_modify($ds, $info[0]['dn'], $newData)) {
148
+					if (!ldap_modify($ds, $info[0]['dn'], $newData)) {
149 149
 						#print ldap_error($ds);
150 150
 						#return false;
151 151
 					}
152 152
 				}
153 153
 
154
-				if ((in_array('dbmailuser',$info[0]['objectclass']) || in_array('dbmailUser',$info[0]['objectclass'])) && !$info[0]['dbmailgid']) {
154
+				if ((in_array('dbmailuser', $info[0]['objectclass']) || in_array('dbmailUser', $info[0]['objectclass'])) && !$info[0]['dbmailgid']) {
155 155
 					$newData = array();
156
-					$newData['dbmailGID']	= sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
156
+					$newData['dbmailGID'] = sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
157 157
 
158
-					if(!ldap_modify($ds, $info[0]['dn'], $newData)) {
158
+					if (!ldap_modify($ds, $info[0]['dn'], $newData)) {
159 159
 						#print ldap_error($ds);
160 160
 						#return false;
161 161
 					}
162 162
 				}
163 163
 			}
164 164
 
165
-			if($validLDAPConfig) {
165
+			if ($validLDAPConfig) {
166 166
 				$newData = array();
167 167
 
168
-				if((int)$_quota >= 0) {
168
+				if ((int)$_quota >= 0) {
169 169
 					$newData['mailQuota'] = (int)$_quota * 1048576;
170 170
 				} else {
171 171
 					$newData['mailQuota'] = array();
172 172
 				}
173 173
 
174
-				if(!ldap_modify($ds, $info[0]['dn'], $newData)) {
174
+				if (!ldap_modify($ds, $info[0]['dn'], $newData)) {
175 175
 					#print ldap_error($ds);
176 176
 					return false;
177 177
 				}
Please login to merge, or discard this patch.
api/src/Mail/Imap/Dbmailqmailuser.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -47,16 +47,16 @@  discard block
 block discarded – undo
47 47
 
48 48
 		$ds = Ldap::factory();
49 49
 
50
-		if(!is_resource($ds)) {
50
+		if (!is_resource($ds)) {
51 51
 			return false;
52 52
 		}
53 53
 
54
-		$filter		= '(&(objectclass=posixaccount)(uid='. $_username .')(qmailGID='. sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id'])) .'))';
54
+		$filter		= '(&(objectclass=posixaccount)(uid='.$_username.')(qmailGID='.sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id'])).'))';
55 55
 		$justthese	= array('dn', 'objectclass', 'mailQuota');
56
-		if(($sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese))) {
56
+		if (($sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese))) {
57 57
 
58
-			if(($info = ldap_get_entries($ds, $sri))) {
59
-				if(isset($info[0]['mailquota'][0])) {
58
+			if (($info = ldap_get_entries($ds, $sri))) {
59
+				if (isset($info[0]['mailquota'][0])) {
60 60
 					$userData['quotaLimit'] = $info[0]['mailquota'][0] / 1048576;
61 61
 				}
62 62
 			}
@@ -65,27 +65,27 @@  discard block
 block discarded – undo
65 65
 	}
66 66
 
67 67
 	function updateAccount($_hookValues) {
68
-		if(!$uidnumber = (int)$_hookValues['account_id']) {
68
+		if (!$uidnumber = (int)$_hookValues['account_id']) {
69 69
 			return false;
70 70
 		}
71 71
 
72 72
 		$ds = Ldap::factory();
73 73
 
74
-		if(!is_resource($ds)) {
74
+		if (!is_resource($ds)) {
75 75
 			return false;
76 76
 		}
77 77
 
78
-		$filter		= '(&(objectclass=posixaccount)(uidnumber='. $uidnumber .'))';
79
-		$justthese	= array('dn', 'objectclass', 'qmailUID', 'qmailGID', 'mail');
78
+		$filter = '(&(objectclass=posixaccount)(uidnumber='.$uidnumber.'))';
79
+		$justthese = array('dn', 'objectclass', 'qmailUID', 'qmailGID', 'mail');
80 80
 		$sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese);
81 81
 
82
-		if(($info = ldap_get_entries($ds, $sri))) {
83
-			if(!in_array('qmailuser',$info[0]['objectclass']) && $info[0]['email']) {
82
+		if (($info = ldap_get_entries($ds, $sri))) {
83
+			if (!in_array('qmailuser', $info[0]['objectclass']) && $info[0]['email']) {
84 84
 				$newData['objectclass'] = $info[0]['objectclass'];
85 85
 				unset($newData['objectclass']['count']);
86 86
 				$newData['objectclass'][] = 'qmailuser';
87 87
 				sort($newData['objectclass']);
88
-				$newData['qmailGID']	= sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
88
+				$newData['qmailGID'] = sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
89 89
 				#$newData['qmailUID']	= (!empty($this->domainName)) ? $_username .'@'. $this->domainName : $_username;
90 90
 
91 91
 				ldap_modify($ds, $info[0]['dn'], $newData);
@@ -93,10 +93,10 @@  discard block
 block discarded – undo
93 93
 				return true;
94 94
 			} else {
95 95
 				$newData = array();
96
-				$newData['qmailGID']	= sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
96
+				$newData['qmailGID'] = sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
97 97
 				#$newData['qmailUID']	= (!empty($this->domainName)) ? $_username .'@'. $this->domainName : $_username;
98 98
 
99
-				if(!ldap_modify($ds, $info[0]['dn'], $newData)) {
99
+				if (!ldap_modify($ds, $info[0]['dn'], $newData)) {
100 100
 					#print ldap_error($ds);
101 101
 					#return false;
102 102
 				}
@@ -109,30 +109,30 @@  discard block
 block discarded – undo
109 109
 	function setUserData($_username, $_quota) {
110 110
 		$ds = Ldap::factory();
111 111
 
112
-		if(!is_resource($ds)) {
112
+		if (!is_resource($ds)) {
113 113
 			return false;
114 114
 		}
115 115
 
116
-		$filter		= '(&(objectclass=posixaccount)(uid='. $_username .'))';
117
-		$justthese	= array('dn', 'objectclass', 'qmailGID', 'mail');
116
+		$filter = '(&(objectclass=posixaccount)(uid='.$_username.'))';
117
+		$justthese = array('dn', 'objectclass', 'qmailGID', 'mail');
118 118
 		$sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese);
119 119
 
120
-		if(($info = ldap_get_entries($ds, $sri))) {
120
+		if (($info = ldap_get_entries($ds, $sri))) {
121 121
 			#_debug_array($info);
122
-			if(!in_array('qmailuser',$info[0]['objectclass']) && $info[0]['email']) {
122
+			if (!in_array('qmailuser', $info[0]['objectclass']) && $info[0]['email']) {
123 123
 				$newData['objectclass'] = $info[0]['objectclass'];
124 124
 				unset($newData['objectclass']['count']);
125 125
 				$newData['objectclass'][] = 'qmailuser';
126 126
 				sort($newData['objectclass']);
127
-				$newData['qmailGID']	= sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
127
+				$newData['qmailGID'] = sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
128 128
 
129 129
 				ldap_modify($ds, $info[0]['dn'], $newData);
130 130
 			} else {
131
-				if (in_array('qmailuser',$info[0]['objectclass']) && !$info[0]['qmailgid']) {
131
+				if (in_array('qmailuser', $info[0]['objectclass']) && !$info[0]['qmailgid']) {
132 132
 					$newData = array();
133
-					$newData['qmailGID']	= sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
133
+					$newData['qmailGID'] = sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id']));
134 134
 
135
-					if(!ldap_modify($ds, $info[0]['dn'], $newData)) {
135
+					if (!ldap_modify($ds, $info[0]['dn'], $newData)) {
136 136
 						#print ldap_error($ds);
137 137
 						#return false;
138 138
 					}
@@ -141,13 +141,13 @@  discard block
 block discarded – undo
141 141
 
142 142
 			$newData = array();
143 143
 
144
-			if((int)$_quota >= 0) {
144
+			if ((int)$_quota >= 0) {
145 145
 				$newData['mailQuota'] = (int)$_quota * 1048576;
146 146
 			} else {
147 147
 				$newData['mailQuota'] = array();
148 148
 			}
149 149
 
150
-			if(!ldap_modify($ds, $info[0]['dn'], $newData)) {
150
+			if (!ldap_modify($ds, $info[0]['dn'], $newData)) {
151 151
 				#print ldap_error($ds);
152 152
 				return false;
153 153
 			}
Please login to merge, or discard this patch.
api/src/Mail/Imap/Dovecot.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	 *
57 57
 	 * @var string
58 58
 	 */
59
-	var $user_home;	// = '/var/dovecot/imap/%d/%u';
59
+	var $user_home; // = '/var/dovecot/imap/%d/%u';
60 60
 
61 61
 	/**
62 62
 	 * Ensure we use an admin connection
@@ -65,12 +65,12 @@  discard block
 block discarded – undo
65 65
 	 *
66 66
 	 * @param string $_username =true create an admin connection for given user or $this->acc_imap_username
67 67
 	 */
68
-	function adminConnection($_username=true)
68
+	function adminConnection($_username = true)
69 69
 	{
70 70
 		// generate admin user name of $username
71 71
 		if (($pos = strpos($this->acc_imap_admin_username, '*')) !== false)	// remove evtl. set username
72 72
 		{
73
-			$this->params['acc_imap_admin_username'] = substr($this->acc_imap_admin_username, $pos+1);
73
+			$this->params['acc_imap_admin_username'] = substr($this->acc_imap_admin_username, $pos + 1);
74 74
 		}
75 75
 		$this->params['acc_imap_admin_username'] = (is_string($_username) ? $_username : $this->acc_imap_username).
76 76
 			'*'.$this->acc_imap_admin_username;
@@ -87,16 +87,16 @@  discard block
 block discarded – undo
87 87
 	 * @param string $_folderName =''
88 88
 	 * @return string utf-7 encoded (done in getMailboxName)
89 89
 	 */
90
-	function getUserMailboxString($_username, $_folderName='')
90
+	function getUserMailboxString($_username, $_folderName = '')
91 91
 	{
92
-		unset($_username);	// not used, but required by function signature
92
+		unset($_username); // not used, but required by function signature
93 93
 
94 94
 		$mailboxString = 'INBOX';
95 95
 
96 96
 		if (!empty($_folderName))
97 97
 		{
98 98
 			$nameSpaces = $this->getNameSpaceArray();
99
-			$mailboxString .= $nameSpaces['others'][0]['delimiter'] . $_folderName;
99
+			$mailboxString .= $nameSpaces['others'][0]['delimiter'].$_folderName;
100 100
 		}
101 101
 		return $mailboxString;
102 102
 	}
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
 	function deleteAccount($_hookValues)
120 120
 	{
121 121
 		// some precausion to really delete just _one_ account
122
-		if (strpos($_hookValues['account_lid'],'%') !== false ||
123
-			strpos($_hookValues['account_lid'],'*') !== false)
122
+		if (strpos($_hookValues['account_lid'], '%') !== false ||
123
+			strpos($_hookValues['account_lid'], '*') !== false)
124 124
 		{
125 125
 			return false;
126 126
 		}
@@ -135,9 +135,9 @@  discard block
 block discarded – undo
135 135
 	 * @return string $username='%' username containing wildcards, default '%' for all users of a domain
136 136
 	 * @return int|boolean number of deleted mailboxes on success or false on error
137 137
 	 */
138
-	function deleteUsers($username='%')
138
+	function deleteUsers($username = '%')
139 139
 	{
140
-		if(!$this->acc_imap_administration || empty($username))
140
+		if (!$this->acc_imap_administration || empty($username))
141 141
 		{
142 142
 			return false;
143 143
 		}
@@ -155,9 +155,9 @@  discard block
 block discarded – undo
155 155
 			{
156 156
 				throw new Api\Exception\AssertionFailed("user_home='$this->user_home' contains no domain-part '%d'!");
157 157
 			}
158
-			$home = strtr(substr($this->user_home, 0, $pos+2), $replace);
158
+			$home = strtr(substr($this->user_home, 0, $pos + 2), $replace);
159 159
 
160
-			$ret = count(scandir($home))-2;
160
+			$ret = count(scandir($home)) - 2;
161 161
 		}
162 162
 		else
163 163
 		{
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 	{
184 184
 		if (is_dir($path))
185 185
 		{
186
-			foreach(scandir($path) as $file)
186
+			foreach (scandir($path) as $file)
187 187
 			{
188 188
 				if ($file == '.' || $file == '..') continue;
189 189
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 				return false;
202 202
 			}
203 203
 		}
204
-		elseif(!unlink($path))
204
+		elseif (!unlink($path))
205 205
 		{
206 206
 			return false;
207 207
 		}
@@ -235,10 +235,10 @@  discard block
 block discarded – undo
235 235
 
236 236
 		$userData = array();
237 237
 		// we are authenticated with master but for current user
238
-		if(($quota = $this->getStorageQuotaRoot('INBOX')))
238
+		if (($quota = $this->getStorageQuotaRoot('INBOX')))
239 239
 		{
240
-			$userData['quotaLimit'] = (int) ($quota['QMAX'] / 1024);
241
-			$userData['quotaUsed'] = (int) ($quota['USED'] / 1024);
240
+			$userData['quotaLimit'] = (int)($quota['QMAX'] / 1024);
241
+			$userData['quotaUsed'] = (int)($quota['USED'] / 1024);
242 242
 		}
243 243
 		$this->username = $bufferUsername;
244 244
 		$this->loginName = $bufferLoginName;
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 	 */
261 261
 	function setUserData($_username, $_quota)
262 262
 	{
263
-		unset($_username); unset($_quota);	// not used, but required by function signature
263
+		unset($_username); unset($_quota); // not used, but required by function signature
264 264
 
265 265
 		return true;
266 266
 	}
@@ -272,9 +272,9 @@  discard block
 block discarded – undo
272 272
 	 */
273 273
 	function updateAccount($_hookValues)
274 274
 	{
275
-		unset($_hookValues);	// not used, but required by function signature
275
+		unset($_hookValues); // not used, but required by function signature
276 276
 
277
-		if(!$this->acc_imap_administration)
277
+		if (!$this->acc_imap_administration)
278 278
 		{
279 279
 			return false;
280 280
 		}
Please login to merge, or discard this patch.
api/src/Mail/Imap/Iface.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -14,9 +14,9 @@  discard block
 block discarded – undo
14 14
 namespace EGroupware\Api\Mail\Imap;
15 15
 
16 16
 define('IMAP_NAMESPACE_PERSONAL', 'personal');
17
-define('IMAP_NAMESPACE_OTHERS'	, 'others');
18
-define('IMAP_NAMESPACE_SHARED'	, 'shared');
19
-define('IMAP_NAMESPACE_ALL'	, 'all');
17
+define('IMAP_NAMESPACE_OTHERS', 'others');
18
+define('IMAP_NAMESPACE_SHARED', 'shared');
19
+define('IMAP_NAMESPACE_ALL', 'all');
20 20
 
21 21
 /**
22 22
  * This class holds all information about the imap connection.
@@ -87,7 +87,7 @@  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 92
 	/**
93 93
 	 * get list of namespaces
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	 * @param string $_what - what to retrieve either QMAX, USED or ALL is supported
104 104
 	 * @return mixed the quota for specified user (by what) or array with all available Quota Information, or false
105 105
 	 */
106
-	function getQuotaByUser($_username, $_what='QMAX');
106
+	function getQuotaByUser($_username, $_what = 'QMAX');
107 107
 
108 108
 	/**
109 109
 	 * returns information about a user
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	 * @param int $_timeout =null timeout in secs, if none given fmail pref or default of 20 is used
123 123
 	 * @throws Exception on error
124 124
 	 */
125
-	function openConnection($_adminConnection=false, $_timeout=null);
125
+	function openConnection($_adminConnection = false, $_timeout = null);
126 126
 
127 127
 	/**
128 128
 	 * set userdata
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 	 * @param string $_scriptName =null
150 150
 	 * @return boolean
151 151
 	 */
152
-	public function setVacationUser($_euser, array $_vacation, $_scriptName=null);
152
+	public function setVacationUser($_euser, array $_vacation, $_scriptName = null);
153 153
 
154 154
 	/**
155 155
 	 * Get vacation message for given user
@@ -159,5 +159,5 @@  discard block
 block discarded – undo
159 159
 	 * @throws Exception on connection error or authentication failure
160 160
 	 * @return array
161 161
 	 */
162
-	public function getVacationUser($_euser, $_scriptName=null);
162
+	public function getVacationUser($_euser, $_scriptName = null);
163 163
 }
Please login to merge, or discard this patch.
api/src/Mail/Cache.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
      */
40 40
     public function get($key, $lifetime = 0)
41 41
 	{
42
-		unset($lifetime);	// not (yet) used, but required by function signature
42
+		unset($lifetime); // not (yet) used, but required by function signature
43 43
 
44 44
 		$ret = Api\Cache::getCache(self::LEVEL, 'mail', $key);
45 45
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
      */
72 72
     public function exists($key, $lifetime = 0)
73 73
 	{
74
-		unset($lifetime);	// not (yet) used, but required by function signature
74
+		unset($lifetime); // not (yet) used, but required by function signature
75 75
 
76 76
 		return !is_null(Api\Cache::getCache(self::LEVEL, 'mail', $key));
77 77
 	}
Please login to merge, or discard this patch.