Completed
Push — 17.1 ( 8c3b94...29ee37 )
by Ralf
20:39 queued 11:58
created
api/src/Etemplate/Widget/Textbox.php 3 patches
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	 *
56 56
 	 * @param string|XMLReader $xml
57 57
 	 * @param boolean $cloned =true true: object does NOT need to be cloned, false: to set attribute, set them in cloned object
58
-	 * @return Template current object or clone, if any attribute was set
58
+	 * @return Textbox current object or clone, if any attribute was set
59 59
 	 */
60 60
 	public function set_attrs($xml, $cloned=true)
61 61
 	{
@@ -110,7 +110,6 @@  discard block
 block discarded – undo
110 110
 	 * @param array $expand values for keys 'c', 'row', 'c_', 'row_', 'cont'
111 111
 	 * @param array $content
112 112
 	 * @param array &$validated=array() validated content
113
-	 * @param array $expand=array values for keys 'c', 'row', 'c_', 'row_', 'cont'
114 113
 	 */
115 114
 	public function validate($cname, array $expand, array $content, &$validated=array())
116 115
 	{
Please login to merge, or discard this patch.
Braces   +14 added lines, -4 removed lines patch added patch discarded remove patch
@@ -41,7 +41,10 @@  discard block
 block discarded – undo
41 41
 		// normalize types
42 42
 		if ($this->type !== 'textbox')
43 43
 		{
44
-			if ($this->type == 'int') $this->type = 'integer';
44
+			if ($this->type == 'int')
45
+			{
46
+				$this->type = 'integer';
47
+			}
45 48
 
46 49
 			$this->attrs['type'] = $this->type;
47 50
 			$this->type = 'textbox';
@@ -90,7 +93,10 @@  discard block
 block discarded – undo
90 93
 			if (!empty($value))
91 94
 			{
92 95
 				$preserv =& self::get_array(self::$request->preserv, $form_name, true);
93
-				if (true) $preserv = (string)$value;
96
+				if (true)
97
+				{
98
+					$preserv = (string)$value;
99
+				}
94 100
 				$value = str_repeat('*', strlen($preserv));
95 101
 			}
96 102
 		}
@@ -171,11 +177,15 @@  discard block
 block discarded – undo
171 177
 						break;
172 178
 				}
173 179
 			}
174
-			elseif ($this->attrs['type'] == 'integer' || $this->attrs['type'] == 'float')	// cast int and float and check range
180
+			elseif ($this->attrs['type'] == 'integer' || $this->attrs['type'] == 'float')
181
+			{
182
+				// cast int and float and check range
175 183
 			{
176 184
 				if ((string)$value !== '' || $this->attrs['needed'])	// empty values are Ok if needed is not set
177 185
 				{
178
-					$value = $this->attrs['type'] == 'integer' ? (int) $value : (float) str_replace(',','.',$value);	// allow for german (and maybe other) format
186
+					$value = $this->attrs['type'] == 'integer' ? (int) $value : (float) str_replace(',','.',$value);
187
+			}
188
+			// allow for german (and maybe other) format
179 189
 
180 190
 					if (!(empty($this->attrs['min']) && $this->attrs['min'] !== 0) && $value < $this->attrs['min'])
181 191
 					{
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	 * @param boolean $cloned =true true: object does NOT need to be cloned, false: to set attribute, set them in cloned object
58 58
 	 * @return Template current object or clone, if any attribute was set
59 59
 	 */
60
-	public function set_attrs($xml, $cloned=true)
60
+	public function set_attrs($xml, $cloned = true)
61 61
 	{
62 62
 		parent::set_attrs($xml, $cloned);
63 63
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 			$this->setElementAttribute($this->id, 'size', abs($this->attrs['size']));
70 70
 			self::$request->readonlys[$this->id] = false;
71 71
 			$this->setElementAttribute($this->id, 'readonly', true);
72
-			trigger_error("Using a negative size to set textbox readonly. " .$this, E_USER_DEPRECATED);
72
+			trigger_error("Using a negative size to set textbox readonly. ".$this, E_USER_DEPRECATED);
73 73
 		}
74 74
 		return $this;
75 75
 	}
@@ -80,16 +80,16 @@  discard block
 block discarded – undo
80 80
 	 * @param string $cname
81 81
 	 * @param array $expand values for keys 'c', 'row', 'c_', 'row_', 'cont'
82 82
 	 */
83
-	public function beforeSendToClient($cname, array $expand=null)
83
+	public function beforeSendToClient($cname, array $expand = null)
84 84
 	{
85 85
 		// to NOT transmit passwords back to client, we need to store (non-empty) value in preserv
86 86
 		if ($this->attrs['type'] == 'passwd' || $this->type == 'passwd')
87 87
 		{
88 88
 			$form_name = self::form_name($cname, $this->id, $expand);
89
-			$value =& self::get_array(self::$request->content, $form_name);
89
+			$value = & self::get_array(self::$request->content, $form_name);
90 90
 			if (!empty($value))
91 91
 			{
92
-				$preserv =& self::get_array(self::$request->preserv, $form_name, true);
92
+				$preserv = & self::get_array(self::$request->preserv, $form_name, true);
93 93
 				if (true) $preserv = (string)$value;
94 94
 				$value = str_repeat('*', strlen($preserv));
95 95
 			}
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	 * @param array &$validated=array() validated content
113 113
 	 * @param array $expand=array values for keys 'c', 'row', 'c_', 'row_', 'cont'
114 114
 	 */
115
-	public function validate($cname, array $expand, array $content, &$validated=array())
115
+	public function validate($cname, array $expand, array $content, &$validated = array())
116 116
 	{
117 117
 		$form_name = self::form_name($cname, $this->id, $expand);
118 118
 
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 		{
121 121
 			if (!isset($this->attrs['validator']))
122 122
 			{
123
-				switch($this->attrs['type'])
123
+				switch ($this->attrs['type'])
124 124
 				{
125 125
 					case 'int':
126 126
 					case 'integer':
@@ -150,26 +150,26 @@  discard block
 block discarded – undo
150 150
 
151 151
 			if ((string)$value === '' && $this->attrs['needed'])
152 152
 			{
153
-				self::set_validation_error($form_name,lang('Field must not be empty !!!'),'');
153
+				self::set_validation_error($form_name, lang('Field must not be empty !!!'), '');
154 154
 			}
155
-			if ((int) $this->attrs['maxlength'] > 0 && mb_strlen($value) > (int) $this->attrs['maxlength'])
155
+			if ((int)$this->attrs['maxlength'] > 0 && mb_strlen($value) > (int)$this->attrs['maxlength'])
156 156
 			{
157
-				$value = mb_substr($value,0,(int) $this->attrs['maxlength']);
157
+				$value = mb_substr($value, 0, (int)$this->attrs['maxlength']);
158 158
 			}
159 159
 			// PHP xml parser reads backslashes literal from attributes, while JavaScript ones need them escaped (eg. like PHP strings)
160 160
 			// --> replace \\ with \ to get following XML working: validator="/^\\d+$" (server- AND client-side!)
161
-			if ($this->attrs['validator'] && !preg_match(str_replace('\\\\','\\', $this->attrs['validator']), $value))
161
+			if ($this->attrs['validator'] && !preg_match(str_replace('\\\\', '\\', $this->attrs['validator']), $value))
162 162
 			{
163
-				switch($this->attrs['type'])
163
+				switch ($this->attrs['type'])
164 164
 				{
165 165
 					case 'integer':
166
-						self::set_validation_error($form_name,lang("'%1' is not a valid integer !!!",$value),'');
166
+						self::set_validation_error($form_name, lang("'%1' is not a valid integer !!!", $value), '');
167 167
 						break;
168 168
 					case 'float':
169
-						self::set_validation_error($form_name,lang("'%1' is not a valid floatingpoint number !!!",$value),'');
169
+						self::set_validation_error($form_name, lang("'%1' is not a valid floatingpoint number !!!", $value), '');
170 170
 						break;
171 171
 					default:
172
-						self::set_validation_error($form_name,lang("'%1' has an invalid format !!!",$value)/*." !preg_match('$this->attrs[validator]', '$value')"*/,'');
172
+						self::set_validation_error($form_name, lang("'%1' has an invalid format !!!", $value)/*." !preg_match('$this->attrs[validator]', '$value')"*/, '');
173 173
 						break;
174 174
 				}
175 175
 			}
@@ -177,17 +177,17 @@  discard block
 block discarded – undo
177 177
 			{
178 178
 				if ((string)$value !== '' || $this->attrs['needed'])	// empty values are Ok if needed is not set
179 179
 				{
180
-					$value = $this->attrs['type'] == 'integer' ? (int) $value : (float) str_replace(',','.',$value);	// allow for german (and maybe other) format
180
+					$value = $this->attrs['type'] == 'integer' ? (int)$value : (float)str_replace(',', '.', $value); // allow for german (and maybe other) format
181 181
 
182 182
 					if (!(empty($this->attrs['min']) && $this->attrs['min'] !== 0) && $value < $this->attrs['min'])
183 183
 					{
184
-						self::set_validation_error($form_name,lang("Value has to be at least '%1' !!!",$this->attrs['min']),'');
185
-						$value = $this->attrs['type'] == 'integer' ? (int) $this->attrs['min'] : (float) $this->attrs['min'];
184
+						self::set_validation_error($form_name, lang("Value has to be at least '%1' !!!", $this->attrs['min']), '');
185
+						$value = $this->attrs['type'] == 'integer' ? (int)$this->attrs['min'] : (float)$this->attrs['min'];
186 186
 					}
187
-					if (!(empty($this->attrs['max'])&& $this->attrs['max'] !== 0) && $value > $this->attrs['max'])
187
+					if (!(empty($this->attrs['max']) && $this->attrs['max'] !== 0) && $value > $this->attrs['max'])
188 188
 					{
189
-						self::set_validation_error($form_name,lang("Value has to be at maximum '%1' !!!",$this->attrs['max']),'');
190
-						$value = $this->attrs['type'] == 'integer' ? (int) $this->attrs['max'] : (float) $this->attrs['max'];
189
+						self::set_validation_error($form_name, lang("Value has to be at maximum '%1' !!!", $this->attrs['max']), '');
190
+						$value = $this->attrs['type'] == 'integer' ? (int)$this->attrs['max'] : (float)$this->attrs['max'];
191 191
 					}
192 192
 				}
193 193
 			}
@@ -199,4 +199,4 @@  discard block
 block discarded – undo
199 199
 		}
200 200
 	}
201 201
 }
202
-Etemplate\Widget::registerWidget(__NAMESPACE__.'\\Textbox', array('textbox','text','int','integer','float','passwd','hidden','colorpicker','hidden'));
202
+Etemplate\Widget::registerWidget(__NAMESPACE__.'\\Textbox', array('textbox', 'text', 'int', 'integer', 'float', 'passwd', 'hidden', 'colorpicker', 'hidden'));
Please login to merge, or discard this patch.
api/src/Exception/NoPermission/Admin.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -19,6 +19,9 @@
 block discarded – undo
19 19
  */
20 20
 class Admin extends App
21 21
 {
22
+	/**
23
+	 * @param string $msg
24
+	 */
22 25
 	function __construct($msg=null,$code=102)
23 26
 	{
24 27
 		if (is_null($msg)) $msg = 'admin';
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,10 +19,10 @@
 block discarded – undo
19 19
  */
20 20
 class Admin extends App
21 21
 {
22
-	function __construct($msg=null,$code=102)
22
+	function __construct($msg = null, $code = 102)
23 23
 	{
24 24
 		if (is_null($msg)) $msg = 'admin';
25 25
 
26
-		parent::__construct($msg,$code);
26
+		parent::__construct($msg, $code);
27 27
 	}
28 28
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,10 @@
 block discarded – undo
21 21
 {
22 22
 	function __construct($msg=null,$code=102)
23 23
 	{
24
-		if (is_null($msg)) $msg = 'admin';
24
+		if (is_null($msg))
25
+		{
26
+			$msg = 'admin';
27
+		}
25 28
 
26 29
 		parent::__construct($msg,$code);
27 30
 	}
Please login to merge, or discard this patch.
api/src/Framework/Ajax.php 4 patches
Doc Comments   -5 removed lines patch added patch discarded remove patch
@@ -356,11 +356,6 @@
 block discarded – undo
356 356
 	/**
357 357
 	* Add menu items to the topmenu template class to be displayed
358 358
 	*
359
-	* @param array $app application data
360
-	* @param mixed $alt_label string with alternative menu item label default value = null
361
-	* @param string $urlextra string with alternate additional code inside <a>-tag
362
-	* @access protected
363
-	* @return void
364 359
 	*/
365 360
 	function _add_topmenu_item(array $app_data,$alt_label=null)
366 361
 	{
Please login to merge, or discard this patch.
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -337,16 +337,16 @@  discard block
 block discarded – undo
337 337
 	}
338 338
 
339 339
 	/**
340
-	* called by hooks to add an icon in the topmenu info location
341
-	*
342
-	* @param string $id unique element id
343
-	* @param string $icon_src src of the icon image. Make sure this nog height then 18pixels
344
-	* @param string $iconlink where the icon links to
345
-	* @param booleon $blink set true to make the icon blink
346
-	* @param mixed $tooltip string containing the tooltip Api\Html, or null of no tooltip
347
-	* @todo implement in a reasonable way for jdots
348
-	* @return void
349
-	*/
340
+	 * called by hooks to add an icon in the topmenu info location
341
+	 *
342
+	 * @param string $id unique element id
343
+	 * @param string $icon_src src of the icon image. Make sure this nog height then 18pixels
344
+	 * @param string $iconlink where the icon links to
345
+	 * @param booleon $blink set true to make the icon blink
346
+	 * @param mixed $tooltip string containing the tooltip Api\Html, or null of no tooltip
347
+	 * @todo implement in a reasonable way for jdots
348
+	 * @return void
349
+	 */
350 350
 	function topmenu_info_icon($id,$icon_src,$iconlink,$blink=false,$tooltip=null)
351 351
 	{
352 352
 		unset($id,$icon_src,$iconlink,$blink,$tooltip);	// not used
@@ -354,14 +354,14 @@  discard block
 block discarded – undo
354 354
 	}
355 355
 
356 356
 	/**
357
-	* Add menu items to the topmenu template class to be displayed
358
-	*
359
-	* @param array $app application data
360
-	* @param mixed $alt_label string with alternative menu item label default value = null
361
-	* @param string $urlextra string with alternate additional code inside <a>-tag
362
-	* @access protected
363
-	* @return void
364
-	*/
357
+	 * Add menu items to the topmenu template class to be displayed
358
+	 *
359
+	 * @param array $app application data
360
+	 * @param mixed $alt_label string with alternative menu item label default value = null
361
+	 * @param string $urlextra string with alternate additional code inside <a>-tag
362
+	 * @access protected
363
+	 * @return void
364
+	 */
365 365
 	function _add_topmenu_item(array $app_data,$alt_label=null)
366 366
 	{
367 367
 		switch($app_data['name'])
Please login to merge, or discard this patch.
Spacing   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -57,11 +57,11 @@  discard block
 block discarded – undo
57 57
 	 *
58 58
 	 * @param string $template = '' name of the template
59 59
 	 */
60
-	function __construct($template=self::APP)
60
+	function __construct($template = self::APP)
61 61
 	{
62
-		parent::__construct($template);		// call the constructor of the extended class
62
+		parent::__construct($template); // call the constructor of the extended class
63 63
 
64
-		$this->template_dir = '/'.$template;		// we are packaged as an application
64
+		$this->template_dir = '/'.$template; // we are packaged as an application
65 65
 	}
66 66
 
67 67
 	/**
@@ -129,16 +129,16 @@  discard block
 block discarded – undo
129 129
 	public static function app_from_url($url)
130 130
 	{
131 131
 		$matches = null;
132
-		if (preg_match('/menuaction=([a-z0-9_-]+)\./i',$url,$matches))
132
+		if (preg_match('/menuaction=([a-z0-9_-]+)\./i', $url, $matches))
133 133
 		{
134 134
 			return $matches[1];
135 135
 		}
136 136
 		if ($GLOBALS['egw_info']['server']['webserver_url'] &&
137
-			($webserver_path = parse_url($GLOBALS['egw_info']['server']['webserver_url'],PHP_URL_PATH)))
137
+			($webserver_path = parse_url($GLOBALS['egw_info']['server']['webserver_url'], PHP_URL_PATH)))
138 138
 		{
139
-			list(,$url) = explode($webserver_path, parse_url($url,PHP_URL_PATH),2);
139
+			list(,$url) = explode($webserver_path, parse_url($url, PHP_URL_PATH), 2);
140 140
 		}
141
-		if (preg_match('/\/([^\/]+)\/([^\/]+\.php)?(\?|\/|$)/',$url,$matches))
141
+		if (preg_match('/\/([^\/]+)\/([^\/]+\.php)?(\?|\/|$)/', $url, $matches))
142 142
 		{
143 143
 			return $matches[1];
144 144
 		}
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	 * @param string $link_app = null if appname or true, some templates generate a special link-handler url
155 155
 	 * @return string	The full url after processing
156 156
 	 */
157
-	static function link($url = '', $extravars = '', $link_app=null)
157
+	static function link($url = '', $extravars = '', $link_app = null)
158 158
 	{
159 159
 		if (is_null($link_app)) $link_app = self::$link_app;
160 160
 		$link = parent::link($url, $extravars);
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 			// Link gets handled in JS, so quotes need slashes as well as url-encoded
166 166
 			// encoded ampersands in get parameters (%26) need to be encoded twise,
167 167
 			// so they are still encoded when assigned to window.location
168
-			$link_with_slashes = str_replace(array('%27','%26'), array('\%27','%2526'), $link);
168
+			$link_with_slashes = str_replace(array('%27', '%26'), array('\%27', '%2526'), $link);
169 169
 
170 170
 			//$link = "javascript:window.egw_link_handler?egw_link_handler('$link','$link_app'):parent.egw_link_handler('$link','$link_app');";
171 171
 			$link = "javascript:egw_link_handler('$link_with_slashes','$link_app')";
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 	 * @param array $extra = array() extra attributes passed as data-attribute to egw.js
180 180
 	 * @return string with Api\Html
181 181
 	 */
182
-	function header(array $extra=array())
182
+	function header(array $extra = array())
183 183
 	{
184 184
 		// make sure header is output only once
185 185
 		if (self::$header_done) return '';
@@ -204,8 +204,8 @@  discard block
 block discarded – undo
204 204
 		{
205 205
 			$this->tpl->set_file(array('_head' => 'head.tpl'));
206 206
 		}
207
-		$this->tpl->set_block('_head','head');
208
-		$this->tpl->set_block('_head','framework');
207
+		$this->tpl->set_block('_head', 'head');
208
+		$this->tpl->set_block('_head', 'framework');
209 209
 
210 210
 		// should we draw the framework, or just a header
211 211
 		$do_framework = isset($_GET['cd']) && $_GET['cd'] === 'yes';
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 			{
231 231
 				self::includeJS('.', 'fw_'.static::APP, static::JS_INCLUDE_APP);
232 232
 			}
233
-			Api\Cache::unsetSession(__CLASS__,'sidebox_md5');	// sideboxes need to be send again
233
+			Api\Cache::unsetSession(__CLASS__, 'sidebox_md5'); // sideboxes need to be send again
234 234
 
235 235
 			$extra['navbar-apps'] = $this->get_navbar_apps($_SERVER['REQUEST_URI']);
236 236
 		}
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 		// - if not we need to check if we have an opener (are a popup window)
240 240
 		// - as popups can open further popups, we need to decend all the way down until we find a framework
241 241
 		// - only if we cant find a framework in all openers, we redirect to create a new framework
242
-		if(!$do_framework)
242
+		if (!$do_framework)
243 243
 		{
244 244
 			// fetch sidebox from application and set it in extra data, if we are no popup
245 245
 			if (!$GLOBALS['egw_info']['flags']['nonavbar'])
@@ -249,12 +249,12 @@  discard block
 block discarded – undo
249 249
 			// for remote manual never check/create framework
250 250
 			if (!in_array($GLOBALS['egw_info']['flags']['currentapp'], array('manual', 'login', 'logout', 'sitemgr')))
251 251
 			{
252
-				if (empty($GLOBALS['egw_info']['flags']['java_script'])) $GLOBALS['egw_info']['flags']['java_script']='';
252
+				if (empty($GLOBALS['egw_info']['flags']['java_script'])) $GLOBALS['egw_info']['flags']['java_script'] = '';
253 253
 				$extra['check-framework'] = $_GET['cd'] !== 'no';
254 254
 			}
255 255
 		}
256 256
 		$this->tpl->set_var($this->_get_header($extra));
257
-		$content = $this->tpl->fp('out','head').$content;
257
+		$content = $this->tpl->fp('out', 'head').$content;
258 258
 
259 259
 		if (!$do_framework)
260 260
 		{
@@ -263,10 +263,10 @@  discard block
 block discarded – undo
263 263
 
264 264
 		// topmenu
265 265
 		$vars = $this->_get_navbar($apps = $this->_get_navbar_apps());
266
-		$this->tpl->set_var($this->topmenu($vars,$apps));
266
+		$this->tpl->set_var($this->topmenu($vars, $apps));
267 267
 
268 268
 		// hook after_navbar (eg. notifications)
269
-		$this->tpl->set_var('hook_after_navbar',$this->_get_after_navbar());
269
+		$this->tpl->set_var('hook_after_navbar', $this->_get_after_navbar());
270 270
 
271 271
 		//Global sidebar width
272 272
 		$this->tpl->set_var('sidebox_width', self::get_global_sidebar_width());
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 
284 284
 		// add framework div's
285 285
 		$this->tpl->set_var($this->_get_footer());
286
-		$content .= $this->tpl->fp('out','framework');
286
+		$content .= $this->tpl->fp('out', 'framework');
287 287
 		$content .= self::footer(false);
288 288
 
289 289
 		echo $content;
@@ -302,14 +302,14 @@  discard block
 block discarded – undo
302 302
 	 * @param array $apps
303 303
 	 * @return array
304 304
 	 */
305
-	function topmenu(array $vars,array $apps)
305
+	function topmenu(array $vars, array $apps)
306 306
 	{
307 307
 		$this->topmenu_items = $this->topmenu_info_items = array();
308 308
 
309
-		parent::topmenu($vars,$apps);
310
-		$vars['topmenu_items'] = "<ul>\n<li>".implode("</li>\n<li>",$this->topmenu_items)."</li>\n</ul>";
309
+		parent::topmenu($vars, $apps);
310
+		$vars['topmenu_items'] = "<ul>\n<li>".implode("</li>\n<li>", $this->topmenu_items)."</li>\n</ul>";
311 311
 		$vars['topmenu_info_items'] = '';
312
-		foreach($this->topmenu_info_items as $id => $item)
312
+		foreach ($this->topmenu_info_items as $id => $item)
313 313
 		{
314 314
 			$vars['topmenu_info_items'] .= '<div class="topmenu_info_item"'.
315 315
 				(is_numeric($id) ? '' : ' id="topmenu_info_'.$id.'"').'>'.$item."</div>\n";
@@ -330,9 +330,9 @@  discard block
 block discarded – undo
330 330
 	* @todo implement in a reasonable way for jdots
331 331
 	* @return void
332 332
 	*/
333
-	function topmenu_info_icon($id,$icon_src,$iconlink,$blink=false,$tooltip=null)
333
+	function topmenu_info_icon($id, $icon_src, $iconlink, $blink = false, $tooltip = null)
334 334
 	{
335
-		unset($id,$icon_src,$iconlink,$blink,$tooltip);	// not used
335
+		unset($id, $icon_src, $iconlink, $blink, $tooltip); // not used
336 336
 		// not yet implemented, only used in admin/inc/hook_topmenu_info.inc.php to notify about pending updates
337 337
 	}
338 338
 
@@ -345,9 +345,9 @@  discard block
 block discarded – undo
345 345
 	* @access protected
346 346
 	* @return void
347 347
 	*/
348
-	function _add_topmenu_item(array $app_data,$alt_label=null)
348
+	function _add_topmenu_item(array $app_data, $alt_label = null)
349 349
 	{
350
-		switch($app_data['name'])
350
+		switch ($app_data['name'])
351 351
 		{
352 352
 			case 'logout':
353 353
 				if (Api\Header\UserAgent::mobile() || $GLOBALS['egw_info']['user']['preferences']['common']['theme'] == 'mobile')
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 				}
357 357
 				else
358 358
 				{
359
-					return;	// no need for logout in topmenu on jdots
359
+					return; // no need for logout in topmenu on jdots
360 360
 				}
361 361
 				break;
362 362
 
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 				break;
366 366
 
367 367
 			default:
368
-				if (strpos($app_data['url'],'logout.php') === false && substr($app_data['url'], 0, 11) != 'javascript:')
368
+				if (strpos($app_data['url'], 'logout.php') === false && substr($app_data['url'], 0, 11) != 'javascript:')
369 369
 				{
370 370
 					$app_data['url'] = "javascript:egw_link_handler('".$app_data['url']."','".
371 371
 						(isset($GLOBALS['egw_info']['user']['apps'][$app_data['name']]) ?
@@ -373,8 +373,8 @@  discard block
 block discarded – undo
373 373
 				}
374 374
 		}
375 375
 		$id = $app_data['id'] ? $app_data['id'] : ($app_data['name'] ? $app_data['name'] : $app_data['title']);
376
-		$title =  htmlspecialchars($alt_label ? $alt_label : $app_data['title']);
377
-		$this->topmenu_items[] = '<a id="topmenu_' . $id . '" href="'.htmlspecialchars($app_data['url']).'" title="'.$app_data['title'].'">'.$title.'</a>';
376
+		$title = htmlspecialchars($alt_label ? $alt_label : $app_data['title']);
377
+		$this->topmenu_items[] = '<a id="topmenu_'.$id.'" href="'.htmlspecialchars($app_data['url']).'" title="'.$app_data['title'].'">'.$title.'</a>';
378 378
 	}
379 379
 
380 380
 	/**
@@ -385,11 +385,11 @@  discard block
 block discarded – undo
385 385
 	 * @access protected
386 386
 	 * @return void
387 387
 	 */
388
-	function _add_topmenu_info_item($content, $id=null)
388
+	function _add_topmenu_info_item($content, $id = null)
389 389
 	{
390
-		if(strpos($content,'menuaction=admin.admin_accesslog.sessions') !== false)
390
+		if (strpos($content, 'menuaction=admin.admin_accesslog.sessions') !== false)
391 391
 		{
392
-			$content = preg_replace('/href="([^"]+)"/',"href=\"javascript:egw_link_handler('\\1','admin')\"",$content);
392
+			$content = preg_replace('/href="([^"]+)"/', "href=\"javascript:egw_link_handler('\\1','admin')\"", $content);
393 393
 		}
394 394
 		if ($id)
395 395
 		{
@@ -408,10 +408,10 @@  discard block
 block discarded – undo
408 408
 	 */
409 409
 	static function ajax_tz_selection($tz)
410 410
 	{
411
-		Api\DateTime::setUserPrefs($tz);	// throws exception, if tz is invalid
411
+		Api\DateTime::setUserPrefs($tz); // throws exception, if tz is invalid
412 412
 
413 413
 		$GLOBALS['egw']->preferences->read_repository();
414
-		$GLOBALS['egw']->preferences->add('common','tz',$tz);
414
+		$GLOBALS['egw']->preferences->add('common', 'tz', $tz);
415 415
 		$GLOBALS['egw']->preferences->save_repository();
416 416
 	}
417 417
 
@@ -463,13 +463,13 @@  discard block
 block discarded – undo
463 463
 		// only send admin sidebox, for admin index url (when clicked on admin),
464 464
 		// not for other admin pages, called eg. from sidebox menu of other apps
465 465
 		// --> that way we always stay in the app, and NOT open admin sidebox for an app tab!!!
466
-		if ($app == 'admin' && substr($_SERVER['PHP_SELF'],-16) != '/admin/index.php' &&
466
+		if ($app == 'admin' && substr($_SERVER['PHP_SELF'], -16) != '/admin/index.php' &&
467 467
 			$_GET['menuaction'] != 'admin.admin_ui.index')
468 468
 		{
469 469
 			//error_log(__METHOD__."() app=$app, menuaction=$_GET[menuaction], PHP_SELF=$_SERVER[PHP_SELF] --> sidebox request ignored");
470 470
 			return;
471 471
 		}
472
-		$md5_session =& Api\Cache::getSession(__CLASS__,'sidebox_md5');
472
+		$md5_session = & Api\Cache::getSession(__CLASS__, 'sidebox_md5');
473 473
 
474 474
 		//Set the sidebox content
475 475
 		$sidebox = $this->get_sidebox($app);
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
 		if ($md5_session[$app] !== $md5)
479 479
 		{
480 480
 			//error_log(__METHOD__."() header changed md5_session[$app]!=='$md5' --> setting it on self::\$extra[setSidebox]");
481
-			$md5_session[$app] = $md5;	// update md5 in session
481
+			$md5_session[$app] = $md5; // update md5 in session
482 482
 			self::$extra['setSidebox'] = array($app, $sidebox, $md5);
483 483
 		}
484 484
 		//else error_log(__METHOD__."() md5_session[$app]==='$md5' --> nothing to do");
@@ -492,9 +492,9 @@  discard block
 block discarded – undo
492 492
 	 * @return boolean $consider_navbar_not_yet_called_as_true=true ignored by jdots, we only care for cd=yes GET param
493 493
 	 * @return boolean
494 494
 	 */
495
-	public function isTop($consider_navbar_not_yet_called_as_true=true)
495
+	public function isTop($consider_navbar_not_yet_called_as_true = true)
496 496
 	{
497
-		unset($consider_navbar_not_yet_called_as_true);	// not used
497
+		unset($consider_navbar_not_yet_called_as_true); // not used
498 498
 		return isset($_GET['cd']) && $_GET['cd'] === 'yes';
499 499
 	}
500 500
 
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 	 * @param array $file
521 521
 	 * @param string $type = null 'admin', 'preferences', 'favorites', ...
522 522
 	 */
523
-	public function sidebox($appname,$menu_title,$file,$type=null)
523
+	public function sidebox($appname, $menu_title, $file, $type = null)
524 524
 	{
525 525
 		if (!isset($file['menuOpened'])) $file['menuOpened'] = (boolean)$this->sidebox_menu_opened;
526 526
 		//error_log(__METHOD__."('$appname', '$menu_title', file[menuOpened]=$file[menuOpened], ...) this->sidebox_menu_opened=$this->sidebox_menu_opened");
@@ -529,11 +529,11 @@  discard block
 block discarded – undo
529 529
 		// fix app admin menus to use admin.admin_ui.index loader
530 530
 		if (($type == 'admin' || $menu_title == lang('Admin')) && $appname != 'admin')
531 531
 		{
532
-			foreach($file as &$link)
532
+			foreach ($file as &$link)
533 533
 			{
534 534
 				preg_match('/ajax=(true|false)/', $link, $ajax);
535 535
 				$link = preg_replace("/^(javascript:egw_link_handler\(')(.*)menuaction=([^&]+)(.*)(','[^']+'\))$/",
536
-					'$1$2menuaction=admin.admin_ui.index&load=$3$4&ajax=' . ($ajax[1] ? $ajax[1] : 'true') .'\',\'admin\')', $file_was=$link);
536
+					'$1$2menuaction=admin.admin_ui.index&load=$3$4&ajax='.($ajax[1] ? $ajax[1] : 'true').'\',\'admin\')', $file_was = $link);
537 537
 			}
538 538
 
539 539
 		}
@@ -570,15 +570,15 @@  discard block
 block discarded – undo
570 570
 			self::$link_app = $appname;
571 571
 			// allow other apps to hook into sidebox menu of an app, hook-name: sidebox_$appname
572 572
 			$this->sidebox_menu_opened = true;
573
-			Api\Hooks::process('sidebox_'.$appname,array($appname),true);	// true = call independent of app-permissions
573
+			Api\Hooks::process('sidebox_'.$appname, array($appname), true); // true = call independent of app-permissions
574 574
 
575 575
 			// calling the old hook
576 576
 			$this->sidebox_menu_opened = true;
577
-			Api\Hooks::single('sidebox_menu',$appname);
577
+			Api\Hooks::single('sidebox_menu', $appname);
578 578
 			self::$link_app = null;
579 579
 
580 580
 			// allow other apps to hook into sidebox menu of every app: sidebox_all
581
-			Api\Hooks::process('sidebox_all',array($GLOBALS['egw_info']['flags']['currentapp']),true);
581
+			Api\Hooks::process('sidebox_all', array($GLOBALS['egw_info']['flags']['currentapp']), true);
582 582
 		}
583 583
 		//If there still is no sidebox content, return null here
584 584
 		if (!isset($this->sideboxes[$appname]))
@@ -588,17 +588,17 @@  discard block
 block discarded – undo
588 588
 
589 589
 		$data = array();
590 590
 		$sendToBottom = array();
591
-		foreach($this->sideboxes[$appname] as $menu_name => &$file)
591
+		foreach ($this->sideboxes[$appname] as $menu_name => &$file)
592 592
 		{
593 593
 			$current_menu = array(
594
-				'menu_name' => md5($menu_name),	// can contain Api\Html tags and javascript!
594
+				'menu_name' => md5($menu_name), // can contain Api\Html tags and javascript!
595 595
 				'title' => $menu_name,
596 596
 				'entries' => array(),
597 597
 				'opened' => (boolean)$file['menuOpened'],
598 598
 			);
599
-			foreach($file as $item_text => $item_link)
599
+			foreach ($file as $item_text => $item_link)
600 600
 			{
601
-				if ($item_text === 'menuOpened' || $item_text === 'sendToBottom' ||// flag, not menu entry
601
+				if ($item_text === 'menuOpened' || $item_text === 'sendToBottom' || // flag, not menu entry
602 602
 					$item_text === '_NewLine_' || $item_link === '_NewLine_')
603 603
 				{
604 604
 					continue;
@@ -609,14 +609,14 @@  discard block
 block discarded – undo
609 609
 				}
610 610
 
611 611
 				$var = array();
612
-				$var['icon_or_star'] = $GLOBALS['egw_info']['server']['webserver_url'] . $this->template_dir.'/images/bullet.png';
612
+				$var['icon_or_star'] = $GLOBALS['egw_info']['server']['webserver_url'].$this->template_dir.'/images/bullet.png';
613 613
 				$var['target'] = '';
614
-				if(is_array($item_link))
614
+				if (is_array($item_link))
615 615
 				{
616
-					if(isset($item_link['icon']))
616
+					if (isset($item_link['icon']))
617 617
 					{
618 618
 						$app = isset($item_link['app']) ? $item_link['app'] : $appname;
619
-						$var['icon_or_star'] = $item_link['icon'] ? Api\Image::find($app,$item_link['icon']) : False;
619
+						$var['icon_or_star'] = $item_link['icon'] ? Api\Image::find($app, $item_link['icon']) : False;
620 620
 					}
621 621
 					$var['lang_item'] = isset($item_link['no_lang']) && $item_link['no_lang'] ? $item_link['text'] : lang($item_link['text']);
622 622
 					$var['item_link'] = $item_link['link'];
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
 	public static function ajax_tab_changed_state($tablist)
661 661
 	{
662 662
 		$tabs = array();
663
-		foreach($tablist as $data)
663
+		foreach ($tablist as $data)
664 664
 		{
665 665
 			$tabs[] = $data['appName'];
666 666
 			if ($data['active']) $active = $data['appName'];
@@ -669,7 +669,7 @@  discard block
 block discarded – undo
669 669
 		// used eg. in phpFreeChat to leave the chat
670 670
 		if (($old_tabs = Api\Cache::getSession(__CLASS__, 'open_tabs')))
671 671
 		{
672
-			foreach(array_diff(explode(',',$old_tabs),$tabs) as $app)
672
+			foreach (array_diff(explode(',', $old_tabs), $tabs) as $app)
673 673
 			{
674 674
 				//error_log("Tab '$app' closed, old_tabs=$old_tabs");
675 675
 				Api\Hooks::single(array(
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
 				), $app);
679 679
 			}
680 680
 		}
681
-		$open = implode(',',$tabs);
681
+		$open = implode(',', $tabs);
682 682
 
683 683
 		if ($open != $GLOBALS['egw_info']['user']['preferences']['common']['open_tabs'] ||
684 684
 			$active != $GLOBALS['egw_info']['user']['preferences']['common']['active_tab'])
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
 		$i = 0;
749 749
 
750 750
 		//Parse the "$apps" array for valid content (security)
751
-		foreach($apps as $app)
751
+		foreach ($apps as $app)
752 752
 		{
753 753
 			//Check whether the app really exists and add it to the $app_arr var
754 754
 			if ($GLOBALS['egw_info']['user']['apps'][$app])
@@ -779,17 +779,17 @@  discard block
 block discarded – undo
779 779
 	 */
780 780
 	public function navbar_apps()
781 781
 	{
782
-		$apps = parent::_get_navbar_apps(Api\Image::svg_usable());	// use svg if usable in browser
782
+		$apps = parent::_get_navbar_apps(Api\Image::svg_usable()); // use svg if usable in browser
783 783
 
784 784
 		//Add its sidebox width to each app
785 785
 		foreach ($apps as $app => &$data)
786 786
 		{
787 787
 			$data['sideboxwidth'] = self::get_sidebar_width($app);
788 788
 			// overwrite icon with svg, if supported by browser
789
-			unset($data['icon_hover']);	// not used in jdots
789
+			unset($data['icon_hover']); // not used in jdots
790 790
 		}
791 791
 
792
-		unset($apps['logout']);	// never display it
792
+		unset($apps['logout']); // never display it
793 793
 		if (isset($apps['about'])) $apps['about']['noNavbar'] = true;
794 794
 		if (isset($apps['preferences'])) $apps['preferences']['noNavbar'] = true;
795 795
 		if (isset($apps['manual'])) $apps['manual']['noNavbar'] = true;
@@ -839,7 +839,7 @@  discard block
 block discarded – undo
839 839
 		}
840 840
 
841 841
 		// check if user called a specific url --> open it as active tab
842
-		$last_direct_url =& Api\Cache::getSession(__CLASS__, 'last_direct_url');
842
+		$last_direct_url = & Api\Cache::getSession(__CLASS__, 'last_direct_url');
843 843
 		if ($last_direct_url)
844 844
 		{
845 845
 			$url = $last_direct_url;
@@ -849,7 +849,7 @@  discard block
 block discarded – undo
849 849
 		{
850 850
 			// Coming in with a specific URL, save it and redirect to index.php
851 851
 			// so reloads work nicely, but strip cd=yes or we'll get the framework again
852
-			$last_direct_url = preg_replace('/[&?]cd=yes/','',$url);
852
+			$last_direct_url = preg_replace('/[&?]cd=yes/', '', $url);
853 853
 			Api\Framework::redirect_link('/index.php?cd=yes');
854 854
 		}
855 855
 		else
@@ -864,11 +864,11 @@  discard block
 block discarded – undo
864 864
 		if ($active_tab && array_key_exists($active_tab, $apps))
865 865
 		{
866 866
 			// Do not remove cd=yes if it's an ajax=true app
867
-			if (strpos( $apps[$active_tab]['url'],'ajax=true') !== False)
867
+			if (strpos($apps[$active_tab]['url'], 'ajax=true') !== False)
868 868
 			{
869
-				$url = preg_replace('/[&?]cd=yes/','',$url);
869
+				$url = preg_replace('/[&?]cd=yes/', '', $url);
870 870
 			}
871
-			if($last_direct_url)
871
+			if ($last_direct_url)
872 872
 			{
873 873
 				$apps[$active_tab]['openOnce'] = $url;
874 874
 			}
@@ -880,8 +880,8 @@  discard block
 block discarded – undo
880 880
 		{
881 881
 			$open_tabs = $GLOBALS['egw_info']['user']['preferences']['common']['open_tabs'];
882 882
 		}
883
-		$open_tabs = $open_tabs ? explode(',',$open_tabs) : array();
884
-		if ($active_tab && !in_array($active_tab,$open_tabs))
883
+		$open_tabs = $open_tabs ? explode(',', $open_tabs) : array();
884
+		if ($active_tab && !in_array($active_tab, $open_tabs))
885 885
 		{
886 886
 			$open_tabs[] = $active_tab;
887 887
 			$store_prefs = true;
@@ -889,14 +889,14 @@  discard block
 block discarded – undo
889 889
 		if ($store_prefs)
890 890
 		{
891 891
 			$GLOBALS['egw']->preferences->read_repository();
892
-			$GLOBALS['egw']->preferences->add('common', 'open_tabs', implode(',',$open_tabs));
892
+			$GLOBALS['egw']->preferences->add('common', 'open_tabs', implode(',', $open_tabs));
893 893
 			$GLOBALS['egw']->preferences->add('common', 'active_tab', $active_tab);
894 894
 			$GLOBALS['egw']->preferences->save_repository(true);
895 895
 		}
896 896
 
897 897
 		//error_log(__METHOD__."('$url') url_tab='$url_tab', active_tab=$active_tab, open_tabs=".array2string($open_tabs));
898 898
 		// Restore Tabs
899
-		foreach($open_tabs as $n => $app)
899
+		foreach ($open_tabs as $n => $app)
900 900
 		{
901 901
 			if (isset($apps[$app]))		// user might no longer have app rights
902 902
 			{
@@ -923,10 +923,10 @@  discard block
 block discarded – undo
923 923
 	 * @param boolean $no_framework = true
924 924
 	 * @return string
925 925
 	 */
926
-	function footer($no_framework=true)
926
+	function footer($no_framework = true)
927 927
 	{
928 928
 		//error_log(__METHOD__."($no_framework) footer_done=".array2string(self::$footer_done).' '.function_backtrace());
929
-		if (self::$footer_done) return;	// prevent (multiple) footers
929
+		if (self::$footer_done) return; // prevent (multiple) footers
930 930
 		self::$footer_done = true;
931 931
 
932 932
 		if (!isset($GLOBALS['egw_info']['flags']['nofooter']) || !$GLOBALS['egw_info']['flags']['nofooter'])
@@ -938,7 +938,7 @@  discard block
 block discarded – undo
938 938
 			}
939 939
 		}
940 940
 		return $footer.
941
-			$GLOBALS['egw_info']['flags']['need_footer']."\n".	// eg. javascript, which need to be at the end of the page
941
+			$GLOBALS['egw_info']['flags']['need_footer']."\n".// eg. javascript, which need to be at the end of the page
942 942
 			"</body>\n</html>\n";
943 943
 	}
944 944
 
@@ -976,8 +976,8 @@  discard block
 block discarded – undo
976 976
 		if ($parts['query'])
977 977
 		{
978 978
 			$_SERVER['REQUEST_URI'] = '?'.$parts['query'];
979
-			parse_str($parts['query'],$_GET);
980
-			$_REQUEST = $_GET;	// some apps use $_REQUEST to check $_GET or $_POST
979
+			parse_str($parts['query'], $_GET);
980
+			$_REQUEST = $_GET; // some apps use $_REQUEST to check $_GET or $_POST
981 981
 		}
982 982
 
983 983
 		if (!isset($_GET['menuaction']))
@@ -987,7 +987,7 @@  discard block
 block discarded – undo
987 987
 		// set session action
988 988
 		$GLOBALS['egw']->session->set_action('Ajax: '.$_GET['menuaction']);
989 989
 
990
-		list($app,$class,$method) = explode('.',$_GET['menuaction']);
990
+		list($app, $class, $method) = explode('.', $_GET['menuaction']);
991 991
 
992 992
 		if (!isset($GLOBALS['egw_info']['user']['apps'][$app]))
993 993
 		{
@@ -999,7 +999,7 @@  discard block
 block discarded – undo
999 999
 
1000 1000
 		$GLOBALS[$class] = $obj = CreateObject($app.'.'.$class);
1001 1001
 
1002
-		if(!is_array($obj->public_functions) || !$obj->public_functions[$method])
1002
+		if (!is_array($obj->public_functions) || !$obj->public_functions[$method])
1003 1003
 		{
1004 1004
 			throw new Api\Exception\NoPermission("Bad menuaction {$_GET['menuaction']}, not listed in public_functions!");
1005 1005
 		}
Please login to merge, or discard this patch.
Braces   +52 added lines, -13 removed lines patch added patch discarded remove patch
@@ -104,7 +104,9 @@  discard block
 block discarded – undo
104 104
 
105 105
 		//Width may not be smaller than MIN_SIDEBAR_WIDTH
106 106
 		if ($width < self::MIN_SIDEBAR_WIDTH)
107
-			$width = self::MIN_SIDEBAR_WIDTH;
107
+		{
108
+					$width = self::MIN_SIDEBAR_WIDTH;
109
+		}
108 110
 
109 111
 		return $width;
110 112
 	}
@@ -156,7 +158,10 @@  discard block
 block discarded – undo
156 158
 	 */
157 159
 	static function link($url = '', $extravars = '', $link_app=null)
158 160
 	{
159
-		if (is_null($link_app)) $link_app = self::$link_app;
161
+		if (is_null($link_app))
162
+		{
163
+			$link_app = self::$link_app;
164
+		}
160 165
 		$link = parent::link($url, $extravars);
161 166
 
162 167
 		// $link_app === true --> detect application, otherwise use given application
@@ -182,7 +187,10 @@  discard block
 block discarded – undo
182 187
 	function header(array $extra=array())
183 188
 	{
184 189
 		// make sure header is output only once
185
-		if (self::$header_done) return '';
190
+		if (self::$header_done)
191
+		{
192
+			return '';
193
+		}
186 194
 		self::$header_done = true;
187 195
 
188 196
 		$this->send_headers();
@@ -249,7 +257,10 @@  discard block
 block discarded – undo
249 257
 			// for remote manual never check/create framework
250 258
 			if (!in_array($GLOBALS['egw_info']['flags']['currentapp'], array('manual', 'login', 'logout', 'sitemgr')))
251 259
 			{
252
-				if (empty($GLOBALS['egw_info']['flags']['java_script'])) $GLOBALS['egw_info']['flags']['java_script']='';
260
+				if (empty($GLOBALS['egw_info']['flags']['java_script']))
261
+				{
262
+					$GLOBALS['egw_info']['flags']['java_script']='';
263
+				}
253 264
 				$extra['check-framework'] = $_GET['cd'] !== 'no';
254 265
 			}
255 266
 		}
@@ -522,7 +533,10 @@  discard block
 block discarded – undo
522 533
 	 */
523 534
 	public function sidebox($appname,$menu_title,$file,$type=null)
524 535
 	{
525
-		if (!isset($file['menuOpened'])) $file['menuOpened'] = (boolean)$this->sidebox_menu_opened;
536
+		if (!isset($file['menuOpened']))
537
+		{
538
+			$file['menuOpened'] = (boolean)$this->sidebox_menu_opened;
539
+		}
526 540
 		//error_log(__METHOD__."('$appname', '$menu_title', file[menuOpened]=$file[menuOpened], ...) this->sidebox_menu_opened=$this->sidebox_menu_opened");
527 541
 		$this->sidebox_menu_opened = false;
528 542
 
@@ -663,7 +677,10 @@  discard block
 block discarded – undo
663 677
 		foreach($tablist as $data)
664 678
 		{
665 679
 			$tabs[] = $data['appName'];
666
-			if ($data['active']) $active = $data['appName'];
680
+			if ($data['active'])
681
+			{
682
+				$active = $data['appName'];
683
+			}
667 684
 		}
668 685
 		// send app a notification, that it's tab got closed
669 686
 		// used eg. in phpFreeChat to leave the chat
@@ -790,10 +807,22 @@  discard block
 block discarded – undo
790 807
 		}
791 808
 
792 809
 		unset($apps['logout']);	// never display it
793
-		if (isset($apps['about'])) $apps['about']['noNavbar'] = true;
794
-		if (isset($apps['preferences'])) $apps['preferences']['noNavbar'] = true;
795
-		if (isset($apps['manual'])) $apps['manual']['noNavbar'] = true;
796
-		if (isset($apps['home'])) $apps['home']['noNavbar'] = true;
810
+		if (isset($apps['about']))
811
+		{
812
+			$apps['about']['noNavbar'] = true;
813
+		}
814
+		if (isset($apps['preferences']))
815
+		{
816
+			$apps['preferences']['noNavbar'] = true;
817
+		}
818
+		if (isset($apps['manual']))
819
+		{
820
+			$apps['manual']['noNavbar'] = true;
821
+		}
822
+		if (isset($apps['home']))
823
+		{
824
+			$apps['home']['noNavbar'] = true;
825
+		}
797 826
 
798 827
 		// no need for website icon, if we have sitemgr
799 828
 		if (isset($apps['sitemgr']) && isset($apps['sitemgr-link']))
@@ -855,7 +884,10 @@  discard block
 block discarded – undo
855 884
 		else
856 885
 		{
857 886
 			$active_tab = $GLOBALS['egw_info']['user']['preferences']['common']['active_tab'];
858
-			if (!$active_tab) $active_tab = $default_app;
887
+			if (!$active_tab)
888
+			{
889
+				$active_tab = $default_app;
890
+			}
859 891
 		}
860 892
 
861 893
 		//self::app_from_url might return an application the user has no rights
@@ -898,9 +930,12 @@  discard block
 block discarded – undo
898 930
 		// Restore Tabs
899 931
 		foreach($open_tabs as $n => $app)
900 932
 		{
901
-			if (isset($apps[$app]))		// user might no longer have app rights
933
+			if (isset($apps[$app]))
934
+			{
935
+				// user might no longer have app rights
902 936
 			{
903 937
 				$apps[$app]['opened'] = $n;
938
+			}
904 939
 				if ($app == $active_tab)
905 940
 				{
906 941
 					$apps[$app]['active'] = true;
@@ -926,7 +961,11 @@  discard block
 block discarded – undo
926 961
 	function footer($no_framework=true)
927 962
 	{
928 963
 		//error_log(__METHOD__."($no_framework) footer_done=".array2string(self::$footer_done).' '.function_backtrace());
929
-		if (self::$footer_done) return;	// prevent (multiple) footers
964
+		if (self::$footer_done)
965
+		{
966
+			return;
967
+		}
968
+		// prevent (multiple) footers
930 969
 		self::$footer_done = true;
931 970
 
932 971
 		if (!isset($GLOBALS['egw_info']['flags']['nofooter']) || !$GLOBALS['egw_info']['flags']['nofooter'])
Please login to merge, or discard this patch.
api/src/Framework/CssIncludes.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -145,7 +145,7 @@
 block discarded – undo
145 145
 	 * Parse beginning of given CSS file for /*@import url("...") statements
146 146
 	 *
147 147
 	 * @param string $path EGroupware relative path eg. /phpgwapi/templates/default/some.css
148
-	 * @return array parsed pathes (EGroupware relative) including $path itself
148
+	 * @return string[] parsed pathes (EGroupware relative) including $path itself
149 149
 	 */
150 150
 	protected static function resolve_css_includes($path, &$pathes=array())
151 151
 	{
Please login to merge, or discard this patch.
Braces   +8 added lines, -2 removed lines patch added patch discarded remove patch
@@ -107,14 +107,20 @@
 block discarded – undo
107 107
 		$max_modified = 0;
108 108
 		//no more dynamic minifying: $debug_minify = $GLOBALS['egw_info']['server']['debug_minify'] === 'True';
109 109
 		$base_path = $GLOBALS['egw_info']['server']['webserver_url'];
110
-		if ($base_path[0] != '/') $base_path = parse_url($base_path, PHP_URL_PATH);
110
+		if ($base_path[0] != '/')
111
+		{
112
+			$base_path = parse_url($base_path, PHP_URL_PATH);
113
+		}
111 114
 		$css_files = '';
112 115
 		foreach(self::$files as $path)
113 116
 		{
114 117
 			foreach(self::resolve_css_includes($path) as $path)
115 118
 			{
116 119
 				list($file,$query) = explode('?',$path,2);
117
-				if (($mod = filemtime(EGW_SERVER_ROOT.$file)) > $max_modified) $max_modified = $mod;
120
+				if (($mod = filemtime(EGW_SERVER_ROOT.$file)) > $max_modified)
121
+				{
122
+					$max_modified = $mod;
123
+				}
118 124
 
119 125
 				// do NOT include app.css or categories.php, as it changes from app to app
120 126
 				//no more dynamic minifying: if ($debug_minify || substr($path, -8) == '/app.css' || substr($file,-14) == 'categories.php')
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 * @param boolean $clear_includes =false true: clear all previous includes
35 35
 	 * @return boolean false: css file not found, true: file found
36 36
 	 */
37
-	public static function add($app, $name=null, $append=true, $clear_includes=false)
37
+	public static function add($app, $name = null, $append = true, $clear_includes = false)
38 38
 	{
39 39
 		if ($clear_includes)
40 40
 		{
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 
44 44
 		if (!is_null($name))
45 45
 		{
46
-			foreach($GLOBALS['egw']->framework->template_dirs as $dir)
46
+			foreach ($GLOBALS['egw']->framework->template_dirs as $dir)
47 47
 			{
48 48
 				if (file_exists(EGW_SERVER_ROOT.($path = '/'.$app.'/templates/'.$dir.'/'.$name.'.css')))
49 49
 				{
@@ -55,12 +55,12 @@  discard block
 block discarded – undo
55 55
 		{
56 56
 			$path = $app;
57 57
 		}
58
-		if (!file_exists(EGW_SERVER_ROOT.$path) && !file_exists(EGW_SERVER_ROOT . parse_url($path,PHP_URL_PATH)))
58
+		if (!file_exists(EGW_SERVER_ROOT.$path) && !file_exists(EGW_SERVER_ROOT.parse_url($path, PHP_URL_PATH)))
59 59
 		{
60 60
 			//error_log(__METHOD__."($app,$name) $path NOT found!");
61 61
 			return false;
62 62
 		}
63
-		if (!in_array($path,self::$files))
63
+		if (!in_array($path, self::$files))
64 64
 		{
65 65
 			if ($append)
66 66
 			{
@@ -79,16 +79,16 @@  discard block
 block discarded – undo
79 79
 	 *
80 80
 	 * @return string
81 81
 	 */
82
-	public static function get($resolve=false)
82
+	public static function get($resolve = false)
83 83
 	{
84 84
 		if (!$resolve)
85 85
 		{
86 86
 			return self::$files;
87 87
 		}
88 88
 		$files = array();
89
-		foreach(self::$files as $path)
89
+		foreach (self::$files as $path)
90 90
 		{
91
-			foreach(self::resolve_css_includes($path) as $path)
91
+			foreach (self::resolve_css_includes($path) as $path)
92 92
 			{
93 93
 				$files[] = $path;
94 94
 			}
@@ -109,11 +109,11 @@  discard block
 block discarded – undo
109 109
 		$base_path = $GLOBALS['egw_info']['server']['webserver_url'];
110 110
 		if ($base_path[0] != '/') $base_path = parse_url($base_path, PHP_URL_PATH);
111 111
 		$css_files = '';
112
-		foreach(self::$files as $path)
112
+		foreach (self::$files as $path)
113 113
 		{
114
-			foreach(self::resolve_css_includes($path) as $path)
114
+			foreach (self::resolve_css_includes($path) as $path)
115 115
 			{
116
-				list($file,$query) = explode('?',$path,2);
116
+				list($file, $query) = explode('?', $path, 2);
117 117
 				if (($mod = filemtime(EGW_SERVER_ROOT.$file)) > $max_modified) $max_modified = $mod;
118 118
 
119 119
 				// do NOT include app.css or categories.php, as it changes from app to app
@@ -147,20 +147,20 @@  discard block
 block discarded – undo
147 147
 	 * @param string $path EGroupware relative path eg. /phpgwapi/templates/default/some.css
148 148
 	 * @return array parsed pathes (EGroupware relative) including $path itself
149 149
 	 */
150
-	protected static function resolve_css_includes($path, &$pathes=array())
150
+	protected static function resolve_css_includes($path, &$pathes = array())
151 151
 	{
152 152
 		$matches = null;
153 153
 
154
-		list($file) = explode('?',$path,2);
155
-		if (($to_check = file_get_contents (EGW_SERVER_ROOT.$file, false, null, 0, 1024)) &&
154
+		list($file) = explode('?', $path, 2);
155
+		if (($to_check = file_get_contents(EGW_SERVER_ROOT.$file, false, null, 0, 1024)) &&
156 156
 			stripos($to_check, '/*@import') !== false && preg_match_all('|/\*@import url\("([^"]+)"|i', $to_check, $matches))
157 157
 		{
158
-			foreach($matches[1] as $import_path)
158
+			foreach ($matches[1] as $import_path)
159 159
 			{
160 160
 				if ($import_path[0] != '/')
161 161
 				{
162 162
 					$dir = dirname($path);
163
-					while(substr($import_path,0,3) == '../')
163
+					while (substr($import_path, 0, 3) == '../')
164 164
 					{
165 165
 						$dir = dirname($dir);
166 166
 						$import_path = substr($import_path, 3);
Please login to merge, or discard this patch.
api/src/Framework/Favorites.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -187,7 +187,7 @@
 block discarded – undo
187 187
 	 * @param string $action "add" or "delete"
188 188
 	 * @param boolean|int|String $group ID of the group to create the favorite for, or 'all' for all users
189 189
 	 * @param array $filters key => value pairs for the filter
190
-	 * @return boolean Success
190
+	 * @return boolean|null Success
191 191
 	 */
192 192
 	public static function set_favorite($app, $_name, $action, $group, $filters = array())
193 193
 	{
Please login to merge, or discard this patch.
Braces   +5 added lines, -1 removed lines patch added patch discarded remove patch
@@ -161,7 +161,11 @@
 block discarded – undo
161 161
 		{
162 162
 			if(strpos($pref_name, $pref_prefix) === 0)
163 163
 			{
164
-				if(!is_array($pref)) continue;	// old favorite
164
+				if(!is_array($pref))
165
+				{
166
+					continue;
167
+				}
168
+				// old favorite
165 169
 
166 170
 				$favorites[(string)substr($pref_name,strlen($pref_prefix))] = $pref;
167 171
 			}
Please login to merge, or discard this patch.
Spacing   +25 added lines, -26 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	 *
43 43
 	 * @return array with a single sidebox menu item (array) containing html for favorites
44 44
 	 */
45
-	public static function list_favorites($app, $default=null)
45
+	public static function list_favorites($app, $default = null)
46 46
 	{
47 47
 		if (!$app)
48 48
 		{
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 		$target = 'favorite_sidebox_'.$app;
59 59
 
60 60
 		/* @var $filters array an array of favorites*/
61
-		$filters =  self::get_favorites($app);
61
+		$filters = self::get_favorites($app);
62 62
 		$is_admin = $GLOBALS['egw_info']['user']['apps']['admin'];
63 63
 		$html = "<span id='$target' class='ui-helper-clearfix sidebox-favorites'><ul class='ui-menu ui-widget-content ui-corner-all favorites' role='listbox'>\n";
64 64
 
@@ -69,25 +69,24 @@  discard block
 block discarded – undo
69 69
 		}
70 70
 
71 71
 		// Get link for if there is no nextmatch - this is the fallback
72
-		$registry = Api\Link::get_registry($app,'list');
72
+		$registry = Api\Link::get_registry($app, 'list');
73 73
 		if (!$registry)
74 74
 		{
75 75
 			$registry = Api\Link::get_registry($app, 'index');
76 76
 		}
77
-		foreach($filters as $name => $filter)
77
+		foreach ($filters as $name => $filter)
78 78
 		{
79 79
 			//filter must not be empty if there's one, ignore it at the moment but it need to be checked how it got there in database
80 80
 			if (!$filter)
81 81
 			{
82
-				error_log(__METHOD__.'Favorite filter "'.$name.'" is not supposed to be empty, it should be an array.  Skipping, more investigation needed. filter = '. array2string($filters[$name]));
82
+				error_log(__METHOD__.'Favorite filter "'.$name.'" is not supposed to be empty, it should be an array.  Skipping, more investigation needed. filter = '.array2string($filters[$name]));
83 83
 				continue;
84 84
 			}
85 85
 			$li = "<li data-id='$name' data-group='{$filter['group']}' class='ui-menu-item' role='menuitem'>\n";
86 86
 			$li .= '<a href="#" class="ui-corner-all" tabindex="-1">';
87
-			$li .= "<div class='" . ((string)$name === (string)$default_filter ? 'ui-icon ui-icon-heart' : 'sideboxstar') . "'></div>".
87
+			$li .= "<div class='".((string)$name === (string)$default_filter ? 'ui-icon ui-icon-heart' : 'sideboxstar')."'></div>".
88 88
 				$filter['name'];
89
-			$li .= ($filter['group'] != false && !$is_admin || $name === 'blank' ? "" :
90
-				"<div class='ui-icon ui-icon-trash' title='" . lang('Delete') . "'></div>");
89
+			$li .= ($filter['group'] != false && !$is_admin || $name === 'blank' ? "" : "<div class='ui-icon ui-icon-trash' title='".lang('Delete')."'></div>");
91 90
 			$li .= "</a></li>\n";
92 91
 			//error_log(__METHOD__."() $name, filter=".array2string($filter)." --> ".$li);
93 92
 			$html .= $li;
@@ -95,7 +94,7 @@  discard block
 block discarded – undo
95 94
 
96 95
 		// If were're here, the app supports favorites, so add a 'Add' link too
97 96
 		$html .= "<li data-id='add' class='ui-menu-item' role='menuitem'><a href='javascript:app.$app.add_favorite()' class='ui-corner-all'>";
98
-		$html .= Api\Html::image($app, 'new') . lang('Add current'). '</a></li>';
97
+		$html .= Api\Html::image($app, 'new').lang('Add current').'</a></li>';
99 98
 
100 99
 		$html .= '</ul></span>';
101 100
 
@@ -117,7 +116,7 @@  discard block
 block discarded – undo
117 116
 	 * @return (array|boolean) An array of sorted favorites or False if there's no preferenced sorted list
118 117
 	 *
119 118
 	 */
120
-	public static function get_fav_sort_pref ($app)
119
+	public static function get_fav_sort_pref($app)
121 120
 	{
122 121
 		$fav_sorted_list = array();
123 122
 
@@ -157,13 +156,13 @@  discard block
 block discarded – undo
157 156
 		$fav_sort_pref = self::get_fav_sort_pref($app);
158 157
 
159 158
 		// Look through all preferences & pull out favorites
160
-		foreach((array)$GLOBALS['egw_info']['user']['preferences'][$app] as $pref_name => $pref)
159
+		foreach ((array)$GLOBALS['egw_info']['user']['preferences'][$app] as $pref_name => $pref)
161 160
 		{
162
-			if(strpos($pref_name, $pref_prefix) === 0)
161
+			if (strpos($pref_name, $pref_prefix) === 0)
163 162
 			{
164
-				if(!is_array($pref)) continue;	// old favorite
163
+				if (!is_array($pref)) continue; // old favorite
165 164
 
166
-				$favorites[(string)substr($pref_name,strlen($pref_prefix))] = $pref;
165
+				$favorites[(string)substr($pref_name, strlen($pref_prefix))] = $pref;
167 166
 			}
168 167
 		}
169 168
 		if (is_array($fav_sort_pref))
@@ -172,7 +171,7 @@  discard block
 block discarded – undo
172 171
 			{
173 172
 				$sorted_list[$key] = $favorites[$key];
174 173
 			}
175
-			$favorites = array_merge($sorted_list,$favorites);
174
+			$favorites = array_merge($sorted_list, $favorites);
176 175
 		}
177 176
 		return $favorites;
178 177
 	}
@@ -204,7 +203,7 @@  discard block
 block discarded – undo
204 203
 			}
205 204
 			else
206 205
 			{
207
-				foreach($GLOBALS['egw']->accounts->memberships($GLOBALS['egw_info']['user']['account_id'], true) as $gid)
206
+				foreach ($GLOBALS['egw']->accounts->memberships($GLOBALS['egw_info']['user']['account_id'], true) as $gid)
208 207
 				{
209 208
 					$prefs = new Api\Preferences($gid);
210 209
 					$prefs->read_repository();
@@ -216,7 +215,7 @@  discard block
 block discarded – undo
216 215
 				}
217 216
 			}
218 217
 		}
219
-		if($group && $GLOBALS['egw_info']['apps']['admin'] && $group !== 'all')
218
+		if ($group && $GLOBALS['egw_info']['apps']['admin'] && $group !== 'all')
220 219
 		{
221 220
 			$prefs = new Api\Preferences(is_numeric($group) ? $group : $GLOBALS['egw_info']['user']['account_id']);
222 221
 		}
@@ -227,7 +226,7 @@  discard block
 block discarded – undo
227 226
 		$prefs->read_repository();
228 227
 		$type = $group === "all" ? "default" : "user";
229 228
 		//error_log(__METHOD__."('$app', '$name', '$action', ".array2string($group).", ...) pref_name=$pref_name, type=$type");
230
-		if($action == "add")
229
+		if ($action == "add")
231 230
 		{
232 231
 			$filters = array(
233 232
 				// This is the name as user entered it, minus tags
@@ -235,9 +234,9 @@  discard block
 block discarded – undo
235 234
 				'group' => $group ? $group : false,
236 235
 				'state' => $filters
237 236
 			);
238
-			$pref_name = "favorite_".preg_replace('/[^A-Za-z0-9-_]/u','_',$name);
239
-			$result = $prefs->add($app,$pref_name,$filters,$type);
240
-			$pref = $prefs->save_repository(false,$type);
237
+			$pref_name = "favorite_".preg_replace('/[^A-Za-z0-9-_]/u', '_', $name);
238
+			$result = $prefs->add($app, $pref_name, $filters, $type);
239
+			$pref = $prefs->save_repository(false, $type);
241 240
 
242 241
 			// Update preferences client side, or it could disappear
243 242
 			Api\Json\Response::get()->call('egw.set_preferences', (array)$pref[$app], $app);
@@ -247,8 +246,8 @@  discard block
 block discarded – undo
247 246
 		}
248 247
 		else if ($action == "delete")
249 248
 		{
250
-			$result = $prefs->delete($app,$pref_name, $type);
251
-			$pref = $prefs->save_repository(false,$type);
249
+			$result = $prefs->delete($app, $pref_name, $type);
250
+			$pref = $prefs->save_repository(false, $type);
252 251
 
253 252
 			// Update preferences client side, or it could come back
254 253
 			Api\Json\Response::get()->call('egw.set_preferences', (array)$pref[$app], $app);
@@ -291,7 +290,7 @@  discard block
 block discarded – undo
291 290
 			{
292 291
 				$value = is_array($old_value) ? $old_value : php_safe_unserialize($old_value);
293 292
 
294
-				switch($attr)
293
+				switch ($attr)
295 294
 				{
296 295
 					case 'index_state':
297 296
 						$changes += self::change_account_id($value, self::$app_favorite_attributes[$app], $ids2change);
@@ -337,7 +336,7 @@  discard block
 block discarded – undo
337 336
 			if (!empty($value[$attrs_to_change]))
338 337
 			{
339 338
 				$vals = !is_array($value[$attrs_to_change]) ? explode(',', $value[$attrs_to_change]) : $value[$attrs_to_change];
340
-				foreach($vals as &$v)
339
+				foreach ($vals as &$v)
341 340
 				{
342 341
 					if (isset($ids2change[$v]))
343 342
 					{
@@ -350,7 +349,7 @@  discard block
 block discarded – undo
350 349
 		}
351 350
 		else
352 351
 		{
353
-			foreach($attrs_to_change as $key => $names)
352
+			foreach ($attrs_to_change as $key => $names)
354 353
 			{
355 354
 				if (is_int($key))
356 355
 				{
Please login to merge, or discard this patch.
api/src/Header/Authenticate.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -234,7 +234,7 @@
 block discarded – undo
234 234
 	 * @param string $realm
235 235
 	 * @param string $username
236 236
 	 * @param string &$password=null password to use or if null, on return stored password
237
-	 * @return string|boolean false if $password not given and can NOT be read
237
+	 * @return false|string false if $password not given and can NOT be read
238 238
 	 */
239 239
 	static private function get_digest_A1($realm,$username,&$password=null)
240 240
 	{
Please login to merge, or discard this patch.
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -255,20 +255,20 @@
 block discarded – undo
255 255
 	 */
256 256
 	static public function parse_digest($txt)
257 257
 	{
258
-	    // protect against missing data
259
-	    $needed_parts = array('nonce'=>1, 'nc'=>1, 'cnonce'=>1, 'qop'=>1, 'username'=>1, 'uri'=>1, 'response'=>1);
260
-	    $data = array();
261
-	    $keys = implode('|', array_keys($needed_parts));
258
+		// protect against missing data
259
+		$needed_parts = array('nonce'=>1, 'nc'=>1, 'cnonce'=>1, 'qop'=>1, 'username'=>1, 'uri'=>1, 'response'=>1);
260
+		$data = array();
261
+		$keys = implode('|', array_keys($needed_parts));
262 262
 
263 263
 		$matches = null;
264
-	    preg_match_all('@(' . $keys . ')=(?:([\'"])([^\2]+?)\2|([^\s,]+))@', $txt, $matches, PREG_SET_ORDER);
264
+		preg_match_all('@(' . $keys . ')=(?:([\'"])([^\2]+?)\2|([^\s,]+))@', $txt, $matches, PREG_SET_ORDER);
265 265
 
266
-	    foreach ($matches as $m)
267
-	    {
268
-	        $data[$m[1]] = $m[3] ? $m[3] : $m[4];
269
-	        unset($needed_parts[$m[1]]);
270
-	    }
271
-	    //error_log(__METHOD__."('$txt') returning ".array2string($needed_parts ? false : $data));
272
-	    return $needed_parts ? false : $data;
266
+		foreach ($matches as $m)
267
+		{
268
+			$data[$m[1]] = $m[3] ? $m[3] : $m[4];
269
+			unset($needed_parts[$m[1]]);
270
+		}
271
+		//error_log(__METHOD__."('$txt') returning ".array2string($needed_parts ? false : $data));
272
+		return $needed_parts ? false : $data;
273 273
 	}
274 274
 }
Please login to merge, or discard this patch.
Braces   +38 added lines, -10 removed lines patch added patch discarded remove patch
@@ -82,7 +82,10 @@  discard block
 block discarded – undo
82 82
 			error_log(__METHOD__.'() PHP_AUTH_USER='.array2string($_SERVER['PHP_AUTH_USER']).', PHP_AUTH_PW='.array2string($pw).', PHP_AUTH_DIGEST='.array2string($_SERVER['PHP_AUTH_DIGEST']));
83 83
 		}
84 84
 		$realm = $GLOBALS['egw_info']['flags']['auth_realm'];
85
-		if (empty($realm)) $realm = 'EGroupware';
85
+		if (empty($realm))
86
+		{
87
+			$realm = 'EGroupware';
88
+		}
86 89
 
87 90
 		$username = $_SERVER['PHP_AUTH_USER']; $password = $_SERVER['PHP_AUTH_PW'];
88 91
 		// Support for basic auth when using PHP CGI (what about digest auth?)
@@ -139,7 +142,8 @@  discard block
 block discarded – undo
139 142
 			// replace \x encoded non-ascii chars in password, as they are used eg. by Thunderbird for German umlauts
140 143
 			if (strpos($password, '\\x') !== false)
141 144
 			{
142
-				$password = preg_replace_callback('/\\\\x([0-9A-F]{2})/i', function($matches){
145
+				$password = preg_replace_callback('/\\\\x([0-9A-F]{2})/i', function($matches)
146
+				{
143 147
 					return chr(hexdec($matches[1]));
144 148
 				}, $password);
145 149
 			}
@@ -167,7 +171,10 @@  discard block
 block discarded – undo
167 171
 		if (!($GLOBALS['egw_info']['server']['auth_type'] == 'sql' && $GLOBALS['egw_info']['server']['sql_encryption_type'] == 'plain') ||
168 172
 			  $GLOBALS['egw_info']['server']['auth_type'] == 'ldap' && $GLOBALS['egw_info']['server']['ldap_encryption_type'] == 'plain')
169 173
 		{
170
-			if (self::ERROR_LOG) error_log(__METHOD__."('$username') return false (no plaintext passwords used)");
174
+			if (self::ERROR_LOG)
175
+			{
176
+				error_log(__METHOD__."('$username') return false (no plaintext passwords used)");
177
+			}
171 178
 			return false;	// no plain-text passwords used
172 179
 		}
173 180
 		// check for specific user, if given
@@ -175,10 +182,16 @@  discard block
 block discarded – undo
175 182
 			$GLOBALS['egw_info']['server']['auth_type'] == 'sql' && substr($user_pw,0,7) != '{PLAIN}'))
176 183
 		{
177 184
 			unset($user_pw);
178
-			if (self::ERROR_LOG) error_log(__METHOD__."('$realm','$username') return false (unknown user or NO plaintext password for user)");
185
+			if (self::ERROR_LOG)
186
+			{
187
+				error_log(__METHOD__."('$realm','$username') return false (unknown user or NO plaintext password for user)");
188
+			}
179 189
 			return false;	// user does NOT exist, or has no plaintext passwords (ldap server requires real root_dn or special ACL!)
180 190
 		}
181
-		if (substr($user_pw,0,7) == '{PLAIN}') $user_pw = substr($user_pw,7);
191
+		if (substr($user_pw,0,7) == '{PLAIN}')
192
+		{
193
+			$user_pw = substr($user_pw,7);
194
+		}
182 195
 
183 196
 		if (self::ERROR_LOG)
184 197
 		{
@@ -200,7 +213,10 @@  discard block
 block discarded – undo
200 213
 		{
201 214
 			$nonce = uniqid();
202 215
    			header('WWW-Authenticate: Digest realm="'.$realm.'",qop="auth",nonce="'.$nonce.'",opaque="'.md5($realm).'"');
203
-			if (self::ERROR_LOG) error_log(__METHOD__."() offering digest auth for realm '$realm' using nonce='$nonce'");
216
+			if (self::ERROR_LOG)
217
+			{
218
+				error_log(__METHOD__."() offering digest auth for realm '$realm' using nonce='$nonce'");
219
+			}
204 220
 		}
205 221
 	}
206 222
 
@@ -215,7 +231,10 @@  discard block
 block discarded – undo
215 231
 	 */
216 232
 	static public function is_valid($realm,$auth_digest=null,&$username=null,&$password=null)
217 233
 	{
218
-		if (is_null($auth_digest)) $auth_digest = $_SERVER['PHP_AUTH_DIGEST'];
234
+		if (is_null($auth_digest))
235
+		{
236
+			$auth_digest = $_SERVER['PHP_AUTH_DIGEST'];
237
+		}
219 238
 
220 239
 		$data = self::parse_digest($auth_digest);
221 240
 
@@ -228,7 +247,10 @@  discard block
 block discarded – undo
228 247
 
229 248
 		$valid_response = md5($A1.':'.$data['nonce'].':'.$data['nc'].':'.$data['cnonce'].':'.$data['qop'].':'.$A2);
230 249
 
231
-		if (self::ERROR_LOG) error_log(__METHOD__."('$realm','$auth_digest','$username') response='$data[response]', valid_response='$valid_response' returning ".array2string($data['response'] === $valid_response));
250
+		if (self::ERROR_LOG)
251
+		{
252
+			error_log(__METHOD__."('$realm','$auth_digest','$username') response='$data[response]', valid_response='$valid_response' returning ".array2string($data['response'] === $valid_response));
253
+		}
232 254
 		return $data['response'] === $valid_response;
233 255
 	}
234 256
 
@@ -247,10 +269,16 @@  discard block
 block discarded – undo
247 269
 		{
248 270
 			return false;
249 271
 		}
250
-		if (is_null($password)) $password = $user_pw;
272
+		if (is_null($password))
273
+		{
274
+			$password = $user_pw;
275
+		}
251 276
 
252 277
 		$A1 = md5($username . ':' . $realm . ':' . $password);
253
-		if (self::ERROR_LOG > 1) error_log(__METHOD__."('$realm','$username','$password') returning ".array2string($A1));
278
+		if (self::ERROR_LOG > 1)
279
+		{
280
+			error_log(__METHOD__."('$realm','$username','$password') returning ".array2string($A1));
281
+		}
254 282
 		return $A1;
255 283
 	}
256 284
 
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	static public function autocreate_session_callback(&$account)
77 77
 	{
78
-		unset($account);	// not used, but required by function signature
78
+		unset($account); // not used, but required by function signature
79 79
 		if (self::ERROR_LOG)
80 80
 		{
81 81
 			$pw = self::ERROR_LOG > 1 ? $_SERVER['PHP_AUTH_PW'] : '**********';
@@ -86,15 +86,15 @@  discard block
 block discarded – undo
86 86
 
87 87
 		$username = $_SERVER['PHP_AUTH_USER']; $password = $_SERVER['PHP_AUTH_PW'];
88 88
 		// Support for basic auth when using PHP CGI (what about digest auth?)
89
-		if (!isset($username) && !empty($_SERVER['REDIRECT_HTTP_AUTHORIZATION']) && strpos($_SERVER['REDIRECT_HTTP_AUTHORIZATION'],'Basic ') === 0)
89
+		if (!isset($username) && !empty($_SERVER['REDIRECT_HTTP_AUTHORIZATION']) && strpos($_SERVER['REDIRECT_HTTP_AUTHORIZATION'], 'Basic ') === 0)
90 90
 		{
91
-			$hash = base64_decode(substr($_SERVER['REDIRECT_HTTP_AUTHORIZATION'],6));
91
+			$hash = base64_decode(substr($_SERVER['REDIRECT_HTTP_AUTHORIZATION'], 6));
92 92
 			if (strpos($hash, ':') !== false)
93 93
 			{
94 94
 				list($username, $password) = explode(':', $hash, 2);
95 95
 			}
96 96
 		}
97
-		elseif (isset($_SERVER['PHP_AUTH_DIGEST']) && !self::is_valid($realm,$_SERVER['PHP_AUTH_DIGEST'],$username,$password))
97
+		elseif (isset($_SERVER['PHP_AUTH_DIGEST']) && !self::is_valid($realm, $_SERVER['PHP_AUTH_DIGEST'], $username, $password))
98 98
 		{
99 99
 			unset($password);
100 100
 		}
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 			{
116 116
 				$realm .= ': '.$GLOBALS['egw']->session->reason;
117 117
 			}
118
-			header('WWW-Authenticate: Basic realm="'.$realm.'"');// draft-reschke-basicauth-enc-06 adds, accept-charset="'.translation::charset().'"');
118
+			header('WWW-Authenticate: Basic realm="'.$realm.'"'); // draft-reschke-basicauth-enc-06 adds, accept-charset="'.translation::charset().'"');
119 119
 			self::digest_header($realm);
120 120
 			header('HTTP/1.1 401 Unauthorized');
121 121
 			header('X-WebDAV-Status: 401 Unauthorized', true);
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 			// replace \x encoded non-ascii chars in password, as they are used eg. by Thunderbird for German umlauts
140 140
 			if (strpos($password, '\\x') !== false)
141 141
 			{
142
-				$password = preg_replace_callback('/\\\\x([0-9A-F]{2})/i', function($matches){
142
+				$password = preg_replace_callback('/\\\\x([0-9A-F]{2})/i', function($matches) {
143 143
 					return chr(hexdec($matches[1]));
144 144
 				}, $password);
145 145
 			}
@@ -161,24 +161,24 @@  discard block
 block discarded – undo
161 161
 	 * @param string &$user_pw =null stored cleartext password, if $username given AND function returns true
162 162
 	 * @return boolean true if digest auth is available, false otherwise
163 163
 	 */
164
-	static public function digest_auth_available($realm,$username=null,&$user_pw=null)
164
+	static public function digest_auth_available($realm, $username = null, &$user_pw = null)
165 165
 	{
166 166
 		// we currently require plaintext passwords!
167 167
 		if (!($GLOBALS['egw_info']['server']['auth_type'] == 'sql' && $GLOBALS['egw_info']['server']['sql_encryption_type'] == 'plain') ||
168 168
 			  $GLOBALS['egw_info']['server']['auth_type'] == 'ldap' && $GLOBALS['egw_info']['server']['ldap_encryption_type'] == 'plain')
169 169
 		{
170 170
 			if (self::ERROR_LOG) error_log(__METHOD__."('$username') return false (no plaintext passwords used)");
171
-			return false;	// no plain-text passwords used
171
+			return false; // no plain-text passwords used
172 172
 		}
173 173
 		// check for specific user, if given
174
-		if (!is_null($username) && !(($user_pw = $GLOBALS['egw']->accounts->id2name($username,'account_pwd','u')) ||
175
-			$GLOBALS['egw_info']['server']['auth_type'] == 'sql' && substr($user_pw,0,7) != '{PLAIN}'))
174
+		if (!is_null($username) && !(($user_pw = $GLOBALS['egw']->accounts->id2name($username, 'account_pwd', 'u')) ||
175
+			$GLOBALS['egw_info']['server']['auth_type'] == 'sql' && substr($user_pw, 0, 7) != '{PLAIN}'))
176 176
 		{
177 177
 			unset($user_pw);
178 178
 			if (self::ERROR_LOG) error_log(__METHOD__."('$realm','$username') return false (unknown user or NO plaintext password for user)");
179
-			return false;	// user does NOT exist, or has no plaintext passwords (ldap server requires real root_dn or special ACL!)
179
+			return false; // user does NOT exist, or has no plaintext passwords (ldap server requires real root_dn or special ACL!)
180 180
 		}
181
-		if (substr($user_pw,0,7) == '{PLAIN}') $user_pw = substr($user_pw,7);
181
+		if (substr($user_pw, 0, 7) == '{PLAIN}') $user_pw = substr($user_pw, 7);
182 182
 
183 183
 		if (self::ERROR_LOG)
184 184
 		{
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 	 * @param string $realm
195 195
 	 * @param string &$nonce=null on return
196 196
 	 */
197
-	static public function digest_header($realm,&$nonce=null)
197
+	static public function digest_header($realm, &$nonce = null)
198 198
 	{
199 199
 		if (self::digest_auth_available($realm))
200 200
 		{
@@ -213,13 +213,13 @@  discard block
 block discarded – undo
213 213
 	 * @param string &$password on return cleartext password
214 214
 	 * @return boolean true if digest is correct, false otherwise
215 215
 	 */
216
-	static public function is_valid($realm,$auth_digest=null,&$username=null,&$password=null)
216
+	static public function is_valid($realm, $auth_digest = null, &$username = null, &$password = null)
217 217
 	{
218 218
 		if (is_null($auth_digest)) $auth_digest = $_SERVER['PHP_AUTH_DIGEST'];
219 219
 
220 220
 		$data = self::parse_digest($auth_digest);
221 221
 
222
-		if (!$data || !($A1 = self::get_digest_A1($realm,$username=$data['username'],$password=null)))
222
+		if (!$data || !($A1 = self::get_digest_A1($realm, $username = $data['username'], $password = null)))
223 223
 		{
224 224
 			error_log(__METHOD__."('$realm','$auth_digest','$username') returning FALSE");
225 225
 			return false;
@@ -240,16 +240,16 @@  discard block
 block discarded – undo
240 240
 	 * @param string &$password=null password to use or if null, on return stored password
241 241
 	 * @return string|boolean false if $password not given and can NOT be read
242 242
 	 */
243
-	static private function get_digest_A1($realm,$username,&$password=null)
243
+	static private function get_digest_A1($realm, $username, &$password = null)
244 244
 	{
245 245
 		$user_pw = null;
246
-		if (empty($username) || empty($realm) || !self::digest_auth_available($realm,$username,$user_pw))
246
+		if (empty($username) || empty($realm) || !self::digest_auth_available($realm, $username, $user_pw))
247 247
 		{
248 248
 			return false;
249 249
 		}
250 250
 		if (is_null($password)) $password = $user_pw;
251 251
 
252
-		$A1 = md5($username . ':' . $realm . ':' . $password);
252
+		$A1 = md5($username.':'.$realm.':'.$password);
253 253
 		if (self::ERROR_LOG > 1) error_log(__METHOD__."('$realm','$username','$password') returning ".array2string($A1));
254 254
 		return $A1;
255 255
 	}
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 	    $keys = implode('|', array_keys($needed_parts));
266 266
 
267 267
 		$matches = null;
268
-	    preg_match_all('@(' . $keys . ')=(?:([\'"])([^\2]+?)\2|([^\s,]+))@', $txt, $matches, PREG_SET_ORDER);
268
+	    preg_match_all('@('.$keys.')=(?:([\'"])([^\2]+?)\2|([^\s,]+))@', $txt, $matches, PREG_SET_ORDER);
269 269
 
270 270
 	    foreach ($matches as $m)
271 271
 	    {
Please login to merge, or discard this patch.
api/src/Header/ContentSecurityPolicy.php 3 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,6 @@
 block discarded – undo
41 41
 	 *
42 42
 	 * Calling this method with an empty array for frame-src, sets no defaults but "'self'"!
43 43
 	 *
44
-	 * @param string|array $set =array() URL (incl. protocol!)
45 44
 	 * @param string $source valid CSP source types like 'script-src', 'style-src', 'connect-src', 'frame-src', ...
46 45
 	 * @param string|array $attrs 'unsafe-eval' and/or 'unsafe-inline' (without quotes!) or URL (incl. protocol!)
47 46
 	 */
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 		'script-src'  => array("'unsafe-eval'"),
34 34
 		'style-src'   => array("'unsafe-inline'"),
35 35
 		'connect-src' => array(),
36
-		'frame-src'   => null,	// NOT array(), to allow setting no default frame-src!
36
+		'frame-src'   => null, // NOT array(), to allow setting no default frame-src!
37 37
 	);
38 38
 
39 39
 	/**
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 				$attrs = array('www.egroupware.org');
56 56
 				if (($app_additional = Api\Hooks::process('csp-frame-src')))
57 57
 				{
58
-					foreach($app_additional as $addtional)
58
+					foreach ($app_additional as $addtional)
59 59
 					{
60 60
 						if ($addtional) $attrs = array_unique(array_merge($attrs, $addtional));
61 61
 					}
@@ -63,11 +63,11 @@  discard block
 block discarded – undo
63 63
 			}
64 64
 			self::$sources[$source] = array();
65 65
 		}
66
-		foreach((array)$attrs as $attr)
66
+		foreach ((array)$attrs as $attr)
67 67
 		{
68 68
 			if (in_array($attr, array('none', 'self', 'unsafe-eval', 'unsafe-inline')))
69 69
 			{
70
-				$attr = "'$attr'";	// automatic add quotes
70
+				$attr = "'$attr'"; // automatic add quotes
71 71
 			}
72 72
 			if (!in_array($attr, self::$sources[$source]))
73 73
 			{
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	 *
89 89
 	 * @param string|array $set =array() 'unsafe-eval' and/or 'unsafe-inline' (without quotes!) or URL (incl. protocol!)
90 90
 	 */
91
-	public static function add_script_src($set=null)
91
+	public static function add_script_src($set = null)
92 92
 	{
93 93
 		self::add('script-src', $set);
94 94
 	}
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 *
101 101
 	 * @param string|array $set =array() 'unsafe-inline' (without quotes!) and/or URL (incl. protocol!)
102 102
 	 */
103
-	public static function add_style_src($set=null)
103
+	public static function add_style_src($set = null)
104 104
 	{
105 105
 		self::add('style-src', $set);
106 106
 	}
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	 *
111 111
 	 * @param string|array $set =array() URL (incl. protocol!)
112 112
 	 */
113
-	public static function add_connect_src($set=null)
113
+	public static function add_connect_src($set = null)
114 114
 	{
115 115
 		self::add('connect-src', $set);
116 116
 	}
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 	 * @param string|array $set =array() URL (incl. protocol!)
124 124
 	 * @return string with attributes eg. "'unsafe-inline'"
125 125
 	 */
126
-	public static function add_frame_src($set=null)
126
+	public static function add_frame_src($set = null)
127 127
 	{
128 128
 		self::add('frame-src', $set);
129 129
 	}
@@ -135,10 +135,10 @@  discard block
 block discarded – undo
135 135
 	 */
136 136
 	public static function send()
137 137
 	{
138
-		self::add('frame-src', null);	// set defaults for frame-src
138
+		self::add('frame-src', null); // set defaults for frame-src
139 139
 
140 140
 		$policies = array();
141
-		foreach(self::$sources as $source => $urls)
141
+		foreach (self::$sources as $source => $urls)
142 142
 		{
143 143
 			$policies[] = "$source 'self' ".implode(' ', $urls);
144 144
 		}
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 		// recommendaton ist to not send regular AND deprecated headers together, as they can cause unexpected behavior
153 153
 		if ($user_agent == 'chrome' && $version < 25 || $user_agent == 'safari' && $version < 7)
154 154
 		{
155
-			header("X-Webkit-CSP: $csp");	// Chrome: <= 24, Safari incl. iOS
155
+			header("X-Webkit-CSP: $csp"); // Chrome: <= 24, Safari incl. iOS
156 156
 		}
157 157
 		elseif ($user_agent == 'firefox' && $version < 23 || $user_agent == 'msie')	// Edge is reported as 'edge'!
158 158
 		{
Please login to merge, or discard this patch.
Braces   +8 added lines, -2 removed lines patch added patch discarded remove patch
@@ -57,7 +57,10 @@  discard block
 block discarded – undo
57 57
 				{
58 58
 					foreach($app_additional as $addtional)
59 59
 					{
60
-						if ($addtional) $attrs = array_unique(array_merge($attrs, $addtional));
60
+						if ($addtional)
61
+						{
62
+							$attrs = array_unique(array_merge($attrs, $addtional));
63
+						}
61 64
 					}
62 65
 				}
63 66
 			}
@@ -154,10 +157,13 @@  discard block
 block discarded – undo
154 157
 		{
155 158
 			header("X-Webkit-CSP: $csp");	// Chrome: <= 24, Safari incl. iOS
156 159
 		}
157
-		elseif ($user_agent == 'firefox' && $version < 23 || $user_agent == 'msie')	// Edge is reported as 'edge'!
160
+		elseif ($user_agent == 'firefox' && $version < 23 || $user_agent == 'msie')
161
+		{
162
+			// Edge is reported as 'edge'!
158 163
 		{
159 164
 			header("X-Content-Security-Policy: $csp");
160 165
 		}
166
+		}
161 167
 		else
162 168
 		{
163 169
 			header("Content-Security-Policy: $csp");
Please login to merge, or discard this patch.
api/src/Hooks.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -254,7 +254,7 @@
 block discarded – undo
254 254
 
255 255
 	/**
256 256
 	 * Static function to build pgp encryption sidebox menu
257
-	 * @param type $appname application name
257
+	 * @param string $appname application name
258 258
 	 */
259 259
 	public static function pgp_encryption_menu($appname)
260 260
 	{
Please login to merge, or discard this patch.
Spacing   +15 added lines, -16 removed lines patch added patch discarded remove patch
@@ -64,22 +64,22 @@  discard block
 block discarded – undo
64 64
 
65 65
 		if (!isset(self::$locations)) self::read();
66 66
 		$hooks = self::$locations[$location];
67
-		if (!isset($hooks) || empty($hooks)) return array();	// not a single app implements that hook
67
+		if (!isset($hooks) || empty($hooks)) return array(); // not a single app implements that hook
68 68
 
69 69
 		$apps = array_keys($hooks);
70 70
 		if (!$no_permission_check)
71 71
 		{
72 72
 			// on install of a new egroupware both hook-apps and user apps may be empty/not set
73
-			$apps = array_intersect((array)$apps,array_keys((array)$GLOBALS['egw_info']['user']['apps']));
73
+			$apps = array_intersect((array)$apps, array_keys((array)$GLOBALS['egw_info']['user']['apps']));
74 74
 		}
75 75
 		if ($order)
76 76
 		{
77
-			$apps = array_unique(array_merge((array)$order,$apps));
77
+			$apps = array_unique(array_merge((array)$order, $apps));
78 78
 		}
79 79
 		$results = array();
80
-		foreach((array)$apps as $appname)
80
+		foreach ((array)$apps as $appname)
81 81
 		{
82
-			$results[$appname] = self::single($args,$appname,$no_permission_check);
82
+			$results[$appname] = self::single($args, $appname, $no_permission_check);
83 83
 		}
84 84
 		return $results;
85 85
 	}
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 		}
116 116
 
117 117
 		$ret = array();
118
-		foreach((array)self::$locations[$location][$appname] as $hook)
118
+		foreach ((array)self::$locations[$location][$appname] as $hook)
119 119
 		{
120 120
 			try {
121 121
 				// old style file hook
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 		}
158 158
 
159 159
 		// hooks only existing in filesystem used by setup
160
-		if (!$ret && $try_unregistered && file_exists(EGW_SERVER_ROOT.($hook='/'.$appname.'/inc/hook_'.$location.'.inc.php')))
160
+		if (!$ret && $try_unregistered && file_exists(EGW_SERVER_ROOT.($hook = '/'.$appname.'/inc/hook_'.$location.'.inc.php')))
161 161
 		{
162 162
 			include(EGW_SERVER_ROOT.$hook);
163 163
 			return true;
@@ -189,13 +189,12 @@  discard block
 block discarded – undo
189 189
 	 * @param boolean $return_methods =false true: return hook-method(s)
190 190
 	 * @return int|array the number of found hooks or for $return_methods array with methods
191 191
 	 */
192
-	public static function exists($location, $app, $return_methods=false)
192
+	public static function exists($location, $app, $return_methods = false)
193 193
 	{
194 194
 		if (!isset(self::$locations)) self::read();
195 195
 
196 196
 		//error_log(__METHOD__.__LINE__.array2string(self::$locations[$location]));
197
-		return $return_methods ? self::$locations[$location][$app] :
198
-			(empty(self::$locations[$location][$app]) ? 0 : count(self::$locations[$location][$app]));
197
+		return $return_methods ? self::$locations[$location][$app] : (empty(self::$locations[$location][$app]) ? 0 : count(self::$locations[$location][$app]));
199 198
 	}
200 199
 
201 200
 	/**
@@ -234,7 +233,7 @@  discard block
 block discarded – undo
234 233
 	 *
235 234
 	 * @param boolan $force_rescan =false true: do not use instance cache
236 235
 	 */
237
-	public static function read($force_rescan=false)
236
+	public static function read($force_rescan = false)
238 237
 	{
239 238
 		//$starttime = microtime(true);
240 239
 		if ($force_rescan) Cache::unsetInstance(__CLASS__, 'locations');
@@ -250,18 +249,18 @@  discard block
 block discarded – undo
250 249
 
251 250
 			// read all apps using just filesystem data
252 251
 			$locations = array();
253
-			foreach(array_merge(array('api'), array_keys($GLOBALS['egw_info']['apps'])) as $appname)
252
+			foreach (array_merge(array('api'), array_keys($GLOBALS['egw_info']['apps'])) as $appname)
254 253
 			{
255 254
 				if ($appname[0] == '.' || !is_dir(EGW_SERVER_ROOT.'/'.$appname)) continue;
256 255
 
257
-				$f = EGW_SERVER_ROOT . '/' . $appname . '/setup/setup.inc.php';
256
+				$f = EGW_SERVER_ROOT.'/'.$appname.'/setup/setup.inc.php';
258 257
 				$setup_info = array($appname => array());
259
-				if(@file_exists($f)) include($f);
258
+				if (@file_exists($f)) include($f);
260 259
 
261 260
 				// some apps have setup_info for more then themselfs (eg. api for groupdav)
262
-				foreach($setup_info as $appname => $data)
261
+				foreach ($setup_info as $appname => $data)
263 262
 				{
264
-					foreach((array)$data['hooks'] as $location => $methods)
263
+					foreach ((array)$data['hooks'] as $location => $methods)
265 264
 					{
266 265
 						if (is_int($location))
267 266
 						{
Please login to merge, or discard this patch.
Braces   +57 added lines, -14 removed lines patch added patch discarded remove patch
@@ -62,9 +62,16 @@  discard block
 block discarded – undo
62 62
 		//echo "<p>".__METHOD__.'('.array2string($args).','.array2string($order).','.array2string($no_permission_check).")</p>\n";
63 63
 		$location = is_array($args) ? (isset($args['hook_location']) ? $args['hook_location'] : $args['location']) : $args;
64 64
 
65
-		if (!isset(self::$locations)) self::read();
65
+		if (!isset(self::$locations))
66
+		{
67
+			self::read();
68
+		}
66 69
 		$hooks = self::$locations[$location];
67
-		if (!isset($hooks) || empty($hooks)) return array();	// not a single app implements that hook
70
+		if (!isset($hooks) || empty($hooks))
71
+		{
72
+			return array();
73
+		}
74
+		// not a single app implements that hook
68 75
 
69 76
 		$apps = array_keys($hooks);
70 77
 		if (!$no_permission_check)
@@ -99,9 +106,15 @@  discard block
 block discarded – undo
99 106
 	{
100 107
 		//error_log(__METHOD__."(".array2string($args).",'$appname','$no_permission_check','$try_unregistered')");
101 108
 
102
-		if (!isset(self::$locations)) self::read();
109
+		if (!isset(self::$locations))
110
+		{
111
+			self::read();
112
+		}
103 113
 
104
-		if (!is_array($args)) $args = array('location' => $args);
114
+		if (!is_array($args))
115
+		{
116
+			$args = array('location' => $args);
117
+		}
105 118
 		$location = isset($args['hook_location']) ? $args['hook_location'] : $args['location'];
106 119
 
107 120
 		if (!$appname)
@@ -135,7 +148,10 @@  discard block
 block discarded – undo
135 148
 				// static method of an autoloadable class
136 149
 				if (isset($method) && class_exists($class))
137 150
 				{
138
-					if (is_callable($hook)) $ret[] = call_user_func($hook, $args);
151
+					if (is_callable($hook))
152
+					{
153
+						$ret[] = call_user_func($hook, $args);
154
+					}
139 155
 				}
140 156
 				// app.class.method or not autoloadable class
141 157
 				else
@@ -163,7 +179,10 @@  discard block
 block discarded – undo
163 179
 			return true;
164 180
 		}
165 181
 
166
-		if (!$ret) return false;
182
+		if (!$ret)
183
+		{
184
+			return false;
185
+		}
167 186
 
168 187
 		return count($ret) == 1 ? $ret[0] : $ret;
169 188
 	}
@@ -176,7 +195,10 @@  discard block
 block discarded – undo
176 195
 	 */
177 196
 	public static function count($location)
178 197
 	{
179
-		if (!isset(self::$locations)) self::read();
198
+		if (!isset(self::$locations))
199
+		{
200
+			self::read();
201
+		}
180 202
 
181 203
 		return count(self::$locations[$location]);
182 204
 	}
@@ -191,7 +213,10 @@  discard block
 block discarded – undo
191 213
 	 */
192 214
 	public static function exists($location, $app, $return_methods=false)
193 215
 	{
194
-		if (!isset(self::$locations)) self::read();
216
+		if (!isset(self::$locations))
217
+		{
218
+			self::read();
219
+		}
195 220
 
196 221
 		//error_log(__METHOD__.__LINE__.array2string(self::$locations[$location]));
197 222
 		return $return_methods ? self::$locations[$location][$app] :
@@ -206,7 +231,10 @@  discard block
 block discarded – undo
206 231
 	 */
207 232
 	public static function implemented($location)
208 233
 	{
209
-		if (!isset(self::$locations)) self::read();
234
+		if (!isset(self::$locations))
235
+		{
236
+			self::read();
237
+		}
210 238
 
211 239
 		//error_log(__METHOD__.__LINE__.array2string(self::$locations[$location]));
212 240
 		return isset(self::$locations[$location]) ? array_keys(self::$locations[$location]) : array();
@@ -220,7 +248,10 @@  discard block
 block discarded – undo
220 248
 	 */
221 249
 	static public function disable($hook)
222 250
 	{
223
-		if (!isset(self::$locations)) self::read();
251
+		if (!isset(self::$locations))
252
+		{
253
+			self::read();
254
+		}
224 255
 
225 256
 		$ret = isset(self::$locations[$hook]);
226 257
 
@@ -237,7 +268,10 @@  discard block
 block discarded – undo
237 268
 	public static function read($force_rescan=false)
238 269
 	{
239 270
 		//$starttime = microtime(true);
240
-		if ($force_rescan) Cache::unsetInstance(__CLASS__, 'locations');
271
+		if ($force_rescan)
272
+		{
273
+			Cache::unsetInstance(__CLASS__, 'locations');
274
+		}
241 275
 
242 276
 		self::$locations = Cache::getInstance(__CLASS__, 'locations', function()
243 277
 		{
@@ -252,11 +286,17 @@  discard block
 block discarded – undo
252 286
 			$locations = array();
253 287
 			foreach(array_merge(array('api'), array_keys($GLOBALS['egw_info']['apps'])) as $appname)
254 288
 			{
255
-				if ($appname[0] == '.' || !is_dir(EGW_SERVER_ROOT.'/'.$appname)) continue;
289
+				if ($appname[0] == '.' || !is_dir(EGW_SERVER_ROOT.'/'.$appname))
290
+				{
291
+					continue;
292
+				}
256 293
 
257 294
 				$f = EGW_SERVER_ROOT . '/' . $appname . '/setup/setup.inc.php';
258 295
 				$setup_info = array($appname => array());
259
-				if(@file_exists($f)) include($f);
296
+				if(@file_exists($f))
297
+				{
298
+					include($f);
299
+				}
260 300
 
261 301
 				// some apps have setup_info for more then themselfs (eg. api for groupdav)
262 302
 				foreach($setup_info as $appname => $data)
@@ -284,7 +324,10 @@  discard block
 block discarded – undo
284 324
 	 */
285 325
 	public static function pgp_encryption_menu($appname)
286 326
 	{
287
-		if (Header\UserAgent::mobile() || $GLOBALS['egw_info']['server']['disable_pgp_encryption']) return;
327
+		if (Header\UserAgent::mobile() || $GLOBALS['egw_info']['server']['disable_pgp_encryption'])
328
+		{
329
+			return;
330
+		}
288 331
 
289 332
 		// PGP Encryption (Mailvelope plugin) restore/backup menu
290 333
 		$file = Array(
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -287,7 +287,7 @@
 block discarded – undo
287 287
 		if (Header\UserAgent::mobile() || $GLOBALS['egw_info']['server']['disable_pgp_encryption']) return;
288 288
 
289 289
 		// PGP Encryption (Mailvelope plugin) restore/backup menu
290
-		$file = Array(
290
+		$file = array(
291 291
 			'Backup/Restore ...' => 'javascript:app.'.$appname.'.mailvelopeCreateBackupRestoreDialog();',
292 292
 			'sendToBottom' => true
293 293
 		);
Please login to merge, or discard this patch.
api/src/Html.php 4 patches
Doc Comments   +3 added lines, -5 removed lines patch added patch discarded remove patch
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	 *
140 140
 	 * @param string $name	string with name of the submitted var which holds the key of the selected item form array
141 141
 	 * @param string|array $key key(s) of already selected item(s) from $arr, eg. '1' or '1,2' or array with keys
142
-	 * @param array $arr array with items to select, eg. $arr = array ( 'y' => 'yes','n' => 'no','m' => 'maybe');
142
+	 * @param integer $arr array with items to select, eg. $arr = array ( 'y' => 'yes','n' => 'no','m' => 'maybe');
143 143
 	 * @param boolean $no_lang NOT run the labels of the options through lang(), default false=use lang()
144 144
 	 * @param string $options additional options (e.g. 'width')
145 145
 	 * @param int $multiple number of lines for a multiselect, default 0 = no multiselect, < 0 sets size without multiple
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 	 *
228 228
 	 * @param string $name	string with name of the submitted var which holds the key of the selected item form array
229 229
 	 * @param string|array $key key(s) of already selected item(s) from $arr, eg. '1' or '1,2' or array with keys
230
-	 * @param array $arr array with items to select, eg. $arr = array ( 'y' => 'yes','n' => 'no','m' => 'maybe');
230
+	 * @param integer $arr array with items to select, eg. $arr = array ( 'y' => 'yes','n' => 'no','m' => 'maybe');
231 231
 	 * @param boolean $no_lang NOT run the labels of the options through lang(), default false=use lang()
232 232
 	 * @param string $options additional options (e.g. 'width')
233 233
 	 * @param int $multiple number of lines for a multiselect, default 3
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 	 * @param string $value value
314 314
 	 * @param string $label label
315 315
 	 * @param mixed $selected value or array of values of options to mark as selected
316
-	 * @param boolean $no_lang NOT running the label through lang(), default false=use lang()
316
+	 * @param integer $no_lang NOT running the label through lang(), default false=use lang()
317 317
 	 * @param string $extra extra text, e.g.: style="", default: ''
318 318
 	 * @return string html
319 319
 	 */
@@ -386,7 +386,6 @@  discard block
 block discarded – undo
386 386
 	 *
387 387
 	 * @param string $name name attr. of the tag
388 388
 	 * @param string $value default
389
-	 * @param boolean $ignore_empty if true all empty, zero (!) or unset values, plus filer=none
390 389
 	 * @param boolean $double_encoding =false do we want double encoding or not, default no
391 390
 	 * @param string html
392 391
 	 */
@@ -741,7 +740,6 @@  discard block
 block discarded – undo
741 740
 	 * @param array $hidden_vars array with name-value pairs for hidden input fields
742 741
 	 * @param string $url eGW relative URL, will be run through the link function
743 742
 	 * @param string|array $url_vars parameters for the URL, send to link static function too
744
-	 * @param string $options attributes for the tag, default ''=none
745 743
 	 * @param string $form_name name of the form, defaul ''=none
746 744
 	 * @param string $method method of the form, default 'POST'
747 745
 	 * @return string html
Please login to merge, or discard this patch.
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -425,20 +425,20 @@  discard block
 block discarded – undo
425 425
 	}
426 426
 
427 427
 	/**
428
-	* this static function is a wrapper for fckEditor to create some reuseable layouts
429
-	*
430
-	* @param string $_name name and id of the input-field
431
-	* @param string $_content of the tinymce (will be run through htmlspecialchars !!!), default ''
432
-	* @param string $_mode display mode of the tinymce editor can be: simple, extended or advanced
433
-	* @param array  $_options (toolbar_expanded true/false)
434
-	* @param string $_height ='400px'
435
-	* @param string $_width ='100%'
436
-	* @param string $_start_path ='' if passed activates the browser for image at absolute path passed
437
-	* @param boolean $_purify =true run $_content through htmlpurifier before handing it to fckEditor
438
-	* @param mixed (boolean/string) $_focusToBody=false USED only for CKEDIOR true means yes, focus on top, you may specify TOP or BOTTOM (to focus on the end of the editor area)
439
-	* @param string $_executeJSAfterInit ='' Javascript to be executed after InstanceReady of CKEditor
440
-	* @return string the necessary html for the textarea
441
-	*/
428
+	 * this static function is a wrapper for fckEditor to create some reuseable layouts
429
+	 *
430
+	 * @param string $_name name and id of the input-field
431
+	 * @param string $_content of the tinymce (will be run through htmlspecialchars !!!), default ''
432
+	 * @param string $_mode display mode of the tinymce editor can be: simple, extended or advanced
433
+	 * @param array  $_options (toolbar_expanded true/false)
434
+	 * @param string $_height ='400px'
435
+	 * @param string $_width ='100%'
436
+	 * @param string $_start_path ='' if passed activates the browser for image at absolute path passed
437
+	 * @param boolean $_purify =true run $_content through htmlpurifier before handing it to fckEditor
438
+	 * @param mixed (boolean/string) $_focusToBody=false USED only for CKEDIOR true means yes, focus on top, you may specify TOP or BOTTOM (to focus on the end of the editor area)
439
+	 * @param string $_executeJSAfterInit ='' Javascript to be executed after InstanceReady of CKEditor
440
+	 * @return string the necessary html for the textarea
441
+	 */
442 442
 	static function fckEditor($_name, $_content, $_mode, $_options=array('toolbar_expanded' =>'true'),
443 443
 		$_height='400px', $_width='100%',$_start_path='',$_purify=true, $_focusToBody=false, $_executeJSAfterInit='')
444 444
 	{
@@ -509,21 +509,21 @@  discard block
 block discarded – undo
509 509
 	}
510 510
 
511 511
 	/**
512
-	* this static function is a wrapper for tinymce to create some reuseable layouts
513
-	*
514
-	* Please note: if you did not run init_tinymce already you this static function need to be called before the call to phpgw_header() !!!
515
-	*
516
-	* @param string $_name name and id of the input-field
517
-	* @param string $_mode display mode of the tinymce editor can be: simple, extended or advanced
518
-	* @param string $_content ='' of the tinymce (will be run through htmlspecialchars !!!), default ''
519
-	* @param string $_height ='400px'
520
-	* @param string $_width ='100%'
521
-	* @param boolean $_purify =true
522
-	* @param string $_border ='0px' NOT used for CKEditor
523
-	* @param mixed (boolean/string) $_focusToBody=false USED only for CKEDIOR true means yes, focus on top, you may specify TOP or BOTTOM (to focus on the end of the editor area)
524
-	* @param string $_executeJSAfterInit ='' Javascript to be executed after InstanceReady of CKEditor
525
-	* @return string the necessary html for the textarea
526
-	*/
512
+	 * this static function is a wrapper for tinymce to create some reuseable layouts
513
+	 *
514
+	 * Please note: if you did not run init_tinymce already you this static function need to be called before the call to phpgw_header() !!!
515
+	 *
516
+	 * @param string $_name name and id of the input-field
517
+	 * @param string $_mode display mode of the tinymce editor can be: simple, extended or advanced
518
+	 * @param string $_content ='' of the tinymce (will be run through htmlspecialchars !!!), default ''
519
+	 * @param string $_height ='400px'
520
+	 * @param string $_width ='100%'
521
+	 * @param boolean $_purify =true
522
+	 * @param string $_border ='0px' NOT used for CKEditor
523
+	 * @param mixed (boolean/string) $_focusToBody=false USED only for CKEDIOR true means yes, focus on top, you may specify TOP or BOTTOM (to focus on the end of the editor area)
524
+	 * @param string $_executeJSAfterInit ='' Javascript to be executed after InstanceReady of CKEditor
525
+	 * @return string the necessary html for the textarea
526
+	 */
527 527
 	static function fckEditorQuick($_name, $_mode, $_content='', $_height='400px', $_width='100%',$_purify=true, $_border='0px',$_focusToBody=false,$_executeJSAfterInit='')
528 528
 	{
529 529
 		if (!self::htmlarea_availible() || $_mode == 'ascii')
Please login to merge, or discard this patch.
Spacing   +178 added lines, -178 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 */
35 35
 	static function activate_links($content)
36 36
 	{
37
-		if (!$content || strlen($content) < 20) return $content;	// performance
37
+		if (!$content || strlen($content) < 20) return $content; // performance
38 38
 
39 39
 		// Exclude everything which is already a link
40 40
 		$NotAnchor = '(?<!"|href=|href\s=\s|href=\s|href\s=)';
@@ -46,73 +46,73 @@  discard block
 block discarded – undo
46 46
 
47 47
 		//  First match things beginning with http:// (or other protocols)
48 48
 		$optBracket0 = '(<|&lt;)';
49
-		$Protocol = '(http:\/\/|(ftp:\/\/|https:\/\/))';	// only http:// gets removed, other protocolls are shown
49
+		$Protocol = '(http:\/\/|(ftp:\/\/|https:\/\/))'; // only http:// gets removed, other protocolls are shown
50 50
 		$Domain = '([\w-]+\.[\w-.]+)';
51 51
 		$Subdir = '([\w\-\.,@?^=%&;:\/~\+#]*[\w\-\@?^=%&\/~\+#])?';
52 52
 		$optBracket = '(>|&gt;)';
53
-		$Expr = '/' .$optBracket0. $NotAnchor . $Protocol . $Domain . $Subdir . $optBracket . '/i';
53
+		$Expr = '/'.$optBracket0.$NotAnchor.$Protocol.$Domain.$Subdir.$optBracket.'/i';
54 54
 		// use preg_replace_callback as we experienced problems with https links
55
-		$result2 = preg_replace_callback($Expr, function ($match)
55
+		$result2 = preg_replace_callback($Expr, function($match)
56 56
 		{
57
-			return $match[1]."<a href=\"".($match[2]&&!$match[3]?$match[2]:'').($match[3]?$match[3]:'').$match[4].$match[5]."\" target=\"_blank\">".$match[4].$match[5]."</a>".$match[6];
57
+			return $match[1]."<a href=\"".($match[2] && !$match[3] ? $match[2] : '').($match[3] ? $match[3] : '').$match[4].$match[5]."\" target=\"_blank\">".$match[4].$match[5]."</a>".$match[6];
58 58
 		}, $result);
59 59
 
60 60
 		if (true)	// hack to keep IDE from complaing about double assignments
61 61
 		{
62 62
 			//  First match things beginning with http:// (or other protocols)
63
-			$Protocol = '(http:\/\/|(ftp:\/\/|https:\/\/))';	// only http:// gets removed, other protocolls are shown
63
+			$Protocol = '(http:\/\/|(ftp:\/\/|https:\/\/))'; // only http:// gets removed, other protocolls are shown
64 64
 			$Domain = '([\w-]+\.[\w-.]+)';
65 65
 			$Subdir = '([\w\-\.,@?^=%&;:\/~\+#]*[\w\-\@?^=%&\/~\+#])?';
66 66
 			$optStuff = '(&quot;|&quot|;)?';
67
-			$Expr = '/' . $NotAnchor . $Protocol . $Domain . $Subdir . $optStuff . '/i';
67
+			$Expr = '/'.$NotAnchor.$Protocol.$Domain.$Subdir.$optStuff.'/i';
68 68
 			// use preg_replace_callback as we experienced problems with https links
69
-			$result3 = preg_replace_callback($Expr, function ($match)
69
+			$result3 = preg_replace_callback($Expr, function($match)
70 70
 			{
71
-				$additionalQuote="";//at the end, ...
71
+				$additionalQuote = ""; //at the end, ...
72 72
 				// only one &quot at the end is found. chance is, it is not belonging to the URL
73
-				if ($match[5]==';' && (strlen($match[4])-6) >=0 && strpos($match[4],'&quot',strlen($match[4])-6)!==false && strpos(substr($match[4],0,strlen($match[4])-6),'&quot')===false)
73
+				if ($match[5] == ';' && (strlen($match[4]) - 6) >= 0 && strpos($match[4], '&quot', strlen($match[4]) - 6) !== false && strpos(substr($match[4], 0, strlen($match[4]) - 6), '&quot') === false)
74 74
 				{
75
-					$match[4] = substr($match[4],0,strpos($match[4],'&quot',strlen($match[4])-6));
75
+					$match[4] = substr($match[4], 0, strpos($match[4], '&quot', strlen($match[4]) - 6));
76 76
 					$additionalQuote = "&quot;";
77 77
 				}
78 78
 				// if there is quoted stuff within the URL then we have at least one more &quot; in match[4], so chance is the last &quot is matched by the one within
79
-				if ($match[5]==';' && (strlen($match[4])-6) >=0 && strpos($match[4],'&quot',strlen($match[4])-6)!==false && strpos(substr($match[4],0,strlen($match[4])-6),'&quot')!==false)
79
+				if ($match[5] == ';' && (strlen($match[4]) - 6) >= 0 && strpos($match[4], '&quot', strlen($match[4]) - 6) !== false && strpos(substr($match[4], 0, strlen($match[4]) - 6), '&quot') !== false)
80 80
 				{
81 81
 					$match[4] .= $match[5];
82 82
 				}
83
-				if ($match[5]==';'&&$match[4]=="&quot")
83
+				if ($match[5] == ';' && $match[4] == "&quot")
84 84
 				{
85
-					$match[4] ='';
85
+					$match[4] = '';
86 86
 					$additionalQuote = "&quot;";
87 87
 				}
88 88
 				//error_log(__METHOD__.__LINE__.array2string($match));
89
-				return "<a href=\"".($match[1]&&!$match[2]?$match[1]:'').($match[2]?$match[2]:'').$match[3].$match[4]."\" target=\"_blank\">".$match[3].$match[4]."</a>$additionalQuote";
89
+				return "<a href=\"".($match[1] && !$match[2] ? $match[1] : '').($match[2] ? $match[2] : '').$match[3].$match[4]."\" target=\"_blank\">".$match[3].$match[4]."</a>$additionalQuote";
90 90
 			}, $result2);
91 91
 
92 92
 			//  Now match things beginning with www.
93 93
 			$optBracket0 = '(<|&lt;)?';
94
-			$NotHTTP = '(?<!:\/\/|" target=\"_blank\">)';	//	avoid running again on http://www links already handled above
94
+			$NotHTTP = '(?<!:\/\/|" target=\"_blank\">)'; //	avoid running again on http://www links already handled above
95 95
 			$Domain2 = 'www(\.[\w-.]+)';
96 96
 			$Subdir2 = '([\w\-\.,@?^=%&:\/~\+#]*[\w\-\@?^=%&\/~\+#])?';
97 97
 			$optBracket = '(>|&gt;|&gt|;)?';
98
-			$Expr = '/' .$optBracket0. $NotAnchor . $NotHTTP . $Domain2 . $Subdir2 .$optBracket. '/i';
98
+			$Expr = '/'.$optBracket0.$NotAnchor.$NotHTTP.$Domain2.$Subdir2.$optBracket.'/i';
99 99
 			//$Expr = '/' . $NotAnchor . $NotHTTP . $Domain . $Subdir . $optBracket . '/i';
100 100
 			// use preg_replace_callback as we experienced problems with links such as <www.example.tld/pfad/zu/einer/pdf-Datei.pdf>
101
-			$result4 = preg_replace_callback( $Expr, function ($match) {
101
+			$result4 = preg_replace_callback($Expr, function($match) {
102 102
 					//error_log(__METHOD__.__LINE__.array2string($match));
103
-					if ($match[4]==';' && (strlen($match[3])-4) >=0 && strpos($match[3],'&gt',strlen($match[3])-4)!==false)
103
+					if ($match[4] == ';' && (strlen($match[3]) - 4) >= 0 && strpos($match[3], '&gt', strlen($match[3]) - 4) !== false)
104 104
 					{
105
-						$match[3] = substr($match[3],0,strpos($match[3],'&gt',strlen($match[3])-4));
105
+						$match[3] = substr($match[3], 0, strpos($match[3], '&gt', strlen($match[3]) - 4));
106 106
 						$match[4] = "&gt;";
107 107
 					}
108
-					if ($match[4]==';'&&$match[3]=="&gt")
108
+					if ($match[4] == ';' && $match[3] == "&gt")
109 109
 					{
110
-						$match[3] ='';
110
+						$match[3] = '';
111 111
 						$match[4] = "&gt;";
112 112
 					}
113 113
 					//error_log(__METHOD__.__LINE__.array2string($match));
114 114
 					return $match[1]."<a href=\"http://www".$match[2].$match[3]."\" target=\"_blank\">"."www".$match[2].$match[3]."</a>".$match[4];
115
-				}, $result3 );
115
+				}, $result3);
116 116
 		}
117 117
 		return $result4;
118 118
 	}
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
 	 * @param boolean $double_encoding =false do we want double encoding or not, default no
130 130
 	 * @return string
131 131
 	 */
132
-	static function htmlspecialchars($str, $double_encoding=false)
132
+	static function htmlspecialchars($str, $double_encoding = false)
133 133
 	{
134
-		return htmlspecialchars($str,ENT_COMPAT,Translation::charset(),$double_encoding);
134
+		return htmlspecialchars($str, ENT_COMPAT, Translation::charset(), $double_encoding);
135 135
 	}
136 136
 
137 137
 	/**
@@ -146,36 +146,36 @@  discard block
 block discarded – undo
146 146
 	 * @param boolean $enhanced Use enhanced selectbox with search.  Null for default yes if more than 12 options.
147 147
 	 * @return string to set for a template or to echo into html page
148 148
 	 */
149
-	static function select($name, $key, $arr=0,$no_lang=false,$options='',$multiple=0,$enhanced=null)
149
+	static function select($name, $key, $arr = 0, $no_lang = false, $options = '', $multiple = 0, $enhanced = null)
150 150
 	{
151
-		if(is_null($enhanced)) $enhanced = false;	//disabled by default (count($arr) > self::SELECT_ENHANCED_ROW_COUNT);
151
+		if (is_null($enhanced)) $enhanced = false; //disabled by default (count($arr) > self::SELECT_ENHANCED_ROW_COUNT);
152 152
 
153 153
 		if (!is_array($arr))
154 154
 		{
155
-			$arr = array('no','yes');
155
+			$arr = array('no', 'yes');
156 156
 		}
157 157
 		if ((int)$multiple > 0)
158 158
 		{
159 159
 			$options .= ' multiple="1" size="'.(int)$multiple.'"';
160
-			if (substr($name,-2) != '[]')
160
+			if (substr($name, -2) != '[]')
161 161
 			{
162 162
 				$name .= '[]';
163 163
 			}
164 164
 		}
165
-		elseif($multiple < 0)
165
+		elseif ($multiple < 0)
166 166
 		{
167 167
 			$options .= ' size="'.abs($multiple).'"';
168 168
 		}
169 169
 		// fix width for MSIE < 9 in/for selectboxes
170 170
 		if (Header\UserAgent::type() == 'msie' && Header\UserAgent::version() < 9)
171 171
 		{
172
-			if (stripos($options,'onfocus="') === false)
172
+			if (stripos($options, 'onfocus="') === false)
173 173
 			{
174 174
 				$options .= ' onfocus="window.dropdown_menu_hack(this);" ';
175 175
 			}
176 176
 			else
177 177
 			{
178
-				$options = str_ireplace('onfocus="','onfocus="window.dropdown_menu_hack(this);',$options);
178
+				$options = str_ireplace('onfocus="', 'onfocus="window.dropdown_menu_hack(this);', $options);
179 179
 			}
180 180
 		}
181 181
 		$out = "<select name=\"$name\" $options>\n";
@@ -183,14 +183,14 @@  discard block
 block discarded – undo
183 183
 		if (!is_array($key))
184 184
 		{
185 185
 			// explode on ',' only if multiple values expected and the key contains just numbers and commas
186
-			$key = $multiple > 0 && preg_match('/^[,0-9]+$/',$key) ? explode(',',$key) : array($key);
186
+			$key = $multiple > 0 && preg_match('/^[,0-9]+$/', $key) ? explode(',', $key) : array($key);
187 187
 		}
188
-		foreach($arr as $k => $data)
188
+		foreach ($arr as $k => $data)
189 189
 		{
190 190
 			if (!is_array($data) || count($data) == 2 && isset($data['label']) && isset($data['title']))
191 191
 			{
192
-				$out .= self::select_option($k,is_array($data)?$data['label']:$data,$key,$no_lang,
193
-					is_array($data)?$data['title']:'');
192
+				$out .= self::select_option($k, is_array($data) ? $data['label'] : $data, $key, $no_lang,
193
+					is_array($data) ? $data['title'] : '');
194 194
 			}
195 195
 			else
196 196
 			{
@@ -201,19 +201,19 @@  discard block
 block discarded – undo
201 201
 				}
202 202
 				$out .= '<optgroup label="'.self::htmlspecialchars($no_lang || $k == '' ? $k : lang($k))."\">\n";
203 203
 
204
-				foreach($data as $k => $label)
204
+				foreach ($data as $k => $label)
205 205
 				{
206
-					$out .= self::select_option($k,is_array($label)?$label['label']:$label,$key,$no_lang,
207
-						is_array($label)?$label['title']:'');
206
+					$out .= self::select_option($k, is_array($label) ? $label['label'] : $label, $key, $no_lang,
207
+						is_array($label) ? $label['title'] : '');
208 208
 				}
209 209
 				$out .= "</optgroup>\n";
210 210
 			}
211 211
 		}
212 212
 		$out .= "</select>\n";
213 213
 
214
-		if($enhanced) {
214
+		if ($enhanced) {
215 215
 			Framework::includeJS('/api/js/jquery/chosen/chosen.jquery.js');
216
-			Framework::includeCSS('/api/js/jquery/chosen/chosen.css',null,false);
216
+			Framework::includeCSS('/api/js/jquery/chosen/chosen.css', null, false);
217 217
 			$out .= "<script>var lab = egw_LAB || \$LAB; lab.wait(function() {jQuery(function() {if(jQuery().chosen) jQuery('select[name=\"$name\"]').chosen({width: '100%'});});})</script>\n";
218 218
 		}
219 219
 		return $out;
@@ -235,39 +235,39 @@  discard block
 block discarded – undo
235 235
 	 * @param string $style ='' extra style settings like "width: 100%", default '' none
236 236
 	 * @return string to set for a template or to echo into html page
237 237
 	 */
238
-	static function checkbox_multiselect($name, $key, $arr=0,$no_lang=false,$options='',$multiple=3,$selected_first=true,$style='',$enhanced = null)
238
+	static function checkbox_multiselect($name, $key, $arr = 0, $no_lang = false, $options = '', $multiple = 3, $selected_first = true, $style = '', $enhanced = null)
239 239
 	{
240 240
 		//echo "<p align=right>checkbox_multiselect('$name',".array2string($key).",".array2string($arr).",$no_lang,'$options',$multiple,$selected_first,'$style')</p>\n";
241
-		if(is_null($enhanced)) $enhanced = (count($arr) > self::SELECT_ENHANCED_ROW_COUNT);
241
+		if (is_null($enhanced)) $enhanced = (count($arr) > self::SELECT_ENHANCED_ROW_COUNT);
242 242
 
243 243
 		if (!is_array($arr))
244 244
 		{
245
-			$arr = array('no','yes');
245
+			$arr = array('no', 'yes');
246 246
 		}
247 247
 		if ((int)$multiple <= 0) $multiple = 1;
248 248
 
249
-		if (substr($name,-2) != '[]')
249
+		if (substr($name, -2) != '[]')
250 250
 		{
251 251
 			$name .= '[]';
252 252
 		}
253
-		$base_name = substr($name,0,-2);
253
+		$base_name = substr($name, 0, -2);
254 254
 
255
-		if($enhanced) return self::select($name, $key, $arr,$no_lang,$options." style=\"$style\" ",$multiple,$enhanced);
255
+		if ($enhanced) return self::select($name, $key, $arr, $no_lang, $options." style=\"$style\" ", $multiple, $enhanced);
256 256
 
257 257
 		if (!is_array($key))
258 258
 		{
259 259
 			// explode on ',' only if multiple values expected and the key contains just numbers and commas
260
-			$key = preg_match('/^[,0-9]+$/',$key) ? explode(',',$key) : array($key);
260
+			$key = preg_match('/^[,0-9]+$/', $key) ? explode(',', $key) : array($key);
261 261
 		}
262 262
 		$html = '';
263
-		$options_no_id = preg_replace('/id="[^"]+"/i','',$options);
263
+		$options_no_id = preg_replace('/id="[^"]+"/i', '', $options);
264 264
 
265 265
 		if ($selected_first)
266 266
 		{
267 267
 			$selected = $not_selected = array();
268
-			foreach($arr as $val => $label)
268
+			foreach ($arr as $val => $label)
269 269
 			{
270
-				if (in_array((string)$val,$key))
270
+				if (in_array((string)$val, $key))
271 271
 				{
272 272
 					$selected[$val] = $label;
273 273
 				}
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 			$arr = $selected + $not_selected;
280 280
 		}
281 281
 		$max_len = 0;
282
-		foreach($arr as $val => $label)
282
+		foreach ($arr as $val => $label)
283 283
 		{
284 284
 			if (is_array($label))
285 285
 			{
@@ -295,16 +295,16 @@  discard block
 block discarded – undo
295 295
 
296 296
 			if (strlen($label) > $max_len) $max_len = strlen($label);
297 297
 
298
-			$html .= self::label(self::checkbox($name,in_array((string)$val,$key),$val,$options_no_id.
298
+			$html .= self::label(self::checkbox($name, in_array((string)$val, $key), $val, $options_no_id.
299 299
 				' id="'.$base_name.'['.$val.']'.'"').self::htmlspecialchars($label),
300
-				$base_name.'['.$val.']','',($title ? 'title="'.self::htmlspecialchars($title).'" ':''))."<br />\n";
300
+				$base_name.'['.$val.']', '', ($title ? 'title="'.self::htmlspecialchars($title).'" ' : ''))."<br />\n";
301 301
 		}
302
-		if ($style && substr($style,-1) != ';') $style .= '; ';
303
-		if (strpos($style,'height')===false) $style .= 'height: '.(1.7*$multiple).'em; ';
304
-		if (strpos($style,'width')===false)  $style .= 'width: '.(4+$max_len*($max_len < 15 ? 0.65 : 0.6)).'em; ';
302
+		if ($style && substr($style, -1) != ';') $style .= '; ';
303
+		if (strpos($style, 'height') === false) $style .= 'height: '.(1.7 * $multiple).'em; ';
304
+		if (strpos($style, 'width') === false)  $style .= 'width: '.(4 + $max_len * ($max_len < 15 ? 0.65 : 0.6)).'em; ';
305 305
 		$style .= 'background-color: white; overflow: auto; border: lightgray 2px inset; text-align: left;';
306 306
 
307
-		return self::div($html,$options,'',$style);
307
+		return self::div($html, $options, '', $style);
308 308
 	}
309 309
 
310 310
 	/**
@@ -317,23 +317,23 @@  discard block
 block discarded – undo
317 317
 	 * @param string $extra extra text, e.g.: style="", default: ''
318 318
 	 * @return string html
319 319
 	 */
320
-	static function select_option($value,$label,$selected,$no_lang=0,$title='',$extra='')
320
+	static function select_option($value, $label, $selected, $no_lang = 0, $title = '', $extra = '')
321 321
 	{
322 322
 		// the following compares strict as strings, to archive: '0' == 0 != ''
323 323
 		// the first non-strict search via array_search, is for performance reasons, to not always search the whole array with php
324
-		if (($found = ($key = array_search($value,$selected)) !== false) && (string) $value !== (string) $selected[$key])
324
+		if (($found = ($key = array_search($value, $selected)) !== false) && (string)$value !== (string)$selected[$key])
325 325
 		{
326 326
 			$found = false;
327
-			foreach($selected as $sel)
327
+			foreach ($selected as $sel)
328 328
 			{
329
-				if (($found = (((string) $value) === ((string) $selected[$key])))) break;
329
+				if (($found = (((string)$value) === ((string)$selected[$key])))) break;
330 330
 			}
331 331
 			unset($sel);
332 332
 		}
333
-		return '<option value="'.self::htmlspecialchars($value).'"'.($found  ? ' selected="selected"' : '') .
334
-			($title ? ' title="'.self::htmlspecialchars($no_lang ? $title : lang($title)).'"' : '') .
335
-			($extra ? ' ' . $extra : '') . '>'.
336
-			self::htmlspecialchars($no_lang || $label == '' ? $label : lang($label)) . "</option>\n";
333
+		return '<option value="'.self::htmlspecialchars($value).'"'.($found ? ' selected="selected"' : '').
334
+			($title ? ' title="'.self::htmlspecialchars($no_lang ? $title : lang($title)).'"' : '').
335
+			($extra ? ' '.$extra : '').'>'.
336
+			self::htmlspecialchars($no_lang || $label == '' ? $label : lang($label))."</option>\n";
337 337
 	}
338 338
 
339 339
 	/**
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
 	 * @param string $style css-styles attribute, default ''=none
346 346
 	 * @return string html
347 347
 	 */
348
-	static function div($content,$options='',$class='',$style='')
348
+	static function div($content, $options = '', $class = '', $style = '')
349 349
 	{
350 350
 		if ($class) $options .= ' class="'.$class.'"';
351 351
 		if ($style) $options .= ' style="'.$style.'"';
@@ -361,13 +361,13 @@  discard block
 block discarded – undo
361 361
 	 * @param boolean $ignore_empty if true all empty, zero (!) or unset values, plus filer=none
362 362
 	 * @param string html
363 363
 	 */
364
-	static function input_hidden($vars,$value='',$ignore_empty=True)
364
+	static function input_hidden($vars, $value = '', $ignore_empty = True)
365 365
 	{
366 366
 		if (!is_array($vars))
367 367
 		{
368
-			$vars = array( $vars => $value );
368
+			$vars = array($vars => $value);
369 369
 		}
370
-		foreach($vars as $name => $value)
370
+		foreach ($vars as $name => $value)
371 371
 		{
372 372
 			if (is_array($value))
373 373
 			{
@@ -390,9 +390,9 @@  discard block
 block discarded – undo
390 390
 	 * @param boolean $double_encoding =false do we want double encoding or not, default no
391 391
 	 * @param string html
392 392
 	 */
393
-	static function textarea($name,$value='',$options='',$double_encoding=false)
393
+	static function textarea($name, $value = '', $options = '', $double_encoding = false)
394 394
 	{
395
-		return "<textarea name=\"$name\" $options>".self::htmlspecialchars($value,$double_encoding)."</textarea>\n";
395
+		return "<textarea name=\"$name\" $options>".self::htmlspecialchars($value, $double_encoding)."</textarea>\n";
396 396
 	}
397 397
 
398 398
 	/**
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 	 *
416 416
 	 * creates a textarea inputfield for the htmlarea js-widget (returns the necessary html and js)
417 417
 	 */
418
-	static function htmlarea($name,$content='',$style='',$base_href=''/*,$plugins='',$custom_toolbar='',$set_width_height_in_config=false*/)
418
+	static function htmlarea($name, $content = '', $style = '', $base_href = ''/*,$plugins='',$custom_toolbar='',$set_width_height_in_config=false*/)
419 419
 	{
420 420
 		/*if (!self::htmlarea_availible())
421 421
 		{
@@ -439,12 +439,12 @@  discard block
 block discarded – undo
439 439
 	* @param string $_executeJSAfterInit ='' Javascript to be executed after InstanceReady of CKEditor
440 440
 	* @return string the necessary html for the textarea
441 441
 	*/
442
-	static function fckEditor($_name, $_content, $_mode, $_options=array('toolbar_expanded' =>'true'),
443
-		$_height='400px', $_width='100%',$_start_path='',$_purify=true, $_focusToBody=false, $_executeJSAfterInit='')
442
+	static function fckEditor($_name, $_content, $_mode, $_options = array('toolbar_expanded' =>'true'),
443
+		$_height = '400px', $_width = '100%', $_start_path = '', $_purify = true, $_focusToBody = false, $_executeJSAfterInit = '')
444 444
 	{
445 445
 		if (!self::htmlarea_availible() || $_mode == 'ascii')
446 446
 		{
447
-			return self::textarea($_name,$_content,'style="width: '.$_width.'; height: '.$_height.';" id="'.htmlspecialchars($_name).'"');
447
+			return self::textarea($_name, $_content, 'style="width: '.$_width.'; height: '.$_height.';" id="'.htmlspecialchars($_name).'"');
448 448
 		}
449 449
 
450 450
 		//include the ckeditor js file
@@ -465,13 +465,13 @@  discard block
 block discarded – undo
465 465
 		// User preferences
466 466
 		$font = $GLOBALS['egw_info']['user']['preferences']['common']['rte_font'];
467 467
 		$font_size = Html\CkEditorConfig::font_size_from_prefs();
468
-		$font_span = '<span '.($font||$font_size?'style=\"':'').($font?'font-family:'.$font.'; ':'').($font_size?'font-size:'.$font_size.'; ':'').'\">';
468
+		$font_span = '<span '.($font || $font_size ? 'style=\"' : '').($font ? 'font-family:'.$font.'; ' : '').($font_size ? 'font-size:'.$font_size.'; ' : '').'\">';
469 469
 		if (empty($font) && empty($font_size)) $font_span = '';
470 470
 
471 471
 		// we need to enable double encoding here, as ckEditor has to undo one level of encoding
472 472
 		// otherwise < and > chars eg. from html markup entered in regular (not source) input, will turn into html!
473 473
 		//error_log(__METHOD__.__LINE__.' '.Header\UserAgent::type().','.Header\UserAgent::version());
474
-		return self::textarea($_name,$_content,'id="'.htmlspecialchars($_name).'"',true).	// true = double encoding
474
+		return self::textarea($_name, $_content, 'id="'.htmlspecialchars($_name).'"', true).// true = double encoding
475 475
 '
476 476
 <script type="text/javascript">
477 477
 window.CKEDITOR_BASEPATH="'.$GLOBALS['egw_info']['server']['webserver_url'].'/vendor/egroupware/ckeditor/";
@@ -484,22 +484,22 @@  discard block
 block discarded – undo
484 484
 		function (ev)
485 485
 		{
486 486
 			//alert("CKEditorLoad:"+"'.$_focusToBody.'");
487
-'.($_focusToBody?'
487
+'.($_focusToBody ? '
488 488
 			ev.editor.focus();':'').'
489 489
 			var d = ev.editor.document;
490 490
 			var r = new CKEDITOR.dom.range(d);
491 491
 			r.collapse(true);
492 492
 			r.selectNodeContents(d.getBody());
493
-			r.collapse('.($_focusToBody==='BOTTOM'?'false':'true').');
494
-			r.select();'.($font_span?'
493
+			r.collapse('.($_focusToBody === 'BOTTOM' ? 'false' : 'true').');
494
+			r.select();'.($font_span ? '
495 495
 			//this stuff is needed, as the above places the caret just before the span tag
496 496
 			var sN = r.startContainer.getNextSourceNode();
497 497
 			//FF is selecting the span with getNextSourceNode, other browsers need to fetch it with getNext
498 498
 			r.selectNodeContents(((typeof sN.getName==="function") && sN.getName()=="span"?r.startContainer.getNextSourceNode():r.startContainer.getNextSourceNode().getNext()));
499 499
 			r.collapse(true);
500
-			r.select();'.'':'').'
500
+			r.select();'.'' : '').'
501 501
 			ev.editor.resize("100%", '.str_replace('px', '', $pxheight).');
502
-'.($_executeJSAfterInit?$_executeJSAfterInit:'').'
502
+'.($_executeJSAfterInit ? $_executeJSAfterInit : '').'
503 503
 		}
504 504
 	);'.
505 505
 	(trim($_content) == '' && $font_span ? 'CKEDITOR.instances["'.$_name.'"].setData("'.$font_span.'&#8203;</span>");' : '').
@@ -524,16 +524,16 @@  discard block
 block discarded – undo
524 524
 	* @param string $_executeJSAfterInit ='' Javascript to be executed after InstanceReady of CKEditor
525 525
 	* @return string the necessary html for the textarea
526 526
 	*/
527
-	static function fckEditorQuick($_name, $_mode, $_content='', $_height='400px', $_width='100%',$_purify=true, $_border='0px',$_focusToBody=false,$_executeJSAfterInit='')
527
+	static function fckEditorQuick($_name, $_mode, $_content = '', $_height = '400px', $_width = '100%', $_purify = true, $_border = '0px', $_focusToBody = false, $_executeJSAfterInit = '')
528 528
 	{
529 529
 		if (!self::htmlarea_availible() || $_mode == 'ascii')
530 530
 		{
531 531
 			//TODO: use self::textarea
532
-			return "<textarea name=\"$_name\" style=\"".($_width?" width:".$_width.';':" width:100%;").($_height?" height:".$_height.';':" height:400px;").($_border?" border:".$_border.';':" border:0px;")."\">$_content</textarea>";
532
+			return "<textarea name=\"$_name\" style=\"".($_width ? " width:".$_width.';' : " width:100%;").($_height ? " height:".$_height.';' : " height:400px;").($_border ? " border:".$_border.';' : " border:0px;")."\">$_content</textarea>";
533 533
 		}
534 534
 		else
535 535
 		{
536
-			return self::fckEditor($_name, $_content, $_mode, array(), $_height, $_width,'',$_purify,$_focusToBody,$_executeJSAfterInit);
536
+			return self::fckEditor($_name, $_content, $_mode, array(), $_height, $_width, '', $_purify, $_focusToBody, $_executeJSAfterInit);
537 537
 		}
538 538
 	}
539 539
 
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
 	 * @param string $type type, default ''=not specified = text
546 546
 	 * @param string $options attributes for the tag, default ''=none
547 547
 	 */
548
-	static function input($name,$value='',$type='',$options='' )
548
+	static function input($name, $value = '', $type = '', $options = '')
549 549
 	{
550 550
 		switch ((string)$type)
551 551
 		{
@@ -572,12 +572,12 @@  discard block
 block discarded – undo
572 572
 		'cancelled' => '/no(&|\]|$)/',
573 573
 		'ok'     => '/ok(&|\]|$)/',
574 574
 		'close'  => '/close(&|\]|$)/',
575
-		'add'    => '/(add(&|\]|$)|create)/',	// customfields use create*
575
+		'add'    => '/(add(&|\]|$)|create)/', // customfields use create*
576 576
 	);
577 577
 
578 578
 	static protected $default_classes = array(
579
-		'et2_button_cancel'   => '/cancel(&|\]|$)/',	// yellow
580
-		'et2_button_question' => '/(yes|no)(&|\]|$)/',	// yellow
579
+		'et2_button_cancel'   => '/cancel(&|\]|$)/', // yellow
580
+		'et2_button_question' => '/(yes|no)(&|\]|$)/', // yellow
581 581
 		'et2_button_delete'   => '/delete(&|\]|$)/'		// red
582 582
 	);
583 583
 
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
 	 * @param string $buttontype which type of html button (button|submit), default ='submit'
595 595
 	 * @return string html
596 596
 	 */
597
-	static function submit_button($name,$label,$onClick='',$no_lang=false,$options='',$image='',$app='phpgwapi', $buttontype='submit')
597
+	static function submit_button($name, $label, $onClick = '', $no_lang = false, $options = '', $image = '', $app = 'phpgwapi', $buttontype = 'submit')
598 598
 	{
599 599
 		// workaround for idots and IE button problem (wrong cursor-image)
600 600
 		if (Header\UserAgent::type() == 'msie')
@@ -606,11 +606,11 @@  discard block
 block discarded – undo
606 606
 
607 607
 		if ($image != '')
608 608
 		{
609
-			$image = str_replace(array('.gif','.GIF','.png','.PNG'),'',$image);
609
+			$image = str_replace(array('.gif', '.GIF', '.png', '.PNG'), '', $image);
610 610
 
611 611
 			if (!($path = Image::find($app, $image)))
612 612
 			{
613
-				$path = $image;		// name may already contain absolut path
613
+				$path = $image; // name may already contain absolut path
614 614
 			}
615 615
 			$image = ' src="'.$path.'"';
616 616
 			$classes[] = 'image_button';
@@ -619,11 +619,11 @@  discard block
 block discarded – undo
619 619
 		{
620 620
 			$label = lang($label);
621 621
 		}
622
-		if (($accesskey = @strstr($label,'&')) && $accesskey[1] != ' ' &&
623
-			(($pos = strpos($accesskey,';')) === false || $pos > 5))
622
+		if (($accesskey = @strstr($label, '&')) && $accesskey[1] != ' ' &&
623
+			(($pos = strpos($accesskey, ';')) === false || $pos > 5))
624 624
 		{
625
-			$label_u = str_replace('&'.$accesskey[1],'<u>'.$accesskey[1].'</u>',$label);
626
-			$label = str_replace('&','',$label);
625
+			$label_u = str_replace('&'.$accesskey[1], '<u>'.$accesskey[1].'</u>', $label);
626
+			$label = str_replace('&', '', $label);
627 627
 			$options .= ' accesskey="'.$accesskey[1].'" '.$options;
628 628
 		}
629 629
 		else
@@ -631,10 +631,10 @@  discard block
 block discarded – undo
631 631
 			$accesskey = '';
632 632
 			$label_u = $label;
633 633
 		}
634
-		if ($onClick) $options .= ' onclick="'.str_replace('"','\\"',$onClick).'"';
634
+		if ($onClick) $options .= ' onclick="'.str_replace('"', '\\"', $onClick).'"';
635 635
 
636 636
 		// add default background-image to get et2 like buttons
637
-		foreach(self::$default_background_images as $img => $reg_exp)
637
+		foreach (self::$default_background_images as $img => $reg_exp)
638 638
 		{
639 639
 			if (preg_match($reg_exp, $name) && ($url = Image::find($GLOBALS['egw_info']['flags']['currentapp'], $img)))
640 640
 			{
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
 			}
645 645
 		}
646 646
 		// add default class for cancel, delete or yes/no buttons
647
-		foreach(self::$default_classes as $class => $reg_exp)
647
+		foreach (self::$default_classes as $class => $reg_exp)
648 648
 		{
649 649
 			if (preg_match($reg_exp, $name))
650 650
 			{
@@ -678,19 +678,19 @@  discard block
 block discarded – undo
678 678
 	 * @param array|string $vars query or array ('name' => 'value', ...) with query
679 679
 	 * @return string absolut link already run through $phpgw->link
680 680
 	 */
681
-	static function link($_url,$vars='')
681
+	static function link($_url, $vars = '')
682 682
 	{
683 683
 		if (!is_array($vars))
684 684
 		{
685
-			parse_str($vars,$vars);
685
+			parse_str($vars, $vars);
686 686
 		}
687
-		list($url,$v) = explode('?', $_url);	// url may contain additional vars
687
+		list($url, $v) = explode('?', $_url); // url may contain additional vars
688 688
 		if ($v)
689 689
 		{
690
-			parse_str($v,$v);
690
+			parse_str($v, $v);
691 691
 			$vars += $v;
692 692
 		}
693
-		return Framework::link($url,$vars);
693
+		return Framework::link($url, $vars);
694 694
 	}
695 695
 
696 696
 	/**
@@ -702,9 +702,9 @@  discard block
 block discarded – undo
702 702
 	 * @param string $options attributes for the tag, default ''=none
703 703
 	 * @return string html
704 704
 	 */
705
-	static function checkbox($name,$checked=false,$value='True',$options='')
705
+	static function checkbox($name, $checked = false, $value = 'True', $options = '')
706 706
 	{
707
-		return '<input type="checkbox" name="'.$name.'" value="'.self::htmlspecialchars($value).'"' .($checked ? ' checked="1"' : '') . "$options />\n";
707
+		return '<input type="checkbox" name="'.$name.'" value="'.self::htmlspecialchars($value).'"'.($checked ? ' checked="1"' : '')."$options />\n";
708 708
 	}
709 709
 
710 710
 	/**
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
 	 * @param string $method method of the form, default 'POST'
720 720
 	 * @return string html
721 721
 	 */
722
-	static function form($content,$hidden_vars,$_url,$url_vars='',$name='',$options='',$method='POST')
722
+	static function form($content, $hidden_vars, $_url, $url_vars = '', $name = '', $options = '', $method = 'POST')
723 723
 	{
724 724
 		$url = $_url ? self::link($_url, $url_vars) : $_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'];
725 725
 		$html = "<form method=\"$method\" ".($name != '' ? "name=\"$name\" " : '')."action=\"$url\" $options>\n";
@@ -746,9 +746,9 @@  discard block
 block discarded – undo
746 746
 	 * @param string $method method of the form, default 'POST'
747 747
 	 * @return string html
748 748
 	 */
749
-	static function form_1button($name,$label,$hidden_vars,$url,$url_vars='',$form_name='',$method='POST')
749
+	static function form_1button($name, $label, $hidden_vars, $url, $url_vars = '', $form_name = '', $method = 'POST')
750 750
 	{
751
-		return self::form(self::submit_button($name,$label),$hidden_vars,$url,$url_vars,$form_name,' style="display: inline-block"',$method);
751
+		return self::form(self::submit_button($name, $label), $hidden_vars, $url, $url_vars, $form_name, ' style="display: inline-block"', $method);
752 752
 	}
753 753
 
754 754
 	const THEAD = 1;
@@ -781,34 +781,34 @@  discard block
 block discarded – undo
781 781
 	 * @param boolean $no_table_tr dont return the table- and outmost tr-tabs, default false=return table+tr
782 782
 	 * @return string with html-code of the table
783 783
 	 */
784
-	static function table($rows,$options = '',$no_table_tr=False)
784
+	static function table($rows, $options = '', $no_table_tr = False)
785 785
 	{
786 786
 		$html = $no_table_tr ? '' : "<table $options>\n";
787 787
 
788 788
 		$part = 0;
789
-		foreach($rows as $key => $row)
789
+		foreach ($rows as $key => $row)
790 790
 		{
791 791
 			if (!is_array($row))
792 792
 			{
793
-				continue;					// parameter
793
+				continue; // parameter
794 794
 			}
795 795
 			// get the current part from the optional 'h' or 'f' prefix of the key
796 796
 			$p = $key[0] == 'h' ? self::THEAD : ($key[0] == 'f' ? self::TFOOT : self::TBODY);
797 797
 			if ($part < $p && ($part || $p < self::TBODY))	// add only allowed and neccessary transitions
798 798
 			{
799 799
 				if ($part) $html .= '</'.self::$part2tag[$part].">\n";
800
-				$html .= '<'.self::$part2tag[$part=$p].">\n";
800
+				$html .= '<'.self::$part2tag[$part = $p].">\n";
801 801
 			}
802 802
 			$html .= $no_table_tr && $key == 1 ? '' : "\t<tr ".$rows['.'.$key].">\n";
803 803
 
804
-			foreach($row as $key => $cell)
804
+			foreach ($row as $key => $cell)
805 805
 			{
806 806
 				if ($key[0] == '.')
807 807
 				{
808
-					continue;				// parameter
808
+					continue; // parameter
809 809
 				}
810
-				$table_pos = strpos($cell,'<table');
811
-				$td_pos = strpos($cell,'<td');
810
+				$table_pos = strpos($cell, '<table');
811
+				$td_pos = strpos($cell, '<td');
812 812
 				if ($td_pos !== False && ($table_pos === False || $td_pos < $table_pos))
813 813
 				{
814 814
 					$html .= $cell;
@@ -832,7 +832,7 @@  discard block
 block discarded – undo
832 832
 
833 833
 		if ($no_table_tr)
834 834
 		{
835
-			$html = substr($html,0,-16);
835
+			$html = substr($html, 0, -16);
836 836
 		}
837 837
 		return $html;
838 838
 	}
@@ -844,12 +844,12 @@  discard block
 block discarded – undo
844 844
 	 * @param boolean $no_script if true generate a submit-button if javascript is off
845 845
 	 * @return string html
846 846
 	 */
847
-	static function sbox_submit( $sbox,$no_script=false )
847
+	static function sbox_submit($sbox, $no_script = false)
848 848
 	{
849
-		$html = str_replace('<select','<select onchange="this.form.submit()" ',$sbox);
849
+		$html = str_replace('<select', '<select onchange="this.form.submit()" ', $sbox);
850 850
 		if ($no_script)
851 851
 		{
852
-			$html .= '<noscript>'.self::submit_button('send','>').'</noscript>';
852
+			$html .= '<noscript>'.self::submit_button('send', '>').'</noscript>';
853 853
 		}
854 854
 		return $html;
855 855
 	}
@@ -865,17 +865,17 @@  discard block
 block discarded – undo
865 865
 	 * @param string $height height, default 5px
866 866
 	 * @return string html
867 867
 	 */
868
-	static function progressbar($_percent, $_title='',$options='',$width='',$color='',$height='' )
868
+	static function progressbar($_percent, $_title = '', $options = '', $width = '', $color = '', $height = '')
869 869
 	{
870 870
 		$percent = (int)$_percent;
871 871
 		if (!$width) $width = '30px';
872
-		if (!$height)$height= '5px';
872
+		if (!$height)$height = '5px';
873 873
 		if (!$color) $color = '#D00000';
874 874
 		$title = $_title ? self::htmlspecialchars($_title) : $percent.'%';
875 875
 
876 876
 		return '<div class="onlyPrint">'.$title.'</div><div class="noPrint" title="'.$title.'" '.$options.
877 877
 			' style="height: '.$height.'; width: '.$width.'; border: 1px solid black; padding: 1px; text-align: left;'.
878
-			(@stristr($options,'onclick="') ? ' cursor: pointer;' : '').'">'."\n\t".
878
+			(@stristr($options, 'onclick="') ? ' cursor: pointer;' : '').'">'."\n\t".
879 879
 			'<div style="height: '.$height.'; width: '.$percent.'%; background: '.$color.';"></div>'."\n</div>\n";
880 880
 	}
881 881
 
@@ -893,32 +893,32 @@  discard block
 block discarded – undo
893 893
 	 * @param string $options further options for the tag, default '' = none
894 894
 	 * @return string the html
895 895
 	 */
896
-	static function image( $app,$name,$title='',$options='' )
896
+	static function image($app, $name, $title = '', $options = '')
897 897
 	{
898 898
 		if (is_array($name))	// menuaction and other get-vars
899 899
 		{
900
-			$name = $GLOBALS['egw']->link('/index.php',$name);
900
+			$name = $GLOBALS['egw']->link('/index.php', $name);
901 901
 		}
902
-		if (substr($name,0,5) == 'vfs:/')	// vfs pseudo protocoll
902
+		if (substr($name, 0, 5) == 'vfs:/')	// vfs pseudo protocoll
903 903
 		{
904
-			$name = Framework::link(Vfs::download_url(substr($name,4)));
904
+			$name = Framework::link(Vfs::download_url(substr($name, 4)));
905 905
 		}
906
-		if ($name[0] == '/' || substr($name,0,7) == 'http://' || substr($name,0,8) == 'https://' || stripos($name,'api/thumbnail.php') )
906
+		if ($name[0] == '/' || substr($name, 0, 7) == 'http://' || substr($name, 0, 8) == 'https://' || stripos($name, 'api/thumbnail.php'))
907 907
 		{
908
-			if (!($name[0] == '/' || substr($name,0,7) == 'http://' || substr($name,0,8) == 'https://')) $name = '/'.$name;
908
+			if (!($name[0] == '/' || substr($name, 0, 7) == 'http://' || substr($name, 0, 8) == 'https://')) $name = '/'.$name;
909 909
 			$url = $name;
910 910
 		}
911 911
 		else	// no URL, so try searching the image
912 912
 		{
913
-			$name = str_replace(array('.gif','.GIF','.png','.PNG'),'',$name);
913
+			$name = str_replace(array('.gif', '.GIF', '.png', '.PNG'), '', $name);
914 914
 
915
-			if (!($url = Image::find($app,$name)))
915
+			if (!($url = Image::find($app, $name)))
916 916
 			{
917
-				$url = $name;		// name may already contain absolut path
917
+				$url = $name; // name may already contain absolut path
918 918
 			}
919
-			if($GLOBALS['egw_info']['server']['webserver_url'])
919
+			if ($GLOBALS['egw_info']['server']['webserver_url'])
920 920
 			{
921
-				list(,$path) = explode($GLOBALS['egw_info']['server']['webserver_url'],$url);
921
+				list(,$path) = explode($GLOBALS['egw_info']['server']['webserver_url'], $url);
922 922
 
923 923
 				if (!is_null($path)) $path = EGW_SERVER_ROOT.$path;
924 924
 			}
@@ -927,12 +927,12 @@  discard block
 block discarded – undo
927 927
 				$path = EGW_SERVER_ROOT.$url;
928 928
 			}
929 929
 
930
-			if (is_null($path) || (!@is_readable($path) && stripos($path,'webdav.php')===false))
930
+			if (is_null($path) || (!@is_readable($path) && stripos($path, 'webdav.php') === false))
931 931
 			{
932 932
 				// if the image-name is a percentage, use a progressbar
933
-				if (substr($name,-1) == '%' && is_numeric($percent = substr($name,0,-1)))
933
+				if (substr($name, -1) == '%' && is_numeric($percent = substr($name, 0, -1)))
934 934
 				{
935
-					return self::progressbar($percent,$title);
935
+					return self::progressbar($percent, $title);
936 936
 				}
937 937
 				return $title;
938 938
 			}
@@ -943,12 +943,12 @@  discard block
 block discarded – undo
943 943
 		}
944 944
 
945 945
 		// This block makes pngfix.js useless, adding a check on disable_pngfix to have pngfix.js do its thing
946
-		if (Header\UserAgent::type() == 'msie' && Header\UserAgent::version() < 7.0 && substr($url,-4) == '.png' && ($GLOBALS['egw_info']['user']['preferences']['common']['disable_pngfix'] || !isset($GLOBALS['egw_info']['user']['preferences']['common']['disable_pngfix'])))
946
+		if (Header\UserAgent::type() == 'msie' && Header\UserAgent::version() < 7.0 && substr($url, -4) == '.png' && ($GLOBALS['egw_info']['user']['preferences']['common']['disable_pngfix'] || !isset($GLOBALS['egw_info']['user']['preferences']['common']['disable_pngfix'])))
947 947
 		{
948 948
 			$extra_styles = "display: inline-block; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='$url',sizingMethod='image'); width: 1px; height: 1px;";
949
-			if (false!==strpos($options,'style="'))
949
+			if (false !== strpos($options, 'style="'))
950 950
 			{
951
-				$options = str_replace('style="','style="'.$extra_styles, $options);
951
+				$options = str_replace('style="', 'style="'.$extra_styles, $options);
952 952
 			}
953 953
 			else
954 954
 			{
@@ -968,24 +968,24 @@  discard block
 block discarded – undo
968 968
 	 * @param string $options attributes for the tag, default ''=none
969 969
 	 * @return string the html
970 970
 	 */
971
-	static function a_href( $content,$url,$vars='',$options='')
971
+	static function a_href($content, $url, $vars = '', $options = '')
972 972
 	{
973 973
 		if (is_array($url))
974 974
 		{
975 975
 			$vars = $url;
976 976
 			$url = '/index.php';
977 977
 		}
978
-		elseif (strpos($url,'/')===false &&
979
-			count(explode('.',$url)) >= 3 &&
980
-			!(strpos($url,'mailto:')!==false ||
981
-			strpos($url,'://')!==false ||
982
-			strpos($url,'javascript:')!==false))
978
+		elseif (strpos($url, '/') === false &&
979
+			count(explode('.', $url)) >= 3 &&
980
+			!(strpos($url, 'mailto:') !== false ||
981
+			strpos($url, '://') !== false ||
982
+			strpos($url, 'javascript:') !== false))
983 983
 		{
984 984
 			$url = "/index.php?menuaction=$url";
985 985
 		}
986 986
 		if ($url[0] == '/')		// link relative to eGW
987 987
 		{
988
-			$url = self::link($url,$vars);
988
+			$url = self::link($url, $vars);
989 989
 		}
990 990
 		//echo "<p>self::a_href('".self::htmlspecialchars($content)."','$url',".print_r($vars,True).") = ".self::link($url,$vars)."</p>";
991 991
 		return '<a href="'.self::htmlspecialchars($url).'" '.$options.'>'.$content.'</a>';
@@ -999,7 +999,7 @@  discard block
 block discarded – undo
999 999
 	 */
1000 1000
 	static function bold($content)
1001 1001
 	{
1002
-		return '<b>'.($content?$content.'</b>':'');
1002
+		return '<b>'.($content ? $content.'</b>' : '');
1003 1003
 	}
1004 1004
 
1005 1005
 	/**
@@ -1009,7 +1009,7 @@  discard block
 block discarded – undo
1009 1009
 	 * @param string $options attributes for the tag, default ''=none
1010 1010
 	 * @return string the html
1011 1011
 	 */
1012
-	static function hr($width='',$options='')
1012
+	static function hr($width = '', $options = '')
1013 1013
 	{
1014 1014
 		if ($width) $options .= " width=\"$width\"";
1015 1015
 
@@ -1025,12 +1025,12 @@  discard block
 block discarded – undo
1025 1025
 	 * @param mixed $names String (or Array) with the option-names eg. 'WIDTH,HEIGHT,BORDER'
1026 1026
 	 * @return string with options/attributes
1027 1027
 	 */
1028
-	static function formatOptions($options,$names)
1028
+	static function formatOptions($options, $names)
1029 1029
 	{
1030
-		if (!is_array($options)) $options = explode(',',$options);
1031
-		if (!is_array($names))   $names   = explode(',',$names);
1030
+		if (!is_array($options)) $options = explode(',', $options);
1031
+		if (!is_array($names))   $names   = explode(',', $names);
1032 1032
 
1033
-		foreach($options as $n => $val)
1033
+		foreach ($options as $n => $val)
1034 1034
 		{
1035 1035
 			if ($val != '' && $names[$n] != '')
1036 1036
 			{
@@ -1060,7 +1060,7 @@  discard block
 block discarded – undo
1060 1060
 	 * @param string $options attributes for the tag, default ''=none
1061 1061
 	 * @return string the html
1062 1062
 	 */
1063
-	static function label($content,$id='',$accesskey='',$options='')
1063
+	static function label($content, $id = '', $accesskey = '', $options = '')
1064 1064
 	{
1065 1065
 		if ($id != '')
1066 1066
 		{
@@ -1081,7 +1081,7 @@  discard block
 block discarded – undo
1081 1081
 	 * @param string $options attributes for the tag, default ''=none
1082 1082
 	 * @return string the html
1083 1083
 	 */
1084
-	static function fieldset($content,$legend='',$options='')
1084
+	static function fieldset($content, $legend = '', $options = '')
1085 1085
 	{
1086 1086
 		$html = "<fieldset $options>".($legend ? '<legend>'.self::htmlspecialchars($legend).'</legend>' : '')."\n";
1087 1087
 
@@ -1115,9 +1115,9 @@  discard block
 block discarded – undo
1115 1115
 	 *
1116 1116
 	 * @return string the html code, to be added into the template
1117 1117
 	 */
1118
-	static function tree($_folders,$_selected,$_topFolder=false,$_onNodeSelect="null",$tree='foldertree',$_divClass='',
1119
-		$_leafImage='',$_onCheckHandler=false,$delimiter='/',$folderImageDir=null,$autoLoading=null,$dataMode='JSON',
1120
-		$dragndrop=false)
1118
+	static function tree($_folders, $_selected, $_topFolder = false, $_onNodeSelect = "null", $tree = 'foldertree', $_divClass = '',
1119
+		$_leafImage = '', $_onCheckHandler = false, $delimiter = '/', $folderImageDir = null, $autoLoading = null, $dataMode = 'JSON',
1120
+		$dragndrop = false)
1121 1121
 	{
1122 1122
 		$webserver_url = $GLOBALS['egw_info']['server']['webserver_url'];
1123 1123
 		if (empty($folderImageDir))
@@ -1140,7 +1140,7 @@  discard block
 block discarded – undo
1140 1140
 			//error_log(__METHOD__."() setting templated image-path: $folderImageDir");
1141 1141
 		}
1142 1142
 
1143
-		static $tree_initialised=false;
1143
+		static $tree_initialised = false;
1144 1144
 		if (!$tree_initialised)
1145 1145
 		{
1146 1146
 			Framework::includeCSS('/api/js/dhtmlxtree/codebase/dhtmlxtree.css');
@@ -1150,16 +1150,16 @@  discard block
 block discarded – undo
1150 1150
 			$tree_initialised = true;
1151 1151
 			if (!$_folders && !$autoLoading) return null;
1152 1152
 		}
1153
-		$html = self::div("\n",'id="'.$tree.'"',$_divClass).$html;
1153
+		$html = self::div("\n", 'id="'.$tree.'"', $_divClass).$html;
1154 1154
 		$html .= "<script type='text/javascript'>\n";
1155 1155
 		$html .= "var $tree;";
1156 1156
 		$html .= "egw_LAB.wait(function() {";
1157 1157
 		$html .= "$tree = new"." dhtmlXTreeObject('$tree','100%','100%',0);\n";
1158
-		$html .= "$tree.parentObject.style.overflow='auto';\n";	// dhtmlXTree constructor has hidden hardcoded
1158
+		$html .= "$tree.parentObject.style.overflow='auto';\n"; // dhtmlXTree constructor has hidden hardcoded
1159 1159
 		if (Translation::charset() == 'utf-8') $html .= "if ($tree.setEscapingMode) $tree.setEscapingMode('utf8');\n";
1160 1160
 		$html .= "$tree.setImagePath('$folderImageDir/dhtmlxtree/');\n";
1161 1161
 
1162
-		if($_onCheckHandler)
1162
+		if ($_onCheckHandler)
1163 1163
 		{
1164 1164
 			$html .= "$tree.enableCheckBoxes(1);\n";
1165 1165
 			$html .= "$tree.setOnCheckHandler('$_onCheckHandler');\n";
@@ -1170,7 +1170,7 @@  discard block
 block discarded – undo
1170 1170
 		if ($autoLoading)
1171 1171
 		{
1172 1172
 			$autoLoading = is_array($autoLoading) ?
1173
-				Framework::link('/index.php',$autoLoading) : Framework::link($autoLoading);
1173
+				Framework::link('/index.php', $autoLoading) : Framework::link($autoLoading);
1174 1174
 			$html .= "$tree.setXMLAutoLoading('$autoLoading');\n";
1175 1175
 			if ($dataMode != 'XML') $html .= "$tree.setDataMode('$dataMode');\n";
1176 1176
 
@@ -1211,7 +1211,7 @@  discard block
 block discarded – undo
1211 1211
 		}
1212 1212
 		if (is_string($_folders))
1213 1213
 		{
1214
-			switch($dataMode)
1214
+			switch ($dataMode)
1215 1215
 			{
1216 1216
 				case 'JSON':
1217 1217
 					$html .= "$tree.loadJSONObject($_folders);\n"; break;
@@ -1222,10 +1222,10 @@  discard block
 block discarded – undo
1222 1222
 		else
1223 1223
 		{
1224 1224
 			// evtl. remove leading delimiter
1225
-			if ($_selected[0] == $delimiter) $_selected = substr($_selected,1);
1225
+			if ($_selected[0] == $delimiter) $_selected = substr($_selected, 1);
1226 1226
 
1227 1227
 			$n = 0;
1228
-			foreach($_folders as $path => $data)
1228
+			foreach ($_folders as $path => $data)
1229 1229
 			{
1230 1230
 				if (!is_array($data))
1231 1231
 				{
@@ -1237,10 +1237,10 @@  discard block
 block discarded – undo
1237 1237
 				if ($_leafImage)
1238 1238
 				{
1239 1239
 					$image1 = $image2 = $image3 = "'".$_leafImage."'";
1240
-					if (($next_item = array_slice($_folders, $n+1, 1, true)))
1240
+					if (($next_item = array_slice($_folders, $n + 1, 1, true)))
1241 1241
 					{
1242 1242
 						list($next_path) = each($next_item);
1243
-						if (substr($next_path,0,strlen($path)+1) == $path.'/')
1243
+						if (substr($next_path, 0, strlen($path) + 1) == $path.'/')
1244 1244
 						{
1245 1245
 							$image1 = $image2 = $image3 = '0';
1246 1246
 						}
@@ -1251,22 +1251,22 @@  discard block
 block discarded – undo
1251 1251
 					$image1 = $image2 = $image3 = "'".$data['image']."'";
1252 1252
 				}
1253 1253
 				// evtl. remove leading delimiter
1254
-				if ($path[0] == $delimiter) $path = substr($path,1);
1255
-				$folderParts = explode($delimiter,$path);
1254
+				if ($path[0] == $delimiter) $path = substr($path, 1);
1255
+				$folderParts = explode($delimiter, $path);
1256 1256
 
1257 1257
 				//get rightmost folderpart
1258 1258
 				$label = array_pop($folderParts);
1259 1259
 				if (isset($data['label'])) $label = $data['label'];
1260 1260
 
1261 1261
 				// the rest of the array is the name of the parent
1262
-				$parentName = implode((array)$folderParts,$delimiter);
1263
-				if(empty($parentName)) $parentName = $top;
1262
+				$parentName = implode((array)$folderParts, $delimiter);
1263
+				if (empty($parentName)) $parentName = $top;
1264 1264
 
1265 1265
 				$entryOptions = !isset($data['child']) || $data['child'] ? 'CHILD' : '';
1266 1266
 				if ($_onCheckHandler && $_selected)	// check selected items on multi selection
1267 1267
 				{
1268
-					if (!is_array($_selected)) $_selected = explode(',',$_selected);
1269
-					if (array_search("$path",$_selected)!==false) $entryOptions .= ',CHECKED';
1268
+					if (!is_array($_selected)) $_selected = explode(',', $_selected);
1269
+					if (array_search("$path", $_selected) !== false) $entryOptions .= ',CHECKED';
1270 1270
 					//echo "<p>path=$path, _selected=".print_r($_selected,true).": $entryOptions</p>\n";
1271 1271
 				}
1272 1272
 				// highlight current item
@@ -1286,7 +1286,7 @@  discard block
 block discarded – undo
1286 1286
 		$html .= "$tree.closeAllItems(0);\n";
1287 1287
 		if ($_selected)
1288 1288
 		{
1289
-			foreach(is_array($_selected)?$_selected:array($_selected) as $path)
1289
+			foreach (is_array($_selected) ? $_selected : array($_selected) as $path)
1290 1290
 			{
1291 1291
 				$html .= "$tree.openItem('".addslashes($path)."');\n";
1292 1292
 			}
@@ -1311,7 +1311,7 @@  discard block
 block discarded – undo
1311 1311
 	 *		or to restrict the attribute's values
1312 1312
 	 * @param boolean $_force =null - force the config passed to be used without merging to the default
1313 1313
 	 */
1314
-	static function purify($html,$config=null,$spec=array(),$_force=false)
1314
+	static function purify($html, $config = null, $spec = array(), $_force = false)
1315 1315
 	{
1316 1316
 		return Html\HtmLawed::purify($html, $config, $spec, $_force);
1317 1317
 	}
Please login to merge, or discard this patch.
Braces   +183 added lines, -47 removed lines patch added patch discarded remove patch
@@ -34,7 +34,11 @@  discard block
 block discarded – undo
34 34
 	 */
35 35
 	static function activate_links($content)
36 36
 	{
37
-		if (!$content || strlen($content) < 20) return $content;	// performance
37
+		if (!$content || strlen($content) < 20)
38
+		{
39
+			return $content;
40
+		}
41
+		// performance
38 42
 
39 43
 		// Exclude everything which is already a link
40 44
 		$NotAnchor = '(?<!"|href=|href\s=\s|href=\s|href\s=)';
@@ -57,10 +61,14 @@  discard block
 block discarded – undo
57 61
 			return $match[1]."<a href=\"".($match[2]&&!$match[3]?$match[2]:'').($match[3]?$match[3]:'').$match[4].$match[5]."\" target=\"_blank\">".$match[4].$match[5]."</a>".$match[6];
58 62
 		}, $result);
59 63
 
60
-		if (true)	// hack to keep IDE from complaing about double assignments
64
+		if (true)
65
+		{
66
+			// hack to keep IDE from complaing about double assignments
61 67
 		{
62 68
 			//  First match things beginning with http:// (or other protocols)
63
-			$Protocol = '(http:\/\/|(ftp:\/\/|https:\/\/))';	// only http:// gets removed, other protocolls are shown
69
+			$Protocol = '(http:\/\/|(ftp:\/\/|https:\/\/))';
70
+		}
71
+		// only http:// gets removed, other protocolls are shown
64 72
 			$Domain = '([\w-]+\.[\w-.]+)';
65 73
 			$Subdir = '([\w\-\.,@?^=%&;:\/~\+#]*[\w\-\@?^=%&\/~\+#])?';
66 74
 			$optStuff = '(&quot;|&quot|;)?';
@@ -98,7 +106,8 @@  discard block
 block discarded – undo
98 106
 			$Expr = '/' .$optBracket0. $NotAnchor . $NotHTTP . $Domain2 . $Subdir2 .$optBracket. '/i';
99 107
 			//$Expr = '/' . $NotAnchor . $NotHTTP . $Domain . $Subdir . $optBracket . '/i';
100 108
 			// use preg_replace_callback as we experienced problems with links such as <www.example.tld/pfad/zu/einer/pdf-Datei.pdf>
101
-			$result4 = preg_replace_callback( $Expr, function ($match) {
109
+			$result4 = preg_replace_callback( $Expr, function ($match)
110
+			{
102 111
 					//error_log(__METHOD__.__LINE__.array2string($match));
103 112
 					if ($match[4]==';' && (strlen($match[3])-4) >=0 && strpos($match[3],'&gt',strlen($match[3])-4)!==false)
104 113
 					{
@@ -148,7 +157,11 @@  discard block
 block discarded – undo
148 157
 	 */
149 158
 	static function select($name, $key, $arr=0,$no_lang=false,$options='',$multiple=0,$enhanced=null)
150 159
 	{
151
-		if(is_null($enhanced)) $enhanced = false;	//disabled by default (count($arr) > self::SELECT_ENHANCED_ROW_COUNT);
160
+		if(is_null($enhanced))
161
+		{
162
+			$enhanced = false;
163
+		}
164
+		//disabled by default (count($arr) > self::SELECT_ENHANCED_ROW_COUNT);
152 165
 
153 166
 		if (!is_array($arr))
154 167
 		{
@@ -211,7 +224,8 @@  discard block
 block discarded – undo
211 224
 		}
212 225
 		$out .= "</select>\n";
213 226
 
214
-		if($enhanced) {
227
+		if($enhanced)
228
+		{
215 229
 			Framework::includeJS('/api/js/jquery/chosen/chosen.jquery.js');
216 230
 			Framework::includeCSS('/api/js/jquery/chosen/chosen.css',null,false);
217 231
 			$out .= "<script>var lab = egw_LAB || \$LAB; lab.wait(function() {jQuery(function() {if(jQuery().chosen) jQuery('select[name=\"$name\"]').chosen({width: '100%'});});})</script>\n";
@@ -238,13 +252,19 @@  discard block
 block discarded – undo
238 252
 	static function checkbox_multiselect($name, $key, $arr=0,$no_lang=false,$options='',$multiple=3,$selected_first=true,$style='',$enhanced = null)
239 253
 	{
240 254
 		//echo "<p align=right>checkbox_multiselect('$name',".array2string($key).",".array2string($arr).",$no_lang,'$options',$multiple,$selected_first,'$style')</p>\n";
241
-		if(is_null($enhanced)) $enhanced = (count($arr) > self::SELECT_ENHANCED_ROW_COUNT);
255
+		if(is_null($enhanced))
256
+		{
257
+			$enhanced = (count($arr) > self::SELECT_ENHANCED_ROW_COUNT);
258
+		}
242 259
 
243 260
 		if (!is_array($arr))
244 261
 		{
245 262
 			$arr = array('no','yes');
246 263
 		}
247
-		if ((int)$multiple <= 0) $multiple = 1;
264
+		if ((int)$multiple <= 0)
265
+		{
266
+			$multiple = 1;
267
+		}
248 268
 
249 269
 		if (substr($name,-2) != '[]')
250 270
 		{
@@ -252,7 +272,10 @@  discard block
 block discarded – undo
252 272
 		}
253 273
 		$base_name = substr($name,0,-2);
254 274
 
255
-		if($enhanced) return self::select($name, $key, $arr,$no_lang,$options." style=\"$style\" ",$multiple,$enhanced);
275
+		if($enhanced)
276
+		{
277
+			return self::select($name, $key, $arr,$no_lang,$options." style=\"$style\" ",$multiple,$enhanced);
278
+		}
256 279
 
257 280
 		if (!is_array($key))
258 281
 		{
@@ -290,18 +313,36 @@  discard block
 block discarded – undo
290 313
 			{
291 314
 				$title = '';
292 315
 			}
293
-			if ($label && !$no_lang) $label = lang($label);
294
-			if ($title && !$no_lang) $title = lang($title);
316
+			if ($label && !$no_lang)
317
+			{
318
+				$label = lang($label);
319
+			}
320
+			if ($title && !$no_lang)
321
+			{
322
+				$title = lang($title);
323
+			}
295 324
 
296
-			if (strlen($label) > $max_len) $max_len = strlen($label);
325
+			if (strlen($label) > $max_len)
326
+			{
327
+				$max_len = strlen($label);
328
+			}
297 329
 
298 330
 			$html .= self::label(self::checkbox($name,in_array((string)$val,$key),$val,$options_no_id.
299 331
 				' id="'.$base_name.'['.$val.']'.'"').self::htmlspecialchars($label),
300 332
 				$base_name.'['.$val.']','',($title ? 'title="'.self::htmlspecialchars($title).'" ':''))."<br />\n";
301 333
 		}
302
-		if ($style && substr($style,-1) != ';') $style .= '; ';
303
-		if (strpos($style,'height')===false) $style .= 'height: '.(1.7*$multiple).'em; ';
304
-		if (strpos($style,'width')===false)  $style .= 'width: '.(4+$max_len*($max_len < 15 ? 0.65 : 0.6)).'em; ';
334
+		if ($style && substr($style,-1) != ';')
335
+		{
336
+			$style .= '; ';
337
+		}
338
+		if (strpos($style,'height')===false)
339
+		{
340
+			$style .= 'height: '.(1.7*$multiple).'em; ';
341
+		}
342
+		if (strpos($style,'width')===false)
343
+		{
344
+			$style .= 'width: '.(4+$max_len*($max_len < 15 ? 0.65 : 0.6)).'em; ';
345
+		}
305 346
 		$style .= 'background-color: white; overflow: auto; border: lightgray 2px inset; text-align: left;';
306 347
 
307 348
 		return self::div($html,$options,'',$style);
@@ -326,7 +367,10 @@  discard block
 block discarded – undo
326 367
 			$found = false;
327 368
 			foreach($selected as $sel)
328 369
 			{
329
-				if (($found = (((string) $value) === ((string) $selected[$key])))) break;
370
+				if (($found = (((string) $value) === ((string) $selected[$key]))))
371
+				{
372
+					break;
373
+				}
330 374
 			}
331 375
 			unset($sel);
332 376
 		}
@@ -347,8 +391,14 @@  discard block
 block discarded – undo
347 391
 	 */
348 392
 	static function div($content,$options='',$class='',$style='')
349 393
 	{
350
-		if ($class) $options .= ' class="'.$class.'"';
351
-		if ($style) $options .= ' style="'.$style.'"';
394
+		if ($class)
395
+		{
396
+			$options .= ' class="'.$class.'"';
397
+		}
398
+		if ($style)
399
+		{
400
+			$options .= ' style="'.$style.'"';
401
+		}
352 402
 
353 403
 		return "<div $options>\n".($content ? "$content</div>\n" : '');
354 404
 	}
@@ -373,10 +423,13 @@  discard block
 block discarded – undo
373 423
 			{
374 424
 				$value = json_encode($value);
375 425
 			}
376
-			if (!$ignore_empty || $value && !($name == 'filter' && $value == 'none'))	// dont need to send all the empty vars
426
+			if (!$ignore_empty || $value && !($name == 'filter' && $value == 'none'))
427
+			{
428
+				// dont need to send all the empty vars
377 429
 			{
378 430
 				$html .= "<input type=\"hidden\" name=\"$name\" value=\"".self::htmlspecialchars($value)."\" />\n";
379 431
 			}
432
+			}
380 433
 		}
381 434
 		return $html;
382 435
 	}
@@ -452,7 +505,9 @@  discard block
 block discarded – undo
452 505
 
453 506
 		// run content through htmlpurifier
454 507
 		if ($_purify && !empty($_content))
455
-			$_content = self::purify($_content);
508
+		{
509
+					$_content = self::purify($_content);
510
+		}
456 511
 
457 512
 		// By default the editor start expanded
458 513
 		$expanded = isset($_options['toolbar_expanded']) ?
@@ -466,7 +521,10 @@  discard block
 block discarded – undo
466 521
 		$font = $GLOBALS['egw_info']['user']['preferences']['common']['rte_font'];
467 522
 		$font_size = Html\CkEditorConfig::font_size_from_prefs();
468 523
 		$font_span = '<span '.($font||$font_size?'style=\"':'').($font?'font-family:'.$font.'; ':'').($font_size?'font-size:'.$font_size.'; ':'').'\">';
469
-		if (empty($font) && empty($font_size)) $font_span = '';
524
+		if (empty($font) && empty($font_size))
525
+		{
526
+			$font_span = '';
527
+		}
470 528
 
471 529
 		// we need to enable double encoding here, as ckEditor has to undo one level of encoding
472 530
 		// otherwise < and > chars eg. from html markup entered in regular (not source) input, will turn into html!
@@ -631,7 +689,10 @@  discard block
 block discarded – undo
631 689
 			$accesskey = '';
632 690
 			$label_u = $label;
633 691
 		}
634
-		if ($onClick) $options .= ' onclick="'.str_replace('"','\\"',$onClick).'"';
692
+		if ($onClick)
693
+		{
694
+			$options .= ' onclick="'.str_replace('"','\\"',$onClick).'"';
695
+		}
635 696
 
636 697
 		// add default background-image to get et2 like buttons
637 698
 		foreach(self::$default_background_images as $img => $reg_exp)
@@ -794,9 +855,12 @@  discard block
 block discarded – undo
794 855
 			}
795 856
 			// get the current part from the optional 'h' or 'f' prefix of the key
796 857
 			$p = $key[0] == 'h' ? self::THEAD : ($key[0] == 'f' ? self::TFOOT : self::TBODY);
797
-			if ($part < $p && ($part || $p < self::TBODY))	// add only allowed and neccessary transitions
858
+			if ($part < $p && ($part || $p < self::TBODY))
859
+			{
860
+				// add only allowed and neccessary transitions
798 861
 			{
799 862
 				if ($part) $html .= '</'.self::$part2tag[$part].">\n";
863
+			}
800 864
 				$html .= '<'.self::$part2tag[$part=$p].">\n";
801 865
 			}
802 866
 			$html .= $no_table_tr && $key == 1 ? '' : "\t<tr ".$rows['.'.$key].">\n";
@@ -824,10 +888,13 @@  discard block
 block discarded – undo
824 888
 		{
825 889
 			echo "<p>".function_backtrace()."</p>\n";
826 890
 		}
827
-		if ($part)	// close current part
891
+		if ($part)
892
+		{
893
+			// close current part
828 894
 		{
829 895
 			$html .= "</".self::$part2tag[$part].">\n";
830 896
 		}
897
+		}
831 898
 		$html .= "</table>\n";
832 899
 
833 900
 		if ($no_table_tr)
@@ -868,9 +935,18 @@  discard block
 block discarded – undo
868 935
 	static function progressbar($_percent, $_title='',$options='',$width='',$color='',$height='' )
869 936
 	{
870 937
 		$percent = (int)$_percent;
871
-		if (!$width) $width = '30px';
872
-		if (!$height)$height= '5px';
873
-		if (!$color) $color = '#D00000';
938
+		if (!$width)
939
+		{
940
+			$width = '30px';
941
+		}
942
+		if (!$height)
943
+		{
944
+			$height= '5px';
945
+		}
946
+		if (!$color)
947
+		{
948
+			$color = '#D00000';
949
+		}
874 950
 		$title = $_title ? self::htmlspecialchars($_title) : $percent.'%';
875 951
 
876 952
 		return '<div class="onlyPrint">'.$title.'</div><div class="noPrint" title="'.$title.'" '.$options.
@@ -895,17 +971,26 @@  discard block
 block discarded – undo
895 971
 	 */
896 972
 	static function image( $app,$name,$title='',$options='' )
897 973
 	{
898
-		if (is_array($name))	// menuaction and other get-vars
974
+		if (is_array($name))
975
+		{
976
+			// menuaction and other get-vars
899 977
 		{
900 978
 			$name = $GLOBALS['egw']->link('/index.php',$name);
901 979
 		}
902
-		if (substr($name,0,5) == 'vfs:/')	// vfs pseudo protocoll
980
+		}
981
+		if (substr($name,0,5) == 'vfs:/')
982
+		{
983
+			// vfs pseudo protocoll
903 984
 		{
904 985
 			$name = Framework::link(Vfs::download_url(substr($name,4)));
905 986
 		}
987
+		}
906 988
 		if ($name[0] == '/' || substr($name,0,7) == 'http://' || substr($name,0,8) == 'https://' || stripos($name,'api/thumbnail.php') )
907 989
 		{
908
-			if (!($name[0] == '/' || substr($name,0,7) == 'http://' || substr($name,0,8) == 'https://')) $name = '/'.$name;
990
+			if (!($name[0] == '/' || substr($name,0,7) == 'http://' || substr($name,0,8) == 'https://'))
991
+			{
992
+				$name = '/'.$name;
993
+			}
909 994
 			$url = $name;
910 995
 		}
911 996
 		else	// no URL, so try searching the image
@@ -920,7 +1005,10 @@  discard block
 block discarded – undo
920 1005
 			{
921 1006
 				list(,$path) = explode($GLOBALS['egw_info']['server']['webserver_url'],$url);
922 1007
 
923
-				if (!is_null($path)) $path = EGW_SERVER_ROOT.$path;
1008
+				if (!is_null($path))
1009
+				{
1010
+					$path = EGW_SERVER_ROOT.$path;
1011
+				}
924 1012
 			}
925 1013
 			else
926 1014
 			{
@@ -983,10 +1071,13 @@  discard block
 block discarded – undo
983 1071
 		{
984 1072
 			$url = "/index.php?menuaction=$url";
985 1073
 		}
986
-		if ($url[0] == '/')		// link relative to eGW
1074
+		if ($url[0] == '/')
1075
+		{
1076
+			// link relative to eGW
987 1077
 		{
988 1078
 			$url = self::link($url,$vars);
989 1079
 		}
1080
+		}
990 1081
 		//echo "<p>self::a_href('".self::htmlspecialchars($content)."','$url',".print_r($vars,True).") = ".self::link($url,$vars)."</p>";
991 1082
 		return '<a href="'.self::htmlspecialchars($url).'" '.$options.'>'.$content.'</a>';
992 1083
 	}
@@ -1011,7 +1102,10 @@  discard block
 block discarded – undo
1011 1102
 	 */
1012 1103
 	static function hr($width='',$options='')
1013 1104
 	{
1014
-		if ($width) $options .= " width=\"$width\"";
1105
+		if ($width)
1106
+		{
1107
+			$options .= " width=\"$width\"";
1108
+		}
1015 1109
 
1016 1110
 		return "<hr $options />\n";
1017 1111
 	}
@@ -1027,8 +1121,14 @@  discard block
 block discarded – undo
1027 1121
 	 */
1028 1122
 	static function formatOptions($options,$names)
1029 1123
 	{
1030
-		if (!is_array($options)) $options = explode(',',$options);
1031
-		if (!is_array($names))   $names   = explode(',',$names);
1124
+		if (!is_array($options))
1125
+		{
1126
+			$options = explode(',',$options);
1127
+		}
1128
+		if (!is_array($names))
1129
+		{
1130
+			$names   = explode(',',$names);
1131
+		}
1032 1132
 
1033 1133
 		foreach($options as $n => $val)
1034 1134
 		{
@@ -1146,9 +1246,15 @@  discard block
 block discarded – undo
1146 1246
 			Framework::includeCSS('/api/js/dhtmlxtree/codebase/dhtmlxtree.css');
1147 1247
 			Framework::includeJS('/api/js/dhtmlxtree/codebase/dhtmlxcommon.js');
1148 1248
 			Framework::includeJS('/api/js/dhtmlxtree/sources/dhtmlxtree.js');
1149
-			if ($autoLoading && $dataMode != 'XML') Framework::includeJS('/api/js/dhtmlxtree/sources/ext/dhtmlxtree_json.js');
1249
+			if ($autoLoading && $dataMode != 'XML')
1250
+			{
1251
+				Framework::includeJS('/api/js/dhtmlxtree/sources/ext/dhtmlxtree_json.js');
1252
+			}
1150 1253
 			$tree_initialised = true;
1151
-			if (!$_folders && !$autoLoading) return null;
1254
+			if (!$_folders && !$autoLoading)
1255
+			{
1256
+				return null;
1257
+			}
1152 1258
 		}
1153 1259
 		$html = self::div("\n",'id="'.$tree.'"',$_divClass).$html;
1154 1260
 		$html .= "<script type='text/javascript'>\n";
@@ -1156,7 +1262,10 @@  discard block
 block discarded – undo
1156 1262
 		$html .= "egw_LAB.wait(function() {";
1157 1263
 		$html .= "$tree = new"." dhtmlXTreeObject('$tree','100%','100%',0);\n";
1158 1264
 		$html .= "$tree.parentObject.style.overflow='auto';\n";	// dhtmlXTree constructor has hidden hardcoded
1159
-		if (Translation::charset() == 'utf-8') $html .= "if ($tree.setEscapingMode) $tree.setEscapingMode('utf8');\n";
1265
+		if (Translation::charset() == 'utf-8')
1266
+		{
1267
+			$html .= "if ($tree.setEscapingMode) $tree.setEscapingMode('utf8');\n";
1268
+		}
1160 1269
 		$html .= "$tree.setImagePath('$folderImageDir/dhtmlxtree/');\n";
1161 1270
 
1162 1271
 		if($_onCheckHandler)
@@ -1165,19 +1274,28 @@  discard block
 block discarded – undo
1165 1274
 			$html .= "$tree.setOnCheckHandler('$_onCheckHandler');\n";
1166 1275
 		}
1167 1276
 
1168
-		if ($dragndrop) $html .= "$tree.enableDragAndDrop(true);\n";
1277
+		if ($dragndrop)
1278
+		{
1279
+			$html .= "$tree.enableDragAndDrop(true);\n";
1280
+		}
1169 1281
 
1170 1282
 		if ($autoLoading)
1171 1283
 		{
1172 1284
 			$autoLoading = is_array($autoLoading) ?
1173 1285
 				Framework::link('/index.php',$autoLoading) : Framework::link($autoLoading);
1174 1286
 			$html .= "$tree.setXMLAutoLoading('$autoLoading');\n";
1175
-			if ($dataMode != 'XML') $html .= "$tree.setDataMode('$dataMode');\n";
1287
+			if ($dataMode != 'XML')
1288
+			{
1289
+				$html .= "$tree.setDataMode('$dataMode');\n";
1290
+			}
1176 1291
 
1177 1292
 			// if no folders given, use xml url to load root, incl. setting of selected folder
1178 1293
 			if (!$_folders)
1179 1294
 			{
1180
-				if ($_selected) $autoLoading .= '&selected='.urlencode($_selected);
1295
+				if ($_selected)
1296
+				{
1297
+					$autoLoading .= '&selected='.urlencode($_selected);
1298
+				}
1181 1299
 				unset($_selected);
1182 1300
 				$html .= "$tree.loadXML('$autoLoading');\n";
1183 1301
 				$html .= "});";
@@ -1222,7 +1340,10 @@  discard block
 block discarded – undo
1222 1340
 		else
1223 1341
 		{
1224 1342
 			// evtl. remove leading delimiter
1225
-			if ($_selected[0] == $delimiter) $_selected = substr($_selected,1);
1343
+			if ($_selected[0] == $delimiter)
1344
+			{
1345
+				$_selected = substr($_selected,1);
1346
+			}
1226 1347
 
1227 1348
 			$n = 0;
1228 1349
 			foreach($_folders as $path => $data)
@@ -1251,22 +1372,37 @@  discard block
 block discarded – undo
1251 1372
 					$image1 = $image2 = $image3 = "'".$data['image']."'";
1252 1373
 				}
1253 1374
 				// evtl. remove leading delimiter
1254
-				if ($path[0] == $delimiter) $path = substr($path,1);
1375
+				if ($path[0] == $delimiter)
1376
+				{
1377
+					$path = substr($path,1);
1378
+				}
1255 1379
 				$folderParts = explode($delimiter,$path);
1256 1380
 
1257 1381
 				//get rightmost folderpart
1258 1382
 				$label = array_pop($folderParts);
1259
-				if (isset($data['label'])) $label = $data['label'];
1383
+				if (isset($data['label']))
1384
+				{
1385
+					$label = $data['label'];
1386
+				}
1260 1387
 
1261 1388
 				// the rest of the array is the name of the parent
1262 1389
 				$parentName = implode((array)$folderParts,$delimiter);
1263
-				if(empty($parentName)) $parentName = $top;
1390
+				if(empty($parentName))
1391
+				{
1392
+					$parentName = $top;
1393
+				}
1264 1394
 
1265 1395
 				$entryOptions = !isset($data['child']) || $data['child'] ? 'CHILD' : '';
1266
-				if ($_onCheckHandler && $_selected)	// check selected items on multi selection
1396
+				if ($_onCheckHandler && $_selected)
1397
+				{
1398
+					// check selected items on multi selection
1267 1399
 				{
1268 1400
 					if (!is_array($_selected)) $_selected = explode(',',$_selected);
1269
-					if (array_search("$path",$_selected)!==false) $entryOptions .= ',CHECKED';
1401
+				}
1402
+					if (array_search("$path",$_selected)!==false)
1403
+					{
1404
+						$entryOptions .= ',CHECKED';
1405
+					}
1270 1406
 					//echo "<p>path=$path, _selected=".print_r($_selected,true).": $entryOptions</p>\n";
1271 1407
 				}
1272 1408
 				// highlight current item
Please login to merge, or discard this patch.