Completed
Push — 16.1 ( b39e15...d98aac )
by Klaus
18:52
created
api/src/Json/Msg.php 2 patches
Doc Comments   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -82,8 +82,7 @@  discard block
 block discarded – undo
82 82
 	/**
83 83
 	 * Allows to call a global javascript function with given parameters: window[$func].call(window[, $param1[, ...]])
84 84
 	 *
85
-	 * @param string $func name of the global (window) javascript function to call
86
-	 * @param mixed $parameters variable number of parameters
85
+	 * @param string $function
87 86
 	 */
88 87
 	public function call($function)
89 88
 	{
@@ -108,7 +107,7 @@  discard block
 block discarded – undo
108 107
 	 *
109 108
 	 * @param string $selector jquery selector
110 109
 	 * @param string $method name of the jquery to call
111
-	 * @param array $parameters =array()
110
+	 * @param string[] $parameters =array()
112 111
 	 */
113 112
 	public function jquery($selector,$method,array $parameters=array())
114 113
 	{
@@ -126,6 +125,9 @@  discard block
 block discarded – undo
126 125
 		}
127 126
 	}
128 127
 
128
+	/**
129
+	 * @param string $type
130
+	 */
129 131
 	public function generic($type, array $parameters = array())
130 132
 	{
131 133
 		if (is_string($type))
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 * @param string $function name of the global (window) javascript function to call
65 65
 	 * @param array $parameters =array()
66 66
 	 */
67
-	public function apply($function,array $parameters=array())
67
+	public function apply($function, array $parameters = array())
68 68
 	{
69 69
 		if (is_string($function))
70 70
 		{
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	public function call($function)
89 89
 	{
90 90
 		$parameters = func_get_args();
91
-		array_shift($parameters);	// shift off $function
91
+		array_shift($parameters); // shift off $function
92 92
 
93 93
 		if (is_string($function))
94 94
 		{
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	 * @param string $method name of the jquery to call
111 111
 	 * @param array $parameters =array()
112 112
 	 */
113
-	public function jquery($selector,$method,array $parameters=array())
113
+	public function jquery($selector, $method, array $parameters = array())
114 114
 	{
115 115
 		if (is_string($selector) && is_string($method))
116 116
 		{
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 	 * @param string $app =null default current app from flags
170 170
 	 * or only the current application
171 171
 	 */
172
-	public function redirect($url, $global = false, $app=null)
172
+	public function redirect($url, $global = false, $app = null)
173 173
 	{
174 174
 		if (is_string($url) && is_bool($global))
175 175
 		{
Please login to merge, or discard this patch.
api/src/Json/Response.php 4 patches
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -180,7 +180,6 @@  discard block
 block discarded – undo
180 180
 	/**
181 181
 	 * Init responseArray
182 182
 	 *
183
-	 * @param array $arr
184 183
 	 * @return array previous content
185 184
 	 */
186 185
 	public function initResponseArray()
@@ -264,7 +263,7 @@  discard block
 block discarded – undo
264 263
 	 *
265 264
 	 * @param midex $var
266 265
 	 * @param string $prefix =''
267
-	 * @return mixed
266
+	 * @return midex|null
268 267
 	 */
269 268
 	public static function fix_content($var, $prefix='')
270 269
 	{
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -242,13 +242,13 @@
 block discarded – undo
242 242
 		if ($ret === false && ($err = json_last_error()))
243 243
 		{
244 244
 			static $json_err2str = array(
245
-	        	JSON_ERROR_NONE => 'No errors',
246
-	        	JSON_ERROR_DEPTH => 'Maximum stack depth exceeded',
247
-	        	JSON_ERROR_STATE_MISMATCH => 'Underflow or the modes mismatch',
248
-	        	JSON_ERROR_CTRL_CHAR => 'Unexpected control character found',
249
-	        	JSON_ERROR_SYNTAX => 'Syntax error, malformed JSON',
250
-	        	JSON_ERROR_UTF8 => 'Malformed UTF-8 characters, possibly incorrectly encoded',
251
-	        );
245
+				JSON_ERROR_NONE => 'No errors',
246
+				JSON_ERROR_DEPTH => 'Maximum stack depth exceeded',
247
+				JSON_ERROR_STATE_MISMATCH => 'Underflow or the modes mismatch',
248
+				JSON_ERROR_CTRL_CHAR => 'Unexpected control character found',
249
+				JSON_ERROR_SYNTAX => 'Syntax error, malformed JSON',
250
+				JSON_ERROR_UTF8 => 'Malformed UTF-8 characters, possibly incorrectly encoded',
251
+			);
252 252
 			error_log(__METHOD__.'('.array2string($var).') json_last_error()='.$err.'='.$json_err2str[$err]);
253 253
 
254 254
 			if (($var = self::fix_content($var)))
Please login to merge, or discard this patch.
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -268,7 +268,10 @@
 block discarded – undo
268 268
 	 */
269 269
 	public static function fix_content($var, $prefix='')
270 270
 	{
271
-		if (json_encode($var) !== false) return $var;
271
+		if (json_encode($var) !== false)
272
+		{
273
+			return $var;
274
+		}
272 275
 
273 276
 		if (is_scalar($var))
274 277
 		{
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -226,9 +226,9 @@  discard block
 block discarded – undo
226 226
 		// Wrap the result array into a parent "response" Object
227 227
 		$res = array(
228 228
 			'response' => $inst->responseArray,
229
-		)+Api\Framework::get_page_generation_time();
229
+		) + Api\Framework::get_page_generation_time();
230 230
 
231
-		return self::json_encode($res);	//PHP5.3+, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP);
231
+		return self::json_encode($res); //PHP5.3+, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP);
232 232
 	}
233 233
 
234 234
 	/**
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 	 * @param string $prefix =''
269 269
 	 * @return mixed
270 270
 	 */
271
-	public static function fix_content($var, $prefix='')
271
+	public static function fix_content($var, $prefix = '')
272 272
 	{
273 273
 		if (json_encode($var) !== false) return $var;
274 274
 
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 		}
280 280
 		else
281 281
 		{
282
-			foreach($var as $name => &$value)
282
+			foreach ($var as $name => &$value)
283 283
 			{
284 284
 				$value = self::fix_content($value, $prefix ? $prefix.'['.$name.']' : $name);
285 285
 			}
Please login to merge, or discard this patch.
api/src/Ldap/ServerInfo.php 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	/**
82 82
 	* gets the version
83 83
 	*
84
-	* @return integer the supported ldap version
84
+	* @return string the supported ldap version
85 85
 	*/
86 86
 	function getVersion()
87 87
 	{
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 	 * @param resource $ds
160 160
 	 * @param string $host
161 161
 	 * @param int $version 2 or 3
162
-	 * @return ldapserverinfo
162
+	 * @return ServerInfo
163 163
 	 */
164 164
 	public static function get($ds, $host, $version=3)
165 165
 	{
Please login to merge, or discard this patch.
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -32,33 +32,33 @@  discard block
 block discarded – undo
32 32
 	const SAMBA4 = 2;
33 33
 
34 34
 	/**
35
-	* @var array $namingContext holds the supported namingcontexts
36
-	*/
35
+	 * @var array $namingContext holds the supported namingcontexts
36
+	 */
37 37
 	var $namingContext = array();
38 38
 
39 39
 	/**
40
-	* @var string $version holds the LDAP server version
41
-	*/
40
+	 * @var string $version holds the LDAP server version
41
+	 */
42 42
 	var $version = 2;
43 43
 
44 44
 	/**
45
-	* @var integer $serverType holds the type of LDAP server(OpenLDAP, ADS, NDS, ...)
46
-	*/
45
+	 * @var integer $serverType holds the type of LDAP server(OpenLDAP, ADS, NDS, ...)
46
+	 */
47 47
 	var $serverType = 0;
48 48
 
49 49
 	/**
50
-	* @var string $_subSchemaEntry the subschema entry DN
51
-	*/
50
+	 * @var string $_subSchemaEntry the subschema entry DN
51
+	 */
52 52
 	var $subSchemaEntry = '';
53 53
 
54 54
 	/**
55
-	* @var array $supportedObjectClasses the supported objectclasses
56
-	*/
55
+	 * @var array $supportedObjectClasses the supported objectclasses
56
+	 */
57 57
 	var $supportedObjectClasses = array();
58 58
 
59 59
 	/**
60
-	* @var array $supportedOIDs the supported OIDs
61
-	*/
60
+	 * @var array $supportedOIDs the supported OIDs
61
+	 */
62 62
 	var $supportedOIDs = array();
63 63
 
64 64
 	/**
@@ -79,50 +79,50 @@  discard block
 block discarded – undo
79 79
 	}
80 80
 
81 81
 	/**
82
-	* gets the version
83
-	*
84
-	* @return integer the supported ldap version
85
-	*/
82
+	 * gets the version
83
+	 *
84
+	 * @return integer the supported ldap version
85
+	 */
86 86
 	function getVersion()
87 87
 	{
88 88
 		return $this->version;
89 89
 	}
90 90
 
91 91
 	/**
92
-	* sets the namingcontexts
93
-	*
94
-	* @param array $_namingContext the supported namingcontexts
95
-	*/
92
+	 * sets the namingcontexts
93
+	 *
94
+	 * @param array $_namingContext the supported namingcontexts
95
+	 */
96 96
 	function setNamingContexts($_namingContext)
97 97
 	{
98 98
 		$this->namingContext = $_namingContext;
99 99
 	}
100 100
 
101 101
 	/**
102
-	* sets the type of the ldap server(OpenLDAP, ADS, NDS, ...)
103
-	*
104
-	* @param integer $_serverType the type of ldap server
105
-	*/
102
+	 * sets the type of the ldap server(OpenLDAP, ADS, NDS, ...)
103
+	 *
104
+	 * @param integer $_serverType the type of ldap server
105
+	 */
106 106
 	function setServerType($_serverType)
107 107
 	{
108 108
 		$this->serverType = $_serverType;
109 109
 	}
110 110
 
111 111
 	/**
112
-	* sets the DN for the subschema entry
113
-	*
114
-	* @param string $_subSchemaEntry the subschema entry DN
115
-	*/
112
+	 * sets the DN for the subschema entry
113
+	 *
114
+	 * @param string $_subSchemaEntry the subschema entry DN
115
+	 */
116 116
 	function setSubSchemaEntry($_subSchemaEntry)
117 117
 	{
118 118
 		$this->subSchemaEntry = $_subSchemaEntry;
119 119
 	}
120 120
 
121 121
 	/**
122
-	* sets the supported objectclasses
123
-	*
124
-	* @param array $_supportedObjectClasses the supported objectclasses
125
-	*/
122
+	 * sets the supported objectclasses
123
+	 *
124
+	 * @param array $_supportedObjectClasses the supported objectclasses
125
+	 */
126 126
 	function setSupportedObjectClasses($_supportedObjectClasses)
127 127
 	{
128 128
 		$this->supportedOIDs = $_supportedObjectClasses;
@@ -130,20 +130,20 @@  discard block
 block discarded – undo
130 130
 	}
131 131
 
132 132
 	/**
133
-	* sets the version
134
-	*
135
-	* @param integer $_version the supported ldap version
136
-	*/
133
+	 * sets the version
134
+	 *
135
+	 * @param integer $_version the supported ldap version
136
+	 */
137 137
 	function setVersion($_version)
138 138
 	{
139 139
 		$this->version = $_version;
140 140
 	}
141 141
 
142 142
 	/**
143
-	* checks for supported objectclasses
144
-	*
145
-	* @return bool returns true if the ldap server supports this objectclass
146
-	*/
143
+	 * checks for supported objectclasses
144
+	 *
145
+	 * @return bool returns true if the ldap server supports this objectclass
146
+	 */
147 147
 	function supportsObjectClass($_objectClass)
148 148
 	{
149 149
 		if($this->supportedObjectClasses[strtolower($_objectClass)])
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	*/
147 147
 	function supportsObjectClass($_objectClass)
148 148
 	{
149
-		if($this->supportedObjectClasses[strtolower($_objectClass)])
149
+		if ($this->supportedObjectClasses[strtolower($_objectClass)])
150 150
 		{
151 151
 			return true;
152 152
 		}
@@ -161,21 +161,21 @@  discard block
 block discarded – undo
161 161
 	 * @param int $version 2 or 3
162 162
 	 * @return ldapserverinfo
163 163
 	 */
164
-	public static function get($ds, $host, $version=3)
164
+	public static function get($ds, $host, $version = 3)
165 165
 	{
166
-		$filter='(objectclass=*)';
167
-		$justthese = array('structuralObjectClass','namingContexts','supportedLDAPVersion','subschemaSubentry','vendorname');
168
-		if(($sr = @ldap_read($ds, '', $filter, $justthese)))
166
+		$filter = '(objectclass=*)';
167
+		$justthese = array('structuralObjectClass', 'namingContexts', 'supportedLDAPVersion', 'subschemaSubentry', 'vendorname');
168
+		if (($sr = @ldap_read($ds, '', $filter, $justthese)))
169 169
 		{
170
-			if(($info = ldap_get_entries($ds, $sr)))
170
+			if (($info = ldap_get_entries($ds, $sr)))
171 171
 			{
172 172
 				$ldapServerInfo = new ServerInfo($host);
173 173
 				$ldapServerInfo->setVersion($version);
174 174
 
175 175
 				// check for naming contexts
176
-				if($info[0]['namingcontexts'])
176
+				if ($info[0]['namingcontexts'])
177 177
 				{
178
-					for($i=0; $i<$info[0]['namingcontexts']['count']; $i++)
178
+					for ($i = 0; $i < $info[0]['namingcontexts']['count']; $i++)
179 179
 					{
180 180
 						$namingcontexts[] = $info[0]['namingcontexts'][$i];
181 181
 					}
@@ -183,9 +183,9 @@  discard block
 block discarded – undo
183 183
 				}
184 184
 
185 185
 				// check for ldap server type
186
-				if($info[0]['structuralobjectclass'])
186
+				if ($info[0]['structuralobjectclass'])
187 187
 				{
188
-					switch($info[0]['structuralobjectclass'][0])
188
+					switch ($info[0]['structuralobjectclass'][0])
189 189
 					{
190 190
 						case 'OpenLDAProotDSE':
191 191
 							$ldapServerType = OPENLDAP_LDAPSERVER;
@@ -202,30 +202,30 @@  discard block
 block discarded – undo
202 202
 				}
203 203
 
204 204
 				// check for subschema entry dn
205
-				if($info[0]['subschemasubentry'])
205
+				if ($info[0]['subschemasubentry'])
206 206
 				{
207 207
 					$subschemasubentry = $info[0]['subschemasubentry'][0];
208 208
 					$ldapServerInfo->setSubSchemaEntry($subschemasubentry);
209 209
 				}
210 210
 
211 211
 				// create list of supported objetclasses
212
-				if(!empty($subschemasubentry))
212
+				if (!empty($subschemasubentry))
213 213
 				{
214
-					$filter='(objectclass=*)';
214
+					$filter = '(objectclass=*)';
215 215
 					$justthese = array('objectClasses');
216 216
 
217
-					if(($sr = ldap_read($ds, $subschemasubentry, $filter, $justthese)))
217
+					if (($sr = ldap_read($ds, $subschemasubentry, $filter, $justthese)))
218 218
 					{
219
-						if(($info = ldap_get_entries($ds, $sr)))
219
+						if (($info = ldap_get_entries($ds, $sr)))
220 220
 						{
221
-							if($info[0]['objectclasses']) {
222
-								for($i=0; $i<$info[0]['objectclasses']['count']; $i++)
221
+							if ($info[0]['objectclasses']) {
222
+								for ($i = 0; $i < $info[0]['objectclasses']['count']; $i++)
223 223
 								{
224 224
 									$matches = null;
225
-									if(preg_match('/^\( (.*) NAME \'(\w*)\' /', $info[0]['objectclasses'][$i], $matches))
225
+									if (preg_match('/^\( (.*) NAME \'(\w*)\' /', $info[0]['objectclasses'][$i], $matches))
226 226
 									{
227 227
 										#_debug_array($matches);
228
-										if(count($matches) == 3)
228
+										if (count($matches) == 3)
229 229
 										{
230 230
 											$supportedObjectClasses[$matches[1]] = strtolower($matches[2]);
231 231
 										}
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -218,7 +218,8 @@
 block discarded – undo
218 218
 					{
219 219
 						if(($info = ldap_get_entries($ds, $sr)))
220 220
 						{
221
-							if($info[0]['objectclasses']) {
221
+							if($info[0]['objectclasses'])
222
+							{
222 223
 								for($i=0; $i<$info[0]['objectclasses']['count']; $i++)
223 224
 								{
224 225
 									$matches = null;
Please login to merge, or discard this patch.
api/src/Link/Storage.php 5 patches
Doc Comments   +6 added lines, -1 removed lines patch added patch discarded remove patch
@@ -176,6 +176,11 @@  discard block
 block discarded – undo
176 176
 		return is_array($id) ? $links : ($links[$id] ? $links[$id] : array());
177 177
 	}
178 178
 
179
+	/**
180
+	 * @param boolean $left
181
+	 * @param string $only_app
182
+	 * @param boolean $not_only
183
+	 */
179 184
 	private static function _add2links($row,$left,$only_app,$not_only,array &$links)
180 185
 	{
181 186
 		$linked_app = $left ? $row['link_app2'] : $row['link_app1'];
@@ -206,7 +211,7 @@  discard block
 block discarded – undo
206 211
 	 * @param string $id ='' id in $app, if no integer link_id given in $app_link_id
207 212
 	 * @param string $app2 ='' appname of 2. endpoint of the link, if no integer link_id given in $app_link_id
208 213
 	 * @param string $id2 ='' id in $app2, if no integer link_id given in $app_link_id
209
-	 * @return array with link-data or False
214
+	 * @return string with link-data or False
210 215
 	 */
211 216
 	static function get_link($app_link_id,$id='',$app2='',$id2='')
212 217
 	{
Please login to merge, or discard this patch.
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 			echo "<p>solink.link('$app1',$id1,'$app2',$id2,'$remark',$owner)</p>\n";
67 67
 		}
68 68
 		if ($app1 == $app2 && $id1 == $id2 ||
69
-		    $id1 == '' || $id2 == '' || $app1 == '' || $app2 == '')
69
+			$id1 == '' || $id2 == '' || $app1 == '' || $app2 == '')
70 70
 		{
71 71
 			return False;	// dont link to self or other nosense
72 72
 		}
@@ -412,26 +412,26 @@  discard block
 block discarded – undo
412 412
 			array('table'=>self::TABLE,
413 413
 				'cols'=>'c.*,b.link_app1 AS app3,b.link_id1 AS id3,b.link_id AS link3',
414 414
 				'where'=>'a.link_app1='.self::$db->quote($app).' AND c.link_app2='.self::$db->quote($target_app).
415
-                        		(!$target_id ? '' : self::$db->expression(self::TABLE,' AND c.',array('link_id2' => $target_id))),
416
-                        	'join'=>" a
415
+								(!$target_id ? '' : self::$db->expression(self::TABLE,' AND c.',array('link_id2' => $target_id))),
416
+							'join'=>" a
417 417
                         		JOIN $table b ON a.link_id2=b.link_id1 AND a.link_app2=b.link_app1
418 418
                        			JOIN $table c ON a.link_id1=c.link_id1 AND a.link_app1=c.link_app1 AND a.link_id!=c.link_id AND c.link_app2=b.link_app2 AND c.link_id2=b.link_id2",
419 419
 			),
420 420
 			// retrieve the type of links, where the relation is realized as timesheet->infolog/tracker and projectmanager->timesheet
421 421
 			array('table'=>self::TABLE,
422 422
 				'cols'=>'b.link_id, b.link_app2 as app1, b.link_id2 as id1, b.link_app1 as app2, b.link_id1 as id2, b.link_remark,b.link_lastmod,b.link_owner,b.deleted,c.link_app1 AS app3,c.link_id1 AS id3,c.link_id AS link3',
423
-                       		'where'=>'a.link_app1='.self::$db->quote($app).' AND b.link_app1='.self::$db->quote($target_app).
424
-                        		(!$target_id ? '' : self::$db->expression(self::TABLE,' AND b.',array('link_id1' => $target_id))),
425
-                        	'join'=>" a
423
+					   		'where'=>'a.link_app1='.self::$db->quote($app).' AND b.link_app1='.self::$db->quote($target_app).
424
+								(!$target_id ? '' : self::$db->expression(self::TABLE,' AND b.',array('link_id1' => $target_id))),
425
+							'join'=>" a
426 426
                         		JOIN $table b ON a.link_id1=b.link_id2 AND a.link_app1=b.link_app2
427 427
                         		JOIN $table c ON a.link_id2=c.link_id1 AND a.link_app2=c.link_app1 AND a.link_id!=c.link_id AND c.link_app2=b.link_app1 AND c.link_id2=b.link_id1",
428 428
 			),
429 429
 			// retrieve the type of links, where the relation is realized as timesheet->projectmanager and infolog->timesheet
430 430
 			array('table'=>self::TABLE,
431 431
 				'cols'=>'a.*,c.link_app1 AS app3,c.link_id1 AS id3,c.link_id AS link3',
432
-                     		'where'=>'a.link_app1='.self::$db->quote($app).' AND a.link_app2='.self::$db->quote($target_app).
433
-                        		(!$target_id ? '' : self::$db->expression(self::TABLE,' AND a.',array('link_id2' => $target_id))),
434
-                       		'join'=>" a
432
+					 		'where'=>'a.link_app1='.self::$db->quote($app).' AND a.link_app2='.self::$db->quote($target_app).
433
+								(!$target_id ? '' : self::$db->expression(self::TABLE,' AND a.',array('link_id2' => $target_id))),
434
+					   		'join'=>" a
435 435
                        			JOIN $table b ON a.link_id1=b.link_id2 AND a.link_app1=b.link_app2
436 436
                         		JOIN $table c ON a.link_id2=c.link_id2 AND a.link_app2=c.link_app2 AND a.link_id!=c.link_id AND c.link_app1=b.link_app1 AND c.link_id1=b.link_id1",
437 437
 			),
Please login to merge, or discard this patch.
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	 * @param int $lastmod =0 timestamp of last modification (defaults to now=time())
60 60
 	 * @return int/boolean False (for db or param-error) or on success link_id (Please not the return-value of $id1)
61 61
 	 */
62
-	static function link( $app1,&$id1,$app2,$id2='',$remark='',$owner=0,$lastmod=0 )
62
+	static function link($app1, &$id1, $app2, $id2 = '', $remark = '', $owner = 0, $lastmod = 0)
63 63
 	{
64 64
 		if (self::DEBUG)
65 65
 		{
@@ -68,21 +68,21 @@  discard block
 block discarded – undo
68 68
 		if ($app1 == $app2 && $id1 == $id2 ||
69 69
 		    $id1 == '' || $id2 == '' || $app1 == '' || $app2 == '')
70 70
 		{
71
-			return False;	// dont link to self or other nosense
71
+			return False; // dont link to self or other nosense
72 72
 		}
73
-		if (($link = self::get_link($app1,$id1,$app2,$id2)))
73
+		if (($link = self::get_link($app1, $id1, $app2, $id2)))
74 74
 		{
75 75
 			if ($link['link_remark'] != $remark)
76 76
 			{
77
-				self::update_remark($link['link_id'],$remark);
77
+				self::update_remark($link['link_id'], $remark);
78 78
 			}
79
-			return $link['link_id'];	// link alread exist
79
+			return $link['link_id']; // link alread exist
80 80
 		}
81 81
 		if (!$owner)
82 82
 		{
83 83
 			$owner = $GLOBALS['egw_info']['user']['account_id'];
84 84
 		}
85
-		return self::$db->insert(self::TABLE,array(
85
+		return self::$db->insert(self::TABLE, array(
86 86
 				'link_app1'		=> $app1,
87 87
 				'link_id1'		=> $id1,
88 88
 				'link_app2'		=> $app2,
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 				'link_remark'	=> $remark,
91 91
 				'link_lastmod'	=> $lastmod ? $lastmod : time(),
92 92
 				'link_owner'	=> $owner,
93
-			),False,__LINE__,__FILE__) ? self::$db->get_last_insert_id(self::TABLE,'link_id') : false;
93
+			), False, __LINE__, __FILE__) ? self::$db->get_last_insert_id(self::TABLE, 'link_id') : false;
94 94
 	}
95 95
 
96 96
 	/**
@@ -100,14 +100,14 @@  discard block
 block discarded – undo
100 100
 	 * @param string $remark new text for the remark
101 101
 	 * @return boolean true on success, else false
102 102
 	 */
103
-	static function update_remark($link_id,$remark)
103
+	static function update_remark($link_id, $remark)
104 104
 	{
105
-		return self::$db->update(self::TABLE,array(
105
+		return self::$db->update(self::TABLE, array(
106 106
 				'link_remark'	=> $remark,
107 107
 				'link_lastmod'	=> time(),
108
-			),array(
108
+			), array(
109 109
 				'link_id'	=> $link_id,
110
-			),__LINE__,__FILE__);
110
+			), __LINE__, __FILE__);
111 111
 	}
112 112
 
113 113
 	/**
@@ -121,15 +121,15 @@  discard block
 block discarded – undo
121 121
 	 * @param int|array $limit =null number of entries to return, default null = all or array(offset, num_rows) to return num_rows starting from offset
122 122
 	 * @return array id => links pairs if $id is an array or just the links (only_app: ids) or empty array if no matching links found
123 123
 	 */
124
-	static function get_links($app, $id, $only_app='', $order='link_lastmod DESC', $deleted=false, $limit=null)
124
+	static function get_links($app, $id, $only_app = '', $order = 'link_lastmod DESC', $deleted = false, $limit = null)
125 125
 	{
126 126
 		if (self::DEBUG)
127 127
 		{
128
-			echo "<p>solink.get_links($app,".print_r($id,true).",$only_app,$order,$deleted)</p>\n";
128
+			echo "<p>solink.get_links($app,".print_r($id, true).",$only_app,$order,$deleted)</p>\n";
129 129
 		}
130 130
 		if (($not_only = $only_app[0] == '!'))
131 131
 		{
132
-			$only_app = substr($only_app,1);
132
+			$only_app = substr($only_app, 1);
133 133
 		}
134 134
 
135 135
 		$offset = false;
@@ -137,32 +137,32 @@  discard block
 block discarded – undo
137 137
 		{
138 138
 			list($offset, $limit) = $limit;
139 139
 		}
140
-		elseif($limit)
140
+		elseif ($limit)
141 141
 		{
142 142
 			$offset = 0;
143 143
 		}
144 144
 
145 145
 		$links = array();
146 146
 		try {
147
-			foreach(self::$db->select(self::TABLE, '*', self::$db->expression(self::TABLE, '((', array(
147
+			foreach (self::$db->select(self::TABLE, '*', self::$db->expression(self::TABLE, '((', array(
148 148
 						'link_app1'	=> $app,
149 149
 						'link_id1'	=> $id,
150
-					),') OR (',array(
150
+					), ') OR (', array(
151 151
 						'link_app2'	=> $app,
152 152
 						'link_id2'	=> $id,
153
-					),'))',
153
+					), '))',
154 154
 					$deleted ? '' : ' AND deleted IS NULL'
155 155
 				), __LINE__, __FILE__, $offset, $order ? " ORDER BY $order" : '', 'phpgwapi', $limit) as $row)
156 156
 			{
157 157
 				// check if left side (1) is one of our targets --> add it
158
-				if ($row['link_app1'] == $app && in_array($row['link_id1'],(array)$id))
158
+				if ($row['link_app1'] == $app && in_array($row['link_id1'], (array)$id))
159 159
 				{
160
-					self::_add2links($row,true,$only_app,$not_only,$links);
160
+					self::_add2links($row, true, $only_app, $not_only, $links);
161 161
 				}
162 162
 				// check if right side (2) is one of our targets --> add it (both can be true for multiple targets!)
163
-				if ($row['link_app2'] == $app && in_array($row['link_id2'],(array)$id))
163
+				if ($row['link_app2'] == $app && in_array($row['link_id2'], (array)$id))
164 164
 				{
165
-					self::_add2links($row,false,$only_app,$not_only,$links);
165
+					self::_add2links($row, false, $only_app, $not_only, $links);
166 166
 				}
167 167
 			}
168 168
 			// if query returns exactly limit rows, we assume there are more and therefore set self::$limit_exceeded
@@ -170,18 +170,18 @@  discard block
 block discarded – undo
170 170
 		}
171 171
 		// catch Illegal mix of collations (ascii_general_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '=' (1267)
172 172
 		// caused by non-ascii chars compared with ascii field uid
173
-		catch(Api\Db\Exception $e) {
173
+		catch (Api\Db\Exception $e) {
174 174
 			_egw_log_exception($e);
175 175
 		}
176 176
 		return is_array($id) ? $links : ($links[$id] ? $links[$id] : array());
177 177
 	}
178 178
 
179
-	private static function _add2links($row,$left,$only_app,$not_only,array &$links)
179
+	private static function _add2links($row, $left, $only_app, $not_only, array &$links)
180 180
 	{
181 181
 		$linked_app = $left ? $row['link_app2'] : $row['link_app1'];
182 182
 		$linked_id  = $left ? $row['link_id2'] : $row['link_id1'];
183 183
 		$app_id = $left ? $row['link_id1'] : $row['link_id2'];
184
-		list($app) = explode('-',$linked_app);
184
+		list($app) = explode('-', $linked_app);
185 185
 		if ($only_app && $not_only == ($linked_app == $only_app) || !$GLOBALS['egw_info']['user']['apps'][$app])
186 186
 		{
187 187
 			#echo "$linked_app == $only_app, ";var_dump($linked_app == $only_app);echo "	->dont return a link<br>";
@@ -208,13 +208,13 @@  discard block
 block discarded – undo
208 208
 	 * @param string $id2 ='' id in $app2, if no integer link_id given in $app_link_id
209 209
 	 * @return array with link-data or False
210 210
 	 */
211
-	static function get_link($app_link_id,$id='',$app2='',$id2='')
211
+	static function get_link($app_link_id, $id = '', $app2 = '', $id2 = '')
212 212
 	{
213 213
 		if (self::DEBUG)
214 214
 		{
215 215
 			echo "<p>solink.get_link('$app_link_id',$id,'$app2','$id2')</p>\n";
216 216
 		}
217
-		if ((int) $app_link_id > 0)
217
+		if ((int)$app_link_id > 0)
218 218
 		{
219 219
 			$where = array('link_id' => $app_link_id);
220 220
 		}
@@ -224,24 +224,24 @@  discard block
 block discarded – undo
224 224
 			{
225 225
 				return False;
226 226
 			}
227
-			$where = self::$db->expression(self::TABLE,'(',array(
227
+			$where = self::$db->expression(self::TABLE, '(', array(
228 228
 					'link_app1'	=> $app_link_id,
229 229
 					'link_id1'	=> $id,
230 230
 					'link_app2'	=> $app2,
231 231
 					'link_id2'	=> $id2,
232
-				),') OR (',array(
232
+				), ') OR (', array(
233 233
 					'link_app2'	=> $app_link_id,
234 234
 					'link_id2'	=> $id,
235 235
 					'link_app1'	=> $app2,
236 236
 					'link_id1'	=> $id2,
237
-				),')');
237
+				), ')');
238 238
 		}
239 239
 		try {
240
-			return self::$db->select(self::TABLE,'*',$where,__LINE__,__FILE__)->fetch(ADODB_FETCH_ASSOC);
240
+			return self::$db->select(self::TABLE, '*', $where, __LINE__, __FILE__)->fetch(ADODB_FETCH_ASSOC);
241 241
 		}
242 242
 		// catch Illegal mix of collations (ascii_general_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '=' (1267)
243 243
 		// caused by non-ascii chars compared with ascii field uid
244
-		catch(Api\Db\Exception $e) {
244
+		catch (Api\Db\Exception $e) {
245 245
 			_egw_log_exception($e);
246 246
 		}
247 247
 		return false;
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 	 * @param boolean $hold_for_purge Don't really delete the link, just mark it as deleted and wait for final delete of linked entry
260 260
 	 * @return array with deleted links
261 261
 	 */
262
-	static function unlink($link_id,$app='',$id='',$owner=0,$app2='',$id2='',$hold_for_purge=false)
262
+	static function unlink($link_id, $app = '', $id = '', $owner = 0, $app2 = '', $id2 = '', $hold_for_purge = false)
263 263
 	{
264 264
 		if (self::DEBUG)
265 265
 		{
@@ -284,21 +284,21 @@  discard block
 block discarded – undo
284 284
 					$check1['link_id1'] = $id;
285 285
 					$check2['link_id2'] = $id;
286 286
 				}
287
-				$where = self::$db->expression(self::TABLE,'((',$check1,') OR (',$check2,'))');
287
+				$where = self::$db->expression(self::TABLE, '((', $check1, ') OR (', $check2, '))');
288 288
 			}
289 289
 			elseif ($app != '' && $app2 != '')
290 290
 			{
291
-				$where = self::$db->expression(self::TABLE,'(',array(
291
+				$where = self::$db->expression(self::TABLE, '(', array(
292 292
 						'link_app1'	=> $app,
293 293
 						'link_id1'	=> $id,
294 294
 						'link_app2'	=> $app2,
295 295
 						'link_id2'	=> $id2,
296
-					),') OR (',array(
296
+					), ') OR (', array(
297 297
 						'link_app1'	=> $app2,
298 298
 						'link_id1'	=> $id2,
299 299
 						'link_app2'	=> $app,
300 300
 						'link_id2'	=> $id,
301
-					),')');
301
+					), ')');
302 302
 			}
303 303
 			if ($owner)
304 304
 			{
@@ -308,25 +308,25 @@  discard block
 block discarded – undo
308 308
 		}
309 309
 		$deleted = array();
310 310
 		try {
311
-			foreach(self::$db->select(self::TABLE,'*',$where,__LINE__,__FILE__) as $row)
311
+			foreach (self::$db->select(self::TABLE, '*', $where, __LINE__, __FILE__) as $row)
312 312
 			{
313 313
 				$deleted[] = $row;
314 314
 			}
315
-			if($hold_for_purge)
315
+			if ($hold_for_purge)
316 316
 			{
317
-				self::$db->update(self::TABLE,array(
317
+				self::$db->update(self::TABLE, array(
318 318
 					'deleted' => time(),
319 319
 					'link_lastmod' => time(),
320
-				), $where, __LINE__,__FILE__);
320
+				), $where, __LINE__, __FILE__);
321 321
 			}
322 322
 			else
323 323
 			{
324
-				self::$db->delete(self::TABLE,$where,__LINE__,__FILE__);
324
+				self::$db->delete(self::TABLE, $where, __LINE__, __FILE__);
325 325
 			}
326 326
 		}
327 327
 		// catch Illegal mix of collations (ascii_general_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '=' (1267)
328 328
 		// caused by non-ascii chars compared with ascii field uid
329
-		catch(Api\Db\Exception $e) {
329
+		catch (Api\Db\Exception $e) {
330 330
 			_egw_log_exception($e);
331 331
 		}
332 332
 
@@ -357,8 +357,8 @@  discard block
 block discarded – undo
357 357
 			$check1['link_id1'] = $id;
358 358
 			$check2['link_id2'] = $id;
359 359
 		}
360
-		$where = self::$db->expression(self::TABLE,'((',$check1,') OR (',$check2,'))');
361
-		self::$db->update(self::TABLE,array('deleted'=> null), $where, __LINE__,__FILE__);
360
+		$where = self::$db->expression(self::TABLE, '((', $check1, ') OR (', $check2, '))');
361
+		self::$db->update(self::TABLE, array('deleted'=> null), $where, __LINE__, __FILE__);
362 362
 	}
363 363
 
364 364
 	/**
@@ -371,13 +371,13 @@  discard block
 block discarded – undo
371 371
 	 * @param int $new_owner account_id of new owner
372 372
 	 * @return int number of links changed
373 373
 	 */
374
-	static function chown($owner,$new_owner)
374
+	static function chown($owner, $new_owner)
375 375
 	{
376
-		if ((int)$owner <= 0 || (int) $new_owner <= 0)
376
+		if ((int)$owner <= 0 || (int)$new_owner <= 0)
377 377
 		{
378 378
 			return 0;
379 379
 		}
380
-		self::$db->update(self::TABLE,array('owner'=>$new_owner),array('owner'=>$owner),__LINE__,__FILE__);
380
+		self::$db->update(self::TABLE, array('owner'=>$new_owner), array('owner'=>$owner), __LINE__, __FILE__);
381 381
 
382 382
 		return self::$db->affected_rows();
383 383
 	}
@@ -404,15 +404,15 @@  discard block
 block discarded – undo
404 404
 	 * @param int|array $limit =null number of entries to return, default null = all or array(offset, num_rows) to return num_rows starting from offset
405 405
 	 * @return array with links from entries from $app to $target_app/$target_id plus the other (b) link_id/app/id in the keys 'link3'/'app3'/'id3'
406 406
 	 */
407
-	static function get_3links($app, $target_app, $target_id=null, $just_app_ids=false, $order='link_lastmod DESC', $limit=null)
407
+	static function get_3links($app, $target_app, $target_id = null, $just_app_ids = false, $order = 'link_lastmod DESC', $limit = null)
408 408
 	{
409 409
 		$table = self::TABLE;
410
-		$arrayofselects=array(
410
+		$arrayofselects = array(
411 411
 			// retrieve the type of links, where the relation is realized as timesheet->infolog/tracker via infolog->projectmanager to timesheet->projectmanager
412 412
 			array('table'=>self::TABLE,
413 413
 				'cols'=>'c.*,b.link_app1 AS app3,b.link_id1 AS id3,b.link_id AS link3',
414 414
 				'where'=>'a.link_app1='.self::$db->quote($app).' AND c.link_app2='.self::$db->quote($target_app).
415
-                        		(!$target_id ? '' : self::$db->expression(self::TABLE,' AND c.',array('link_id2' => $target_id))),
415
+                        		(!$target_id ? '' : self::$db->expression(self::TABLE, ' AND c.', array('link_id2' => $target_id))),
416 416
                         	'join'=>" a
417 417
                         		JOIN $table b ON a.link_id2=b.link_id1 AND a.link_app2=b.link_app1
418 418
                        			JOIN $table c ON a.link_id1=c.link_id1 AND a.link_app1=c.link_app1 AND a.link_id!=c.link_id AND c.link_app2=b.link_app2 AND c.link_id2=b.link_id2",
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
 			array('table'=>self::TABLE,
422 422
 				'cols'=>'b.link_id, b.link_app2 as app1, b.link_id2 as id1, b.link_app1 as app2, b.link_id1 as id2, b.link_remark,b.link_lastmod,b.link_owner,b.deleted,c.link_app1 AS app3,c.link_id1 AS id3,c.link_id AS link3',
423 423
                        		'where'=>'a.link_app1='.self::$db->quote($app).' AND b.link_app1='.self::$db->quote($target_app).
424
-                        		(!$target_id ? '' : self::$db->expression(self::TABLE,' AND b.',array('link_id1' => $target_id))),
424
+                        		(!$target_id ? '' : self::$db->expression(self::TABLE, ' AND b.', array('link_id1' => $target_id))),
425 425
                         	'join'=>" a
426 426
                         		JOIN $table b ON a.link_id1=b.link_id2 AND a.link_app1=b.link_app2
427 427
                         		JOIN $table c ON a.link_id2=c.link_id1 AND a.link_app2=c.link_app1 AND a.link_id!=c.link_id AND c.link_app2=b.link_app1 AND c.link_id2=b.link_id1",
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
 			array('table'=>self::TABLE,
431 431
 				'cols'=>'a.*,c.link_app1 AS app3,c.link_id1 AS id3,c.link_id AS link3',
432 432
                      		'where'=>'a.link_app1='.self::$db->quote($app).' AND a.link_app2='.self::$db->quote($target_app).
433
-                        		(!$target_id ? '' : self::$db->expression(self::TABLE,' AND a.',array('link_id2' => $target_id))),
433
+                        		(!$target_id ? '' : self::$db->expression(self::TABLE, ' AND a.', array('link_id2' => $target_id))),
434 434
                        		'join'=>" a
435 435
                        			JOIN $table b ON a.link_id1=b.link_id2 AND a.link_app1=b.link_app2
436 436
                         		JOIN $table c ON a.link_id2=c.link_id2 AND a.link_app2=c.link_app2 AND a.link_id!=c.link_id AND c.link_app1=b.link_app1 AND c.link_id1=b.link_id1",
@@ -442,17 +442,17 @@  discard block
 block discarded – undo
442 442
 		{
443 443
 			list($offset, $limit) = $limit;
444 444
 		}
445
-		elseif($limit)
445
+		elseif ($limit)
446 446
 		{
447 447
 			$offset = 0;
448 448
 		}
449 449
 
450 450
 		$links = array();
451
-		foreach(self::$db->union($arrayofselects, __LINE__, __FILE__, $order, $offset, $limit) as $row)
451
+		foreach (self::$db->union($arrayofselects, __LINE__, __FILE__, $order, $offset, $limit) as $row)
452 452
 		{
453 453
 			if ($just_app_ids)
454 454
 			{
455
-				if ($row['link_app1'] == $target_app && (is_null($target_id) || in_array($row['link_id1'],(array)$target_id)))
455
+				if ($row['link_app1'] == $target_app && (is_null($target_id) || in_array($row['link_id1'], (array)$target_id)))
456 456
 				{
457 457
 					$links[$row['link_id']] = $row['link_id2'];
458 458
 				}
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
 			}
464 464
 			else
465 465
 			{
466
-				$links[] = Api\Db::strip_array_keys($row,'link_');
466
+				$links[] = Api\Db::strip_array_keys($row, 'link_');
467 467
 			}
468 468
 		}
469 469
 		// if query returns exactly limit rows, we assume there are more and therefore set self::$limit_exceeded
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
 	 */
478 478
 	static function init_static( )
479 479
 	{
480
-		self::$db     = $GLOBALS['egw']->db;
480
+		self::$db = $GLOBALS['egw']->db;
481 481
 	}
482 482
 }
483 483
 Storage::init_static();
Please login to merge, or discard this patch.
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -302,7 +302,10 @@
 block discarded – undo
302 302
 			}
303 303
 			if ($owner)
304 304
 			{
305
-				if ($app) $where = array($where);
305
+				if ($app)
306
+				{
307
+					$where = array($where);
308
+				}
306 309
 				$where['link_owner'] = $owner;
307 310
 			}
308 311
 		}
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -269,7 +269,7 @@
 block discarded – undo
269 269
 		{
270 270
 			$where = array('link_id' => $link_id);
271 271
 		}
272
-		elseif ($app == '' AND $owner == '')
272
+		elseif ($app == '' and $owner == '')
273 273
 		{
274 274
 			return 0;
275 275
 		}
Please login to merge, or discard this patch.
api/src/Mail/Account.php 3 patches
Doc Comments   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
 	 * @param boolean $replace_placeholders =false should placeholders like {{n_fn}} be replaced
487 487
 	 * @param string $field ='name' what to return as value: "ident_(realname|org|email|signature)" or default "name"=result from identity_name
488 488
 	 * @param int $user =null account_id to use if not current user
489
-	 * @return Iterator ident_id => identity_name of identity
489
+	 * @return Api\Db\CallbackIterator ident_id => identity_name of identity
490 490
 	 */
491 491
 	public static function identities($account, $replace_placeholders=true, $field='name', $user=null)
492 492
 	{
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
 	 *
796 796
 	 * To get $this->params you need to call getUserData before! It is never automatically loaded.
797 797
 	 *
798
-	 * @param type $name
798
+	 * @param string $name
799 799
 	 * @return mixed
800 800
 	 */
801 801
 	public function __get($name)
@@ -819,8 +819,8 @@  discard block
 block discarded – undo
819 819
 	/**
820 820
 	 * Give read access to protected parameters in $this->params
821 821
 	 *
822
-	 * @param type $name
823
-	 * @return mixed
822
+	 * @param string $name
823
+	 * @return boolean
824 824
 	 */
825 825
 	public function __isset($name)
826 826
 	{
@@ -1340,10 +1340,10 @@  discard block
 block discarded – undo
1340 1340
 	 * @param boolean|string $just_name =true true: return self::identity_name, false: return Account objects,
1341 1341
 	 *	string with attribute-name: return that attribute, eg. acc_imap_host or 'params' to return all attributes as array
1342 1342
 	 * @param string $order_by ='acc_name ASC'
1343
-	 * @param int|boolean $offset =false offset or false to return all
1343
+	 * @param boolean $offset =false offset or false to return all
1344 1344
 	 * @param int $num_rows =0 number of rows to return, 0=default from prefs (if $offset !== false)
1345 1345
 	 * @param boolean $replace_placeholders =true should placeholders like {{n_fn}} be replaced
1346
-	 * @return Iterator with acc_id => acc_name or Account objects
1346
+	 * @return Api\Db\CallbackIterator with acc_id => acc_name or Account objects
1347 1347
 	 */
1348 1348
 	public static function search($only_current_user=true, $just_name=true, $order_by=null, $offset=false, $num_rows=0, $replace_placeholders=true)
1349 1349
 	{
Please login to merge, or discard this patch.
Braces   +95 added lines, -24 removed lines patch added patch discarded remove patch
@@ -360,8 +360,14 @@  discard block
 block discarded – undo
360 360
 		{
361 361
 			// make sure mbstring.func_overload=0
362 362
 			static $func_overload = null;
363
-			if (is_null($func_overload)) $func_overload = extension_loaded('mbstring') ? ini_get('mbstring.func_overload') : 0;
364
-			if ($func_overload) throw new Api\Exception\AssertionFailed('Fatal Error: EGroupware requires mbstring.func_overload=0 set in your php.ini!');
363
+			if (is_null($func_overload))
364
+			{
365
+				$func_overload = extension_loaded('mbstring') ? ini_get('mbstring.func_overload') : 0;
366
+			}
367
+			if ($func_overload)
368
+			{
369
+				throw new Api\Exception\AssertionFailed('Fatal Error: EGroupware requires mbstring.func_overload=0 set in your php.ini!');
370
+			}
365 371
 
366 372
 			$class = $this->params['acc_imap_type'];
367 373
 			$this->imapServer = new $class($this->params, $_adminConnection, $_timeout);
@@ -490,7 +496,10 @@  discard block
 block discarded – undo
490 496
 	 */
491 497
 	public static function identities($account, $replace_placeholders=true, $field='name', $user=null)
492 498
 	{
493
-		if (!isset($user)) $user = $GLOBALS['egw_info']['user']['account_id'];
499
+		if (!isset($user))
500
+		{
501
+			$user = $GLOBALS['egw_info']['user']['account_id'];
502
+		}
494 503
 		$acc_id = is_scalar($account) ? $account : $account['acc_id'];
495 504
 
496 505
 		$cols = array('ident_id', 'ident_name', 'ident_realname', 'ident_org', 'ident_email', 'ident_signature', 'acc_id', 'acc_imap_username', 'acc_imap_logintype', 'acc_domain');
@@ -528,8 +537,14 @@  discard block
 block discarded – undo
528 537
 				// fill an empty ident_realname or ident_email of current user with data from user account
529 538
 				if ($replace_placeholders && (!isset($user) || $user == $GLOBALS['egw_info']['user']['acount_id']))
530 539
 				{
531
-					if (empty($row['ident_realname'])) $row['ident_realname'] = $GLOBALS['egw_info']['user']['account_fullname'];
532
-					if (empty($row['ident_email'])) $row['ident_email'] = $GLOBALS['egw_info']['user']['account_email'];
540
+					if (empty($row['ident_realname']))
541
+					{
542
+						$row['ident_realname'] = $GLOBALS['egw_info']['user']['account_fullname'];
543
+					}
544
+					if (empty($row['ident_email']))
545
+					{
546
+						$row['ident_email'] = $GLOBALS['egw_info']['user']['account_email'];
547
+					}
533 548
 				}
534 549
 				if ($field != 'name')
535 550
 				{
@@ -538,7 +553,9 @@  discard block
 block discarded – undo
538 553
 				}
539 554
 				return self::identity_name($row, $replace_placeholders);
540 555
 			}, array(),
541
-			function($row) { return $row['ident_id'];});
556
+			function($row)
557
+			{
558
+return $row['ident_id'];});
542 559
 	}
543 560
 
544 561
 	/**
@@ -554,10 +571,13 @@  discard block
 block discarded – undo
554 571
 		{
555 572
 			$address .= ($address && $identity['ident_org'] ? ' ' : '').$identity['ident_org'];
556 573
 		}
557
-		if (strpos($address, ',') !== false)	// need to quote comma
574
+		if (strpos($address, ',') !== false)
575
+		{
576
+			// need to quote comma
558 577
 		{
559 578
 			$address = '"'.str_replace('"', '\\"', $address).'"';
560 579
 		}
580
+		}
561 581
 		if (!strpos($identity['ident_email'], '@'))
562 582
 		{
563 583
 			$address = null;
@@ -661,8 +681,14 @@  discard block
 block discarded – undo
661 681
 		if ($to_replace)
662 682
 		{
663 683
 			static $merge=null;
664
-			if (!isset($merge)) $merge = new Api\Contacts\Merge();
665
-			if (!isset($account_id)) $account_id = $GLOBALS['egw_info']['user']['account_id'];
684
+			if (!isset($merge))
685
+			{
686
+				$merge = new Api\Contacts\Merge();
687
+			}
688
+			if (!isset($account_id))
689
+			{
690
+				$account_id = $GLOBALS['egw_info']['user']['account_id'];
691
+			}
666 692
 			foreach($to_replace as $name => &$value)
667 693
 			{
668 694
 				$err = null;
@@ -1083,7 +1109,10 @@  discard block
 block discarded – undo
1083 1109
 				}
1084 1110
 
1085 1111
 				// fetch the IMAP / incomming server data
1086
-				if (!class_exists($data['acc_smtp_type'])) $data['acc_smtp_type'] = __NAMESPACE__.'\\Smtp';
1112
+				if (!class_exists($data['acc_smtp_type']))
1113
+				{
1114
+					$data['acc_smtp_type'] = __NAMESPACE__.'\\Smtp';
1115
+				}
1087 1116
 			}
1088 1117
 		}
1089 1118
 		return $data;
@@ -1115,7 +1144,10 @@  discard block
 block discarded – undo
1115 1144
 		}
1116 1145
 
1117 1146
 		// fetch the IMAP / incomming server data
1118
-		if (!class_exists($imap_type)) $imap_type = __NAMESPACE__.'\\Imap';
1147
+		if (!class_exists($imap_type))
1148
+		{
1149
+			$imap_type = __NAMESPACE__.'\\Imap';
1150
+		}
1119 1151
 
1120 1152
 		return $imap_type;
1121 1153
 	}
@@ -1168,7 +1200,10 @@  discard block
 block discarded – undo
1168 1200
 			$data['acc_id'] = self::$db->get_last_insert_id(self::TABLE, 'acc_id');
1169 1201
 		}
1170 1202
 		// restore namespace in class-names
1171
-		if ($backup) $data = array_merge($data, $backup);
1203
+		if ($backup)
1204
+		{
1205
+			$data = array_merge($data, $backup);
1206
+		}
1172 1207
 
1173 1208
 		// store identity
1174 1209
 		$new_ident_id = self::save_identity($data);
@@ -1279,7 +1314,10 @@  discard block
 block discarded – undo
1279 1314
 	 */
1280 1315
 	protected static function credentials_valid_for($account, $account_id=null)
1281 1316
 	{
1282
-		if (!isset($account_id)) $account_id = $GLOBALS['egw_info']['user']['account_id'];
1317
+		if (!isset($account_id))
1318
+		{
1319
+			$account_id = $GLOBALS['egw_info']['user']['account_id'];
1320
+		}
1283 1321
 
1284 1322
 		// if account valid for multiple users
1285 1323
 		if (self::is_multiple($account))
@@ -1398,9 +1436,12 @@  discard block
 block discarded – undo
1398 1436
 				$cols[] = $valid_account_id_sql.' AS account_id';
1399 1437
 				$join .= ' '.self::ALL_VALID_JOIN;
1400 1438
 			}
1401
-			if ($just_name == 'params')	// join in acc_imap_admin_username
1439
+			if ($just_name == 'params')
1440
+			{
1441
+				// join in acc_imap_admin_username
1402 1442
 			{
1403 1443
 				$cols[] = self::ADMIN_COL;
1444
+			}
1404 1445
 				$join .= ' '.self::ADMIN_JOIN;
1405 1446
 			}
1406 1447
 			$rs = self::$db->select(self::TABLE, $cols,	$where, __LINE__, __FILE__,
@@ -1434,7 +1475,10 @@  discard block
 block discarded – undo
1434 1475
 				}
1435 1476
 			}
1436 1477
 		}
1437
-		if (is_null(self::$search_cache[$cache_key])) self::$search_cache[$cache_key]=array();
1478
+		if (is_null(self::$search_cache[$cache_key]))
1479
+		{
1480
+			self::$search_cache[$cache_key]=array();
1481
+		}
1438 1482
 		return new Api\Db\CallbackIterator(new \ArrayIterator(self::$search_cache[$cache_key]),
1439 1483
 			// process each row
1440 1484
 			function($row) use ($just_name, $replace_placeholders, $account_id)
@@ -1476,12 +1520,18 @@  discard block
 block discarded – undo
1476 1520
 			{
1477 1521
 				if ($smtp)
1478 1522
 				{
1479
-					if (!$params['acc_smtp_host'] || !$params['acc_smtp_port']) continue;
1523
+					if (!$params['acc_smtp_host'] || !$params['acc_smtp_port'])
1524
+					{
1525
+						continue;
1526
+					}
1480 1527
 					// check requirement of session, which is not available in async service!
1481 1528
 					if (isset($GLOBALS['egw_info']['flags']['async-service']) ||
1482
-						empty($GLOBALS['egw_info']['user']['account_id']))	// happens during login when notifying about blocked accounts
1529
+						empty($GLOBALS['egw_info']['user']['account_id']))
1530
+					{
1531
+						// happens during login when notifying about blocked accounts
1483 1532
 					{
1484 1533
 						if ($params['acc_smtp_auth_session']) continue;
1534
+					}
1485 1535
 						// may fail because of smtp only profile, or no session password, etc
1486 1536
 						try
1487 1537
 						{
@@ -1492,15 +1542,24 @@  discard block
 block discarded – undo
1492 1542
 							unset($x);
1493 1543
 							continue;
1494 1544
 						}
1495
-						if (Credentials::isUser($account->acc_smtp_pw_enc)) continue;
1545
+						if (Credentials::isUser($account->acc_smtp_pw_enc))
1546
+						{
1547
+							continue;
1548
+						}
1496 1549
 					}
1497 1550
 				}
1498 1551
 				else
1499 1552
 				{
1500
-					if (!$params['acc_imap_host'] || !$params['acc_imap_port']) continue;
1553
+					if (!$params['acc_imap_host'] || !$params['acc_imap_port'])
1554
+					{
1555
+						continue;
1556
+					}
1501 1557
 					$account = new Account($params);
1502 1558
 					// continue if we have either no imap username or password
1503
-					if (!$account->is_imap()) continue;
1559
+					if (!$account->is_imap())
1560
+					{
1561
+						continue;
1562
+					}
1504 1563
 				}
1505 1564
 				return $return_id ? $acc_id : (isset($account) && $account->acc_id == $acc_id ?
1506 1565
 					$account : new Account($params));
@@ -1508,7 +1567,10 @@  discard block
 block discarded – undo
1508 1567
 		}
1509 1568
 		catch (\Exception $e)
1510 1569
 		{
1511
-			if ($log_no_default) error_log(__METHOD__.__LINE__.' Error no Default available.'.$e->getMessage());
1570
+			if ($log_no_default)
1571
+			{
1572
+				error_log(__METHOD__.__LINE__.' Error no Default available.'.$e->getMessage());
1573
+			}
1512 1574
 		}
1513 1575
 		return null;
1514 1576
 	}
@@ -1570,8 +1632,14 @@  discard block
 block discarded – undo
1570 1632
 				// fill an empty ident_realname or ident_email of current user with data from user account
1571 1633
 				if ($replace_placeholders && (!isset($account_id) || $account_id == $GLOBALS['egw_info']['user']['acount_id']))
1572 1634
 				{
1573
-					if (empty($account['ident_realname'])) $account['ident_realname'] = $GLOBALS['egw_info']['user']['account_fullname'];
1574
-					if (empty($account['ident_email'])) $account['ident_email'] = $GLOBALS['egw_info']['user']['account_email'];
1635
+					if (empty($account['ident_realname']))
1636
+					{
1637
+						$account['ident_realname'] = $GLOBALS['egw_info']['user']['account_fullname'];
1638
+					}
1639
+					if (empty($account['ident_email']))
1640
+					{
1641
+						$account['ident_email'] = $GLOBALS['egw_info']['user']['account_email'];
1642
+					}
1575 1643
 				}
1576 1644
 				if (empty($account['ident_email']) && !empty($account['acc_imap_username']) && strpos($account['acc_imap_username'], '@') !== false)
1577 1645
 				{
@@ -1642,7 +1710,10 @@  discard block
 block discarded – undo
1642 1710
 	 */
1643 1711
 	protected static function memberships($user=null)
1644 1712
 	{
1645
-		if (!$user) $user = $GLOBALS['egw_info']['user']['account_id'];
1713
+		if (!$user)
1714
+		{
1715
+			$user = $GLOBALS['egw_info']['user']['account_id'];
1716
+		}
1646 1717
 
1647 1718
 		$memberships = $GLOBALS['egw']->accounts->memberships($user, true);
1648 1719
 		$memberships[] = $user;
Please login to merge, or discard this patch.
Spacing   +67 added lines, -70 removed lines patch added patch discarded remove patch
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	/**
198 198
 	 * Path to log smtp comunication to or null to not log
199 199
 	 */
200
-	const SMTP_DEBUG_LOG = null;//'/tmp/smtp.log';
200
+	const SMTP_DEBUG_LOG = null; //'/tmp/smtp.log';
201 201
 
202 202
 	/**
203 203
 	 * Instanciated account object by acc_id, read acts as singelton
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 	 * @param int $called_for=null if set access to given user (without smtp credentials!),
253 253
 	 *	default current user AND read username/password from current users session
254 254
 	 */
255
-	/*protected*/ function __construct(array $params, $called_for=null)
255
+	/*protected*/ function __construct(array $params, $called_for = null)
256 256
 	{
257 257
 		// read credentials from database
258 258
 		$params += Credentials::read($params['acc_id'], null, $called_for ? array(0, $called_for) : $called_for, $this->on_login);
@@ -281,16 +281,16 @@  discard block
 block discarded – undo
281 281
 	public static function ssl2secure($ssl)
282 282
 	{
283 283
 		$secure = false;
284
-		switch($ssl & ~self::SSL_VERIFY)
284
+		switch ($ssl&~self::SSL_VERIFY)
285 285
 		{
286 286
 			case self::SSL_STARTTLS:
287
-				$secure = 'tls';	// Horde uses 'tls' for STARTTLS, not ssl connection with tls version >= 1 and no sslv2/3
287
+				$secure = 'tls'; // Horde uses 'tls' for STARTTLS, not ssl connection with tls version >= 1 and no sslv2/3
288 288
 				break;
289 289
 			case self::SSL_SSL:
290 290
 				$secure = 'ssl';
291 291
 				break;
292 292
 			case self::SSL_TLS:
293
-				$secure = 'tlsv1';	// since Horde_Imap_Client-1.16.0 requiring Horde_Socket_Client-1.1.0
293
+				$secure = 'tlsv1'; // since Horde_Imap_Client-1.16.0 requiring Horde_Socket_Client-1.1.0
294 294
 				break;
295 295
 		}
296 296
 		return $secure;
@@ -319,15 +319,15 @@  discard block
 block discarded – undo
319 319
 				$this->params = array_merge($this->params, $data);
320 320
 			}
321 321
 		}
322
-		catch(Horde_Imap_Client_Exception $e) {
322
+		catch (Horde_Imap_Client_Exception $e) {
323 323
 			unset($e);
324 324
 			// ignore eg. connection errors
325 325
 		}
326
-		catch(\InvalidArgumentException $e) {
326
+		catch (\InvalidArgumentException $e) {
327 327
 			unset($e);
328 328
 			// ignore eg. missing admin user
329 329
 		}
330
-		$this->params += array_fill_keys(self::$user_data, null);	// make sure all keys exist now
330
+		$this->params += array_fill_keys(self::$user_data, null); // make sure all keys exist now
331 331
 
332 332
 		return (array)$data + (array)$smtp_data;
333 333
 	}
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 	 */
340 340
 	public function saveUserData($user, array $data)
341 341
 	{
342
-		$data += $this->params;	// in case only user-data has been specified
342
+		$data += $this->params; // in case only user-data has been specified
343 343
 
344 344
 		// store account-information of managed mail server
345 345
 		if ($user > 0 && $data['acc_smtp_type'] && $data['acc_smtp_type'] != __NAMESPACE__.'\\Smtp')
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 	 * @param int $_timeout =null timeout in secs, if none given fmail pref or default of 20 is used
364 364
 	 * @return Imap
365 365
 	 */
366
-	public function imapServer($_adminConnection=false, $_timeout=null)
366
+	public function imapServer($_adminConnection = false, $_timeout = null)
367 367
 	{
368 368
 		if (!isset($this->imapServer) || $this->imapServer->isAdminConnection !== $_adminConnection)
369 369
 		{
@@ -395,11 +395,11 @@  discard block
 block discarded – undo
395 395
 	 *	(matters only for imap servers managed by EGroupware!)
396 396
 	 * @return boolean
397 397
 	 */
398
-	public function is_imap($try_connect=true)
398
+	public function is_imap($try_connect = true)
399 399
 	{
400 400
 		if (empty($this->acc_imap_host) || empty($this->acc_imap_username) || empty($this->acc_imap_password))
401 401
 		{
402
-			return false;	// no imap host or credentials
402
+			return false; // no imap host or credentials
403 403
 		}
404 404
 		// if we are not managing the mail-server, we do NOT need to check deliveryMode and accountStatus
405 405
 		if ($this->acc_smtp_type == __NAMESPACE__.'\\Smtp')
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 			$this->smtpServer->editForwardingAddress = false;
437 437
 			$this->smtpServer->host = $this->params['acc_smtp_host'];
438 438
 			$this->smtpServer->port = $this->params['acc_smtp_port'];
439
-			switch($this->params['acc_smtp_ssl'])
439
+			switch ($this->params['acc_smtp_ssl'])
440 440
 			{
441 441
 				case self::SSL_TLS:
442 442
 					$this->smtpServer->host = 'tlsv1://'.$this->smtpServer->host;
@@ -466,16 +466,16 @@  discard block
 block discarded – undo
466 466
 		if (!isset($this->smtpTransport))
467 467
 		{
468 468
 			$secure = false;
469
-			switch($this->acc_smtp_ssl & ~self::SSL_VERIFY)
469
+			switch ($this->acc_smtp_ssl&~self::SSL_VERIFY)
470 470
 			{
471 471
 				case self::SSL_STARTTLS:
472
-					$secure = 'tls';	// Horde uses 'tls' for STARTTLS, not ssl connection with tls version >= 1 and no sslv2/3
472
+					$secure = 'tls'; // Horde uses 'tls' for STARTTLS, not ssl connection with tls version >= 1 and no sslv2/3
473 473
 					break;
474 474
 				case self::SSL_SSL:
475 475
 					$secure = 'ssl';
476 476
 					break;
477 477
 				case self::SSL_TLS:
478
-					$secure = 'tlsv1';	// since Horde_Smtp-1.3.0 requiring Horde_Socket_Client-1.1.0
478
+					$secure = 'tlsv1'; // since Horde_Smtp-1.3.0 requiring Horde_Socket_Client-1.1.0
479 479
 					break;
480 480
 			}
481 481
 			// Horde use locale for translation of error messages
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
 	 * @param int $user =null account_id to use if not current user
506 506
 	 * @return Iterator ident_id => identity_name of identity
507 507
 	 */
508
-	public static function identities($account, $replace_placeholders=true, $field='name', $user=null)
508
+	public static function identities($account, $replace_placeholders = true, $field = 'name', $user = null)
509 509
 	{
510 510
 		if (!isset($user)) $user = $GLOBALS['egw_info']['user']['account_id'];
511 511
 		$acc_id = is_scalar($account) ? $account : $account['acc_id'];
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
 				}
556 556
 				return self::identity_name($row, $replace_placeholders);
557 557
 			}, array(),
558
-			function($row) { return $row['ident_id'];});
558
+			function($row) { return $row['ident_id']; });
559 559
 	}
560 560
 
561 561
 	/**
@@ -598,17 +598,17 @@  discard block
 block discarded – undo
598 598
 	 * @return array acc_id:ident_id:email => rfc822 address pairs, eg. '1:1:[email protected]' => 'Ralf Becker Stylite AG <[email protected]>'
599 599
 	 * @todo add aliases for manged mail servers
600 600
 	 */
601
-	public static function rfc822_addresses($formatter=null)
601
+	public static function rfc822_addresses($formatter = null)
602 602
 	{
603 603
 		if (!$formatter || !is_callable($formatter))
604 604
 		{
605 605
 			$formatter = 'self::rfc822';
606 606
 		}
607 607
 		$addresses = array();
608
-		foreach(self::search(true, false) as $acc_id => $account)
608
+		foreach (self::search(true, false) as $acc_id => $account)
609 609
 		{
610
-			$added = false;	// make sure each account get's at least added once, even if it uses an identical email address
611
-			foreach(self::identities($account, true, 'params') as $identity)
610
+			$added = false; // make sure each account get's at least added once, even if it uses an identical email address
611
+			foreach (self::identities($account, true, 'params') as $identity)
612 612
 			{
613 613
 				if (($address = call_user_func($formatter, $identity)) && (!$added || !in_array($address, $addresses)))
614 614
 				{
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
 			}
643 643
 			return $cmp;
644 644
 		});
645
-		foreach($identities as &$identity)
645
+		foreach ($identities as &$identity)
646 646
 		{
647 647
 			$identity = self::identity_name($identity);
648 648
 		}
@@ -659,16 +659,16 @@  discard block
 block discarded – undo
659 659
 	 * @param int $account_id =null account_id of user, or current user
660 660
 	 * @return array with modified fields
661 661
 	 */
662
-	public static function replace_placeholders($identity, $account_id=null)
662
+	public static function replace_placeholders($identity, $account_id = null)
663 663
 	{
664
-		static $fields = array('ident_name','ident_realname','ident_org','ident_email','ident_signature');
664
+		static $fields = array('ident_name', 'ident_realname', 'ident_org', 'ident_email', 'ident_signature');
665 665
 
666 666
 		if (!is_array($identity) && !is_a($identity, 'Account'))
667 667
 		{
668 668
 			throw new Api\Exception\WrongParameter(__METHOD__."() requires an identity or account as first parameter!");
669 669
 		}
670 670
 		$to_replace = array();
671
-		foreach($fields as $name)
671
+		foreach ($fields as $name)
672 672
 		{
673 673
 			if (strpos($identity[$name], '{{') !== false || strpos($identity[$name], '$$') !== false)
674 674
 			{
@@ -677,10 +677,10 @@  discard block
 block discarded – undo
677 677
 		}
678 678
 		if ($to_replace)
679 679
 		{
680
-			static $merge=null;
680
+			static $merge = null;
681 681
 			if (!isset($merge)) $merge = new Api\Contacts\Merge();
682 682
 			if (!isset($account_id)) $account_id = $GLOBALS['egw_info']['user']['account_id'];
683
-			foreach($to_replace as $name => &$value)
683
+			foreach ($to_replace as $name => &$value)
684 684
 			{
685 685
 				$err = null;
686 686
 				$value = $merge->merge_string($value,
@@ -702,7 +702,7 @@  discard block
 block discarded – undo
702 702
 	 * @return array
703 703
 	 * @throws Api\Exception\NotFound
704 704
 	 */
705
-	public static function read_identity($ident_id, $replace_placeholders=false, $user=null, $account=null)
705
+	public static function read_identity($ident_id, $replace_placeholders = false, $user = null, $account = null)
706 706
 	{
707 707
 		if (($account && $account['ident_id'] == $ident_id))
708 708
 		{
@@ -772,8 +772,7 @@  discard block
 block discarded – undo
772 772
 			'ident_org' => $identity['ident_org'],
773 773
 			'ident_email' => $identity['ident_email'],
774 774
 			'ident_signature' => $identity['ident_signature'],
775
-			'account_id' => self::is_multiple($identity) ? 0 :
776
-				(is_array($identity['account_id']) ? $identity['account_id'][0] : $identity['account_id']),
775
+			'account_id' => self::is_multiple($identity) ? 0 : (is_array($identity['account_id']) ? $identity['account_id'][0] : $identity['account_id']),
777 776
 		);
778 777
 		if ($identity['ident_id'] > 0)
779 778
 		{
@@ -817,7 +816,7 @@  discard block
 block discarded – undo
817 816
 	 */
818 817
 	public function __get($name)
819 818
 	{
820
-		switch($name)
819
+		switch ($name)
821 820
 		{
822 821
 			case 'acc_imap_administration':	// no longer stored in database
823 822
 				return !empty($this->params['acc_imap_admin_username']);
@@ -841,7 +840,7 @@  discard block
 block discarded – undo
841 840
 	 */
842 841
 	public function __isset($name)
843 842
 	{
844
-		switch($name)
843
+		switch ($name)
845 844
 		{
846 845
 			case 'acc_imap_administration':	// no longer stored in database
847 846
 				return true;
@@ -931,11 +930,11 @@  discard block
 block discarded – undo
931 930
 		{
932 931
 			// check if account is for current user, if not deny access
933 932
 			$memberships = self::memberships();
934
-			$memberships[] = '';	// edit uses '' for everyone
933
+			$memberships[] = ''; // edit uses '' for everyone
935 934
 
936 935
 			if (array_intersect((array)$account['account_id'], $memberships))
937 936
 			{
938
-				switch($rights)
937
+				switch ($rights)
939 938
 				{
940 939
 					case Api\Acl::READ:
941 940
 						$access = true;
@@ -980,7 +979,7 @@  discard block
 block discarded – undo
980 979
 	 * @return email_account
981 980
 	 * @throws Api\Exception\NotFound if account was not found (or not valid for current user)
982 981
 	 */
983
-	public static function read($acc_id, $called_for=null)
982
+	public static function read($acc_id, $called_for = null)
984 983
 	{
985 984
 		//error_log(__METHOD__."($acc_id, ".array2string($called_for).")");
986 985
 		// some caching, but only for regular usage/users
@@ -998,7 +997,7 @@  discard block
 block discarded – undo
998 997
 				//error_log(__METHOD__."($acc_id) created instance from cached data");
999 998
 				return self::$instances[$acc_id] = new Account(self::$cache[$acc_id]);
1000 999
 			}
1001
-			$data =& self::$cache[$acc_id];
1000
+			$data = & self::$cache[$acc_id];
1002 1001
 		}
1003 1002
 		$where = array(self::TABLE.'.acc_id='.(int)$acc_id);
1004 1003
 		if (!isset($called_for) || $called_for !== '0')
@@ -1022,7 +1021,7 @@  discard block
 block discarded – undo
1022 1021
 		if (!$valid_account_id_sql)
1023 1022
 		{
1024 1023
 			$data['account_id'] = array();
1025
-			foreach(self::$db->select(self::VALID_TABLE, 'account_id', array('acc_id' => $acc_id),
1024
+			foreach (self::$db->select(self::VALID_TABLE, 'account_id', array('acc_id' => $acc_id),
1026 1025
 				__LINE__, __FILE__, false, '', self::APP) as $row)
1027 1026
 			{
1028 1027
 				$data['account_id'][] = $row['account_id'];
@@ -1034,7 +1033,7 @@  discard block
 block discarded – undo
1034 1033
 		if (!isset($called_for))
1035 1034
 		{
1036 1035
 			//error_log(__METHOD__."($acc_id) creating instance and caching data read from db");
1037
-			$ret =& self::$instances[$acc_id];
1036
+			$ret = & self::$instances[$acc_id];
1038 1037
 		}
1039 1038
 		return $ret = new Account($data, $called_for);
1040 1039
 	}
@@ -1047,7 +1046,7 @@  discard block
 block discarded – undo
1047 1046
 	 */
1048 1047
 	protected static function db2data(array $data)
1049 1048
 	{
1050
-		foreach(array('acc_sieve_enabled','acc_user_editable','acc_smtp_auth_session','acc_user_forward') as $name)
1049
+		foreach (array('acc_sieve_enabled', 'acc_user_editable', 'acc_smtp_auth_session', 'acc_user_forward') as $name)
1051 1050
 		{
1052 1051
 			if (isset($data[$name]))
1053 1052
 			{
@@ -1146,16 +1145,16 @@  discard block
 block discarded – undo
1146 1145
 	 * @throws Api\Exception\WrongParameter if called static without data-array
1147 1146
 	 * @throws Api\Db\Exception
1148 1147
 	 */
1149
-	public static function write(array $data, $user=null)
1148
+	public static function write(array $data, $user = null)
1150 1149
 	{
1151 1150
 		//error_log(__METHOD__."(".array2string($data).")");
1152 1151
 		$data['acc_modifier'] = $GLOBALS['egw_info']['user']['account_id'];
1153 1152
 		$data['acc_modified'] = time();
1154 1153
 
1155 1154
 		// remove redundant namespace to fit into column
1156
-		$ns_len = strlen(__NAMESPACE__)+1;
1155
+		$ns_len = strlen(__NAMESPACE__) + 1;
1157 1156
 		$backup = array();
1158
-		foreach(array('acc_smtp_type', 'acc_imap_type') as $attr)
1157
+		foreach (array('acc_smtp_type', 'acc_imap_type') as $attr)
1159 1158
 		{
1160 1159
 			if (substr($data[$attr], 0, $ns_len) == __NAMESPACE__.'\\')
1161 1160
 			{
@@ -1169,7 +1168,7 @@  discard block
 block discarded – undo
1169 1168
 		{
1170 1169
 			// set not set values which, are NOT NULL and therefore would give an SQL error
1171 1170
 			$td = self::$db->get_table_definitions('api', self::TABLE);
1172
-			foreach($td['fd'] as $col => $def)
1171
+			foreach ($td['fd'] as $col => $def)
1173 1172
 			{
1174 1173
 				if (!isset($data[$col]) && $def['nullable'] === false && !isset($def['default']))
1175 1174
 				{
@@ -1206,19 +1205,19 @@  discard block
 block discarded – undo
1206 1205
 		$old_account_ids = array();
1207 1206
 		if ($where)
1208 1207
 		{
1209
-			foreach(self::$db->select(self::VALID_TABLE, 'account_id', $where,
1208
+			foreach (self::$db->select(self::VALID_TABLE, 'account_id', $where,
1210 1209
 				__LINE__, __FILE__, false, '', self::APP) as $row)
1211 1210
 			{
1212 1211
 				$old_account_ids[] = $row['account_id'];
1213 1212
 			}
1214 1213
 			if (($ids_to_remove = array_diff($old_account_ids, (array)$data['account_id'])))
1215 1214
 			{
1216
-				self::$db->delete(self::VALID_TABLE, $where+array(
1215
+				self::$db->delete(self::VALID_TABLE, $where + array(
1217 1216
 					'account_id' => $ids_to_remove,
1218 1217
 				), __LINE__, __FILE__, self::APP);
1219 1218
 			}
1220 1219
 		}
1221
-		foreach((array)$data['account_id'] as $account_id)
1220
+		foreach ((array)$data['account_id'] as $account_id)
1222 1221
 		{
1223 1222
 			if (!in_array($account_id, $old_account_ids))
1224 1223
 			{
@@ -1267,8 +1266,7 @@  discard block
 block discarded – undo
1267 1266
 		}
1268 1267
 
1269 1268
 		// store notification folders
1270
-		Notifications::write($data['acc_id'], $data['notify_save_default'] ? 0 :
1271
-			($data['called_for'] ? $data['called_for'] : $GLOBALS['egw_info']['user']['account_id']),
1269
+		Notifications::write($data['acc_id'], $data['notify_save_default'] ? 0 : ($data['called_for'] ? $data['called_for'] : $GLOBALS['egw_info']['user']['account_id']),
1272 1270
 			(array)$data['notify_folders']);
1273 1271
 
1274 1272
 		// store domain of an account for all user like before as "mail_suffix" config
@@ -1294,7 +1292,7 @@  discard block
 block discarded – undo
1294 1292
 	 * @param int $account_id =null
1295 1293
 	 * @return int account_id for whom credentials are valid or 0 for all
1296 1294
 	 */
1297
-	protected static function credentials_valid_for($account, $account_id=null)
1295
+	protected static function credentials_valid_for($account, $account_id = null)
1298 1296
 	{
1299 1297
 		if (!isset($account_id)) $account_id = $GLOBALS['egw_info']['user']['account_id'];
1300 1298
 
@@ -1320,7 +1318,7 @@  discard block
 block discarded – undo
1320 1318
 	 * @param int $account_id =null user or group
1321 1319
 	 * @return int number of deleted mail accounts or null if only user-data was deleted and no full mail accounts
1322 1320
 	 */
1323
-	public static function delete($acc_id, $account_id=null)
1321
+	public static function delete($acc_id, $account_id = null)
1324 1322
 	{
1325 1323
 		if (is_array($acc_id) || $acc_id > 0)
1326 1324
 		{
@@ -1331,7 +1329,7 @@  discard block
 block discarded – undo
1331 1329
 			self::$db->delete(self::TABLE, array('acc_id' => $acc_id), __LINE__, __FILE__, self::APP);
1332 1330
 
1333 1331
 			// invalidate caches
1334
-			foreach((array)$acc_id as $acc_id)
1332
+			foreach ((array)$acc_id as $acc_id)
1335 1333
 			{
1336 1334
 				self::cache_invalidate($acc_id);
1337 1335
 			}
@@ -1350,7 +1348,7 @@  discard block
 block discarded – undo
1350 1348
 		self::$db->delete(self::IDENTITIES_TABLE, array('account_id' => $account_id), __LINE__, __FILE__, self::APP);
1351 1349
 		// find profiles not belonging to anyone else and delete them
1352 1350
 		$acc_ids = array();
1353
-		foreach(self::$db->select(self::TABLE, self::TABLE.'.acc_id', 'account_id IS NULL', __LINE__, __FILE__,
1351
+		foreach (self::$db->select(self::TABLE, self::TABLE.'.acc_id', 'account_id IS NULL', __LINE__, __FILE__,
1354 1352
 			false, 'GROUP BY '.self::TABLE.'.acc_id', self::APP, 0, 'LEFT '.self::VALID_JOIN) as $row)
1355 1353
 		{
1356 1354
 			$acc_ids[] = $row['acc_id'];
@@ -1374,7 +1372,7 @@  discard block
 block discarded – undo
1374 1372
 	 * @param boolean $replace_placeholders =true should placeholders like {{n_fn}} be replaced
1375 1373
 	 * @return Iterator with acc_id => acc_name or Account objects
1376 1374
 	 */
1377
-	public static function search($only_current_user=true, $just_name=true, $order_by=null, $offset=false, $num_rows=0, $replace_placeholders=true)
1375
+	public static function search($only_current_user = true, $just_name = true, $order_by = null, $offset = false, $num_rows = 0, $replace_placeholders = true)
1378 1376
 	{
1379 1377
 		//error_log(__METHOD__."($only_current_user, $just_name, '$order_by', $offset, $num_rows)");
1380 1378
 		$where = array();
@@ -1420,19 +1418,19 @@  discard block
 block discarded – undo
1420 1418
 				$cols[] = self::ADMIN_COL;
1421 1419
 				$join .= ' '.self::ADMIN_JOIN;
1422 1420
 			}
1423
-			$rs = self::$db->select(self::TABLE, $cols,	$where, __LINE__, __FILE__,
1421
+			$rs = self::$db->select(self::TABLE, $cols, $where, __LINE__, __FILE__,
1424 1422
 				$offset, Api\Storage::fix_group_by_columns($group_by, $cols, self::TABLE, 'acc_id').' ORDER BY '.$order_by,
1425 1423
 				self::APP, $num_rows, $join);
1426 1424
 
1427 1425
 			$ids = array();
1428
-			foreach($rs as $row)
1426
+			foreach ($rs as $row)
1429 1427
 			{
1430 1428
 				$row = self::db2data($row);
1431 1429
 
1432 1430
 				if ($only_current_user === true)
1433 1431
 				{
1434 1432
 					//error_log(__METHOD__."(TRUE, $just_name) caching data for acc_id=$row[acc_id]");
1435
-					self::$search_cache[$cache_key][$row['acc_id']] =& self::$cache[$row['acc_id']];
1433
+					self::$search_cache[$cache_key][$row['acc_id']] = & self::$cache[$row['acc_id']];
1436 1434
 					self::$cache[$row['acc_id']] = $row;
1437 1435
 				}
1438 1436
 				else
@@ -1444,14 +1442,14 @@  discard block
 block discarded – undo
1444 1442
 			// fetch valid_id, if not yet fetched
1445 1443
 			if (!$valid_account_id_sql && $ids)
1446 1444
 			{
1447
-				foreach(self::$db->select(self::VALID_TABLE, 'account_id', array('acc_id' => $ids),
1445
+				foreach (self::$db->select(self::VALID_TABLE, 'account_id', array('acc_id' => $ids),
1448 1446
 					__LINE__, __FILE__, false, '', self::APP) as $row)
1449 1447
 				{
1450 1448
 					self::$cache[$row['acc_id']]['account_id'][] = $row['account_id'];
1451 1449
 				}
1452 1450
 			}
1453 1451
 		}
1454
-		if (is_null(self::$search_cache[$cache_key])) self::$search_cache[$cache_key]=array();
1452
+		if (is_null(self::$search_cache[$cache_key])) self::$search_cache[$cache_key] = array();
1455 1453
 		return new Api\Db\CallbackIterator(new \ArrayIterator(self::$search_cache[$cache_key]),
1456 1454
 			// process each row
1457 1455
 			function($row) use ($just_name, $replace_placeholders, $account_id)
@@ -1485,11 +1483,11 @@  discard block
 block discarded – undo
1485 1483
 	 * @param boolean $log_no_default =true true: error_log if no default found, false be silent
1486 1484
 	 * @return Account|null
1487 1485
 	 */
1488
-	static function get_default($smtp=false, $return_id=false, $log_no_default=true)
1486
+	static function get_default($smtp = false, $return_id = false, $log_no_default = true)
1489 1487
 	{
1490 1488
 		try
1491 1489
 		{
1492
-			foreach(self::search(true, 'params') as $acc_id => $params)
1490
+			foreach (self::search(true, 'params') as $acc_id => $params)
1493 1491
 			{
1494 1492
 				if ($smtp)
1495 1493
 				{
@@ -1536,7 +1534,7 @@  discard block
 block discarded – undo
1536 1534
 	 * @param boolean $smtp =false false: usable for IMAP, true: usable for SMTP
1537 1535
 	 * @return int
1538 1536
 	 */
1539
-	static function get_default_acc_id($smtp=false)
1537
+	static function get_default_acc_id($smtp = false)
1540 1538
 	{
1541 1539
 		return self::get_default($smtp, true);
1542 1540
 	}
@@ -1549,7 +1547,7 @@  discard block
 block discarded – undo
1549 1547
 	 * @param int $account_id =null account_id of user we are called for
1550 1548
 	 * @return string with htmlencoded angle brackets
1551 1549
 	 */
1552
-	public static function identity_name($account, $replace_placeholders=true, $account_id=null)
1550
+	public static function identity_name($account, $replace_placeholders = true, $account_id = null)
1553 1551
 	{
1554 1552
 		if ($replace_placeholders)
1555 1553
 		{
@@ -1576,7 +1574,7 @@  discard block
 block discarded – undo
1576 1574
 				{
1577 1575
 					if (!isset($account['acc_imap_username']))
1578 1576
 					{
1579
-						$account += Credentials::read($account['acc_id'], null, ($account_id?array($account_id, 0):null));
1577
+						$account += Credentials::read($account['acc_id'], null, ($account_id ? array($account_id, 0) : null));
1580 1578
 					}
1581 1579
 					if (empty($account['acc_imap_username']) && $account['acc_imap_logintype'] &&
1582 1580
 						(!isset($account_id) || $account_id == $GLOBALS['egw_info']['user']['account_id']))
@@ -1595,7 +1593,7 @@  discard block
 block discarded – undo
1595 1593
 					$account['ident_email'] = $account['acc_imap_username'];
1596 1594
 				}
1597 1595
 			}
1598
-			catch(\Exception $e) {
1596
+			catch (\Exception $e) {
1599 1597
 				_egw_log_exception($e);
1600 1598
 			}
1601 1599
 		}
@@ -1611,7 +1609,7 @@  discard block
 block discarded – undo
1611 1609
 		{
1612 1610
 			$name .= ' <'.$account['ident_email'].'>';
1613 1611
 		}
1614
-		elseif(!empty(trim($account['acc_imap_username'])))
1612
+		elseif (!empty(trim($account['acc_imap_username'])))
1615 1613
 		{
1616 1614
 			$name .= ' <'.$account['acc_imap_username'].'>';
1617 1615
 		}
@@ -1634,8 +1632,7 @@  discard block
 block discarded – undo
1634 1632
 	 */
1635 1633
 	public static function is_multiple($account)
1636 1634
 	{
1637
-		$is_multiple = !is_array($account['account_id']) ? $account['account_id'] <= 0 :
1638
-			(count($account['account_id']) > 1 || $account['account_id'][0] <= 0);
1635
+		$is_multiple = !is_array($account['account_id']) ? $account['account_id'] <= 0 : (count($account['account_id']) > 1 || $account['account_id'][0] <= 0);
1639 1636
 		//error_log(__METHOD__."(account_id=".array2string($account['account_id']).") returning ".array2string($is_multiple));
1640 1637
 		return $is_multiple;
1641 1638
 	}
@@ -1656,13 +1653,13 @@  discard block
 block discarded – undo
1656 1653
 	 * @param type $user
1657 1654
 	 * @return array
1658 1655
 	 */
1659
-	protected static function memberships($user=null)
1656
+	protected static function memberships($user = null)
1660 1657
 	{
1661 1658
 		if (!$user) $user = $GLOBALS['egw_info']['user']['account_id'];
1662 1659
 
1663 1660
 		$memberships = $GLOBALS['egw']->accounts->memberships($user, true);
1664 1661
 		$memberships[] = $user;
1665
-		$memberships[] = 0;	// marks accounts valid for everyone
1662
+		$memberships[] = 0; // marks accounts valid for everyone
1666 1663
 
1667 1664
 		return $memberships;
1668 1665
 	}
Please login to merge, or discard this patch.
api/src/Mail/Hooks.php 4 patches
Doc Comments   -8 removed lines patch added patch discarded remove patch
@@ -36,9 +36,6 @@  discard block
 block discarded – undo
36 36
      * Hook called before an account get deleted
37 37
      *
38 38
      * @param array $data
39
-     * @param int $data['account_id'] numerical id
40
-     * @param string $data['account_lid'] account-name
41
-     * @param int $data['new_owner'] account-id of new owner, or false if data should get deleted
42 39
      */
43 40
 	static function deleteaccount(array $data)
44 41
 	{
@@ -52,8 +49,6 @@  discard block
 block discarded – undo
52 49
      * Hook called before a group get deleted
53 50
      *
54 51
      * @param array $data
55
-     * @param int $data['account_id'] numerical id
56
-     * @param string $data['account_name'] account-name
57 52
      */
58 53
 	static function deletegroup(array $data)
59 54
 	{
@@ -64,9 +59,6 @@  discard block
 block discarded – undo
64 59
      * Hook called when an account get added or edited
65 60
      *
66 61
      * @param array $data
67
-     * @param int $data['account_id'] numerical id
68
-     * @param string $data['account_lid'] account-name
69
-     * @param string $data['account_email'] email
70 62
 	 */
71 63
 	static function addaccount(array $data)
72 64
 	{
Please login to merge, or discard this patch.
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -32,14 +32,14 @@  discard block
 block discarded – undo
32 32
 		}
33 33
 	}
34 34
 
35
-    /**
36
-     * Hook called before an account get deleted
37
-     *
38
-     * @param array $data
39
-     * @param int $data['account_id'] numerical id
40
-     * @param string $data['account_lid'] account-name
41
-     * @param int $data['new_owner'] account-id of new owner, or false if data should get deleted
42
-     */
35
+	/**
36
+	 * Hook called before an account get deleted
37
+	 *
38
+	 * @param array $data
39
+	 * @param int $data['account_id'] numerical id
40
+	 * @param string $data['account_lid'] account-name
41
+	 * @param int $data['new_owner'] account-id of new owner, or false if data should get deleted
42
+	 */
43 43
 	static function deleteaccount(array $data)
44 44
 	{
45 45
 		self::run_plugin_hooks('deleteAccount', $data);
@@ -48,25 +48,25 @@  discard block
 block discarded – undo
48 48
 		Account::delete(0, $data['account_id']);
49 49
 	}
50 50
 
51
-    /**
52
-     * Hook called before a group get deleted
53
-     *
54
-     * @param array $data
55
-     * @param int $data['account_id'] numerical id
56
-     * @param string $data['account_name'] account-name
57
-     */
51
+	/**
52
+	 * Hook called before a group get deleted
53
+	 *
54
+	 * @param array $data
55
+	 * @param int $data['account_id'] numerical id
56
+	 * @param string $data['account_name'] account-name
57
+	 */
58 58
 	static function deletegroup(array $data)
59 59
 	{
60 60
 		Account::delete(0, $data['account_id']);
61 61
 	}
62 62
 
63 63
 	/**
64
-     * Hook called when an account get added or edited
65
-     *
66
-     * @param array $data
67
-     * @param int $data['account_id'] numerical id
68
-     * @param string $data['account_lid'] account-name
69
-     * @param string $data['account_email'] email
64
+	 * Hook called when an account get added or edited
65
+	 *
66
+	 * @param array $data
67
+	 * @param int $data['account_id'] numerical id
68
+	 * @param string $data['account_lid'] account-name
69
+	 * @param string $data['account_email'] email
70 70
 	 */
71 71
 	static function addaccount(array $data)
72 72
 	{
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
 	 */
83 83
 	protected static function run_plugin_hooks($method, array $data)
84 84
 	{
85
-		foreach(Account::search((int)$data['account_id'], 'params') as $params)
85
+		foreach (Account::search((int)$data['account_id'], 'params') as $params)
86 86
 		{
87
-			if (!Account::is_multiple($params)) continue;	// no need to waste time on personal accounts
87
+			if (!Account::is_multiple($params)) continue; // no need to waste time on personal accounts
88 88
 
89 89
 			try {
90 90
 				$account = new Account($params);
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 					$imap->$method($data);
101 101
 				}
102 102
 			}
103
-			catch(\Exception $e) {
103
+			catch (\Exception $e) {
104 104
 				_egw_log_exception($e);
105 105
 				// ignore exception, without stalling other hooks
106 106
 			}
Please login to merge, or discard this patch.
Braces   +5 added lines, -1 removed lines patch added patch discarded remove patch
@@ -84,7 +84,11 @@
 block discarded – undo
84 84
 	{
85 85
 		foreach(Account::search((int)$data['account_id'], 'params') as $params)
86 86
 		{
87
-			if (!Account::is_multiple($params)) continue;	// no need to waste time on personal accounts
87
+			if (!Account::is_multiple($params))
88
+			{
89
+				continue;
90
+			}
91
+			// no need to waste time on personal accounts
88 92
 
89 93
 			try {
90 94
 				$account = new Account($params);
Please login to merge, or discard this patch.
api/src/Mail/Html.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -227,7 +227,7 @@
 block discarded – undo
227 227
 	 * @param string $displayCharset : charset to use; should be a valid charset
228 228
 	 * @param bool $stripcrl :  flag to indicate for the removal of all crlf \r\n
229 229
 	 * @param bool $stripalltags : flag to indicate wether or not to strip $_html from all remaining tags
230
-	 * @return text $_html : the modified text.
230
+	 * @return string $_html : the modified text.
231 231
 	 */
232 232
 	static function convertHTMLToText($_html,$displayCharset=false,$stripcrl=false,$stripalltags=true)
233 233
 	{
Please login to merge, or discard this patch.
Spacing   +126 added lines, -126 removed lines patch added patch discarded remove patch
@@ -28,17 +28,17 @@  discard block
 block discarded – undo
28 28
 	 * @param integer $reclevel param to control recursive calls (to prevent endless recursion)
29 29
 	 * @return string
30 30
 	 */
31
-	static function decodeMailHeader($_string, $displayCharset='utf-8', $reclevel=0)
31
+	static function decodeMailHeader($_string, $displayCharset = 'utf-8', $reclevel = 0)
32 32
 	{
33
-		$maxreclevel=25;
33
+		$maxreclevel = 25;
34 34
 		if ($reclevel > $maxreclevel) {
35
-			error_log( __METHOD__.__LINE__." Recursion Level Exeeded ($reclevel) while decoding $_string ");
35
+			error_log(__METHOD__.__LINE__." Recursion Level Exeeded ($reclevel) while decoding $_string ");
36 36
 			return $_string;
37 37
 		}
38 38
 		$reclevel++;
39 39
 
40 40
 		//error_log(__FILE__.','.__METHOD__.':'."called with $_string and CHARSET $displayCharset");
41
-		if(function_exists('imap_mime_header_decode'))
41
+		if (function_exists('imap_mime_header_decode'))
42 42
 		{
43 43
 			// some characterreplacements, as they fail to translate
44 44
 			$sar = array(
@@ -60,23 +60,23 @@  discard block
 block discarded – undo
60 60
 
61 61
 			$string = preg_replace('/\?=\s+=\?/', '?= =?', $_string);
62 62
 
63
-			$elements=imap_mime_header_decode($string);
63
+			$elements = imap_mime_header_decode($string);
64 64
 
65 65
 			$convertAtEnd = false;
66
-			foreach((array)$elements as $element)
66
+			foreach ((array)$elements as $element)
67 67
 			{
68 68
 				if ($element->charset == 'default') $element->charset = Api\Translation::detect_encoding($element->text);
69 69
 				if ($element->charset != 'x-unknown')
70 70
 				{
71
-					if( strtoupper($element->charset) != 'UTF-8') $element->text = preg_replace($sar,$rar,$element->text);
71
+					if (strtoupper($element->charset) != 'UTF-8') $element->text = preg_replace($sar, $rar, $element->text);
72 72
 					// check if there is a possible nested encoding; make sure that the inputstring and the decoded result are different to avoid loops
73
-					$openTags = substr_count($element->text,'?=');
74
-					if(preg_match('/\?=.+=\?/', $element->text) && $openTags>0 && $openTags==substr_count($element->text,'=?') && $element->text != $_string)
73
+					$openTags = substr_count($element->text, '?=');
74
+					if (preg_match('/\?=.+=\?/', $element->text) && $openTags > 0 && $openTags == substr_count($element->text, '=?') && $element->text != $_string)
75 75
 					{
76 76
 						$element->text = self::decodeMailHeader($element->text, $element->charset, $reclevel);
77 77
 						$element->charset = $displayCharset;
78 78
 					}
79
-					$newString .= Api\Translation::convert($element->text,$element->charset);
79
+					$newString .= Api\Translation::convert($element->text, $element->charset);
80 80
 				}
81 81
 				else
82 82
 				{
@@ -84,34 +84,34 @@  discard block
 block discarded – undo
84 84
 					$convertAtEnd = true;
85 85
 				}
86 86
 			}
87
-			if ($convertAtEnd) $newString = self::decodeMailHeader($newString,$displayCharset,$reclevel);
88
-			return preg_replace('/([\000-\012\015\016\020-\037\075])/','',$newString);
87
+			if ($convertAtEnd) $newString = self::decodeMailHeader($newString, $displayCharset, $reclevel);
88
+			return preg_replace('/([\000-\012\015\016\020-\037\075])/', '', $newString);
89 89
 		}
90
-		elseif(function_exists(mb_decode_mimeheader))
90
+		elseif (function_exists(mb_decode_mimeheader))
91 91
 		{
92 92
 			$matches = null;
93
-			if(preg_match_all('/=\?.*\?Q\?.*\?=/iU', $string=$_string, $matches))
93
+			if (preg_match_all('/=\?.*\?Q\?.*\?=/iU', $string = $_string, $matches))
94 94
 			{
95
-				foreach($matches[0] as $match)
95
+				foreach ($matches[0] as $match)
96 96
 				{
97 97
 					$fixedMatch = str_replace('_', ' ', $match);
98 98
 					$string = str_replace($match, $fixedMatch, $string);
99 99
 				}
100
-				$string = str_replace('=?ISO8859-','=?ISO-8859-',
101
-					str_replace('=?windows-1258','=?ISO-8859-1',$string));
100
+				$string = str_replace('=?ISO8859-', '=?ISO-8859-',
101
+					str_replace('=?windows-1258', '=?ISO-8859-1', $string));
102 102
 			}
103 103
 			$string = mb_decode_mimeheader($string);
104
-			return preg_replace('/([\000-\012\015\016\020-\037\075])/','',$string);
104
+			return preg_replace('/([\000-\012\015\016\020-\037\075])/', '', $string);
105 105
 		}
106
-		elseif(function_exists(iconv_mime_decode))
106
+		elseif (function_exists(iconv_mime_decode))
107 107
 		{
108 108
 			// continue decoding also if an error occurs
109 109
 			$string = @iconv_mime_decode($_string, 2, $displayCharset);
110
-			return preg_replace('/([\000-\012\015\016\020-\037\075])/','',$string);
110
+			return preg_replace('/([\000-\012\015\016\020-\037\075])/', '', $string);
111 111
 		}
112 112
 
113 113
 		// no decoding function available
114
-		return preg_replace('/([\000-\012\015\016\020-\037\075])/','',$_string);
114
+		return preg_replace('/([\000-\012\015\016\020-\037\075])/', '', $_string);
115 115
 	}
116 116
 
117 117
 	/**
@@ -124,15 +124,15 @@  discard block
 block discarded – undo
124 124
 	{
125 125
 		//error_log($text);
126 126
 		//replace CRLF with something other to be preserved via preg_replace as CRLF seems to vanish
127
-		$text2 = str_replace("\r\n",'<#cr-lf#>',$text);
127
+		$text2 = str_replace("\r\n", '<#cr-lf#>', $text);
128 128
 			// replace emailaddresses eclosed in <> (eg.: <[email protected]>) with the emailaddress only (e.g: [email protected])
129
-		$text3 = preg_replace("/(<|&lt;a href=\")*(mailto:([\w\.,-.,_.,0-9.]+)(@)([\w\.,-.,_.,0-9.]+))(>|&gt;)*/i","$2 ", $text2);
129
+		$text3 = preg_replace("/(<|&lt;a href=\")*(mailto:([\w\.,-.,_.,0-9.]+)(@)([\w\.,-.,_.,0-9.]+))(>|&gt;)*/i", "$2 ", $text2);
130 130
 		//$text = preg_replace_callback("/(<|&lt;a href=\")*(mailto:([\w\.,-.,_.,0-9.]+)(@)([\w\.,-.,_.,0-9.]+))(>|&gt;)*/i",'self::transform_mailto2text',$text);
131 131
 		//$text = preg_replace('~<a[^>]+href=\"(mailto:)+([^"]+)\"[^>]*>~si','$2 ',$text);
132
-		$text4 = preg_replace_callback('~<a[^>]+href=\"(mailto:)+([^"]+)\"[^>]*>([ @\w\.,-.,_.,0-9.]+)<\/a>~si','self::transform_mailto2text',$text3);
133
-		$text5 = preg_replace("/(([\w\.,-.,_.,0-9.]+)(@)([\w\.,-.,_.,0-9.]+))( |\s)*(<\/a>)*( |\s)*(>|&gt;)*/i","$1 ", $text4);
134
-		$text6 = preg_replace("/(<|&lt;)*(([\w\.,-.,_.,0-9.]+)@([\w\.,-.,_.,0-9.]+))(>|&gt;)*/i","$2 ", $text5);
135
-		$text = str_replace('<#cr-lf#>',"\r\n",$text6);
132
+		$text4 = preg_replace_callback('~<a[^>]+href=\"(mailto:)+([^"]+)\"[^>]*>([ @\w\.,-.,_.,0-9.]+)<\/a>~si', 'self::transform_mailto2text', $text3);
133
+		$text5 = preg_replace("/(([\w\.,-.,_.,0-9.]+)(@)([\w\.,-.,_.,0-9.]+))( |\s)*(<\/a>)*( |\s)*(>|&gt;)*/i", "$1 ", $text4);
134
+		$text6 = preg_replace("/(<|&lt;)*(([\w\.,-.,_.,0-9.]+)@([\w\.,-.,_.,0-9.]+))(>|&gt;)*/i", "$2 ", $text5);
135
+		$text = str_replace('<#cr-lf#>', "\r\n", $text6);
136 136
 		return 1;
137 137
 	}
138 138
 
@@ -146,11 +146,11 @@  discard block
 block discarded – undo
146 146
 	 *				or if you want the string to be matched as is
147 147
 	 * @return void the modified text is passed via reference
148 148
 	 */
149
-	static function replaceTagsCompletley(&$_body,$tag,$endtag='',$addbracesforendtag=true)
149
+	static function replaceTagsCompletley(&$_body, $tag, $endtag = '', $addbracesforendtag = true)
150 150
 	{
151 151
 		if ($tag) $tag = strtolower($tag);
152 152
 		$singleton = false;
153
-		if ($endtag=='/>') $singleton =true;
153
+		if ($endtag == '/>') $singleton = true;
154 154
 		if ($endtag == '' || empty($endtag) || !isset($endtag))
155 155
 		{
156 156
 			$endtag = $tag;
@@ -163,31 +163,31 @@  discard block
 block discarded – undo
163 163
 			if ($singleton)
164 164
 			{
165 165
 				//$_body = preg_replace('~<'.$tag.'[^>].*? '.$endtag.'~simU','',$_body);
166
-				$_body = preg_replace('~<?'.$tag.'[^>].* '.$endtag.'~simU','',$_body); // we are in Ungreedy mode, so we expect * to be ungreedy without specifying ?
166
+				$_body = preg_replace('~<?'.$tag.'[^>].* '.$endtag.'~simU', '', $_body); // we are in Ungreedy mode, so we expect * to be ungreedy without specifying ?
167 167
 			}
168 168
 			else
169 169
 			{
170
-				$found=null;
171
-				if ($addbracesforendtag === true )
170
+				$found = null;
171
+				if ($addbracesforendtag === true)
172 172
 				{
173
-					if (stripos($_body,'<'.$tag)!==false)  $ct = preg_match_all('#<'.$tag.'(?:\s.*)?>(.+)</'.$endtag.'>#isU', $_body, $found);
174
-					if ($ct>0)
173
+					if (stripos($_body, '<'.$tag) !== false)  $ct = preg_match_all('#<'.$tag.'(?:\s.*)?>(.+)</'.$endtag.'>#isU', $_body, $found);
174
+					if ($ct > 0)
175 175
 					{
176 176
 						//error_log(__METHOD__.__LINE__.array2string($found[0]));
177 177
 						// only replace what we have found
178
-						$_body = str_ireplace($found[0],'',$_body);
178
+						$_body = str_ireplace($found[0], '', $_body);
179 179
 					}
180 180
 					// remove left over tags, unfinished ones, and so on
181
-					$_body = preg_replace('~<'.$tag.'[^>]*?>~si','',$_body);
181
+					$_body = preg_replace('~<'.$tag.'[^>]*?>~si', '', $_body);
182 182
 				}
183
-				if ($addbracesforendtag === false )
183
+				if ($addbracesforendtag === false)
184 184
 				{
185
-					if (stripos($_body,'<'.$tag)!==false)  $ct = preg_match_all('#<'.$tag.'(?:\s.*)?>(.+)'.$endtag.'#isU', $_body, $found);
186
-					if ($ct>0)
185
+					if (stripos($_body, '<'.$tag) !== false)  $ct = preg_match_all('#<'.$tag.'(?:\s.*)?>(.+)'.$endtag.'#isU', $_body, $found);
186
+					if ($ct > 0)
187 187
 					{
188 188
 						//error_log(__METHOD__.__LINE__.array2string($found[0]));
189 189
 						// only replace what we have found
190
-						$_body = str_ireplace($found[0],'',$_body);
190
+						$_body = str_ireplace($found[0], '', $_body);
191 191
 					}
192 192
 /*
193 193
 					$_body = preg_replace('~<'.$tag.'[^>]*?>(.*?)'.$endtag.'~simU','',$_body);
@@ -205,9 +205,9 @@  discard block
 block discarded – undo
205 205
 		// this is the actual url
206 206
 		$matches[2] = trim(strip_tags($matches[2]));
207 207
 		$matches[3] = trim(strip_tags($matches[3]));
208
-		$matches[2] = str_replace(array('%40','%20'),array('@',' '),$matches[2]);
209
-		$matches[3] = str_replace(array('%40','%20'),array('@',' '),$matches[3]);
210
-		return $matches[1].$matches[2].($matches[2]==$matches[3]?' ':' -> '.$matches[3].' ');
208
+		$matches[2] = str_replace(array('%40', '%20'), array('@', ' '), $matches[2]);
209
+		$matches[3] = str_replace(array('%40', '%20'), array('@', ' '), $matches[3]);
210
+		return $matches[1].$matches[2].($matches[2] == $matches[3] ? ' ' : ' -> '.$matches[3].' ');
211 211
 	}
212 212
 
213 213
 	static function transform_url2text($matches)
@@ -216,9 +216,9 @@  discard block
 block discarded – undo
216 216
 		$linkTextislink = false;
217 217
 		// this is the actual url
218 218
 		$matches[2] = trim(strip_tags($matches[2]));
219
-		if ($matches[2]==$matches[1]) $linkTextislink = true;
220
-		$matches[1] = str_replace(' ','%20',$matches[1]);
221
-		return ($linkTextislink?' ':'[ ').$matches[1].($linkTextislink?'':' -> '.$matches[2]).($linkTextislink?' ':' ]');
219
+		if ($matches[2] == $matches[1]) $linkTextislink = true;
220
+		$matches[1] = str_replace(' ', '%20', $matches[1]);
221
+		return ($linkTextislink ? ' ' : '[ ').$matches[1].($linkTextislink ? '' : ' -> '.$matches[2]).($linkTextislink ? ' ' : ' ]');
222 222
 	}
223 223
 
224 224
 	/**
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 	 * @param bool $stripalltags : flag to indicate wether or not to strip $_html from all remaining tags
230 230
 	 * @return text $_html : the modified text.
231 231
 	 */
232
-	static function convertHTMLToText($_html,$displayCharset=false,$stripcrl=false,$stripalltags=true)
232
+	static function convertHTMLToText($_html, $displayCharset = false, $stripcrl = false, $stripalltags = true)
233 233
 	{
234 234
 		// assume input isHTML, but test the input anyway, because,
235 235
 		// if it is not, we may not want to strip whitespace
@@ -245,27 +245,27 @@  discard block
 block discarded – undo
245 245
 		#print "<pre>"; print htmlspecialchars($_html);
246 246
 		#print "</pre>";
247 247
 		#print "<hr>";
248
-		if (stripos($_html,'style')!==false) self::replaceTagsCompletley($_html,'style'); // clean out empty or pagewide style definitions / left over tags
249
-		if (stripos($_html,'head')!==false) self::replaceTagsCompletley($_html,'head'); // Strip out stuff in head
250
-		if (stripos($_html,'![if')!==false && stripos($_html,'<![endif]>')!==false) self::replaceTagsCompletley($_html,'!\[if','<!\[endif\]>',false); // Strip out stuff in ifs
251
-		if (stripos($_html,'!--[if')!==false && stripos($_html,'<![endif]-->')!==false) self::replaceTagsCompletley($_html,'!--\[if','<!\[endif\]-->',false); // Strip out stuff in ifs
252
-		$Rules = array ('@<script[^>]*?>.*?</script>@siU', // Strip out javascript
253
-			'@&(quot|#34);@i',                // Replace HTML entities
254
-			'@&(amp|#38);@i',                 //   Ampersand &
255
-			'@&(lt|#60);@i',                  //   Less Than <
256
-			'@&(gt|#62);@i',                  //   Greater Than >
257
-			'@&(nbsp|#160);@i',               //   Non Breaking Space
258
-			'@&(iexcl|#161);@i',              //   Inverted Exclamation point
259
-			'@&(cent|#162);@i',               //   Cent
260
-			'@&(pound|#163);@i',              //   Pound
261
-			'@&(copy|#169);@i',               //   Copyright
262
-			'@&(reg|#174);@i',                //   Registered
263
-			'@&(trade|#8482);@i',             //   trade
264
-			'@&#39;@i',                       //   singleQuote
265
-			'@(\xc2\xa0)@',                   //   nbsp or tab (encoded windows-style)
266
-			'@(\xe2\x80\x8b)@',               //   ZERO WIDTH SPACE
248
+		if (stripos($_html, 'style') !== false) self::replaceTagsCompletley($_html, 'style'); // clean out empty or pagewide style definitions / left over tags
249
+		if (stripos($_html, 'head') !== false) self::replaceTagsCompletley($_html, 'head'); // Strip out stuff in head
250
+		if (stripos($_html, '![if') !== false && stripos($_html, '<![endif]>') !== false) self::replaceTagsCompletley($_html, '!\[if', '<!\[endif\]>', false); // Strip out stuff in ifs
251
+		if (stripos($_html, '!--[if') !== false && stripos($_html, '<![endif]-->') !== false) self::replaceTagsCompletley($_html, '!--\[if', '<!\[endif\]-->', false); // Strip out stuff in ifs
252
+		$Rules = array('@<script[^>]*?>.*?</script>@siU', // Strip out javascript
253
+			'@&(quot|#34);@i', // Replace HTML entities
254
+			'@&(amp|#38);@i', //   Ampersand &
255
+			'@&(lt|#60);@i', //   Less Than <
256
+			'@&(gt|#62);@i', //   Greater Than >
257
+			'@&(nbsp|#160);@i', //   Non Breaking Space
258
+			'@&(iexcl|#161);@i', //   Inverted Exclamation point
259
+			'@&(cent|#162);@i', //   Cent
260
+			'@&(pound|#163);@i', //   Pound
261
+			'@&(copy|#169);@i', //   Copyright
262
+			'@&(reg|#174);@i', //   Registered
263
+			'@&(trade|#8482);@i', //   trade
264
+			'@&#39;@i', //   singleQuote
265
+			'@(\xc2\xa0)@', //   nbsp or tab (encoded windows-style)
266
+			'@(\xe2\x80\x8b)@', //   ZERO WIDTH SPACE
267 267
 		);
268
-		$Replace = array ('',
268
+		$Replace = array('',
269 269
 			'"',
270 270
 			'#amper#sand#',
271 271
 			'<',
@@ -274,9 +274,9 @@  discard block
 block discarded – undo
274 274
 			chr(161),
275 275
 			chr(162),
276 276
 			chr(163),
277
-			'(C)',//chr(169),// copyrighgt
278
-			'(R)',//chr(174),// registered
279
-			'(TM)',// trade
277
+			'(C)', //chr(169),// copyrighgt
278
+			'(R)', //chr(174),// registered
279
+			'(TM)', // trade
280 280
 			"'",
281 281
 			' ',
282 282
 			'',
@@ -284,27 +284,27 @@  discard block
 block discarded – undo
284 284
 		$_html = preg_replace($Rules, $Replace, $_html);
285 285
 
286 286
 		//   removing carriage return linefeeds, preserve those enclosed in <pre> </pre> tags
287
-		if ($stripcrl === true )
287
+		if ($stripcrl === true)
288 288
 		{
289
-			if (stripos($_html,'<pre ')!==false || stripos($_html,'<pre>')!==false)
289
+			if (stripos($_html, '<pre ') !== false || stripos($_html, '<pre>') !== false)
290 290
 			{
291 291
 				$contentArr = self::splithtmlByPRE($_html);
292 292
 				foreach ($contentArr as $k =>&$elem)
293 293
 				{
294
-					if (stripos($elem,'<pre ')===false && stripos($elem,'<pre>')===false)
294
+					if (stripos($elem, '<pre ') === false && stripos($elem, '<pre>') === false)
295 295
 					{
296 296
 						//$elem = str_replace('@(\r\n)@i',' ',$elem);
297
-						$elem = str_replace(array("\r\n","\n"),($isHTML?'':' '),$elem);
297
+						$elem = str_replace(array("\r\n", "\n"), ($isHTML ? '' : ' '), $elem);
298 298
 					}
299 299
 				}
300
-				$_html = implode('',$contentArr);
300
+				$_html = implode('', $contentArr);
301 301
 			}
302 302
 			else
303 303
 			{
304
-				$_html = str_replace(array("\r\n","\n"),($isHTML?'':' '),$_html);
304
+				$_html = str_replace(array("\r\n", "\n"), ($isHTML ? '' : ' '), $_html);
305 305
 			}
306 306
 		}
307
-		$tags = array (
307
+		$tags = array(
308 308
 			0 => '~<h[123][^>]*>\r*\n*~si',
309 309
 			1 => '~<h[456][^>]*>\r*\n*~si',
310 310
 			2 => '~<table[^>]*>\r*\n*~si',
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 			17 => '/<([1234567890])/',
326 326
 			18 => '/>([1234567890])/',
327 327
 		);
328
-		$Replace = array (
328
+		$Replace = array(
329 329
 			0 => "\r\n",
330 330
 			1 => "\r\n",
331 331
 			2 => "\r\n",
@@ -346,112 +346,112 @@  discard block
 block discarded – undo
346 346
 			17 => '#lower#than#$1',
347 347
 			18 => '#greater#than#$1',
348 348
 		);
349
-		$_html = preg_replace($tags,$Replace,$_html);
350
-		$_html = preg_replace('~</t(d|h)>\s*<t(d|h)[^>]*>~si',' - ',$_html);
351
-		$_html = preg_replace('~<img[^>]+>~s','',$_html);
349
+		$_html = preg_replace($tags, $Replace, $_html);
350
+		$_html = preg_replace('~</t(d|h)>\s*<t(d|h)[^>]*>~si', ' - ', $_html);
351
+		$_html = preg_replace('~<img[^>]+>~s', '', $_html);
352 352
 		// replace emailaddresses eclosed in <> (eg.: <[email protected]>) with the emailaddress only (e.g: [email protected])
353 353
 		self::replaceEmailAdresses($_html);
354 354
 		//convert hrefs to description -> URL
355 355
 		//$_html = preg_replace('~<a[^>]+href=\"([^"]+)\"[^>]*>(.*)</a>~si','[$2 -> $1]',$_html);
356
-		$_html = preg_replace_callback('~<a[^>]+href=\"([^"]+)\"[^>]*>(.*?)</a>~si','self::transform_url2text',$_html);
356
+		$_html = preg_replace_callback('~<a[^>]+href=\"([^"]+)\"[^>]*>(.*?)</a>~si', 'self::transform_url2text', $_html);
357 357
 
358 358
 		// reducing double \r\n to single ones, dont mess with pre sections
359 359
 		if ($stripcrl === true && $isHTML)
360 360
 		{
361
-			if (stripos($_html,'<pre ')!==false || stripos($_html,'<pre>')!==false)
361
+			if (stripos($_html, '<pre ') !== false || stripos($_html, '<pre>') !== false)
362 362
 			{
363 363
 				$contentArr = self::splithtmlByPRE($_html);
364 364
 				foreach ($contentArr as $k =>&$elem)
365 365
 				{
366
-					if (stripos($elem,'<pre ')===false && stripos($elem,'<pre>')===false)
366
+					if (stripos($elem, '<pre ') === false && stripos($elem, '<pre>') === false)
367 367
 					{
368 368
 						//this is supposed to strip out all remaining stuff in tags, this is sometimes taking out whole sections off content
369
-						if ( $stripalltags ) {
370
-							$_html = preg_replace('~<[^>^@]+>~s','',$_html);
369
+						if ($stripalltags) {
370
+							$_html = preg_replace('~<[^>^@]+>~s', '', $_html);
371 371
 						}
372 372
 						// strip out whitespace inbetween CR/LF
373 373
 						$elem = preg_replace('~\r\n\s+\r\n~si', "\r\n\r\n", $elem);
374 374
 						// strip out / reduce exess CR/LF
375
-						$elem = preg_replace('~\r\n{3,}~si',"\r\n\r\n",$elem);
375
+						$elem = preg_replace('~\r\n{3,}~si', "\r\n\r\n", $elem);
376 376
 					}
377 377
 				}
378
-				$_html = implode('',$contentArr);
378
+				$_html = implode('', $contentArr);
379 379
 			}
380 380
 			else
381 381
 			{
382 382
 				//this is supposed to strip out all remaining stuff in tags, this is sometimes taking out whole sections off content
383
-				if ( $stripalltags ) {
384
-					$_html = preg_replace('~<[^>^@]+>~s','',$_html);
383
+				if ($stripalltags) {
384
+					$_html = preg_replace('~<[^>^@]+>~s', '', $_html);
385 385
 				}
386 386
 				// strip out whitespace inbetween CR/LF
387 387
 				$_html = preg_replace('~\r\n\s+\r\n~si', "\r\n\r\n", $_html);
388 388
 				// strip out / reduce exess CR/LF
389
-				$_html = preg_replace('~(\r\n){3,}~si',"\r\n\r\n",$_html);
389
+				$_html = preg_replace('~(\r\n){3,}~si', "\r\n\r\n", $_html);
390 390
 			}
391 391
 		}
392 392
 		//this is supposed to strip out all remaining stuff in tags, this is sometimes taking out whole sections off content
393
-		if ( $stripalltags ) {
394
-			$_html = preg_replace('~<[^>^@]+>~s','',$_html);
393
+		if ($stripalltags) {
394
+			$_html = preg_replace('~<[^>^@]+>~s', '', $_html);
395 395
 			//$_html = strip_tags($_html, '<a>');
396 396
 		}
397 397
 		// reducing spaces (not for input that was plain text from the beginning)
398
-		if ($isHTML) $_html = preg_replace('~ +~s',' ',$_html);
398
+		if ($isHTML) $_html = preg_replace('~ +~s', ' ', $_html);
399 399
 		// restoring ampersands
400
-		$_html = str_replace('#amper#sand#','&',$_html);
400
+		$_html = str_replace('#amper#sand#', '&', $_html);
401 401
 		// restoring lower|greater[or equal] than
402
-		$_html = str_replace('#lowerorequal#than#','<=',$_html);
403
-		$_html = str_replace('#greaterorequal#than#','>=',$_html);
404
-		$_html = str_replace('#lower#than#','<',$_html);
405
-		$_html = str_replace('#greater#than#','>',$_html);
402
+		$_html = str_replace('#lowerorequal#than#', '<=', $_html);
403
+		$_html = str_replace('#greaterorequal#than#', '>=', $_html);
404
+		$_html = str_replace('#lower#than#', '<', $_html);
405
+		$_html = str_replace('#greater#than#', '>', $_html);
406 406
 		//error_log(__METHOD__.__LINE__.' Charset:'.$displayCharset.' -> '.$_html);
407 407
 		$_html = html_entity_decode($_html, ENT_COMPAT, $displayCharset);
408 408
 		//error_log(__METHOD__.__LINE__.' Charset:'.$displayCharset.' After html_entity_decode: -> '.$_html);
409 409
 		//self::replaceEmailAdresses($_html);
410 410
 		$pos = strpos($_html, 'blockquote');
411 411
 		//error_log("convert HTML2Text: $_html");
412
-		if($pos === false) {
412
+		if ($pos === false) {
413 413
 			return $_html;
414 414
 		} else {
415 415
 			$indent = 0;
416 416
 			$indentString = '';
417 417
 
418 418
 			$quoteParts = preg_split('/#blockquote#type#cite#/', $_html, -1, PREG_SPLIT_OFFSET_CAPTURE);
419
-			foreach($quoteParts as $quotePart) {
420
-				if($quotePart[1] > 0) {
419
+			foreach ($quoteParts as $quotePart) {
420
+				if ($quotePart[1] > 0) {
421 421
 					$indent++;
422 422
 					$indentString .= '>';
423 423
 				}
424 424
 				$quoteParts2 = preg_split('/#blockquote#end#cite#/', $quotePart[0], -1, PREG_SPLIT_OFFSET_CAPTURE);
425 425
 
426
-				foreach($quoteParts2 as $quotePart2) {
427
-					if($quotePart2[1] > 0) {
426
+				foreach ($quoteParts2 as $quotePart2) {
427
+					if ($quotePart2[1] > 0) {
428 428
 						$indent--;
429 429
 						$indentString = substr($indentString, 0, $indent);
430 430
 					}
431 431
 
432 432
 					$quoteParts3 = explode("\r\n", $quotePart2[0]);
433 433
 
434
-					foreach($quoteParts3 as $quotePart3) {
434
+					foreach ($quoteParts3 as $quotePart3) {
435 435
 						//error_log(__METHOD__.__LINE__.'Line:'.$quotePart3);
436
-						$allowedLength = 76-strlen("\r\n$indentString");
436
+						$allowedLength = 76 - strlen("\r\n$indentString");
437 437
 						// only break lines, if not already indented
438
-						if (substr($quotePart3,0,strlen($indentString)) != $indentString)
438
+						if (substr($quotePart3, 0, strlen($indentString)) != $indentString)
439 439
 						{
440 440
 							if (strlen($quotePart3) > $allowedLength) {
441
-								$s=explode(" ", $quotePart3);
441
+								$s = explode(" ", $quotePart3);
442 442
 								$quotePart3 = "";
443 443
 								$linecnt = 0;
444 444
 								foreach ($s as $k=>$v) {
445 445
 									$cnt = strlen($v);
446 446
 									// only break long words within the wordboundaries,
447 447
 									// but it may destroy links, so we check for href and dont do it if we find it
448
-									if($cnt > $allowedLength && stripos($v,'href=')===false) {
448
+									if ($cnt > $allowedLength && stripos($v, 'href=') === false) {
449 449
 										//error_log(__METHOD__.__LINE__.'LongWordFound:'.$v);
450
-										$v=wordwrap($v, $allowedLength, "\r\n$indentString", true);
450
+										$v = wordwrap($v, $allowedLength, "\r\n$indentString", true);
451 451
 									}
452 452
 									// the rest should be broken at the start of the new word that exceeds the limit
453
-									if ($linecnt+$cnt > $allowedLength) {
454
-										$v="\r\n$indentString$v";
453
+									if ($linecnt + $cnt > $allowedLength) {
454
+										$v = "\r\n$indentString$v";
455 455
 										//error_log(__METHOD__.__LINE__.'breaking here:'.$v);
456 456
 										$linecnt = 0;
457 457
 									} else {
@@ -462,11 +462,11 @@  discard block
 block discarded – undo
462 462
 							}
463 463
 						}
464 464
 						//error_log(__METHOD__.__LINE__.'partString to return:'.$indentString . $quotePart3);
465
-						$asciiTextBuff[] = $indentString . $quotePart3 ;
465
+						$asciiTextBuff[] = $indentString.$quotePart3;
466 466
 					}
467 467
 				}
468 468
 			}
469
-			return implode("\r\n",$asciiTextBuff);
469
+			return implode("\r\n", $asciiTextBuff);
470 470
 		}
471 471
 	}
472 472
 
@@ -479,30 +479,30 @@  discard block
 block discarded – undo
479 479
 	static function splithtmlByPRE($html)
480 480
 	{
481 481
 		$searchFor = '<pre ';
482
-		$pos = stripos($html,$searchFor);
483
-		if ($pos===false)
482
+		$pos = stripos($html, $searchFor);
483
+		if ($pos === false)
484 484
 		{
485 485
 			$searchFor = '<pre>';
486
-			$pos = stripos($html,$searchFor);
486
+			$pos = stripos($html, $searchFor);
487 487
 		}
488 488
 		if ($pos === false)
489 489
 		{
490 490
 			return $html;
491 491
 		}
492
-		$html2ret[] = substr($html,0,$pos);
493
-		while ($pos!==false)
492
+		$html2ret[] = substr($html, 0, $pos);
493
+		while ($pos !== false)
494 494
 		{
495
-			$endofpre = stripos($html,'</pre>',$pos);
496
-			$length = $endofpre-$pos+6;
497
-			$html2ret[] = substr($html,$pos,$length);
495
+			$endofpre = stripos($html, '</pre>', $pos);
496
+			$length = $endofpre - $pos + 6;
497
+			$html2ret[] = substr($html, $pos, $length);
498 498
 			$searchFor = '<pre ';
499
-			$pos = stripos($html,$searchFor, $endofpre+6);
500
-			if ($pos===false)
499
+			$pos = stripos($html, $searchFor, $endofpre + 6);
500
+			if ($pos === false)
501 501
 			{
502 502
 				$searchFor = '<pre>';
503
-				$pos = stripos($html,$searchFor, $endofpre+6);
503
+				$pos = stripos($html, $searchFor, $endofpre + 6);
504 504
 			}
505
-			$html2ret[] = ($pos ? substr($html,$endofpre+6,$pos-($endofpre+6)): substr($html,$endofpre+6));
505
+			$html2ret[] = ($pos ? substr($html, $endofpre + 6, $pos - ($endofpre + 6)) : substr($html, $endofpre + 6));
506 506
 			//$pos=false;
507 507
 		}
508 508
 		//error_log(__METHOD__.__LINE__.array2string($html2ret));
Please login to merge, or discard this patch.
Braces   +103 added lines, -33 removed lines patch added patch discarded remove patch
@@ -31,7 +31,8 @@  discard block
 block discarded – undo
31 31
 	static function decodeMailHeader($_string, $displayCharset='utf-8', $reclevel=0)
32 32
 	{
33 33
 		$maxreclevel=25;
34
-		if ($reclevel > $maxreclevel) {
34
+		if ($reclevel > $maxreclevel)
35
+		{
35 36
 			error_log( __METHOD__.__LINE__." Recursion Level Exeeded ($reclevel) while decoding $_string ");
36 37
 			return $_string;
37 38
 		}
@@ -65,10 +66,16 @@  discard block
 block discarded – undo
65 66
 			$convertAtEnd = false;
66 67
 			foreach((array)$elements as $element)
67 68
 			{
68
-				if ($element->charset == 'default') $element->charset = Api\Translation::detect_encoding($element->text);
69
+				if ($element->charset == 'default')
70
+				{
71
+					$element->charset = Api\Translation::detect_encoding($element->text);
72
+				}
69 73
 				if ($element->charset != 'x-unknown')
70 74
 				{
71
-					if( strtoupper($element->charset) != 'UTF-8') $element->text = preg_replace($sar,$rar,$element->text);
75
+					if( strtoupper($element->charset) != 'UTF-8')
76
+					{
77
+						$element->text = preg_replace($sar,$rar,$element->text);
78
+					}
72 79
 					// check if there is a possible nested encoding; make sure that the inputstring and the decoded result are different to avoid loops
73 80
 					$openTags = substr_count($element->text,'?=');
74 81
 					if(preg_match('/\?=.+=\?/', $element->text) && $openTags>0 && $openTags==substr_count($element->text,'=?') && $element->text != $_string)
@@ -84,7 +91,10 @@  discard block
 block discarded – undo
84 91
 					$convertAtEnd = true;
85 92
 				}
86 93
 			}
87
-			if ($convertAtEnd) $newString = self::decodeMailHeader($newString,$displayCharset,$reclevel);
94
+			if ($convertAtEnd)
95
+			{
96
+				$newString = self::decodeMailHeader($newString,$displayCharset,$reclevel);
97
+			}
88 98
 			return preg_replace('/([\000-\012\015\016\020-\037\075])/','',$newString);
89 99
 		}
90 100
 		elseif(function_exists(mb_decode_mimeheader))
@@ -148,18 +158,27 @@  discard block
 block discarded – undo
148 158
 	 */
149 159
 	static function replaceTagsCompletley(&$_body,$tag,$endtag='',$addbracesforendtag=true)
150 160
 	{
151
-		if ($tag) $tag = strtolower($tag);
161
+		if ($tag)
162
+		{
163
+			$tag = strtolower($tag);
164
+		}
152 165
 		$singleton = false;
153
-		if ($endtag=='/>') $singleton =true;
166
+		if ($endtag=='/>')
167
+		{
168
+			$singleton =true;
169
+		}
154 170
 		if ($endtag == '' || empty($endtag) || !isset($endtag))
155 171
 		{
156 172
 			$endtag = $tag;
157
-		} else {
173
+		}
174
+		else
175
+		{
158 176
 			$endtag = strtolower($endtag);
159 177
 			//error_log(__METHOD__.' Using EndTag:'.$endtag);
160 178
 		}
161 179
 		// strip tags out of the message completely with their content
162
-		if ($_body) {
180
+		if ($_body)
181
+		{
163 182
 			if ($singleton)
164 183
 			{
165 184
 				//$_body = preg_replace('~<'.$tag.'[^>].*? '.$endtag.'~simU','',$_body);
@@ -170,7 +189,10 @@  discard block
 block discarded – undo
170 189
 				$found=null;
171 190
 				if ($addbracesforendtag === true )
172 191
 				{
173
-					if (stripos($_body,'<'.$tag)!==false)  $ct = preg_match_all('#<'.$tag.'(?:\s.*)?>(.+)</'.$endtag.'>#isU', $_body, $found);
192
+					if (stripos($_body,'<'.$tag)!==false)
193
+					{
194
+						$ct = preg_match_all('#<'.$tag.'(?:\s.*)?>(.+)</'.$endtag.'>#isU', $_body, $found);
195
+					}
174 196
 					if ($ct>0)
175 197
 					{
176 198
 						//error_log(__METHOD__.__LINE__.array2string($found[0]));
@@ -182,7 +204,10 @@  discard block
 block discarded – undo
182 204
 				}
183 205
 				if ($addbracesforendtag === false )
184 206
 				{
185
-					if (stripos($_body,'<'.$tag)!==false)  $ct = preg_match_all('#<'.$tag.'(?:\s.*)?>(.+)'.$endtag.'#isU', $_body, $found);
207
+					if (stripos($_body,'<'.$tag)!==false)
208
+					{
209
+						$ct = preg_match_all('#<'.$tag.'(?:\s.*)?>(.+)'.$endtag.'#isU', $_body, $found);
210
+					}
186 211
 					if ($ct>0)
187 212
 					{
188 213
 						//error_log(__METHOD__.__LINE__.array2string($found[0]));
@@ -216,7 +241,10 @@  discard block
 block discarded – undo
216 241
 		$linkTextislink = false;
217 242
 		// this is the actual url
218 243
 		$matches[2] = trim(strip_tags($matches[2]));
219
-		if ($matches[2]==$matches[1]) $linkTextislink = true;
244
+		if ($matches[2]==$matches[1])
245
+		{
246
+			$linkTextislink = true;
247
+		}
220 248
 		$matches[1] = str_replace(' ','%20',$matches[1]);
221 249
 		return ($linkTextislink?' ':'[ ').$matches[1].($linkTextislink?'':' -> '.$matches[2]).($linkTextislink?' ':' ]');
222 250
 	}
@@ -239,16 +267,35 @@  discard block
 block discarded – undo
239 267
 			$isHTML = false;
240 268
 			// return $_html; // maybe we should not proceed at all
241 269
 		}
242
-		if ($displayCharset === false) $displayCharset = Api\Translation::charset();
270
+		if ($displayCharset === false)
271
+		{
272
+			$displayCharset = Api\Translation::charset();
273
+		}
243 274
 		//error_log(__METHOD__.$_html);
244 275
 		#print '<hr>';
245 276
 		#print "<pre>"; print htmlspecialchars($_html);
246 277
 		#print "</pre>";
247 278
 		#print "<hr>";
248
-		if (stripos($_html,'style')!==false) self::replaceTagsCompletley($_html,'style'); // clean out empty or pagewide style definitions / left over tags
249
-		if (stripos($_html,'head')!==false) self::replaceTagsCompletley($_html,'head'); // Strip out stuff in head
250
-		if (stripos($_html,'![if')!==false && stripos($_html,'<![endif]>')!==false) self::replaceTagsCompletley($_html,'!\[if','<!\[endif\]>',false); // Strip out stuff in ifs
251
-		if (stripos($_html,'!--[if')!==false && stripos($_html,'<![endif]-->')!==false) self::replaceTagsCompletley($_html,'!--\[if','<!\[endif\]-->',false); // Strip out stuff in ifs
279
+		if (stripos($_html,'style')!==false)
280
+		{
281
+			self::replaceTagsCompletley($_html,'style');
282
+		}
283
+		// clean out empty or pagewide style definitions / left over tags
284
+		if (stripos($_html,'head')!==false)
285
+		{
286
+			self::replaceTagsCompletley($_html,'head');
287
+		}
288
+		// Strip out stuff in head
289
+		if (stripos($_html,'![if')!==false && stripos($_html,'<![endif]>')!==false)
290
+		{
291
+			self::replaceTagsCompletley($_html,'!\[if','<!\[endif\]>',false);
292
+		}
293
+		// Strip out stuff in ifs
294
+		if (stripos($_html,'!--[if')!==false && stripos($_html,'<![endif]-->')!==false)
295
+		{
296
+			self::replaceTagsCompletley($_html,'!--\[if','<!\[endif\]-->',false);
297
+		}
298
+		// Strip out stuff in ifs
252 299
 		$Rules = array ('@<script[^>]*?>.*?</script>@siU', // Strip out javascript
253 300
 			'@&(quot|#34);@i',                // Replace HTML entities
254 301
 			'@&(amp|#38);@i',                 //   Ampersand &
@@ -366,7 +413,8 @@  discard block
 block discarded – undo
366 413
 					if (stripos($elem,'<pre ')===false && stripos($elem,'<pre>')===false)
367 414
 					{
368 415
 						//this is supposed to strip out all remaining stuff in tags, this is sometimes taking out whole sections off content
369
-						if ( $stripalltags ) {
416
+						if ( $stripalltags )
417
+						{
370 418
 							$_html = preg_replace('~<[^>^@]+>~s','',$_html);
371 419
 						}
372 420
 						// strip out whitespace inbetween CR/LF
@@ -380,7 +428,8 @@  discard block
 block discarded – undo
380 428
 			else
381 429
 			{
382 430
 				//this is supposed to strip out all remaining stuff in tags, this is sometimes taking out whole sections off content
383
-				if ( $stripalltags ) {
431
+				if ( $stripalltags )
432
+				{
384 433
 					$_html = preg_replace('~<[^>^@]+>~s','',$_html);
385 434
 				}
386 435
 				// strip out whitespace inbetween CR/LF
@@ -390,12 +439,16 @@  discard block
 block discarded – undo
390 439
 			}
391 440
 		}
392 441
 		//this is supposed to strip out all remaining stuff in tags, this is sometimes taking out whole sections off content
393
-		if ( $stripalltags ) {
442
+		if ( $stripalltags )
443
+		{
394 444
 			$_html = preg_replace('~<[^>^@]+>~s','',$_html);
395 445
 			//$_html = strip_tags($_html, '<a>');
396 446
 		}
397 447
 		// reducing spaces (not for input that was plain text from the beginning)
398
-		if ($isHTML) $_html = preg_replace('~ +~s',' ',$_html);
448
+		if ($isHTML)
449
+		{
450
+			$_html = preg_replace('~ +~s',' ',$_html);
451
+		}
399 452
 		// restoring ampersands
400 453
 		$_html = str_replace('#amper#sand#','&',$_html);
401 454
 		// restoring lower|greater[or equal] than
@@ -409,55 +462,72 @@  discard block
 block discarded – undo
409 462
 		//self::replaceEmailAdresses($_html);
410 463
 		$pos = strpos($_html, 'blockquote');
411 464
 		//error_log("convert HTML2Text: $_html");
412
-		if($pos === false) {
465
+		if($pos === false)
466
+		{
413 467
 			return $_html;
414
-		} else {
468
+		}
469
+		else
470
+		{
415 471
 			$indent = 0;
416 472
 			$indentString = '';
417 473
 
418 474
 			$quoteParts = preg_split('/#blockquote#type#cite#/', $_html, -1, PREG_SPLIT_OFFSET_CAPTURE);
419
-			foreach($quoteParts as $quotePart) {
420
-				if($quotePart[1] > 0) {
475
+			foreach($quoteParts as $quotePart)
476
+			{
477
+				if($quotePart[1] > 0)
478
+				{
421 479
 					$indent++;
422 480
 					$indentString .= '>';
423 481
 				}
424 482
 				$quoteParts2 = preg_split('/#blockquote#end#cite#/', $quotePart[0], -1, PREG_SPLIT_OFFSET_CAPTURE);
425 483
 
426
-				foreach($quoteParts2 as $quotePart2) {
427
-					if($quotePart2[1] > 0) {
484
+				foreach($quoteParts2 as $quotePart2)
485
+				{
486
+					if($quotePart2[1] > 0)
487
+					{
428 488
 						$indent--;
429 489
 						$indentString = substr($indentString, 0, $indent);
430 490
 					}
431 491
 
432 492
 					$quoteParts3 = explode("\r\n", $quotePart2[0]);
433 493
 
434
-					foreach($quoteParts3 as $quotePart3) {
494
+					foreach($quoteParts3 as $quotePart3)
495
+					{
435 496
 						//error_log(__METHOD__.__LINE__.'Line:'.$quotePart3);
436 497
 						$allowedLength = 76-strlen("\r\n$indentString");
437 498
 						// only break lines, if not already indented
438 499
 						if (substr($quotePart3,0,strlen($indentString)) != $indentString)
439 500
 						{
440
-							if (strlen($quotePart3) > $allowedLength) {
501
+							if (strlen($quotePart3) > $allowedLength)
502
+							{
441 503
 								$s=explode(" ", $quotePart3);
442 504
 								$quotePart3 = "";
443 505
 								$linecnt = 0;
444
-								foreach ($s as $k=>$v) {
506
+								foreach ($s as $k=>$v)
507
+								{
445 508
 									$cnt = strlen($v);
446 509
 									// only break long words within the wordboundaries,
447 510
 									// but it may destroy links, so we check for href and dont do it if we find it
448
-									if($cnt > $allowedLength && stripos($v,'href=')===false) {
511
+									if($cnt > $allowedLength && stripos($v,'href=')===false)
512
+									{
449 513
 										//error_log(__METHOD__.__LINE__.'LongWordFound:'.$v);
450 514
 										$v=wordwrap($v, $allowedLength, "\r\n$indentString", true);
451 515
 									}
452 516
 									// the rest should be broken at the start of the new word that exceeds the limit
453
-									if ($linecnt+$cnt > $allowedLength) {
517
+									if ($linecnt+$cnt > $allowedLength)
518
+									{
454 519
 										$v="\r\n$indentString$v";
455 520
 										//error_log(__METHOD__.__LINE__.'breaking here:'.$v);
456 521
 										$linecnt = 0;
457
-									} else {
522
+									}
523
+									else
524
+									{
458 525
 										$linecnt += $cnt;
459 526
 									}
460
-									if (strlen($v))  $quotePart3 .= (strlen($quotePart3) ? " " : "").$v;
527
+									if (strlen($v))
528
+									{
529
+										$quotePart3 .= (strlen($quotePart3) ? " " : "").$v;
530
+									}
461 531
 								}
462 532
 							}
463 533
 						}
Please login to merge, or discard this patch.
api/src/Mail/Imap.php 4 patches
Doc Comments   +7 added lines, -6 removed lines patch added patch discarded remove patch
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 	 * Construtor
141 141
 	 *
142 142
 	 * @param array
143
-	 * @param bool|int|string $_adminConnection create admin connection if true or account_id or imap username
143
+	 * @param boolean|string $_adminConnection create admin connection if true or account_id or imap username
144 144
 	 * @param int $_timeout =null timeout in secs, if none given fmail pref or default of 20 is used
145 145
 	 * @return void
146 146
 	 */
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
 	 * Returns an array containing the names of the selected mailboxes
565 565
 	 *
566 566
 	 * @param   string  $reference          base mailbox to start the search (default is current mailbox)
567
-	 * @param   string  $restriction_search false or 0 means return all mailboxes
567
+	 * @param   integer  $restriction_search false or 0 means return all mailboxes
568 568
 	 *                                      true or 1 return only the mailbox that contains that exact name
569 569
 	 *                                      2 return all mailboxes in that hierarchy level
570 570
 	 * @param   string  $returnAttributes   true means return an assoc array containing mailbox names and mailbox attributes
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
 	 * Returns an array containing the names of the subscribed selected mailboxes
649 649
 	 *
650 650
 	 * @param   string  $reference          base mailbox to start the search
651
-	 * @param   string  $restriction_search false or 0 means return all mailboxes
651
+	 * @param   integer  $restriction_search false or 0 means return all mailboxes
652 652
 	 *                                      true or 1 return only the mailbox that contains that exact name
653 653
 	 *                                      2 return all mailboxes in that hierarchy level
654 654
 	 * @param   string  $returnAttributes   true means return an assoc array containing mailbox names and mailbox attributes
@@ -716,7 +716,7 @@  discard block
 block discarded – undo
716 716
 	 * Returns an array containing the names of the selected unsubscribed mailboxes
717 717
 	 *
718 718
 	 * @param   string  $reference          base mailbox to start the search
719
-	 * @param   string  $restriction_search false or 0 means return all mailboxes
719
+	 * @param   integer  $restriction_search false or 0 means return all mailboxes
720 720
 	 *                                      true or 1 return only the mailbox that contains that exact name
721 721
 	 *                                      2 return all mailboxes in that hierarchy level
722 722
 	 *
@@ -894,6 +894,7 @@  discard block
 block discarded – undo
894 894
 	 *
895 895
 	 * @var array $_nameSpace
896 896
 	 * @var string $_folderName
897
+	 * @param string $_folderName
897 898
 	 * @return string the prefix (may be an empty string)
898 899
 	 */
899 900
 	static function getFolderPrefixFromNamespace($_nameSpace, $_folderName)
@@ -912,7 +913,7 @@  discard block
 block discarded – undo
912 913
 	 * @param string $_mailbox
913 914
 	 * @param string $delimiter
914 915
 	 * @param string $prefix
915
-	 * @param string $reclevel = 0, counter to keep track of the current recursionlevel
916
+	 * @param integer $reclevel = 0, counter to keep track of the current recursionlevel
916 917
 	 * @return array of mailboxes
917 918
 	 */
918 919
 	function getMailBoxesRecursive($_mailbox, $delimiter, $prefix, $reclevel=0)
@@ -1344,7 +1345,7 @@  discard block
 block discarded – undo
1344 1345
 	/**
1345 1346
 	 * Get vacation message for given user
1346 1347
 	 *
1347
-	 * @param int|string $_euser nummeric account_id or imap username
1348
+	 * @param string|null $_euser nummeric account_id or imap username
1348 1349
 	 * @param string $_scriptName =null
1349 1350
 	 * @throws Exception on connection error or authentication failure
1350 1351
 	 * @return array
Please login to merge, or discard this patch.
Switch Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -580,16 +580,16 @@  discard block
 block discarded – undo
580 580
 		$mailbox = '';
581 581
 		if ( is_int( $restriction_search ) ){
582 582
 			switch ( $restriction_search ) {
583
-			case 0:
584
-				$searchstring = $reference."*";
585
-				break;
586
-			case 1:
587
-				$mailbox = $searchstring = $reference;
588
-				//$reference = '%';
589
-				break;
590
-			case 2:
591
-				$searchstring = $reference."%";
592
-				break;
583
+				case 0:
584
+					$searchstring = $reference."*";
585
+					break;
586
+				case 1:
587
+					$mailbox = $searchstring = $reference;
588
+					//$reference = '%';
589
+					break;
590
+				case 2:
591
+					$searchstring = $reference."%";
592
+					break;
593 593
 			}
594 594
 		}else{
595 595
 			if ( is_string( $restriction_search ) ){
@@ -664,16 +664,16 @@  discard block
 block discarded – undo
664 664
 		$mailbox = '';
665 665
 		if ( is_int( $restriction_search ) ){
666 666
 			switch ( $restriction_search ) {
667
-			case 0:
668
-				$searchstring = $reference."*";
669
-				break;
670
-			case 1:
671
-				$mailbox = $searchstring = $reference;
672
-				//$reference = '%';
673
-				break;
674
-			case 2:
675
-				$searchstring = $reference."%";
676
-				break;
667
+				case 0:
668
+					$searchstring = $reference."*";
669
+					break;
670
+				case 1:
671
+					$mailbox = $searchstring = $reference;
672
+					//$reference = '%';
673
+					break;
674
+				case 2:
675
+					$searchstring = $reference."%";
676
+					break;
677 677
 			}
678 678
 		}else{
679 679
 			if ( is_string( $restriction_search ) ){
@@ -730,16 +730,16 @@  discard block
 block discarded – undo
730 730
 
731 731
 		if ( is_int( $restriction_search ) ){
732 732
 			switch ( $restriction_search ) {
733
-			case 0:
734
-				$mailbox = $reference."*";
735
-				break;
736
-			case 1:
737
-				$mailbox = $reference;
738
-				$reference = '%';
739
-				break;
740
-			case 2:
741
-				$mailbox = "%";
742
-				break;
733
+				case 0:
734
+					$mailbox = $reference."*";
735
+					break;
736
+				case 1:
737
+					$mailbox = $reference;
738
+					$reference = '%';
739
+					break;
740
+				case 2:
741
+					$mailbox = "%";
742
+					break;
743 743
 			}
744 744
 		}else{
745 745
 			if ( is_string( $restriction_search ) ){
Please login to merge, or discard this patch.
Braces   +130 added lines, -42 removed lines patch added patch discarded remove patch
@@ -156,7 +156,10 @@  discard block
 block discarded – undo
156 156
 		$this->loginType = $this->params['acc_imap_logintype'];
157 157
 		$this->domainName = $this->params['acc_domain'];
158 158
 
159
-		if (is_null($_timeout)) $_timeout = $this->params['acc_imap_timeout']?$this->params['acc_imap_timeout']:self::getTimeOut ();
159
+		if (is_null($_timeout))
160
+		{
161
+			$_timeout = $this->params['acc_imap_timeout']?$this->params['acc_imap_timeout']:self::getTimeOut ();
162
+		}
160 163
 
161 164
 		// Horde use locale for translation of error messages
162 165
 		Api\Preferences::setlocale(LC_MESSAGES);
@@ -167,7 +170,10 @@  discard block
 block discarded – undo
167 170
 		{
168 171
 			$username = $this->getMailBoxUserName($username);
169 172
 		}
170
-		if ($_adminConnection) $this->adminConnection($username);
173
+		if ($_adminConnection)
174
+		{
175
+			$this->adminConnection($username);
176
+		}
171 177
 		$parent_params = array(
172 178
 			'username' => $this->params[$_adminConnection ? 'acc_imap_admin_username' : 'acc_imap_username'],
173 179
 			'password' => $this->params[$_adminConnection ? 'acc_imap_admin_password' : 'acc_imap_password'],
@@ -303,7 +309,11 @@  discard block
 block discarded – undo
303 309
 	static function getTimeOut($_use='IMAP')
304 310
 	{
305 311
 		$timeout = $GLOBALS['egw_info']['user']['preferences']['mail']['connectionTimeout'];
306
-		if (empty($timeout) || !($timeout > 0)) $timeout = $_use == 'SIEVE' ? 10 : 20; // this is the default value
312
+		if (empty($timeout) || !($timeout > 0))
313
+		{
314
+			$timeout = $_use == 'SIEVE' ? 10 : 20;
315
+		}
316
+		// this is the default value
307 317
 		return $timeout;
308 318
 	}
309 319
 
@@ -366,7 +376,8 @@  discard block
 block discarded – undo
366 376
 	 */
367 377
 	function encodeFolderName($_folderName)
368 378
 	{
369
-		if($this->mbAvailable) {
379
+		if($this->mbAvailable)
380
+		{
370 381
 			return mb_convert_encoding($_folderName, "UTF7-IMAP", Api\Translation::charset());
371 382
 		}
372 383
 
@@ -384,14 +395,21 @@  discard block
 block discarded – undo
384 395
 	function getMailbox($mailbox)
385 396
 	{
386 397
 		$mailboxes = $this->listMailboxes($mailbox,Horde_Imap_Client::MBOX_ALL);
387
-		if (empty($mailboxes)) $mailboxes = $this->listMailboxes($mailbox,Horde_Imap_Client::MBOX_UNSUBSCRIBED);
398
+		if (empty($mailboxes))
399
+		{
400
+			$mailboxes = $this->listMailboxes($mailbox,Horde_Imap_Client::MBOX_UNSUBSCRIBED);
401
+		}
388 402
 		//error_log(__METHOD__.__LINE__.'->'.$mailbox.'/'.array2string($mailboxes));
389 403
 		$mboxes = new Horde_Imap_Client_Mailbox_List($mailboxes);
390 404
 		//_debug_array($mboxes->count());
391 405
 		foreach ($mboxes->getIterator() as $k =>$box)
392 406
 		{
393 407
 			//error_log(__METHOD__.__LINE__.'->'.$k);
394
-			if ($k!='user' && $k != '' && $k==$mailbox) return $box['mailbox']; //_debug_array(array($k => $client->status($k)));
408
+			if ($k!='user' && $k != '' && $k==$mailbox)
409
+			{
410
+				return $box['mailbox'];
411
+			}
412
+			//_debug_array(array($k => $client->status($k)));
395 413
 		}
396 414
 		return ($this->mailboxExist($mailbox)?$mailbox:false);
397 415
 	}
@@ -460,8 +478,14 @@  discard block
 block discarded – undo
460 478
 			//throw new egw_exception(__METHOD__.' ('.__LINE__.") failed to ".__METHOD__." :".$e->getMessage());
461 479
 			unset($e);
462 480
 		}
463
-		if (!empty($mailbox)) return $mailbox['mailbox'];
464
-		if (empty($mailbox) && $this->mailboxExist('INBOX')) return 'INBOX';
481
+		if (!empty($mailbox))
482
+		{
483
+			return $mailbox['mailbox'];
484
+		}
485
+		if (empty($mailbox) && $this->mailboxExist('INBOX'))
486
+		{
487
+			return 'INBOX';
488
+		}
465 489
 		return null;
466 490
 	}
467 491
 
@@ -531,7 +555,10 @@  discard block
 block discarded – undo
531 555
 			));
532 556
 
533 557
 		$flags = Horde_Imap_Client::STATUS_ALL;
534
-		if ($ignoreStatusCache) $flags |= Horde_Imap_Client::STATUS_FORCE_REFRESH;
558
+		if ($ignoreStatusCache)
559
+		{
560
+			$flags |= Horde_Imap_Client::STATUS_FORCE_REFRESH;
561
+		}
535 562
 
536 563
 		$mboxes = new Horde_Imap_Client_Mailbox_List($mailboxes);
537 564
 		//error_log(__METHOD__.__LINE__.array2string($mboxes->count()));
@@ -574,12 +601,15 @@  discard block
 block discarded – undo
574 601
 	 */
575 602
 	function getMailboxes($reference = ''  , $restriction_search = 0, $returnAttributes = false)
576 603
 	{
577
-		if ( is_bool($restriction_search) ){
604
+		if ( is_bool($restriction_search) )
605
+		{
578 606
 			$restriction_search = (int) $restriction_search;
579 607
 		}
580 608
 		$mailbox = '';
581
-		if ( is_int( $restriction_search ) ){
582
-			switch ( $restriction_search ) {
609
+		if ( is_int( $restriction_search ) )
610
+		{
611
+			switch ( $restriction_search )
612
+			{
583 613
 			case 0:
584 614
 				$searchstring = $reference."*";
585 615
 				break;
@@ -591,8 +621,11 @@  discard block
 block discarded – undo
591 621
 				$searchstring = $reference."%";
592 622
 				break;
593 623
 			}
594
-		}else{
595
-			if ( is_string( $restriction_search ) ){
624
+		}
625
+		else
626
+		{
627
+			if ( is_string( $restriction_search ) )
628
+			{
596 629
 				$mailbox = $searchstring = $restriction_search;
597 630
 			}
598 631
 		}
@@ -658,12 +691,15 @@  discard block
 block discarded – undo
658 691
 	 */
659 692
 	function listSubscribedMailboxes($reference = ''  , $restriction_search = 0, $returnAttributes = false)
660 693
 	{
661
-		if ( is_bool($restriction_search) ){
694
+		if ( is_bool($restriction_search) )
695
+		{
662 696
 			$restriction_search = (int) $restriction_search;
663 697
 		}
664 698
 		$mailbox = '';
665
-		if ( is_int( $restriction_search ) ){
666
-			switch ( $restriction_search ) {
699
+		if ( is_int( $restriction_search ) )
700
+		{
701
+			switch ( $restriction_search )
702
+			{
667 703
 			case 0:
668 704
 				$searchstring = $reference."*";
669 705
 				break;
@@ -675,8 +711,11 @@  discard block
 block discarded – undo
675 711
 				$searchstring = $reference."%";
676 712
 				break;
677 713
 			}
678
-		}else{
679
-			if ( is_string( $restriction_search ) ){
714
+		}
715
+		else
716
+		{
717
+			if ( is_string( $restriction_search ) )
718
+			{
680 719
 				$mailbox = $searchstring = $restriction_search;
681 720
 			}
682 721
 		}
@@ -724,12 +763,15 @@  discard block
 block discarded – undo
724 763
 	 */
725 764
 	function listUnSubscribedMailboxes($reference = ''  , $restriction_search = 0)
726 765
 	{
727
-		if ( is_bool($restriction_search) ){
766
+		if ( is_bool($restriction_search) )
767
+		{
728 768
 			$restriction_search = (int) $restriction_search;
729 769
 		}
730 770
 
731
-		if ( is_int( $restriction_search ) ){
732
-			switch ( $restriction_search ) {
771
+		if ( is_int( $restriction_search ) )
772
+		{
773
+			switch ( $restriction_search )
774
+			{
733 775
 			case 0:
734 776
 				$mailbox = $reference."*";
735 777
 				break;
@@ -741,8 +783,11 @@  discard block
 block discarded – undo
741 783
 				$mailbox = "%";
742 784
 				break;
743 785
 			}
744
-		}else{
745
-			if ( is_string( $restriction_search ) ){
786
+		}
787
+		else
788
+		{
789
+			if ( is_string( $restriction_search ) )
790
+			{
746 791
 				$mailbox = $restriction_search;
747 792
 			}
748 793
 		}
@@ -761,7 +806,10 @@  discard block
 block discarded – undo
761 806
 		foreach ($unsubscribed as $box)
762 807
 		{
763 808
 			//error_log(__METHOD__.__LINE__.' Box:'.$k.'->'.array2string($box['mailbox']->utf8));
764
-			if (!in_array($box['mailbox']->utf8,$sret) && $box['mailbox']->utf8!='INBOX') $ret[]=$box['mailbox']->utf8;
809
+			if (!in_array($box['mailbox']->utf8,$sret) && $box['mailbox']->utf8!='INBOX')
810
+			{
811
+				$ret[]=$box['mailbox']->utf8;
812
+			}
765 813
 		}
766 814
 		return $ret;
767 815
 	}
@@ -775,10 +823,16 @@  discard block
 block discarded – undo
775 823
 	 */
776 824
 	function examineMailbox($mailbox, $flags=null)
777 825
 	{
778
-		if ($mailbox=='') return false;
826
+		if ($mailbox=='')
827
+		{
828
+			return false;
829
+		}
779 830
 		$mailboxes = $this->listMailboxes($mailbox);
780 831
 
781
-		if (is_null($flags)) $flags = Horde_Imap_Client::STATUS_ALL | Horde_Imap_Client::STATUS_FLAGS | Horde_Imap_Client::STATUS_PERMFLAGS;
832
+		if (is_null($flags))
833
+		{
834
+			$flags = Horde_Imap_Client::STATUS_ALL | Horde_Imap_Client::STATUS_FLAGS | Horde_Imap_Client::STATUS_PERMFLAGS;
835
+		}
782 836
 
783 837
 		$mboxes = new Horde_Imap_Client_Mailbox_List($mailboxes);
784 838
 		//_debug_array($mboxes->count());
@@ -860,7 +914,10 @@  discard block
 block discarded – undo
860 914
 		}
861 915
 		catch (\Exception $e)
862 916
 		{
863
-			if ($this->debug) error_log(__METHOD__.__LINE__.' error querying for capability:'.$capability.' ->'.$e->getMessage());
917
+			if ($this->debug)
918
+			{
919
+				error_log(__METHOD__.__LINE__.' error querying for capability:'.$capability.' ->'.$e->getMessage());
920
+			}
864 921
 			return false;
865 922
 		}
866 923
 		if (!is_array($cap))
@@ -900,7 +957,10 @@  discard block
 block discarded – undo
900 957
 	{
901 958
 		foreach($_nameSpace as &$singleNameSpace)
902 959
 		{
903
-			if (substr($_folderName,0,strlen($singleNameSpace['prefix'])) == $singleNameSpace['prefix']) return $singleNameSpace['prefix'];
960
+			if (substr($_folderName,0,strlen($singleNameSpace['prefix'])) == $singleNameSpace['prefix'])
961
+			{
962
+				return $singleNameSpace['prefix'];
963
+			}
904 964
 		}
905 965
 		return "";
906 966
 	}
@@ -917,7 +977,8 @@  discard block
 block discarded – undo
917 977
 	 */
918 978
 	function getMailBoxesRecursive($_mailbox, $delimiter, $prefix, $reclevel=0)
919 979
 	{
920
-		if ($reclevel > 25) {
980
+		if ($reclevel > 25)
981
+		{
921 982
 			error_log( __METHOD__." Recursion Level Exeeded ($reclevel) while looking up $_mailbox$delimiter ");
922 983
 			return array();
923 984
 		}
@@ -933,7 +994,8 @@  discard block
 block discarded – undo
933 994
 		{
934 995
 			$buff = $this->getMailboxes($mbx[$mbxkeys[0]]['MAILBOX'].($mbx[$mbxkeys[0]]['MAILBOX'] == $prefix ? '':$delimiter),2,false);
935 996
 			$allMailboxes = array();
936
-			foreach ($buff as $mbxname) {
997
+			foreach ($buff as $mbxname)
998
+			{
937 999
 				$mbxname = preg_replace('~'.($delimiter == '.' ? "\\".$delimiter:$delimiter).'+~s',$delimiter,$mbxname['MAILBOX']);
938 1000
 				#echo "About to recur in level $reclevel:".$mbxname."<br>";
939 1001
 				if ( $mbxname != $mbx[$mbxkeys[0]]['MAILBOX'] && $mbxname != $prefix  && $mbxname != $mbx[$mbxkeys[0]]['MAILBOX'].$delimiter)
@@ -941,7 +1003,10 @@  discard block
 block discarded – undo
941 1003
 					$allMailboxes = array_merge($allMailboxes, self::getMailBoxesRecursive($mbxname, $delimiter, $prefix, $reclevel));
942 1004
 				}
943 1005
 			}
944
-			if (!(in_array('\NoSelect',$mbx[$mbxkeys[0]]["ATTRIBUTES"]) || in_array('\Noselect',$mbx[$mbxkeys[0]]["ATTRIBUTES"]) || in_array('\noselect',$mbx[$mbxkeys[0]]["ATTRIBUTES"]))) $allMailboxes[] = $mbx[$mbxkeys[0]]['MAILBOX'];
1006
+			if (!(in_array('\NoSelect',$mbx[$mbxkeys[0]]["ATTRIBUTES"]) || in_array('\Noselect',$mbx[$mbxkeys[0]]["ATTRIBUTES"]) || in_array('\noselect',$mbx[$mbxkeys[0]]["ATTRIBUTES"])))
1007
+			{
1008
+				$allMailboxes[] = $mbx[$mbxkeys[0]]['MAILBOX'];
1009
+			}
945 1010
 			return $allMailboxes;
946 1011
 		}
947 1012
 		else
@@ -963,9 +1028,16 @@  discard block
 block discarded – undo
963 1028
 		static $nameSpace=null;
964 1029
 		$foldersNameSpace = array();
965 1030
 		$delimiter = $this->getDelimiter();
966
-		if (empty($delimiter)) $delimiter='/';
967
-		if (is_null($nameSpace)) $nameSpace = $this->getNameSpaceArray();
968
-		if (is_array($nameSpace)) {
1031
+		if (empty($delimiter))
1032
+		{
1033
+			$delimiter='/';
1034
+		}
1035
+		if (is_null($nameSpace))
1036
+		{
1037
+			$nameSpace = $this->getNameSpaceArray();
1038
+		}
1039
+		if (is_array($nameSpace))
1040
+		{
969 1041
 			foreach($nameSpace as $type => $singleNameSpaceArray)
970 1042
 			{
971 1043
 				foreach ($singleNameSpaceArray as $singleNameSpace)
@@ -982,7 +1054,9 @@  discard block
 block discarded – undo
982 1054
 						$_foldersNameSpace['prefix_present'] = 'forced';
983 1055
 						// uw-imap server with mailbox prefix or dovecot maybe
984 1056
 						$_foldersNameSpace['prefix'] = 'mail';
985
-					} else {
1057
+					}
1058
+					else
1059
+					{
986 1060
 						$_foldersNameSpace['prefix_present'] = !empty($singleNameSpace['name']);
987 1061
 						$_foldersNameSpace['prefix'] = $singleNameSpace['name'];
988 1062
 					}
@@ -1022,7 +1096,10 @@  discard block
 block discarded – undo
1022 1096
 		$namespaces = $this->getNamespaces();
1023 1097
 		foreach ($namespaces as $nsp)
1024 1098
 		{
1025
-			if ($nsp['type']==$type && $nsp['delimiter']) return $nsp['delimiter'];
1099
+			if ($nsp['type']==$type && $nsp['delimiter'])
1100
+			{
1101
+				return $nsp['delimiter'];
1102
+			}
1026 1103
 		}
1027 1104
 		return "/";
1028 1105
 	}
@@ -1131,12 +1208,14 @@  discard block
 block discarded – undo
1131 1208
 	{
1132 1209
 		$nameSpaces = $this->getNameSpaceArray();
1133 1210
 
1134
-		if(!isset($nameSpaces['others'])) {
1211
+		if(!isset($nameSpaces['others']))
1212
+		{
1135 1213
 			return false;
1136 1214
 		}
1137 1215
 
1138 1216
 		$username = $this->getMailBoxUserName($_username);
1139
-		if($this->loginType == 'vmailmgr' || $this->loginType == 'email' || $this->loginType == 'uidNumber') {
1217
+		if($this->loginType == 'vmailmgr' || $this->loginType == 'email' || $this->loginType == 'uidNumber')
1218
+		{
1140 1219
 			$username .= '@'. $this->domainName;
1141 1220
 		}
1142 1221
 
@@ -1288,7 +1367,10 @@  discard block
 block discarded – undo
1288 1367
 	 */
1289 1368
 	public function __call($name,array $params=null)
1290 1369
 	{
1291
-		if ($this->debug) error_log(__METHOD__.'->'.$name.' with params:'.array2string($params));
1370
+		if ($this->debug)
1371
+		{
1372
+			error_log(__METHOD__.'->'.$name.' with params:'.array2string($params));
1373
+		}
1292 1374
 		switch($name)
1293 1375
 		{
1294 1376
 			case 'installScript':
@@ -1323,7 +1405,10 @@  discard block
 block discarded – undo
1323 1405
 	 */
1324 1406
 	public function setVacationUser($_euser, array $_vacation, $_scriptName=null)
1325 1407
 	{
1326
-		if ($this->debug) error_log(__METHOD__.' User:'.array2string($_euser).' Scriptname:'.array2string($_scriptName).' VacationMessage:'.array2string($_vacation));
1408
+		if ($this->debug)
1409
+		{
1410
+			error_log(__METHOD__.' User:'.array2string($_euser).' Scriptname:'.array2string($_scriptName).' VacationMessage:'.array2string($_vacation));
1411
+		}
1327 1412
 
1328 1413
 		if (is_numeric($_euser))
1329 1414
 		{
@@ -1351,7 +1436,10 @@  discard block
 block discarded – undo
1351 1436
 	 */
1352 1437
 	public function getVacationUser($_euser, $_scriptName=null)
1353 1438
 	{
1354
-		if ($this->debug) error_log(__METHOD__.' User:'.array2string($_euser));
1439
+		if ($this->debug)
1440
+		{
1441
+			error_log(__METHOD__.' User:'.array2string($_euser));
1442
+		}
1355 1443
 
1356 1444
 		if (is_numeric($_euser))
1357 1445
 		{
Please login to merge, or discard this patch.
Spacing   +135 added lines, -135 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	static public $default_params = array(
67 67
 		//'debug' => '/tmp/imap.log', // uncomment to log communitcation with IMAP server
68 68
 		//'debug_literal' => true,    // uncomment to log mail contents returned by IMAP server
69
-		'cache' => true,              // default caching via Cache / Api\Cache
69
+		'cache' => true, // default caching via Cache / Api\Cache
70 70
 	);
71 71
 
72 72
 	/**
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 * @param int $_timeout =null timeout in secs, if none given fmail pref or default of 20 is used
145 145
 	 * @return void
146 146
 	 */
147
-	function __construct(array $params, $_adminConnection=false, $_timeout=null)
147
+	function __construct(array $params, $_adminConnection = false, $_timeout = null)
148 148
 	{
149 149
 		if (function_exists('mb_convert_encoding'))
150 150
 		{
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 		$this->loginType = $this->params['acc_imap_logintype'];
157 157
 		$this->domainName = $this->params['acc_domain'];
158 158
 
159
-		if (is_null($_timeout)) $_timeout = $this->params['acc_imap_timeout']?$this->params['acc_imap_timeout']:self::getTimeOut ();
159
+		if (is_null($_timeout)) $_timeout = $this->params['acc_imap_timeout'] ? $this->params['acc_imap_timeout'] : self::getTimeOut();
160 160
 
161 161
 		// Horde use locale for translation of error messages
162 162
 		Api\Preferences::setlocale(LC_MESSAGES);
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 			'port' => $this->params['acc_imap_port'],
176 176
 			'secure' => Account::ssl2secure($this->params['acc_imap_ssl']),
177 177
 			'timeout' => $_timeout,
178
-		)+self::$default_params;
178
+		) + self::$default_params;
179 179
 
180 180
 		if ($parent_params['cache'] === true)
181 181
 		{
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 				// as we have no way to tell this apart we ignore BINARY this affects
200 200
 				// Horde_Imap_Client_Fetch_Query::bodyPart for its fetch parameter decode=true is ignored
201 201
 				// (other functionality depending on BINARY is, of cause, affected too)
202
-				$parent_params['capability_ignore']= array_merge((array)$parent_params['capability_ignore'],array('BINARY'));
202
+				$parent_params['capability_ignore'] = array_merge((array)$parent_params['capability_ignore'], array('BINARY'));
203 203
 				break;
204 204
 		}
205 205
 		parent::__construct($parent_params);
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 	 *
213 213
 	 * @param string $_username =true create an admin connection for given user or $this->acc_imap_username
214 214
 	 */
215
-	function adminConnection($_username=true)
215
+	function adminConnection($_username = true)
216 216
 	{
217 217
 		if ($this->isAdminConnection !== $_username)
218 218
 		{
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 	 * @param string $_username =null create an admin connection for given user or $this->acc_imap_username
230 230
 	 * @throws Horde_IMAP_Client_Exception
231 231
 	 */
232
-	public function checkAdminConnection($_username=true)
232
+	public function checkAdminConnection($_username = true)
233 233
 	{
234 234
 		if ($this->acc_imap_administration)
235 235
 		{
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 	 */
247 247
 	public function __get($name)
248 248
 	{
249
-		switch($name)
249
+		switch ($name)
250 250
 		{
251 251
 			case 'acc_imap_administration':
252 252
 				return !empty($this->params['acc_imap_admin_username']);
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 				{
265 265
 					return $this->$name;
266 266
 				}
267
-				if (array_key_exists($name,$this->params))
267
+				if (array_key_exists($name, $this->params))
268 268
 				{
269 269
 					return $this->params[$name];
270 270
 				}
@@ -285,9 +285,9 @@  discard block
 block discarded – undo
285 285
 	 * @deprecated allready called by constructor automatic, parameters must be passed to constructor!
286 286
 	 * @throws Api\Exception\WrongParameter
287 287
 	 */
288
-	function openConnection($_adminConnection=false, $_timeout=null)
288
+	function openConnection($_adminConnection = false, $_timeout = null)
289 289
 	{
290
-		unset($_timeout);	// not used
290
+		unset($_timeout); // not used
291 291
 		if ($_adminConnection !== $this->params['adminConnection'])
292 292
 		{
293 293
 			throw new Api\Exception\WrongParameter('need to set parameters on calling Account->imapServer()!');
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 	 * @param string _use decide if the use is for IMAP or SIEVE, by now only the default differs
301 301
 	 * @return int - timeout (either set or default 20/10)
302 302
 	 */
303
-	static function getTimeOut($_use='IMAP')
303
+	static function getTimeOut($_use = 'IMAP')
304 304
 	{
305 305
 		$timeout = $GLOBALS['egw_info']['user']['preferences']['mail']['connectionTimeout'];
306 306
 		if (empty($timeout) || !($timeout > 0)) $timeout = $_use == 'SIEVE' ? 10 : 20; // this is the default value
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 	 */
326 326
 	function addAccount($_hookValues)
327 327
 	{
328
-		unset($_hookValues);	// not used
328
+		unset($_hookValues); // not used
329 329
 		return true;
330 330
 	}
331 331
 
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 	 */
338 338
 	function updateAccount($_hookValues)
339 339
 	{
340
-		unset($_hookValues);	// not used
340
+		unset($_hookValues); // not used
341 341
 		return true;
342 342
 	}
343 343
 
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
 	 */
350 350
 	function deleteAccount($_hookValues)
351 351
 	{
352
-		unset($_hookValues);	// not used
352
+		unset($_hookValues); // not used
353 353
 		return true;
354 354
 	}
355 355
 
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 	 */
367 367
 	function encodeFolderName($_folderName)
368 368
 	{
369
-		if($this->mbAvailable) {
369
+		if ($this->mbAvailable) {
370 370
 			return mb_convert_encoding($_folderName, "UTF7-IMAP", Api\Translation::charset());
371 371
 		}
372 372
 
@@ -383,17 +383,17 @@  discard block
 block discarded – undo
383 383
 	 */
384 384
 	function getMailbox($mailbox)
385 385
 	{
386
-		$mailboxes = $this->listMailboxes($mailbox,Horde_Imap_Client::MBOX_ALL);
387
-		if (empty($mailboxes)) $mailboxes = $this->listMailboxes($mailbox,Horde_Imap_Client::MBOX_UNSUBSCRIBED);
386
+		$mailboxes = $this->listMailboxes($mailbox, Horde_Imap_Client::MBOX_ALL);
387
+		if (empty($mailboxes)) $mailboxes = $this->listMailboxes($mailbox, Horde_Imap_Client::MBOX_UNSUBSCRIBED);
388 388
 		//error_log(__METHOD__.__LINE__.'->'.$mailbox.'/'.array2string($mailboxes));
389 389
 		$mboxes = new Horde_Imap_Client_Mailbox_List($mailboxes);
390 390
 		//_debug_array($mboxes->count());
391 391
 		foreach ($mboxes->getIterator() as $k =>$box)
392 392
 		{
393 393
 			//error_log(__METHOD__.__LINE__.'->'.$k);
394
-			if ($k!='user' && $k != '' && $k==$mailbox) return $box['mailbox']; //_debug_array(array($k => $client->status($k)));
394
+			if ($k != 'user' && $k != '' && $k == $mailbox) return $box['mailbox']; //_debug_array(array($k => $client->status($k)));
395 395
 		}
396
-		return ($this->mailboxExist($mailbox)?$mailbox:false);
396
+		return ($this->mailboxExist($mailbox) ? $mailbox : false);
397 397
 	}
398 398
 
399 399
 	/**
@@ -409,23 +409,23 @@  discard block
 block discarded – undo
409 409
 			//error_log(__METHOD__.__LINE__.':'.$mailbox);
410 410
 			$currentMailbox = $this->currentMailbox();
411 411
 		}
412
-		catch(\Exception $e)
412
+		catch (\Exception $e)
413 413
 		{
414 414
 			//error_log(__METHOD__.__LINE__.' failed detecting currentMailbox:'.$currentMailbox.':'.$e->getMessage());
415
-			$currentMailbox=null;
415
+			$currentMailbox = null;
416 416
 			unset($e);
417 417
 		}
418 418
 		try
419 419
 		{
420 420
 			//error_log(__METHOD__.__LINE__.':'.$mailbox);
421 421
 			$this->openMailbox($mailbox);
422
-			$returnvalue=true;
422
+			$returnvalue = true;
423 423
 		}
424
-		catch(\Exception $e)
424
+		catch (\Exception $e)
425 425
 		{
426 426
 			//error_log(__METHOD__.__LINE__.' failed opening:'.$mailbox.':'.$e->getMessage().' Called by:'.function_backtrace());
427 427
 			unset($e);
428
-			$returnvalue=false;
428
+			$returnvalue = false;
429 429
 		}
430 430
 		if (!empty($currentMailbox) && $currentMailbox['mailbox'] != $mailbox)
431 431
 		{
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 				//error_log(__METHOD__.__LINE__.':'.$currentMailbox .'<->'.$mailbox);
435 435
 				$this->openMailbox($currentMailbox['mailbox']);
436 436
 			}
437
-			catch(\Exception $e)
437
+			catch (\Exception $e)
438 438
 			{
439 439
 				//error_log(__METHOD__.__LINE__.' failed reopening:'.$currentMailbox.':'.$e->getMessage());
440 440
 				unset($e);
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 		{
455 455
 			$mailbox = $this->currentMailbox();
456 456
 		}
457
-		catch(\Exception $e)
457
+		catch (\Exception $e)
458 458
 		{
459 459
 			error_log(__METHOD__.' ('.__LINE__.') failed fetching currentMailbox:'.$e->getMessage());
460 460
 			//throw new egw_exception(__METHOD__.' ('.__LINE__.") failed to ".__METHOD__." :".$e->getMessage());
@@ -472,16 +472,16 @@  discard block
 block discarded – undo
472 472
 	 */
473 473
 	function getSpecialUseFolders()
474 474
 	{
475
-		$mailboxes = $this->getMailboxes('',0,true);
475
+		$mailboxes = $this->getMailboxes('', 0, true);
476 476
 		$suF = array();
477 477
 		foreach ($mailboxes as $box)
478 478
 		{
479
-			if ($box['MAILBOX']!='user' && $box['MAILBOX'] != '')
479
+			if ($box['MAILBOX'] != 'user' && $box['MAILBOX'] != '')
480 480
 			{
481 481
 				//error_log(__METHOD__.__LINE__.$k.'->'.array2string($box));
482
-				if (isset($box['ATTRIBUTES'])&&!empty($box['ATTRIBUTES'])&&
483
-					stripos(strtolower(array2string($box['ATTRIBUTES'])),'\noselect')=== false&&
484
-					stripos(strtolower(array2string($box['ATTRIBUTES'])),'\nonexistent')=== false)
482
+				if (isset($box['ATTRIBUTES']) && !empty($box['ATTRIBUTES']) &&
483
+					stripos(strtolower(array2string($box['ATTRIBUTES'])), '\noselect') === false &&
484
+					stripos(strtolower(array2string($box['ATTRIBUTES'])), '\nonexistent') === false)
485 485
 				{
486 486
 					$suF[$box['MAILBOX']] = $box;
487 487
 				}
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 			$status = $this->status($mailbox);
504 504
 			foreach ($status as $key => $v)
505 505
 			{
506
-				$_status[strtoupper($key)]=$v;
506
+				$_status[strtoupper($key)] = $v;
507 507
 			}
508 508
 			return $_status;
509 509
 		}
@@ -521,9 +521,9 @@  discard block
 block discarded – undo
521 521
 	 * @param ignoreStatusCache bool ignore the cache used for counters
522 522
 	 * @return array with counters
523 523
 	 */
524
-	function getStatus($mailbox, $ignoreStatusCache=false)
524
+	function getStatus($mailbox, $ignoreStatusCache = false)
525 525
 	{
526
-		$mailboxes = $this->listMailboxes($mailbox,Horde_Imap_Client::MBOX_ALL,array(
526
+		$mailboxes = $this->listMailboxes($mailbox, Horde_Imap_Client::MBOX_ALL, array(
527 527
 				'attributes'=>true,
528 528
 				'children'=>true, //child info
529 529
 				'delimiter'=>true,
@@ -537,16 +537,16 @@  discard block
 block discarded – undo
537 537
 		//error_log(__METHOD__.__LINE__.array2string($mboxes->count()));
538 538
 		foreach ($mboxes->getIterator() as $k =>$box)
539 539
 		{
540
-			if ($k!='user' && $k != '' && $k==$mailbox)
540
+			if ($k != 'user' && $k != '' && $k == $mailbox)
541 541
 			{
542
-				if (stripos(array2string($box['attributes']),'\noselect')=== false)
542
+				if (stripos(array2string($box['attributes']), '\noselect') === false)
543 543
 				{
544 544
 					$status = $this->status($k, $flags);
545 545
 					foreach ($status as $key => $v)
546 546
 					{
547
-						$_status[strtoupper($key)]=$v;
547
+						$_status[strtoupper($key)] = $v;
548 548
 					}
549
-					$_status['HIERACHY_DELIMITER'] = $_status['delimiter'] = ($box['delimiter']?$box['delimiter']:$this->getDelimiter('personal'));
549
+					$_status['HIERACHY_DELIMITER'] = $_status['delimiter'] = ($box['delimiter'] ? $box['delimiter'] : $this->getDelimiter('personal'));
550 550
 					$_status['ATTRIBUTES'] = $box['attributes'];
551 551
 					//error_log(__METHOD__.__LINE__.$k.'->'.array2string($_status));
552 552
 					return $_status;
@@ -572,14 +572,14 @@  discard block
 block discarded – undo
572 572
 	 *
573 573
 	 * @return  mixed   array of mailboxes
574 574
 	 */
575
-	function getMailboxes($reference = ''  , $restriction_search = 0, $returnAttributes = false)
575
+	function getMailboxes($reference = '', $restriction_search = 0, $returnAttributes = false)
576 576
 	{
577
-		if ( is_bool($restriction_search) ){
578
-			$restriction_search = (int) $restriction_search;
577
+		if (is_bool($restriction_search)) {
578
+			$restriction_search = (int)$restriction_search;
579 579
 		}
580 580
 		$mailbox = '';
581
-		if ( is_int( $restriction_search ) ){
582
-			switch ( $restriction_search ) {
581
+		if (is_int($restriction_search)) {
582
+			switch ($restriction_search) {
583 583
 			case 0:
584 584
 				$searchstring = $reference."*";
585 585
 				break;
@@ -591,8 +591,8 @@  discard block
 block discarded – undo
591 591
 				$searchstring = $reference."%";
592 592
 				break;
593 593
 			}
594
-		}else{
595
-			if ( is_string( $restriction_search ) ){
594
+		} else {
595
+			if (is_string($restriction_search)) {
596 596
 				$mailbox = $searchstring = $restriction_search;
597 597
 			}
598 598
 		}
@@ -605,35 +605,35 @@  discard block
 block discarded – undo
605 605
 				'special_use'=>true,
606 606
 				'sort'=>true,
607 607
 			);
608
-		if ($returnAttributes==false)
608
+		if ($returnAttributes == false)
609 609
 		{
610 610
 			unset($options['attributes']);
611 611
 			unset($options['children']);
612 612
 			unset($options['special_use']);
613 613
 		}
614
-		$mailboxes = $this->listMailboxes($searchstring,Horde_Imap_Client::MBOX_ALL, $options);
614
+		$mailboxes = $this->listMailboxes($searchstring, Horde_Imap_Client::MBOX_ALL, $options);
615 615
 		//$mboxes = new Horde_Imap_Client_Mailbox_List($mailboxes);
616 616
 		//_debug_array($mboxes->count());
617 617
 		foreach ((array)$mailboxes as $k =>$box)
618 618
 		{
619 619
 			//error_log(__METHOD__.__LINE__.' Box:'.$k.'->'.array2string($box));
620
-			$ret[$k]=array('MAILBOX'=>$k,'ATTRIBUTES'=>$box['attributes'],'delimiter'=>($box['delimiter']?$box['delimiter']:$this->getDelimiter('personal')),'SUBSCRIBED'=>true);
620
+			$ret[$k] = array('MAILBOX'=>$k, 'ATTRIBUTES'=>$box['attributes'], 'delimiter'=>($box['delimiter'] ? $box['delimiter'] : $this->getDelimiter('personal')), 'SUBSCRIBED'=>true);
621 621
 		}
622 622
 		// for unknown reasons on ALL, UNSUBSCRIBED are not returned
623 623
 		//always fetch unsubscribed, think about only fetching it when $options['attributes'] is set
624 624
 		//but then allMailboxes are not all, ....
625 625
 		//if (!empty($mailbox) && !isset($ret[$mailbox]))
626 626
 		{
627
-			$unsub_mailboxes = $this->listMailboxes($searchstring,Horde_Imap_Client::MBOX_UNSUBSCRIBED, $options);
627
+			$unsub_mailboxes = $this->listMailboxes($searchstring, Horde_Imap_Client::MBOX_UNSUBSCRIBED, $options);
628 628
 			//$mboxes = new Horde_Imap_Client_Mailbox_List($mailboxes);
629 629
 			//_debug_array($mboxes->count());
630 630
 			//error_log(__METHOD__.__LINE__.' '.$mailbox.':'.count((array)$mailboxes).'->'.function_backtrace());
631 631
 			foreach ((array)$unsub_mailboxes as $k =>$box)
632 632
 			{
633 633
 				//error_log(__METHOD__.__LINE__.' Box:'.$k.' already In?'.array_key_exists($k,$boxexists).'->'.array2string($box));
634
-				if(!array_key_exists($k,$ret))
634
+				if (!array_key_exists($k, $ret))
635 635
 				{
636
-					$ret[$k]=array('MAILBOX'=>$k,'ATTRIBUTES'=>$box['attributes'],'delimiter'=>($box['delimiter']?$box['delimiter']:$this->getDelimiter('personal')),'SUBSCRIBED'=>false);
636
+					$ret[$k] = array('MAILBOX'=>$k, 'ATTRIBUTES'=>$box['attributes'], 'delimiter'=>($box['delimiter'] ? $box['delimiter'] : $this->getDelimiter('personal')), 'SUBSCRIBED'=>false);
637 637
 				}
638 638
 				else
639 639
 				{
@@ -656,14 +656,14 @@  discard block
 block discarded – undo
656 656
 	 *
657 657
 	 * @return  mixed   array of mailboxes
658 658
 	 */
659
-	function listSubscribedMailboxes($reference = ''  , $restriction_search = 0, $returnAttributes = false)
659
+	function listSubscribedMailboxes($reference = '', $restriction_search = 0, $returnAttributes = false)
660 660
 	{
661
-		if ( is_bool($restriction_search) ){
662
-			$restriction_search = (int) $restriction_search;
661
+		if (is_bool($restriction_search)) {
662
+			$restriction_search = (int)$restriction_search;
663 663
 		}
664 664
 		$mailbox = '';
665
-		if ( is_int( $restriction_search ) ){
666
-			switch ( $restriction_search ) {
665
+		if (is_int($restriction_search)) {
666
+			switch ($restriction_search) {
667 667
 			case 0:
668 668
 				$searchstring = $reference."*";
669 669
 				break;
@@ -675,8 +675,8 @@  discard block
 block discarded – undo
675 675
 				$searchstring = $reference."%";
676 676
 				break;
677 677
 			}
678
-		}else{
679
-			if ( is_string( $restriction_search ) ){
678
+		} else {
679
+			if (is_string($restriction_search)) {
680 680
 				$mailbox = $searchstring = $restriction_search;
681 681
 			}
682 682
 		}
@@ -688,25 +688,25 @@  discard block
 block discarded – undo
688 688
 				'special_use'=>true,
689 689
 				'sort'=>true,
690 690
 			);
691
-		if ($returnAttributes==false)
691
+		if ($returnAttributes == false)
692 692
 		{
693 693
 			unset($options['attributes']);
694 694
 			unset($options['children']);
695 695
 			unset($options['special_use']);
696 696
 		}
697
-		$mailboxes = $this->listMailboxes($searchstring,Horde_Imap_Client::MBOX_SUBSCRIBED_EXISTS, $options);
697
+		$mailboxes = $this->listMailboxes($searchstring, Horde_Imap_Client::MBOX_SUBSCRIBED_EXISTS, $options);
698 698
 		//$mboxes = new Horde_Imap_Client_Mailbox_List($mailboxes);
699 699
 		//_debug_array($mboxes->count());
700 700
 		foreach ((array)$mailboxes as $k =>$box)
701 701
 		{
702 702
 			//error_log(__METHOD__.__LINE__.' Searched for:'.$mailbox.' got Box:'.$k.'->'.array2string($box).function_backtrace());
703
-			if ($returnAttributes==false)
703
+			if ($returnAttributes == false)
704 704
 			{
705
-				$ret[]=$k;
705
+				$ret[] = $k;
706 706
 			}
707 707
 			else
708 708
 			{
709
-				$ret[$k]=array('MAILBOX'=>$k,'ATTRIBUTES'=>$box['attributes'],'delimiter'=>($box['delimiter']?$box['delimiter']:$this->getDelimiter('personal')),'SUBSCRIBED'=>true);
709
+				$ret[$k] = array('MAILBOX'=>$k, 'ATTRIBUTES'=>$box['attributes'], 'delimiter'=>($box['delimiter'] ? $box['delimiter'] : $this->getDelimiter('personal')), 'SUBSCRIBED'=>true);
710 710
 			}
711 711
 		}
712 712
 		return $ret;
@@ -722,14 +722,14 @@  discard block
 block discarded – undo
722 722
 	 *
723 723
 	 * @return  mixed   array of mailboxes
724 724
 	 */
725
-	function listUnSubscribedMailboxes($reference = ''  , $restriction_search = 0)
725
+	function listUnSubscribedMailboxes($reference = '', $restriction_search = 0)
726 726
 	{
727
-		if ( is_bool($restriction_search) ){
728
-			$restriction_search = (int) $restriction_search;
727
+		if (is_bool($restriction_search)) {
728
+			$restriction_search = (int)$restriction_search;
729 729
 		}
730 730
 
731
-		if ( is_int( $restriction_search ) ){
732
-			switch ( $restriction_search ) {
731
+		if (is_int($restriction_search)) {
732
+			switch ($restriction_search) {
733 733
 			case 0:
734 734
 				$mailbox = $reference."*";
735 735
 				break;
@@ -741,8 +741,8 @@  discard block
 block discarded – undo
741 741
 				$mailbox = "%";
742 742
 				break;
743 743
 			}
744
-		}else{
745
-			if ( is_string( $restriction_search ) ){
744
+		} else {
745
+			if (is_string($restriction_search)) {
746 746
 				$mailbox = $restriction_search;
747 747
 			}
748 748
 		}
@@ -751,17 +751,17 @@  discard block
 block discarded – undo
751 751
 			'sort'=>true,
752 752
 			//'flat'=>true,
753 753
 		);
754
-		$mailboxes = $this->listMailboxes($mailbox,Horde_Imap_Client::MBOX_SUBSCRIBED_EXISTS, $options);
754
+		$mailboxes = $this->listMailboxes($mailbox, Horde_Imap_Client::MBOX_SUBSCRIBED_EXISTS, $options);
755 755
 		foreach ($mailboxes as $box)
756 756
 		{
757 757
 			//error_log(__METHOD__.__LINE__.' Box:'.$k.'->'.array2string($box['mailbox']->utf8));
758
-			$sret[]=$box['mailbox']->utf8;
758
+			$sret[] = $box['mailbox']->utf8;
759 759
 		}
760
-		$unsubscribed = $this->listMailboxes($mailbox,Horde_Imap_Client::MBOX_UNSUBSCRIBED, $options);
760
+		$unsubscribed = $this->listMailboxes($mailbox, Horde_Imap_Client::MBOX_UNSUBSCRIBED, $options);
761 761
 		foreach ($unsubscribed as $box)
762 762
 		{
763 763
 			//error_log(__METHOD__.__LINE__.' Box:'.$k.'->'.array2string($box['mailbox']->utf8));
764
-			if (!in_array($box['mailbox']->utf8,$sret) && $box['mailbox']->utf8!='INBOX') $ret[]=$box['mailbox']->utf8;
764
+			if (!in_array($box['mailbox']->utf8, $sret) && $box['mailbox']->utf8 != 'INBOX') $ret[] = $box['mailbox']->utf8;
765 765
 		}
766 766
 		return $ret;
767 767
 	}
@@ -773,12 +773,12 @@  discard block
 block discarded – undo
773 773
 	 * @param int $flags =null default Horde_Imap_Client::STATUS_ALL | Horde_Imap_Client::STATUS_FLAGS | Horde_Imap_Client::STATUS_PERMFLAGS
774 774
 	 * @return array of counters for mailbox
775 775
 	 */
776
-	function examineMailbox($mailbox, $flags=null)
776
+	function examineMailbox($mailbox, $flags = null)
777 777
 	{
778
-		if ($mailbox=='') return false;
778
+		if ($mailbox == '') return false;
779 779
 		$mailboxes = $this->listMailboxes($mailbox);
780 780
 
781
-		if (is_null($flags)) $flags = Horde_Imap_Client::STATUS_ALL | Horde_Imap_Client::STATUS_FLAGS | Horde_Imap_Client::STATUS_PERMFLAGS;
781
+		if (is_null($flags)) $flags = Horde_Imap_Client::STATUS_ALL|Horde_Imap_Client::STATUS_FLAGS|Horde_Imap_Client::STATUS_PERMFLAGS;
782 782
 
783 783
 		$mboxes = new Horde_Imap_Client_Mailbox_List($mailboxes);
784 784
 		//_debug_array($mboxes->count());
@@ -786,18 +786,18 @@  discard block
 block discarded – undo
786 786
 		{
787 787
 			//error_log(__METHOD__.__LINE__.array2string($box));
788 788
 			unset($box);
789
-			if ($k!='user' && $k != '' && $k==$mailbox)
789
+			if ($k != 'user' && $k != '' && $k == $mailbox)
790 790
 			{
791 791
 				$status = $this->status($k, $flags);
792 792
 				//error_log(__METHOD__.__LINE__.array2string($status));
793 793
 				foreach ($status as $key => $v)
794 794
 				{
795
-					$_status[strtoupper($key)]=$v;
795
+					$_status[strtoupper($key)] = $v;
796 796
 				}
797
-				if ($flags & (Horde_Imap_Client::STATUS_FLAGS|Horde_Imap_Client::STATUS_PERMFLAGS))
797
+				if ($flags&(Horde_Imap_Client::STATUS_FLAGS|Horde_Imap_Client::STATUS_PERMFLAGS))
798 798
 				{
799 799
 					self::$supports_keywords[$this->ImapServerId] = stripos(implode('', $status['flags']), '$label') !== false ||
800
-						in_array('\\*', $status['permflags']);	// arbitrary keyswords also allow keywords
800
+						in_array('\\*', $status['permflags']); // arbitrary keyswords also allow keywords
801 801
 				}
802 802
 				return $_status;
803 803
 			}
@@ -836,7 +836,7 @@  discard block
 block discarded – undo
836 836
 	 */
837 837
 	function hasCapability($capability)
838 838
 	{
839
-		if ($capability=='SUPPORTS_KEYWORDS')
839
+		if ($capability == 'SUPPORTS_KEYWORDS')
840 840
 		{
841 841
 			// if pseudo-flag is not set, call examineMailbox now to set it (no STATUS_ALL = counters necessary)
842 842
 			if (!isset(self::$supports_keywords[$this->ImapServerId]))
@@ -848,7 +848,7 @@  discard block
 block discarded – undo
848 848
 				catch (\Exception $e)
849 849
 				{
850 850
 					error_log(__METHOD__.__LINE__.' (examineServer for detection) '.$capability.'->'.array2string(self::$supports_keywords).' failed '.function_backtrace());
851
-					self::$supports_keywords[$this->ImapServerId]=false;
851
+					self::$supports_keywords[$this->ImapServerId] = false;
852 852
 				}
853 853
 			}
854 854
 			//error_log(__METHOD__.__LINE__.' '.$capability.'->'.array2string(self::$supports_keywords).' '.function_backtrace());
@@ -898,9 +898,9 @@  discard block
 block discarded – undo
898 898
 	 */
899 899
 	static function getFolderPrefixFromNamespace($_nameSpace, $_folderName)
900 900
 	{
901
-		foreach($_nameSpace as &$singleNameSpace)
901
+		foreach ($_nameSpace as &$singleNameSpace)
902 902
 		{
903
-			if (substr($_folderName,0,strlen($singleNameSpace['prefix'])) == $singleNameSpace['prefix']) return $singleNameSpace['prefix'];
903
+			if (substr($_folderName, 0, strlen($singleNameSpace['prefix'])) == $singleNameSpace['prefix']) return $singleNameSpace['prefix'];
904 904
 		}
905 905
 		return "";
906 906
 	}
@@ -915,33 +915,33 @@  discard block
 block discarded – undo
915 915
 	 * @param string $reclevel = 0, counter to keep track of the current recursionlevel
916 916
 	 * @return array of mailboxes
917 917
 	 */
918
-	function getMailBoxesRecursive($_mailbox, $delimiter, $prefix, $reclevel=0)
918
+	function getMailBoxesRecursive($_mailbox, $delimiter, $prefix, $reclevel = 0)
919 919
 	{
920 920
 		if ($reclevel > 25) {
921
-			error_log( __METHOD__." Recursion Level Exeeded ($reclevel) while looking up $_mailbox$delimiter ");
921
+			error_log(__METHOD__." Recursion Level Exeeded ($reclevel) while looking up $_mailbox$delimiter ");
922 922
 			return array();
923 923
 		}
924 924
 		$reclevel++;
925 925
 		// clean up double delimiters
926
-		$mailbox = preg_replace('~'.($delimiter == '.' ? "\\".$delimiter:$delimiter).'+~s',$delimiter,$_mailbox);
926
+		$mailbox = preg_replace('~'.($delimiter == '.' ? "\\".$delimiter : $delimiter).'+~s', $delimiter, $_mailbox);
927 927
 		//get that mailbox in question
928
-		$mbx = $this->getMailboxes($mailbox,1,true);
928
+		$mbx = $this->getMailboxes($mailbox, 1, true);
929 929
 		$mbxkeys = array_keys($mbx);
930 930
 
931 931
 		// Example: Array([INBOX/GaGa] => Array([MAILBOX] => INBOX/GaGa[ATTRIBUTES] => Array([0] => \\unmarked)[delimiter] => /))
932
-		if (is_array($mbx[$mbxkeys[0]]["ATTRIBUTES"]) && (in_array('\HasChildren',$mbx[$mbxkeys[0]]["ATTRIBUTES"]) || in_array('\Haschildren',$mbx[$mbxkeys[0]]["ATTRIBUTES"]) || in_array('\haschildren',$mbx[$mbxkeys[0]]["ATTRIBUTES"])))
932
+		if (is_array($mbx[$mbxkeys[0]]["ATTRIBUTES"]) && (in_array('\HasChildren', $mbx[$mbxkeys[0]]["ATTRIBUTES"]) || in_array('\Haschildren', $mbx[$mbxkeys[0]]["ATTRIBUTES"]) || in_array('\haschildren', $mbx[$mbxkeys[0]]["ATTRIBUTES"])))
933 933
 		{
934
-			$buff = $this->getMailboxes($mbx[$mbxkeys[0]]['MAILBOX'].($mbx[$mbxkeys[0]]['MAILBOX'] == $prefix ? '':$delimiter),2,false);
934
+			$buff = $this->getMailboxes($mbx[$mbxkeys[0]]['MAILBOX'].($mbx[$mbxkeys[0]]['MAILBOX'] == $prefix ? '' : $delimiter), 2, false);
935 935
 			$allMailboxes = array();
936 936
 			foreach ($buff as $mbxname) {
937
-				$mbxname = preg_replace('~'.($delimiter == '.' ? "\\".$delimiter:$delimiter).'+~s',$delimiter,$mbxname['MAILBOX']);
937
+				$mbxname = preg_replace('~'.($delimiter == '.' ? "\\".$delimiter : $delimiter).'+~s', $delimiter, $mbxname['MAILBOX']);
938 938
 				#echo "About to recur in level $reclevel:".$mbxname."<br>";
939
-				if ( $mbxname != $mbx[$mbxkeys[0]]['MAILBOX'] && $mbxname != $prefix  && $mbxname != $mbx[$mbxkeys[0]]['MAILBOX'].$delimiter)
939
+				if ($mbxname != $mbx[$mbxkeys[0]]['MAILBOX'] && $mbxname != $prefix && $mbxname != $mbx[$mbxkeys[0]]['MAILBOX'].$delimiter)
940 940
 				{
941 941
 					$allMailboxes = array_merge($allMailboxes, self::getMailBoxesRecursive($mbxname, $delimiter, $prefix, $reclevel));
942 942
 				}
943 943
 			}
944
-			if (!(in_array('\NoSelect',$mbx[$mbxkeys[0]]["ATTRIBUTES"]) || in_array('\Noselect',$mbx[$mbxkeys[0]]["ATTRIBUTES"]) || in_array('\noselect',$mbx[$mbxkeys[0]]["ATTRIBUTES"]))) $allMailboxes[] = $mbx[$mbxkeys[0]]['MAILBOX'];
944
+			if (!(in_array('\NoSelect', $mbx[$mbxkeys[0]]["ATTRIBUTES"]) || in_array('\Noselect', $mbx[$mbxkeys[0]]["ATTRIBUTES"]) || in_array('\noselect', $mbx[$mbxkeys[0]]["ATTRIBUTES"]))) $allMailboxes[] = $mbx[$mbxkeys[0]]['MAILBOX'];
945 945
 			return $allMailboxes;
946 946
 		}
947 947
 		else
@@ -960,24 +960,24 @@  discard block
 block discarded – undo
960 960
 	 */
961 961
 	function getNameSpace()
962 962
 	{
963
-		static $nameSpace=null;
963
+		static $nameSpace = null;
964 964
 		$foldersNameSpace = array();
965 965
 		$delimiter = $this->getDelimiter();
966
-		if (empty($delimiter)) $delimiter='/';
966
+		if (empty($delimiter)) $delimiter = '/';
967 967
 		if (is_null($nameSpace)) $nameSpace = $this->getNameSpaceArray();
968 968
 		if (is_array($nameSpace)) {
969
-			foreach($nameSpace as $type => $singleNameSpaceArray)
969
+			foreach ($nameSpace as $type => $singleNameSpaceArray)
970 970
 			{
971 971
 				foreach ($singleNameSpaceArray as $singleNameSpace)
972 972
 				{
973 973
 					$_foldersNameSpace = array();
974
-					if($type == 'personal' && $singleNameSpace['name'] == '#mh/' && ($this->folderExists('Mail')||$this->folderExists('INBOX')))
974
+					if ($type == 'personal' && $singleNameSpace['name'] == '#mh/' && ($this->folderExists('Mail') || $this->folderExists('INBOX')))
975 975
 					{
976 976
 						$_foldersNameSpace['prefix_present'] = 'forced';
977 977
 						// uw-imap server with mailbox prefix or dovecot maybe
978
-						$_foldersNameSpace['prefix'] = ($this->folderExists('Mail')?'Mail':(!empty($singleNameSpace['name'])?$singleNameSpace['name']:''));
978
+						$_foldersNameSpace['prefix'] = ($this->folderExists('Mail') ? 'Mail' : (!empty($singleNameSpace['name']) ? $singleNameSpace['name'] : ''));
979 979
 					}
980
-					elseif($type == 'personal' && ($singleNameSpace['name'] == '#mh/') && $this->folderExists('mail'))
980
+					elseif ($type == 'personal' && ($singleNameSpace['name'] == '#mh/') && $this->folderExists('mail'))
981 981
 					{
982 982
 						$_foldersNameSpace['prefix_present'] = 'forced';
983 983
 						// uw-imap server with mailbox prefix or dovecot maybe
@@ -986,9 +986,9 @@  discard block
 block discarded – undo
986 986
 						$_foldersNameSpace['prefix_present'] = !empty($singleNameSpace['name']);
987 987
 						$_foldersNameSpace['prefix'] = $singleNameSpace['name'];
988 988
 					}
989
-					$_foldersNameSpace['delimiter'] = ($singleNameSpace['delimiter']?$singleNameSpace['delimiter']:$delimiter);
989
+					$_foldersNameSpace['delimiter'] = ($singleNameSpace['delimiter'] ? $singleNameSpace['delimiter'] : $delimiter);
990 990
 					$_foldersNameSpace['type'] = $type;
991
-					$foldersNameSpace[] =$_foldersNameSpace;
991
+					$foldersNameSpace[] = $_foldersNameSpace;
992 992
 				}
993 993
 			}
994 994
 		}
@@ -1000,29 +1000,29 @@  discard block
 block discarded – undo
1000 1000
 	 * @param mixed _type (1=personal, 2=user/other, 3=shared)
1001 1001
 	 * @return string the delimimiter
1002 1002
 	 */
1003
-	function getDelimiter($_type=1)
1003
+	function getDelimiter($_type = 1)
1004 1004
 	{
1005 1005
 		switch ($_type)
1006 1006
 		{
1007 1007
 			case 'user':
1008 1008
 			case 'other':
1009 1009
 			case 2:
1010
-				$type=2;
1010
+				$type = 2;
1011 1011
 				break;
1012 1012
 			case 'shared':
1013 1013
 			case '':
1014 1014
 			case 3:
1015
-				$type=3;
1015
+				$type = 3;
1016 1016
 				break;
1017 1017
 			case 'personal':
1018 1018
 			case 1:
1019 1019
 			default:
1020
-				$type=1;
1020
+				$type = 1;
1021 1021
 		}
1022 1022
 		$namespaces = $this->getNamespaces();
1023 1023
 		foreach ($namespaces as $nsp)
1024 1024
 		{
1025
-			if ($nsp['type']==$type && $nsp['delimiter']) return $nsp['delimiter'];
1025
+			if ($nsp['type'] == $type && $nsp['delimiter']) return $nsp['delimiter'];
1026 1026
 		}
1027 1027
 		return "/";
1028 1028
 	}
@@ -1050,7 +1050,7 @@  discard block
 block discarded – undo
1050 1050
 	{
1051 1051
 		if (is_numeric($_username))
1052 1052
 		{
1053
-			$_username = $GLOBALS['egw']->accounts->id2name($accountID=$_username);
1053
+			$_username = $GLOBALS['egw']->accounts->id2name($accountID = $_username);
1054 1054
 		}
1055 1055
 		else
1056 1056
 		{
@@ -1059,7 +1059,7 @@  discard block
 block discarded – undo
1059 1059
 		switch ($this->loginType)
1060 1060
 		{
1061 1061
 			case 'email':
1062
-				$_username = $GLOBALS['egw']->accounts->id2name($accountID,'account_email');
1062
+				$_username = $GLOBALS['egw']->accounts->id2name($accountID, 'account_email');
1063 1063
 				break;
1064 1064
 
1065 1065
 			case 'vmailmgr':
@@ -1074,8 +1074,8 @@  discard block
 block discarded – undo
1074 1074
 				if (empty($this->loginType))
1075 1075
 				{
1076 1076
 					// try to figure out by params['acc_imap_username']
1077
-					list($lusername,$domain) = explode('@',$this->params['acc_imap_username'],2);
1078
-					if (strpos($_username,'@')===false && !empty($domain) && !empty($lusername))
1077
+					list($lusername, $domain) = explode('@', $this->params['acc_imap_username'], 2);
1078
+					if (strpos($_username, '@') === false && !empty($domain) && !empty($lusername))
1079 1079
 					{
1080 1080
 						$_username = $_username.'@'.$domain;
1081 1081
 					}
@@ -1114,20 +1114,20 @@  discard block
 block discarded – undo
1114 1114
 	 * @param string $_folderName=''
1115 1115
 	 * @return string utf-7 encoded (done in getMailboxName)
1116 1116
 	 */
1117
-	function getUserMailboxString($_username, $_folderName='')
1117
+	function getUserMailboxString($_username, $_folderName = '')
1118 1118
 	{
1119 1119
 		$nameSpaces = $this->getNameSpaceArray();
1120 1120
 
1121
-		if(!isset($nameSpaces['others'])) {
1121
+		if (!isset($nameSpaces['others'])) {
1122 1122
 			return false;
1123 1123
 		}
1124 1124
 
1125 1125
 		$username = $this->getMailBoxUserName($_username);
1126
-		if($this->loginType == 'vmailmgr' || $this->loginType == 'email' || $this->loginType == 'uidNumber') {
1127
-			$username .= '@'. $this->domainName;
1126
+		if ($this->loginType == 'vmailmgr' || $this->loginType == 'email' || $this->loginType == 'uidNumber') {
1127
+			$username .= '@'.$this->domainName;
1128 1128
 		}
1129 1129
 
1130
-		$mailboxString = $nameSpaces['others'][0]['name'] . $username . (!empty($_folderName) ? ($nameSpaces['others'][0]['delimiter']?$nameSpaces['others'][0]['delimiter']:'/') . $_folderName : '');
1130
+		$mailboxString = $nameSpaces['others'][0]['name'].$username.(!empty($_folderName) ? ($nameSpaces['others'][0]['delimiter'] ? $nameSpaces['others'][0]['delimiter'] : '/').$_folderName : '');
1131 1131
 
1132 1132
 		return $mailboxString;
1133 1133
 	}
@@ -1146,7 +1146,7 @@  discard block
 block discarded – undo
1146 1146
 		);
1147 1147
 		//error_log(__METHOD__.__LINE__.array2string($types));
1148 1148
 		$result = array();
1149
-		foreach($this->getNamespaces() as $data)
1149
+		foreach ($this->getNamespaces() as $data)
1150 1150
 		{
1151 1151
 			//error_log(__METHOD__.__LINE__.array2string($data));
1152 1152
 			if (isset($types[$data['type']]))
@@ -1156,7 +1156,7 @@  discard block
 block discarded – undo
1156 1156
 					'name' => $data['name'],
1157 1157
 					'prefix' => $data['name'],
1158 1158
 					'prefix_present' => !empty($data['name']),
1159
-					'delimiter' => ($data['delimiter']?$data['delimiter']:'/'),
1159
+					'delimiter' => ($data['delimiter'] ? $data['delimiter'] : '/'),
1160 1160
 				);
1161 1161
 			}
1162 1162
 		}
@@ -1177,7 +1177,7 @@  discard block
 block discarded – undo
1177 1177
 		{
1178 1178
 			if ($qInfo['storage'])
1179 1179
 			{
1180
-				return array('USED'=>$qInfo['storage']['usage'],'QMAX'=>$qInfo['storage']['limit']);
1180
+				return array('USED'=>$qInfo['storage']['usage'], 'QMAX'=>$qInfo['storage']['limit']);
1181 1181
 			}
1182 1182
 		}
1183 1183
 		return false;
@@ -1191,7 +1191,7 @@  discard block
 block discarded – undo
1191 1191
 	 * @param string $_what - what to retrieve either limit/QMAX, usage/USED or ALL is supported
1192 1192
 	 * @return int|array|boolean the quota for specified user (by what) or array with values for "limit" and "usage", or false
1193 1193
 	 */
1194
-	function getQuotaByUser($_username, $_what='QMAX')
1194
+	function getQuotaByUser($_username, $_what = 'QMAX')
1195 1195
 	{
1196 1196
 		$mailboxName = $this->getUserMailboxString($_username);
1197 1197
 		$storageQuota = $this->getQuotaRoot($mailboxName);
@@ -1200,7 +1200,7 @@  discard block
 block discarded – undo
1200 1200
 		if (is_array($storageQuota) && isset($storageQuota[$mailboxName]) && is_array($storageQuota[$mailboxName]) &&
1201 1201
 			isset($storageQuota[$mailboxName]['storage']) && is_array($storageQuota[$mailboxName]['storage']))
1202 1202
 		{
1203
-			switch($_what)
1203
+			switch ($_what)
1204 1204
 			{
1205 1205
 				case 'QMAX':
1206 1206
 					$_what = 'limit';
@@ -1226,7 +1226,7 @@  discard block
 block discarded – undo
1226 1226
 	 */
1227 1227
 	function getUserData($_username)
1228 1228
 	{
1229
-		unset($_username);	// not used
1229
+		unset($_username); // not used
1230 1230
 		return array();
1231 1231
 	}
1232 1232
 
@@ -1239,7 +1239,7 @@  discard block
 block discarded – undo
1239 1239
 	 */
1240 1240
 	function setUserData($_username, $_quota)
1241 1241
 	{
1242
-		unset($_username, $_quota);	// not used
1242
+		unset($_username, $_quota); // not used
1243 1243
 		return true;
1244 1244
 	}
1245 1245
 
@@ -1273,10 +1273,10 @@  discard block
 block discarded – undo
1273 1273
 	 * @param array $params
1274 1274
 	 * @throws Api\Exception\WrongParameter
1275 1275
 	 */
1276
-	public function __call($name,array $params=null)
1276
+	public function __call($name, array $params = null)
1277 1277
 	{
1278 1278
 		if ($this->debug) error_log(__METHOD__.'->'.$name.' with params:'.array2string($params));
1279
-		switch($name)
1279
+		switch ($name)
1280 1280
 		{
1281 1281
 			case 'installScript':
1282 1282
 			case 'getScript':
@@ -1291,9 +1291,9 @@  discard block
 block discarded – undo
1291 1291
 				if (is_null($this->sieve))
1292 1292
 				{
1293 1293
 					$this->sieve = new Sieve($this);
1294
-					$this->error =& $this->sieve->error;
1294
+					$this->error = & $this->sieve->error;
1295 1295
 				}
1296
-				$ret = call_user_func_array(array($this->sieve,$name),$params);
1296
+				$ret = call_user_func_array(array($this->sieve, $name), $params);
1297 1297
 				//error_log(__CLASS__.'->'.$name.'('.array2string($params).') returns '.array2string($ret));
1298 1298
 				return $ret;
1299 1299
 		}
@@ -1308,7 +1308,7 @@  discard block
 block discarded – undo
1308 1308
 	 * @param string $_scriptName =null
1309 1309
 	 * @return boolean
1310 1310
 	 */
1311
-	public function setVacationUser($_euser, array $_vacation, $_scriptName=null)
1311
+	public function setVacationUser($_euser, array $_vacation, $_scriptName = null)
1312 1312
 	{
1313 1313
 		if ($this->debug) error_log(__METHOD__.' User:'.array2string($_euser).' Scriptname:'.array2string($_scriptName).' VacationMessage:'.array2string($_vacation));
1314 1314
 
@@ -1320,8 +1320,8 @@  discard block
 block discarded – undo
1320 1320
 		{
1321 1321
 			$this->adminConnection($_euser);
1322 1322
 			$this->sieve = new Sieve($this, $_euser, $_scriptName);
1323
-			$this->scriptName =& $this->sieve->scriptName;
1324
-			$this->error =& $this->sieve->error;
1323
+			$this->scriptName = & $this->sieve->scriptName;
1324
+			$this->error = & $this->sieve->error;
1325 1325
 		}
1326 1326
 		$ret = $this->setVacation($_vacation, $_scriptName);
1327 1327
 
@@ -1336,7 +1336,7 @@  discard block
 block discarded – undo
1336 1336
 	 * @throws Exception on connection error or authentication failure
1337 1337
 	 * @return array
1338 1338
 	 */
1339
-	public function getVacationUser($_euser, $_scriptName=null)
1339
+	public function getVacationUser($_euser, $_scriptName = null)
1340 1340
 	{
1341 1341
 		if ($this->debug) error_log(__METHOD__.' User:'.array2string($_euser));
1342 1342
 
@@ -1348,8 +1348,8 @@  discard block
 block discarded – undo
1348 1348
 		{
1349 1349
 			$this->adminConnection($_euser);
1350 1350
 			$this->sieve = new Sieve($this, $_euser, $_scriptName);
1351
-			$this->error =& $this->sieve->error;
1352
-			$this->scriptName =& $this->sieve->scriptName;
1351
+			$this->error = & $this->sieve->error;
1352
+			$this->scriptName = & $this->sieve->scriptName;
1353 1353
 		}
1354 1354
 		return $this->sieve->getVacation();
1355 1355
 	}
@@ -1369,7 +1369,7 @@  discard block
 block discarded – undo
1369 1369
 	 */
1370 1370
 	public static function init_static()
1371 1371
 	{
1372
-		self::$supports_keywords =& Api\Cache::getSession (__CLASS__, 'supports_keywords');
1372
+		self::$supports_keywords = & Api\Cache::getSession(__CLASS__, 'supports_keywords');
1373 1373
 	}
1374 1374
 }
1375 1375
 Imap::init_static();
Please login to merge, or discard this patch.
api/src/Mail/Imap/Iface.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -121,6 +121,7 @@
 block discarded – undo
121 121
 	 * @param bool $_adminConnection create admin connection if true
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
+	 * @return void
124 125
 	 */
125 126
 	function openConnection($_adminConnection=false, $_timeout=null);
126 127
 
Please login to merge, or discard this 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.