Test Setup Failed
Push — 17.1 ( 8a89ce...c3d5c4 )
by Ralf
12:42
created
pixelegg/inc/class.pixelegg_framework.inc.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
 	 * Overwritten to load our slider.js
56 56
 	 *
57 57
 	 * @param array $extra
58
-	 * @return type
58
+	 * @return string|null
59 59
 	 */
60 60
 	function header(array $extra=array())
61 61
 	{
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -41,12 +41,12 @@  discard block
 block discarded – undo
41 41
 	 *
42 42
 	 * @param string $template ='pixelegg' name of the template
43 43
 	 */
44
-	function __construct($template=self::APP)
44
+	function __construct($template = self::APP)
45 45
 	{
46
-		parent::__construct($template);		// call the constructor of the extended class
46
+		parent::__construct($template); // call the constructor of the extended class
47 47
 
48 48
 		// search 'mobile' dirs first
49
-		if (Api\Header\UserAgent::mobile()) array_unshift ($this->template_dirs, 'mobile');
49
+		if (Api\Header\UserAgent::mobile()) array_unshift($this->template_dirs, 'mobile');
50 50
 	}
51 51
 
52 52
 	/**
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	 * @param array $extra
58 58
 	 * @return type
59 59
 	 */
60
-	function header(array $extra=array())
60
+	function header(array $extra = array())
61 61
 	{
62 62
 		// load our slider.js, but only if framework requested
63 63
 		if (!self::$header_done && $_GET['cd'] === 'yes' &&
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
 	{
80 80
 		if ($color[0] == '#') $color = ltrim($color, '#');
81 81
 
82
-		$R = hexdec(substr($color,0,2));
83
-		$G = hexdec(substr($color,2,2));
84
-		$B = hexdec(substr($color,4,2));
82
+		$R = hexdec(substr($color, 0, 2));
83
+		$G = hexdec(substr($color, 2, 2));
84
+		$B = hexdec(substr($color, 4, 2));
85 85
 
86 86
 		$Rs = round($R * (100 + $percent) / 100);
87 87
 		$Gs = round($G * (100 + $percent) / 100);
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	{
105 105
 		$ret = parent::_get_css();
106 106
 		// color to use
107
-		$color = str_replace('custom',$GLOBALS['egw_info']['user']['preferences']['common']['template_custom_color'],
107
+		$color = str_replace('custom', $GLOBALS['egw_info']['user']['preferences']['common']['template_custom_color'],
108 108
 			$GLOBALS['egw_info']['user']['preferences']['common']['template_color']);
109 109
 
110 110
 		// Create a dark variant of the color
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 			$loginbox_color = $color_darker;
130 130
 		}
131 131
 
132
-		if (preg_match('/^(#[0-9A-F]+|[A-Z]+)$/i',$color))	// a little xss check
132
+		if (preg_match('/^(#[0-9A-F]+|[A-Z]+)$/i', $color))	// a little xss check
133 133
 		{
134 134
 			if (!Api\Header\UserAgent::mobile())
135 135
 			{
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 	 * @param string $extra_vars for login url
207 207
 	 * @param string $change_passwd =null string with message to render input fields for password change
208 208
 	 */
209
-	function login_screen($extra_vars, $change_passwd=null)
209
+	function login_screen($extra_vars, $change_passwd = null)
210 210
 	{
211 211
 		if (empty($GLOBALS['loginscreenmessage']))
212 212
 		{
Please login to merge, or discard this patch.
Braces   +24 added lines, -6 removed lines patch added patch discarded remove patch
@@ -46,7 +46,10 @@  discard block
 block discarded – undo
46 46
 		parent::__construct($template);		// call the constructor of the extended class
47 47
 
48 48
 		// search 'mobile' dirs first
49
-		if (Api\Header\UserAgent::mobile()) array_unshift ($this->template_dirs, 'mobile');
49
+		if (Api\Header\UserAgent::mobile())
50
+		{
51
+			array_unshift ($this->template_dirs, 'mobile');
52
+		}
50 53
 	}
51 54
 
52 55
 	/**
@@ -77,7 +80,10 @@  discard block
 block discarded – undo
77 80
 	 */
78 81
 	function _color_shader($color, $percent)
79 82
 	{
80
-		if ($color[0] == '#') $color = ltrim($color, '#');
83
+		if ($color[0] == '#')
84
+		{
85
+			$color = ltrim($color, '#');
86
+		}
81 87
 
82 88
 		$R = hexdec(substr($color,0,2));
83 89
 		$G = hexdec(substr($color,2,2));
@@ -87,9 +93,18 @@  discard block
 block discarded – undo
87 93
 		$Gs = round($G * (100 + $percent) / 100);
88 94
 		$Bs = round($B * (100 + $percent) / 100);
89 95
 
90
-		if ($Rs > 255) $Rs = 255;
91
-		if ($Gs > 255) $Gs = 255;
92
-		if ($Bs > 255) $Bs = 255;
96
+		if ($Rs > 255)
97
+		{
98
+			$Rs = 255;
99
+		}
100
+		if ($Gs > 255)
101
+		{
102
+			$Gs = 255;
103
+		}
104
+		if ($Bs > 255)
105
+		{
106
+			$Bs = 255;
107
+		}
93 108
 
94 109
 		return '#'.sprintf('%02X%02X%02X', $Rs, $Gs, $Bs);
95 110
 	}
@@ -129,7 +144,9 @@  discard block
 block discarded – undo
129 144
 			$loginbox_color = $color_darker;
130 145
 		}
131 146
 
132
-		if (preg_match('/^(#[0-9A-F]+|[A-Z]+)$/i',$color))	// a little xss check
147
+		if (preg_match('/^(#[0-9A-F]+|[A-Z]+)$/i',$color))
148
+		{
149
+			// a little xss check
133 150
 		{
134 151
 			if (!Api\Header\UserAgent::mobile())
135 152
 			{
@@ -177,6 +194,7 @@  discard block
 block discarded – undo
177 194
 .ui-datepicker div.ui-timepicker-div div.ui_tpicker_hour_slider span.ui-slider-handle,
178 195
 .ui-widget-header {background-color: $sidebox_color;}
179 196
 ";
197
+		}
180 198
 				if ($GLOBALS['egw_info']['user']['preferences']['common']['theme'] == 'traditional')
181 199
 				{
182 200
 					$ret['app_css'] .= ".dialogFooterToolbar {background-color: $color !important;}";
Please login to merge, or discard this patch.
preferences/inc/class.preferences_settings.inc.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -292,7 +292,7 @@
 block discarded – undo
292 292
 	 * @param array &$sel_options
293 293
 	 * @param array &$readonlys
294 294
 	 * @param array &$types on return setting-name => setting-type
295
-	 * @param etemplate $tpl
295
+	 * @param Etemplate $tpl
296 296
 	 * @throws Api\Exception\WrongParameter
297 297
 	 * @return array content
298 298
 	 */
Please login to merge, or discard this patch.
Braces   +67 added lines, -16 removed lines patch added patch discarded remove patch
@@ -164,9 +164,15 @@  discard block
 block discarded – undo
164 164
 		$data = $this->get_content($appname, $type, $sel_options, $readonlys, $preserve['types'], $tpl);
165 165
 		$preserve['appname'] = $preserve['old_appname'] = $data['appname'];
166 166
 		$preserve['type'] = $preserve['old_type'] = $data['type'];
167
-		if (isset($old_tab)) $data['tabs'] = $old_tab;
167
+		if (isset($old_tab))
168
+		{
169
+			$data['tabs'] = $old_tab;
170
+		}
168 171
 
169
-		if ($msg) Framework::message($msg, $msg_type ? $msg_type : 'error');
172
+		if ($msg)
173
+		{
174
+			Framework::message($msg, $msg_type ? $msg_type : 'error');
175
+		}
170 176
 
171 177
 		$tpl->exec('preferences.preferences_settings.index', $data, $sel_options, $readonlys, $preserve, 2);
172 178
 	}
@@ -201,7 +207,10 @@  discard block
 block discarded – undo
201 207
 			switch((string)$types[$var])
202 208
 			{
203 209
 				case 'password':	// dont write empty password-fields
204
-					if (empty($value)) continue 2;
210
+					if (empty($value))
211
+					{
212
+						continue 2;
213
+					}
205 214
 					break;
206 215
 				case 'vfs_file':
207 216
 				case 'vfs_dir':
@@ -215,7 +224,10 @@  discard block
 block discarded – undo
215 224
 						{
216 225
 							unset($prefs[$var]);
217 226
 							// need to call preferences::delete, to also set affective prefs!
218
-							if (!$only_verify) $GLOBALS['egw']->preferences->delete($appname, $var, $type);
227
+							if (!$only_verify)
228
+							{
229
+								$GLOBALS['egw']->preferences->delete($appname, $var, $type);
230
+							}
219 231
 							continue 2;
220 232
 						}
221 233
 					}
@@ -232,7 +244,11 @@  discard block
 block discarded – undo
232 244
 						// to still allow space or comma in dirnames, we also use the trailing slash of all pathes to split
233 245
 						foreach($types[$var] == 'vfs_dir' ? array($value) : preg_split('/[,\s]+\//', $value) as $n => $dir)
234 246
 						{
235
-							if ($n) $dir = '/'.$dir;	// re-adding trailing slash removed by split
247
+							if ($n)
248
+							{
249
+								$dir = '/'.$dir;
250
+							}
251
+							// re-adding trailing slash removed by split
236 252
 							if ($dir[0] != '/' || !Vfs::stat($dir) || !Vfs::is_dir($dir))
237 253
 							{
238 254
 								$error .= ($error ? ' ' : '').lang('%1 is no existing vfs directory!',$dir);
@@ -249,19 +265,29 @@  discard block
 block discarded – undo
249 265
 
250 266
 			if (isset($value) && $value !== '' && $value !== '**NULL**' && $value !== array())
251 267
 			{
252
-				if (is_array($value) && !$settings[$var]['no_sel_options']) $value = implode(',',$value);	// multiselect
268
+				if (is_array($value) && !$settings[$var]['no_sel_options'])
269
+				{
270
+					$value = implode(',',$value);
271
+				}
272
+				// multiselect
253 273
 
254 274
 				$prefs[$var] = $value;
255 275
 
256 276
 				// need to call preferences::add, to also set affective prefs!
257
-				if (!$only_verify) $GLOBALS['egw']->preferences->add($appname, $var, $prefs[$var], $type);
277
+				if (!$only_verify)
278
+				{
279
+					$GLOBALS['egw']->preferences->add($appname, $var, $prefs[$var], $type);
280
+				}
258 281
 			}
259 282
 			else
260 283
 			{
261 284
 				unset($prefs[$var]);
262 285
 
263 286
 				// need to call preferences::delete, to also set affective prefs!
264
-				if (!$only_verify) $GLOBALS['egw']->preferences->delete($appname, $var, $type);
287
+				if (!$only_verify)
288
+				{
289
+					$GLOBALS['egw']->preferences->delete($appname, $var, $type);
290
+				}
265 291
 			}
266 292
 		}
267 293
 
@@ -281,7 +307,10 @@  discard block
 block discarded – undo
281 307
 			return $error;
282 308
 		}
283 309
 
284
-		if (!$only_verify) $GLOBALS['egw']->preferences->save_repository(True,$type);
310
+		if (!$only_verify)
311
+		{
312
+			$GLOBALS['egw']->preferences->save_repository(True,$type);
313
+		}
285 314
 
286 315
 		// certain common prefs (language, template, ...) require the session to be re-created
287 316
 		if ($appname == 'common' && !$only_verify)
@@ -319,7 +348,10 @@  discard block
 block discarded – undo
319 348
 		$tab = 'tab1';
320 349
 		foreach($this->settings as $setting)
321 350
 		{
322
-			if (!is_array($setting)) continue;
351
+			if (!is_array($setting))
352
+			{
353
+				continue;
354
+			}
323 355
 			if ($type != 'forced' && (string)$GLOBALS['egw']->preferences->forced[$appname][$setting['name']] !== '')
324 356
 			{
325 357
 				continue;	// forced preferences are not displayed, unless we edit them
@@ -341,7 +373,10 @@  discard block
 block discarded – undo
341 373
 
342 374
 				case 'notify':
343 375
 					$vars = $GLOBALS['egw']->preferences->vars;
344
-					if (is_array($setting['values'])) $vars += $setting['values'];
376
+					if (is_array($setting['values']))
377
+					{
378
+						$vars += $setting['values'];
379
+					}
345 380
 					$GLOBALS['egw']->preferences->{$attribute}[$appname][$setting['name']] =
346 381
 						$GLOBALS['egw']->preferences->lang_notify($GLOBALS['egw']->preferences->{$attribute}[$appname][$setting['name']], $vars);
347 382
 					$types[$setting['name']] = $vars;	// store vars for re-translation, instead type "notify"
@@ -383,17 +418,27 @@  discard block
 block discarded – undo
383 418
 				case 'multiselect':
384 419
 					$setting['type'] = 'select';
385 420
 					$tpl->setElementAttribute($tab.'['.$setting['name'].']', 'rows', 5);
386
-					if (!isset($setting['size'])) $setting['size'] = '5';	// old eT
421
+					if (!isset($setting['size']))
422
+					{
423
+						$setting['size'] = '5';
424
+					}
425
+					// old eT
387 426
 					break;
388 427
 				case 'color':
389 428
 					$setting['type'] = 'colorpicker';
390 429
 					break;
391 430
 				case 'date-duration':
392
-					if (!isset($setting['size'])) $setting['size'] = 'm,dhm,24,1';
431
+					if (!isset($setting['size']))
432
+					{
433
+						$setting['size'] = 'm,dhm,24,1';
434
+					}
393 435
 					$attrs = explode(',', $setting['size']);
394 436
 					foreach(array("data_format","display_format", "hours_per_day", "empty_not_0", "short_labels") as $n => $name)
395 437
 					{
396
-						if ((string)$attrs[$n] !== '') $tpl->setElementAttribute($tab.'['.$setting['name'].']', $name, $attrs[$n]);
438
+						if ((string)$attrs[$n] !== '')
439
+						{
440
+							$tpl->setElementAttribute($tab.'['.$setting['name'].']', $name, $attrs[$n]);
441
+						}
397 442
 					}
398 443
 					break;
399 444
 				case 'taglist':
@@ -435,10 +480,13 @@  discard block
 block discarded – undo
435 480
 				{
436 481
 					$default = self::get_default_label($default, $setting['values']);
437 482
 				}
438
-				if (is_array($types[$setting['name']]))	// translate the substitution names
483
+				if (is_array($types[$setting['name']]))
484
+				{
485
+					// translate the substitution names
439 486
 				{
440 487
 					$default = $GLOBALS['egw']->preferences->lang_notify($default, $types[$setting['name']]);
441 488
 				}
489
+				}
442 490
 			}
443 491
 			if ($setting['help'] && ($setting['run_lang'] || !isset($setting['run_lang'])))
444 492
 			{
@@ -550,7 +598,10 @@  discard block
 block discarded – undo
550 598
 					}
551 599
 				}
552 600
 			}
553
-			if ($lang) $def = lang($def);
601
+			if ($lang)
602
+			{
603
+				$def = lang($def);
604
+			}
554 605
 		}
555 606
 		$label = implode(', ', $labels);
556 607
 		//error_log(__METHOD__."(".array2string($default).', '.array2string($values).") returning $label");
Please login to merge, or discard this patch.
Spacing   +56 added lines, -57 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	 * @param array $content =null
46 46
 	 * @param string $msg =''
47 47
 	 */
48
-	function index(array $content=null, $msg='')
48
+	function index(array $content = null, $msg = '')
49 49
 	{
50 50
 		$tpl = new Etemplate('preferences.settings');
51 51
 		if (!is_array($content))
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 			{
71 71
 				list($button) = each($content['button']);
72 72
 				$appname = $content['old_appname'] ? $content['old_appname'] : 'common';
73
-				switch($button)
73
+				switch ($button)
74 74
 				{
75 75
 					case 'save':
76 76
 					case 'apply':
@@ -79,10 +79,10 @@  discard block
 block discarded – undo
79 79
 						{
80 80
 							throw new Api\Exception\NoPermission\Admin;
81 81
 						}
82
-						list($type,$account_id) = explode(':', $content['old_type']);
82
+						list($type, $account_id) = explode(':', $content['old_type']);
83 83
 						// merge prefs of all tabs together again
84 84
 						$prefs = array();
85
-						foreach($content as $name => $val)
85
+						foreach ($content as $name => $val)
86 86
 						{
87 87
 							if (is_array($val) && strpos($name, 'tab') === 0)
88 88
 							{
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 						$old_values = array_intersect_key($GLOBALS['egw_info']['user']['preferences']['common'], array_flip($require_reload));
101 101
 
102 102
 						$attribute = $type == 'group' ? 'user' : $type;
103
-						if (!($msg=$this->process_array($GLOBALS['egw']->preferences->$attribute, $prefs, $content['types'], $appname, $attribute)))
103
+						if (!($msg = $this->process_array($GLOBALS['egw']->preferences->$attribute, $prefs, $content['types'], $appname, $attribute)))
104 104
 						{
105 105
 							$msg_type = 'success';
106 106
 							$msg = lang('Preferences saved.');
@@ -124,14 +124,14 @@  discard block
 block discarded – undo
124 124
 						// update client-side Api\Preferences in response
125 125
 						Framework::ajax_get_preference($appname);
126 126
 				}
127
-				if (in_array($button, array('save','cancel')))
127
+				if (in_array($button, array('save', 'cancel')))
128 128
 				{
129 129
 					Api\Json\Response::get()->call('egw.message', $msg, $msg_type);
130 130
 					Framework::window_close();
131 131
 				}
132 132
 			}
133 133
 			$appname = $content['appname'] ? $content['appname'] : 'common';
134
-			list($type,$account_id) = explode(':', $content['type']);
134
+			list($type, $account_id) = explode(':', $content['type']);
135 135
 			//_debug_array($prefs);
136 136
 		}
137 137
 		if ($account_id && $account_id != $GLOBALS['egw']->preferences->get_account_id())
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 		$preserve['current_app'] = $content['current_app'];
151 151
 		$GLOBALS['egw_info']['flags']['currentapp'] = $content['current_app'] == 'common' ?
152 152
 			'preferences' : $content['current_app'];
153
-		Framework::includeCSS('preferences','app');
153
+		Framework::includeCSS('preferences', 'app');
154 154
 
155 155
 		// if not just saved, call validation before, to be able to show failed validation of current prefs
156 156
 		if (!isset($button))
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 	 * @param boolean $only_verify =false
183 183
 	 * @return string with verification error or null on success
184 184
 	 */
185
-	function process_array(array &$repository, array $values, array $types, $appname, $type, $only_verify=false)
185
+	function process_array(array &$repository, array $values, array $types, $appname, $type, $only_verify = false)
186 186
 	{
187 187
 		//fetch application specific settings from a hook
188 188
 		$settings = Api\Hooks::single(array(
@@ -195,10 +195,10 @@  discard block
 block discarded – undo
195 195
 
196 196
 		unset($prefs['']);
197 197
 		//_debug_array($values);exit;
198
-		foreach($values as $var => $value)
198
+		foreach ($values as $var => $value)
199 199
 		{
200 200
 			// type specific validation
201
-			switch((string)$types[$var])
201
+			switch ((string)$types[$var])
202 202
 			{
203 203
 				case 'password':	// dont write empty password-fields
204 204
 					if (empty($value)) continue 2;
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 						// empty is always allowed
212 212
 
213 213
 						// If forced, empty == not set
214
-						if($type == 'forced')
214
+						if ($type == 'forced')
215 215
 						{
216 216
 							unset($prefs[$var]);
217 217
 							// need to call preferences::delete, to also set affective prefs!
@@ -223,19 +223,19 @@  discard block
 block discarded – undo
223 223
 					{
224 224
 						if ($value[0] != '/' || !Vfs::stat($value) || Vfs::is_dir($value))
225 225
 						{
226
-							$error = lang('%1 is no existing vfs file!',htmlspecialchars($value));
226
+							$error = lang('%1 is no existing vfs file!', htmlspecialchars($value));
227 227
 						}
228 228
 					}
229 229
 					else
230 230
 					{
231 231
 						// split multiple comma or whitespace separated directories
232 232
 						// to still allow space or comma in dirnames, we also use the trailing slash of all pathes to split
233
-						foreach($types[$var] == 'vfs_dir' ? array($value) : preg_split('/[,\s]+\//', $value) as $n => $dir)
233
+						foreach ($types[$var] == 'vfs_dir' ? array($value) : preg_split('/[,\s]+\//', $value) as $n => $dir)
234 234
 						{
235
-							if ($n) $dir = '/'.$dir;	// re-adding trailing slash removed by split
235
+							if ($n) $dir = '/'.$dir; // re-adding trailing slash removed by split
236 236
 							if ($dir[0] != '/' || !Vfs::stat($dir) || !Vfs::is_dir($dir))
237 237
 							{
238
-								$error .= ($error ? ' ' : '').lang('%1 is no existing vfs directory!',$dir);
238
+								$error .= ($error ? ' ' : '').lang('%1 is no existing vfs directory!', $dir);
239 239
 							}
240 240
 						}
241 241
 					}
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 
250 250
 			if (isset($value) && $value !== '' && $value !== '**NULL**' && $value !== array())
251 251
 			{
252
-				if (is_array($value) && !$settings[$var]['no_sel_options']) $value = implode(',',$value);	// multiselect
252
+				if (is_array($value) && !$settings[$var]['no_sel_options']) $value = implode(',', $value); // multiselect
253 253
 
254 254
 				$prefs[$var] = $value;
255 255
 
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 		// if you return something else than False, it is treated as an error-msg and
270 270
 		// displayed to the user (the prefs are not saved)
271 271
 		//
272
-		if(($error .= Api\Hooks::single(array(
272
+		if (($error .= Api\Hooks::single(array(
273 273
 				'location' => 'verify_settings',
274 274
 				'prefs'    => &$repository[$appname],
275 275
 				'type'     => $type,
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 			return $error;
282 282
 		}
283 283
 
284
-		if (!$only_verify) $GLOBALS['egw']->preferences->save_repository(True,$type);
284
+		if (!$only_verify) $GLOBALS['egw']->preferences->save_repository(True, $type);
285 285
 
286 286
 		// certain common prefs (language, template, ...) require the session to be re-created
287 287
 		if ($appname == 'common' && !$only_verify)
@@ -317,19 +317,19 @@  discard block
 block discarded – undo
317 317
 		$sel_options = $readonlys = $content = $tabs = array();
318 318
 		// disable all but first tab and name current tab "tab1", for apps not using sections
319 319
 		$tab = 'tab1';
320
-		foreach($this->settings as $setting)
320
+		foreach ($this->settings as $setting)
321 321
 		{
322 322
 			if (!is_array($setting)) continue;
323 323
 			if ($type != 'forced' && (string)$GLOBALS['egw']->preferences->forced[$appname][$setting['name']] !== '')
324 324
 			{
325
-				continue;	// forced preferences are not displayed, unless we edit them
325
+				continue; // forced preferences are not displayed, unless we edit them
326 326
 			}
327 327
 			$types[$setting['name']] = $old_type = $setting['type'];
328 328
 
329
-			switch($old_type)
329
+			switch ($old_type)
330 330
 			{
331 331
 				case 'section':
332
-					$tab = 'tab'.(1+count($tabs));
332
+					$tab = 'tab'.(1 + count($tabs));
333 333
 					$tabs[] = array(
334 334
 						'id' => $tab,
335 335
 						'template' => 'preferences.settings.tab1',
@@ -344,24 +344,24 @@  discard block
 block discarded – undo
344 344
 					if (is_array($setting['values'])) $vars += $setting['values'];
345 345
 					$GLOBALS['egw']->preferences->{$attribute}[$appname][$setting['name']] =
346 346
 						$GLOBALS['egw']->preferences->lang_notify($GLOBALS['egw']->preferences->{$attribute}[$appname][$setting['name']], $vars);
347
-					$types[$setting['name']] = $vars;	// store vars for re-translation, instead type "notify"
347
+					$types[$setting['name']] = $vars; // store vars for re-translation, instead type "notify"
348 348
 					if ($setting['help'] && ($setting['run_lang'] || !isset($setting['run_lang'])))
349 349
 					{
350 350
 						$setting['help'] = lang($setting['help']);
351 351
 					}
352 352
 					$setting['help'] .= '<p><b>'.lang('Substitutions and their meanings:').'</b>';
353
-					foreach($vars as $var => $var_help)
353
+					foreach ($vars as $var => $var_help)
354 354
 					{
355 355
 						$lname = ($lname = lang($var)) == $var.'*' ? $var : $lname;
356 356
 						$setting['help'] .= "<br>\n".'<b>$$'.$lname.'$$</b>: '.$var_help;
357 357
 					}
358 358
 					$setting['help'] .= "</p>\n";
359
-					$setting['run_lang'] = false;	// already done now
359
+					$setting['run_lang'] = false; // already done now
360 360
 					// handle as textarea
361 361
 				case 'textarea':
362 362
 					$setting['type'] = is_a($tpl, 'etemplate') ? 'textarea' : 'textbox';
363 363
 					$tpl->setElementAttribute($tab.'['.$setting['name'].']', 'multiline', 'true');
364
-					$tpl->setElementAttribute($tab. '[' . $setting['name'] . ']','width', '99%' );
364
+					$tpl->setElementAttribute($tab.'['.$setting['name'].']', 'width', '99%');
365 365
 					// anyway setting via css: width: 99%, height: 5em
366 366
 					// for old eT use size attribute
367 367
 					if (is_a($tpl, 'etemplate') && (!empty($setting['cols']) || !empty($setting['rows'])))
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 				case 'multiselect':
384 384
 					$setting['type'] = 'select';
385 385
 					$tpl->setElementAttribute($tab.'['.$setting['name'].']', 'rows', 5);
386
-					if (!isset($setting['size'])) $setting['size'] = '5';	// old eT
386
+					if (!isset($setting['size'])) $setting['size'] = '5'; // old eT
387 387
 					break;
388 388
 				case 'color':
389 389
 					$setting['type'] = 'colorpicker';
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 				case 'date-duration':
392 392
 					if (!isset($setting['size'])) $setting['size'] = 'm,dhm,24,1';
393 393
 					$attrs = explode(',', $setting['size']);
394
-					foreach(array("data_format","display_format", "hours_per_day", "empty_not_0", "short_labels") as $n => $name)
394
+					foreach (array("data_format", "display_format", "hours_per_day", "empty_not_0", "short_labels") as $n => $name)
395 395
 					{
396 396
 						if ((string)$attrs[$n] !== '') $tpl->setElementAttribute($tab.'['.$setting['name'].']', $name, $attrs[$n]);
397 397
 					}
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 				case 'taglist':
400 400
 					if ($setting['no_sel_options'])
401 401
 					{
402
-						$tpl->setElementAttribute ($tab.'['.$setting['name'].']', 'autocomplete_url', '');
402
+						$tpl->setElementAttribute($tab.'['.$setting['name'].']', 'autocomplete_url', '');
403 403
 					}
404 404
 					break;
405 405
 			}
@@ -408,17 +408,17 @@  discard block
 block discarded – undo
408 408
 			{
409 409
 				if ($old_type != 'multiselect' && $old_type != 'notify')
410 410
 				{
411
-					switch($type)
411
+					switch ($type)
412 412
 					{
413 413
 						case 'user':
414
-							$setting['values'] = array('' => lang('Use default'))+$setting['values'];
414
+							$setting['values'] = array('' => lang('Use default')) + $setting['values'];
415 415
 							break;
416 416
 						case 'default':
417 417
 						case 'group':
418
-							$setting['values'] = array('' => lang('No default'))+$setting['values'];
418
+							$setting['values'] = array('' => lang('No default')) + $setting['values'];
419 419
 							break;
420 420
 						case 'forced';
421
-							$setting['values'] = array('**NULL**' => lang('Users choice'))+$setting['values'];
421
+							$setting['values'] = array('**NULL**' => lang('Users choice')) + $setting['values'];
422 422
 							break;
423 423
 					}
424 424
 				}
@@ -427,8 +427,7 @@  discard block
 block discarded – undo
427 427
 			if ($type == 'user')
428 428
 			{
429 429
 				$default = $GLOBALS['egw']->preferences->group[$appname][$setting['name']] ?
430
-					$GLOBALS['egw']->preferences->group[$appname][$setting['name']] :
431
-					$GLOBALS['egw']->preferences->default[$appname][$setting['name']];
430
+					$GLOBALS['egw']->preferences->group[$appname][$setting['name']] : $GLOBALS['egw']->preferences->default[$appname][$setting['name']];
432 431
 
433 432
 				// replace default value(s) for selectboxes with selectbox labels
434 433
 				if (isset($setting['values']) && is_array($setting['values']))
@@ -448,7 +447,7 @@  discard block
 block discarded – undo
448 447
 				'name' => $setting['name'],
449 448
 				'type' => $setting['type'],
450 449
 				'label' => preg_replace('|<br[ /]*>|i', "\n", $setting['label']),
451
-				'help' => lang($setting['help']),	// is html
450
+				'help' => lang($setting['help']), // is html
452 451
 				'default' => (string)$default !== '' ? lang('Default').': '.$default : null,
453 452
 				'onchange' => $setting['onchange'],
454 453
 				'attributes' => $setting['attributes']
@@ -474,7 +473,7 @@  discard block
 block discarded – undo
474 473
 
475 474
 		$content['appname'] = $appname;
476 475
 		$sel_options['appname'] = array();
477
-		foreach(Api\Hooks::implemented('settings') as $app)
476
+		foreach (Api\Hooks::implemented('settings') as $app)
478 477
 		{
479 478
 			if ($app != 'preferences' && $GLOBALS['egw_info']['user']['apps'][$app])
480 479
 			{
@@ -500,7 +499,7 @@  discard block
 block discarded – undo
500 499
 				$user_apps = $GLOBALS['egw']->acl->get_user_applications($id);
501 500
 				$sel_options['appname'] = array_intersect_key($sel_options['appname'], $user_apps);
502 501
 			}
503
-			foreach($GLOBALS['egw']->accounts->search(array('type' => 'groups', 'order' => 'account_lid')) as $account_id => $group)
502
+			foreach ($GLOBALS['egw']->accounts->search(array('type' => 'groups', 'order' => 'account_lid')) as $account_id => $group)
504 503
 			{
505 504
 				$sel_options['type']['group:'.$account_id] = lang('Preferences').' '.Api\Accounts::format_username($group['account_lid'], '', '', $account_id);
506 505
 			}
@@ -523,7 +522,7 @@  discard block
 block discarded – undo
523 522
 	 * @param boolean $lang =true
524 523
 	 * @return string comma-separated and translated labels
525 524
 	 */
526
-	protected static function get_default_label($default, array $values, $lang=true)
525
+	protected static function get_default_label($default, array $values, $lang = true)
527 526
 	{
528 527
 		// explode comma-separated multiple default values
529 528
 		if (!is_array($default) && !isset($values[$default]) && strpos($default, ',') !== false)
@@ -534,7 +533,7 @@  discard block
 block discarded – undo
534 533
 		{
535 534
 			$labels = (array)$default;
536 535
 		}
537
-		foreach($labels as &$def)
536
+		foreach ($labels as &$def)
538 537
 		{
539 538
 			if (isset($values[$def]))
540 539
 			{
@@ -542,7 +541,7 @@  discard block
 block discarded – undo
542 541
 			}
543 542
 			else	// value could be in an optgroup
544 543
 			{
545
-				foreach($values as $value)
544
+				foreach ($values as $value)
546 545
 				{
547 546
 					if (is_array($value) && !isset($value['label']) && isset($value[$def]))
548 547
 					{
@@ -568,16 +567,16 @@  discard block
 block discarded – undo
568 567
 	 * @param int|string $account_id =null account_id for user or group prefs, or "forced" or "default"
569 568
 	 * @return boolean
570 569
 	 */
571
-	protected function call_hook($appname, $type='user', $account_id=null)
570
+	protected function call_hook($appname, $type = 'user', $account_id = null)
572 571
 	{
573 572
 		$this->appname = $appname == 'common' ? 'preferences' : $appname;
574 573
 
575 574
 		// Set framework here to make sure we get the right settings for user's [newly] selected template
576 575
 		$GLOBALS['egw_info']['server']['template_set'] = $GLOBALS['egw']->preferences->data['common']['template_set'];
577 576
 		Api\Translation::add_app($this->appname);
578
-		if($this->appname != 'preferences')
577
+		if ($this->appname != 'preferences')
579 578
 		{
580
-			Api\Translation::add_app('preferences');	// we need the prefs translations too
579
+			Api\Translation::add_app('preferences'); // we need the prefs translations too
581 580
 		}
582 581
 
583 582
 		// make type available, to hooks from Egw\Applications can use it, eg. activesync
@@ -586,7 +585,7 @@  discard block
 block discarded – undo
586 585
 			'type' => $type,
587 586
 			'account_id' => $account_id,
588 587
 		);
589
-		$GLOBALS['type'] = $type;	// old global variable
588
+		$GLOBALS['type'] = $type; // old global variable
590 589
 
591 590
 		// calling app specific settings hook
592 591
 		$settings = Api\Hooks::single($hook_data, $this->appname);
@@ -595,30 +594,30 @@  discard block
 block discarded – undo
595 594
 		{
596 595
 			$this->settings = array_merge($this->settings, $settings);
597 596
 		}
598
-		elseif(isset($GLOBALS['settings']) && is_array($GLOBALS['settings']) && $GLOBALS['settings'])
597
+		elseif (isset($GLOBALS['settings']) && is_array($GLOBALS['settings']) && $GLOBALS['settings'])
599 598
 		{
600 599
 			$this->settings = array_merge($this->settings, $GLOBALS['settings']);
601 600
 		}
602 601
 		else
603 602
 		{
604
-			return False;	// no settings returned
603
+			return False; // no settings returned
605 604
 		}
606 605
 
607 606
 		// calling settings hook all apps can answer (for a specific app)
608 607
 		$hook_data['location'] = 'settings_'.$this->appname;
609
-		foreach(Api\Hooks::process($hook_data, $this->appname,true) as $settings)
608
+		foreach (Api\Hooks::process($hook_data, $this->appname, true) as $settings)
610 609
 		{
611 610
 			if (isset($settings) && is_array($settings) && $settings)
612 611
 			{
613
-				$this->settings = array_merge($this->settings,$settings);
612
+				$this->settings = array_merge($this->settings, $settings);
614 613
 			}
615 614
 		}
616 615
 		/* Remove ui-only settings */
617
-		if($this->xmlrpc)
616
+		if ($this->xmlrpc)
618 617
 		{
619
-			foreach($this->settings as $key => $valarray)
618
+			foreach ($this->settings as $key => $valarray)
620 619
 			{
621
-				if(!$valarray['xmlrpc'])
620
+				if (!$valarray['xmlrpc'])
622 621
 				{
623 622
 					unset($this->settings[$key]);
624 623
 				}
@@ -630,10 +629,10 @@  discard block
 block discarded – undo
630 629
 			 This is not handled by the hooks class and is only valid if not using xml-rpc.
631 630
 			*/
632 631
 			$tmpl_settings = EGW_SERVER_ROOT.$GLOBALS['egw']->framework->template_dir.'/hook_settings.inc.php';
633
-			if($this->appname == 'preferences' && file_exists($tmpl_settings))
632
+			if ($this->appname == 'preferences' && file_exists($tmpl_settings))
634 633
 			{
635 634
 				include($tmpl_settings);
636
-				$this->settings = array_merge($this->settings,$GLOBALS['settings']);
635
+				$this->settings = array_merge($this->settings, $GLOBALS['settings']);
637 636
 			}
638 637
 		}
639 638
 		// check if we have a default/forced value from the settings hook,
@@ -654,9 +653,9 @@  discard block
 block discarded – undo
654 653
 		}
655 654
 		if ($need_update)
656 655
 		{
657
-			$GLOBALS['egw']->preferences->save_repository(false,'default',true);
656
+			$GLOBALS['egw']->preferences->save_repository(false, 'default', true);
658 657
 		}
659
-		if($this->debug)
658
+		if ($this->debug)
660 659
 		{
661 660
 			_debug_array($this->settings);
662 661
 		}
Please login to merge, or discard this patch.
redirect.php 2 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -24,6 +24,10 @@
 block discarded – undo
24 24
 
25 25
 	if(!function_exists('html_entity_decode'))
26 26
 	{
27
+
28
+		/**
29
+		 * @param integer $quote_style
30
+		 */
27 31
 		function html_entity_decode($given_html, $quote_style = ENT_QUOTES)
28 32
 		{
29 33
 			$trans_table = array_flip(get_html_translation_table( HTML_SPECIALCHARS, $quote_style));
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -22,11 +22,11 @@  discard block
 block discarded – undo
22 22
 	  "<a href=\"$webserverURL/redirect.php?go=".htmlentities(urlencode('http://www.egroupware.org')).'">'
23 23
 	*/
24 24
 
25
-	if(!function_exists('html_entity_decode'))
25
+	if (!function_exists('html_entity_decode'))
26 26
 	{
27 27
 		function html_entity_decode($given_html, $quote_style = ENT_QUOTES)
28 28
 		{
29
-			$trans_table = array_flip(get_html_translation_table( HTML_SPECIALCHARS, $quote_style));
29
+			$trans_table = array_flip(get_html_translation_table(HTML_SPECIALCHARS, $quote_style));
30 30
 			$trans_table['&#39;'] = "'";
31 31
 			return(strtr($given_html, $trans_table));
32 32
 		}
@@ -45,17 +45,17 @@  discard block
 block discarded – undo
45 45
 
46 46
 	/* Only allow redirects from inside this eGroupware installation. */
47 47
 	$valid_referer = array();
48
-	$path = preg_replace('/\/[^\/]*$/','',$_SERVER['PHP_SELF']) . '/';
48
+	$path = preg_replace('/\/[^\/]*$/', '', $_SERVER['PHP_SELF']).'/';
49 49
 	array_push($valid_referer, $path);
50
-	array_push($valid_referer, ($_SERVER['HTTPS'] ? 'https://' : 'http://') . $_SERVER['SERVER_ADDR'] . $path);
51
-	array_push($valid_referer, ($_SERVER['HTTPS'] ? 'https://' : 'http://') . $_SERVER['SERVER_NAME'] . $path);
50
+	array_push($valid_referer, ($_SERVER['HTTPS'] ? 'https://' : 'http://').$_SERVER['SERVER_ADDR'].$path);
51
+	array_push($valid_referer, ($_SERVER['HTTPS'] ? 'https://' : 'http://').$_SERVER['SERVER_NAME'].$path);
52 52
 
53 53
 	$referrer = trim($_SERVER['HTTP_REFERER']);
54 54
 	if ((!isset($_SERVER['HTTP_REFERER'])) || (empty($referrer)))
55 55
 	{
56 56
 		echo "Only usable from within eGroupware.\n";
57 57
 	}
58
-	else if($_GET['go'])
58
+	else if ($_GET['go'])
59 59
 	{
60 60
 		$allow = false;
61 61
 		foreach ($valid_referer as $urlRoot)
@@ -69,15 +69,15 @@  discard block
 block discarded – undo
69 69
 		}
70 70
 		if ($allow)
71 71
 		{
72
-			$url= html_entity_decode(urldecode($_GET['go']));
72
+			$url = html_entity_decode(urldecode($_GET['go']));
73 73
 			unset($_GET['go']);
74 74
 			/* Only add "&" if there is something to append. */
75 75
 			if (!empty($_GET))
76 76
 			{
77
-				$url=$url."&".http_build_query($_GET);
77
+				$url = $url."&".http_build_query($_GET);
78 78
 			}
79 79
 
80
-			Header('Location: ' . html_entity_decode(urldecode($url)));
80
+			Header('Location: '.html_entity_decode(urldecode($url)));
81 81
 			exit;
82 82
 		}
83 83
 		else
Please login to merge, or discard this patch.
remote.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
  * Create a session or if the user has no account return authenticate header and 401 Unauthorized
29 29
  *
30 30
  * @param array &$account
31
- * @return int session-id
31
+ * @return string session-id
32 32
  */
33 33
 function check_access(&$account)
34 34
 {
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 {
35 35
 	if (isset($_GET['auth']))
36 36
 	{
37
-		list($_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW']) = explode(':',base64_decode($_GET['auth']),2);
37
+		list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':', base64_decode($_GET['auth']), 2);
38 38
 	}
39 39
 	return Api\Header\Authenticate::autocreate_session_callback($account);
40 40
 }
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
 		'noheader'  => True,
46 46
 		'currentapp' => preg_match('|/remote.php/webdav/apps/([A-Za-z0-9_-]+)/|', $_SERVER['REQUEST_URI'], $matches) ? $matches[1] : 'filemanager',
47 47
 		'autocreate_session_callback' => 'check_access',
48
-		'no_exception_handler' => 'basic_auth',	// we use a basic auth exception handler (sends exception message as basic auth realm)
49
-		'auth_realm' => 'EGroupware WebDAV server',	// cant use Vfs\WebDAV::REALM as autoloading and include path not yet setup!
48
+		'no_exception_handler' => 'basic_auth', // we use a basic auth exception handler (sends exception message as basic auth realm)
49
+		'auth_realm' => 'EGroupware WebDAV server', // cant use Vfs\WebDAV::REALM as autoloading and include path not yet setup!
50 50
 	)
51 51
 );
52 52
 
@@ -74,12 +74,12 @@  discard block
 block discarded – undo
74 74
 
75 75
 // temporary mount ownCloud default /clientsync as /home/$user, if not explicitly mounted
76 76
 // so ownCloud dir contains users home-dir by default
77
-if (strpos($_SERVER['REQUEST_URI'],'/remote.php/webdav/clientsync') !== false &&
78
-	($fstab=Vfs::mount()) && !isset($fstab['/clientsync']))
77
+if (strpos($_SERVER['REQUEST_URI'], '/remote.php/webdav/clientsync') !== false &&
78
+	($fstab = Vfs::mount()) && !isset($fstab['/clientsync']))
79 79
 {
80 80
 	$is_root_backup = Vfs::$is_root;
81 81
 	Vfs::$is_root = true;
82
-	$ok = Vfs::mount($url='vfs://default/home/$user', $clientsync='/clientsync', null, false);
82
+	$ok = Vfs::mount($url = 'vfs://default/home/$user', $clientsync = '/clientsync', null, false);
83 83
 	Vfs::$is_root = $is_root_backup;
84 84
 	//error_log("mounting ownCloud default '$clientsync' as '$url' ".($ok ? 'successful' : 'failed!'));
85 85
 }
Please login to merge, or discard this patch.
resources/inc/class.resources_acl_bo.inc.php 4 patches
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,7 +43,6 @@  discard block
 block discarded – undo
43 43
 	/**
44 44
 	 * Constructor
45 45
 	 *
46
-	 * @param int $user=null account_id of user whos rights to return, or null for current user
47 46
 	 * @param boolean $session
48 47
 	 */
49 48
 	function __construct($session=False, $user=null)
@@ -77,7 +76,7 @@  discard block
 block discarded – undo
77 76
 	*
78 77
 	* @author Cornelius Weiss <[email protected]>
79 78
 	* @param int $perm_type one of Acl::READ, Acl::ADD, Acl::EDIT, Acl::DELETE, self::DIRECT_BOOKING
80
-	* @param int $parent_id=0 cat_id of parent to return only children of that category
79
+	* @param int $parent_id cat_id of parent to return only children of that category
81 80
 	* @return array cat_id => cat_name
82 81
 	* TODO mark subcats and so on!
83 82
 	*/
Please login to merge, or discard this patch.
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -73,14 +73,14 @@  discard block
 block discarded – undo
73 73
 	}
74 74
 
75 75
 	/**
76
-	* get list of cats where current user has given rights
77
-	*
78
-	* @author Cornelius Weiss <[email protected]>
79
-	* @param int $perm_type one of Acl::READ, Acl::ADD, Acl::EDIT, Acl::DELETE, self::DIRECT_BOOKING
80
-	* @param int $parent_id=0 cat_id of parent to return only children of that category
81
-	* @return array cat_id => cat_name
82
-	* TODO mark subcats and so on!
83
-	*/
76
+	 * get list of cats where current user has given rights
77
+	 *
78
+	 * @author Cornelius Weiss <[email protected]>
79
+	 * @param int $perm_type one of Acl::READ, Acl::ADD, Acl::EDIT, Acl::DELETE, self::DIRECT_BOOKING
80
+	 * @param int $parent_id=0 cat_id of parent to return only children of that category
81
+	 * @return array cat_id => cat_name
82
+	 * TODO mark subcats and so on!
83
+	 */
84 84
 	function get_cats($perm_type,$parent_id=0)
85 85
 	{
86 86
 		$cats = $this->egw_cats->return_sorted_array(0,false,'','','',true,$parent_id);
@@ -105,24 +105,24 @@  discard block
 block discarded – undo
105 105
 
106 106
 
107 107
 	/**
108
-	* gets name of category
109
-	*
110
-	* @author Lukas Weiss <[email protected]>
111
-	* @param int $cat_id
112
-	* @return mixed name of category
113
-	*/
108
+	 * gets name of category
109
+	 *
110
+	 * @author Lukas Weiss <[email protected]>
111
+	 * @param int $cat_id
112
+	 * @return mixed name of category
113
+	 */
114 114
 	static public function get_cat_name($cat_id)
115 115
 	{
116 116
 		return $GLOBALS['egw']->categories->id2name($cat_id);
117 117
 	}
118 118
 
119 119
 	/**
120
-	* gets userid of admin for given category
121
-	*
122
-	* @author Cornelius Weiss <[email protected]>
123
-	* @param int $cat_id
124
-	* @return int|null userid of cat admin or null for none set
125
-	*/
120
+	 * gets userid of admin for given category
121
+	 *
122
+	 * @author Cornelius Weiss <[email protected]>
123
+	 * @param int $cat_id
124
+	 * @return int|null userid of cat admin or null for none set
125
+	 */
126 126
 	static public function get_cat_admin($cat_id)
127 127
 	{
128 128
 		$cat_rights = self::get_rights($cat_id);
@@ -194,11 +194,11 @@  discard block
 block discarded – undo
194 194
 	}
195 195
 
196 196
 	/**
197
-	* gets all rights from all user for given cat
198
-	*
199
-	* @param int $cat_id
200
-	* @return array userid => right
201
-	*/
197
+	 * gets all rights from all user for given cat
198
+	 *
199
+	 * @param int $cat_id
200
+	 * @return array userid => right
201
+	 */
202 202
 	static public function get_rights($cat_id)
203 203
 	{
204 204
 		return $GLOBALS['egw']->acl->get_all_rights('L'.$cat_id,'resources');
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -46,17 +46,17 @@  discard block
 block discarded – undo
46 46
 	 * @param int $user=null account_id of user whos rights to return, or null for current user
47 47
 	 * @param boolean $session
48 48
 	 */
49
-	function __construct($session=False, $user=null)
49
+	function __construct($session = False, $user = null)
50 50
 	{
51 51
 		$this->egw_cats = new Api\Categories($user, 'resources');
52 52
 		$this->debug = False;
53 53
 
54 54
 		//all this is only needed when called from uiacl.
55
-		if($session)
55
+		if ($session)
56 56
 		{
57 57
 			$this->read_sessiondata();
58 58
 			$this->use_session = True;
59
-			foreach(array('start','query','sort','order') as $var)
59
+			foreach (array('start', 'query', 'sort', 'order') as $var)
60 60
 			{
61 61
 				if (isset($_POST[$var]))
62 62
 				{
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 				}
69 69
 			}
70 70
 			$this->save_sessiondata();
71
-			$this->cats = $this->egw_cats->return_sorted_array(0,false,'','','',true);
71
+			$this->cats = $this->egw_cats->return_sorted_array(0, false, '', '', '', true);
72 72
 		}
73 73
 	}
74 74
 
@@ -81,18 +81,18 @@  discard block
 block discarded – undo
81 81
 	* @return array cat_id => cat_name
82 82
 	* TODO mark subcats and so on!
83 83
 	*/
84
-	function get_cats($perm_type,$parent_id=0)
84
+	function get_cats($perm_type, $parent_id = 0)
85 85
 	{
86
-		$cats = $this->egw_cats->return_sorted_array(0,false,'','','',true,$parent_id);
86
+		$cats = $this->egw_cats->return_sorted_array(0, false, '', '', '', true, $parent_id);
87 87
 		#_debug_array($cats);
88 88
 		if (!is_array($cats)) $cats = array();
89 89
 		$perm_cats = array();
90
-		foreach($cats as $key=>$cat) {
90
+		foreach ($cats as $key=>$cat) {
91 91
 			#echo "key:$key"._debug_array($value)."<br>";
92 92
 			#_debug_array($cat)."hier<br>";
93
-			if($this->is_permitted($cat['id'],$perm_type))
93
+			if ($this->is_permitted($cat['id'], $perm_type))
94 94
 			{
95
-				$s = str_repeat('&nbsp; ',$cat['level']) . stripslashes($cat['name']);
95
+				$s = str_repeat('&nbsp; ', $cat['level']).stripslashes($cat['name']);
96 96
 				if ($cat['app_name'] == 'phpgw' || $cat['owner'] == '-1')
97 97
 				{
98 98
 					$s .= ' &#9830;';
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 				$perm_cats[$cat['id']] = $s;
101 101
 			}
102 102
 		}
103
-		return isset($perm_cats)?$perm_cats:array();
103
+		return isset($perm_cats) ? $perm_cats : array();
104 104
 	}
105 105
 
106 106
 
@@ -128,13 +128,13 @@  discard block
 block discarded – undo
128 128
 		$cat_rights = self::get_rights($cat_id);
129 129
 		foreach ($cat_rights as $userid => $right)
130 130
 		{
131
-			if ($right & self::CAT_ADMIN)
131
+			if ($right&self::CAT_ADMIN)
132 132
 			{
133 133
 				return $userid;
134 134
 			}
135 135
 		}
136 136
 		// check for an inherited cat admin
137
-		if (($parent = $GLOBALS['egw']->categories->id2name($cat_id,'parent')))
137
+		if (($parent = $GLOBALS['egw']->categories->id2name($cat_id, 'parent')))
138 138
 		{
139 139
 			return self::get_cat_admin($parent);
140 140
 		}
@@ -161,10 +161,10 @@  discard block
 block discarded – undo
161 161
 		{
162 162
 			if (is_null(self::$resource_acl))
163 163
 			{
164
-				self::$resource_acl = $GLOBALS['egw']->acl->get_all_location_rights($GLOBALS['egw_info']['user']['account_id'],'resources',true);
164
+				self::$resource_acl = $GLOBALS['egw']->acl->get_all_location_rights($GLOBALS['egw_info']['user']['account_id'], 'resources', true);
165 165
 			}
166 166
 			self::$permissions[$cat_id] = (int)self::$resource_acl['L'.$cat_id];
167
-			if (($parent = $GLOBALS['egw']->categories->id2name($cat_id,'parent')))
167
+			if (($parent = $GLOBALS['egw']->categories->id2name($cat_id, 'parent')))
168 168
 			{
169 169
 				self::$permissions[$cat_id] |= self::get_permissions($parent);
170 170
 			}
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 	 * @param int $right
183 183
 	 * @return boolean user is permitted or not for right
184 184
 	 */
185
-	static public function is_permitted($cat_id,$right)
185
+	static public function is_permitted($cat_id, $right)
186 186
 	{
187 187
 		if (!isset(self::$permissions[$cat_id]))
188 188
 		{
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 		}
191 191
 		//echo "<p>".__METHOD__."($cat_id,$right) = ".self::$permissions[$cat_id]." & $right = ".(self::$permissions[$cat_id] & $right)."</p>\n";
192 192
 
193
-		return (boolean) (self::$permissions[$cat_id] & $right);
193
+		return (boolean)(self::$permissions[$cat_id]&$right);
194 194
 	}
195 195
 
196 196
 	/**
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 	*/
202 202
 	static public function get_rights($cat_id)
203 203
 	{
204
-		return $GLOBALS['egw']->acl->get_all_rights('L'.$cat_id,'resources');
204
+		return $GLOBALS['egw']->acl->get_all_rights('L'.$cat_id, 'resources');
205 205
 	}
206 206
 
207 207
 	static public function check_calendar_invite($uid)
@@ -229,14 +229,14 @@  discard block
 block discarded – undo
229 229
 			'order' => $this->order,
230 230
 			'limit' => $this->limit,
231 231
 		);
232
-		if($this->debug) { echo '<br>Read:'; _debug_array($data); }
232
+		if ($this->debug) { echo '<br>Read:'; _debug_array($data); }
233 233
 		Api\Cache::setSession('resources_acl', 'session_data', $data);
234 234
 	}
235 235
 
236 236
 	function read_sessiondata()
237 237
 	{
238 238
 		$data = Api\Cache::getSession('resources_acl', 'session_data');
239
-		if($this->debug) { echo '<br>Read:'; _debug_array($data); }
239
+		if ($this->debug) { echo '<br>Read:'; _debug_array($data); }
240 240
 
241 241
 		$this->start  = $data['start'];
242 242
 		$this->query  = $data['query'];
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 		$this->limit = $data['limit'];
246 246
 	}
247 247
 
248
-	public static function set_rights($cat_id,$read,$write,$calread,$calbook,$admin)
248
+	public static function set_rights($cat_id, $read, $write, $calread, $calbook, $admin)
249 249
 	{
250 250
 		// Clear cache
251 251
 		unset(self::$permissions[$cat_id]);
@@ -256,19 +256,19 @@  discard block
 block discarded – undo
256 256
 		$calbookcat = $calbook ? $calbook : array();
257 257
 		$admincat = $admin ? $admin : array();
258 258
 
259
-		$GLOBALS['egw']->acl->delete_repository('resources','L' . $cat_id,false);
259
+		$GLOBALS['egw']->acl->delete_repository('resources', 'L'.$cat_id, false);
260 260
 
261
-		foreach(array_unique(array_merge($readcat, $writecat, $calreadcat, $calbookcat, $admincat)) as $account_id)
261
+		foreach (array_unique(array_merge($readcat, $writecat, $calreadcat, $calbookcat, $admincat)) as $account_id)
262 262
 		{
263 263
 			$rights = false;
264
-			$rights = in_array($account_id,$readcat) ? ($rights | Acl::READ) : false;
265
-			$rights = in_array($account_id,$writecat) ? ($rights | Acl::READ | Acl::ADD | Acl::EDIT | Acl::DELETE): $rights;
266
-			$rights = in_array($account_id,$calreadcat) ? ($rights | self::CAL_READ) : $rights;
267
-			$rights = in_array($account_id,$calbookcat) ? ($rights | self::DIRECT_BOOKING | self::CAL_READ) : $rights;
268
-			$rights = in_array($account_id,$admincat) ? ($rights = 511) : $rights;
264
+			$rights = in_array($account_id, $readcat) ? ($rights|Acl::READ) : false;
265
+			$rights = in_array($account_id, $writecat) ? ($rights|Acl::READ|Acl::ADD|Acl::EDIT|Acl::DELETE) : $rights;
266
+			$rights = in_array($account_id, $calreadcat) ? ($rights|self::CAL_READ) : $rights;
267
+			$rights = in_array($account_id, $calbookcat) ? ($rights|self::DIRECT_BOOKING|self::CAL_READ) : $rights;
268
+			$rights = in_array($account_id, $admincat) ? ($rights = 511) : $rights;
269 269
 			if ($rights)
270 270
 			{
271
-				$GLOBALS['egw']->acl->add_repository('resources','L'.$cat_id,$account_id,$rights);
271
+				$GLOBALS['egw']->acl->add_repository('resources', 'L'.$cat_id, $account_id, $rights);
272 272
 			}
273 273
 		}
274 274
 	}
Please login to merge, or discard this patch.
Braces   +14 added lines, -5 removed lines patch added patch discarded remove patch
@@ -85,9 +85,13 @@  discard block
 block discarded – undo
85 85
 	{
86 86
 		$cats = $this->egw_cats->return_sorted_array(0,false,'','','',true,$parent_id);
87 87
 		#_debug_array($cats);
88
-		if (!is_array($cats)) $cats = array();
88
+		if (!is_array($cats))
89
+		{
90
+			$cats = array();
91
+		}
89 92
 		$perm_cats = array();
90
-		foreach($cats as $key=>$cat) {
93
+		foreach($cats as $key=>$cat)
94
+		{
91 95
 			#echo "key:$key"._debug_array($value)."<br>";
92 96
 			#_debug_array($cat)."hier<br>";
93 97
 			if($this->is_permitted($cat['id'],$perm_type))
@@ -208,7 +212,8 @@  discard block
 block discarded – undo
208 212
 	{
209 213
 		$resources_config = Api\Config::read('resources');
210 214
 		$resources_so = new resources_so();
211
-		if ($resources_config['bookingrequests'] === 'disabled') {
215
+		if ($resources_config['bookingrequests'] === 'disabled')
216
+		{
212 217
 			$resources_so = new resources_so();
213 218
 			$cat_id = $resources_so->get_value('cat_id', intval(substr($uid, 1)));
214 219
 			return resources_acl_bo::is_permitted($cat_id, resources_acl_bo::DIRECT_BOOKING);
@@ -229,14 +234,18 @@  discard block
 block discarded – undo
229 234
 			'order' => $this->order,
230 235
 			'limit' => $this->limit,
231 236
 		);
232
-		if($this->debug) { echo '<br>Read:'; _debug_array($data); }
237
+		if($this->debug)
238
+		{
239
+echo '<br>Read:'; _debug_array($data); }
233 240
 		Api\Cache::setSession('resources_acl', 'session_data', $data);
234 241
 	}
235 242
 
236 243
 	function read_sessiondata()
237 244
 	{
238 245
 		$data = Api\Cache::getSession('resources_acl', 'session_data');
239
-		if($this->debug) { echo '<br>Read:'; _debug_array($data); }
246
+		if($this->debug)
247
+		{
248
+echo '<br>Read:'; _debug_array($data); }
240 249
 
241 250
 		$this->start  = $data['start'];
242 251
 		$this->query  = $data['query'];
Please login to merge, or discard this patch.
resources/inc/class.resources_import_csv.inc.php 4 patches
Doc Comments   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,9 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
 	/**
30 30
 	 * imports entries according to given definition object.
31
-	 * @param resource $_stream
32
-	 * @param string $_charset
33
-	 * @param definition $_definition
31
+	 * @param importexport_definition $_definition
34 32
 	 */
35 33
 	public function init(importexport_definition $_definition ) {
36 34
 
@@ -52,7 +50,7 @@  discard block
 block discarded – undo
52 50
 	*
53 51
 	* Updates the count of actions taken
54 52
 	*
55
-	* @return boolean success
53
+	* @return null|boolean success
56 54
 	*/
57 55
 	protected function import_record(importexport_iface_egw_record &$record, &$import_csv)
58 56
 	{
Please login to merge, or discard this patch.
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -45,15 +45,15 @@  discard block
 block discarded – undo
45 45
 	}
46 46
 
47 47
 	/**
48
-	* Import a single record
49
-	*
50
-	* You don't need to worry about mappings or translations, they've been done already.
51
-	* You do need to handle the conditions and the actions taken.
52
-	*
53
-	* Updates the count of actions taken
54
-	*
55
-	* @return boolean success
56
-	*/
48
+	 * Import a single record
49
+	 *
50
+	 * You don't need to worry about mappings or translations, they've been done already.
51
+	 * You do need to handle the conditions and the actions taken.
52
+	 *
53
+	 * Updates the count of actions taken
54
+	 *
55
+	 * @return boolean success
56
+	 */
57 57
 	protected function import_record(importexport_iface_egw_record &$record, &$import_csv)
58 58
 	{
59 59
 		// Check for an un-matched accessory of, try again on just name
@@ -250,14 +250,14 @@  discard block
 block discarded – undo
250 250
 	}
251 251
 
252 252
 	/**
253
-        * Returns warnings that were encountered during importing
254
-        * Maximum of one warning message per record, but you can append if you need to
255
-        *
256
-        * @return Array (
257
-        *       record_# => warning message
258
-        *       )
259
-        */
260
-        public function get_warnings() {
253
+	 * Returns warnings that were encountered during importing
254
+	 * Maximum of one warning message per record, but you can append if you need to
255
+	 *
256
+	 * @return Array (
257
+	 *       record_# => warning message
258
+	 *       )
259
+	 */
260
+		public function get_warnings() {
261 261
 		return $this->warnings;
262 262
 	}
263 263
 }
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 /**
17 17
  * class to import resources from CSV
18 18
  */
19
-class resources_import_csv extends importexport_basic_import_csv  {
19
+class resources_import_csv extends importexport_basic_import_csv {
20 20
 
21 21
 
22 22
 	/**
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 *
25 25
 	 * @var array
26 26
 	 */
27
-	protected static $conditions = array( 'exists' );
27
+	protected static $conditions = array('exists');
28 28
 
29 29
 	/**
30 30
 	 * imports entries according to given definition object.
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 * @param string $_charset
33 33
 	 * @param definition $_definition
34 34
 	 */
35
-	public function init(importexport_definition $_definition ) {
35
+	public function init(importexport_definition $_definition) {
36 36
 
37 37
 		// fetch the resource bo
38 38
 		$this->bo = new resources_bo();
@@ -57,30 +57,30 @@  discard block
 block discarded – undo
57 57
 	protected function import_record(importexport_iface_egw_record &$record, &$import_csv)
58 58
 	{
59 59
 		// Check for an un-matched accessory of, try again on just name
60
-		if(!is_numeric($record->accessory_of))
60
+		if (!is_numeric($record->accessory_of))
61 61
 		{
62 62
 			$accessory_of = $record->accessory_of;
63 63
 
64 64
 			// Look for exact match in just name
65
-			$results = $this->bo->so->search(array('name' => $record->accessory_of),array('res_id','name'));
66
-			if(count($results) >= 1)
65
+			$results = $this->bo->so->search(array('name' => $record->accessory_of), array('res_id', 'name'));
66
+			if (count($results) >= 1)
67 67
 			{
68 68
 				// More than 1 result?  Bad names.  Pick one.
69
-				foreach($results as $result)
69
+				foreach ($results as $result)
70 70
 				{
71
-					if($result['name'] == $record->accessory_of)
71
+					if ($result['name'] == $record->accessory_of)
72 72
 					{
73 73
 						$record->accessory_of = $result['res_id'];
74 74
 						break;
75 75
 					}
76 76
 				}
77
-				if(is_numeric($record->accessory_of))
77
+				if (is_numeric($record->accessory_of))
78 78
 				{
79 79
 					// Import/Export conversion gave a warning, so cancel it
80
-					$pattern = lang('Unable to link to %1 "%2"',lang('resources'),$accessory_of) . ' - ('.lang('too many matches') . '|'.lang('no matches') . ')';
80
+					$pattern = lang('Unable to link to %1 "%2"', lang('resources'), $accessory_of).' - ('.lang('too many matches').'|'.lang('no matches').')';
81 81
 					$this->warnings[$import_csv->get_current_position()] = preg_replace($pattern, '', $this->warnings[$import_csv->get_current_position()], 1);
82 82
 					// If that was the only warning, clear it for this row
83
-					if(trim($this->warnings[$import_csv->get_current_position()]) == '')
83
+					if (trim($this->warnings[$import_csv->get_current_position()]) == '')
84 84
 					{
85 85
 						unset($this->warnings[$import_csv->get_current_position()]);
86 86
 					}
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 		// Check for a new category, it needs permissions set
93 93
 		$category = $GLOBALS['egw']->categories->read($record->cat_id);
94 94
 
95
-		if($category['last_mod'] >= $this->start_time) {
95
+		if ($category['last_mod'] >= $this->start_time) {
96 96
 			// New category.  Give read & write permissions to the current user's default group
97 97
 			$this->acl_bo->set_rights($record['cat_id'],
98 98
 				array($GLOBALS['egw_info']['user']['account_primary_group']),
@@ -104,37 +104,37 @@  discard block
 block discarded – undo
104 104
 			// Refresh ACL
105 105
 			//$GLOBALS['egw']->acl->read_repository();
106 106
 		}
107
-		if(!$record->accessory_of) $record->accessory_of = -1;
107
+		if (!$record->accessory_of) $record->accessory_of = -1;
108 108
 		//error_log(__METHOD__.__LINE__.array2string($_definition->plugin_options['conditions']));
109 109
 		if ($this->definition->plugin_options['conditions']) {
110 110
 
111
-			foreach ( $this->definition->plugin_options['conditions'] as $condition ) {
111
+			foreach ($this->definition->plugin_options['conditions'] as $condition) {
112 112
 				$results = array();
113
-				switch ( $condition['type'] ) {
113
+				switch ($condition['type']) {
114 114
 					// exists
115 115
 					case 'exists' :
116
-						if($record->{$condition['string']}) {
116
+						if ($record->{$condition['string']}) {
117 117
 							$results = $this->bo->so->search(
118
-								array( $condition['string'] => $record->{$condition['string']}),
118
+								array($condition['string'] => $record->{$condition['string']}),
119 119
 								False
120 120
 							);
121 121
 						}
122 122
 
123
-						if ( is_array( $results ) && count( array_keys( $results )) >= 1) {
123
+						if (is_array($results) && count(array_keys($results)) >= 1) {
124 124
 							// apply action to all contacts matching this exists condition
125 125
 							$action = $condition['true'];
126
-							foreach ( (array)$results as $resource ) {
126
+							foreach ((array)$results as $resource) {
127 127
 								$record->res_id = $resource['res_id'];
128
-								if ( $_definition->plugin_options['update_cats'] == 'add' ) {
129
-									if ( !is_array( $resource['cat_id'] ) ) $resource['cat_id'] = explode( ',', $resource['cat_id'] );
130
-									if ( !is_array( $record->cat_id ) ) $record->cat_id = explode( ',', $record->cat_id );
131
-									$record->cat_id = implode( ',', array_unique( array_merge( $record->cat_id, $resource['cat_id'] ) ) );
128
+								if ($_definition->plugin_options['update_cats'] == 'add') {
129
+									if (!is_array($resource['cat_id'])) $resource['cat_id'] = explode(',', $resource['cat_id']);
130
+									if (!is_array($record->cat_id)) $record->cat_id = explode(',', $record->cat_id);
131
+									$record->cat_id = implode(',', array_unique(array_merge($record->cat_id, $resource['cat_id'])));
132 132
 								}
133
-								$success = $this->action(  $action['action'], $record, $import_csv->get_current_position() );
133
+								$success = $this->action($action['action'], $record, $import_csv->get_current_position());
134 134
 							}
135 135
 						} else {
136 136
 							$action = $condition['false'];
137
-							$success = ($this->action(  $action['action'], $record, $import_csv->get_current_position() ));
137
+							$success = ($this->action($action['action'], $record, $import_csv->get_current_position()));
138 138
 						}
139 139
 						break;
140 140
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 			}
148 148
 		} else {
149 149
 			// unconditional insert
150
-			$success = $this->action( 'insert', $record, $import_csv->get_current_position() );
150
+			$success = $this->action('insert', $record, $import_csv->get_current_position());
151 151
 		}
152 152
 		return $success;
153 153
 	}
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 	 * @param importexport_iface_egw_record $record Entry record
160 160
 	 * @return bool success or not
161 161
 	 */
162
-	protected function action ( $_action, importexport_iface_egw_record &$record, $record_num = 0 ) {
162
+	protected function action($_action, importexport_iface_egw_record &$record, $record_num = 0) {
163 163
 		$_data = $record->get_record_array();
164 164
 		switch ($_action) {
165 165
 			case 'none' :
@@ -173,17 +173,17 @@  discard block
 block discarded – undo
173 173
 
174 174
 				// Fall through
175 175
 			case 'insert' :
176
-				if($_action == 'insert') {
176
+				if ($_action == 'insert') {
177 177
 					// Backend doesn't like inserting with ID specified, it can overwrite
178 178
 					unset($_data['res_id']);
179 179
 				}
180
-				if ( $this->dry_run ) {
180
+				if ($this->dry_run) {
181 181
 					//print_r($_data);
182 182
 					$this->results[$_action]++;
183 183
 					return true;
184 184
 				} else {
185
-					$result = $this->bo->save( $_data );
186
-					if($result && !is_numeric($result)) {
185
+					$result = $this->bo->save($_data);
186
+					if ($result && !is_numeric($result)) {
187 187
 						$this->errors[$record_num] = $result;
188 188
 						return false;
189 189
 					} else {
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 	 * 		preserv		=> array,
237 237
 	 * )
238 238
 	 */
239
-	public function get_options_etpl(importexport_definition &$definition=null)
239
+	public function get_options_etpl(importexport_definition &$definition = null)
240 240
 	{
241 241
 		// lets do it!
242 242
 	}
Please login to merge, or discard this patch.
Braces   +68 added lines, -28 removed lines patch added patch discarded remove patch
@@ -16,7 +16,8 @@  discard block
 block discarded – undo
16 16
 /**
17 17
  * class to import resources from CSV
18 18
  */
19
-class resources_import_csv extends importexport_basic_import_csv  {
19
+class resources_import_csv extends importexport_basic_import_csv
20
+{
20 21
 
21 22
 
22 23
 	/**
@@ -32,7 +33,8 @@  discard block
 block discarded – undo
32 33
 	 * @param string $_charset
33 34
 	 * @param definition $_definition
34 35
 	 */
35
-	public function init(importexport_definition $_definition ) {
36
+	public function init(importexport_definition $_definition )
37
+	{
36 38
 
37 39
 		// fetch the resource bo
38 40
 		$this->bo = new resources_bo();
@@ -92,7 +94,8 @@  discard block
 block discarded – undo
92 94
 		// Check for a new category, it needs permissions set
93 95
 		$category = $GLOBALS['egw']->categories->read($record->cat_id);
94 96
 
95
-		if($category['last_mod'] >= $this->start_time) {
97
+		if($category['last_mod'] >= $this->start_time)
98
+		{
96 99
 			// New category.  Give read & write permissions to the current user's default group
97 100
 			$this->acl_bo->set_rights($record['cat_id'],
98 101
 				array($GLOBALS['egw_info']['user']['account_primary_group']),
@@ -104,35 +107,53 @@  discard block
 block discarded – undo
104 107
 			// Refresh ACL
105 108
 			//$GLOBALS['egw']->acl->read_repository();
106 109
 		}
107
-		if(!$record->accessory_of) $record->accessory_of = -1;
110
+		if(!$record->accessory_of)
111
+		{
112
+			$record->accessory_of = -1;
113
+		}
108 114
 		//error_log(__METHOD__.__LINE__.array2string($_definition->plugin_options['conditions']));
109
-		if ($this->definition->plugin_options['conditions']) {
115
+		if ($this->definition->plugin_options['conditions'])
116
+		{
110 117
 
111
-			foreach ( $this->definition->plugin_options['conditions'] as $condition ) {
118
+			foreach ( $this->definition->plugin_options['conditions'] as $condition )
119
+			{
112 120
 				$results = array();
113
-				switch ( $condition['type'] ) {
121
+				switch ( $condition['type'] )
122
+				{
114 123
 					// exists
115 124
 					case 'exists' :
116
-						if($record->{$condition['string']}) {
125
+						if($record->{$condition['string']})
126
+						{
117 127
 							$results = $this->bo->so->search(
118 128
 								array( $condition['string'] => $record->{$condition['string']}),
119 129
 								False
120 130
 							);
121 131
 						}
122 132
 
123
-						if ( is_array( $results ) && count( array_keys( $results )) >= 1) {
133
+						if ( is_array( $results ) && count( array_keys( $results )) >= 1)
134
+						{
124 135
 							// apply action to all contacts matching this exists condition
125 136
 							$action = $condition['true'];
126
-							foreach ( (array)$results as $resource ) {
137
+							foreach ( (array)$results as $resource )
138
+							{
127 139
 								$record->res_id = $resource['res_id'];
128
-								if ( $_definition->plugin_options['update_cats'] == 'add' ) {
129
-									if ( !is_array( $resource['cat_id'] ) ) $resource['cat_id'] = explode( ',', $resource['cat_id'] );
130
-									if ( !is_array( $record->cat_id ) ) $record->cat_id = explode( ',', $record->cat_id );
140
+								if ( $_definition->plugin_options['update_cats'] == 'add' )
141
+								{
142
+									if ( !is_array( $resource['cat_id'] ) )
143
+									{
144
+										$resource['cat_id'] = explode( ',', $resource['cat_id'] );
145
+									}
146
+									if ( !is_array( $record->cat_id ) )
147
+									{
148
+										$record->cat_id = explode( ',', $record->cat_id );
149
+									}
131 150
 									$record->cat_id = implode( ',', array_unique( array_merge( $record->cat_id, $resource['cat_id'] ) ) );
132 151
 								}
133 152
 								$success = $this->action(  $action['action'], $record, $import_csv->get_current_position() );
134 153
 							}
135
-						} else {
154
+						}
155
+						else
156
+						{
136 157
 							$action = $condition['false'];
137 158
 							$success = ($this->action(  $action['action'], $record, $import_csv->get_current_position() ));
138 159
 						}
@@ -143,9 +164,14 @@  discard block
 block discarded – undo
143 164
 						die('condition / action not supported!!!');
144 165
 						break;
145 166
 				}
146
-				if ($action['last']) break;
167
+				if ($action['last'])
168
+				{
169
+					break;
170
+				}
147 171
 			}
148
-		} else {
172
+		}
173
+		else
174
+		{
149 175
 			// unconditional insert
150 176
 			$success = $this->action( 'insert', $record, $import_csv->get_current_position() );
151 177
 		}
@@ -159,9 +185,11 @@  discard block
 block discarded – undo
159 185
 	 * @param importexport_iface_egw_record $record Entry record
160 186
 	 * @return bool success or not
161 187
 	 */
162
-	protected function action ( $_action, importexport_iface_egw_record &$record, $record_num = 0 ) {
188
+	protected function action ( $_action, importexport_iface_egw_record &$record, $record_num = 0 )
189
+	{
163 190
 		$_data = $record->get_record_array();
164
-		switch ($_action) {
191
+		switch ($_action)
192
+		{
165 193
 			case 'none' :
166 194
 				return true;
167 195
 			case 'update' :
@@ -173,20 +201,27 @@  discard block
 block discarded – undo
173 201
 
174 202
 				// Fall through
175 203
 			case 'insert' :
176
-				if($_action == 'insert') {
204
+				if($_action == 'insert')
205
+				{
177 206
 					// Backend doesn't like inserting with ID specified, it can overwrite
178 207
 					unset($_data['res_id']);
179 208
 				}
180
-				if ( $this->dry_run ) {
209
+				if ( $this->dry_run )
210
+				{
181 211
 					//print_r($_data);
182 212
 					$this->results[$_action]++;
183 213
 					return true;
184
-				} else {
214
+				}
215
+				else
216
+				{
185 217
 					$result = $this->bo->save( $_data );
186
-					if($result && !is_numeric($result)) {
218
+					if($result && !is_numeric($result))
219
+					{
187 220
 						$this->errors[$record_num] = $result;
188 221
 						return false;
189
-					} else {
222
+					}
223
+					else
224
+					{
190 225
 						$this->results[$_action]++;
191 226
 						return true;
192 227
 					}
@@ -202,7 +237,8 @@  discard block
 block discarded – undo
202 237
 	 *
203 238
 	 * @return string name
204 239
 	 */
205
-	public static function get_name() {
240
+	public static function get_name()
241
+	{
206 242
 		return lang('Resources CSV import');
207 243
 	}
208 244
 
@@ -211,7 +247,8 @@  discard block
 block discarded – undo
211 247
 	 *
212 248
 	 * @return string descriprion
213 249
 	 */
214
-	public static function get_description() {
250
+	public static function get_description()
251
+	{
215 252
 		return lang("Imports a list of resources from a CSV file.");
216 253
 	}
217 254
 
@@ -220,7 +257,8 @@  discard block
 block discarded – undo
220 257
 	 *
221 258
 	 * @return string suffix (comma seperated)
222 259
 	 */
223
-	public static function get_filesuffix() {
260
+	public static function get_filesuffix()
261
+	{
224 262
 		return 'csv';
225 263
 	}
226 264
 
@@ -246,7 +284,8 @@  discard block
 block discarded – undo
246 284
 	 *
247 285
 	 * @return string etemplate name
248 286
 	 */
249
-	public function get_selectors_etpl() {
287
+	public function get_selectors_etpl()
288
+	{
250 289
 		// lets do it!
251 290
 	}
252 291
 
@@ -258,7 +297,8 @@  discard block
 block discarded – undo
258 297
         *       record_# => warning message
259 298
         *       )
260 299
         */
261
-        public function get_warnings() {
300
+        public function get_warnings()
301
+        {
262 302
 		return $this->warnings;
263 303
 	}
264 304
 }
Please login to merge, or discard this patch.
resources/inc/class.resources_so.inc.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
 	 *
34 34
 	 * @param string $key key of value to get
35 35
 	 * @param int $res_id resource id
36
-	 * @return mixed value of key and resource, false if key or id not found.
36
+	 * @return integer value of key and resource, false if key or id not found.
37 37
 	 */
38 38
 	function get_value($key,$res_id)
39 39
 	{
Please login to merge, or discard this patch.
Spacing   +6 added lines, -7 removed lines patch added patch discarded remove patch
@@ -22,10 +22,10 @@  discard block
 block discarded – undo
22 22
 {
23 23
 	function __construct()
24 24
 	{
25
-		parent::__construct('resources','egw_resources', 'egw_resources_extra', '',
26
-			'extra_name', 'extra_value', 'extra_id' );
25
+		parent::__construct('resources', 'egw_resources', 'egw_resources_extra', '',
26
+			'extra_name', 'extra_value', 'extra_id');
27 27
 
28
-		$this->columns_to_search = array('name','short_description','inventory_number','long_description','location');
28
+		$this->columns_to_search = array('name', 'short_description', 'inventory_number', 'long_description', 'location');
29 29
 	}
30 30
 
31 31
 	/**
@@ -35,10 +35,9 @@  discard block
 block discarded – undo
35 35
 	 * @param int $res_id resource id
36 36
 	 * @return mixed value of key and resource, false if key or id not found.
37 37
 	 */
38
-	function get_value($key,$res_id)
38
+	function get_value($key, $res_id)
39 39
 	{
40
-		return $res_id == $this->data['res_id'] ? $this->data[$key] :
41
-			$this->db->select($this->table_name,$key,array('res_id' => $res_id),__LINE__,__FILE__)->fetchColumn();
40
+		return $res_id == $this->data['res_id'] ? $this->data[$key] : $this->db->select($this->table_name, $key, array('res_id' => $res_id), __LINE__, __FILE__)->fetchColumn();
42 41
 	}
43 42
 
44 43
 	/**
@@ -90,7 +89,7 @@  discard block
 block discarded – undo
90 89
 	function save($resource)
91 90
 	{
92 91
 		$this->data = $resource;
93
-		if(parent::save() != 0) return false;
92
+		if (parent::save() != 0) return false;
94 93
 		$res_id = $this->data['res_id'];
95 94
 
96 95
 		return $res_id;
Please login to merge, or discard this patch.
Braces   +8 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,7 +51,10 @@  discard block
 block discarded – undo
51 51
 	 */
52 52
 	function read($res_id)
53 53
 	{
54
-		if (is_array($res_id) && count($res_id) == 1 && isset($res_id['res_id'])) $res_id = $res_id['res_id'];
54
+		if (is_array($res_id) && count($res_id) == 1 && isset($res_id['res_id']))
55
+		{
56
+			$res_id = $res_id['res_id'];
57
+		}
55 58
 
56 59
 		/*if (!is_array($res_id) && $res_id == $this->data['res_id'])
57 60
 		{
@@ -90,7 +93,10 @@  discard block
 block discarded – undo
90 93
 	function save($resource)
91 94
 	{
92 95
 		$this->data = $resource;
93
-		if(parent::save() != 0) return false;
96
+		if(parent::save() != 0)
97
+		{
98
+			return false;
99
+		}
94 100
 		$res_id = $this->data['res_id'];
95 101
 
96 102
 		return $res_id;
Please login to merge, or discard this patch.
resources/inc/class.resources_ui.inc.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -273,7 +273,7 @@
 block discarded – undo
273 273
 	 * @param int &$success number of succeded actions
274 274
 	 * @param int &$failed number of failed actions (not enought permissions)
275 275
 	 * @param string &$action_msg translated verb for the actions, to be used in a message like %1 timesheets 'deleted'
276
-	 * @param string/array $session_name 'index' or 'email', or array with session-data depending if we are in the main list or the popup
276
+	 * @param string $session_name 'index' or 'email', or array with session-data depending if we are in the main list or the popup
277 277
 	 * @return boolean true if all actions succeded, false otherwise
278 278
 	 */
279 279
 	function action($action,$checked,$use_all,&$success,&$failed,&$action_msg,$session_name,&$msg)
Please login to merge, or discard this patch.
Braces   +57 added lines, -16 removed lines patch added patch discarded remove patch
@@ -105,7 +105,9 @@  discard block
 block discarded – undo
105 105
 					}
106 106
 				}
107 107
 			}
108
-		} else {
108
+		}
109
+		else
110
+		{
109 111
 			$msg = $content;
110 112
 		}
111 113
 		$content = array();
@@ -140,7 +142,8 @@  discard block
 block discarded – undo
140 142
 			$content['nm']['options-filter2'][resources_bo::DELETED] = lang('Deleted');
141 143
 		}
142 144
 
143
-		if($_GET['search']) {
145
+		if($_GET['search'])
146
+		{
144 147
 			$content['nm']['search'] = $_GET['search'];
145 148
 		}
146 149
 		if($_GET['view_accs_of'])
@@ -305,7 +308,10 @@  discard block
 block discarded – undo
305 308
 				foreach($checked as $n=>$id)
306 309
 				{
307 310
 					// Extra data
308
-					if(!$id) continue;
311
+					if(!$id)
312
+					{
313
+						continue;
314
+					}
309 315
 					$resource = $this->bo->read($id);
310 316
 					$resource['deleted'] = null;
311 317
 					if($resource['accessory_of'] > 0)
@@ -337,7 +343,10 @@  discard block
 block discarded – undo
337 343
 					}
338 344
 					$success++;
339 345
 				}
340
-				if($restored_accessories) $action_msg .= ", " . lang('%1 accessories restored',$restored_accessories);
346
+				if($restored_accessories)
347
+				{
348
+					$action_msg .= ", " . lang('%1 accessories restored',$restored_accessories);
349
+				}
341 350
 				break;
342 351
 			case 'delete':
343 352
 				$action_msg = lang('deleted');
@@ -345,7 +354,10 @@  discard block
 block discarded – undo
345 354
 				foreach($checked as $n => &$id)
346 355
 				{
347 356
 					// Extra data
348
-					if(!$id) continue;
357
+					if(!$id)
358
+					{
359
+						continue;
360
+					}
349 361
 					$resource = $this->bo->read($id);
350 362
 					if($settings == 'promote')
351 363
 					{
@@ -371,7 +383,10 @@  discard block
 block discarded – undo
371 383
 
372 384
 							// Don't need to process these ones now
373 385
 							$checked_key = array_search($acc_id, $checked);
374
-							if($checked_key !== false) unset($checked[$checked_key]);
386
+							if($checked_key !== false)
387
+							{
388
+								unset($checked[$checked_key]);
389
+							}
375 390
 						}
376 391
 					}
377 392
 					else
@@ -401,7 +416,10 @@  discard block
 block discarded – undo
401 416
 						$failed++;
402 417
 					}
403 418
 				}
404
-				if($promoted_accessories) $action_msg .= ", " . lang('%1 accessories now resources',$promoted_accessories);
419
+				if($promoted_accessories)
420
+				{
421
+					$action_msg .= ", " . lang('%1 accessories now resources',$promoted_accessories);
422
+				}
405 423
 				break;
406 424
 		}
407 425
 		return $failed == 0;
@@ -443,7 +461,10 @@  discard block
 block discarded – undo
443 461
 						if($acc_count && $content['accessory_of'] != -1)
444 462
 						{
445 463
 							// Resource with accessories changed into accessory
446
-							if($acc_count) $msg = lang('%1 accessories now resources',$acc_count);
464
+							if($acc_count)
465
+							{
466
+								$msg = lang('%1 accessories now resources',$acc_count);
467
+							}
447 468
 						}
448 469
 					}
449 470
 					else
@@ -475,9 +496,18 @@  discard block
 block discarded – undo
475 496
 
476 497
 		$nm_session_data = Api\Cache::getSession('resources', 'index_nm');
477 498
 		$res_id = is_numeric($content) ? (int)$content : $content['res_id'];
478
-		if (isset($_GET['res_id'])) $res_id = $_GET['res_id'];
479
-		if (isset($nm_session_data['filter2']) && $nm_session_data['filter2'] > 0) $accessory_of = $nm_session_data['filter2'];
480
-		if (isset($_GET['accessory_of'])) $accessory_of = $_GET['accessory_of'];
499
+		if (isset($_GET['res_id']))
500
+		{
501
+			$res_id = $_GET['res_id'];
502
+		}
503
+		if (isset($nm_session_data['filter2']) && $nm_session_data['filter2'] > 0)
504
+		{
505
+			$accessory_of = $nm_session_data['filter2'];
506
+		}
507
+		if (isset($_GET['accessory_of']))
508
+		{
509
+			$accessory_of = $_GET['accessory_of'];
510
+		}
481 511
 		$content = array('res_id' => $res_id);
482 512
 		if ($res_id > 0)
483 513
 		{
@@ -487,7 +517,9 @@  discard block
 block discarded – undo
487 517
 				'to_id' => $res_id,
488 518
 				'to_app' => 'resources'
489 519
 			);
490
-		} elseif ($accessory_of > 0) {
520
+		}
521
+		elseif ($accessory_of > 0)
522
+		{
491 523
 			// Pre-set according to parent
492 524
 			$owner = $this->bo->read($accessory_of);
493 525
 			if($owner['accessory_of'] > 0)
@@ -498,16 +530,22 @@  discard block
 block discarded – undo
498 530
 			}
499 531
 			$content['cat_id'] = $owner['cat_id'];
500 532
 			$content['bookable'] = true;
501
-		} else {
533
+		}
534
+		else
535
+		{
502 536
 			// New resource
503 537
 			$content['cat_id'] = $nm_session_data['filter'];
504 538
 			$content['bookable'] = true;
505 539
 		}
506
-		if($msg) {
540
+		if($msg)
541
+		{
507 542
 			$content['msg'] = $msg;
508 543
 		}
509 544
 
510
-		if ($_GET['msg']) $content['msg'] = strip_tags($_GET['msg']);
545
+		if ($_GET['msg'])
546
+		{
547
+			$content['msg'] = strip_tags($_GET['msg']);
548
+		}
511 549
 
512 550
 		// some presetes
513 551
 		$content['resource_picture'] = $this->bo->get_picture($content['res_id'],false);
@@ -545,7 +583,10 @@  discard block
 block discarded – undo
545 583
 		);
546 584
 
547 585
 		$sel_options['accessory_of'] = array(-1 => lang('none')) + (array)$this->bo->link_query('',$search_options);
548
-		if($res_id) unset($sel_options['accessory_of'][$res_id]);
586
+		if($res_id)
587
+		{
588
+			unset($sel_options['accessory_of'][$res_id]);
589
+		}
549 590
 
550 591
 // 		$content['general|page|pictures|links'] = 'resources.edit_tabs.page';  //debug
551 592
 
Please login to merge, or discard this patch.
Spacing   +92 added lines, -93 removed lines patch added patch discarded remove patch
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
 	function __construct()
38 38
 	{
39 39
 // 		print_r($GLOBALS['egw_info']); die();
40
-		$this->tmpl	= new Etemplate('resources.show');
41
-		$this->bo	= new resources_bo();
40
+		$this->tmpl = new Etemplate('resources.show');
41
+		$this->bo = new resources_bo();
42 42
 // 		$this->calui	= CreateObject('resources.ui_calviews');
43 43
 	}
44 44
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 * @param array $content content from eTemplate callback
50 50
 	 *
51 51
 	 */
52
-	function index($content='')
52
+	function index($content = '')
53 53
 	{
54 54
 		if (is_array($content))
55 55
 		{
@@ -59,25 +59,25 @@  discard block
 block discarded – undo
59 59
 
60 60
 			if (isset($content['btn_delete_selected']))
61 61
 			{
62
-				foreach($content['nm']['rows'] as $row)
62
+				foreach ($content['nm']['rows'] as $row)
63 63
 				{
64
-					if($res_id = $row['checkbox'][0])
64
+					if ($res_id = $row['checkbox'][0])
65 65
 					{
66
-						$msg .= '<p>'. $this->bo->delete($res_id). '</p><br>';
66
+						$msg .= '<p>'.$this->bo->delete($res_id).'</p><br>';
67 67
 					}
68 68
 				}
69 69
 				return $this->index($msg);
70 70
 			}
71
-			foreach($content['nm']['rows'] as $row)
71
+			foreach ($content['nm']['rows'] as $row)
72 72
 			{
73
-				if(isset($row['delete']))
73
+				if (isset($row['delete']))
74 74
 				{
75
-					$res_id = array_search('pressed',$row['delete']);
75
+					$res_id = array_search('pressed', $row['delete']);
76 76
 					return $this->index($this->bo->delete($res_id));
77 77
 				}
78
-				if(isset($row['view_acc']))
78
+				if (isset($row['view_acc']))
79 79
 				{
80
-					$sessiondata['filter2'] = array_search('pressed',$row['view_acc']);
80
+					$sessiondata['filter2'] = array_search('pressed', $row['view_acc']);
81 81
 					Api\Cache::setSession('resources', 'index_nm', $sessiondata);
82 82
 					return $this->index();
83 83
 				}
@@ -90,18 +90,18 @@  discard block
 block discarded – undo
90 90
 				}
91 91
 				else
92 92
 				{
93
-					if ($this->action($content['nm']['action'],$content['nm']['selected'],$content['nm']['select_all'],
94
-						$success,$failed,$action_msg,'resources_index_nm',$msg))
93
+					if ($this->action($content['nm']['action'], $content['nm']['selected'], $content['nm']['select_all'],
94
+						$success, $failed, $action_msg, 'resources_index_nm', $msg))
95 95
 					{
96
-						$msg .= lang('%1 resource(s) %2',$success,$action_msg);
96
+						$msg .= lang('%1 resource(s) %2', $success, $action_msg);
97 97
 					}
98
-					elseif(empty($msg))
98
+					elseif (empty($msg))
99 99
 					{
100
-						$msg .= lang('%1 resource(s) %2, %3 failed because of insufficent rights !!!',$success,$action_msg,$failed);
100
+						$msg .= lang('%1 resource(s) %2, %3 failed because of insufficent rights !!!', $success, $action_msg, $failed);
101 101
 					}
102 102
 					else
103 103
 					{
104
-						$msg .= lang('%1 resource(s) %2, %3 failed',$success,$action_msg,$failed);
104
+						$msg .= lang('%1 resource(s) %2, %3 failed', $success, $action_msg, $failed);
105 105
 					}
106 106
 				}
107 107
 			}
@@ -111,65 +111,65 @@  discard block
 block discarded – undo
111 111
 		$content = array();
112 112
 		$content['msg'] = $msg ? $msg : $_GET['msg'];
113 113
 
114
-		$content['nm']['get_rows']		= 'resources.resources_bo.get_rows';
114
+		$content['nm']['get_rows'] = 'resources.resources_bo.get_rows';
115 115
 		$content['nm']['no_filter'] 	= False;
116 116
 		$content['nm']['filter_no_lang'] = true;
117 117
 		$content['nm']['no_cat']	= true;
118 118
 		$content['nm']['bottom_too']	= true;
119 119
 		$content['nm']['order']		= 'name';
120
-		$content['nm']['sort']		= 'ASC';
121
-		$content['nm']['store_state']	= 'get_rows';
120
+		$content['nm']['sort'] = 'ASC';
121
+		$content['nm']['store_state'] = 'get_rows';
122 122
 		$content['nm']['row_id']	= 'res_id';
123 123
 		$content['nm']['favorites'] = true;
124 124
 
125 125
 		$nm_session_data = Api\Cache::getSession('resources', 'index_nm');
126
-		if($nm_session_data)
126
+		if ($nm_session_data)
127 127
 		{
128 128
 			$content['nm'] = $nm_session_data;
129 129
 		}
130
-		$content['nm']['options-filter']= array(''=>lang('all categories'))+(array)$this->bo->acl->get_cats(Acl::READ);
130
+		$content['nm']['options-filter'] = array(''=>lang('all categories')) + (array)$this->bo->acl->get_cats(Acl::READ);
131 131
 		$content['nm']['options-filter2'] = resources_bo::$filter_options;
132
-		if(!$content['nm']['filter2'])
132
+		if (!$content['nm']['filter2'])
133 133
 		{
134 134
 			$content['nm']['filter2'] = key(resources_bo::$filter_options);
135 135
 		}
136 136
 
137 137
 		$config = Api\Config::read('resources');
138
-		if($config['history'])
138
+		if ($config['history'])
139 139
 		{
140 140
 			$content['nm']['options-filter2'][resources_bo::DELETED] = lang('Deleted');
141 141
 		}
142 142
 
143
-		if($_GET['search']) {
143
+		if ($_GET['search']) {
144 144
 			$content['nm']['search'] = $_GET['search'];
145 145
 		}
146
-		if($_GET['view_accs_of'])
146
+		if ($_GET['view_accs_of'])
147 147
 		{
148 148
 			$content['nm']['filter2'] = (int)$_GET['view_accs_of'];
149 149
 		}
150
-		$content['nm']['actions']	= $this->get_actions();
150
+		$content['nm']['actions'] = $this->get_actions();
151 151
 		$content['nm']['placeholder_actions'] = array('add');
152 152
 
153 153
 		// check if user is permitted to add resources
154 154
 		// If they can't read any categories, they won't be able to save it
155
-		if(!$this->bo->acl->get_cats(Acl::ADD) || !$this->bo->acl->get_cats(Acl::READ))
155
+		if (!$this->bo->acl->get_cats(Acl::ADD) || !$this->bo->acl->get_cats(Acl::READ))
156 156
 		{
157 157
 			$no_button['add'] = $no_button['nm']['add'] = true;
158 158
 		}
159 159
 		$no_button['back'] = true;
160 160
 		$GLOBALS['egw_info']['flags']['app_header'] = lang('resources');
161 161
 
162
-		Framework::includeJS('.','resources','resources');
162
+		Framework::includeJS('.', 'resources', 'resources');
163 163
 
164
-		if($content['nm']['filter2'] > 0)
164
+		if ($content['nm']['filter2'] > 0)
165 165
 		{
166 166
 			$master = $this->bo->so->read(array('res_id' => $content['nm']['filter2']));
167 167
 			$content['nm']['options-filter2'] = resources_bo::$filter_options + array(
168
-				$master['res_id'] => lang('accessories of') . ' ' . $master['name']
168
+				$master['res_id'] => lang('accessories of').' '.$master['name']
169 169
 			);
170
-			$content['nm']['get_rows'] 	= 'resources.resources_bo.get_rows';
171
-			$GLOBALS['egw_info']['flags']['app_header'] = lang('resources') . ' - ' . lang('accessories of '). ' '. $master['name'] .
172
-				($master['short_description'] ? ' [' . $master['short_description'] . ']' : '');
170
+			$content['nm']['get_rows'] = 'resources.resources_bo.get_rows';
171
+			$GLOBALS['egw_info']['flags']['app_header'] = lang('resources').' - '.lang('accessories of ').' '.$master['name'].
172
+				($master['short_description'] ? ' ['.$master['short_description'].']' : '');
173 173
 		}
174 174
 		$preserv = $content;
175 175
 
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 
178 178
 		Api\Cache::setSession('resources', 'index_nm', $content['nm']);
179 179
 		$this->tmpl->read('resources.show');
180
-		return $this->tmpl->exec('resources.resources_ui.index',$content,$sel_options,$no_button,$preserv);
180
+		return $this->tmpl->exec('resources.resources_ui.index', $content, $sel_options, $no_button, $preserv);
181 181
 	}
182 182
 
183 183
 	/**
@@ -194,9 +194,9 @@  discard block
 block discarded – undo
194 194
 				'allowOnMultiple' => false,
195 195
 				'url' => 'menuaction=resources.resources_ui.edit&res_id=$id',
196 196
 				'popup' => Link::get_registry('resources', 'add_popup'),
197
-				'group' => $group=1,
197
+				'group' => $group = 1,
198 198
 				'disableClass' => 'rowNoEdit',
199
-				'onExecute' => Api\Header\UserAgent::mobile()?'javaScript:app.resources.viewEntry':'',
199
+				'onExecute' => Api\Header\UserAgent::mobile() ? 'javaScript:app.resources.viewEntry' : '',
200 200
 				'mobileViewTemplate' => 'view?'.filemtime(Api\Etemplate\Widget\Template::rel2path('/resources/templates/mobile/view.xet'))
201 201
 			),
202 202
 			'add' => array(
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 	 * @param string/array $session_name 'index' or 'email', or array with session-data depending if we are in the main list or the popup
279 279
 	 * @return boolean true if all actions succeded, false otherwise
280 280
 	 */
281
-	function action($action,$checked,$use_all,&$success,&$failed,&$action_msg,$session_name,&$msg)
281
+	function action($action, $checked, $use_all, &$success, &$failed, &$action_msg, $session_name, &$msg)
282 282
 	{
283 283
 		$success = $failed = 0;
284 284
 		if ($use_all)
@@ -286,11 +286,11 @@  discard block
 block discarded – undo
286 286
 			// get the whole selection
287 287
 			$query = is_array($session_name) ? $session_name : Api\Cache::getSession($session_name, 'session_data');
288 288
 
289
-			@set_time_limit(0);                     // switch off the execution time limit, as it's for big selections to small
290
-			$query['num_rows'] = -1;        // all
291
-			$this->bo->get_rows($query,$resources,$readonlys);
289
+			@set_time_limit(0); // switch off the execution time limit, as it's for big selections to small
290
+			$query['num_rows'] = -1; // all
291
+			$this->bo->get_rows($query, $resources, $readonlys);
292 292
 			$checked = array();
293
-			foreach($resources as $resource)
293
+			foreach ($resources as $resource)
294 294
 			{
295 295
 				$checked[] = $resource['res_id'];
296 296
 			}
@@ -300,17 +300,17 @@  discard block
 block discarded – undo
300 300
 		// Dialogs to get options
301 301
 		list($action, $settings) = explode('_', $action, 2);
302 302
 
303
-		switch($action)
303
+		switch ($action)
304 304
 		{
305 305
 			case 'restore':
306 306
 				$action_msg = lang('restored');
307
-				foreach($checked as $n=>$id)
307
+				foreach ($checked as $n=>$id)
308 308
 				{
309 309
 					// Extra data
310
-					if(!$id) continue;
310
+					if (!$id) continue;
311 311
 					$resource = $this->bo->read($id);
312 312
 					$resource['deleted'] = null;
313
-					if($resource['accessory_of'] > 0)
313
+					if ($resource['accessory_of'] > 0)
314 314
 					{
315 315
 						/*
316 316
 						If restoring an accessory, and parent is deleted, and not in
@@ -318,18 +318,18 @@  discard block
 block discarded – undo
318 318
 						*/
319 319
 						$parent = $this->bo->read($resource['accessory_of']);
320 320
 						$checked_key = array_search($parent['res_id'], $checked);
321
-						if($checked_key === false && $parent['deleted'])
321
+						if ($checked_key === false && $parent['deleted'])
322 322
 						{
323 323
 							$resource['accessory_of'] = -1;
324 324
 						}
325 325
 					}
326 326
 
327 327
 					$this->bo->save($resource);
328
-					if($settings == 'accessories')
328
+					if ($settings == 'accessories')
329 329
 					{
330 330
 						// Restore accessories too
331
-						$accessories = $this->bo->get_acc_list($id,true);
332
-						foreach($accessories as $acc_id => $name)
331
+						$accessories = $this->bo->get_acc_list($id, true);
332
+						foreach ($accessories as $acc_id => $name)
333 333
 						{
334 334
 							$acc = $this->bo->read($acc_id);
335 335
 							$acc['deleted'] = null;
@@ -339,20 +339,20 @@  discard block
 block discarded – undo
339 339
 					}
340 340
 					$success++;
341 341
 				}
342
-				if($restored_accessories) $action_msg .= ", " . lang('%1 accessories restored',$restored_accessories);
342
+				if ($restored_accessories) $action_msg .= ", ".lang('%1 accessories restored', $restored_accessories);
343 343
 				break;
344 344
 			case 'delete':
345 345
 				$action_msg = lang('deleted');
346 346
 				$promoted_accessories = 0;
347
-				foreach($checked as $n => &$id)
347
+				foreach ($checked as $n => &$id)
348 348
 				{
349 349
 					// Extra data
350
-					if(!$id) continue;
350
+					if (!$id) continue;
351 351
 					$resource = $this->bo->read($id);
352
-					if($settings == 'promote')
352
+					if ($settings == 'promote')
353 353
 					{
354 354
 						// Handle a selected accessory
355
-						if($resource['accessory_of'] > 0)
355
+						if ($resource['accessory_of'] > 0)
356 356
 						{
357 357
 							$resource['accessory_of'] = -1;
358 358
 							$this->bo->save($resource);
@@ -361,8 +361,8 @@  discard block
 block discarded – undo
361 361
 						}
362 362
 
363 363
 						// Make associated accessories into resources - include deleted
364
-						$accessories = $this->bo->get_acc_list($id,true);
365
-						foreach($accessories as $acc_id => $name)
364
+						$accessories = $this->bo->get_acc_list($id, true);
365
+						foreach ($accessories as $acc_id => $name)
366 366
 						{
367 367
 							$acc = $this->bo->read($acc_id);
368 368
 							$acc['accessory_of'] = -1;
@@ -373,19 +373,19 @@  discard block
 block discarded – undo
373 373
 
374 374
 							// Don't need to process these ones now
375 375
 							$checked_key = array_search($acc_id, $checked);
376
-							if($checked_key !== false) unset($checked[$checked_key]);
376
+							if ($checked_key !== false) unset($checked[$checked_key]);
377 377
 						}
378 378
 					}
379 379
 					else
380 380
 					{
381 381
 						// Remove checked accessories, deleting resource will remove them
382 382
 						// We get an error if we try to delete them after they're gone
383
-						$accessories = $this->bo->get_acc_list($id,$resource['deleted']);
383
+						$accessories = $this->bo->get_acc_list($id, $resource['deleted']);
384 384
 
385
-						foreach($accessories as $acc_id => $name)
385
+						foreach ($accessories as $acc_id => $name)
386 386
 						{
387 387
 							$checked_key = array_search($acc_id, $checked);
388
-							if($checked_key !== false)
388
+							if ($checked_key !== false)
389 389
 							{
390 390
 								$success++;
391 391
 								unset($checked[$checked_key]);
@@ -399,11 +399,11 @@  discard block
 block discarded – undo
399 399
 					}
400 400
 					else
401 401
 					{
402
-						$msg = $error . "\n";
402
+						$msg = $error."\n";
403 403
 						$failed++;
404 404
 					}
405 405
 				}
406
-				if($promoted_accessories) $action_msg .= ", " . lang('%1 accessories now resources',$promoted_accessories);
406
+				if ($promoted_accessories) $action_msg .= ", ".lang('%1 accessories now resources', $promoted_accessories);
407 407
 				break;
408 408
 		}
409 409
 		return $failed == 0;
@@ -415,13 +415,13 @@  discard block
 block discarded – undo
415 415
 	 *
416 416
 	 * @param $content   Content from the eTemplate Exec call or id on inital call
417 417
 	 */
418
-	function edit($content=0,$accessory_of = -1)
418
+	function edit($content = 0, $accessory_of = -1)
419 419
 	{
420 420
 		if (is_array($content))
421 421
 		{
422 422
 			list($button) = @each($content['button']);
423 423
 			unset($content['button']);
424
-			switch($button)
424
+			switch ($button)
425 425
 			{
426 426
 				case 'save':
427 427
 				case 'apply':
@@ -432,20 +432,20 @@  discard block
 block discarded – undo
432 432
 // 						// links are already saved by eTemplate
433 433
 // 						unset($resource['link_to']['to_id']);
434 434
 // 					}
435
-					if($content['res_id'])
435
+					if ($content['res_id'])
436 436
 					{
437 437
 						 $acc_count = count($this->bo->get_acc_list($content['res_id']));
438 438
 					}
439 439
 					$result = $this->bo->save($content);
440 440
 
441
-					if(is_numeric($result))
441
+					if (is_numeric($result))
442 442
 					{
443
-						$msg = lang('Resource %1 saved!',$result);
443
+						$msg = lang('Resource %1 saved!', $result);
444 444
 						$content['res_id'] = $result;
445
-						if($acc_count && $content['accessory_of'] != -1)
445
+						if ($acc_count && $content['accessory_of'] != -1)
446 446
 						{
447 447
 							// Resource with accessories changed into accessory
448
-							if($acc_count) $msg = lang('%1 accessories now resources',$acc_count);
448
+							if ($acc_count) $msg = lang('%1 accessories now resources', $acc_count);
449 449
 						}
450 450
 					}
451 451
 					else
@@ -456,9 +456,9 @@  discard block
 block discarded – undo
456 456
 					break;
457 457
 				case 'delete':
458 458
 					unset($content['delete']);
459
-					if(!$this->bo->delete($content['res_id']))
459
+					if (!$this->bo->delete($content['res_id']))
460 460
 					{
461
-						$msg = lang('Resource %1 deleted!',$content['res_id']);
461
+						$msg = lang('Resource %1 deleted!', $content['res_id']);
462 462
 					}
463 463
 					else
464 464
 					{
@@ -466,9 +466,9 @@  discard block
 block discarded – undo
466 466
 						break;
467 467
 					}
468 468
 			}
469
-			Framework::refresh_opener($msg, 'resources',$content['res_id'],($button == 'delete'?'delete':'edit'));
469
+			Framework::refresh_opener($msg, 'resources', $content['res_id'], ($button == 'delete' ? 'delete' : 'edit'));
470 470
 
471
-			if($button != 'apply')
471
+			if ($button != 'apply')
472 472
 			{
473 473
 				Framework::window_close();
474 474
 			}
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
 		if ($res_id > 0)
485 485
 		{
486 486
 			$content = $this->bo->read($res_id);
487
-			$content['picture_src'] = strpos($content['picture_src'],'.') !== false ? 'gen_src' : $content['picture_src'];
487
+			$content['picture_src'] = strpos($content['picture_src'], '.') !== false ? 'gen_src' : $content['picture_src'];
488 488
 			$content['link_to'] = array(
489 489
 				'to_id' => $res_id,
490 490
 				'to_app' => 'resources'
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
 		} elseif ($accessory_of > 0) {
493 493
 			// Pre-set according to parent
494 494
 			$owner = $this->bo->read($accessory_of);
495
-			if($owner['accessory_of'] > 0)
495
+			if ($owner['accessory_of'] > 0)
496 496
 			{
497 497
 				// Accessory of accessory not allowed, grab parent resource
498 498
 				$accessory_of = $owner['accessory_of'];
@@ -505,33 +505,32 @@  discard block
 block discarded – undo
505 505
 			$content['cat_id'] = $nm_session_data['filter'];
506 506
 			$content['bookable'] = true;
507 507
 		}
508
-		if($msg) {
508
+		if ($msg) {
509 509
 			$content['msg'] = $msg;
510 510
 		}
511 511
 
512 512
 		if ($_GET['msg']) $content['msg'] = strip_tags($_GET['msg']);
513 513
 
514 514
 		// some presetes
515
-		$content['resource_picture'] = $this->bo->get_picture($content['res_id'],false);
515
+		$content['resource_picture'] = $this->bo->get_picture($content['res_id'], false);
516 516
 		// Set original size picture
517
-		$content['picture_original'] = $content['picture_src'] == 'own_src'?
518
-				'webdav.php/apps/resources/'.$content['res_id'].'/.picture.jpg': $this->bo->get_picture($content['res_id'],true);
517
+		$content['picture_original'] = $content['picture_src'] == 'own_src' ?
518
+				'webdav.php/apps/resources/'.$content['res_id'].'/.picture.jpg' : $this->bo->get_picture($content['res_id'], true);
519 519
 
520 520
 		$content['quantity'] = $content['quantity'] ? $content['quantity'] : 1;
521 521
 		$content['useable'] = $content['useable'] ? $content['useable'] : 1;
522 522
 		$content['accessory_of'] = $content['accessory_of'] ? $content['accessory_of'] : $accessory_of;
523 523
 
524
-		if($content['res_id'] && $content['accessory_of'] == -1)
524
+		if ($content['res_id'] && $content['accessory_of'] == -1)
525 525
 		{
526 526
 			$content['acc_count'] = count($this->bo->get_acc_list($content['res_id']));
527 527
 		}
528 528
 		$sel_options['status'] = resources_bo::$field2label;
529 529
 
530 530
 		//$sel_options['gen_src_list'] = $this->bo->get_genpicturelist();
531
-		$sel_options['cat_id'] =  $this->bo->acl->get_cats(Acl::ADD);
532
-		$sel_options['cat_id'] = count($sel_options['cat_id']) == 1 ? $sel_options['cat_id'] :
533
-			array('' => lang('select one')) + $sel_options['cat_id'];
534
-		if($accessory_of > 0 || $content['accessory_of'] > 0)
531
+		$sel_options['cat_id'] = $this->bo->acl->get_cats(Acl::ADD);
532
+		$sel_options['cat_id'] = count($sel_options['cat_id']) == 1 ? $sel_options['cat_id'] : array('' => lang('select one')) + $sel_options['cat_id'];
533
+		if ($accessory_of > 0 || $content['accessory_of'] > 0)
535 534
 		{
536 535
 			$content['accessory_of'] = $content['accessory_of'] ? $content['accessory_of'] : $accessory_of;
537 536
 		}
@@ -546,19 +545,19 @@  discard block
 block discarded – undo
546 545
 			)
547 546
 		);
548 547
 
549
-		$sel_options['accessory_of'] = array(-1 => lang('none')) + (array)$this->bo->link_query('',$search_options);
550
-		if($res_id) unset($sel_options['accessory_of'][$res_id]);
548
+		$sel_options['accessory_of'] = array(-1 => lang('none')) + (array)$this->bo->link_query('', $search_options);
549
+		if ($res_id) unset($sel_options['accessory_of'][$res_id]);
551 550
 
552 551
 // 		$content['general|page|pictures|links'] = 'resources.edit_tabs.page';  //debug
553 552
 
554 553
 		// Permissions
555 554
 		$read_only = array();
556
-		if($res_id && !$this->bo->acl->is_permitted($content['cat_id'],Acl::EDIT))
555
+		if ($res_id && !$this->bo->acl->is_permitted($content['cat_id'], Acl::EDIT))
557 556
 		{
558 557
 			$read_only['__ALL__'] = true;
559 558
 		}
560 559
 		$config = Api\Config::read('resources');
561
-		if(!$this->bo->acl->is_permitted($content['cat_id'],Acl::DELETE) ||
560
+		if (!$this->bo->acl->is_permitted($content['cat_id'], Acl::DELETE) ||
562 561
 			($content['deleted'] && !$GLOBALS['egw_info']['user']['apps']['admin'] && $config['history'] == 'history'))
563 562
 		{
564 563
 			$read_only['delete'] = true;
@@ -566,19 +565,19 @@  discard block
 block discarded – undo
566 565
 
567 566
 		// Can't make a resource with accessories an accessory
568 567
 		$read_only['accessory_of'] = $content['acc_count'];
569
-		if($read_only['accessory_of'])
568
+		if ($read_only['accessory_of'])
570 569
 		{
571 570
 			$content['accessory_label'] = lang('Remove accessories before changing Accessory of');
572 571
 		}
573 572
 
574 573
 		// Disable custom tab if there are no custom fields defined
575
-		$read_only['tabs']['custom'] = !(Api\Storage\Customfields::get('resources',true));
576
-		$read_only['tabs']['history'] = ($content['history']['id'] != 0?false:true);
574
+		$read_only['tabs']['custom'] = !(Api\Storage\Customfields::get('resources', true));
575
+		$read_only['tabs']['history'] = ($content['history']['id'] != 0 ?false:true);
577 576
 
578 577
 		$preserv = $content;
579 578
 
580 579
 		$this->tmpl->read('resources.edit');
581
-		return $this->tmpl->exec('resources.resources_ui.edit',$content,$sel_options,$read_only,$preserv,2);
580
+		return $this->tmpl->exec('resources.resources_ui.edit', $content, $sel_options, $read_only, $preserv, 2);
582 581
 	}
583 582
 
584 583
 }
Please login to merge, or discard this patch.
setup/check_install.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -316,6 +316,7 @@
 block discarded – undo
316 316
  * Check if given package is installed via composer in EGroupware's vendor directory
317 317
  *
318 318
  * @param string $package package-name in composer notation eg. "pear-pear.horde.org/Horde_Imap_Client" or "pear-pear.php.net/Net_Sieve"
319
+ * @return string|null
319 320
  */
320 321
 function composer_check($package)
321 322
 {
Please login to merge, or discard this patch.
Spacing   +119 added lines, -123 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 use EGroupware\Api;
14 14
 
15 15
 $run_by_webserver = !!$_SERVER['PHP_SELF'];
16
-$is_windows = strtoupper(substr(PHP_OS,0,3)) == 'WIN';
16
+$is_windows = strtoupper(substr(PHP_OS, 0, 3)) == 'WIN';
17 17
 
18 18
 if ($run_by_webserver)
19 19
 {
@@ -41,9 +41,9 @@  discard block
 block discarded – undo
41 41
 	$error_icon = '*** Error: ';
42 42
 	$warning_icon = '!!! Warning: ';
43 43
 
44
-	function lang($msg,$arg1=NULL,$arg2=NULL,$arg3=NULL,$arg4=NULL)
44
+	function lang($msg, $arg1 = NULL, $arg2 = NULL, $arg3 = NULL, $arg4 = NULL)
45 45
 	{
46
-		return is_null($arg1) ? $msg : str_replace(array('%1','%2','%3','%4'),array($arg1,$arg2,$arg3,$arg4),$msg);
46
+		return is_null($arg1) ? $msg : str_replace(array('%1', '%2', '%3', '%4'), array($arg1, $arg2, $arg3, $arg4), $msg);
47 47
 	}
48 48
 }
49 49
 
@@ -79,13 +79,13 @@  discard block
 block discarded – undo
79 79
 		'func' => 'php_ini_check',
80 80
 		'value' => 0,
81 81
 		'verbose_value' => 'Off',
82
-		'warning' => lang('%1 is set to %2. This is NOT recommeded for a production system, as displayed error messages can contain passwords or other sensitive information!','display_errors',ini_get('display_errors')),
82
+		'warning' => lang('%1 is set to %2. This is NOT recommeded for a production system, as displayed error messages can contain passwords or other sensitive information!', 'display_errors', ini_get('display_errors')),
83 83
 	),
84 84
 	'memory_limit' => array(
85 85
 		'func' => 'php_ini_check',
86 86
 		'value' => '128M',
87 87
 		'check' => '>=',
88
-		'error' => lang('memory_limit is set to less than %1: some applications of EGroupware need more than the recommend 8M, expect occasional failures','24M'),
88
+		'error' => lang('memory_limit is set to less than %1: some applications of EGroupware need more than the recommend 8M, expect occasional failures', '24M'),
89 89
 		'change' => 'memory_limit = 24M'
90 90
 	),
91 91
 	'max_execution_time' => array(
@@ -105,14 +105,14 @@  discard block
 block discarded – undo
105 105
 		'func' => 'php_ini_check',
106 106
 		'value' => '8M',
107 107
 		'check' => '>=',
108
-		'error' => lang('%1 is set to %2, you will NOT be able to upload or attach files bigger then that!','upload_max_filesize',ini_get('upload_max_filesize')),
108
+		'error' => lang('%1 is set to %2, you will NOT be able to upload or attach files bigger then that!', 'upload_max_filesize', ini_get('upload_max_filesize')),
109 109
 		'change' => 'upload_max_filesize = 8M'
110 110
 	),
111 111
 	'post_max_size' => array(
112 112
 		'func' => 'php_ini_check',
113 113
 		'value' => '8M',
114 114
 		'check' => '>=',
115
-		'error' => lang('%1 is set to %2, you will NOT be able to upload or attach files bigger then that!','post_max_size',ini_get('max_post_size')),
115
+		'error' => lang('%1 is set to %2, you will NOT be able to upload or attach files bigger then that!', 'post_max_size', ini_get('max_post_size')),
116 116
 		'change' => 'post_max_size = 8M'
117 117
 	),
118 118
 	'allow_url_fopen' => array(
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 		'verbose_value' => '"System/Localtime"',
139 139
 		'check' => '!=',
140 140
 		'error' => lang('No VALID timezone set! ("%1" is NOT sufficient, you have to use a timezone identifer like "%2", see %3full list of valid identifers%4)',
141
-			'System/Localtime','Europe/Berlin','<a href="http://www.php.net/manual/en/timezones.php" target="_blank">','</a>'),
141
+			'System/Localtime', 'Europe/Berlin', '<a href="http://www.php.net/manual/en/timezones.php" target="_blank">', '</a>'),
142 142
 	),
143 143
 	'pdo' => array(
144 144
 		'func' => 'extension_check',
@@ -146,19 +146,19 @@  discard block
 block discarded – undo
146 146
 	),
147 147
 	'mysqli' => array(
148 148
 		'func' => 'extension_check',
149
-		'warning' => lang('The %1 extension is needed, if you plan to use a %2 database.','mysql','MySQL')
149
+		'warning' => lang('The %1 extension is needed, if you plan to use a %2 database.', 'mysql', 'MySQL')
150 150
 	),
151 151
 	'pdo_mysql' => array(
152 152
 		'func' => 'extension_check',
153
-		'warning' => lang('The %1 extension is needed, if you plan to use a %2 database.','pdo_mysql','MySQL')
153
+		'warning' => lang('The %1 extension is needed, if you plan to use a %2 database.', 'pdo_mysql', 'MySQL')
154 154
 	),
155 155
 	'pgsql' => array(
156 156
 		'func' => 'extension_check',
157
-		'warning' => lang('The %1 extension is needed, if you plan to use a %2 database.','pgsql','pgSQL')
157
+		'warning' => lang('The %1 extension is needed, if you plan to use a %2 database.', 'pgsql', 'pgSQL')
158 158
 	),
159 159
 	'pdo_pgsql' => array(
160 160
 		'func' => 'extension_check',
161
-		'warning' => lang('The %1 extension is needed, if you plan to use a %2 database.','pdo_pgsql','pgSQL')
161
+		'warning' => lang('The %1 extension is needed, if you plan to use a %2 database.', 'pdo_pgsql', 'pgSQL')
162 162
 	),
163 163
 	/* disable checks for other database extensions, as we are not really supporting them anymore
164 164
 	'mssql' => array(
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 	realpath('..') => array(
203 203
 		'func' => 'permission_check',
204 204
 		'is_world_writable' => False,
205
-		'only_if_exists' => true,	// quitens "file does not exist" for doc symlinks in Debian to files outside open_basedir
205
+		'only_if_exists' => true, // quitens "file does not exist" for doc symlinks in Debian to files outside open_basedir
206 206
 		'recursiv' => True
207 207
 	),
208 208
 	realpath('../header.inc.php') => array(
@@ -240,10 +240,10 @@  discard block
 block discarded – undo
240 240
 	$sp_visible = true;
241 241
 	if (($open_basedir = ini_get('open_basedir')) && $open_basedir != 'none')
242 242
 	{
243
-		foreach(explode(PATH_SEPARATOR,$open_basedir) as $dir)
243
+		foreach (explode(PATH_SEPARATOR, $open_basedir) as $dir)
244 244
 		{
245 245
 			$dir = realpath($dir);
246
-			if (($sp_visible = substr($session_path,0,strlen($dir)) == $dir)) break;
246
+			if (($sp_visible = substr($session_path, 0, strlen($dir)) == $dir)) break;
247 247
 		}
248 248
 	}
249 249
 	if ($sp_visible)	// only check if session_save_path is visible by webserver
@@ -251,13 +251,13 @@  discard block
 block discarded – undo
251 251
 		$checks[$session_path] = array(
252 252
 			'func' => 'permission_check',
253 253
 			'is_writable' => true,
254
-			'msg' => lang("Checking if php.ini setting session.save_path='%1' is writable by the webserver",session_save_path()),
254
+			'msg' => lang("Checking if php.ini setting session.save_path='%1' is writable by the webserver", session_save_path()),
255 255
 			'error' => lang('You will NOT be able to log into EGroupware using PHP sessions: "session could not be verified" !!!'),
256 256
 		);
257 257
 	}
258 258
 }
259 259
 $setup_info = $GLOBALS['egw_setup']->detection->get_versions();
260
-foreach($setup_info as $app => $app_data)
260
+foreach ($setup_info as $app => $app_data)
261 261
 {
262 262
 	if (!isset($app_data['check_install'])) continue;
263 263
 
@@ -265,9 +265,9 @@  discard block
 block discarded – undo
265 265
 	{
266 266
 		if (isset($checks[$name]))
267 267
 		{
268
-			if ($checks[$name] == $data) continue;	// identical check --> ignore it
268
+			if ($checks[$name] == $data) continue; // identical check --> ignore it
269 269
 
270
-			if ($data['func'] == 'pear_check' || in_array($data['func'],array('extension_check','php_ini_check')) && !isset($data['warning']))
270
+			if ($data['func'] == 'pear_check' || in_array($data['func'], array('extension_check', 'php_ini_check')) && !isset($data['warning']))
271 271
 			{
272 272
 				if (isset($checks[$name]['from']) && $checks[$name]['from'] && !is_array($checks[$name]['from']))
273 273
 				{
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 				}
276 276
 				if (!isset($data['from'])) $data['from'] = $app;
277 277
 				if (!isset($checks[$name]['from']) || !is_array($checks[$name]['from'])) $checks[$name]['from'] = array();
278
-				if (!in_array($data['from'],$checks[$name]['from'])) $checks[$name]['from'][] = $data['from'];
278
+				if (!in_array($data['from'], $checks[$name]['from'])) $checks[$name]['from'][] = $data['from'];
279 279
 			}
280 280
 			else
281 281
 			{
@@ -291,9 +291,9 @@  discard block
 block discarded – undo
291 291
 	}
292 292
 }
293 293
 $sorted_checks = array();
294
-foreach(array('php_version','php_ini_check','extension_check','pear_check','gd_check','permission_check') as $func)
294
+foreach (array('php_version', 'php_ini_check', 'extension_check', 'pear_check', 'gd_check', 'permission_check') as $func)
295 295
 {
296
-	foreach($checks as $name => $data)
296
+	foreach ($checks as $name => $data)
297 297
 	{
298 298
 		if ($data['func'] == $func)
299 299
 		{
@@ -304,15 +304,15 @@  discard block
 block discarded – undo
304 304
 }
305 305
 if ($checks) $sorted_checks += $checks;
306 306
 
307
-function php_version($name,$args)
307
+function php_version($name, $args)
308 308
 {
309 309
 	global $passed_icon, $error_icon;
310
-	unset($name);	// not used, but required by function signature
310
+	unset($name); // not used, but required by function signature
311 311
 
312
-	$version_ok = version_compare(phpversion(),$args['value']) >= 0;
312
+	$version_ok = version_compare(phpversion(), $args['value']) >= 0;
313 313
 
314 314
 	echo '<div>'.($version_ok ? $passed_icon : $error_icon).' <span'.($version_ok ? '' : ' class="setup_error"').'>'.
315
-		lang('Checking required PHP version %1 (recommended %2)',$args['verbose_value'],$args['recommended']).': '.
315
+		lang('Checking required PHP version %1 (recommended %2)', $args['verbose_value'], $args['recommended']).': '.
316 316
 		phpversion().' ==> '.($version_ok ? lang('True') : lang('False'))."</span></div>\n";
317 317
 }
318 318
 
@@ -323,13 +323,13 @@  discard block
 block discarded – undo
323 323
  */
324 324
 function composer_check($package)
325 325
 {
326
-	static $installed=null;
326
+	static $installed = null;
327 327
 	if (!isset($installed))
328 328
 	{
329 329
 		$installed = array();
330
-		if (file_exists(EGW_SERVER_ROOT.'/vendor') && file_exists($json=EGW_SERVER_ROOT.'/vendor/composer/installed.json'))
330
+		if (file_exists(EGW_SERVER_ROOT.'/vendor') && file_exists($json = EGW_SERVER_ROOT.'/vendor/composer/installed.json'))
331 331
 		{
332
-			foreach(json_decode(file_get_contents($json), true) as $package_data)
332
+			foreach (json_decode(file_get_contents($json), true) as $package_data)
333 333
 			{
334 334
 				$installed[strtolower($package_data['name'])] = $package_data['version'];
335 335
 			}
@@ -345,9 +345,9 @@  discard block
 block discarded – undo
345 345
  * @param $channel =null use default or given channel
346 346
  * @return array with package-name => version pairs, eg. array('Log' => '1.9.8','PEAR' => '1.4.11')
347 347
  */
348
-function get_installed_pear_packages($channel=null)
348
+function get_installed_pear_packages($channel = null)
349 349
 {
350
-	$pear_config = '';	// use the system default
350
+	$pear_config = ''; // use the system default
351 351
 	// fix for SuSE having the pear.conf only for cli, will fail with open_basedir - no idea what to do then
352 352
 	if (@is_dir('/etc/php5/apache2') && !file_exists('/etc/php5/apache2/pear.conf') && @file_exists('/etc/php5/cli/pear.conf'))
353 353
 	{
@@ -357,13 +357,13 @@  discard block
 block discarded – undo
357 357
 
358 358
 	if (!class_exists('PEAR_Config')) return false;
359 359
 
360
-	$config = new PEAR_Config('',$pear_config);
360
+	$config = new PEAR_Config('', $pear_config);
361 361
 	//echo "<pre>config = ".print_r($config,true)."</pre>\n";
362 362
 
363 363
 	if (empty($channel)) $channel = $config->get('default_channel');
364 364
 	//echo "<pre>channel = ".print_r($channel,true)."</pre>\n";
365 365
 
366
-	if (!method_exists($config,'getRegistry')) return false;	// PEAR version to old
366
+	if (!method_exists($config, 'getRegistry')) return false; // PEAR version to old
367 367
 
368 368
 	$reg = &$config->getRegistry();
369 369
 	//echo "<pre>reg = ".print_r($reg,true)."</pre>\n";
@@ -372,11 +372,11 @@  discard block
 block discarded – undo
372 372
 	// bug reported: http://pear.php.net/bugs/bug.php?id=11317
373 373
 	if (!file_exists($reg->install_dir)) return false;
374 374
 
375
-	$installed = $reg->packageInfo(null,null,$channel);
375
+	$installed = $reg->packageInfo(null, null, $channel);
376 376
 
377 377
 	//echo "<pre>installed =".print_r($installed,true)."</pre>\n";
378 378
 	$packages = array();
379
-	foreach($installed as $package)
379
+	foreach ($installed as $package)
380 380
 	{
381 381
 		$name = isset($package['package']) ? $package['package'] : $package['name'];
382 382
 		$version = $package['version'];
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
 	return $packages;
391 391
 }
392 392
 
393
-function pear_check($package,$args)
393
+function pear_check($package, $args)
394 394
 {
395 395
 	global $passed_icon, $warning_icon;
396 396
 	static $pear_available = null;
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 			$found = $pear_available;
435 435
 			if ($pear_available && $package)
436 436
 			{
437
-				$file = str_replace('_','/',$package == 'Mail_Mime' ? 'Mail_mime' : $package).'.php';
437
+				$file = str_replace('_', '/', $package == 'Mail_Mime' ? 'Mail_mime' : $package).'.php';
438 438
 
439 439
 				$found = @include_once($file);
440 440
 
@@ -443,16 +443,15 @@  discard block
 block discarded – undo
443 443
 		}
444 444
 	}
445 445
 	// is the right version availible
446
-	$available = $found && (!$min_version || version_compare($min_version,$version_available) <= 0);
446
+	$available = $found && (!$min_version || version_compare($min_version, $version_available) <= 0);
447 447
 	echo '<div>'.($available ? $passed_icon : $warning_icon).' <span'.($available ? '' : ' class="setup_warning"').'>'.
448
-		lang('Checking PEAR%1 is installed',($package?($channel?' '.$channel.'/':'::').$package:'').($min_version?" ($min_version)":'')).': '.
449
-		($available ? ($version_available ? $version_available : lang('True')) :
450
-		($found ? lang('Found, but unknown version') : lang('False')))."</span></div>\n";
448
+		lang('Checking PEAR%1 is installed', ($package ? ($channel ? ' '.$channel.'/' : '::').$package : '').($min_version ? " ($min_version)" : '')).': '.
449
+		($available ? ($version_available ? $version_available : lang('True')) : ($found ? lang('Found, but unknown version') : lang('False')))."</span></div>\n";
451 450
 
452 451
 	if (!$available)	// give further info only if not availible
453 452
 	{
454
-		echo '<div class="setup_info">' . lang('PEAR%1 is needed by: %2.',$package ? '::'.$package : '',
455
-			is_array($args['from']) ? implode(', ',$args['from']) : $args['from']);
453
+		echo '<div class="setup_info">'.lang('PEAR%1 is needed by: %2.', $package ? '::'.$package : '',
454
+			is_array($args['from']) ? implode(', ', $args['from']) : $args['from']);
456 455
 
457 456
 		// if using Composer, dont confuse user with PEAR ;-)
458 457
 		if (file_exists(EGW_SERVER_ROOT.'/vendor'))
@@ -465,7 +464,7 @@  discard block
 block discarded – undo
465 464
 			if (!$pear_available)
466 465
 			{
467 466
 				echo '<br/>'.lang('PEAR (%1) is a PHP repository and is usually in a package called %2.',
468
-					'<a href="http://pear.php.net" target="_blank">pear.php.net</a>','php-pear');
467
+					'<a href="http://pear.php.net" target="_blank">pear.php.net</a>', 'php-pear');
469 468
 			}
470 469
 			elseif ($package && !$found)
471 470
 			{
@@ -475,12 +474,12 @@  discard block
 block discarded – undo
475 474
 			}
476 475
 			elseif ($min_version && !$version_available)
477 476
 			{
478
-				echo '<br/>'.lang('We could not determine the version of %1, please make sure it is at least %2',$package,$min_version);
477
+				echo '<br/>'.lang('We could not determine the version of %1, please make sure it is at least %2', $package, $min_version);
479 478
 			}
480
-			elseif ($min_version && version_compare($min_version,$version_available) > 0)
479
+			elseif ($min_version && version_compare($min_version, $version_available) > 0)
481 480
 			{
482 481
 				echo '<br/>'.lang('Your installed version of %1 is %2, required is at least %3, please run: ',
483
-					$package,$version_available,$min_version).' pear upgrade '.$package;
482
+					$package, $version_available, $min_version).' pear upgrade '.$package;
484 483
 			}
485 484
 			echo '<br/>'.lang('Alternatively you can use %1Composer%2 to install all requirements at once. Downloading it and run:',
486 485
 				'<a href="https://getcomposer.org/" target="_blank">', '</a>').
@@ -493,26 +492,26 @@  discard block
 block discarded – undo
493 492
 	return $available;
494 493
 }
495 494
 
496
-function extension_check($name,$args)
495
+function extension_check($name, $args)
497 496
 {
498 497
 	//echo "<p>extension_check($name,".print_r($args,true).")</p>\n";
499 498
 	global $passed_icon, $warning_icon, $is_windows;
500 499
 
501 500
 	if (isset($args['win_only']) && $args['win_only'] && !$is_windows)
502 501
 	{
503
-		return True;	// check only under windows
502
+		return True; // check only under windows
504 503
 	}
505 504
 	// we check for the existens of 'dl', as multithreaded webservers dont have it !!!
506 505
 	$available = check_load_extension($name);
507 506
 
508
-	echo '<div>'.($available ? $passed_icon : $warning_icon).' <span'.($available ? '' : ' class="setup_warning"').'>'.lang('Checking extension %1 is loaded or loadable',$name).': '.($available ? lang('True') : lang('False'))."</span></div>\n";
507
+	echo '<div>'.($available ? $passed_icon : $warning_icon).' <span'.($available ? '' : ' class="setup_warning"').'>'.lang('Checking extension %1 is loaded or loadable', $name).': '.($available ? lang('True') : lang('False'))."</span></div>\n";
509 508
 
510 509
 	if (!$available)
511 510
 	{
512 511
 		if (!isset($args['warning']))
513 512
 		{
514
-			$args['warning'] = lang('The %1 extension is needed from: %2.',$name,
515
-				is_array($args['from']) ? implode(', ',$args['from']) : $args['from']);
513
+			$args['warning'] = lang('The %1 extension is needed from: %2.', $name,
514
+				is_array($args['from']) ? implode(', ', $args['from']) : $args['from']);
516 515
 		}
517 516
 		echo "<div class='setup_info'>".$args['warning'].'</div>';
518 517
 	}
@@ -521,20 +520,20 @@  discard block
 block discarded – undo
521 520
 	return $available;
522 521
 }
523 522
 
524
-function function_check($name,$args)
523
+function function_check($name, $args)
525 524
 {
526 525
 	global $passed_icon, $warning_icon;
527 526
 
528 527
 	$available = function_exists($name);
529 528
 
530
-	echo '<div>'.($available ? $passed_icon : $warning_icon).' <span'.($available ? '' : ' class="setup_warning"').'>'.lang('Checking function %1 exists',$name).': '.($available ? lang('True') : lang('False'))."</span></div>\n";
529
+	echo '<div>'.($available ? $passed_icon : $warning_icon).' <span'.($available ? '' : ' class="setup_warning"').'>'.lang('Checking function %1 exists', $name).': '.($available ? lang('True') : lang('False'))."</span></div>\n";
531 530
 
532 531
 	if (!$available)
533 532
 	{
534 533
 		if (!isset($args['warning']))
535 534
 		{
536
-			$args['warning'] = lang('The function %1 is needed from: %2.',$name,
537
-				is_array($args['from'] ? implode(', ',$args['from']) : $args['from']));
535
+			$args['warning'] = lang('The function %1 is needed from: %2.', $name,
536
+				is_array($args['from'] ? implode(', ', $args['from']) : $args['from']));
538 537
 		}
539 538
 		echo "<div class='setup_info'>".$args['warning'].'</div>';
540 539
 	}
@@ -543,33 +542,33 @@  discard block
 block discarded – undo
543 542
 	return $available;
544 543
 }
545 544
 
546
-function verbosePerms( $in_Perms )
545
+function verbosePerms($in_Perms)
547 546
 {
548
-	if($in_Perms & 0x1000)     // FIFO pipe
547
+	if ($in_Perms&0x1000)     // FIFO pipe
549 548
 	{
550 549
 		$sP = 'p';
551 550
 	}
552
-	elseif($in_Perms & 0x2000) // Character special
551
+	elseif ($in_Perms&0x2000) // Character special
553 552
 	{
554 553
 		$sP = 'c';
555 554
 	}
556
-	elseif($in_Perms & 0x4000) // Directory
555
+	elseif ($in_Perms&0x4000) // Directory
557 556
 	{
558 557
 		$sP = 'd';
559 558
 	}
560
-	elseif($in_Perms & 0x6000) // Block special
559
+	elseif ($in_Perms&0x6000) // Block special
561 560
 	{
562 561
 		$sP = 'b';
563 562
 	}
564
-	elseif($in_Perms & 0x8000) // Regular
563
+	elseif ($in_Perms&0x8000) // Regular
565 564
 	{
566 565
 		$sP = '-';
567 566
 	}
568
-	elseif($in_Perms & 0xA000) // Symbolic Link
567
+	elseif ($in_Perms&0xA000) // Symbolic Link
569 568
 	{
570 569
 		$sP = 'l';
571 570
 	}
572
-	elseif($in_Perms & 0xC000) // Socket
571
+	elseif ($in_Perms&0xC000) // Socket
573 572
 	{
574 573
 		$sP = 's';
575 574
 	}
@@ -579,33 +578,30 @@  discard block
 block discarded – undo
579 578
 	}
580 579
 
581 580
 	// owner
582
-	$sP .= (($in_Perms & 0x0100) ? 'r' : '-') .
583
-	(($in_Perms & 0x0080) ? 'w' : '-') .
584
-	(($in_Perms & 0x0040) ? (($in_Perms & 0x0800) ? 's' : 'x' ) :
585
-	(($in_Perms & 0x0800) ? 'S' : '-'));
581
+	$sP .= (($in_Perms&0x0100) ? 'r' : '-').
582
+	(($in_Perms&0x0080) ? 'w' : '-').
583
+	(($in_Perms&0x0040) ? (($in_Perms&0x0800) ? 's' : 'x') : (($in_Perms&0x0800) ? 'S' : '-'));
586 584
 
587 585
 	// group
588
-	$sP .= (($in_Perms & 0x0020) ? 'r' : '-') .
589
-	(($in_Perms & 0x0010) ? 'w' : '-') .
590
-	(($in_Perms & 0x0008) ? (($in_Perms & 0x0400) ? 's' : 'x' ) :
591
-	(($in_Perms & 0x0400) ? 'S' : '-'));
586
+	$sP .= (($in_Perms&0x0020) ? 'r' : '-').
587
+	(($in_Perms&0x0010) ? 'w' : '-').
588
+	(($in_Perms&0x0008) ? (($in_Perms&0x0400) ? 's' : 'x') : (($in_Perms&0x0400) ? 'S' : '-'));
592 589
 
593 590
 	// world
594
-	$sP .= (($in_Perms & 0x0004) ? 'r' : '-') .
595
-	(($in_Perms & 0x0002) ? 'w' : '-') .
596
-	(($in_Perms & 0x0001) ? (($in_Perms & 0x0200) ? 't' : 'x' ) :
597
-	(($in_Perms & 0x0200) ? 'T' : '-'));
591
+	$sP .= (($in_Perms&0x0004) ? 'r' : '-').
592
+	(($in_Perms&0x0002) ? 'w' : '-').
593
+	(($in_Perms&0x0001) ? (($in_Perms&0x0200) ? 't' : 'x') : (($in_Perms&0x0200) ? 'T' : '-'));
598 594
 	return $sP;
599 595
 }
600 596
 
601
-function permission_check($name,$args,$verbose=True)
597
+function permission_check($name, $args, $verbose = True)
602 598
 {
603
-	global $passed_icon, $error_icon, $warning_icon,$is_windows;
599
+	global $passed_icon, $error_icon, $warning_icon, $is_windows;
604 600
 	//echo "<p>permision_check('$name',".print_r($args,True).",'$verbose')</p>\n";
605 601
 
606 602
 	// add a ../ for non-absolute pathes
607 603
 	$rel_name = $name;
608
-	if ($name && substr($name,0,3) != '../' && $name[0] != '/' && $name[0] != '\\' && strpos($name,':') === false)
604
+	if ($name && substr($name, 0, 3) != '../' && $name[0] != '/' && $name[0] != '\\' && strpos($name, ':') === false)
609 605
 	{
610 606
 		$name = '../'.$name;
611 607
 	}
@@ -627,22 +623,22 @@  discard block
 block discarded – undo
627 623
 	if (isset($args['is_readable']))
628 624
 	{
629 625
 		$checks[] = lang('readable by the webserver');
630
-		$check_not = (!$args['is_readable']?lang('not'):'');
626
+		$check_not = (!$args['is_readable'] ?lang('not') : '');
631 627
 	}
632 628
 	if (isset($args['is_writable']))
633 629
 	{
634 630
 		$checks[] = lang('writable by the webserver');
635
-		$check_not = (!$args['is_writable']?lang('not'):'');
631
+		$check_not = (!$args['is_writable'] ?lang('not') : '');
636 632
 	}
637 633
 	if (isset($args['is_world_readable']))
638 634
 	{
639 635
 		$checks[] = lang('world readable');
640
-		$check_not = (!$args['is_world_readable']?lang('not'):'');
636
+		$check_not = (!$args['is_world_readable'] ?lang('not') : '');
641 637
 	}
642 638
 	if (isset($args['is_world_writable']))
643 639
 	{
644 640
 		$checks[] = lang('world writable');
645
-		$check_not = (!$args['is_world_writable']?lang('not'):'');
641
+		$check_not = (!$args['is_world_writable'] ?lang('not') : '');
646 642
 	}
647 643
 
648 644
 	if (isset($args['msg']) && ($msg = $args['msg']))
@@ -651,7 +647,7 @@  discard block
 block discarded – undo
651 647
 	}
652 648
 	else
653 649
 	{
654
-		$msg = lang('Checking file-permissions of %1 for %2 %3: %4',$rel_name,$check_not,implode(', ',$checks),$perms)."<br />\n";
650
+		$msg = lang('Checking file-permissions of %1 for %2 %3: %4', $rel_name, $check_not, implode(', ', $checks), $perms)."<br />\n";
655 651
 	}
656 652
 	$extra_error_msg = '';
657 653
 	if (isset($args['error']) && $args['error'])
@@ -660,13 +656,13 @@  discard block
 block discarded – undo
660 656
 	}
661 657
 	if (!file_exists($name))
662 658
 	{
663
-		echo '<div>'. $error_icon . '<span class="setup_error">' . $msg . lang('%1 does not exist !!!',$rel_name).$extra_error_msg."</span></div>\n";
659
+		echo '<div>'.$error_icon.'<span class="setup_error">'.$msg.lang('%1 does not exist !!!', $rel_name).$extra_error_msg."</span></div>\n";
664 660
 		return False;
665 661
 	}
666 662
 	$warning = False;
667 663
 	if (!$GLOBALS['run_by_webserver'] && (@$args['is_readable'] || @$args['is_writable']))
668 664
 	{
669
-		echo $warning_icon.' '.$msg. lang('Check can only be performed, if called via a webserver, as the user-id/-name of the webserver is not known.')."\n";
665
+		echo $warning_icon.' '.$msg.lang('Check can only be performed, if called via a webserver, as the user-id/-name of the webserver is not known.')."\n";
670 666
 		unset($args['is_readable']);
671 667
 		unset($args['is_writable']);
672 668
 		$warning = True;
@@ -674,22 +670,22 @@  discard block
 block discarded – undo
674 670
 	$Ok = True;
675 671
 	if (isset($args['is_writable']) && is_writable($name) != $args['is_writable'])
676 672
 	{
677
-		echo '<div>'.$error_icon.' <span class="setup_error">'.$msg.' '.lang('%1 is %2%3 !!!',$rel_name,$args['is_writable']?lang('not').' ':'',lang('writable by the webserver')).$extra_error_msg."</span></div>\n";
673
+		echo '<div>'.$error_icon.' <span class="setup_error">'.$msg.' '.lang('%1 is %2%3 !!!', $rel_name, $args['is_writable'] ?lang('not').' ' : '', lang('writable by the webserver')).$extra_error_msg."</span></div>\n";
678 674
 		$Ok = False;
679 675
 	}
680 676
 	if (isset($args['is_readable']) && is_readable($name) != $args['is_readable'])
681 677
 	{
682
-		echo '<div>'.$error_icon.' <span class="setup_error">'.$msg.' '.lang('%1 is %2%3 !!!',$rel_name,$args['is_readable']?lang('not').' ':'',lang('readable by the webserver')).$extra_error_msg."</span></div>\n";
678
+		echo '<div>'.$error_icon.' <span class="setup_error">'.$msg.' '.lang('%1 is %2%3 !!!', $rel_name, $args['is_readable'] ?lang('not').' ' : '', lang('readable by the webserver')).$extra_error_msg."</span></div>\n";
683 679
 		$Ok = False;
684 680
 	}
685
-	if (!$is_windows && isset($args['is_world_readable']) && !(fileperms($name) & 04) == $args['is_world_readable'])
681
+	if (!$is_windows && isset($args['is_world_readable']) && !(fileperms($name)&04) == $args['is_world_readable'])
686 682
 	{
687
-		echo '<div>'.$error_icon.' <span class="setup_error">'.$msg.' '.lang('%1 is %2%3 !!!',$rel_name,$args['is_world_readable']?lang('not').' ':'',lang('world readable')).$extra_error_msg."</span></div>\n";
683
+		echo '<div>'.$error_icon.' <span class="setup_error">'.$msg.' '.lang('%1 is %2%3 !!!', $rel_name, $args['is_world_readable'] ?lang('not').' ' : '', lang('world readable')).$extra_error_msg."</span></div>\n";
688 684
 		$Ok = False;
689 685
 	}
690
-	if (!$is_windows && isset($args['is_world_writable']) && !(fileperms($name) & 02) == $args['is_world_writable'])
686
+	if (!$is_windows && isset($args['is_world_writable']) && !(fileperms($name)&02) == $args['is_world_writable'])
691 687
 	{
692
-		echo '<div>'.$error_icon.' <span class="setup_error">'.$msg.' '.lang('%1 is %2%3 !!!',$rel_name,$args['is_world_writable']?lang('not').' ':'',lang('world writable')).$extra_error_msg."</span></div>\n";
688
+		echo '<div>'.$error_icon.' <span class="setup_error">'.$msg.' '.lang('%1 is %2%3 !!!', $rel_name, $args['is_world_writable'] ?lang('not').' ' : '', lang('world writable')).$extra_error_msg."</span></div>\n";
693 689
 		$Ok = False;
694 690
 	}
695 691
 	if ($Ok && !$warning && $verbose)
@@ -701,16 +697,16 @@  discard block
 block discarded – undo
701 697
 		if ($verbose)
702 698
 		{
703 699
 			@set_time_limit(0);
704
-			echo "<div class='setup_info'>" . lang('This might take a while, please wait ...')."</div>\n";
700
+			echo "<div class='setup_info'>".lang('This might take a while, please wait ...')."</div>\n";
705 701
 			flush();
706 702
 		}
707 703
 		@set_time_limit(0);
708 704
 		$handle = @opendir($name);
709
-		while($handle && ($file = readdir($handle)))
705
+		while ($handle && ($file = readdir($handle)))
710 706
 		{
711 707
 			if ($file != '.' && $file != '..')
712 708
 			{
713
-				$Ok = $Ok && permission_check(($name!='.'?$name.'/':'').$file,$args,False);
709
+				$Ok = $Ok && permission_check(($name != '.' ? $name.'/' : '').$file, $args, False);
714 710
 			}
715 711
 		}
716 712
 		if ($handle) closedir($handle);
@@ -723,12 +719,12 @@  discard block
 block discarded – undo
723 719
 function mk_value($value)
724 720
 {
725 721
 	$matches = null;
726
-	if (!preg_match('/^([0-9]+)([mk]+)$/i',$value,$matches)) return $value;
722
+	if (!preg_match('/^([0-9]+)([mk]+)$/i', $value, $matches)) return $value;
727 723
 
728
-	return (strtolower($matches[2]) == 'm' ? 1024*1024 : 1024) * (int) $matches[1];
724
+	return (strtolower($matches[2]) == 'm' ? 1024 * 1024 : 1024) * (int)$matches[1];
729 725
 }
730 726
 
731
-function php_ini_check($name,$args)
727
+function php_ini_check($name, $args)
732 728
 {
733 729
 	global $passed_icon, $error_icon, $warning_icon, $is_windows;
734 730
 
@@ -746,20 +742,20 @@  discard block
 block discarded – undo
746 742
 	{
747 743
 		case 'not set':
748 744
 			$check = lang('not set');
749
-			$result = !($ini_value & $args['value']);
745
+			$result = !($ini_value&$args['value']);
750 746
 			break;
751 747
 		case 'set':
752 748
 			$check = lang('set');
753
-			$result = !!($ini_value & $args['value']);
749
+			$result = !!($ini_value&$args['value']);
754 750
 			break;
755 751
 		case '>=':
756
-			$result = !$ini_value ||	// value not used, eg. no memory limit
757
-			(int) mk_value($ini_value) >= (int) mk_value($args['value']);
752
+			$result = !$ini_value || // value not used, eg. no memory limit
753
+			(int)mk_value($ini_value) >= (int)mk_value($args['value']);
758 754
 			break;
759 755
 		case 'contain':
760 756
 			$check = lang('contain');
761 757
 			$sep = $is_windows ? '/[; ]+/' : '/[: ]+/';
762
-			$result = in_array($args['value'],preg_split($sep,$ini_value));
758
+			$result = in_array($args['value'], preg_split($sep, $ini_value));
763 759
 			break;
764 760
 		case '!=':
765 761
 			$check = lang('set and not');
@@ -776,9 +772,9 @@  discard block
 block discarded – undo
776 772
 			$tz = new DateTimeZone($ini_value);
777 773
 			unset($tz);
778 774
 		}
779
-		catch(Exception $e) {
775
+		catch (Exception $e) {
780 776
 			unset($e);
781
-			$result = false;	// no valid timezone
777
+			$result = false; // no valid timezone
782 778
 		}
783 779
 	}
784 780
 	$msg = ' '.lang('Checking php.ini').": $name $check $verbose_value: <span class='setup_info'>ini_get('$name')='$ini_value'$ini_value_verbose</span>";
@@ -800,7 +796,7 @@  discard block
 block discarded – undo
800 796
 		elseif (!isset($args['safe_mode']))
801 797
 		{
802 798
 			echo "<div>".$warning_icon.' <span class="setup_warning">'.$msg.'</span><div class="setup_info">'.
803
-				lang('%1 is needed by: %2.',$name,is_array($args['from']) ? implode(', ',$args['from']) : $args['from'])
799
+				lang('%1 is needed by: %2.', $name, is_array($args['from']) ? implode(', ', $args['from']) : $args['from'])
804 800
 				."</div></div>\n";
805 801
 		}
806 802
 		if (isset($args['safe_mode']) && $safe_mode || @$args['change'])
@@ -810,7 +806,7 @@  discard block
 block discarded – undo
810 806
 				echo '<div>'.$error_icon.' <span class="setup_error">'.$msg.'</span></div>';
811 807
 			}
812 808
 			echo "<div class='setup_error'>\n";
813
-			echo '*** '.lang('Please make the following change in your php.ini').' ('.get_php_ini().'): '.(@$args['safe_mode']?$args['safe_mode']:$args['change'])."<br />\n";
809
+			echo '*** '.lang('Please make the following change in your php.ini').' ('.get_php_ini().'): '.(@$args['safe_mode'] ? $args['safe_mode'] : $args['change'])."<br />\n";
814 810
 			echo '*** '.lang('AND reload your webserver, so the above changes take effect !!!')."</div>\n";
815 811
 		}
816 812
 	}
@@ -825,16 +821,16 @@  discard block
 block discarded – undo
825 821
 	ob_end_clean();
826 822
 
827 823
 	$found = null;
828
-	return preg_match('/\(php.ini\).*<\/td><td[^>]*>([^ <]+)/',$phpinfo,$found) ? $found[1] : False;
824
+	return preg_match('/\(php.ini\).*<\/td><td[^>]*>([^ <]+)/', $phpinfo, $found) ? $found[1] : False;
829 825
 }
830 826
 
831 827
 function gd_check()
832 828
 {
833 829
 	global $passed_icon, $warning_icon;
834 830
 
835
-	$available = (function_exists('imagecopyresampled')  || function_exists('imagecopyresized'));
831
+	$available = (function_exists('imagecopyresampled') || function_exists('imagecopyresized'));
836 832
 
837
-	echo "<div>".($available ? $passed_icon : $warning_icon).' <span'.($available?'':' class="setup_warning"').'>'.lang('Checking for GD support...').': '.($available ? lang('True') : lang('False'))."</span></div>\n";
833
+	echo "<div>".($available ? $passed_icon : $warning_icon).' <span'.($available ? '' : ' class="setup_warning"').'>'.lang('Checking for GD support...').': '.($available ? lang('True') : lang('False'))."</span></div>\n";
838 834
 
839 835
 	if (!$available)
840 836
 	{
@@ -853,24 +849,24 @@  discard block
 block discarded – undo
853 849
 	));
854 850
 	$ConfigDomain = $_REQUEST['ConfigDomain'];
855 851
 	if (@$_GET['intro']) {
856
-		if(($ConfigLang = setup::get_lang()))
852
+		if (($ConfigLang = setup::get_lang()))
857 853
 		{
858
-			$GLOBALS['egw_setup']->set_cookie('ConfigLang',$ConfigLang,(int) (time()+(1200*9)),'/');
854
+			$GLOBALS['egw_setup']->set_cookie('ConfigLang', $ConfigLang, (int)(time() + (1200 * 9)), '/');
859 855
 		}
860
-		$GLOBALS['egw_setup']->html->show_header(lang('Welcome to the EGroupware Installation'),False,'config');
856
+		$GLOBALS['egw_setup']->html->show_header(lang('Welcome to the EGroupware Installation'), False, 'config');
861 857
 		echo '<h1>'.lang('Welcome to the EGroupware Installation')."</h1>\n";
862
-		if(!$ConfigLang)
858
+		if (!$ConfigLang)
863 859
 		{
864
-			echo '<p><form action="check_install.php?intro=1" method="Post">Please Select your language '.setup_html::lang_select(True,'en')."</form></p>\n";
860
+			echo '<p><form action="check_install.php?intro=1" method="Post">Please Select your language '.setup_html::lang_select(True, 'en')."</form></p>\n";
865 861
 		}
866 862
 		echo '<p>'.lang('The first step in installing EGroupware is to ensure your environment has the necessary settings to correctly run the application.').'</p>';
867 863
 		echo '<p>'.lang('We will now run a series of tests, which may take a few minutes.  Click the link below to proceed.').'</p>';
868 864
 		echo '<h3><a href="check_install.php">'.lang('Run installation tests').'</a></h3>';
869 865
 		echo '<p><a href="manageheader.php">'.lang('Skip the installation tests (not recommended)')."</a></p>\n";
870
-		$setup_tpl->pparse('out','T_footer');
866
+		$setup_tpl->pparse('out', 'T_footer');
871 867
 		exit;
872 868
 	} else {
873
-		$GLOBALS['egw_setup']->html->show_header(lang('Checking the EGroupware Installation'),False,'config',$ConfigDomain ? $ConfigDomain . '(' . @$GLOBALS['egw_domain'][$ConfigDomain]['db_type'] . ')' : '');
869
+		$GLOBALS['egw_setup']->html->show_header(lang('Checking the EGroupware Installation'), False, 'config', $ConfigDomain ? $ConfigDomain.'('.@$GLOBALS['egw_domain'][$ConfigDomain]['db_type'].')' : '');
874 870
 		echo '<h1>'.lang('Checking the EGroupware Installation')."</h1>\n";
875 871
 		# echo "<pre style=\"text-align: left;\">\n";;
876 872
 	}
@@ -884,7 +880,7 @@  discard block
 block discarded – undo
884 880
 $Ok = True;
885 881
 foreach ($sorted_checks as $name => $args)
886 882
 {
887
-	$check_ok = $args['func']($name,$args);
883
+	$check_ok = $args['func']($name, $args);
888 884
 	$Ok = $Ok && $check_ok;
889 885
 }
890 886
 
@@ -896,9 +892,9 @@  discard block
 block discarded – undo
896 892
 	{
897 893
 		if (!$Ok)
898 894
 		{
899
-			echo '<h3>'.lang('Please fix the above errors (%1) and warnings(%2)',$error_icon,$warning_icon)."</h3>\n";
895
+			echo '<h3>'.lang('Please fix the above errors (%1) and warnings(%2)', $error_icon, $warning_icon)."</h3>\n";
900 896
 			echo '<h3><a href="check_install.php">'.lang('Click here to re-run the installation tests')."</a></h3>\n";
901
-			echo '<h3>'.lang('or %1Continue to the Header Admin%2','<a href="manageheader.php">','</a>')."</h3>\n";
897
+			echo '<h3>'.lang('or %1Continue to the Header Admin%2', '<a href="manageheader.php">', '</a>')."</h3>\n";
902 898
 		}
903 899
 		else
904 900
 		{
@@ -910,10 +906,10 @@  discard block
 block discarded – undo
910 906
 		echo '<h3>';
911 907
 		if (!$Ok)
912 908
 		{
913
-			echo lang('Please fix the above errors (%1) and warnings(%2)',$error_icon,$warning_icon).'. ';
909
+			echo lang('Please fix the above errors (%1) and warnings(%2)', $error_icon, $warning_icon).'. ';
914 910
 		}
915
-		echo '<br /><a href="'.str_replace('check_install.php','',@$_SERVER['HTTP_REFERER']).'">'.lang('Return to Setup')."</a></h3>\n";
911
+		echo '<br /><a href="'.str_replace('check_install.php', '', @$_SERVER['HTTP_REFERER']).'">'.lang('Return to Setup')."</a></h3>\n";
916 912
 	}
917
-	$setup_tpl->pparse('out','T_footer');
913
+	$setup_tpl->pparse('out', 'T_footer');
918 914
 	//echo "</body>\n</html>\n";
919 915
 }
Please login to merge, or discard this patch.
Braces   +119 added lines, -30 removed lines patch added patch discarded remove patch
@@ -243,10 +243,15 @@  discard block
 block discarded – undo
243 243
 		foreach(explode(PATH_SEPARATOR,$open_basedir) as $dir)
244 244
 		{
245 245
 			$dir = realpath($dir);
246
-			if (($sp_visible = substr($session_path,0,strlen($dir)) == $dir)) break;
246
+			if (($sp_visible = substr($session_path,0,strlen($dir)) == $dir))
247
+			{
248
+				break;
249
+			}
247 250
 		}
248 251
 	}
249
-	if ($sp_visible)	// only check if session_save_path is visible by webserver
252
+	if ($sp_visible)
253
+	{
254
+		// only check if session_save_path is visible by webserver
250 255
 	{
251 256
 		$checks[$session_path] = array(
252 257
 			'func' => 'permission_check',
@@ -255,17 +260,25 @@  discard block
 block discarded – undo
255 260
 			'error' => lang('You will NOT be able to log into EGroupware using PHP sessions: "session could not be verified" !!!'),
256 261
 		);
257 262
 	}
263
+	}
258 264
 }
259 265
 $setup_info = $GLOBALS['egw_setup']->detection->get_versions();
260 266
 foreach($setup_info as $app => $app_data)
261 267
 {
262
-	if (!isset($app_data['check_install'])) continue;
268
+	if (!isset($app_data['check_install']))
269
+	{
270
+		continue;
271
+	}
263 272
 
264 273
 	foreach ($app_data['check_install'] as $name => $data)
265 274
 	{
266 275
 		if (isset($checks[$name]))
267 276
 		{
268
-			if ($checks[$name] == $data) continue;	// identical check --> ignore it
277
+			if ($checks[$name] == $data)
278
+			{
279
+				continue;
280
+			}
281
+			// identical check --> ignore it
269 282
 
270 283
 			if ($data['func'] == 'pear_check' || in_array($data['func'],array('extension_check','php_ini_check')) && !isset($data['warning']))
271 284
 			{
@@ -273,9 +286,18 @@  discard block
 block discarded – undo
273 286
 				{
274 287
 					$checks[$name]['from'] = array($checks[$name]['from']);
275 288
 				}
276
-				if (!isset($data['from'])) $data['from'] = $app;
277
-				if (!isset($checks[$name]['from']) || !is_array($checks[$name]['from'])) $checks[$name]['from'] = array();
278
-				if (!in_array($data['from'],$checks[$name]['from'])) $checks[$name]['from'][] = $data['from'];
289
+				if (!isset($data['from']))
290
+				{
291
+					$data['from'] = $app;
292
+				}
293
+				if (!isset($checks[$name]['from']) || !is_array($checks[$name]['from']))
294
+				{
295
+					$checks[$name]['from'] = array();
296
+				}
297
+				if (!in_array($data['from'],$checks[$name]['from']))
298
+				{
299
+					$checks[$name]['from'][] = $data['from'];
300
+				}
279 301
 			}
280 302
 			else
281 303
 			{
@@ -284,7 +306,10 @@  discard block
 block discarded – undo
284 306
 		}
285 307
 		else
286 308
 		{
287
-			if (!isset($data['from'])) $data['from'] = $app;
309
+			if (!isset($data['from']))
310
+			{
311
+				$data['from'] = $app;
312
+			}
288 313
 			$checks[$name] = $data;
289 314
 		}
290 315
 		//echo "added check $data[func]($name) for $app"; _debug_array($data);
@@ -302,7 +327,10 @@  discard block
 block discarded – undo
302 327
 		}
303 328
 	}
304 329
 }
305
-if ($checks) $sorted_checks += $checks;
330
+if ($checks)
331
+{
332
+	$sorted_checks += $checks;
333
+}
306 334
 
307 335
 function php_version($name,$args)
308 336
 {
@@ -355,22 +383,35 @@  discard block
 block discarded – undo
355 383
 	}
356 384
 	@include_once 'PEAR/Config.php';
357 385
 
358
-	if (!class_exists('PEAR_Config')) return false;
386
+	if (!class_exists('PEAR_Config'))
387
+	{
388
+		return false;
389
+	}
359 390
 
360 391
 	$config = new PEAR_Config('',$pear_config);
361 392
 	//echo "<pre>config = ".print_r($config,true)."</pre>\n";
362 393
 
363
-	if (empty($channel)) $channel = $config->get('default_channel');
394
+	if (empty($channel))
395
+	{
396
+		$channel = $config->get('default_channel');
397
+	}
364 398
 	//echo "<pre>channel = ".print_r($channel,true)."</pre>\n";
365 399
 
366
-	if (!method_exists($config,'getRegistry')) return false;	// PEAR version to old
400
+	if (!method_exists($config,'getRegistry'))
401
+	{
402
+		return false;
403
+	}
404
+	// PEAR version to old
367 405
 
368 406
 	$reg = &$config->getRegistry();
369 407
 	//echo "<pre>reg = ".print_r($reg,true)."</pre>\n";
370 408
 
371 409
 	// a bug in pear causes an endless loop if the install-dir does not exist
372 410
 	// bug reported: http://pear.php.net/bugs/bug.php?id=11317
373
-	if (!file_exists($reg->install_dir)) return false;
411
+	if (!file_exists($reg->install_dir))
412
+	{
413
+		return false;
414
+	}
374 415
 
375 416
 	$installed = $reg->packageInfo(null,null,$channel);
376 417
 
@@ -380,7 +421,10 @@  discard block
 block discarded – undo
380 421
 	{
381 422
 		$name = isset($package['package']) ? $package['package'] : $package['name'];
382 423
 		$version = $package['version'];
383
-		if (is_array($version)) $version = $version['release'];
424
+		if (is_array($version))
425
+		{
426
+			$version = $version['release'];
427
+		}
384 428
 
385 429
 		$packages[$name] = $version;
386 430
 		//echo "<p>$name: ".print_r($package['version'],true)."</p>\n";
@@ -419,7 +463,10 @@  discard block
 block discarded – undo
419 463
 		{
420 464
 			$pear_available = $found = true;
421 465
 			// check if package is installed
422
-			if ($package && isset($pear_packages[$package])) $available = true;
466
+			if ($package && isset($pear_packages[$package]))
467
+			{
468
+				$available = true;
469
+			}
423 470
 			// check if it's the right version
424 471
 			$version_available = $pear_packages[$package ? $package : 'PEAR'];
425 472
 		}
@@ -429,7 +476,10 @@  discard block
 block discarded – undo
429 476
 			{
430 477
 				$pear_available = @include_once('PEAR.php');
431 478
 
432
-				if (!class_exists('PEAR')) $pear_available = false;
479
+				if (!class_exists('PEAR'))
480
+				{
481
+					$pear_available = false;
482
+				}
433 483
 			}
434 484
 			$found = $pear_available;
435 485
 			if ($pear_available && $package)
@@ -438,7 +488,10 @@  discard block
 block discarded – undo
438 488
 
439 489
 				$found = @include_once($file);
440 490
 
441
-				if (!class_exists($package)) $found = false;
491
+				if (!class_exists($package))
492
+				{
493
+					$found = false;
494
+				}
442 495
 			}
443 496
 		}
444 497
 	}
@@ -449,10 +502,13 @@  discard block
 block discarded – undo
449 502
 		($available ? ($version_available ? $version_available : lang('True')) :
450 503
 		($found ? lang('Found, but unknown version') : lang('False')))."</span></div>\n";
451 504
 
452
-	if (!$available)	// give further info only if not availible
505
+	if (!$available)
506
+	{
507
+		// give further info only if not availible
453 508
 	{
454 509
 		echo '<div class="setup_info">' . lang('PEAR%1 is needed by: %2.',$package ? '::'.$package : '',
455 510
 			is_array($args['from']) ? implode(', ',$args['from']) : $args['from']);
511
+	}
456 512
 
457 513
 		// if using Composer, dont confuse user with PEAR ;-)
458 514
 		if (file_exists(EGW_SERVER_ROOT.'/vendor'))
@@ -545,34 +601,55 @@  discard block
 block discarded – undo
545 601
 
546 602
 function verbosePerms( $in_Perms )
547 603
 {
548
-	if($in_Perms & 0x1000)     // FIFO pipe
604
+	if($in_Perms & 0x1000)
605
+	{
606
+		// FIFO pipe
549 607
 	{
550 608
 		$sP = 'p';
551 609
 	}
552
-	elseif($in_Perms & 0x2000) // Character special
610
+	}
611
+	elseif($in_Perms & 0x2000)
612
+	{
613
+		// Character special
553 614
 	{
554 615
 		$sP = 'c';
555 616
 	}
556
-	elseif($in_Perms & 0x4000) // Directory
617
+	}
618
+	elseif($in_Perms & 0x4000)
619
+	{
620
+		// Directory
557 621
 	{
558 622
 		$sP = 'd';
559 623
 	}
560
-	elseif($in_Perms & 0x6000) // Block special
624
+	}
625
+	elseif($in_Perms & 0x6000)
626
+	{
627
+		// Block special
561 628
 	{
562 629
 		$sP = 'b';
563 630
 	}
564
-	elseif($in_Perms & 0x8000) // Regular
631
+	}
632
+	elseif($in_Perms & 0x8000)
633
+	{
634
+		// Regular
565 635
 	{
566 636
 		$sP = '-';
567 637
 	}
568
-	elseif($in_Perms & 0xA000) // Symbolic Link
638
+	}
639
+	elseif($in_Perms & 0xA000)
640
+	{
641
+		// Symbolic Link
569 642
 	{
570 643
 		$sP = 'l';
571 644
 	}
572
-	elseif($in_Perms & 0xC000) // Socket
645
+	}
646
+	elseif($in_Perms & 0xC000)
647
+	{
648
+		// Socket
573 649
 	{
574 650
 		$sP = 's';
575 651
 	}
652
+	}
576 653
 	else                         // UNKNOWN
577 654
 	{
578 655
 		$sP = 'u';
@@ -713,9 +790,15 @@  discard block
 block discarded – undo
713 790
 				$Ok = $Ok && permission_check(($name!='.'?$name.'/':'').$file,$args,False);
714 791
 			}
715 792
 		}
716
-		if ($handle) closedir($handle);
793
+		if ($handle)
794
+		{
795
+			closedir($handle);
796
+		}
797
+	}
798
+	if ($verbose)
799
+	{
800
+		echo "\n";
717 801
 	}
718
-	if ($verbose) echo "\n";
719 802
 
720 803
 	return $Ok;
721 804
 }
@@ -723,7 +806,10 @@  discard block
 block discarded – undo
723 806
 function mk_value($value)
724 807
 {
725 808
 	$matches = null;
726
-	if (!preg_match('/^([0-9]+)([mk]+)$/i',$value,$matches)) return $value;
809
+	if (!preg_match('/^([0-9]+)([mk]+)$/i',$value,$matches))
810
+	{
811
+		return $value;
812
+	}
727 813
 
728 814
 	return (strtolower($matches[2]) == 'm' ? 1024*1024 : 1024) * (int) $matches[1];
729 815
 }
@@ -852,7 +938,8 @@  discard block
 block discarded – undo
852 938
 		'T_footer' => 'footer.tpl',
853 939
 	));
854 940
 	$ConfigDomain = $_REQUEST['ConfigDomain'];
855
-	if (@$_GET['intro']) {
941
+	if (@$_GET['intro'])
942
+	{
856 943
 		if(($ConfigLang = setup::get_lang()))
857 944
 		{
858 945
 			$GLOBALS['egw_setup']->set_cookie('ConfigLang',$ConfigLang,(int) (time()+(1200*9)),'/');
@@ -869,7 +956,9 @@  discard block
 block discarded – undo
869 956
 		echo '<p><a href="manageheader.php">'.lang('Skip the installation tests (not recommended)')."</a></p>\n";
870 957
 		$setup_tpl->pparse('out','T_footer');
871 958
 		exit;
872
-	} else {
959
+	}
960
+	else
961
+	{
873 962
 		$GLOBALS['egw_setup']->html->show_header(lang('Checking the EGroupware Installation'),False,'config',$ConfigDomain ? $ConfigDomain . '(' . @$GLOBALS['egw_domain'][$ConfigDomain]['db_type'] . ')' : '');
874 963
 		echo '<h1>'.lang('Checking the EGroupware Installation')."</h1>\n";
875 964
 		# echo "<pre style=\"text-align: left;\">\n";;
Please login to merge, or discard this patch.