Completed
Push — 14.2 ( c53e78...a8db63 )
by Ralf
29:08
created
phpgwapi/inc/class.egw_framework.inc.php 1 patch
Spacing   +235 added lines, -237 removed lines patch added patch discarded remove patch
@@ -101,15 +101,15 @@  discard block
 block discarded – undo
101 101
 		$class = $GLOBALS['egw_info']['server']['template_set'].'_framework';
102 102
 		if (!class_exists($class))	// first try to autoload the class
103 103
 		{
104
-			require_once($file=EGW_INCLUDE_ROOT.'/phpgwapi/templates/'.$GLOBALS['egw_info']['server']['template_set'].'/class.'.$class.'.inc.php');
105
-			if (!in_array($file,(array)$_SESSION['egw_required_files']))
104
+			require_once($file = EGW_INCLUDE_ROOT.'/phpgwapi/templates/'.$GLOBALS['egw_info']['server']['template_set'].'/class.'.$class.'.inc.php');
105
+			if (!in_array($file, (array)$_SESSION['egw_required_files']))
106 106
 			{
107
-				$_SESSION['egw_required_files'][] = $file;	// automatic load the used framework class, when the object get's restored
107
+				$_SESSION['egw_required_files'][] = $file; // automatic load the used framework class, when the object get's restored
108 108
 			}
109 109
 		}
110 110
 		// fall back to idots if a template does NOT support current user-agent
111
-		if ($class != 'idots_framework' && method_exists($class,'is_supported_user_agent') &&
112
-			!call_user_func(array($class,'is_supported_user_agent')))
111
+		if ($class != 'idots_framework' && method_exists($class, 'is_supported_user_agent') &&
112
+			!call_user_func(array($class, 'is_supported_user_agent')))
113 113
 		{
114 114
 			$GLOBALS['egw_info']['server']['template_set'] = 'idots';
115 115
 			return self::factory();
@@ -138,13 +138,13 @@  discard block
 block discarded – undo
138 138
 	 * @param string|array $set =array() 'unsafe-eval' and/or 'unsafe-inline' (without quotes!) or URL (incl. protocol!)
139 139
 	 * @return string with attributes eg. "'unsafe-eval' 'unsafe-inline'"
140 140
 	 */
141
-	public static function csp_script_src_attrs($set=null)
141
+	public static function csp_script_src_attrs($set = null)
142 142
 	{
143
-		foreach((array)$set as $attr)
143
+		foreach ((array)$set as $attr)
144 144
 		{
145 145
 			if (in_array($attr, array('none', 'self', 'unsafe-eval', 'unsafe-inline')))
146 146
 			{
147
-				$attr = "'$attr'";	// automatic add quotes
147
+				$attr = "'$attr'"; // automatic add quotes
148 148
 			}
149 149
 			if (!in_array($attr, self::$csp_script_src_attrs))
150 150
 			{
@@ -173,13 +173,13 @@  discard block
 block discarded – undo
173 173
 	 * @param string|array $set =array() 'unsafe-inline' (without quotes!) and/or URL (incl. protocol!)
174 174
 	 * @return string with attributes eg. "'unsafe-inline'"
175 175
 	 */
176
-	public static function csp_style_src_attrs($set=null)
176
+	public static function csp_style_src_attrs($set = null)
177 177
 	{
178
-		foreach((array)$set as $attr)
178
+		foreach ((array)$set as $attr)
179 179
 		{
180 180
 			if (in_array($attr, array('none', 'self', 'unsafe-inline')))
181 181
 			{
182
-				$attr = "'$attr'";	// automatic add quotes
182
+				$attr = "'$attr'"; // automatic add quotes
183 183
 			}
184 184
 			if (!in_array($attr, self::$csp_style_src_attrs))
185 185
 			{
@@ -204,9 +204,9 @@  discard block
 block discarded – undo
204 204
 	 * @param string|array $set =array() URL (incl. protocol!)
205 205
 	 * @return string with attributes eg. "'unsafe-inline'"
206 206
 	 */
207
-	public static function csp_connect_src_attrs($set=null)
207
+	public static function csp_connect_src_attrs($set = null)
208 208
 	{
209
-		foreach((array)$set as $attr)
209
+		foreach ((array)$set as $attr)
210 210
 		{
211 211
 			if (!in_array($attr, self::$csp_connect_src_attrs))
212 212
 			{
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 	 * @param string|array $set =array() URL (incl. protocol!)
234 234
 	 * @return string with attributes eg. "'unsafe-inline'"
235 235
 	 */
236
-	public static function csp_frame_src_attrs($set=null)
236
+	public static function csp_frame_src_attrs($set = null)
237 237
 	{
238 238
 		// set frame-src attrs of API and apps via hook
239 239
 		if (!isset(self::$csp_frame_src_attrs) && !isset($set))
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 			$frame_src = array('manual.egroupware.org', 'www.egroupware.org');
242 242
 			if (($app_additional = $GLOBALS['egw']->hooks->process('csp-frame-src')))
243 243
 			{
244
-				foreach($app_additional as $addtional)
244
+				foreach ($app_additional as $addtional)
245 245
 				{
246 246
 					if ($addtional) $frame_src = array_unique(array_merge($frame_src, $addtional));
247 247
 				}
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 
252 252
 		if (!isset(self::$csp_frame_src_attrs)) self::$csp_frame_src_attrs = array();
253 253
 
254
-		foreach((array)$set as $attr)
254
+		foreach ((array)$set as $attr)
255 255
 		{
256 256
 			if (!in_array($attr, self::$csp_frame_src_attrs))
257 257
 			{
@@ -283,11 +283,11 @@  discard block
 block discarded – undo
283 283
 
284 284
 		//$csp = "default-src * 'unsafe-eval' 'unsafe-inline'";	// allow everything
285 285
 		header("Content-Security-Policy: $csp");
286
-		header("X-Webkit-CSP: $csp");	// Chrome: <= 24, Safari incl. iOS
287
-		header("X-Content-Security-Policy: $csp");	// FF <= 22
286
+		header("X-Webkit-CSP: $csp"); // Chrome: <= 24, Safari incl. iOS
287
+		header("X-Content-Security-Policy: $csp"); // FF <= 22
288 288
 
289 289
 		// allow client-side to detect first load aka just logged in
290
-		$reload_count =& egw_cache::getSession(__CLASS__, 'framework-reload');
290
+		$reload_count = & egw_cache::getSession(__CLASS__, 'framework-reload');
291 291
 		self::$extra['framework-reload'] = (int)(bool)$reload_count++;
292 292
 	}
293 293
 
@@ -328,9 +328,9 @@  discard block
 block discarded – undo
328 328
 	 * @param string $link_app =null if appname or true, some templates generate a special link-handler url
329 329
 	 * @return string	The full url after processing
330 330
 	 */
331
-	static function link($url, $extravars = '', $link_app=null)
331
+	static function link($url, $extravars = '', $link_app = null)
332 332
 	{
333
-		unset($link_app);	// not used by required by function signature
333
+		unset($link_app); // not used by required by function signature
334 334
 		return $GLOBALS['egw']->session->link($url, $extravars);
335 335
 	}
336 336
 
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 	 * @param string $link_app =null if appname or true, some templates generate a special link-handler url
343 343
 	 * @return string	The full url after processing
344 344
 	 */
345
-	static function redirect_link($url, $extravars='', $link_app=null)
345
+	static function redirect_link($url, $extravars = '', $link_app = null)
346 346
 	{
347 347
 		egw::redirect(self::link($url, $extravars), $link_app);
348 348
 	}
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
 	 * @param string $navbar =null show the navigation, default !$GLOBALS['egw_info']['flags']['nonavbar'], false gives a typical popu
358 358
 	 *
359 359
 	 */
360
-	function render($content,$app_header=null,$navbar=null)
360
+	function render($content, $app_header = null, $navbar = null)
361 361
 	{
362 362
 		if (!is_null($app_header)) $GLOBALS['egw_info']['flags']['app_header'] = $app_header;
363 363
 		if (!is_null($navbar)) $GLOBALS['egw_info']['flags']['nonavbar'] = !$navbar;
@@ -406,12 +406,12 @@  discard block
 block discarded – undo
406 406
 	 * @param string $with =null
407 407
 	 * @param string $msg_type =null 'error', 'warning' or 'success' (default)
408 408
 	 */
409
-	public static function refresh_opener($msg, $app, $id=null, $type=null, $targetapp=null, $replace=null, $with=null, $msg_type=null)
409
+	public static function refresh_opener($msg, $app, $id = null, $type = null, $targetapp = null, $replace = null, $with = null, $msg_type = null)
410 410
 	{
411 411
 		//error_log(__METHOD__.'('.array2string(func_get_args()).')');
412 412
 		self::$extra['refresh-opener'] = func_get_args();
413 413
 
414
-		unset($msg, $app, $id, $type, $targetapp, $replace, $with, $msg_type);	// used only via func_get_args();
414
+		unset($msg, $app, $id, $type, $targetapp, $replace, $with, $msg_type); // used only via func_get_args();
415 415
 	}
416 416
 
417 417
 	/**
@@ -422,11 +422,11 @@  discard block
 block discarded – undo
422 422
 	 * @param string $msg message to show
423 423
 	 * @param string $type ='success' 'error', 'warning' or 'success' (default)
424 424
 	 */
425
-	public static function message($msg, $type='success')
425
+	public static function message($msg, $type = 'success')
426 426
 	{
427 427
 		self::$extra['message'] = func_get_args();
428 428
 
429
-		unset($msg, $type);	// used only via func_get_args();
429
+		unset($msg, $type); // used only via func_get_args();
430 430
 	}
431 431
 
432 432
 	/**
@@ -436,12 +436,12 @@  discard block
 block discarded – undo
436 436
 	 * @param string $target
437 437
 	 * @param string $popup
438 438
 	 */
439
-	public static function popup($link, $target='_blank', $popup='640x480')
439
+	public static function popup($link, $target = '_blank', $popup = '640x480')
440 440
 	{
441 441
 		// default params are not returned by func_get_args!
442
-		$args = func_get_args()+array(null, '_blank', '640x480');
442
+		$args = func_get_args() + array(null, '_blank', '640x480');
443 443
 
444
-		unset($link, $target, $popup);	// used only via func_get_args()
444
+		unset($link, $target, $popup); // used only via func_get_args()
445 445
 
446 446
 		if (egw_json_request::isJSONRequest())
447 447
 		{
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
 	 *
459 459
 	 * @param string $alert_msg ='' optional message to display as alert, before closing the window
460 460
 	 */
461
-	public static function window_close($alert_msg='')
461
+	public static function window_close($alert_msg = '')
462 462
 	{
463 463
 		//error_log(__METHOD__."()");
464 464
 		self::$extra['window-close'] = $alert_msg ? $alert_msg : true;
@@ -515,12 +515,12 @@  discard block
 block discarded – undo
515 515
 	public static function get_extra()
516 516
 	{
517 517
 		// adding links of refreshed entry, to give others apps more information about necessity to refresh
518
-		if (isset(self::$extra['refresh-opener']) && count(self::$extra['refresh-opener']) <= 8 &&	// do not run twice
518
+		if (isset(self::$extra['refresh-opener']) && count(self::$extra['refresh-opener']) <= 8 && // do not run twice
519 519
 			!empty(self::$extra['refresh-opener'][1]) && !empty(self::$extra['refresh-opener'][2]))	// app/id given
520 520
 		{
521 521
 			$links = egw_link::get_links(self::$extra['refresh-opener'][1], self::$extra['refresh-opener'][2]);
522 522
 			$apps = array();
523
-			foreach($links as $link)
523
+			foreach ($links as $link)
524 524
 			{
525 525
 				$apps[$link['app']][] = $link['id'];
526 526
 			}
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 	 *
539 539
 	 * @return string with html
540 540
 	 */
541
-	abstract function header(array $extra=array());
541
+	abstract function header(array $extra = array());
542 542
 
543 543
 	/**
544 544
 	 * Returns the html from the body-tag til the main application area (incl. opening div tag)
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
 	 * @return boolean $consider_navbar_not_yet_called_as_true=true
559 559
 	 * @return boolean
560 560
 	 */
561
-	abstract function isTop($consider_navbar_not_yet_called_as_true=true);
561
+	abstract function isTop($consider_navbar_not_yet_called_as_true = true);
562 562
 
563 563
 	/**
564 564
 	 * Returns the content of one sidebox
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
 	 * @param array $file
569 569
 	 * @param string $type =null 'admin', 'preferences', 'favorites', ...
570 570
 	 */
571
-	abstract function sidebox($appname,$menu_title,$file,$type=null);
571
+	abstract function sidebox($appname, $menu_title, $file, $type = null);
572 572
 
573 573
 	/**
574 574
 	 * Returns the html from the closing div of the main application area to the closing html-tag
@@ -583,23 +583,23 @@  discard block
 block discarded – undo
583 583
 	 * @param string $extra_vars for login url
584 584
 	 * @param string $change_passwd =null string with message to render input fields for password change
585 585
 	*/
586
-	function login_screen($extra_vars, $change_passwd=null)
586
+	function login_screen($extra_vars, $change_passwd = null)
587 587
 	{
588
-		self::csp_frame_src_attrs(array());	// array() no external frame-sources
588
+		self::csp_frame_src_attrs(array()); // array() no external frame-sources
589 589
 
590 590
 		//error_log(__METHOD__."() this->template=$this->template, this->template_dir=$this->template_dir, get_class(this)=".get_class($this));
591 591
 		$tmpl = new Template(EGW_SERVER_ROOT.$this->template_dir);
592 592
 
593 593
 		$tmpl->set_file(array('login_form' => 'login.tpl'));
594 594
 
595
-		$tmpl->set_var('lang_message',$GLOBALS['loginscreenmessage']);
595
+		$tmpl->set_var('lang_message', $GLOBALS['loginscreenmessage']);
596 596
 
597 597
 		// hide change-password fields, if not requested
598 598
 		if (!$change_passwd)
599 599
 		{
600
-			$tmpl->set_block('login_form','change_password');
600
+			$tmpl->set_block('login_form', 'change_password');
601 601
 			$tmpl->set_var('change_password', '');
602
-			$tmpl->set_var('lang_password',lang('password'));
602
+			$tmpl->set_var('lang_password', lang('password'));
603 603
 
604 604
 			// display login-message depending on $_GET[cd] and what's in database/header for "login_message"
605 605
 			$cd_msg = check_logoutcode($_GET['cd']);
@@ -620,9 +620,9 @@  discard block
 block discarded – undo
620 620
 		}
621 621
 		else
622 622
 		{
623
-			$tmpl->set_var('lang_password',lang('Old password'));
624
-			$tmpl->set_var('lang_new_password',lang('New password'));
625
-			$tmpl->set_var('lang_repeat_password',lang('Repeat password'));
623
+			$tmpl->set_var('lang_password', lang('Old password'));
624
+			$tmpl->set_var('lang_new_password', lang('New password'));
625
+			$tmpl->set_var('lang_repeat_password', lang('Repeat password'));
626 626
 			$tmpl->set_var('cd', $change_passwd);
627 627
 			$tmpl->set_var('cd_class', 'error');
628 628
 			$last_loginid = $_POST['login'];
@@ -631,55 +631,55 @@  discard block
 block discarded – undo
631 631
 			$tmpl->set_var('autofocus_login', '');
632 632
 			$tmpl->set_var('autofocus_new_passwd', 'autofocus');
633 633
 		}
634
-		if($GLOBALS['egw_info']['server']['show_domain_selectbox'])
634
+		if ($GLOBALS['egw_info']['server']['show_domain_selectbox'])
635 635
 		{
636
-			foreach(array_keys($GLOBALS['egw_domain']) as $domain)
636
+			foreach (array_keys($GLOBALS['egw_domain']) as $domain)
637 637
 			{
638 638
 				$domains[$domain] = $domain;
639 639
 			}
640 640
 			$tmpl->set_var(array(
641 641
 				'lang_domain'   => lang('domain'),
642
-				'select_domain' => html::select('logindomain',$last_domain,$domains,true,'tabindex="2"',0,false),
642
+				'select_domain' => html::select('logindomain', $last_domain, $domains, true, 'tabindex="2"', 0, false),
643 643
 			));
644 644
 		}
645 645
 		else
646 646
 		{
647 647
 			/* trick to make domain section disapear */
648
-			$tmpl->set_block('login_form','domain_selection');
649
-			$tmpl->set_var('domain_selection',$GLOBALS['egw_info']['user']['domain'] ?
650
-			html::input_hidden('logindomain',$GLOBALS['egw_info']['user']['domain']) : '');
648
+			$tmpl->set_block('login_form', 'domain_selection');
649
+			$tmpl->set_var('domain_selection', $GLOBALS['egw_info']['user']['domain'] ?
650
+			html::input_hidden('logindomain', $GLOBALS['egw_info']['user']['domain']) : '');
651 651
 
652
-			if($last_loginid !== '')
652
+			if ($last_loginid !== '')
653 653
 			{
654 654
 				reset($GLOBALS['egw_domain']);
655 655
 				list($default_domain) = each($GLOBALS['egw_domain']);
656 656
 
657
-				if(!empty ($last_domain) && $last_domain != $default_domain)
657
+				if (!empty ($last_domain) && $last_domain != $default_domain)
658 658
 				{
659
-					$last_loginid .= '@' . $last_domain;
659
+					$last_loginid .= '@'.$last_domain;
660 660
 				}
661 661
 			}
662 662
 		}
663 663
 
664 664
 		$config_reg = config::read('registration');
665 665
 
666
-		if($config_reg['enable_registration'])
666
+		if ($config_reg['enable_registration'])
667 667
 		{
668 668
 			if ($config_reg['register_link'])
669 669
 			{
670
-				$reg_link='&nbsp;<a href="'. egw::link('/registration/index.php','lang_code='.$_GET['lang']). '">'.lang('Not a user yet? Register now').'</a><br/>';
670
+				$reg_link = '&nbsp;<a href="'.egw::link('/registration/index.php', 'lang_code='.$_GET['lang']).'">'.lang('Not a user yet? Register now').'</a><br/>';
671 671
 			}
672 672
 			if ($config_reg['lostpassword_link'])
673 673
 			{
674
-				$lostpw_link='&nbsp;<a href="'. egw::link('/registration/index.php','menuaction=registration.registration_ui.lost_password&lang_code='.$_GET['lang']). '">'.lang('Lost password').'</a><br/>';
674
+				$lostpw_link = '&nbsp;<a href="'.egw::link('/registration/index.php', 'menuaction=registration.registration_ui.lost_password&lang_code='.$_GET['lang']).'">'.lang('Lost password').'</a><br/>';
675 675
 			}
676 676
 			if ($config_reg['lostid_link'])
677 677
 			{
678
-				$lostid_link='&nbsp;<a href="'. egw::link('/registration/index.php','menuaction=registration.registration_ui.lost_username&lang_code='.$_GET['lang']). '">'.lang('Lost Login Id').'</a><br/>';
678
+				$lostid_link = '&nbsp;<a href="'.egw::link('/registration/index.php', 'menuaction=registration.registration_ui.lost_username&lang_code='.$_GET['lang']).'">'.lang('Lost Login Id').'</a><br/>';
679 679
 			}
680 680
 
681 681
 			/* if at least one option of "registration" is activated display the registration section */
682
-			if($config_reg['register_link'] || $config_reg['lostpassword_link'] || $config_reg['lostid_link'] )
682
+			if ($config_reg['register_link'] || $config_reg['lostpassword_link'] || $config_reg['lostid_link'])
683 683
 			{
684 684
 				$tmpl->set_var(array(
685 685
 				'register_link'     => $reg_link,
@@ -690,20 +690,20 @@  discard block
 block discarded – undo
690 690
 			else
691 691
 			{
692 692
 				/* trick to make registration section disapear */
693
-				$tmpl->set_block('login_form','registration');
694
-				$tmpl->set_var('registration','');
693
+				$tmpl->set_block('login_form', 'registration');
694
+				$tmpl->set_var('registration', '');
695 695
 			}
696 696
 		}
697 697
 
698
-		$tmpl->set_var('login_url', $GLOBALS['egw_info']['server']['webserver_url'] . '/login.php' . $extra_vars);
698
+		$tmpl->set_var('login_url', $GLOBALS['egw_info']['server']['webserver_url'].'/login.php'.$extra_vars);
699 699
 		$tmpl->set_var('version', $GLOBALS['egw_info']['server']['versions']['phpgwapi']);
700 700
 		$tmpl->set_var('login', $last_loginid);
701 701
 
702
-		$tmpl->set_var('lang_username',lang('username'));
703
-		$tmpl->set_var('lang_login',lang('login'));
702
+		$tmpl->set_var('lang_username', lang('username'));
703
+		$tmpl->set_var('lang_login', lang('login'));
704 704
 
705 705
 		$tmpl->set_var('website_title', $GLOBALS['egw_info']['server']['site_title']);
706
-		$tmpl->set_var('template_set',$this->template);
706
+		$tmpl->set_var('template_set', $this->template);
707 707
 
708 708
 		if (substr($GLOBALS['egw_info']['server']['login_logo_file'], 0, 4) == 'http' ||
709 709
 			$GLOBALS['egw_info']['server']['login_logo_file'][0] == '/')
@@ -712,14 +712,14 @@  discard block
 block discarded – undo
712 712
 		}
713 713
 		else
714 714
 		{
715
-			$var['logo_file'] = common::image('phpgwapi',$GLOBALS['egw_info']['server']['login_logo_file']?$GLOBALS['egw_info']['server']['login_logo_file']:'logo', '', null);	// null=explicit allow svg
715
+			$var['logo_file'] = common::image('phpgwapi', $GLOBALS['egw_info']['server']['login_logo_file'] ? $GLOBALS['egw_info']['server']['login_logo_file'] : 'logo', '', null); // null=explicit allow svg
716 716
 		}
717
-		$var['logo_url'] = $GLOBALS['egw_info']['server']['login_logo_url']?$GLOBALS['egw_info']['server']['login_logo_url']:'http://www.eGroupWare.org';
718
-		if (substr($var['logo_url'],0,4) != 'http')
717
+		$var['logo_url'] = $GLOBALS['egw_info']['server']['login_logo_url'] ? $GLOBALS['egw_info']['server']['login_logo_url'] : 'http://www.eGroupWare.org';
718
+		if (substr($var['logo_url'], 0, 4) != 'http')
719 719
 		{
720 720
 			$var['logo_url'] = 'http://'.$var['logo_url'];
721 721
 		}
722
-		$var['logo_title'] = $GLOBALS['egw_info']['server']['login_logo_title']?$GLOBALS['egw_info']['server']['login_logo_title']:'www.eGroupWare.org';
722
+		$var['logo_title'] = $GLOBALS['egw_info']['server']['login_logo_title'] ? $GLOBALS['egw_info']['server']['login_logo_title'] : 'www.eGroupWare.org';
723 723
 		$tmpl->set_var($var);
724 724
 
725 725
 		/* language section if activated in site config */
@@ -727,14 +727,14 @@  discard block
 block discarded – undo
727 727
 		{
728 728
 			$tmpl->set_var(array(
729 729
 				'lang_language' => lang('Language'),
730
-				'select_language' => html::select('lang',$GLOBALS['egw_info']['user']['preferences']['common']['lang'],
731
-				translation::get_installed_langs(),true,'tabindex="1"',0,false),
730
+				'select_language' => html::select('lang', $GLOBALS['egw_info']['user']['preferences']['common']['lang'],
731
+				translation::get_installed_langs(), true, 'tabindex="1"', 0, false),
732 732
 			));
733 733
 		}
734 734
 		else
735 735
 		{
736
-			$tmpl->set_block('login_form','language_select');
737
-			$tmpl->set_var('language_select','');
736
+			$tmpl->set_block('login_form', 'language_select');
737
+			$tmpl->set_var('language_select', '');
738 738
 		}
739 739
 
740 740
 		/********************************************************\
@@ -742,31 +742,31 @@  discard block
 block discarded – undo
742 742
 		* and place a time selectbox, how long cookie is valid   *
743 743
 		\********************************************************/
744 744
 
745
-		if($GLOBALS['egw_info']['server']['allow_cookie_auth'])
745
+		if ($GLOBALS['egw_info']['server']['allow_cookie_auth'])
746 746
 		{
747
-			$tmpl->set_block('login_form','remember_me_selection');
748
-			$tmpl->set_var('lang_remember_me',lang('Remember me'));
749
-			$tmpl->set_var('select_remember_me',html::select('remember_me', '', array(
747
+			$tmpl->set_block('login_form', 'remember_me_selection');
748
+			$tmpl->set_var('lang_remember_me', lang('Remember me'));
749
+			$tmpl->set_var('select_remember_me', html::select('remember_me', '', array(
750 750
 				'' => lang('not'),
751 751
 				'1hour' => lang('1 Hour'),
752 752
 				'1day' => lang('1 Day'),
753 753
 				'1week'=> lang('1 Week'),
754 754
 				'1month' => lang('1 Month'),
755 755
 				'forever' => lang('Forever'),
756
-			),true,'tabindex="3"',0,false));
756
+			), true, 'tabindex="3"', 0, false));
757 757
 		}
758 758
 		else
759 759
 		{
760 760
 			/* trick to make remember_me section disapear */
761
-			$tmpl->set_block('login_form','remember_me_selection');
762
-			$tmpl->set_var('remember_me_selection','');
761
+			$tmpl->set_block('login_form', 'remember_me_selection');
762
+			$tmpl->set_var('remember_me_selection', '');
763 763
 		}
764 764
 		$tmpl->set_var('autocomplete', ($GLOBALS['egw_info']['server']['autocomplete_login'] ? 'autocomplete="off"' : ''));
765 765
 
766 766
 		// load jquery for login screen too
767 767
 		self::validate_file('jquery', 'jquery');
768 768
 
769
-		$this->render($tmpl->fp('loginout','login_form'),false,false);
769
+		$this->render($tmpl->fp('loginout', 'login_form'), false, false);
770 770
 	}
771 771
 
772 772
 	/**
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
 		// load jquery for deny-login screen too
790 790
 		self::validate_file('jquery', 'jquery');
791 791
 
792
-		$this->render($tmpl->fp('loginout','login_form'),false,false);
792
+		$this->render($tmpl->fp('loginout', 'login_form'), false, false);
793 793
 	}
794 794
 
795 795
 	/**
@@ -800,19 +800,19 @@  discard block
 block discarded – undo
800 800
 	public function _get_footer()
801 801
 	{
802 802
 		$var = Array(
803
-			'img_root'       => $GLOBALS['egw_info']['server']['webserver_url'] . $this->template_dir.'/images',
803
+			'img_root'       => $GLOBALS['egw_info']['server']['webserver_url'].$this->template_dir.'/images',
804 804
 			'version'        => $GLOBALS['egw_info']['server']['versions']['phpgwapi']
805 805
 		);
806 806
 		$var['page_generation_time'] = '';
807
-		if($GLOBALS['egw_info']['user']['preferences']['common']['show_generation_time'])
807
+		if ($GLOBALS['egw_info']['user']['preferences']['common']['show_generation_time'])
808 808
 		{
809
-			$totaltime = sprintf('%4.2lf',microtime(true) - $GLOBALS['egw_info']['flags']['page_start_time']);
809
+			$totaltime = sprintf('%4.2lf', microtime(true) - $GLOBALS['egw_info']['flags']['page_start_time']);
810 810
 
811
-			$var['page_generation_time'] = '<div class="pageGenTime" id="divGenTime_'.$GLOBALS['egw_info']['flags']['currentapp'].'"><span>'.lang('Page was generated in %1 seconds',$totaltime);
811
+			$var['page_generation_time'] = '<div class="pageGenTime" id="divGenTime_'.$GLOBALS['egw_info']['flags']['currentapp'].'"><span>'.lang('Page was generated in %1 seconds', $totaltime);
812 812
 			if ($GLOBALS['egw_info']['flags']['session_restore_time'])
813 813
 			{
814 814
 				$var['page_generation_time'] .= ' '.lang('(session restored in %1 seconds)',
815
-					sprintf('%4.2lf',$GLOBALS['egw_info']['flags']['session_restore_time']));
815
+					sprintf('%4.2lf', $GLOBALS['egw_info']['flags']['session_restore_time']));
816 816
 			}
817 817
 			$var['page_generation_time'] .= '</span></div>';
818 818
 		}
@@ -832,23 +832,23 @@  discard block
 block discarded – undo
832 832
 	{
833 833
 		ob_start();
834 834
 		// Include the apps footer files if it exists
835
-		if (EGW_APP_INC != EGW_API_INC &&	// this prevents an endless inclusion on the homepage
835
+		if (EGW_APP_INC != EGW_API_INC && // this prevents an endless inclusion on the homepage
836 836
 			                                // (some apps set currentapp in hook_home => it's not releyable)
837
-			(file_exists (EGW_APP_INC . '/footer.inc.php') || isset($_GET['menuaction'])) &&
837
+			(file_exists(EGW_APP_INC.'/footer.inc.php') || isset($_GET['menuaction'])) &&
838 838
 			$GLOBALS['egw_info']['flags']['currentapp'] != 'home' &&
839 839
 			$GLOBALS['egw_info']['flags']['currentapp'] != 'login' &&
840 840
 			$GLOBALS['egw_info']['flags']['currentapp'] != 'logout' &&
841 841
 			!@$GLOBALS['egw_info']['flags']['noappfooter'])
842 842
 		{
843
-			list(, $class) = explode('.',(string)$_GET['menuaction']);
843
+			list(, $class) = explode('.', (string)$_GET['menuaction']);
844 844
 			if ($class && is_object($GLOBALS[$class]) && is_array($GLOBALS[$class]->public_functions) &&
845 845
 				isset($GLOBALS[$class]->public_functions['footer']))
846 846
 			{
847 847
 				$GLOBALS[$class]->footer();
848 848
 			}
849
-			elseif(file_exists(EGW_APP_INC.'/footer.inc.php'))
849
+			elseif (file_exists(EGW_APP_INC.'/footer.inc.php'))
850 850
 			{
851
-				include(EGW_APP_INC . '/footer.inc.php');
851
+				include(EGW_APP_INC.'/footer.inc.php');
852 852
 			}
853 853
 		}
854 854
 		$content = ob_get_contents();
@@ -863,7 +863,7 @@  discard block
 block discarded – undo
863 863
 	 * @param array $extra =array() extra attributes passed as data-attribute to egw.js
864 864
 	 * @return array
865 865
 	 */
866
-	protected function _get_header(array $extra=array())
866
+	protected function _get_header(array $extra = array())
867 867
 	{
868 868
 		// display password expires in N days message once per session
869 869
 		$message = null;
@@ -874,7 +874,7 @@  discard block
 block discarded – undo
874 874
 		}
875 875
 
876 876
 		// get used language code (with a little xss check, if someone tries to sneak something in)
877
-		if (preg_match('/^[a-z]{2}(-[a-z]{2})?$/',$GLOBALS['egw_info']['user']['preferences']['common']['lang']))
877
+		if (preg_match('/^[a-z]{2}(-[a-z]{2})?$/', $GLOBALS['egw_info']['user']['preferences']['common']['lang']))
878 878
 		{
879 879
 			$lang_code = $GLOBALS['egw_info']['user']['preferences']['common']['lang'];
880 880
 		}
@@ -886,9 +886,9 @@  discard block
 block discarded – undo
886 886
 			$pngfix = '<meta http-equiv="X-UA-Compatible" content="IE=edge" />'."\n";
887 887
 
888 888
 			// pngfix for IE6 defaults to yes
889
-			if(!$GLOBALS['egw_info']['user']['preferences']['common']['disable_pngfix'] && html::$ua_version < 7)
889
+			if (!$GLOBALS['egw_info']['user']['preferences']['common']['disable_pngfix'] && html::$ua_version < 7)
890 890
 			{
891
-				$pngfix_src = $GLOBALS['egw_info']['server']['webserver_url'] . '/phpgwapi/templates/idots/js/pngfix.js';
891
+				$pngfix_src = $GLOBALS['egw_info']['server']['webserver_url'].'/phpgwapi/templates/idots/js/pngfix.js';
892 892
 				$pngfix .= '<!-- This solves the Internet Explorer PNG-transparency bug, but only for IE 5.5 - 6.0 and higher -->
893 893
 				<!--[if lt IE 7.0]>
894 894
 				<script src="'.$pngfix_src.'" type="text/javascript">
@@ -905,14 +905,14 @@  discard block
 block discarded – undo
905 905
 		// send appheader to clientside
906 906
 		$extra['app-header'] = $app_header;
907 907
 
908
-		if($GLOBALS['egw_info']['flags']['currentapp'] != 'wiki') $robots ='<meta name="robots" content="none" />';
909
-		if (substr($GLOBALS['egw_info']['server']['favicon_file'],0,4) == 'http')
908
+		if ($GLOBALS['egw_info']['flags']['currentapp'] != 'wiki') $robots = '<meta name="robots" content="none" />';
909
+		if (substr($GLOBALS['egw_info']['server']['favicon_file'], 0, 4) == 'http')
910 910
 		{
911 911
 			$var['favicon_file'] = $GLOBALS['egw_info']['server']['favicon_file'];
912 912
 		}
913 913
 		else
914 914
 		{
915
-			$var['favicon_file'] = common::image('phpgwapi',$GLOBALS['egw_info']['server']['favicon_file']?$GLOBALS['egw_info']['server']['favicon_file']:'favicon.ico');
915
+			$var['favicon_file'] = common::image('phpgwapi', $GLOBALS['egw_info']['server']['favicon_file'] ? $GLOBALS['egw_info']['server']['favicon_file'] : 'favicon.ico');
916 916
 		}
917 917
 
918 918
 		if ($GLOBALS['egw_info']['flags']['include_wz_tooltip'] &&
@@ -921,7 +921,7 @@  discard block
 block discarded – undo
921 921
 			$include_wz_tooltip = '<script src="'.$GLOBALS['egw_info']['server']['webserver_url'].
922 922
 				$wz_tooltip.'?'.filemtime(EGW_SERVER_ROOT.$wz_tooltip).'" type="text/javascript"></script>';
923 923
 		}
924
-		return $this->_get_css()+array(
924
+		return $this->_get_css() + array(
925 925
 			'img_icon'			=> $var['favicon_file'],
926 926
 			'img_shortcut'		=> $var['favicon_file'],
927 927
 			'pngfix'        	=> $pngfix,
@@ -945,15 +945,15 @@  discard block
 block discarded – undo
945 945
 	 */
946 946
 	protected function _get_navbar($apps)
947 947
 	{
948
-		$var['img_root'] = $GLOBALS['egw_info']['server']['webserver_url'] . '/phpgwapi/templates/'.$this->template.'/images';
948
+		$var['img_root'] = $GLOBALS['egw_info']['server']['webserver_url'].'/phpgwapi/templates/'.$this->template.'/images';
949 949
 
950
-		if(isset($GLOBALS['egw_info']['flags']['app_header']))
950
+		if (isset($GLOBALS['egw_info']['flags']['app_header']))
951 951
 		{
952 952
 			$var['current_app_title'] = $GLOBALS['egw_info']['flags']['app_header'];
953 953
 		}
954 954
 		else
955 955
 		{
956
-			$var['current_app_title']=$apps[$GLOBALS['egw_info']['flags']['currentapp']]['title'];
956
+			$var['current_app_title'] = $apps[$GLOBALS['egw_info']['flags']['currentapp']]['title'];
957 957
 		}
958 958
 		$var['currentapp'] = $GLOBALS['egw_info']['flags']['currentapp'];
959 959
 
@@ -965,32 +965,32 @@  discard block
 block discarded – undo
965 965
 
966 966
 		$var['user_info'] = $this->_user_time_info();
967 967
 
968
-		if($GLOBALS['egw_info']['user']['account_lastpwd_change'] == 0)
968
+		if ($GLOBALS['egw_info']['user']['account_lastpwd_change'] == 0)
969 969
 		{
970 970
 			$api_messages = lang('You are required to change your password during your first login').'<br />'.
971
-				lang('Click this image on the navbar: %1','<img src="'.common::image('preferences','navbar.gif').'">');
971
+				lang('Click this image on the navbar: %1', '<img src="'.common::image('preferences', 'navbar.gif').'">');
972 972
 		}
973
-		elseif($GLOBALS['egw_info']['server']['change_pwd_every_x_days'] && $GLOBALS['egw_info']['user']['account_lastpwd_change'] < time() - (86400*$GLOBALS['egw_info']['server']['change_pwd_every_x_days']))
973
+		elseif ($GLOBALS['egw_info']['server']['change_pwd_every_x_days'] && $GLOBALS['egw_info']['user']['account_lastpwd_change'] < time() - (86400 * $GLOBALS['egw_info']['server']['change_pwd_every_x_days']))
974 974
 		{
975
-			$api_messages = lang('it has been more then %1 days since you changed your password',$GLOBALS['egw_info']['server']['change_pwd_every_x_days']);
975
+			$api_messages = lang('it has been more then %1 days since you changed your password', $GLOBALS['egw_info']['server']['change_pwd_every_x_days']);
976 976
 		}
977 977
 
978
-		if (substr($GLOBALS['egw_info']['server']['login_logo_file'],0,4) == 'http' ||
978
+		if (substr($GLOBALS['egw_info']['server']['login_logo_file'], 0, 4) == 'http' ||
979 979
 			$GLOBALS['egw_info']['server']['login_logo_file'][0] == '/')
980 980
 		{
981 981
 			$var['logo_file'] = $GLOBALS['egw_info']['server']['login_logo_file'];
982 982
 		}
983 983
 		else
984 984
 		{
985
-			$var['logo_file'] = common::image('phpgwapi',$GLOBALS['egw_info']['server']['login_logo_file']?$GLOBALS['egw_info']['server']['login_logo_file']:'logo', '', null);	// null=explicit allow svg
985
+			$var['logo_file'] = common::image('phpgwapi', $GLOBALS['egw_info']['server']['login_logo_file'] ? $GLOBALS['egw_info']['server']['login_logo_file'] : 'logo', '', null); // null=explicit allow svg
986 986
 		}
987
-		$var['logo_url'] = $GLOBALS['egw_info']['server']['login_logo_url']?$GLOBALS['egw_info']['server']['login_logo_url']:'http://www.eGroupWare.org';
987
+		$var['logo_url'] = $GLOBALS['egw_info']['server']['login_logo_url'] ? $GLOBALS['egw_info']['server']['login_logo_url'] : 'http://www.eGroupWare.org';
988 988
 
989
-		if (substr($var['logo_url'],0,4) != 'http')
989
+		if (substr($var['logo_url'], 0, 4) != 'http')
990 990
 		{
991 991
 			$var['logo_url'] = 'http://'.$var['logo_url'];
992 992
 		}
993
-		$var['logo_title'] = $GLOBALS['egw_info']['server']['login_logo_title']?$GLOBALS['egw_info']['server']['login_logo_title']:'www.eGroupWare.org';
993
+		$var['logo_title'] = $GLOBALS['egw_info']['server']['login_logo_title'] ? $GLOBALS['egw_info']['server']['login_logo_title'] : 'www.eGroupWare.org';
994 994
 
995 995
 		return $var;
996 996
 	}
@@ -1003,14 +1003,14 @@  discard block
 block discarded – undo
1003 1003
 	protected static function _user_time_info()
1004 1004
 	{
1005 1005
 		$now = new egw_time();
1006
-		$user_info = '<b>'.common::display_fullname() .'</b>'. ' - ' . lang($now->format('l')) . ' ' . $now->format(true);
1006
+		$user_info = '<b>'.common::display_fullname().'</b>'.' - '.lang($now->format('l')).' '.$now->format(true);
1007 1007
 
1008 1008
 		$user_tzs = egw_time::getUserTimezones();
1009 1009
 		if (count($user_tzs) > 1)
1010 1010
 		{
1011 1011
 			$tz = $GLOBALS['egw_info']['user']['preferences']['common']['tz'];
1012
-			$user_info .= html::form(html::select('tz',$tz,$user_tzs,true),array(),
1013
-				'/index.php','','tz_selection',' style="display: inline;"','GET');
1012
+			$user_info .= html::form(html::select('tz', $tz, $user_tzs, true), array(),
1013
+				'/index.php', '', 'tz_selection', ' style="display: inline;"', 'GET');
1014 1014
 		}
1015 1015
 		return $user_info;
1016 1016
 	}
@@ -1022,10 +1022,10 @@  discard block
 block discarded – undo
1022 1022
 	 */
1023 1023
 	protected static function _current_users()
1024 1024
 	{
1025
-	   if( $GLOBALS['egw_info']['user']['apps']['admin'] && $GLOBALS['egw_info']['user']['preferences']['common']['show_currentusers'])
1025
+	   if ($GLOBALS['egw_info']['user']['apps']['admin'] && $GLOBALS['egw_info']['user']['preferences']['common']['show_currentusers'])
1026 1026
 	   {
1027
-		  $current_users = '<a href="' . egw::link('/index.php','menuaction=admin.admin_accesslog.sessions') . '">' .
1028
-		  	lang('Current users') . ': <span id="currentusers">' . $GLOBALS['egw']->session->session_count() . '</span></a>';
1027
+		  $current_users = '<a href="'.egw::link('/index.php', 'menuaction=admin.admin_accesslog.sessions').'">'.
1028
+		  	lang('Current users').': <span id="currentusers">'.$GLOBALS['egw']->session->session_count().'</span></a>';
1029 1029
 		  return $current_users;
1030 1030
 	   }
1031 1031
 	}
@@ -1081,8 +1081,8 @@  discard block
 block discarded – undo
1081 1081
 				list($current, $security) = explode("\n", $remote);
1082 1082
 				if (empty($security)) $security = $current;
1083 1083
 				$versions = array(
1084
-					'current'  => $current,		// last maintenance update
1085
-					'security' => $security,	// last security update
1084
+					'current'  => $current, // last maintenance update
1085
+					'security' => $security, // last security update
1086 1086
 				);
1087 1087
 			}
1088 1088
 			return $versions;
@@ -1128,14 +1128,14 @@  discard block
 block discarded – undo
1128 1128
 	 * @param string $password =null password --------- " ----------
1129 1129
 	 * @return resource|null context to use with file_get_context/fopen or null if no proxy configured
1130 1130
 	 */
1131
-	public static function proxy_context($username=null, $password=null)
1131
+	public static function proxy_context($username = null, $password = null)
1132 1132
 	{
1133 1133
 		$opts = array(
1134 1134
 			'method' => 'GET',
1135 1135
 		);
1136 1136
 		if (!empty($GLOBALS['egw_info']['server']['httpproxy_server']))
1137 1137
 		{
1138
-			$opts += array (
1138
+			$opts += array(
1139 1139
 				'proxy'  => 'tcp://'.$GLOBALS['egw_info']['server']['httpproxy_server'].':'.
1140 1140
 					($GLOBALS['egw_info']['server']['httpproxy_port'] ? $GLOBALS['egw_info']['server']['httpproxy_port'] : 8080),
1141 1141
 				'request_fulluri' => true,
@@ -1167,7 +1167,7 @@  discard block
 block discarded – undo
1167 1167
 	 */
1168 1168
 	protected static function update_older($version, $days)
1169 1169
 	{
1170
-		list(,,$date) = explode('.', $version);
1170
+		list(,, $date) = explode('.', $version);
1171 1171
 		if ($date < 20140000) return false;
1172 1172
 		$version_timestamp = mktime(0, 0, 0, (int)substr($date, 4, 2), (int)substr($date, -2), (int)substr($date, 0, 4));
1173 1173
 
@@ -1180,7 +1180,7 @@  discard block
 block discarded – undo
1180 1180
 	 * @param string &$changelog on return path to changelog
1181 1181
 	 * @return string
1182 1182
 	 */
1183
-	public static function api_version(&$changelog=null)
1183
+	public static function api_version(&$changelog = null)
1184 1184
 	{
1185 1185
 		$version = preg_replace('/[^0-9.]/', '', $GLOBALS['egw_info']['server']['versions']['phpgwapi']);
1186 1186
 		// parse version from changelog
@@ -1203,7 +1203,7 @@  discard block
 block discarded – undo
1203 1203
 	 */
1204 1204
 	public static function index($app)
1205 1205
 	{
1206
-		$data =& $GLOBALS['egw_info']['user']['apps'][$app];
1206
+		$data = & $GLOBALS['egw_info']['user']['apps'][$app];
1207 1207
 		if (!isset($data))
1208 1208
 		{
1209 1209
 			throw new egw_exception_wrong_parameter("'$app' not a valid app for this user!");
@@ -1220,7 +1220,7 @@  discard block
 block discarded – undo
1220 1220
 				$index = '/index.php?menuaction='.$data['index'];
1221 1221
 			}
1222 1222
 		}
1223
-		return egw::link($index,$GLOBALS['egw_info']['flags']['params'][$app]);
1223
+		return egw::link($index, $GLOBALS['egw_info']['flags']['params'][$app]);
1224 1224
 	}
1225 1225
 
1226 1226
 	/**
@@ -1261,15 +1261,15 @@  discard block
 block discarded – undo
1261 1261
 	 *	true: always return svg, false: never return svg (current default), null: browser dependent, see svg_usable()
1262 1262
 	 * @return array
1263 1263
 	 */
1264
-	protected static function _get_navbar_apps($svg=false)
1264
+	protected static function _get_navbar_apps($svg = false)
1265 1265
 	{
1266 1266
 		list($first) = each($GLOBALS['egw_info']['user']['apps']);
1267
-		if(is_array($GLOBALS['egw_info']['user']['apps']['admin']) && $first != 'admin')
1267
+		if (is_array($GLOBALS['egw_info']['user']['apps']['admin']) && $first != 'admin')
1268 1268
 		{
1269 1269
 			$newarray['admin'] = $GLOBALS['egw_info']['user']['apps']['admin'];
1270
-			foreach($GLOBALS['egw_info']['user']['apps'] as $index => $value)
1270
+			foreach ($GLOBALS['egw_info']['user']['apps'] as $index => $value)
1271 1271
 			{
1272
-				if($index != 'admin')
1272
+				if ($index != 'admin')
1273 1273
 				{
1274 1274
 					$newarray[$index] = $value;
1275 1275
 				}
@@ -1282,7 +1282,7 @@  discard block
 block discarded – undo
1282 1282
 		unset($newarray);
1283 1283
 
1284 1284
 		$apps = array();
1285
-		foreach($GLOBALS['egw_info']['user']['apps'] as $app => $data)
1285
+		foreach ($GLOBALS['egw_info']['user']['apps'] as $app => $data)
1286 1286
 		{
1287 1287
 			if (is_long($app))
1288 1288
 			{
@@ -1299,29 +1299,29 @@  discard block
 block discarded – undo
1299 1299
 				if ($data['status'] == 4)
1300 1300
 				{
1301 1301
 					$apps[$app]['target'] = ' target="'.$app.'" onClick="'."if (this != '') { window.open(this+'".
1302
-						(strpos($apps[$app]['url'],'?') !== false ? '&' : '?').
1302
+						(strpos($apps[$app]['url'], '?') !== false ? '&' : '?').
1303 1303
 						"referer='+encodeURIComponent(location),this.target,'width=800,height=600,scrollbars=yes,resizable=yes'); return false; } else { return true; }".'"';
1304 1304
 				}
1305
-				elseif(isset($GLOBALS['egw_info']['flags']['navbar_target']) && $GLOBALS['egw_info']['flags']['navbar_target'])
1305
+				elseif (isset($GLOBALS['egw_info']['flags']['navbar_target']) && $GLOBALS['egw_info']['flags']['navbar_target'])
1306 1306
 				{
1307
-					$apps[$app]['target'] = 'target="' . $GLOBALS['egw_info']['flags']['navbar_target'] . '"';
1307
+					$apps[$app]['target'] = 'target="'.$GLOBALS['egw_info']['flags']['navbar_target'].'"';
1308 1308
 				}
1309 1309
 				else
1310 1310
 				{
1311 1311
 					$apps[$app]['target'] = '';
1312 1312
 				}
1313 1313
 
1314
-				$icon = isset($data['icon']) ?  $data['icon'] : 'navbar';
1314
+				$icon = isset($data['icon']) ? $data['icon'] : 'navbar';
1315 1315
 				$icon_app = isset($data['icon_app']) ? $data['icon_app'] : $app;
1316 1316
 				if ($app != $GLOBALS['egw_info']['flags']['currentapp'])
1317 1317
 				{
1318
-					$apps[$app]['icon']  = common::image($icon_app,Array($icon,'nonav'),'',$svg);
1319
-					$apps[$app]['icon_hover']  = common::image_on($icon_app,Array($icon,'nonav'),'-over',$svg);
1318
+					$apps[$app]['icon'] = common::image($icon_app, Array($icon, 'nonav'), '', $svg);
1319
+					$apps[$app]['icon_hover'] = common::image_on($icon_app, Array($icon, 'nonav'), '-over', $svg);
1320 1320
 				}
1321 1321
 				else
1322 1322
 				{
1323
-					$apps[$app]['icon']  = common::image_on($icon_app,Array($icon,'nonav'),'-over',$svg);
1324
-					$apps[$app]['icon_hover']  = common::image($icon_app,Array($icon,'nonav'),'',$svg);
1323
+					$apps[$app]['icon'] = common::image_on($icon_app, Array($icon, 'nonav'), '-over', $svg);
1324
+					$apps[$app]['icon_hover'] = common::image($icon_app, Array($icon, 'nonav'), '', $svg);
1325 1325
 				}
1326 1326
 			}
1327 1327
 		}
@@ -1356,15 +1356,15 @@  discard block
 block discarded – undo
1356 1356
 		$apps['about']['title'] = 'EGroupware';
1357 1357
 
1358 1358
 		$apps['about']['url']   = egw::link('/about.php');
1359
-		$apps['about']['icon']  = common::image('phpgwapi',Array('about','nonav'));
1360
-		$apps['about']['icon_hover']  = common::image_on('phpgwapi',Array('about','nonav'),'-over');
1359
+		$apps['about']['icon']  = common::image('phpgwapi', Array('about', 'nonav'));
1360
+		$apps['about']['icon_hover'] = common::image_on('phpgwapi', Array('about', 'nonav'), '-over');
1361 1361
 		$apps['about']['name'] = 'about';
1362 1362
 
1363 1363
 		$apps['logout']['title'] = lang('Logout');
1364 1364
 		$apps['logout']['name'] = 'logout';
1365 1365
 		$apps['logout']['url']   = egw::link('/logout.php');
1366
-		$apps['logout']['icon']  = common::image('phpgwapi',Array('logout','nonav'));
1367
-		$apps['logout']['icon_hover']  = common::image_on('phpgwapi',Array('logout','nonav'),'-over');
1366
+		$apps['logout']['icon']  = common::image('phpgwapi', Array('logout', 'nonav'));
1367
+		$apps['logout']['icon_hover'] = common::image_on('phpgwapi', Array('logout', 'nonav'), '-over');
1368 1368
 
1369 1369
 		return $apps;
1370 1370
 	}
@@ -1410,7 +1410,7 @@  discard block
 block discarded – undo
1410 1410
 			if (html::$ua_mobile) $themes_to_check[] = $this->template_dir.'/css/mobile.css';
1411 1411
 			$themes_to_check[] = $this->template_dir.'/css/'.$GLOBALS['egw_info']['user']['preferences']['common']['theme'].'.css';
1412 1412
 			$themes_to_check[] = $this->template_dir.'/css/'.$this->template.'.css';
1413
-			foreach($themes_to_check as $theme_css)
1413
+			foreach ($themes_to_check as $theme_css)
1414 1414
 			{
1415 1415
 				if (file_exists(EGW_SERVER_ROOT.$theme_css)) break;
1416 1416
 			}
@@ -1422,7 +1422,7 @@  discard block
 block discarded – undo
1422 1422
 
1423 1423
 			// sending print css last, so it can overwrite anything
1424 1424
 			$print_css = $this->template_dir.'/print.css';
1425
-			if(!file_exists(EGW_SERVER_ROOT.$print_css))
1425
+			if (!file_exists(EGW_SERVER_ROOT.$print_css))
1426 1426
 			{
1427 1427
 				$print_css = '/phpgwapi/templates/idots/print.css';
1428 1428
 			}
@@ -1434,15 +1434,15 @@  discard block
 block discarded – undo
1434 1434
 		$base_path = $GLOBALS['egw_info']['server']['webserver_url'];
1435 1435
 		if ($base_path[0] != '/') $base_path = parse_url($base_path, PHP_URL_PATH);
1436 1436
 		$css_files = '';
1437
-		foreach(self::$css_include_files as $path)
1437
+		foreach (self::$css_include_files as $path)
1438 1438
 		{
1439
-			foreach(self::resolve_css_includes($path) as $path)
1439
+			foreach (self::resolve_css_includes($path) as $path)
1440 1440
 			{
1441
-				list($file,$query) = explode('?',$path,2);
1441
+				list($file, $query) = explode('?', $path, 2);
1442 1442
 				if (($mod = filemtime(EGW_SERVER_ROOT.$file)) > $max_modified) $max_modified = $mod;
1443 1443
 
1444 1444
 				// do NOT include app.css or categories.php, as it changes from app to app
1445
-				if ($debug_minify || substr($path, -8) == '/app.css' || substr($file,-14) == 'categories.php')
1445
+				if ($debug_minify || substr($path, -8) == '/app.css' || substr($file, -14) == 'categories.php')
1446 1446
 				{
1447 1447
 					$css_files .= '<link href="'.$GLOBALS['egw_info']['server']['webserver_url'].$path.($query ? '&' : '?').$mod.'" type="text/css" rel="StyleSheet" />'."\n";
1448 1448
 				}
@@ -1456,7 +1456,7 @@  discard block
 block discarded – undo
1456 1456
 		{
1457 1457
 			$css = $GLOBALS['egw_info']['server']['webserver_url'].'/phpgwapi/inc/min/?';
1458 1458
 			if ($base_path && $base_path != '/') $css .= 'b='.substr($base_path, 1).'&';
1459
-			$css .= 'f='.$css_file .
1459
+			$css .= 'f='.$css_file.
1460 1460
 				($GLOBALS['egw_info']['server']['debug_minify'] === 'debug' ? '&debug' : '').
1461 1461
 				'&'.$max_modified;
1462 1462
 			$css_files = '<link href="'.$css.'" type="text/css" rel="StyleSheet" />'."\n".$css_files;
@@ -1473,20 +1473,20 @@  discard block
 block discarded – undo
1473 1473
 	 * @param string $path EGroupware relative path eg. /phpgwapi/templates/default/some.css
1474 1474
 	 * @return array parsed pathes (EGroupware relative) including $path itself
1475 1475
 	 */
1476
-	protected static function resolve_css_includes($path, &$pathes=array())
1476
+	protected static function resolve_css_includes($path, &$pathes = array())
1477 1477
 	{
1478 1478
 		$matches = null;
1479 1479
 
1480
-		list($file,$query) = explode('?',$path,2);
1481
-		if (($to_check = file_get_contents (EGW_SERVER_ROOT.$file, false, null, -1, 1024)) &&
1480
+		list($file, $query) = explode('?', $path, 2);
1481
+		if (($to_check = file_get_contents(EGW_SERVER_ROOT.$file, false, null, -1, 1024)) &&
1482 1482
 			stripos($to_check, '/*@import') !== false && preg_match_all('|/\*@import url\("([^"]+)"|i', $to_check, $matches))
1483 1483
 		{
1484
-			foreach($matches[1] as $import_path)
1484
+			foreach ($matches[1] as $import_path)
1485 1485
 			{
1486 1486
 				if ($import_path[0] != '/')
1487 1487
 				{
1488 1488
 					$dir = dirname($path);
1489
-					while(substr($import_path,0,3) == '../')
1489
+					while (substr($import_path, 0, 3) == '../')
1490 1490
 					{
1491 1491
 						$dir = dirname($dir);
1492 1492
 						$import_path = substr($import_path, 3);
@@ -1511,7 +1511,7 @@  discard block
 block discarded – undo
1511 1511
 	 * @param array $extra =array() extra data to pass to egw.js as data-parameter
1512 1512
 	 * @return string the javascript to be included
1513 1513
 	 */
1514
-	public static function _get_js(array $extra=array())
1514
+	public static function _get_js(array $extra = array())
1515 1515
 	{
1516 1516
 		$java_script = '';
1517 1517
 
@@ -1519,7 +1519,7 @@  discard block
 block discarded – undo
1519 1519
 		Think of conf vars etc...  ([email protected]) */
1520 1520
 		if (isset($GLOBALS['egw_info']['flags']['java_script_thirst']))
1521 1521
 		{
1522
-			$java_script .= $GLOBALS['egw_info']['flags']['java_script_thirst'] . "\n";
1522
+			$java_script .= $GLOBALS['egw_info']['flags']['java_script_thirst']."\n";
1523 1523
 		}
1524 1524
 		// add configuration, link-registry, images, user-data and -perferences for non-popup windows
1525 1525
 		// specifying etag in url to force reload, as we send expires header
@@ -1531,7 +1531,7 @@  discard block
 block discarded – undo
1531 1531
 			self::validate_file('/phpgwapi/images.php', array(
1532 1532
 				'template' => $GLOBALS['egw_info']['server']['template_set'],
1533 1533
 				'etag' => md5(json_encode(common::image_map($GLOBALS['egw_info']['server']['template_set']))),
1534
-				'svg' => 0,	// always load non-svg image map
1534
+				'svg' => 0, // always load non-svg image map
1535 1535
 			));
1536 1536
 			self::validate_file('/phpgwapi/user.php', array(
1537 1537
 				'user' => $GLOBALS['egw_info']['user']['account_lid'],
@@ -1543,7 +1543,7 @@  discard block
 block discarded – undo
1543 1543
 		}
1544 1544
 
1545 1545
 		$extra['url'] = $GLOBALS['egw_info']['server']['webserver_url'];
1546
-		$extra['include'] = array_map(function($str){return substr($str,1);}, self::get_script_links(true), array(1));
1546
+		$extra['include'] = array_map(function($str) {return substr($str, 1); }, self::get_script_links(true), array(1));
1547 1547
 		$extra['app'] = $GLOBALS['egw_info']['flags']['currentapp'];
1548 1548
 
1549 1549
 		// Load LABjs ONCE here
@@ -1553,18 +1553,18 @@  discard block
 block discarded – undo
1553 1553
 				'/phpgwapi/js/jsapi/egw.js?'.filemtime(EGW_SERVER_ROOT.'/phpgwapi/js/jsapi/egw.js').'" id="egw_script_id"';
1554 1554
 
1555 1555
 		// add values of extra parameter and class var as data attributes to script tag of egw.js
1556
-		foreach($extra+self::$extra as $name => $value)
1556
+		foreach ($extra + self::$extra as $name => $value)
1557 1557
 		{
1558 1558
 			if (is_array($value)) $value = json_encode($value);
1559 1559
 			// we need to double encode (html::htmlspecialchars( , TRUE)), as otherwise we get invalid json, eg. for quotes
1560
-			$java_script .= ' data-'.$name."=\"". html::htmlspecialchars($value, true)."\"";
1560
+			$java_script .= ' data-'.$name."=\"".html::htmlspecialchars($value, true)."\"";
1561 1561
 		}
1562 1562
 		$java_script .= "></script>\n";
1563 1563
 
1564
-		if(@isset($_GET['menuaction']))
1564
+		if (@isset($_GET['menuaction']))
1565 1565
 		{
1566
-			list(, $class) = explode('.',$_GET['menuaction']);
1567
-			if(is_array($GLOBALS[$class]->public_functions) &&
1566
+			list(, $class) = explode('.', $_GET['menuaction']);
1567
+			if (is_array($GLOBALS[$class]->public_functions) &&
1568 1568
 				$GLOBALS[$class]->public_functions['java_script'])
1569 1569
 			{
1570 1570
 				$java_script .= $GLOBALS[$class]->java_script();
@@ -1573,10 +1573,10 @@  discard block
 block discarded – undo
1573 1573
 		if (isset($GLOBALS['egw_info']['flags']['java_script']))
1574 1574
 		{
1575 1575
 			// Strip out any script tags, this needs to be executed as anonymous function
1576
-			$GLOBALS['egw_info']['flags']['java_script'] = preg_replace(array('/(<script[^>]*>)([^<]*)/is','/<\/script>/'),array('$2',''),$GLOBALS['egw_info']['flags']['java_script']);
1577
-			if(trim($GLOBALS['egw_info']['flags']['java_script']) != '')
1576
+			$GLOBALS['egw_info']['flags']['java_script'] = preg_replace(array('/(<script[^>]*>)([^<]*)/is', '/<\/script>/'), array('$2', ''), $GLOBALS['egw_info']['flags']['java_script']);
1577
+			if (trim($GLOBALS['egw_info']['flags']['java_script']) != '')
1578 1578
 			{
1579
-				$java_script .= '<script type="text/javascript">window.egw_LAB.wait(function() {'.$GLOBALS['egw_info']['flags']['java_script'] . "});</script>\n";
1579
+				$java_script .= '<script type="text/javascript">window.egw_LAB.wait(function() {'.$GLOBALS['egw_info']['flags']['java_script']."});</script>\n";
1580 1580
 			}
1581 1581
 		}
1582 1582
 
@@ -1593,13 +1593,13 @@  discard block
 block discarded – undo
1593 1593
 	function list_themes()
1594 1594
 	{
1595 1595
 		$list = array();
1596
-		if (($dh = @opendir(EGW_SERVER_ROOT.$this->template_dir . SEP . 'css')))
1596
+		if (($dh = @opendir(EGW_SERVER_ROOT.$this->template_dir.SEP.'css')))
1597 1597
 		{
1598 1598
 			while (($file = readdir($dh)))
1599 1599
 			{
1600 1600
 				if (preg_match('/'."\.css$".'/i', $file))
1601 1601
 				{
1602
-					list($name) = explode('.',$file);
1602
+					list($name) = explode('.', $file);
1603 1603
 					$list[$name] = $name;
1604 1604
 				}
1605 1605
 			}
@@ -1614,20 +1614,19 @@  discard block
 block discarded – undo
1614 1614
 	 * @param boolean $full_data =false true: value is array with values for keys 'name', 'title', ...
1615 1615
 	 * @returns array alphabetically sorted list of templates
1616 1616
 	 */
1617
-	static function list_templates($full_data=false)
1617
+	static function list_templates($full_data = false)
1618 1618
 	{
1619
-		$list = array('pixelegg'=>null,'jdots'=>null,'idots'=>null);
1619
+		$list = array('pixelegg'=>null, 'jdots'=>null, 'idots'=>null);
1620 1620
 		// templates packaged in the api
1621
-		$d = dir(EGW_SERVER_ROOT . '/phpgwapi/templates');
1622
-		while (($entry=$d->read()))
1621
+		$d = dir(EGW_SERVER_ROOT.'/phpgwapi/templates');
1622
+		while (($entry = $d->read()))
1623 1623
 		{
1624
-			if ($entry != '..' && file_exists(EGW_SERVER_ROOT . '/phpgwapi/templates/' . $entry .'/class.'.$entry.'_framework.inc.php'))
1624
+			if ($entry != '..' && file_exists(EGW_SERVER_ROOT.'/phpgwapi/templates/'.$entry.'/class.'.$entry.'_framework.inc.php'))
1625 1625
 			{
1626
-				if (file_exists ($f = EGW_SERVER_ROOT . '/phpgwapi/templates/' . $entry . '/setup/setup.inc.php'))
1626
+				if (file_exists($f = EGW_SERVER_ROOT.'/phpgwapi/templates/'.$entry.'/setup/setup.inc.php'))
1627 1627
 				{
1628 1628
 					include($f);
1629
-					$list[$entry] = $full_data ? $GLOBALS['egw_info']['template'][$entry] :
1630
-						$GLOBALS['egw_info']['template'][$entry]['title'];
1629
+					$list[$entry] = $full_data ? $GLOBALS['egw_info']['template'][$entry] : $GLOBALS['egw_info']['template'][$entry]['title'];
1631 1630
 				}
1632 1631
 				else
1633 1632
 				{
@@ -1641,16 +1640,15 @@  discard block
 block discarded – undo
1641 1640
 		$d->close();
1642 1641
 		// templates packaged like apps in own directories (containing as setup/setup.inc.php file!)
1643 1642
 		$dr = dir(EGW_SERVER_ROOT);
1644
-		while (($entry=$dr->read()))
1643
+		while (($entry = $dr->read()))
1645 1644
 		{
1646 1645
 			if ($entry != '..' && !isset($GLOBALS['egw_info']['apps'][$entry]) && is_dir(EGW_SERVER_ROOT.'/'.$entry) &&
1647
-				file_exists($f = EGW_SERVER_ROOT . '/' . $entry .'/setup/setup.inc.php'))
1646
+				file_exists($f = EGW_SERVER_ROOT.'/'.$entry.'/setup/setup.inc.php'))
1648 1647
 			{
1649 1648
 				include($f);
1650 1649
 				if (isset($GLOBALS['egw_info']['template'][$entry]))
1651 1650
 				{
1652
-					$list[$entry] = $full_data ? $GLOBALS['egw_info']['template'][$entry] :
1653
-						$GLOBALS['egw_info']['template'][$entry]['title'];
1651
+					$list[$entry] = $full_data ? $GLOBALS['egw_info']['template'][$entry] : $GLOBALS['egw_info']['template'][$entry]['title'];
1654 1652
 				}
1655 1653
 			}
1656 1654
 		}
@@ -1667,14 +1665,14 @@  discard block
 block discarded – undo
1667 1665
 	* @param array $vars
1668 1666
 	* @param array $apps
1669 1667
 	*/
1670
-	function topmenu(array $vars,array $apps)
1668
+	function topmenu(array $vars, array $apps)
1671 1669
 	{
1672
-		if($GLOBALS['egw_info']['user']['apps']['home'] && isset($apps['home']))
1670
+		if ($GLOBALS['egw_info']['user']['apps']['home'] && isset($apps['home']))
1673 1671
 		{
1674 1672
 			$this->_add_topmenu_item($apps['home']);
1675 1673
 		}
1676 1674
 
1677
-		if($GLOBALS['egw_info']['user']['apps']['preferences'])
1675
+		if ($GLOBALS['egw_info']['user']['apps']['preferences'])
1678 1676
 		{
1679 1677
 			$this->add_preferences_topmenu('prefs');
1680 1678
 			$this->add_preferences_topmenu('acl');
@@ -1699,9 +1697,9 @@  discard block
 block discarded – undo
1699 1697
 			$this->_add_topmenu_item(array_merge($apps['manual'],array('title' => lang('Help'))));
1700 1698
 		}*/
1701 1699
 
1702
-		$GLOBALS['egw']->hooks->process('topmenu_info',array(),true);
1700
+		$GLOBALS['egw']->hooks->process('topmenu_info', array(), true);
1703 1701
 		// Add extra items added by hooks
1704
-		foreach(self::$top_menu_extra as $extra_item) {
1702
+		foreach (self::$top_menu_extra as $extra_item) {
1705 1703
 			$this->_add_topmenu_item($extra_item);
1706 1704
 		}
1707 1705
 
@@ -1711,7 +1709,7 @@  discard block
 block discarded – undo
1711 1709
 		{
1712 1710
 			$this->_add_topmenu_info_item($update, 'update');
1713 1711
 		}
1714
-		if($GLOBALS['egw_info']['user']['apps']['notifications'])
1712
+		if ($GLOBALS['egw_info']['user']['apps']['notifications'])
1715 1713
 		{
1716 1714
 			$this->_add_topmenu_info_item(self::_get_notification_bell(), 'notifications');
1717 1715
 		}
@@ -1723,9 +1721,9 @@  discard block
 block discarded – undo
1723 1721
 	/**
1724 1722
 	 * Add preferences link to topmenu using settings-hook to know if an app supports preferences
1725 1723
 	 */
1726
-	protected function add_preferences_topmenu($type='prefs')
1724
+	protected function add_preferences_topmenu($type = 'prefs')
1727 1725
 	{
1728
-		static $memberships=null;
1726
+		static $memberships = null;
1729 1727
 		if (!isset($memberships)) $memberships = $GLOBALS['egw']->accounts->memberships($GLOBALS['egw_info']['user']['account_id'], true);
1730 1728
 		static $types = array(
1731 1729
 			'prefs' => array(
@@ -1739,20 +1737,20 @@  discard block
 block discarded – undo
1739 1737
 			'cats' => array(
1740 1738
 				'title' => 'Categories',
1741 1739
 				'hook' => 'categories',
1742
-				'run_hook' => true,	// acturally run hook, not just look it's implemented
1740
+				'run_hook' => true, // acturally run hook, not just look it's implemented
1743 1741
 			),
1744 1742
 		);
1745 1743
 		if (!$GLOBALS['egw_info']['user']['apps']['preferences'] || $GLOBALS['egw_info']['server']['deny_'.$type] &&
1746 1744
 			array_intersect($memberships, (array)$GLOBALS['egw_info']['server']['deny_'.$type]) &&
1747 1745
 			!$GLOBALS['egw_info']['user']['apps']['admin'])
1748 1746
 		{
1749
-			return;	// user has no access to preferences app
1747
+			return; // user has no access to preferences app
1750 1748
 		}
1751 1749
 		if (isset($types[$type]['run_hook']))
1752 1750
 		{
1753 1751
 			$apps = $GLOBALS['egw']->hooks->process($types[$type]['hook']);
1754 1752
 			// as all apps answer, we need to remove none-true responses
1755
-			foreach($apps as $app => $val)
1753
+			foreach ($apps as $app => $val)
1756 1754
 			{
1757 1755
 				if (!$val) unset($apps[$app]);
1758 1756
 			}
@@ -1778,7 +1776,7 @@  discard block
 block discarded – undo
1778 1776
 	* @access protected
1779 1777
 	* @return void
1780 1778
 	*/
1781
-	abstract function _add_topmenu_item(array $app_data,$alt_label=null);
1779
+	abstract function _add_topmenu_item(array $app_data, $alt_label = null);
1782 1780
 
1783 1781
 	/**
1784 1782
 	* Add info items to the topmenu template class to be displayed
@@ -1788,7 +1786,7 @@  discard block
 block discarded – undo
1788 1786
 	* @access protected
1789 1787
 	* @return void
1790 1788
 	*/
1791
-	abstract function _add_topmenu_info_item($content, $id=null);
1789
+	abstract function _add_topmenu_info_item($content, $id = null);
1792 1790
 
1793 1791
 	static $top_menu_extra = array();
1794 1792
 
@@ -1803,7 +1801,7 @@  discard block
 block discarded – undo
1803 1801
 	* @access public
1804 1802
 	* @return void
1805 1803
 	*/
1806
-	public static function add_topmenu_item($id,$url,$title,$target = '')
1804
+	public static function add_topmenu_item($id, $url, $title, $target = '')
1807 1805
 	{
1808 1806
 		$entry['name'] = $id;
1809 1807
 		$entry['url'] = $url;
@@ -1824,7 +1822,7 @@  discard block
 block discarded – undo
1824 1822
 	* @access public
1825 1823
 	* @return void
1826 1824
 	*/
1827
-	abstract function topmenu_info_icon($id,$icon_src,$iconlink,$blink=false,$tooltip=null);
1825
+	abstract function topmenu_info_icon($id, $icon_src, $iconlink, $blink = false, $tooltip = null);
1828 1826
 
1829 1827
 	/**
1830 1828
 	 * Call and return content of 'after_navbar' hook
@@ -1834,7 +1832,7 @@  discard block
 block discarded – undo
1834 1832
 	protected function _get_after_navbar()
1835 1833
 	{
1836 1834
 		ob_start();
1837
-		$GLOBALS['egw']->hooks->process('after_navbar',null,true);
1835
+		$GLOBALS['egw']->hooks->process('after_navbar', null, true);
1838 1836
 		$content = ob_get_contents();
1839 1837
 		ob_end_clean();
1840 1838
 
@@ -1868,7 +1866,7 @@  discard block
 block discarded – undo
1868 1866
 	 * @deprecated since 14.1 use app.js et2_ready method instead to execute code or bind a handler (CSP will stop onXXX attributes!)
1869 1867
 	 * @return string content of onXXX tag after adding code
1870 1868
 	 */
1871
-	static function set_onload($code='',$replace=false)
1869
+	static function set_onload($code = '', $replace = false)
1872 1870
 	{
1873 1871
 		if ($replace || empty(self::$body_tags['onLoad']))
1874 1872
 		{
@@ -1889,7 +1887,7 @@  discard block
 block discarded – undo
1889 1887
 	 * @deprecated since 14.1 use app.js et2_ready method instead to execute code or bind a handler (CSP will stop onXXX attributes!)
1890 1888
 	 * @return string content of onXXX tag after adding code
1891 1889
 	 */
1892
-	static function set_onunload($code='',$replace=false)
1890
+	static function set_onunload($code = '', $replace = false)
1893 1891
 	{
1894 1892
 		if ($replace || empty(self::$body_tags['onUnload']))
1895 1893
 		{
@@ -1910,7 +1908,7 @@  discard block
 block discarded – undo
1910 1908
 	 * @deprecated since 14.1 use app.js et2_ready method instead to execute code or bind a handler (CSP will stop onXXX attributes!)
1911 1909
 	 * @return string content of onXXX tag after adding code
1912 1910
 	 */
1913
-	static function set_onbeforeunload($code='',$replace=false)
1911
+	static function set_onbeforeunload($code = '', $replace = false)
1914 1912
 	{
1915 1913
 		if ($replace || empty(self::$body_tags['onBeforeUnload']))
1916 1914
 		{
@@ -1931,7 +1929,7 @@  discard block
 block discarded – undo
1931 1929
 	 * @deprecated since 14.1 use app.js et2_ready method instead to execute code or bind a handler (CSP will stop onXXX attributes!)
1932 1930
 	 * @return string content of onXXX tag after adding code
1933 1931
 	 */
1934
-	static function set_onresize($code='',$replace=false)
1932
+	static function set_onresize($code = '', $replace = false)
1935 1933
 	{
1936 1934
 		if ($replace || empty(self::$body_tags['onResize']))
1937 1935
 		{
@@ -1953,16 +1951,16 @@  discard block
 block discarded – undo
1953 1951
 	static public function _get_body_attribs()
1954 1952
 	{
1955 1953
 		$js = '';
1956
-		foreach(self::$body_tags as $what => $data)
1954
+		foreach (self::$body_tags as $what => $data)
1957 1955
 		{
1958 1956
 			if (!empty($data))
1959 1957
 			{
1960
-				if($what == 'onLoad')
1958
+				if ($what == 'onLoad')
1961 1959
 				{
1962
-					$js .= 'onLoad="egw_LAB.wait(function() {'. htmlspecialchars($data).'})"';
1960
+					$js .= 'onLoad="egw_LAB.wait(function() {'.htmlspecialchars($data).'})"';
1963 1961
 					continue;
1964 1962
 				}
1965
-				$js .= ' '.$what.'="' . htmlspecialchars($data) . '"';
1963
+				$js .= ' '.$what.'="'.htmlspecialchars($data).'"';
1966 1964
 			}
1967 1965
 		}
1968 1966
 		return $js;
@@ -1992,7 +1990,7 @@  discard block
 block discarded – undo
1992 1990
 	*
1993 1991
 	* @returns bool was the file found?
1994 1992
 	*/
1995
-	static function validate_file($package, $file=null, $app='phpgwapi')
1993
+	static function validate_file($package, $file = null, $app = 'phpgwapi')
1996 1994
 	{
1997 1995
 		self::$js_include_mgr->include_js_file($package, $file, $app);
1998 1996
 	}
@@ -2004,7 +2002,7 @@  discard block
 block discarded – undo
2004 2002
 	 * @param boolean $clear_files =false true clear files after returning them
2005 2003
 	 * @return array with pathes relative to EGW_SERVER_ROOT
2006 2004
 	 */
2007
-	static function js_files(array $files=null, $clear_files=false)
2005
+	static function js_files(array $files = null, $clear_files = false)
2008 2006
 	{
2009 2007
 		if (isset($files) && is_array($files))
2010 2008
 		{
@@ -2023,7 +2021,7 @@  discard block
 block discarded – undo
2023 2021
 	 * @param boolean $clear_files =false true clear files after returning them
2024 2022
 	 * @return string|array see $return_pathes parameter
2025 2023
 	 */
2026
-	static public function get_script_links($return_pathes=false, $clear_files=false)
2024
+	static public function get_script_links($return_pathes = false, $clear_files = false)
2027 2025
 	{
2028 2026
 		$to_include = self::bundle_js_includes(self::$js_include_mgr->get_included_files($clear_files));
2029 2027
 
@@ -2031,7 +2029,7 @@  discard block
 block discarded – undo
2031 2029
 		{
2032 2030
 			return $to_include;
2033 2031
 		}
2034
-		$start = '<script type="text/javascript" src="'. $GLOBALS['egw_info']['server']['webserver_url'];
2032
+		$start = '<script type="text/javascript" src="'.$GLOBALS['egw_info']['server']['webserver_url'];
2035 2033
 		$end = '">'."</script>\n";
2036 2034
 		return "\n".$start.implode($end.$start, $to_include).$end;
2037 2035
 	}
@@ -2052,14 +2050,14 @@  discard block
 block discarded – undo
2052 2050
 			$bundles = egw_cache::getTree(__CLASS__, 'bundles', array(__CLASS__, 'get_bundles'), array(), 7200);
2053 2051
 			$bundles_ts = $bundles['.ts'];
2054 2052
 			unset($bundles['.ts']);
2055
-			foreach($bundles as $name => $files)
2053
+			foreach ($bundles as $name => $files)
2056 2054
 			{
2057 2055
 				$file2bundle += array_combine($files, array_fill(0, count($files), $name));
2058 2056
 			}
2059 2057
 		}
2060 2058
 		$to_include = $included_bundles = array();
2061 2059
 		$query = null;
2062
-		foreach($js_includes as $file)
2060
+		foreach ($js_includes as $file)
2063 2061
 		{
2064 2062
 			if (!isset($to_include[$file]))
2065 2063
 			{
@@ -2104,31 +2102,31 @@  discard block
 block discarded – undo
2104 2102
 	 * @param int& $max_modified =null on return maximum modification time of bundle
2105 2103
 	 * @return array js-files (can be more then one, if one of given files can not be bundeled)
2106 2104
 	 */
2107
-	protected static function bundle_urls(array $js_includes, &$max_modified=null)
2105
+	protected static function bundle_urls(array $js_includes, &$max_modified = null)
2108 2106
 	{
2109 2107
 		$debug_minify = $GLOBALS['egw_info']['server']['debug_minify'] === 'True';
2110 2108
 		$to_include = $to_minify = array();
2111 2109
 		$max_modified = 0;
2112 2110
 		$query = null;
2113
-		foreach($js_includes as $path)
2111
+		foreach ($js_includes as $path)
2114 2112
 		{
2115
-			if ($path == '/phpgwapi/js/jsapi/egw.js') continue;	// loaded via own tag, and we must not load it twice!
2113
+			if ($path == '/phpgwapi/js/jsapi/egw.js') continue; // loaded via own tag, and we must not load it twice!
2116 2114
 
2117 2115
 			unset($query);
2118
-			list($path,$query) = explode('?',$path,2);
2116
+			list($path, $query) = explode('?', $path, 2);
2119 2117
 			$mod = filemtime(EGW_SERVER_ROOT.$path);
2120 2118
 
2121 2119
 			// for now minify does NOT support query parameters, nor php files generating javascript
2122
-			if ($debug_minify || $query || substr($path, -3) != '.js' || strpos($path,'ckeditor') !== false ||
2120
+			if ($debug_minify || $query || substr($path, -3) != '.js' || strpos($path, 'ckeditor') !== false ||
2123 2121
 				substr($path, -7) == '/app.js')	// do NOT include app.js, as it changes from app to app
2124 2122
 			{
2125
-				$path .= '?'. $mod.($query ? '&'.$query : '');
2123
+				$path .= '?'.$mod.($query ? '&'.$query : '');
2126 2124
 				$to_include[] = $path;
2127 2125
 			}
2128 2126
 			else
2129 2127
 			{
2130 2128
 				if ($mod > $max_modified) $max_modified = $mod;
2131
-				$to_minify[] = substr($path,1);
2129
+				$to_minify[] = substr($path, 1);
2132 2130
 			}
2133 2131
 		}
2134 2132
 		if (!$debug_minify && $to_minify)
@@ -2136,7 +2134,7 @@  discard block
 block discarded – undo
2136 2134
 			$base_path = $GLOBALS['egw_info']['server']['webserver_url'];
2137 2135
 			if ($base_path[0] != '/') $base_path = parse_url($base_path, PHP_URL_PATH);
2138 2136
 			$path = '/phpgwapi/inc/min/?'.($base_path && $base_path != '/' ? 'b='.substr($base_path, 1).'&' : '').
2139
-				'f='.implode(',', $to_minify) .
2137
+				'f='.implode(',', $to_minify).
2140 2138
 				($GLOBALS['egw_info']['server']['debug_minify'] === 'debug' ? '&debug' : '').
2141 2139
 				'&'.$max_modified;
2142 2140
 			// need to include minified javascript before not minified stuff like jscalendar-setup, as it might depend on it
@@ -2213,12 +2211,12 @@  discard block
 block discarded – undo
2213 2211
 		}*/
2214 2212
 
2215 2213
 		// automatic split bundles with more then MAX_BUNDLE_FILES (=50) files
2216
-		foreach($bundles as $name => $files)
2214
+		foreach ($bundles as $name => $files)
2217 2215
 		{
2218 2216
 			$n = '';
2219
-			while (count($files) > self::MAX_BUNDLE_FILES*(int)$n)
2217
+			while (count($files) > self::MAX_BUNDLE_FILES * (int)$n)
2220 2218
 			{
2221
-				$files80 = array_slice($files, self::MAX_BUNDLE_FILES*(int)$n, self::MAX_BUNDLE_FILES, true);
2219
+				$files80 = array_slice($files, self::MAX_BUNDLE_FILES * (int)$n, self::MAX_BUNDLE_FILES, true);
2222 2220
 				$bundles[$name.$n++] = $files80;
2223 2221
 			}
2224 2222
 		}
@@ -2252,7 +2250,7 @@  discard block
 block discarded – undo
2252 2250
 	 * @param boolean $no_default_css =false true do NOT load any default css, only what app explicitly includes
2253 2251
 	 * @return boolean false: css file not found, true: file found
2254 2252
 	 */
2255
-	public static function includeCSS($app, $name=null, $append=true, $no_default_css=false)
2253
+	public static function includeCSS($app, $name = null, $append = true, $no_default_css = false)
2256 2254
 	{
2257 2255
 		if ($no_default_css)
2258 2256
 		{
@@ -2272,12 +2270,12 @@  discard block
 block discarded – undo
2272 2270
 		{
2273 2271
 			$path = $app;
2274 2272
 		}
2275
-		if (!file_exists(EGW_SERVER_ROOT.$path) && !file_exists(EGW_SERVER_ROOT . parse_url($path,PHP_URL_PATH)))
2273
+		if (!file_exists(EGW_SERVER_ROOT.$path) && !file_exists(EGW_SERVER_ROOT.parse_url($path, PHP_URL_PATH)))
2276 2274
 		{
2277 2275
 			//error_log(__METHOD__."($app,$name) $path NOT found!");
2278 2276
 			return false;
2279 2277
 		}
2280
-		if (!in_array($path,self::$css_include_files))
2278
+		if (!in_array($path, self::$css_include_files))
2281 2279
 		{
2282 2280
 			if ($append)
2283 2281
 			{
@@ -2301,15 +2299,15 @@  discard block
 block discarded – undo
2301 2299
 
2302 2300
 		// try to add app specific css file
2303 2301
 		self::includeCSS($app, 'app-'.$GLOBALS['egw_info']['user']['preferences']['common']['theme']) ||
2304
-			self::includeCSS($app,'app');
2302
+			self::includeCSS($app, 'app');
2305 2303
 
2306 2304
 		// add all css files from egw_framework::includeCSS()
2307 2305
 		$query = null;
2308
-		foreach(self::$css_include_files as $path)
2306
+		foreach (self::$css_include_files as $path)
2309 2307
 		{
2310 2308
 			unset($query);
2311
-			list($path,$query) = explode('?',$path,2);
2312
-			$path .= '?'. ($query ? $query : filemtime(EGW_SERVER_ROOT.$path));
2309
+			list($path, $query) = explode('?', $path, 2);
2310
+			$path .= '?'.($query ? $query : filemtime(EGW_SERVER_ROOT.$path));
2313 2311
 			$response->includeCSS($GLOBALS['egw_info']['server']['webserver_url'].$path);
2314 2312
 		}
2315 2313
 
@@ -2318,7 +2316,7 @@  discard block
 block discarded – undo
2318 2316
 
2319 2317
 		// add all js files from egw_framework::validate_file()
2320 2318
 		$files = self::bundle_js_includes(self::$js_include_mgr->get_included_files());
2321
-		foreach($files as $path)
2319
+		foreach ($files as $path)
2322 2320
 		{
2323 2321
 			$response->includeScript($GLOBALS['egw_info']['server']['webserver_url'].$path);
2324 2322
 		}
@@ -2378,7 +2376,7 @@  discard block
 block discarded – undo
2378 2376
 	 * @deprecated use egw_favorites::favorite_list
2379 2377
 	 * @return array with a single sidebox menu item (array) containing html for favorites
2380 2378
 	 */
2381
-	public static function favorite_list($app, $default=null)
2379
+	public static function favorite_list($app, $default = null)
2382 2380
 	{
2383 2381
 		return egw_favorites::list_favorites($app, $default);
2384 2382
 	}
@@ -2407,17 +2405,17 @@  discard block
 block discarded – undo
2407 2405
 	 */
2408 2406
 	public static function ajax_user_list()
2409 2407
 	{
2410
-		$list = array('accounts' => array(),'groups' => array(), 'owngroups' => array());
2411
-		if($GLOBALS['egw_info']['user']['preferences']['common']['account_selection'] == 'primary_group')
2408
+		$list = array('accounts' => array(), 'groups' => array(), 'owngroups' => array());
2409
+		if ($GLOBALS['egw_info']['user']['preferences']['common']['account_selection'] == 'primary_group')
2412 2410
 		{
2413 2411
 			$list['accounts']['filter']['group'] = $GLOBALS['egw_info']['user']['account_primary_group'];
2414 2412
 		}
2415
-		foreach($list as $type => &$accounts)
2413
+		foreach ($list as $type => &$accounts)
2416 2414
 		{
2417 2415
 			$options = array('account_type' => $type) + $accounts;
2418
-			$key_pair = accounts::link_query('',$options);
2416
+			$key_pair = accounts::link_query('', $options);
2419 2417
 			$accounts = array();
2420
-			foreach($key_pair as $account_id => $name)
2418
+			foreach ($key_pair as $account_id => $name)
2421 2419
 			{
2422 2420
 				$accounts[] = array('value' => $account_id, 'label' => $name);
2423 2421
 			}
@@ -2454,9 +2452,9 @@  discard block
 block discarded – undo
2454 2452
 	 *
2455 2453
 	 * @deprecated use $GLOBALS['egw']->framework->sidebox()
2456 2454
 	 */
2457
-	function display_sidebox($appname,$menu_title,$_file)
2455
+	function display_sidebox($appname, $menu_title, $_file)
2458 2456
 	{
2459 2457
 		$file = str_replace('preferences.uisettings.index', 'preferences.preferences_settings.index', $_file);
2460
-		$GLOBALS['egw']->framework->sidebox($appname,$menu_title,$file);
2458
+		$GLOBALS['egw']->framework->sidebox($appname, $menu_title, $file);
2461 2459
 	}
2462 2460
  }
Please login to merge, or discard this patch.