Completed
Push — 16.1 ( 82e441...5923cf )
by Nathan
40:06 queued 25:58
created
infolog/inc/class.infolog_hooks.inc.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 */
30 30
 	static function not_enum_group_acls($location)
31 31
 	{
32
-		unset($location);	// not used, but part of hook signature
32
+		unset($location); // not used, but part of hook signature
33 33
 		$config = Api\Config::read('infolog');
34 34
 
35 35
 		return $config['group_owners'];
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	static function search_link($location)
45 45
 	{
46
-		unset($location);	// not used, but part of hook signature
46
+		unset($location); // not used, but part of hook signature
47 47
 
48 48
 		return array(
49 49
 			'query'      => 'infolog.infolog_bo.link_query',
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 			'add_id'     => 'action_id',
67 67
 			'add_popup'  => '760x570',
68 68
 			'file_access'=> 'infolog.infolog_bo.file_access',
69
-			'file_access_user' => true,	// file_access supports 4th parameter $user
69
+			'file_access_user' => true, // file_access supports 4th parameter $user
70 70
 			'edit'       => array(
71 71
 				'menuaction' => 'infolog.infolog_ui.edit',
72 72
 			),
@@ -93,46 +93,46 @@  discard block
 block discarded – undo
93 93
 			display_sidebox($appname, lang('Favorites'), Framework\Favorites::list_favorites($appname));
94 94
 
95 95
 			$file = array(
96
-				'infolog list' => Egw::link('/index.php',array(
96
+				'infolog list' => Egw::link('/index.php', array(
97 97
 					'menuaction' => 'infolog.infolog_ui.index',
98 98
 					'ajax' => 'true')),
99 99
 				array(
100
-					'text' => lang('Add %1',lang(Link::get_registry($appname, 'entry'))),
100
+					'text' => lang('Add %1', lang(Link::get_registry($appname, 'entry'))),
101 101
 					'no_lang' => true,
102 102
 					'link' => "javascript:app.infolog.add_link_sidemenu();"
103 103
 				),
104
-				'Placeholders' => Egw::link('/index.php','menuaction=infolog.infolog_merge.show_replacements')
104
+				'Placeholders' => Egw::link('/index.php', 'menuaction=infolog.infolog_merge.show_replacements')
105 105
 			);
106
-			display_sidebox($appname,$GLOBALS['egw_info']['apps']['infolog']['title'].' '.lang('Menu'),$file);
106
+			display_sidebox($appname, $GLOBALS['egw_info']['apps']['infolog']['title'].' '.lang('Menu'), $file);
107 107
 		}
108 108
 
109 109
 		if ($GLOBALS['egw_info']['user']['apps']['admin'] && !Api\Header\UserAgent::mobile())
110 110
 		{
111 111
 			$file = Array(
112
-				'Site configuration' => Egw::link('/index.php',array(
112
+				'Site configuration' => Egw::link('/index.php', array(
113 113
 					'menuaction' => 'infolog.infolog_ui.admin',
114 114
 					// As long as CKEditor needs CSP exceptions, this needs to
115 115
 					// load in an iframe
116 116
 					'ajax' => 'false',
117 117
 				)),
118
-				'Global Categories'  => Egw::link('/index.php',array(
118
+				'Global Categories'  => Egw::link('/index.php', array(
119 119
 					'menuaction' => 'admin.admin_categories.index',
120 120
 					'appname'    => $appname,
121 121
 					'global_cats'=> True,
122 122
 					'ajax' => 'true',
123 123
 				)),
124
-				'Custom fields, type and status' => Egw::link('/index.php',array(
124
+				'Custom fields, type and status' => Egw::link('/index.php', array(
125 125
 					'menuaction' => 'infolog.infolog_customfields.index',
126 126
 					'ajax' => 'true',
127 127
 				)),
128 128
 			);
129 129
 			if ($location == 'admin')
130 130
 			{
131
-				display_section($appname,$file);
131
+				display_section($appname, $file);
132 132
 			}
133 133
 			else
134 134
 			{
135
-				display_sidebox($appname,lang('Admin'),$file);
135
+				display_sidebox($appname, lang('Admin'), $file);
136 136
 			}
137 137
 		}
138 138
 	}
@@ -145,19 +145,19 @@  discard block
 block discarded – undo
145 145
 	static function settings()
146 146
 	{
147 147
 		/* Setup some values to fill the array of this app's settings below */
148
-		$info = new infolog_bo();	// need some labels from
148
+		$info = new infolog_bo(); // need some labels from
149 149
 		$filters = $show_home = array();
150 150
 		$show_home[] = lang("DON'T show InfoLog");
151 151
 		$filters['none'] = $info->filters[''];
152
-		foreach($info->filters as $key => $label)
152
+		foreach ($info->filters as $key => $label)
153 153
 		{
154 154
 			$show_home[$key] = $filters[$key] = lang($label);
155 155
 		}
156 156
 
157 157
 		// migrage old filter-pref 1,2 to the filter one 'own-open-today'
158
-		if (isset($GLOBALS['type']) && in_array($GLOBALS['egw']->preferences->{$GLOBALS['type']}['homeShowEvents'],array('1','2')))
158
+		if (isset($GLOBALS['type']) && in_array($GLOBALS['egw']->preferences->{$GLOBALS['type']}['homeShowEvents'], array('1', '2')))
159 159
 		{
160
-			$GLOBALS['egw']->preferences->add('infolog','homeShowEvents','own-open-today',$GLOBALS['type']);
160
+			$GLOBALS['egw']->preferences->add('infolog', 'homeShowEvents', 'own-open-today', $GLOBALS['type']);
161 161
 			$GLOBALS['egw']->preferences->save_repository();
162 162
 		}
163 163
 		$show_links = array(
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 				'help'   => 'Should the Infolog list show a unique numerical Id, which can be used eg. as ticket Id.',
235 235
 				'xmlrpc' => True,
236 236
 				'admin'  => False,
237
-				'default'=> '1',	// Yes
237
+				'default'=> '1', // Yes
238 238
 			),
239 239
 			'listNoSubs' => array(
240 240
 				'type'   => 'select',
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 				'help'   => 'Should InfoLog show Subtasks, -calls or -notes in the normal view or not. You can always view the Subs via there parent.',
249 249
 				'xmlrpc' => True,
250 250
 				'admin'  => False,
251
-				'default'=> '0',	// Allways show them
251
+				'default'=> '0', // Allways show them
252 252
 			),
253 253
 			'show_links' => array(
254 254
 				'type'   => 'select',
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 				'help'   => 'Should the Infolog list show the percent done only for status ongoing or two separate icons.',
269 269
 				'xmlrpc' => True,
270 270
 				'admin'  => False,
271
-				'default'=> 1,	// Yes
271
+				'default'=> 1, // Yes
272 272
 			),
273 273
 			'limit_des_lines' => array(
274 274
 				'type'   => 'input',
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 			'help'   => 'Do you want a notification, if items you created get updated?',
298 298
 			'xmlrpc' => True,
299 299
 			'admin'  => False,
300
-			'default'=> '1',	// Yes
300
+			'default'=> '1', // Yes
301 301
 		);
302 302
 		$settings['notify_assigned'] = array(
303 303
 			'type'   => 'select',
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 			),
312 312
 			'xmlrpc' => True,
313 313
 			'admin'  => False,
314
-			'default'=> '1',	// Yes
314
+			'default'=> '1', // Yes
315 315
 		);
316 316
 
317 317
 		// to add options for more then 3 days back or in advance, you need to update soinfolog::users_with_open_entries()!
@@ -320,8 +320,8 @@  discard block
 block discarded – undo
320 320
 			'-1d' => lang('one day after'),
321 321
 			'0d'  => lang('same day'),
322 322
 			'1d'  => lang('one day in advance'),
323
-			'2d'  => lang('%1 days in advance',2),
324
-			'3d'  => lang('%1 days in advance',3),
323
+			'2d'  => lang('%1 days in advance', 2),
324
+			'3d'  => lang('%1 days in advance', 3),
325 325
 		);
326 326
 		$settings['notify_due_delegated'] = array(
327 327
 			'type'   => 'select',
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 			'values' => $options,
332 332
 			'xmlrpc' => True,
333 333
 			'admin'  => False,
334
-			'default'=> '0',	// No
334
+			'default'=> '0', // No
335 335
 		);
336 336
 		$settings['notify_due_responsible'] = array(
337 337
 			'type'   => 'select',
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 			'values' => $options,
342 342
 			'xmlrpc' => True,
343 343
 			'admin'  => False,
344
-			'default'=> '0d',	// Same day
344
+			'default'=> '0d', // Same day
345 345
 		);
346 346
 		$settings['notify_start_delegated'] = array(
347 347
 			'type'   => 'select',
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 			'values' => $options,
352 352
 			'xmlrpc' => True,
353 353
 			'admin'  => False,
354
-			'default'=> '0',	// No
354
+			'default'=> '0', // No
355 355
 		);
356 356
 		$settings['notify_start_responsible'] = array(
357 357
 			'type'   => 'select',
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 			'values' => $options,
362 362
 			'xmlrpc' => True,
363 363
 			'admin'  => False,
364
-			'default'=> '0d',	// Same day
364
+			'default'=> '0d', // Same day
365 365
 		);
366 366
 
367 367
 		// receive notification for items owned by groups you are part of
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 			'help'   => 'Do you want a notification if items owned by groups you are part of get updated ?',
373 373
 			'xmlrpc' => True,
374 374
 			'admin'  => False,
375
-			'default'=> '0',	// No
375
+			'default'=> '0', // No
376 376
 		);
377 377
 
378 378
 		$settings[] = array(
@@ -391,8 +391,8 @@  discard block
 block discarded – undo
391 391
 				'size'   => 60,
392 392
 				'label'  => 'Default document to insert entries',
393 393
 				'name'   => 'default_document',
394
-				'help'   => lang('If you specify a document (full vfs path) here, %1 displays an extra document icon for each entry. That icon allows to download the specified document with the data inserted.',lang('infolog')).' '.
395
-					lang('The document can contain placeholder like {{%1}}, to be replaced with the data.','info_subject').' '.
394
+				'help'   => lang('If you specify a document (full vfs path) here, %1 displays an extra document icon for each entry. That icon allows to download the specified document with the data inserted.', lang('infolog')).' '.
395
+					lang('The document can contain placeholder like {{%1}}, to be replaced with the data.', 'info_subject').' '.
396 396
 					lang('The following document-types are supported:').'*.rtf, *.txt',
397 397
 				'run_lang' => false,
398 398
 				'xmlrpc' => True,
@@ -403,8 +403,8 @@  discard block
 block discarded – undo
403 403
 				'size'   => 60,
404 404
 				'label'  => 'Directory with documents to insert entries',
405 405
 				'name'   => 'document_dir',
406
-				'help'   => lang('If you specify a directory (full vfs path) here, %1 displays an action for each document. That action allows to download the specified document with the data inserted.',lang('infolog')).' '.
407
-					lang('The document can contain placeholder like {{%1}}, to be replaced with the data.','info_subject').' '.
406
+				'help'   => lang('If you specify a directory (full vfs path) here, %1 displays an action for each document. That action allows to download the specified document with the data inserted.', lang('infolog')).' '.
407
+					lang('The document can contain placeholder like {{%1}}, to be replaced with the data.', 'info_subject').' '.
408 408
 					lang('The following document-types are supported:').'*.rtf, *.txt',
409 409
 				'run_lang' => false,
410 410
 				'xmlrpc' => True,
@@ -493,12 +493,12 @@  discard block
 block discarded – undo
493 493
 	 */
494 494
 	private static function all_cats()
495 495
 	{
496
-		$categories = new Api\Categories('','infolog');
496
+		$categories = new Api\Categories('', 'infolog');
497 497
 		$accountId = $GLOBALS['egw_info']['user']['account_id'];
498 498
 
499
-		foreach((array)$categories->return_sorted_array(0,False,'','','',true) as $cat)
499
+		foreach ((array)$categories->return_sorted_array(0, False, '', '', '', true) as $cat)
500 500
 		{
501
-			$s = str_repeat(' ',$cat['level']) . stripslashes($cat['name']);
501
+			$s = str_repeat(' ', $cat['level']).stripslashes($cat['name']);
502 502
 
503 503
 			if ($cat['app_name'] == 'phpgw' || $cat['owner'] == '-1')
504 504
 			{
@@ -506,13 +506,13 @@  discard block
 block discarded – undo
506 506
 			}
507 507
 			elseif ($cat['owner'] != $accountId)
508 508
 			{
509
-				$s .= '<' . $GLOBALS['egw']->accounts->id2name($cat['owner'], 'account_fullname') . '>';
509
+				$s .= '<'.$GLOBALS['egw']->accounts->id2name($cat['owner'], 'account_fullname').'>';
510 510
 			}
511 511
 			elseif ($cat['access'] == 'private')
512 512
 			{
513 513
 				$s .= ' ♥';
514 514
 			}
515
-			$sel_options[$cat['id']] = $s;	// 0.9.14 only
515
+			$sel_options[$cat['id']] = $s; // 0.9.14 only
516 516
 		}
517 517
 		return $sel_options;
518 518
 	}
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
 
534 534
 			if (!$async->read('infolog-async-notification'))
535 535
 			{
536
-				$async->set_timer(array('hour' => 2),'infolog-async-notification','infolog.infolog_bo.async_notification',null);
536
+				$async->set_timer(array('hour' => 2), 'infolog-async-notification', 'infolog.infolog_bo.async_notification', null);
537 537
 			}
538 538
 		}
539 539
 	}
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
 	 */
547 547
 	public static function acl_rights($params)
548 548
 	{
549
-		unset($params);	// not used, but default function signature for hooks
549
+		unset($params); // not used, but default function signature for hooks
550 550
 		return array(
551 551
 			Acl::READ    => 'read',
552 552
 			Acl::ADD     => 'add',
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
 	 */
565 565
 	public static function categories($location)
566 566
 	{
567
-		unset($location);	// not used, but part of hook signature
567
+		unset($location); // not used, but part of hook signature
568 568
 		return true;
569 569
 	}
570 570
 
@@ -575,9 +575,9 @@  discard block
 block discarded – undo
575 575
 	 */
576 576
 	public static function mail_import($args)
577 577
 	{
578
-		unset($args);	// not used, but required by function signature
578
+		unset($args); // not used, but required by function signature
579 579
 
580
-		return array (
580
+		return array(
581 581
 			'menuaction' => 'infolog.infolog_ui.mail_import',
582 582
 			'popup' => Link::get_registry('infolog', 'edit_popup')
583 583
 		);
Please login to merge, or discard this patch.
api/src/Framework/Ajax.php 1 patch
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -57,11 +57,11 @@  discard block
 block discarded – undo
57 57
 	 *
58 58
 	 * @param string $template = '' name of the template
59 59
 	 */
60
-	function __construct($template=self::APP)
60
+	function __construct($template = self::APP)
61 61
 	{
62
-		parent::__construct($template);		// call the constructor of the extended class
62
+		parent::__construct($template); // call the constructor of the extended class
63 63
 
64
-		$this->template_dir = '/'.$template;		// we are packaged as an application
64
+		$this->template_dir = '/'.$template; // we are packaged as an application
65 65
 	}
66 66
 
67 67
 	/**
@@ -129,16 +129,16 @@  discard block
 block discarded – undo
129 129
 	public static function app_from_url($url)
130 130
 	{
131 131
 		$matches = null;
132
-		if (preg_match('/menuaction=([a-z0-9_-]+)\./i',$url,$matches))
132
+		if (preg_match('/menuaction=([a-z0-9_-]+)\./i', $url, $matches))
133 133
 		{
134 134
 			return $matches[1];
135 135
 		}
136 136
 		if ($GLOBALS['egw_info']['server']['webserver_url'] &&
137
-			($webserver_path = parse_url($GLOBALS['egw_info']['server']['webserver_url'],PHP_URL_PATH)))
137
+			($webserver_path = parse_url($GLOBALS['egw_info']['server']['webserver_url'], PHP_URL_PATH)))
138 138
 		{
139
-			list(,$url) = explode($webserver_path, parse_url($url,PHP_URL_PATH),2);
139
+			list(,$url) = explode($webserver_path, parse_url($url, PHP_URL_PATH), 2);
140 140
 		}
141
-		if (preg_match('/\/([^\/]+)\/([^\/]+\.php)?(\?|\/|$)/',$url,$matches))
141
+		if (preg_match('/\/([^\/]+)\/([^\/]+\.php)?(\?|\/|$)/', $url, $matches))
142 142
 		{
143 143
 			return $matches[1];
144 144
 		}
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	 * @param string $link_app = null if appname or true, some templates generate a special link-handler url
155 155
 	 * @return string	The full url after processing
156 156
 	 */
157
-	static function link($url = '', $extravars = '', $link_app=null)
157
+	static function link($url = '', $extravars = '', $link_app = null)
158 158
 	{
159 159
 		if (is_null($link_app)) $link_app = self::$link_app;
160 160
 		$link = parent::link($url, $extravars);
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 			// Link gets handled in JS, so quotes need slashes as well as url-encoded
166 166
 			// encoded ampersands in get parameters (%26) need to be encoded twise,
167 167
 			// so they are still encoded when assigned to window.location
168
-			$link_with_slashes = str_replace(array('%27','%26'), array('\%27','%2526'), $link);
168
+			$link_with_slashes = str_replace(array('%27', '%26'), array('\%27', '%2526'), $link);
169 169
 
170 170
 			//$link = "javascript:window.egw_link_handler?egw_link_handler('$link','$link_app'):parent.egw_link_handler('$link','$link_app');";
171 171
 			$link = "javascript:egw_link_handler('$link_with_slashes','$link_app')";
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 	protected function _get_csp_frame_src()
184 184
 	{
185 185
 		$srcs = array();
186
-		foreach(Api\Hooks::process('csp-frame-src') as $src)
186
+		foreach (Api\Hooks::process('csp-frame-src') as $src)
187 187
 		{
188 188
 			if ($src) $srcs = array_merge($srcs, $src);
189 189
 		}
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 	 * @param array $extra = array() extra attributes passed as data-attribute to egw.js
197 197
 	 * @return string with Api\Html
198 198
 	 */
199
-	function header(array $extra=array())
199
+	function header(array $extra = array())
200 200
 	{
201 201
 		// make sure header is output only once
202 202
 		if (self::$header_done) return '';
@@ -221,8 +221,8 @@  discard block
 block discarded – undo
221 221
 		{
222 222
 			$this->tpl->set_file(array('_head' => 'head.tpl'));
223 223
 		}
224
-		$this->tpl->set_block('_head','head');
225
-		$this->tpl->set_block('_head','framework');
224
+		$this->tpl->set_block('_head', 'head');
225
+		$this->tpl->set_block('_head', 'framework');
226 226
 
227 227
 		// should we draw the framework, or just a header
228 228
 		$do_framework = isset($_GET['cd']) && $_GET['cd'] === 'yes';
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 			{
248 248
 				self::includeJS('.', 'fw_'.static::APP, static::JS_INCLUDE_APP);
249 249
 			}
250
-			Api\Cache::unsetSession(__CLASS__,'sidebox_md5');	// sideboxes need to be send again
250
+			Api\Cache::unsetSession(__CLASS__, 'sidebox_md5'); // sideboxes need to be send again
251 251
 
252 252
 			$extra['navbar-apps'] = $this->get_navbar_apps($_SERVER['REQUEST_URI']);
253 253
 		}
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 		// - if not we need to check if we have an opener (are a popup window)
257 257
 		// - as popups can open further popups, we need to decend all the way down until we find a framework
258 258
 		// - only if we cant find a framework in all openers, we redirect to create a new framework
259
-		if(!$do_framework)
259
+		if (!$do_framework)
260 260
 		{
261 261
 			// fetch sidebox from application and set it in extra data, if we are no popup
262 262
 			if (!$GLOBALS['egw_info']['flags']['nonavbar'])
@@ -266,12 +266,12 @@  discard block
 block discarded – undo
266 266
 			// for remote manual never check/create framework
267 267
 			if (!in_array($GLOBALS['egw_info']['flags']['currentapp'], array('manual', 'login', 'logout', 'sitemgr')))
268 268
 			{
269
-				if (empty($GLOBALS['egw_info']['flags']['java_script'])) $GLOBALS['egw_info']['flags']['java_script']='';
269
+				if (empty($GLOBALS['egw_info']['flags']['java_script'])) $GLOBALS['egw_info']['flags']['java_script'] = '';
270 270
 				$extra['check-framework'] = $_GET['cd'] !== 'no';
271 271
 			}
272 272
 		}
273 273
 		$this->tpl->set_var($this->_get_header($extra));
274
-		$content = $this->tpl->fp('out','head').$content;
274
+		$content = $this->tpl->fp('out', 'head').$content;
275 275
 
276 276
 		if (!$do_framework)
277 277
 		{
@@ -280,10 +280,10 @@  discard block
 block discarded – undo
280 280
 
281 281
 		// topmenu
282 282
 		$vars = $this->_get_navbar($apps = $this->_get_navbar_apps());
283
-		$this->tpl->set_var($this->topmenu($vars,$apps));
283
+		$this->tpl->set_var($this->topmenu($vars, $apps));
284 284
 
285 285
 		// hook after_navbar (eg. notifications)
286
-		$this->tpl->set_var('hook_after_navbar',$this->_get_after_navbar());
286
+		$this->tpl->set_var('hook_after_navbar', $this->_get_after_navbar());
287 287
 
288 288
 		//Global sidebar width
289 289
 		$this->tpl->set_var('sidebox_width', self::get_global_sidebar_width());
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 
301 301
 		// add framework div's
302 302
 		$this->tpl->set_var($this->_get_footer());
303
-		$content .= $this->tpl->fp('out','framework');
303
+		$content .= $this->tpl->fp('out', 'framework');
304 304
 		$content .= self::footer(false);
305 305
 
306 306
 		echo $content;
@@ -319,14 +319,14 @@  discard block
 block discarded – undo
319 319
 	 * @param array $apps
320 320
 	 * @return array
321 321
 	 */
322
-	function topmenu(array $vars,array $apps)
322
+	function topmenu(array $vars, array $apps)
323 323
 	{
324 324
 		$this->topmenu_items = $this->topmenu_info_items = array();
325 325
 
326
-		parent::topmenu($vars,$apps);
327
-		$vars['topmenu_items'] = "<ul>\n<li>".implode("</li>\n<li>",$this->topmenu_items)."</li>\n</ul>";
326
+		parent::topmenu($vars, $apps);
327
+		$vars['topmenu_items'] = "<ul>\n<li>".implode("</li>\n<li>", $this->topmenu_items)."</li>\n</ul>";
328 328
 		$vars['topmenu_info_items'] = '';
329
-		foreach($this->topmenu_info_items as $id => $item)
329
+		foreach ($this->topmenu_info_items as $id => $item)
330 330
 		{
331 331
 			$vars['topmenu_info_items'] .= '<div class="topmenu_info_item"'.
332 332
 				(is_numeric($id) ? '' : ' id="topmenu_info_'.$id.'"').'>'.$item."</div>\n";
@@ -347,9 +347,9 @@  discard block
 block discarded – undo
347 347
 	* @todo implement in a reasonable way for jdots
348 348
 	* @return void
349 349
 	*/
350
-	function topmenu_info_icon($id,$icon_src,$iconlink,$blink=false,$tooltip=null)
350
+	function topmenu_info_icon($id, $icon_src, $iconlink, $blink = false, $tooltip = null)
351 351
 	{
352
-		unset($id,$icon_src,$iconlink,$blink,$tooltip);	// not used
352
+		unset($id, $icon_src, $iconlink, $blink, $tooltip); // not used
353 353
 		// not yet implemented, only used in admin/inc/hook_topmenu_info.inc.php to notify about pending updates
354 354
 	}
355 355
 
@@ -362,9 +362,9 @@  discard block
 block discarded – undo
362 362
 	* @access protected
363 363
 	* @return void
364 364
 	*/
365
-	function _add_topmenu_item(array $app_data,$alt_label=null)
365
+	function _add_topmenu_item(array $app_data, $alt_label = null)
366 366
 	{
367
-		switch($app_data['name'])
367
+		switch ($app_data['name'])
368 368
 		{
369 369
 			case 'logout':
370 370
 				if (Api\Header\UserAgent::mobile() || $GLOBALS['egw_info']['user']['preferences']['common']['theme'] == 'mobile')
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 				}
374 374
 				else
375 375
 				{
376
-					return;	// no need for logout in topmenu on jdots
376
+					return; // no need for logout in topmenu on jdots
377 377
 				}
378 378
 				break;
379 379
 
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 				break;
383 383
 
384 384
 			default:
385
-				if (strpos($app_data['url'],'logout.php') === false && substr($app_data['url'], 0, 11) != 'javascript:')
385
+				if (strpos($app_data['url'], 'logout.php') === false && substr($app_data['url'], 0, 11) != 'javascript:')
386 386
 				{
387 387
 					$app_data['url'] = "javascript:egw_link_handler('".$app_data['url']."','".
388 388
 						(isset($GLOBALS['egw_info']['user']['apps'][$app_data['name']]) ?
@@ -390,8 +390,8 @@  discard block
 block discarded – undo
390 390
 				}
391 391
 		}
392 392
 		$id = $app_data['id'] ? $app_data['id'] : ($app_data['name'] ? $app_data['name'] : $app_data['title']);
393
-		$title =  htmlspecialchars($alt_label ? $alt_label : $app_data['title']);
394
-		$this->topmenu_items[] = '<a id="topmenu_' . $id . '" href="'.htmlspecialchars($app_data['url']).'" title="'.$app_data['title'].'">'.$title.'</a>';
393
+		$title = htmlspecialchars($alt_label ? $alt_label : $app_data['title']);
394
+		$this->topmenu_items[] = '<a id="topmenu_'.$id.'" href="'.htmlspecialchars($app_data['url']).'" title="'.$app_data['title'].'">'.$title.'</a>';
395 395
 	}
396 396
 
397 397
 	/**
@@ -402,11 +402,11 @@  discard block
 block discarded – undo
402 402
 	 * @access protected
403 403
 	 * @return void
404 404
 	 */
405
-	function _add_topmenu_info_item($content, $id=null)
405
+	function _add_topmenu_info_item($content, $id = null)
406 406
 	{
407
-		if(strpos($content,'menuaction=admin.admin_accesslog.sessions') !== false)
407
+		if (strpos($content, 'menuaction=admin.admin_accesslog.sessions') !== false)
408 408
 		{
409
-			$content = preg_replace('/href="([^"]+)"/',"href=\"javascript:egw_link_handler('\\1','admin')\"",$content);
409
+			$content = preg_replace('/href="([^"]+)"/', "href=\"javascript:egw_link_handler('\\1','admin')\"", $content);
410 410
 		}
411 411
 		if ($id)
412 412
 		{
@@ -425,10 +425,10 @@  discard block
 block discarded – undo
425 425
 	 */
426 426
 	static function ajax_tz_selection($tz)
427 427
 	{
428
-		Api\DateTime::setUserPrefs($tz);	// throws exception, if tz is invalid
428
+		Api\DateTime::setUserPrefs($tz); // throws exception, if tz is invalid
429 429
 
430 430
 		$GLOBALS['egw']->preferences->read_repository();
431
-		$GLOBALS['egw']->preferences->add('common','tz',$tz);
431
+		$GLOBALS['egw']->preferences->add('common', 'tz', $tz);
432 432
 		$GLOBALS['egw']->preferences->save_repository();
433 433
 	}
434 434
 
@@ -480,13 +480,13 @@  discard block
 block discarded – undo
480 480
 		// only send admin sidebox, for admin index url (when clicked on admin),
481 481
 		// not for other admin pages, called eg. from sidebox menu of other apps
482 482
 		// --> that way we always stay in the app, and NOT open admin sidebox for an app tab!!!
483
-		if ($app == 'admin' && substr($_SERVER['PHP_SELF'],-16) != '/admin/index.php' &&
483
+		if ($app == 'admin' && substr($_SERVER['PHP_SELF'], -16) != '/admin/index.php' &&
484 484
 			$_GET['menuaction'] != 'admin.admin_ui.index')
485 485
 		{
486 486
 			//error_log(__METHOD__."() app=$app, menuaction=$_GET[menuaction], PHP_SELF=$_SERVER[PHP_SELF] --> sidebox request ignored");
487 487
 			return;
488 488
 		}
489
-		$md5_session =& Api\Cache::getSession(__CLASS__,'sidebox_md5');
489
+		$md5_session = & Api\Cache::getSession(__CLASS__, 'sidebox_md5');
490 490
 
491 491
 		//Set the sidebox content
492 492
 		$sidebox = $this->get_sidebox($app);
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
 		if ($md5_session[$app] !== $md5)
496 496
 		{
497 497
 			//error_log(__METHOD__."() header changed md5_session[$app]!=='$md5' --> setting it on self::\$extra[setSidebox]");
498
-			$md5_session[$app] = $md5;	// update md5 in session
498
+			$md5_session[$app] = $md5; // update md5 in session
499 499
 			self::$extra['setSidebox'] = array($app, $sidebox, $md5);
500 500
 		}
501 501
 		//else error_log(__METHOD__."() md5_session[$app]==='$md5' --> nothing to do");
@@ -509,9 +509,9 @@  discard block
 block discarded – undo
509 509
 	 * @return boolean $consider_navbar_not_yet_called_as_true=true ignored by jdots, we only care for cd=yes GET param
510 510
 	 * @return boolean
511 511
 	 */
512
-	public function isTop($consider_navbar_not_yet_called_as_true=true)
512
+	public function isTop($consider_navbar_not_yet_called_as_true = true)
513 513
 	{
514
-		unset($consider_navbar_not_yet_called_as_true);	// not used
514
+		unset($consider_navbar_not_yet_called_as_true); // not used
515 515
 		return isset($_GET['cd']) && $_GET['cd'] === 'yes';
516 516
 	}
517 517
 
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
 	 * @param array $file
538 538
 	 * @param string $type = null 'admin', 'preferences', 'favorites', ...
539 539
 	 */
540
-	public function sidebox($appname,$menu_title,$file,$type=null)
540
+	public function sidebox($appname, $menu_title, $file, $type = null)
541 541
 	{
542 542
 		if (!isset($file['menuOpened'])) $file['menuOpened'] = (boolean)$this->sidebox_menu_opened;
543 543
 		//error_log(__METHOD__."('$appname', '$menu_title', file[menuOpened]=$file[menuOpened], ...) this->sidebox_menu_opened=$this->sidebox_menu_opened");
@@ -546,11 +546,11 @@  discard block
 block discarded – undo
546 546
 		// fix app admin menus to use admin.admin_ui.index loader
547 547
 		if (($type == 'admin' || $menu_title == lang('Admin')) && $appname != 'admin')
548 548
 		{
549
-			foreach($file as &$link)
549
+			foreach ($file as &$link)
550 550
 			{
551 551
 				preg_match('/ajax=(true|false)/', $link, $ajax);
552 552
 				$link = preg_replace("/^(javascript:egw_link_handler\(')(.*)menuaction=([^&]+)(.*)(','[^']+'\))$/",
553
-					'$1$2menuaction=admin.admin_ui.index&load=$3$4&ajax=' . ($ajax[1] ? $ajax[1] : 'true') .'\',\'admin\')', $file_was=$link);
553
+					'$1$2menuaction=admin.admin_ui.index&load=$3$4&ajax='.($ajax[1] ? $ajax[1] : 'true').'\',\'admin\')', $file_was = $link);
554 554
 			}
555 555
 			 
556 556
 		}
@@ -587,15 +587,15 @@  discard block
 block discarded – undo
587 587
 			self::$link_app = $appname;
588 588
 			// allow other apps to hook into sidebox menu of an app, hook-name: sidebox_$appname
589 589
 			$this->sidebox_menu_opened = true;
590
-			Api\Hooks::process('sidebox_'.$appname,array($appname),true);	// true = call independent of app-permissions
590
+			Api\Hooks::process('sidebox_'.$appname, array($appname), true); // true = call independent of app-permissions
591 591
 
592 592
 			// calling the old hook
593 593
 			$this->sidebox_menu_opened = true;
594
-			Api\Hooks::single('sidebox_menu',$appname);
594
+			Api\Hooks::single('sidebox_menu', $appname);
595 595
 			self::$link_app = null;
596 596
 
597 597
 			// allow other apps to hook into sidebox menu of every app: sidebox_all
598
-			Api\Hooks::process('sidebox_all',array($GLOBALS['egw_info']['flags']['currentapp']),true);
598
+			Api\Hooks::process('sidebox_all', array($GLOBALS['egw_info']['flags']['currentapp']), true);
599 599
 		}
600 600
 		//If there still is no sidebox content, return null here
601 601
 		if (!isset($this->sideboxes[$appname]))
@@ -605,17 +605,17 @@  discard block
 block discarded – undo
605 605
 
606 606
 		$data = array();
607 607
 		$sendToBottom = array();
608
-		foreach($this->sideboxes[$appname] as $menu_name => &$file)
608
+		foreach ($this->sideboxes[$appname] as $menu_name => &$file)
609 609
 		{
610 610
 			$current_menu = array(
611
-				'menu_name' => md5($menu_name),	// can contain Api\Html tags and javascript!
611
+				'menu_name' => md5($menu_name), // can contain Api\Html tags and javascript!
612 612
 				'title' => $menu_name,
613 613
 				'entries' => array(),
614 614
 				'opened' => (boolean)$file['menuOpened'],
615 615
 			);
616
-			foreach($file as $item_text => $item_link)
616
+			foreach ($file as $item_text => $item_link)
617 617
 			{
618
-				if ($item_text === 'menuOpened' || $item_text === 'sendToBottom' ||// flag, not menu entry
618
+				if ($item_text === 'menuOpened' || $item_text === 'sendToBottom' || // flag, not menu entry
619 619
 					$item_text === '_NewLine_' || $item_link === '_NewLine_')
620 620
 				{
621 621
 					continue;
@@ -626,14 +626,14 @@  discard block
 block discarded – undo
626 626
 				}
627 627
 
628 628
 				$var = array();
629
-				$var['icon_or_star'] = $GLOBALS['egw_info']['server']['webserver_url'] . $this->template_dir.'/images/bullet.png';
629
+				$var['icon_or_star'] = $GLOBALS['egw_info']['server']['webserver_url'].$this->template_dir.'/images/bullet.png';
630 630
 				$var['target'] = '';
631
-				if(is_array($item_link))
631
+				if (is_array($item_link))
632 632
 				{
633
-					if(isset($item_link['icon']))
633
+					if (isset($item_link['icon']))
634 634
 					{
635 635
 						$app = isset($item_link['app']) ? $item_link['app'] : $appname;
636
-						$var['icon_or_star'] = $item_link['icon'] ? Api\Image::find($app,$item_link['icon']) : False;
636
+						$var['icon_or_star'] = $item_link['icon'] ? Api\Image::find($app, $item_link['icon']) : False;
637 637
 					}
638 638
 					$var['lang_item'] = isset($item_link['no_lang']) && $item_link['no_lang'] ? $item_link['text'] : lang($item_link['text']);
639 639
 					$var['item_link'] = $item_link['link'];
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
 	public static function ajax_tab_changed_state($tablist)
678 678
 	{
679 679
 		$tabs = array();
680
-		foreach($tablist as $data)
680
+		foreach ($tablist as $data)
681 681
 		{
682 682
 			$tabs[] = $data['appName'];
683 683
 			if ($data['active']) $active = $data['appName'];
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
 		// used eg. in phpFreeChat to leave the chat
687 687
 		if (($old_tabs = Api\Cache::getSession(__CLASS__, 'open_tabs')))
688 688
 		{
689
-			foreach(array_diff(explode(',',$old_tabs),$tabs) as $app)
689
+			foreach (array_diff(explode(',', $old_tabs), $tabs) as $app)
690 690
 			{
691 691
 				//error_log("Tab '$app' closed, old_tabs=$old_tabs");
692 692
 				Api\Hooks::single(array(
@@ -695,7 +695,7 @@  discard block
 block discarded – undo
695 695
 				), $app);
696 696
 			}
697 697
 		}
698
-		$open = implode(',',$tabs);
698
+		$open = implode(',', $tabs);
699 699
 
700 700
 		if ($open != $GLOBALS['egw_info']['user']['preferences']['common']['open_tabs'] ||
701 701
 			$active != $GLOBALS['egw_info']['user']['preferences']['common']['active_tab'])
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
 		$i = 0;
766 766
 
767 767
 		//Parse the "$apps" array for valid content (security)
768
-		foreach($apps as $app)
768
+		foreach ($apps as $app)
769 769
 		{
770 770
 			//Check whether the app really exists and add it to the $app_arr var
771 771
 			if ($GLOBALS['egw_info']['user']['apps'][$app])
@@ -796,17 +796,17 @@  discard block
 block discarded – undo
796 796
 	 */
797 797
 	public function navbar_apps()
798 798
 	{
799
-		$apps = parent::_get_navbar_apps(Api\Image::svg_usable());	// use svg if usable in browser
799
+		$apps = parent::_get_navbar_apps(Api\Image::svg_usable()); // use svg if usable in browser
800 800
 
801 801
 		//Add its sidebox width to each app
802 802
 		foreach ($apps as $app => &$data)
803 803
 		{
804 804
 			$data['sideboxwidth'] = self::get_sidebar_width($app);
805 805
 			// overwrite icon with svg, if supported by browser
806
-			unset($data['icon_hover']);	// not used in jdots
806
+			unset($data['icon_hover']); // not used in jdots
807 807
 		}
808 808
 
809
-		unset($apps['logout']);	// never display it
809
+		unset($apps['logout']); // never display it
810 810
 		if (isset($apps['about'])) $apps['about']['noNavbar'] = true;
811 811
 		if (isset($apps['preferences'])) $apps['preferences']['noNavbar'] = true;
812 812
 		if (isset($apps['manual'])) $apps['manual']['noNavbar'] = true;
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
 		}
857 857
 
858 858
 		// check if user called a specific url --> open it as active tab
859
-		$last_direct_url =& Api\Cache::getSession(__CLASS__, 'last_direct_url');
859
+		$last_direct_url = & Api\Cache::getSession(__CLASS__, 'last_direct_url');
860 860
 		if ($url !== $last_direct_url)
861 861
 		{
862 862
 			$active_tab = $url_tab = self::app_from_url($url);
@@ -869,9 +869,9 @@  discard block
 block discarded – undo
869 869
 		if ($active_tab && array_key_exists($active_tab, $apps))
870 870
 		{
871 871
 			// Do not remove cd=yes if it's an ajax=true app
872
-			if (strpos( $apps[$active_tab]['url'],'ajax=true') !== False)
872
+			if (strpos($apps[$active_tab]['url'], 'ajax=true') !== False)
873 873
 			{
874
-				$url = preg_replace('/[&?]cd=yes/','',$url);
874
+				$url = preg_replace('/[&?]cd=yes/', '', $url);
875 875
 			}
876 876
 			$apps[$active_tab]['openOnce'] = $url;
877 877
 			$store_prefs = true;
@@ -886,8 +886,8 @@  discard block
 block discarded – undo
886 886
 		{
887 887
 			$open_tabs = $GLOBALS['egw_info']['user']['preferences']['common']['open_tabs'];
888 888
 		}
889
-		$open_tabs = $open_tabs ? explode(',',$open_tabs) : array();
890
-		if ($active_tab && !in_array($active_tab,$open_tabs))
889
+		$open_tabs = $open_tabs ? explode(',', $open_tabs) : array();
890
+		if ($active_tab && !in_array($active_tab, $open_tabs))
891 891
 		{
892 892
 			$open_tabs[] = $active_tab;
893 893
 			$store_prefs = true;
@@ -895,14 +895,14 @@  discard block
 block discarded – undo
895 895
 		if ($store_prefs)
896 896
 		{
897 897
 			$GLOBALS['egw']->preferences->read_repository();
898
-			$GLOBALS['egw']->preferences->add('common', 'open_tabs', implode(',',$open_tabs));
898
+			$GLOBALS['egw']->preferences->add('common', 'open_tabs', implode(',', $open_tabs));
899 899
 			$GLOBALS['egw']->preferences->add('common', 'active_tab', $active_tab);
900 900
 			$GLOBALS['egw']->preferences->save_repository(true);
901 901
 		}
902 902
 
903 903
 		//error_log(__METHOD__."('$url') url_tab='$url_tab', active_tab=$active_tab, open_tabs=".array2string($open_tabs));
904 904
 		// Restore Tabs
905
-		foreach($open_tabs as $n => $app)
905
+		foreach ($open_tabs as $n => $app)
906 906
 		{
907 907
 			if (isset($apps[$app]))		// user might no longer have app rights
908 908
 			{
@@ -929,10 +929,10 @@  discard block
 block discarded – undo
929 929
 	 * @param boolean $no_framework = true
930 930
 	 * @return string
931 931
 	 */
932
-	function footer($no_framework=true)
932
+	function footer($no_framework = true)
933 933
 	{
934 934
 		//error_log(__METHOD__."($no_framework) footer_done=".array2string(self::$footer_done).' '.function_backtrace());
935
-		if (self::$footer_done) return;	// prevent (multiple) footers
935
+		if (self::$footer_done) return; // prevent (multiple) footers
936 936
 		self::$footer_done = true;
937 937
 
938 938
 		if (!isset($GLOBALS['egw_info']['flags']['nofooter']) || !$GLOBALS['egw_info']['flags']['nofooter'])
@@ -944,7 +944,7 @@  discard block
 block discarded – undo
944 944
 			}
945 945
 		}
946 946
 		return $footer.
947
-			$GLOBALS['egw_info']['flags']['need_footer']."\n".	// eg. javascript, which need to be at the end of the page
947
+			$GLOBALS['egw_info']['flags']['need_footer']."\n".// eg. javascript, which need to be at the end of the page
948 948
 			"</body>\n</html>\n";
949 949
 	}
950 950
 
@@ -982,8 +982,8 @@  discard block
 block discarded – undo
982 982
 		if ($parts['query'])
983 983
 		{
984 984
 			$_SERVER['REQUEST_URI'] = '?'.$parts['query'];
985
-			parse_str($parts['query'],$_GET);
986
-			$_REQUEST = $_GET;	// some apps use $_REQUEST to check $_GET or $_POST
985
+			parse_str($parts['query'], $_GET);
986
+			$_REQUEST = $_GET; // some apps use $_REQUEST to check $_GET or $_POST
987 987
 		}
988 988
 
989 989
 		if (!isset($_GET['menuaction']))
@@ -993,7 +993,7 @@  discard block
 block discarded – undo
993 993
 		// set session action
994 994
 		$GLOBALS['egw']->session->set_action('Ajax: '.$_GET['menuaction']);
995 995
 
996
-		list($app,$class,$method) = explode('.',$_GET['menuaction']);
996
+		list($app, $class, $method) = explode('.', $_GET['menuaction']);
997 997
 
998 998
 		if (!isset($GLOBALS['egw_info']['user']['apps'][$app]))
999 999
 		{
@@ -1005,7 +1005,7 @@  discard block
 block discarded – undo
1005 1005
 
1006 1006
 		$GLOBALS[$class] = $obj = CreateObject($app.'.'.$class);
1007 1007
 
1008
-		if(!is_array($obj->public_functions) || !$obj->public_functions[$method])
1008
+		if (!is_array($obj->public_functions) || !$obj->public_functions[$method])
1009 1009
 		{
1010 1010
 			throw new Api\Exception\NoPermission("Bad menuaction {$_GET['menuaction']}, not listed in public_functions!");
1011 1011
 		}
Please login to merge, or discard this patch.