Completed
Push — 14.2 ( 1730cb...8c75f3 )
by Ralf
73:29 queued 51:28
created
addressbook/inc/class.addressbook_ui.inc.php 5 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1885,12 +1885,12 @@  discard block
 block discarded – undo
1885 1885
 	}
1886 1886
 
1887 1887
 	/**
1888
-	* Edit a contact
1889
-	*
1890
-	* @param array $content=null submitted content
1891
-	* @param int $_GET['contact_id'] contact_id mainly for popup use
1892
-	* @param bool $_GET['makecp'] true if you want to copy the contact given by $_GET['contact_id']
1893
-	*/
1888
+	 * Edit a contact
1889
+	 *
1890
+	 * @param array $content=null submitted content
1891
+	 * @param int $_GET['contact_id'] contact_id mainly for popup use
1892
+	 * @param bool $_GET['makecp'] true if you want to copy the contact given by $_GET['contact_id']
1893
+	 */
1894 1894
 	function edit($content=null)
1895 1895
 	{
1896 1896
 		if (is_array($content))
@@ -3069,8 +3069,8 @@  discard block
 block discarded – undo
3069 3069
 	}
3070 3070
 
3071 3071
 	/**
3072
-	* Set up history log widget
3073
-	*/
3072
+	 * Set up history log widget
3073
+	 */
3074 3074
 	protected function setup_history(&$content, &$sel_options)
3075 3075
 	{
3076 3076
 		if ($this->contact_repository == 'ldap' || !$content['id'] ||
Please login to merge, or discard this patch.
Doc Comments   +9 added lines, -13 removed lines patch added patch discarded remove patch
@@ -112,9 +112,8 @@  discard block
 block discarded – undo
112 112
 	/**
113 113
 	 * List contacts of an addressbook
114 114
 	 *
115
-	 * @param array $content=null submitted content
116
-	 * @param string $msg=null	message to show
117
-	 * @param boolean $do_email=false do an email-selection popup or the regular index-page
115
+	 * @param array $content submitted content
116
+	 * @param boolean $do_email do an email-selection popup or the regular index-page
118 117
 	 */
119 118
 	function index($content=null,$msg=null,$do_email=false)
120 119
 	{
@@ -353,8 +352,8 @@  discard block
 block discarded – undo
353 352
 	/**
354 353
 	 * Get actions / context menu items
355 354
 	 *
356
-	 * @param string $tid_filter=null
357
-	 * @param string $org_view=null
355
+	 * @param string $tid_filter
356
+	 * @param string $org_view
358 357
 	 * @return array see nextmatch_widget::get_actions()
359 358
 	 */
360 359
 	public function get_actions($tid_filter=null, $org_view=null)
@@ -762,8 +761,7 @@  discard block
 block discarded – undo
762 761
 	/**
763 762
 	 * Email address-selection popup
764 763
 	 *
765
-	 * @param array $content=null submitted content
766
-	 * @param string $msg=null	message to show
764
+	 * @param array $content submitted content
767 765
 	 */
768 766
 	function emailpopup($content=null,$msg=null)
769 767
 	{
@@ -952,7 +950,7 @@  discard block
 block discarded – undo
952 950
 	 * @param int &$failed number of failed actions (not enought permissions)
953 951
 	 * @param string &$action_msg translated verb for the actions, to be used in a message like %1 contacts 'deleted'
954 952
 	 * @param string/array $session_name 'index' or 'email', or array with session-data depending if we are in the main list or the popup
955
-	 * @return boolean true if all actions succeded, false otherwise
953
+	 * @return null|boolean true if all actions succeded, false otherwise
956 954
 	 */
957 955
 	function action($action,$checked,$use_all,&$success,&$failed,&$action_msg,$session_name,&$msg, $checkboxes = NULL)
958 956
 	{
@@ -1303,7 +1301,7 @@  discard block
 block discarded – undo
1303 1301
 	 * @param array &$query
1304 1302
 	 * @param array &$rows returned rows/cups
1305 1303
 	 * @param array &$readonlys eg. to disable buttons based on acl
1306
-	 * @param boolean $id_only=false if true only return (via $rows) an array of contact-ids, dont save state to session
1304
+	 * @param boolean $id_only if true only return (via $rows) an array of contact-ids, dont save state to session
1307 1305
 	 * @return int total number of contacts matching the selection
1308 1306
 	 */
1309 1307
 	function get_rows(&$query,&$rows,&$readonlys,$id_only=false)
@@ -1798,9 +1796,7 @@  discard block
 block discarded – undo
1798 1796
 	/**
1799 1797
 	* Edit a contact
1800 1798
 	*
1801
-	* @param array $content=null submitted content
1802
-	* @param int $_GET['contact_id'] contact_id mainly for popup use
1803
-	* @param bool $_GET['makecp'] true if you want to copy the contact given by $_GET['contact_id']
1799
+	* @param array $content submitted content
1804 1800
 	*/
1805 1801
 	function edit($content=null)
1806 1802
 	{
@@ -2375,7 +2371,7 @@  discard block
 block discarded – undo
2375 2371
 	 *
2376 2372
 	 * @param array $values contact values from form
2377 2373
 	 * @param string $name name of changed value, eg. "email"
2378
-	 * @param int $own_id=0 own contact id, to not check against it
2374
+	 * @param int $own_id own contact id, to not check against it
2379 2375
 	 * @return array with keys 'msg' => "EMail address exists, do you want to open contact?" (or null if not existing)
2380 2376
 	 * 	'data' => array of id => "full name (addressbook)" pairs
2381 2377
 	 *  'fileas_options'
Please login to merge, or discard this patch.
Spacing   +438 added lines, -445 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 *
72 72
 	 * @param string $contact_app
73 73
 	 */
74
-	function __construct($contact_app='addressbook')
74
+	function __construct($contact_app = 'addressbook')
75 75
 	{
76 76
 		parent::__construct($contact_app);
77 77
 
@@ -84,23 +84,23 @@  discard block
 block discarded – undo
84 84
 		);
85 85
 
86 86
 		// make sure the hook for export_limit is registered
87
-		if (!$GLOBALS['egw']->hooks->hook_exists('export_limit','addressbook')) $GLOBALS['egw']->hooks->register_single_app_hook('addressbook','export_limit');
87
+		if (!$GLOBALS['egw']->hooks->hook_exists('export_limit', 'addressbook')) $GLOBALS['egw']->hooks->register_single_app_hook('addressbook', 'export_limit');
88 88
 
89
-		$this->config =& $GLOBALS['egw_info']['server'];
89
+		$this->config = & $GLOBALS['egw_info']['server'];
90 90
 
91 91
 		// check if a contact specific export limit is set, if yes use it also for etemplate's csv export
92
-		$this->config['export_limit'] = $this->config['contact_export_limit'] = bo_merge::getExportLimit($app='addressbook');
92
+		$this->config['export_limit'] = $this->config['contact_export_limit'] = bo_merge::getExportLimit($app = 'addressbook');
93 93
 
94 94
 		if ($this->config['copy_fields'] && ($fields = is_array($this->config['copy_fields']) ?
95 95
 			$this->config['copy_fields'] : unserialize($this->config['copy_fields'])))
96 96
 		{
97 97
 			// Set country code if country name is selected
98
-			$supported_fields = $this->get_fields('supported',null,0);
99
-			if(in_array('adr_one_countrycode', $supported_fields) && in_array('adr_one_countryname',$fields))
98
+			$supported_fields = $this->get_fields('supported', null, 0);
99
+			if (in_array('adr_one_countrycode', $supported_fields) && in_array('adr_one_countryname', $fields))
100 100
 			{
101 101
 				$fields[] = 'adr_one_countrycode';
102 102
 			}
103
-			if(in_array('adr_two_countrycode', $supported_fields) && in_array('adr_two_countryname',$fields))
103
+			if (in_array('adr_two_countrycode', $supported_fields) && in_array('adr_two_countryname', $fields))
104 104
 			{
105 105
 				$fields[] = 'adr_two_countrycode';
106 106
 			}
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	 * @param string $msg=null	message to show
117 117
 	 * @param boolean $do_email=false do an email-selection popup or the regular index-page
118 118
 	 */
119
-	function index($content=null,$msg=null,$do_email=false)
119
+	function index($content = null, $msg = null, $do_email = false)
120 120
 	{
121 121
 		//echo "<p>uicontacts::index(".print_r($content,true).",'$msg')</p>\n";
122 122
 		if (($re_submit = is_array($content)))
@@ -147,16 +147,16 @@  discard block
 block discarded – undo
147 147
 				}
148 148
 				else
149 149
 				{
150
-					if ($this->action($content['nm']['action'],$content['nm']['selected'],$content['nm']['select_all'],
151
-						$success,$failed,$action_msg,$content['do_email'] ? 'email' : 'index',$msg,$content['nm']['checkboxes']))
150
+					if ($this->action($content['nm']['action'], $content['nm']['selected'], $content['nm']['select_all'],
151
+						$success, $failed, $action_msg, $content['do_email'] ? 'email' : 'index', $msg, $content['nm']['checkboxes']))
152 152
 					{
153
-						$msg .= lang('%1 contact(s) %2',$success,$action_msg);
153
+						$msg .= lang('%1 contact(s) %2', $success, $action_msg);
154 154
 						egw_framework::message($msg);
155 155
 					}
156
-					elseif(is_null($msg))
156
+					elseif (is_null($msg))
157 157
 					{
158
-						$msg .= lang('%1 contact(s) %2, %3 failed because of insufficent rights !!!',$success,$action_msg,$failed);
159
-						egw_framework::message($msg,'error');
158
+						$msg .= lang('%1 contact(s) %2, %3 failed because of insufficent rights !!!', $success, $action_msg, $failed);
159
+						egw_framework::message($msg, 'error');
160 160
 					}
161 161
 					$msg = '';
162 162
 				}
@@ -176,9 +176,9 @@  discard block
 block discarded – undo
176 176
 			}
177 177
 			$typeselection = $content['nm']['col_filter']['tid'];
178 178
 		}
179
-		elseif($_GET['add_list'])
179
+		elseif ($_GET['add_list'])
180 180
 		{
181
-			$list = $this->add_list($_GET['add_list'],$_GET['owner']?$_GET['owner']:$this->user);
181
+			$list = $this->add_list($_GET['add_list'], $_GET['owner'] ? $_GET['owner'] : $this->user);
182 182
 			if ($list === true)
183 183
 			{
184 184
 				$msg = lang('List already exists!');
@@ -197,31 +197,31 @@  discard block
 block discarded – undo
197 197
 		);
198 198
 		$to = $content['nm']['to'];
199 199
 		$content = array();
200
-		if($msg || $_GET['msg'])
200
+		if ($msg || $_GET['msg'])
201 201
 		{
202 202
 			egw_framework::message($msg ? $msg : $_GET['msg']);
203 203
 		}
204 204
 
205
-		$content['nm'] = egw_session::appsession($do_email ? 'email' : 'index','addressbook');
205
+		$content['nm'] = egw_session::appsession($do_email ? 'email' : 'index', 'addressbook');
206 206
 		if (!is_array($content['nm']))
207 207
 		{
208 208
 			$content['nm'] = array(
209
-				'get_rows'       =>	'addressbook.addressbook_ui.get_rows',	// I  method/callback to request the data for the rows eg. 'notes.bo.get_rows'
210
-				'bottom_too'     => false,		// I  show the nextmatch-line (arrows, filters, search, ...) again after the rows
211
-				'never_hide'     => True,		// I  never hide the nextmatch-line if less then maxmatch entrie
212
-				'start'          =>	0,			// IO position in list
213
-				'cat_id'         =>	'',			// IO category, if not 'no_cat' => True
214
-				'search'         =>	'',			// IO search pattern
215
-				'order'          =>	'n_family',	// IO name of the column to sort after (optional for the sortheaders)
216
-				'sort'           =>	'ASC',		// IO direction of the sort: 'ASC' or 'DESC'
217
-				'col_filter'     =>	array(),	// IO array of column-name value pairs (optional for the filterheaders)
218
-				'filter_label'   =>	lang('Addressbook'),	// I  label for filter    (optional)
219
-				'filter'         =>	'',	// =All	// IO filter, if not 'no_filter' => True
220
-				'filter_no_lang' => True,		// I  set no_lang for filter (=dont translate the options)
221
-				'no_filter2'     => True,		// I  disable the 2. filter (params are the same as for filter)
222
-				'filter2_label'  =>	lang('Distribution lists'),			// IO filter2, if not 'no_filter2' => True
223
-				'filter2'        =>	'',			// IO filter2, if not 'no_filter2' => True
224
-				'filter2_no_lang'=> True,		// I  set no_lang for filter2 (=dont translate the options)
209
+				'get_rows'       =>	'addressbook.addressbook_ui.get_rows', // I  method/callback to request the data for the rows eg. 'notes.bo.get_rows'
210
+				'bottom_too'     => false, // I  show the nextmatch-line (arrows, filters, search, ...) again after the rows
211
+				'never_hide'     => True, // I  never hide the nextmatch-line if less then maxmatch entrie
212
+				'start'          =>	0, // IO position in list
213
+				'cat_id'         =>	'', // IO category, if not 'no_cat' => True
214
+				'search'         =>	'', // IO search pattern
215
+				'order'          =>	'n_family', // IO name of the column to sort after (optional for the sortheaders)
216
+				'sort'           =>	'ASC', // IO direction of the sort: 'ASC' or 'DESC'
217
+				'col_filter'     =>	array(), // IO array of column-name value pairs (optional for the filterheaders)
218
+				'filter_label'   =>	lang('Addressbook'), // I  label for filter    (optional)
219
+				'filter'         =>	'', // =All	// IO filter, if not 'no_filter' => True
220
+				'filter_no_lang' => True, // I  set no_lang for filter (=dont translate the options)
221
+				'no_filter2'     => True, // I  disable the 2. filter (params are the same as for filter)
222
+				'filter2_label'  =>	lang('Distribution lists'), // IO filter2, if not 'no_filter2' => True
223
+				'filter2'        =>	'', // IO filter2, if not 'no_filter2' => True
224
+				'filter2_no_lang'=> True, // I  set no_lang for filter2 (=dont translate the options)
225 225
 				'lettersearch'   => true,
226 226
 				'do_email'       => $do_email ? 1 : 0,
227 227
 				// using a positiv list now, as we constantly adding new columns in addressbook, but not removing them from default
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 				/* old negative list
232 232
 				'default_cols'   => '!cat_id,contact_created_contact_modified,distribution_list,contact_id,owner,room',*/
233 233
 				'filter2_onchange' => "app.addressbook.filter2_onchange();",
234
-				'manual'         => $do_email ? ' ' : false,	// space for the manual icon
234
+				'manual'         => $do_email ? ' ' : false, // space for the manual icon
235 235
 				//'actions'        => $this->get_actions(),		// set on each request, as it depends on some filters
236 236
 				'row_id'         => 'id',
237 237
 				'row_modified'   => 'modified',
@@ -246,13 +246,13 @@  discard block
 block discarded – undo
246 246
 			// use the state of the last session stored in the user prefs
247 247
 			if (($state = @unserialize($this->prefs[$do_email ? 'email_state' : 'index_state'])))
248 248
 			{
249
-				$content['nm'] = array_merge($content['nm'],$state);
249
+				$content['nm'] = array_merge($content['nm'], $state);
250 250
 			}
251 251
 		}
252 252
 		$sel_options['cat_id'] = array('' => lang('all'), '0' => lang('None'));
253 253
 
254 254
 		// Edit and delete list actions depends on permissions
255
-		if($this->get_lists(EGW_ACL_EDIT))
255
+		if ($this->get_lists(EGW_ACL_EDIT))
256 256
 		{
257 257
 			$content['nm']['placeholder_actions'][] = 'rename_list';
258 258
 			$content['nm']['placeholder_actions'][] = 'delete_list';
@@ -265,11 +265,11 @@  discard block
 block discarded – undo
265 265
 		if (isset($typeselection)) $content['nm']['col_filter']['tid'] = $typeselection;
266 266
 		// save the tid for use in creating new addressbook entrys via UI. Current tid is to be used as type of new entrys
267 267
 		//error_log(__METHOD__.__LINE__.' '.$content['nm']['col_filter']['tid']);
268
-		egw_cache::setSession('addressbook','active_tid',$content['nm']['col_filter']['tid']);
268
+		egw_cache::setSession('addressbook', 'active_tid', $content['nm']['col_filter']['tid']);
269 269
 		if ($this->lists_available())
270 270
 		{
271
-			$sel_options['filter2'] = $this->get_lists(EGW_ACL_READ,array('' => lang('none')));
272
-			$sel_options['filter2']['add'] = lang('Add a new list').'...';	// put it at the end
271
+			$sel_options['filter2'] = $this->get_lists(EGW_ACL_READ, array('' => lang('none')));
272
+			$sel_options['filter2']['add'] = lang('Add a new list').'...'; // put it at the end
273 273
 		}
274 274
 		if ($do_email)
275 275
 		{
@@ -287,11 +287,11 @@  discard block
 block discarded – undo
287 287
 			$content['nm']['header_left'] = 'addressbook.email.left';
288 288
 		}
289 289
 		// Organisation stuff is not (yet) availible with ldap
290
-		elseif($GLOBALS['egw_info']['server']['contact_repository'] != 'ldap')
290
+		elseif ($GLOBALS['egw_info']['server']['contact_repository'] != 'ldap')
291 291
 		{
292 292
 			$content['nm']['header_left'] = 'addressbook.index.left';
293 293
 		}
294
-		$sel_options['filter'] = $sel_options['owner'] = $this->get_addressbooks(EGW_ACL_READ,lang('All'));
294
+		$sel_options['filter'] = $sel_options['owner'] = $this->get_addressbooks(EGW_ACL_READ, lang('All'));
295 295
 		$sel_options['to'] = array(
296 296
 			'to'  => 'To',
297 297
 			'cc'  => 'Cc',
@@ -300,13 +300,13 @@  discard block
 block discarded – undo
300 300
 		$sel_options['adr_one_countrycode']['-custom-'] = lang('No country selected');
301 301
 
302 302
 		// if there is any export limit set, pass it on to the nextmatch, to be evaluated by the export
303
-		if (isset($this->config['contact_export_limit']) && (int)$this->config['contact_export_limit']) $content['nm']['export_limit']=$this->config['contact_export_limit'];
303
+		if (isset($this->config['contact_export_limit']) && (int)$this->config['contact_export_limit']) $content['nm']['export_limit'] = $this->config['contact_export_limit'];
304 304
 
305 305
 		// dont show tid-selection if we have only one content_type
306 306
 		// be a bit more sophisticated about it
307 307
 		$content['nm']['header_right'] = 'addressbook.index.right_add';
308 308
 		$availabletypes = array_keys($this->content_types);
309
-		if ($content['nm']['col_filter']['tid'] && !in_array($content['nm']['col_filter']['tid'],$availabletypes))
309
+		if ($content['nm']['col_filter']['tid'] && !in_array($content['nm']['col_filter']['tid'], $availabletypes))
310 310
 		{
311 311
 			//_debug_array(array('Typefilter:'=> $content['nm']['col_filter']['tid'],'Available Types:'=>$availabletypes,'action:'=>'remove invalid filter'));
312 312
 			unset($content['nm']['col_filter']['tid']);
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 		if (!isset($content['nm']['col_filter']['tid'])) $content['nm']['col_filter']['tid'] = $availabletypes[0];
315 315
 		if (count($this->content_types) > 1)
316 316
 		{
317
-			foreach($this->content_types as $tid => $data)
317
+			foreach ($this->content_types as $tid => $data)
318 318
 			{
319 319
 				$sel_options['tid'][$tid] = $data['name'];
320 320
 			}
@@ -332,22 +332,22 @@  discard block
 block discarded – undo
332 332
 
333 333
 		$content['nm']['actions'] = $this->get_actions($content['nm']['col_filter']['tid'], $content['nm']['org_view']);
334 334
 
335
-		if (!isset($sel_options['org_view'][(string) $content['nm']['org_view']]))
335
+		if (!isset($sel_options['org_view'][(string)$content['nm']['org_view']]))
336 336
 		{
337 337
 			$sel_options['org_view'] += $this->_get_org_name((string)$content['nm']['org_view']);
338 338
 		}
339 339
 		// unset the filters regarding organisations, when there is no organisation selected
340
-		if (empty($sel_options['org_view'][(string) $content['nm']['org_view']]) || stripos($org_view,":") === false )
340
+		if (empty($sel_options['org_view'][(string)$content['nm']['org_view']]) || stripos($org_view, ":") === false)
341 341
 		{
342 342
 			unset($content['nm']['col_filter']['org_name']);
343 343
 			unset($content['nm']['col_filter']['org_unit']);
344 344
 			unset($content['nm']['col_filter']['adr_one_locality']);
345 345
 		}
346
-		$content['nm']['org_view_label'] = $sel_options['org_view'][(string) $content['nm']['org_view']];
346
+		$content['nm']['org_view_label'] = $sel_options['org_view'][(string)$content['nm']['org_view']];
347 347
 
348 348
 		$this->tmpl->read($do_email ? 'addressbook.email' : 'addressbook.index');
349 349
 		return $this->tmpl->exec($do_email ? 'addressbook.addressbook_ui.emailpopup' : 'addressbook.addressbook_ui.index',
350
-			$content,$sel_options,$readonlys,$preserv,$do_email ? 2 : 0);
350
+			$content, $sel_options, $readonlys, $preserv, $do_email ? 2 : 0);
351 351
 	}
352 352
 
353 353
 	/**
@@ -357,17 +357,17 @@  discard block
 block discarded – undo
357 357
 	 * @param string $org_view=null
358 358
 	 * @return array see nextmatch_widget::get_actions()
359 359
 	 */
360
-	public function get_actions($tid_filter=null, $org_view=null)
360
+	public function get_actions($tid_filter = null, $org_view = null)
361 361
 	{
362 362
 		// we have no org view (view of one org has context menu like regular "add contacts" view, as it shows contacts
363
-		if (!isset($this->org_views[(string) $org_view]))
363
+		if (!isset($this->org_views[(string)$org_view]))
364 364
 		{
365 365
 			$actions = array(
366 366
 				'view' => array(
367 367
 					'caption' => 'CRM-View',
368 368
 					'default' => $GLOBALS['egw_info']['user']['preferences']['addressbook']['crm_list'] != '~edit~',
369 369
 					'allowOnMultiple' => false,
370
-					'group' => $group=1,
370
+					'group' => $group = 1,
371 371
 					'onExecute' => 'javaScript:app.addressbook.view',
372 372
 					// Children added below
373 373
 					'children' => array()
@@ -402,14 +402,14 @@  discard block
 block discarded – undo
402 402
 			);
403 403
 			// CRM view options
404 404
 			$crm_count = 0;
405
-			$crm_apps = array('infolog','tracker');
406
-			foreach($crm_apps as $app)
405
+			$crm_apps = array('infolog', 'tracker');
406
+			foreach ($crm_apps as $app)
407 407
 			{
408 408
 				if ($GLOBALS['egw_info']['user']['apps'][$app]) $crm_count++;
409 409
 			}
410
-			if($crm_count > 1)
410
+			if ($crm_count > 1)
411 411
 			{
412
-				foreach($crm_apps as $app)
412
+				foreach ($crm_apps as $app)
413 413
 				{
414 414
 					$actions['view']['children']["view-$app"] = array(
415 415
 						'caption' => $app,
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
 					'caption' => 'View',
426 426
 					'default' => true,
427 427
 					'allowOnMultiple' => false,
428
-					'group' => $group=1,
428
+					'group' => $group = 1,
429 429
 				),
430 430
 				'add' => array(
431 431
 					'caption' => 'Add',
@@ -437,23 +437,23 @@  discard block
 block discarded – undo
437 437
 			);
438 438
 		}
439 439
 
440
-		++$group;	// other AB related stuff group: lists, AB's, categories
440
+		++$group; // other AB related stuff group: lists, AB's, categories
441 441
 		// categories submenu
442 442
 		$actions['cat'] = array(
443 443
 			'caption' => 'Categories',
444 444
 			'group' => $group,
445 445
 			'children' => array(
446 446
 				'cat_add' => nextmatch_widget::category_action(
447
-					'addressbook',$group,'Add category', 'cat_add_',
448
-					true, 0,nextmatch_widget::DEFAULT_MAX_MENU_LENGTH,false
449
-				)+array(
447
+					'addressbook', $group, 'Add category', 'cat_add_',
448
+					true, 0, nextmatch_widget::DEFAULT_MAX_MENU_LENGTH, false
449
+				) + array(
450 450
 					'icon' => 'foldertree_nolines_plus',
451 451
 					'disableClass' => 'rowNoEdit',
452 452
 				),
453 453
 				'cat_del' => nextmatch_widget::category_action(
454
-					'addressbook',$group,'Delete category', 'cat_del_',
455
-					true, 0,nextmatch_widget::DEFAULT_MAX_MENU_LENGTH,false
456
-				)+array(
454
+					'addressbook', $group, 'Delete category', 'cat_del_',
455
+					true, 0, nextmatch_widget::DEFAULT_MAX_MENU_LENGTH, false
456
+				) + array(
457 457
 					'icon' => 'foldertree_nolines_minus',
458 458
 					'disableClass' => 'rowNoEdit',
459 459
 				),
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
 					'children' => $add_lists,
481 481
 					'prefix' => 'to_list_',
482 482
 					'icon' => 'foldertree_nolines_plus',
483
-					'enabled' => ($add_lists?true:false), // if there are editable lists, allow to add a contact to one of them,
483
+					'enabled' => ($add_lists ? true : false), // if there are editable lists, allow to add a contact to one of them,
484 484
 					//'disableClass' => 'rowNoEdit',	  // wether you are allowed to edit the contact or not, as you alter a list, not the contact
485 485
 				),
486 486
 				'remove_from_list' => array(
@@ -489,14 +489,14 @@  discard block
 block discarded – undo
489 489
 					'icon' => 'foldertree_nolines_minus',
490 490
 					'enabled' => 'javaScript:app.addressbook.nm_compare_field',
491 491
 					'fieldId' => 'exec[nm][filter2]',
492
-					'fieldValue' => '!',	// enable if list != ''
492
+					'fieldValue' => '!', // enable if list != ''
493 493
 				),
494 494
 				'rename_list' => array(
495 495
 					'caption' => 'Rename selected distribution list',
496 496
 					'icon' => 'edit',
497 497
 					'enabled' => 'javaScript:app.addressbook.nm_compare_field',
498 498
 					'fieldId' => 'exec[nm][filter2]',
499
-					'fieldValue' => '!',	// enable if list != ''
499
+					'fieldValue' => '!', // enable if list != ''
500 500
 					'onExecute' => 'javaScript:app.addressbook.rename_list'
501 501
 				),
502 502
 				'delete_list' => array(
@@ -505,10 +505,10 @@  discard block
 block discarded – undo
505 505
 					'icon' => 'delete',
506 506
 					'enabled' => 'javaScript:app.addressbook.nm_compare_field',
507 507
 					'fieldId' => 'exec[nm][filter2]',
508
-					'fieldValue' => '!',	// enable if list != ''
508
+					'fieldValue' => '!', // enable if list != ''
509 509
 				),
510 510
 			);
511
-			if(is_subclass_of('etemplate', 'etemplate_new'))
511
+			if (is_subclass_of('etemplate', 'etemplate_new'))
512 512
 			{
513 513
 				$actions['lists']['children']['remove_from_list']['fieldId'] = 'filter2';
514 514
 				$actions['lists']['children']['rename_list']['fieldId'] = 'filter2';
@@ -518,17 +518,17 @@  discard block
 block discarded – undo
518 518
 		// move to AB
519 519
 		if (($move2addressbooks = $this->get_addressbooks(EGW_ACL_ADD)))	// do we have addressbooks, we should
520 520
 		{
521
-			unset($move2addressbooks[0]);	// do not offer action to move contact to an account, as we dont support that currrently
522
-			foreach($move2addressbooks as $owner => $label)
521
+			unset($move2addressbooks[0]); // do not offer action to move contact to an account, as we dont support that currrently
522
+			foreach ($move2addressbooks as $owner => $label)
523 523
 			{
524
-				$this->type_icon((int)$owner, substr($owner,-1) == 'p', 'n', $icon, $type_label);
524
+				$this->type_icon((int)$owner, substr($owner, -1) == 'p', 'n', $icon, $type_label);
525 525
 				$move2addressbooks[$owner] = array(
526 526
 					'icon' => $icon,
527 527
 					'caption' => $label,
528 528
 				);
529 529
 			}
530 530
 			// copy checkbox
531
-			$move2addressbooks= array(
531
+			$move2addressbooks = array(
532 532
 				'copy' =>array(
533 533
 					'id' => 'move_to_copy',
534 534
 					'caption' => 'Copy instead of move',
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
 			'group' => $group,
551 551
 		);
552 552
 
553
-		++$group;	// integration with other apps: infolog, calendar, filemanager
553
+		++$group; // integration with other apps: infolog, calendar, filemanager
554 554
 		if ($GLOBALS['egw_info']['user']['apps']['infolog'])
555 555
 		{
556 556
 			$actions['infolog_app'] = array(
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 						'icon' => 'new',
570 570
 						'url' => 'menuaction=infolog.infolog_ui.edit&type=task&action=addressbook&action_id=$id',
571 571
 						'popup' => egw_link::get_registry('infolog', 'add_popup'),
572
-						'onExecute' => 'javaScript:app.addressbook.add_task',	// call server for org-view only
572
+						'onExecute' => 'javaScript:app.addressbook.add_task', // call server for org-view only
573 573
 					),
574 574
 				)
575 575
 			);
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 						'icon' => 'view',
587 587
 						'url' => 'menuaction=calendar.calendar_uiforms.edit&participants=c$id',
588 588
 						'onExecute' => 'javaScript:app.addressbook.view_calendar',
589
-						'targetapp' => 'calendar',	// open in calendar tab,
589
+						'targetapp' => 'calendar', // open in calendar tab,
590 590
 						'hideOnDisabled' => true,
591 591
 					),
592 592
 					'calendar_add' => array(
@@ -653,12 +653,12 @@  discard block
 block discarded – undo
653 653
 				'allowOnMultiple' => false,
654 654
 				'group' => $group,
655 655
 				// disable for for org-views, as it needs contact-ids
656
-				'enabled' => !isset($this->org_views[(string) $org_view]),
656
+				'enabled' => !isset($this->org_views[(string)$org_view]),
657 657
 			);
658 658
 		}
659 659
 		// check if user is an admin or the export is not generally turned off (contact_export_limit is non-numerical, eg. no)
660 660
 		$exception = bo_merge::is_export_limit_excepted();
661
-		if ((isset($GLOBALS['egw_info']['user']['apps']['admin']) || $exception)  || !$this->config['contact_export_limit'] || (int)$this->config['contact_export_limit'])
661
+		if ((isset($GLOBALS['egw_info']['user']['apps']['admin']) || $exception) || !$this->config['contact_export_limit'] || (int)$this->config['contact_export_limit'])
662 662
 		{
663 663
 			$actions['export'] = array(
664 664
 				'caption' => 'Export',
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
 					),
674 674
 					'vcard'  => array(
675 675
 						'caption' => 'Export as VCard',
676
-						'postSubmit' => true,	// download needs post submit (not Ajax) to work
676
+						'postSubmit' => true, // download needs post submit (not Ajax) to work
677 677
 						'icon' => egw_vfs::mime_icon('text/vcard'),
678 678
 					),
679 679
 				),
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
 			$this->prefs['document_dir'], $group, 'Insert in document', 'document_',
685 685
 			$this->prefs['default_document'], $this->config['contact_export_limit']
686 686
 		);
687
-		if (isset($GLOBALS['egw_info']['apps']['stylite']) && ($GLOBALS['egw_info']['user']['apps']['felamimail']||$GLOBALS['egw_info']['user']['apps']['mail']))
687
+		if (isset($GLOBALS['egw_info']['apps']['stylite']) && ($GLOBALS['egw_info']['user']['apps']['felamimail'] || $GLOBALS['egw_info']['user']['apps']['mail']))
688 688
 		{
689 689
 			$actions['mail'] = array(
690 690
 				'caption' => lang('Mail VCard'),
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
 				'disableClass' => 'rowNoDelete',
705 705
 			);
706 706
 		}
707
-		if ($this->grants[0] & EGW_ACL_DELETE)
707
+		if ($this->grants[0]&EGW_ACL_DELETE)
708 708
 		{
709 709
 			$actions['delete_account'] = array(
710 710
 				'caption' => 'Delete',
@@ -717,7 +717,7 @@  discard block
 block discarded – undo
717 717
 			);
718 718
 			$actions['delete']['hideOnDisabled'] = true;
719 719
 		}
720
-		if($tid_filter == 'D')
720
+		if ($tid_filter == 'D')
721 721
 		{
722 722
 			$actions['undelete'] = array(
723 723
 				'caption' => 'Un-delete',
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
 				'disableClass' => 'rowNoEdit',
727 727
 			);
728 728
 		}
729
-		if (isset($actions['export']['children']['csv']) && !importexport_helper_functions::has_definitions('addressbook','export')) unset($actions['export']['children']['csv']);
729
+		if (isset($actions['export']['children']['csv']) && !importexport_helper_functions::has_definitions('addressbook', 'export')) unset($actions['export']['children']['csv']);
730 730
 
731 731
 		//echo "<p>".__METHOD__."($do_email, $tid_filter, $org_view)</p>\n"; _debug_array($actions);
732 732
 
@@ -749,13 +749,13 @@  discard block
 block discarded – undo
749 749
 	private function _get_org_name($org)
750 750
 	{
751 751
 		$org_name = array();
752
-		if (strpos($org,'*AND*')!== false) $org = str_replace('*AND*','&',$org);
753
-		foreach(explode('|||',$org) as $part)
752
+		if (strpos($org, '*AND*') !== false) $org = str_replace('*AND*', '&', $org);
753
+		foreach (explode('|||', $org) as $part)
754 754
 		{
755
-			list(,$name) = explode(':',$part,2);
755
+			list(,$name) = explode(':', $part, 2);
756 756
 			if ($name) $org_name[] = $name;
757 757
 		}
758
-		$org_name = implode(': ',$org_name);
758
+		$org_name = implode(': ', $org_name);
759 759
 		return $org_name ? array($org => $org_name) : array();
760 760
 	}
761 761
 
@@ -765,12 +765,12 @@  discard block
 block discarded – undo
765 765
 	 * @param array $content=null submitted content
766 766
 	 * @param string $msg=null	message to show
767 767
 	 */
768
-	function emailpopup($content=null,$msg=null)
768
+	function emailpopup($content = null, $msg = null)
769 769
 	{
770
-		if (strpos($GLOBALS['egw_info']['flags']['java_script'],'addEmail') === false)
770
+		if (strpos($GLOBALS['egw_info']['flags']['java_script'], 'addEmail') === false)
771 771
 		{
772 772
 			$handler = 'opener.addEmail(to,email)';
773
-			$GLOBALS['egw_info']['flags']['java_script'].= "
773
+			$GLOBALS['egw_info']['flags']['java_script'] .= "
774 774
 <script>
775 775
 window.egw_LAB.wait(function() {
776 776
 	window.focus();
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
 </script>
801 801
 ";
802 802
 		}
803
-		return $this->index($content,$msg,true);
803
+		return $this->index($content, $msg, true);
804 804
 	}
805 805
 
806 806
 	/**
@@ -813,21 +813,21 @@  discard block
 block discarded – undo
813 813
 	public function ajax_organisation_contacts($org, $query = null)
814 814
 	{
815 815
 		$org_contacts = array();
816
-		$query = $query == null ? egw_session::appsession('index','addressbook') : $query;
817
-		$query['num_rows'] = -1;	// all
818
-		if(!is_array($query['col_filter'])) $query['col_filter'] = array();
816
+		$query = $query == null ? egw_session::appsession('index', 'addressbook') : $query;
817
+		$query['num_rows'] = -1; // all
818
+		if (!is_array($query['col_filter'])) $query['col_filter'] = array();
819 819
 
820
-		if(!is_array($org)) $org = array($org);
821
-		foreach($org as $org_name)
820
+		if (!is_array($org)) $org = array($org);
821
+		foreach ($org as $org_name)
822 822
 		{
823 823
 			error_log("Org: $org_name");
824 824
 			$query['org_view'] = $org_name;
825 825
 			$checked = array();
826
-			$count = $this->get_rows($query,$checked,$readonlys,true);	// true = only return the id's
827
-			error_log("Count: $count " . array2string($checked));
828
-			if($checked[0])
826
+			$count = $this->get_rows($query, $checked, $readonlys, true); // true = only return the id's
827
+			error_log("Count: $count ".array2string($checked));
828
+			if ($checked[0])
829 829
 			{
830
-				$org_contacts = array_merge($org_contacts,$checked);
830
+				$org_contacts = array_merge($org_contacts, $checked);
831 831
 			}
832 832
 		}
833 833
 		egw_json_response::get()->data(array_unique($org_contacts));
@@ -840,40 +840,40 @@  discard block
 block discarded – undo
840 840
 	 */
841 841
 	function infolog_org_view($org)
842 842
 	{
843
-		$query = egw_session::appsession('index','addressbook');
844
-		$query['num_rows'] = -1;	// all
843
+		$query = egw_session::appsession('index', 'addressbook');
844
+		$query['num_rows'] = -1; // all
845 845
 		$query['org_view'] = $org;
846 846
 		$query['searchletter'] = '';
847
-		$this->get_rows($query,$checked,$readonlys,true);	// true = only return the id's
847
+		$this->get_rows($query, $checked, $readonlys, true); // true = only return the id's
848 848
 
849 849
 		if (count($checked) > 1)	// use a nicely formatted org-name as title in infolog
850 850
 		{
851 851
 			$parts = array();
852
-			if (strpos($org,'*AND*')!== false) $org = str_replace('*AND*','&',$org);
853
-			foreach(explode('|||',$org) as $part)
852
+			if (strpos($org, '*AND*') !== false) $org = str_replace('*AND*', '&', $org);
853
+			foreach (explode('|||', $org) as $part)
854 854
 			{
855
-				list(,$part) = explode(':',$part,2);
855
+				list(,$part) = explode(':', $part, 2);
856 856
 				if ($part) $parts[] = $part;
857 857
 			}
858
-			$org = implode(', ',$parts);
858
+			$org = implode(', ', $parts);
859 859
 		}
860 860
 		else
861 861
 		{
862
-			$org = '';	// use infolog default of link-title
862
+			$org = ''; // use infolog default of link-title
863 863
 		}
864
-		egw::redirect_link('/index.php',array(
864
+		egw::redirect_link('/index.php', array(
865 865
 			'menuaction' => 'infolog.infolog_ui.index',
866 866
 			'action' => 'addressbook',
867
-			'action_id' => implode(',',$checked),
867
+			'action_id' => implode(',', $checked),
868 868
 			'action_title' => $org,
869
-		),'infolog');
869
+		), 'infolog');
870 870
 	}
871 871
 
872 872
 	function ajax_add_whole_list($list, $email_type = 'email')
873 873
 	{
874
-		$query = egw_session::appsession('email','addressbook');
874
+		$query = egw_session::appsession('email', 'addressbook');
875 875
 		$query['filter2'] = (int)$list;
876
-		$this->action($email_type,array(),true,$success,$failed,$action_msg,$query,$msg);
876
+		$this->action($email_type, array(), true, $success, $failed, $action_msg, $query, $msg);
877 877
 
878 878
 		$response = egw_json_response::get();
879 879
 
@@ -882,8 +882,7 @@  discard block
 block discarded – undo
882 882
 		// close window only if no errors AND something added
883 883
 		if ($failed || !$success)
884 884
 		{
885
-			if (!$msg) $msg = $failed ? lang('%1 contact(s) %2, %3 failed because of insufficent rights !!!',$success,$action_msg,$failed) :
886
-				lang('%1 contact(s) %2',$success,$action_msg);
885
+			if (!$msg) $msg = $failed ? lang('%1 contact(s) %2, %3 failed because of insufficent rights !!!', $success, $action_msg, $failed) : lang('%1 contact(s) %2', $success, $action_msg);
887 886
 
888 887
 			$response->addScript("alert('".addslashes($msg)."')");
889 888
 			// reset the filter
@@ -891,7 +890,7 @@  discard block
 block discarded – undo
891 890
 		}
892 891
 		else
893 892
 		{
894
-			if (!$msg) $msg = lang('%1 contact(s) %2',$success,$action_msg);
893
+			if (!$msg) $msg = lang('%1 contact(s) %2', $success, $action_msg);
895 894
 			$response->addScript("alert('".addslashes($msg)."')");
896 895
 			$response->addScript('egw(window).close();');
897 896
 		}
@@ -912,27 +911,27 @@  discard block
 block discarded – undo
912 911
 		$owner = $owner ? $owner : $GLOBALS['egw_info']['user']['account_id'];
913 912
 
914 913
 		// Check for valid list & permissions
915
-		if(!(int)$list_id && !$this->check_list(null,EGW_ACL_ADD|EGW_ACL_EDIT,$owner))
914
+		if (!(int)$list_id && !$this->check_list(null, EGW_ACL_ADD|EGW_ACL_EDIT, $owner))
916 915
 		{
917
-			egw_json_response::get()->apply('egw.message', array(  lang('List creation failed, no rights!'),'error'));
916
+			egw_json_response::get()->apply('egw.message', array(lang('List creation failed, no rights!'), 'error'));
918 917
 			return;
919 918
 		}
920 919
 		if ((int)$list_id && !$this->check_list((int)$list_id, EGW_ACL_EDIT, $owner))
921 920
 		{
922
-			egw_json_response::get()->apply('egw.message', array(  lang('Insufficent rights to edit this list!'),'error'));
921
+			egw_json_response::get()->apply('egw.message', array(lang('Insufficent rights to edit this list!'), 'error'));
923 922
 			return;
924 923
 		}
925 924
 
926 925
 		$list = array('list_owner' => $owner);
927 926
 
928 927
 		// Rename
929
-		if($list_id)
928
+		if ($list_id)
930 929
 		{
931 930
 			$list = $this->read_list((int)$list_id);
932 931
 		}
933 932
 		$list['list_name'] = $new_name;
934 933
 
935
-		$new_id = $this->add_list(array('list_id' => (int)$list_id), $list['list_owner'],array(),$list);
934
+		$new_id = $this->add_list(array('list_id' => (int)$list_id), $list['list_owner'], array(), $list);
936 935
 
937 936
 		egw_json_response::get()->apply('egw.message', array(
938 937
 			$new_id == $list_id ? lang('Distribution list renamed') : lang('List created'),
@@ -954,86 +953,86 @@  discard block
 block discarded – undo
954 953
 	 * @param string/array $session_name 'index' or 'email', or array with session-data depending if we are in the main list or the popup
955 954
 	 * @return boolean true if all actions succeded, false otherwise
956 955
 	 */
957
-	function action($action,$checked,$use_all,&$success,&$failed,&$action_msg,$session_name,&$msg, $checkboxes = NULL)
956
+	function action($action, $checked, $use_all, &$success, &$failed, &$action_msg, $session_name, &$msg, $checkboxes = NULL)
958 957
 	{
959 958
 		//echo "<p>uicontacts::action('$action',".print_r($checked,true).','.(int)$use_all.",...)</p>\n";
960 959
 		$success = $failed = 0;
961
-		if ($use_all || in_array($action,array('remove_from_list','delete_list')))
960
+		if ($use_all || in_array($action, array('remove_from_list', 'delete_list')))
962 961
 		{
963 962
 			// get the whole selection
964
-			$query = is_array($session_name) ? $session_name : egw_session::appsession($session_name,'addressbook');
963
+			$query = is_array($session_name) ? $session_name : egw_session::appsession($session_name, 'addressbook');
965 964
 
966 965
 			if ($use_all)
967 966
 			{
968
-				@set_time_limit(0);			// switch off the execution time limit, as it's for big selections to small
969
-				$query['num_rows'] = -1;	// all
970
-				$this->get_rows($query,$checked,$readonlys,true);	// true = only return the id's
967
+				@set_time_limit(0); // switch off the execution time limit, as it's for big selections to small
968
+				$query['num_rows'] = -1; // all
969
+				$this->get_rows($query, $checked, $readonlys, true); // true = only return the id's
971 970
 			}
972 971
 		}
973 972
 		// replace org_name:* id's with all id's of that org
974 973
 		$org_contacts = array();
975
-		foreach((array)$checked as $n => $id)
974
+		foreach ((array)$checked as $n => $id)
976 975
 		{
977
-			if (substr($id,0,9) == 'org_name:')
976
+			if (substr($id, 0, 9) == 'org_name:')
978 977
 			{
979 978
 				if (count($checked) == 1 && !count($org_contacts) && $action == 'infolog')
980 979
 				{
981
-					return $this->infolog_org_view($id);	// uses the org-name, instead of 'selected contacts'
980
+					return $this->infolog_org_view($id); // uses the org-name, instead of 'selected contacts'
982 981
 				}
983 982
 				unset($checked[$n]);
984
-				$query = egw_session::appsession($session_name,'addressbook');
985
-				$query['num_rows'] = -1;	// all
983
+				$query = egw_session::appsession($session_name, 'addressbook');
984
+				$query['num_rows'] = -1; // all
986 985
 				$query['org_view'] = $id;
987 986
 				unset($query['filter2']);
988
-				$this->get_rows($query,$extra,$readonlys,true);	// true = only return the id's
989
-				if ($extra[0]) $org_contacts = array_merge($org_contacts,$extra);
987
+				$this->get_rows($query, $extra, $readonlys, true); // true = only return the id's
988
+				if ($extra[0]) $org_contacts = array_merge($org_contacts, $extra);
990 989
 			}
991 990
 		}
992
-		if ($org_contacts) $checked = array_unique($checked ? array_merge($checked,$org_contacts) : $org_contacts);
991
+		if ($org_contacts) $checked = array_unique($checked ? array_merge($checked, $org_contacts) : $org_contacts);
993 992
 		//_debug_array($checked); exit;
994 993
 
995
-		if (substr($action,0,8) == 'move_to_')
994
+		if (substr($action, 0, 8) == 'move_to_')
996 995
 		{
997
-			$action = (int)substr($action,8).(substr($action,-1) == 'p' ? 'p' : '');
996
+			$action = (int)substr($action, 8).(substr($action, -1) == 'p' ? 'p' : '');
998 997
 		}
999
-		elseif (substr($action,0,8) == 'to_list_')
998
+		elseif (substr($action, 0, 8) == 'to_list_')
1000 999
 		{
1001
-			$to_list = (int)substr($action,8);
1000
+			$to_list = (int)substr($action, 8);
1002 1001
 			$action = 'to_list';
1003 1002
 		}
1004
-		elseif (substr($action,0,9) == 'document_')
1003
+		elseif (substr($action, 0, 9) == 'document_')
1005 1004
 		{
1006
-			$document = substr($action,9);
1005
+			$document = substr($action, 9);
1007 1006
 			$action = 'document';
1008 1007
 		}
1009
-		elseif(substr($action,0,4) == 'cat_')	// cat_add_123 or cat_del_456
1008
+		elseif (substr($action, 0, 4) == 'cat_')	// cat_add_123 or cat_del_456
1010 1009
 		{
1011 1010
 			$cat_id = (int)substr($action, 8);
1012
-			$action = substr($action,0,7);
1011
+			$action = substr($action, 0, 7);
1013 1012
 		}
1014 1013
 		// Security: stop non-admins to export more then the configured number of contacts
1015
-		if (in_array($action,array('csv','vcard')) && $this->config['contact_export_limit'] && !bo_merge::is_export_limit_excepted() &&
1014
+		if (in_array($action, array('csv', 'vcard')) && $this->config['contact_export_limit'] && !bo_merge::is_export_limit_excepted() &&
1016 1015
 			(!is_numeric($this->config['contact_export_limit']) || count($checked) > $this->config['contact_export_limit']))
1017 1016
 		{
1018 1017
 			$action_msg = lang('exported');
1019 1018
 			$failed = count($checked);
1020 1019
 			return false;
1021 1020
 		}
1022
-		switch($action)
1021
+		switch ($action)
1023 1022
 		{
1024 1023
 			case 'vcard':
1025 1024
 				$action_msg = lang('exported');
1026
-				$vcard = new addressbook_vcal('addressbook','text/vcard');
1025
+				$vcard = new addressbook_vcal('addressbook', 'text/vcard');
1027 1026
 				$vcard->export($checked);
1028 1027
 				// does not return!
1029 1028
 				$Ok = false;
1030 1029
 				break;
1031 1030
 
1032 1031
 			case 'merge':
1033
-				$success = $this->merge($checked,$error_msg);
1032
+				$success = $this->merge($checked, $error_msg);
1034 1033
 				$failed = count($checked) - (int)$success;
1035 1034
 				$action_msg = lang('merged');
1036
-				$checked = array();	// to not start the single actions
1035
+				$checked = array(); // to not start the single actions
1037 1036
 				break;
1038 1037
 
1039 1038
 			case 'delete_list':
@@ -1041,7 +1040,7 @@  discard block
 block discarded – undo
1041 1040
 				{
1042 1041
 					$msg = lang('You need to select a distribution list');
1043 1042
 				}
1044
-				elseif($this->delete_list($query['filter2']) === false)
1043
+				elseif ($this->delete_list($query['filter2']) === false)
1045 1044
 				{
1046 1045
 					$msg = lang('Insufficent rights to delete this list!');
1047 1046
 				}
@@ -1049,7 +1048,7 @@  discard block
 block discarded – undo
1049 1048
 				{
1050 1049
 					$msg = lang('Distribution list deleted');
1051 1050
 					unset($query['filter2']);
1052
-					egw_session::appsession($session_name,'addressbook',$query);
1051
+					egw_session::appsession($session_name, 'addressbook', $query);
1053 1052
 				}
1054 1053
 				return false;
1055 1054
 
@@ -1061,54 +1060,54 @@  discard block
 block discarded – undo
1061 1060
 				return false;
1062 1061
 
1063 1062
 			case 'infolog_add':
1064
-				list($width,$height) = explode('x',egw_link::get_registry('infolog', 'add_popup'));
1063
+				list($width, $height) = explode('x', egw_link::get_registry('infolog', 'add_popup'));
1065 1064
 				egw_framework::set_onload(
1066
-					"egw_openWindowCentered2('".egw::link('/index.php',array(
1065
+					"egw_openWindowCentered2('".egw::link('/index.php', array(
1067 1066
 						'menuaction' => 'infolog.infolog_ui.edit',
1068 1067
 						'type' => 'task',
1069 1068
 						'action' => 'addressbook',
1070
-						'action_id' => implode(',',$checked),
1069
+						'action_id' => implode(',', $checked),
1071 1070
 					))."','_blank',$width,$height);");
1072
-				$msg = '';	// no message, as we send none in javascript too and users sees opening popup
1071
+				$msg = ''; // no message, as we send none in javascript too and users sees opening popup
1073 1072
 				return false;
1074 1073
 
1075 1074
 			case 'calendar_add':	// add appointment for org-views, other views are handled directly in javascript
1076
-				list($width,$height) = explode('x',egw_link::get_registry('calendar', 'add_popup'));
1075
+				list($width, $height) = explode('x', egw_link::get_registry('calendar', 'add_popup'));
1077 1076
 				egw_framework::set_onload(
1078
-					"egw_openWindowCentered2('".egw::link('/index.php',array(
1077
+					"egw_openWindowCentered2('".egw::link('/index.php', array(
1079 1078
 						'menuaction' => 'calendar.calendar_uiforms.edit',
1080
-						'participants' => 'c'.implode(',c',$checked),
1079
+						'participants' => 'c'.implode(',c', $checked),
1081 1080
 					))."','_blank',$width,$height);");
1082
-				$msg = '';	// no message, as we send none in javascript too and users sees opening popup
1081
+				$msg = ''; // no message, as we send none in javascript too and users sees opening popup
1083 1082
 				return false;
1084 1083
 
1085 1084
 			case 'calendar_view':	// show calendar for org-views, although all views are handled directly in javascript
1086
-				list($width,$height) = explode('x',egw_link::get_registry('calendar', 'add_popup'));
1087
-				egw::redirect_link('/index.php',array(
1085
+				list($width, $height) = explode('x', egw_link::get_registry('calendar', 'add_popup'));
1086
+				egw::redirect_link('/index.php', array(
1088 1087
 					'menuaction' => 'calendar.calendar_uiviews.index',
1089
-					'owner' => 'c'.implode(',c',$checked),
1088
+					'owner' => 'c'.implode(',c', $checked),
1090 1089
 				));
1091 1090
 		}
1092
-		foreach($checked as $id)
1091
+		foreach ($checked as $id)
1093 1092
 		{
1094
-			switch($action)
1093
+			switch ($action)
1095 1094
 			{
1096 1095
 				case 'cat_add':
1097 1096
 				case 'cat_del':
1098
-					if (($Ok = !!($contact = $this->read($id)) && $this->check_perms(EGW_ACL_EDIT,$contact)))
1097
+					if (($Ok = !!($contact = $this->read($id)) && $this->check_perms(EGW_ACL_EDIT, $contact)))
1099 1098
 					{
1100 1099
 						$action_msg = $action == 'cat_add' ? lang('categorie added') : lang('categorie delete');
1101
-						$cat_ids = $contact['cat_id'] ? explode(',', $contact['cat_id']) : array();   //existing categories
1100
+						$cat_ids = $contact['cat_id'] ? explode(',', $contact['cat_id']) : array(); //existing categories
1102 1101
 						if ($action == 'cat_add')
1103 1102
 						{
1104 1103
 							$cat_ids[] = $cat_id;
1105 1104
 							$cat_ids = array_unique($cat_ids);
1106 1105
 						}
1107
-						elseif ((($key = array_search($cat_id,$cat_ids))) !== false)
1106
+						elseif ((($key = array_search($cat_id, $cat_ids))) !== false)
1108 1107
 						{
1109 1108
 							unset($cat_ids[$key]);
1110 1109
 						}
1111
-						$cat_ids = $cat_ids ? implode(',',$cat_ids) : null;
1110
+						$cat_ids = $cat_ids ? implode(',', $cat_ids) : null;
1112 1111
 						if ($cat_ids !== $contact['cat_id'])
1113 1112
 						{
1114 1113
 							$contact['cat_id'] = $cat_ids;
@@ -1119,10 +1118,10 @@  discard block
 block discarded – undo
1119 1118
 
1120 1119
 				case 'delete':
1121 1120
 					$action_msg = lang('deleted');
1122
-					if (($Ok = !!($contact = $this->read($id)) && $this->check_perms(EGW_ACL_DELETE,$contact)))
1121
+					if (($Ok = !!($contact = $this->read($id)) && $this->check_perms(EGW_ACL_DELETE, $contact)))
1123 1122
 					{
1124
-						if ($contact['owner'] ||	// regular contact or
1125
-							empty($contact['account_id']) ||	// accounts without account_id
1123
+						if ($contact['owner'] || // regular contact or
1124
+							empty($contact['account_id']) || // accounts without account_id
1126 1125
 							// already deleted account (should no longer happen, but needed to allow for cleanup)
1127 1126
 							$contact['tid'] == addressbook_so::DELETED_TYPE)
1128 1127
 						{
@@ -1131,7 +1130,7 @@  discard block
 block discarded – undo
1131 1130
 						// delete single account --> redirect to admin
1132 1131
 						elseif (count($checked) == 1 && $contact['account_id'])
1133 1132
 						{
1134
-							egw::redirect_link('/index.php',array(
1133
+							egw::redirect_link('/index.php', array(
1135 1134
 								'menuaction' => 'admin.admin_account.delete',
1136 1135
 								'account_id' => $contact['account_id'],
1137 1136
 							));
@@ -1157,13 +1156,13 @@  discard block
 block discarded – undo
1157 1156
 				case 'email_home':
1158 1157
 					$action == 'email' ? $action_fallback = 'email_home' : $action_fallback = 'email';
1159 1158
 					$action_msg = lang('added');
1160
-					if($contact = $this->read($id))
1159
+					if ($contact = $this->read($id))
1161 1160
 					{
1162
-						if(strpos($contact[$action],'@') !== false)
1161
+						if (strpos($contact[$action], '@') !== false)
1163 1162
 						{
1164 1163
 							$email = $contact[$action];
1165 1164
 						}
1166
-						elseif(strpos($contact[$action_fallback],'@') !== false)
1165
+						elseif (strpos($contact[$action_fallback], '@') !== false)
1167 1166
 						{
1168 1167
 							$email = $contact[$action_fallback];
1169 1168
 						}
@@ -1171,9 +1170,9 @@  discard block
 block discarded – undo
1171 1170
 						{
1172 1171
 							$Ok = $email = false;
1173 1172
 						}
1174
-						if($email)
1173
+						if ($email)
1175 1174
 						{
1176
-							$contact['n_fn'] = str_replace(array(',','@'),' ',$contact['n_fn']);
1175
+							$contact['n_fn'] = str_replace(array(',', '@'), ' ', $contact['n_fn']);
1177 1176
 							egw_framework::set_onload("addEmail('".addslashes(
1178 1177
 								$contact['n_fn'] ? $contact['n_fn'].' <'.trim($email).'>' : trim($email))."');");
1179 1178
 							//error_log(__METHOD__.__LINE__."addEmail('".addslashes(
@@ -1192,7 +1191,7 @@  discard block
 block discarded – undo
1192 1191
 					}
1193 1192
 					else
1194 1193
 					{
1195
-						$Ok = $this->remove_from_list($id,$query['filter2']) !== false;
1194
+						$Ok = $this->remove_from_list($id, $query['filter2']) !== false;
1196 1195
 					}
1197 1196
 					break;
1198 1197
 
@@ -1205,28 +1204,28 @@  discard block
 block discarded – undo
1205 1204
 					}
1206 1205
 					else
1207 1206
 					{
1208
-						$Ok = $this->add2list($id,$to_list) !== false;
1207
+						$Ok = $this->add2list($id, $to_list) !== false;
1209 1208
 					}
1210 1209
 					break;
1211 1210
 
1212 1211
 				default:	// move to an other addressbook
1213
-					if (!(int)$action || !($this->grants[(string) (int) $action] & EGW_ACL_EDIT))	// might be ADD in the future
1212
+					if (!(int)$action || !($this->grants[(string)(int)$action]&EGW_ACL_EDIT))	// might be ADD in the future
1214 1213
 					{
1215 1214
 						return false;
1216 1215
 					}
1217 1216
 					if (!$checkboxes['move_to_copy'])
1218 1217
 					{
1219 1218
 						$action_msg = lang('moved');
1220
-						if (($Ok = !!($contact = $this->read($id)) && $this->check_perms(EGW_ACL_DELETE,$contact)))
1219
+						if (($Ok = !!($contact = $this->read($id)) && $this->check_perms(EGW_ACL_DELETE, $contact)))
1221 1220
 						{
1222 1221
 							if (!$contact['owner'])		// no (mass-)move of accounts
1223 1222
 							{
1224 1223
 								$Ok = false;
1225 1224
 							}
1226
-							elseif ($contact['owner'] != (int)$action || $contact['private'] != (int)(substr($action,-1) == 'p'))
1225
+							elseif ($contact['owner'] != (int)$action || $contact['private'] != (int)(substr($action, -1) == 'p'))
1227 1226
 							{
1228
-								$contact['owner'] = (int) $action;
1229
-								$contact['private'] = (int)(substr($action,-1) == 'p');
1227
+								$contact['owner'] = (int)$action;
1228
+								$contact['private'] = (int)(substr($action, -1) == 'p');
1230 1229
 								$Ok = $this->save($contact);
1231 1230
 							}
1232 1231
 						}
@@ -1234,14 +1233,14 @@  discard block
 block discarded – undo
1234 1233
 					else
1235 1234
 					{
1236 1235
 						$action_msg = lang('copied');
1237
-						if (($Ok = !!($contact = $this->read($id)) && $this->check_perms(EGW_ACL_READ,$contact)))
1236
+						if (($Ok = !!($contact = $this->read($id)) && $this->check_perms(EGW_ACL_READ, $contact)))
1238 1237
 						{
1239
-							if ($contact['owner'] != (int)$action || $contact['private'] != (int)(substr($action,-1) == 'p'))
1238
+							if ($contact['owner'] != (int)$action || $contact['private'] != (int)(substr($action, -1) == 'p'))
1240 1239
 							{
1241
-								$this->copy_contact($contact, false);	// do NOT use self::$copy_fields, copy everything but uid etc.
1240
+								$this->copy_contact($contact, false); // do NOT use self::$copy_fields, copy everything but uid etc.
1242 1241
 								$links = $contact['link_to']['to_id'];
1243
-								$contact['owner'] = (int) $action;
1244
-								$contact['private'] = (int)(substr($action,-1) == 'p');
1242
+								$contact['owner'] = (int)$action;
1243
+								$contact['private'] = (int)(substr($action, -1) == 'p');
1245 1244
 								$Ok = $this->save($contact);
1246 1245
 								if ($Ok && is_array($links))
1247 1246
 								{
@@ -1273,22 +1272,22 @@  discard block
 block discarded – undo
1273 1272
 	 * @param boolean $only_copy_fields =true true: only copy fields configured for copying (eg. no name),
1274 1273
 	 *		false: copy everything, but never to copy fields
1275 1274
 	 */
1276
-	function copy_contact(array &$content, $only_copy_fields=true)
1275
+	function copy_contact(array &$content, $only_copy_fields = true)
1277 1276
 	{
1278 1277
 		$content['link_to']['to_id'] = 0;
1279
-		egw_link::link('addressbook',$content['link_to']['to_id'],'addressbook',$content['id'],
1280
-			lang('Copied by %1, from record #%2.',common::display_fullname('',
1281
-			$GLOBALS['egw_info']['user']['account_firstname'],$GLOBALS['egw_info']['user']['account_lastname']),
1278
+		egw_link::link('addressbook', $content['link_to']['to_id'], 'addressbook', $content['id'],
1279
+			lang('Copied by %1, from record #%2.', common::display_fullname('',
1280
+			$GLOBALS['egw_info']['user']['account_firstname'], $GLOBALS['egw_info']['user']['account_lastname']),
1282 1281
 			$content['id']));
1283 1282
 		// create a new contact with the content of the old
1284
-		foreach(array_keys($content) as $key)
1283
+		foreach (array_keys($content) as $key)
1285 1284
 		{
1286
-			if($only_copy_fields && !in_array($key, self::$copy_fields) || in_array($key, array('id','etag','carddav_name','uid')))
1285
+			if ($only_copy_fields && !in_array($key, self::$copy_fields) || in_array($key, array('id', 'etag', 'carddav_name', 'uid')))
1287 1286
 			{
1288 1287
 				unset($content[$key]);
1289 1288
 			}
1290 1289
 		}
1291
-		if(!isset($content['owner']))
1290
+		if (!isset($content['owner']))
1292 1291
 		{
1293 1292
 			$content['owner'] = $this->default_private ? $this->user.'p' : $this->default_addressbook;
1294 1293
 		}
@@ -1306,7 +1305,7 @@  discard block
 block discarded – undo
1306 1305
 	 * @param boolean $id_only=false if true only return (via $rows) an array of contact-ids, dont save state to session
1307 1306
 	 * @return int total number of contacts matching the selection
1308 1307
 	 */
1309
-	function get_rows(&$query,&$rows,&$readonlys,$id_only=false)
1308
+	function get_rows(&$query, &$rows, &$readonlys, $id_only = false)
1310 1309
 	{
1311 1310
 		$do_email = $query['do_email'];
1312 1311
 		$what = $query['sitemgr_display'] ? $query['sitemgr_display'] : ($do_email ? 'email' : 'index');
@@ -1315,46 +1314,46 @@  discard block
 block discarded – undo
1315 1314
 		{
1316 1315
 			$store_query = $query;
1317 1316
 			// Do not store these
1318
-			foreach(array('options-cat_id','actions') as $key)
1317
+			foreach (array('options-cat_id', 'actions') as $key)
1319 1318
 			{
1320 1319
 				unset($store_query[$key]);
1321 1320
 			}
1322
-			$old_state = egw_session::appsession($what,'addressbook',$store_query);
1321
+			$old_state = egw_session::appsession($what, 'addressbook', $store_query);
1323 1322
 		}
1324 1323
 		else
1325 1324
 		{
1326
-			$old_state = egw_session::appsession($what,'addressbook');
1325
+			$old_state = egw_session::appsession($what, 'addressbook');
1327 1326
 		}
1328
-		if (!isset($this->org_views[(string) $query['org_view']]))   // we dont have an org view, unset the according col_filters
1327
+		if (!isset($this->org_views[(string)$query['org_view']]))   // we dont have an org view, unset the according col_filters
1329 1328
 		{
1330 1329
 			if (isset($query['col_filter']['org_name'])) unset($query['col_filter']['org_name']);
1331 1330
 			if (isset($query['col_filter']['adr_one_locality'])) unset($query['col_filter']['adr_one_locality']);
1332 1331
 			if (isset($query['col_filter']['org_unit'])) unset($query['col_filter']['org_unit']);
1333 1332
 		}
1334 1333
 
1335
-		if (isset($this->org_views[(string) $query['org_view']]))	// we have an org view, reset the advanced search
1334
+		if (isset($this->org_views[(string)$query['org_view']]))	// we have an org view, reset the advanced search
1336 1335
 		{
1337 1336
 			//_debug_array(array('Search'=>$query['search'],
1338 1337
 			//	'AdvancedSearch'=>$query['advanced_search']));
1339 1338
 			//if (is_array($query['search'])) unset($query['search']);
1340 1339
 			//unset($query['advanced_search']);
1341
-			if(!$query['search'] && $old_state['advanced_search']) $query['advanced_search'] = $old_state['advanced_search'];
1340
+			if (!$query['search'] && $old_state['advanced_search']) $query['advanced_search'] = $old_state['advanced_search'];
1342 1341
 		}
1343
-		elseif(!$query['search'] && $old_state['advanced_search'])	// eg. paging in an advanced search
1342
+		elseif (!$query['search'] && $old_state['advanced_search'])	// eg. paging in an advanced search
1344 1343
 		{
1345 1344
 			$query['advanced_search'] = $old_state['advanced_search'];
1346 1345
 		}
1347 1346
 		if ($do_email && etemplate::$loop)
1348 1347
 		{	// remove previous addEmail() calls, otherwise they will be run again
1349
-			egw_framework::set_onload(preg_replace('/addEmail\([^)]+\);/','',egw_framework::set_onload()),true);
1348
+			egw_framework::set_onload(preg_replace('/addEmail\([^)]+\);/', '', egw_framework::set_onload()), true);
1350 1349
 		}
1351 1350
 
1352 1351
 		// Make sure old lettersearch filter doesn't stay - current letter filter will be added later
1353
-		foreach($query['col_filter'] as $key => $col_filter)
1352
+		foreach ($query['col_filter'] as $key => $col_filter)
1354 1353
 		{
1355
-			if(!is_numeric($key)) continue;
1356
-			if(preg_match('/'.$GLOBALS['egw']->db->capabilities['case_insensitive_like'].
1357
-				' '.$GLOBALS['egw']->db->quote('[a-z]%').'$/i',$col_filter) == 1
1354
+			if (!is_numeric($key)) continue;
1355
+			if (preg_match('/'.$GLOBALS['egw']->db->capabilities['case_insensitive_like'].
1356
+				' '.$GLOBALS['egw']->db->quote('[a-z]%').'$/i', $col_filter) == 1
1358 1357
 			)
1359 1358
 			{
1360 1359
 				unset($query['col_filter'][$key]);
@@ -1369,16 +1368,16 @@  discard block
 block discarded – undo
1369 1368
 			{
1370 1369
 				if ($old_state['filter'] === '0')	// user changed to org_view
1371 1370
 				{
1372
-					$query['filter'] = '';			// --> change filter to all contacts
1371
+					$query['filter'] = ''; // --> change filter to all contacts
1373 1372
 				}
1374 1373
 				else								// user changed to accounts
1375 1374
 				{
1376
-					$query['org_view'] = '';		// --> change to regular contacts view
1375
+					$query['org_view'] = ''; // --> change to regular contacts view
1377 1376
 				}
1378 1377
 			}
1379 1378
 			if ($query['org_view'] && isset($this->org_views[$old_state['org_view']]) && !isset($this->org_views[$query['org_view']]))
1380 1379
 			{
1381
-				$query['searchletter'] = '';		// reset lettersearch if viewing the contacts of one organisation
1380
+				$query['searchletter'] = ''; // reset lettersearch if viewing the contacts of one organisation
1382 1381
 			}
1383 1382
 			// save the state of the index in the user prefs
1384 1383
 			$state = serialize(array(
@@ -1391,9 +1390,9 @@  discard block
 block discarded – undo
1391 1390
 			));
1392 1391
 			if ($state != $this->prefs[$what.'_state'] && !$query['csv_export'])
1393 1392
 			{
1394
-				$GLOBALS['egw']->preferences->add('addressbook',$what.'_state',$state);
1393
+				$GLOBALS['egw']->preferences->add('addressbook', $what.'_state', $state);
1395 1394
 				// save prefs, but do NOT invalid the cache (unnecessary)
1396
-				$GLOBALS['egw']->preferences->save_repository(false,'user',false);
1395
+				$GLOBALS['egw']->preferences->save_repository(false, 'user', false);
1397 1396
 			}
1398 1397
 		}
1399 1398
 		unset($old_state);
@@ -1408,11 +1407,11 @@  discard block
 block discarded – undo
1408 1407
 		}
1409 1408
 		if ($query['filter'] !== '')	// not all addressbooks
1410 1409
 		{
1411
-			$query['col_filter']['owner'] = (string) (int) $query['filter'];
1410
+			$query['col_filter']['owner'] = (string)(int)$query['filter'];
1412 1411
 
1413 1412
 			if ($this->private_addressbook)
1414 1413
 			{
1415
-				$query['col_filter']['private'] = substr($query['filter'],-1) == 'p' ? 1 : 0;
1414
+				$query['col_filter']['private'] = substr($query['filter'], -1) == 'p' ? 1 : 0;
1416 1415
 			}
1417 1416
 		}
1418 1417
 		else
@@ -1422,7 +1421,7 @@  discard block
 block discarded – undo
1422 1421
 		}
1423 1422
 		if ((int)$query['filter2'])	// not no distribution list
1424 1423
 		{
1425
-			$query['col_filter']['list'] = (string) (int) $query['filter2'];
1424
+			$query['col_filter']['list'] = (string)(int)$query['filter2'];
1426 1425
 		}
1427 1426
 		else
1428 1427
 		{
@@ -1435,15 +1434,15 @@  discard block
 block discarded – undo
1435 1434
 		// enable/disable distribution lists depending on backend
1436 1435
 		$query['no_filter2'] = !$this->lists_available($query['filter']);
1437 1436
 
1438
-		if (isset($this->org_views[(string) $query['org_view']]))	// we have an org view
1437
+		if (isset($this->org_views[(string)$query['org_view']]))	// we have an org view
1439 1438
 		{
1440
-			if($query['actions'] && $query['actions']['open'])
1439
+			if ($query['actions'] && $query['actions']['open'])
1441 1440
 			{
1442 1441
 				// Just switched from contact view, update actions
1443 1442
 				$query['actions'] = $this->get_actions($query['col_filter']['tid'], $query['org_view']);
1444 1443
 			}
1445
-			unset($query['col_filter']['list']);	// does not work together
1446
-			$query['no_filter2'] = true;			// switch the distribution list selection off
1444
+			unset($query['col_filter']['list']); // does not work together
1445
+			$query['no_filter2'] = true; // switch the distribution list selection off
1447 1446
 
1448 1447
 			$query['template'] = 'addressbook.index.org_rows';
1449 1448
 
@@ -1483,25 +1482,25 @@  discard block
 block discarded – undo
1483 1482
 			}
1484 1483
 			if ($query['org_view'])	// view the contacts of one organisation only
1485 1484
 			{
1486
-				if (strpos($query['org_view'],'*AND*') !== false) $query['org_view'] = str_replace('*AND*','&',$query['org_view']);
1487
-				foreach(explode('|||',$query['org_view']) as $part)
1485
+				if (strpos($query['org_view'], '*AND*') !== false) $query['org_view'] = str_replace('*AND*', '&', $query['org_view']);
1486
+				foreach (explode('|||', $query['org_view']) as $part)
1488 1487
 				{
1489
-					list($name,$value) = explode(':',$part,2);
1488
+					list($name, $value) = explode(':', $part, 2);
1490 1489
 					// do NOT set invalid column, as this gives an SQL error ("AND AND" in sql)
1491
-					if (in_array($name, array('org_name','org_unit','adr_one_location')))
1490
+					if (in_array($name, array('org_name', 'org_unit', 'adr_one_location')))
1492 1491
 					{
1493 1492
 						$query['col_filter'][$name] = $value;
1494 1493
 					}
1495 1494
 				}
1496 1495
 			}
1497
-			else if($query['actions'] && !$query['actions']['edit'])
1496
+			else if ($query['actions'] && !$query['actions']['edit'])
1498 1497
 			{
1499 1498
 				// Just switched from org view, update actions
1500 1499
 				$query['actions'] = $this->get_actions($query['col_filter']['tid'], $query['org_view']);
1501 1500
 			}
1502 1501
 			// translate the select order to the really used over all 3 columns
1503 1502
 			$sort = $query['sort'];
1504
-			switch($query['order'])		// "xxx<>'' DESC" sorts contacts with empty order-criteria always at the end
1503
+			switch ($query['order'])		// "xxx<>'' DESC" sorts contacts with empty order-criteria always at the end
1505 1504
 			{							// we don't exclude them, as the total would otherwise depend on the order-criteria
1506 1505
 				case 'org_name':
1507 1506
 					$order = "egw_addressbook.org_name<>''DESC,egw_addressbook.org_name $sort,n_family $sort,n_given $sort";
@@ -1535,8 +1534,8 @@  discard block
 block discarded – undo
1535 1534
 			}
1536 1535
 			if ($query['searchletter'])	// only show contacts if the order-criteria starts with the given letter
1537 1536
 			{
1538
-				$no_letter_search = array('adr_one_postalcode', 'adr_two_postalcode', 'contact_id', 'contact_created','contact_modified');
1539
-				$query['col_filter'][] = (in_array($query['order'],$no_letter_search) ? 'org_name' : (substr($query['order'],0,1)=='#'?'':'egw_addressbook.').$query['order']).' '.
1537
+				$no_letter_search = array('adr_one_postalcode', 'adr_two_postalcode', 'contact_id', 'contact_created', 'contact_modified');
1538
+				$query['col_filter'][] = (in_array($query['order'], $no_letter_search) ? 'org_name' : (substr($query['order'], 0, 1) == '#' ? '' : 'egw_addressbook.').$query['order']).' '.
1540 1539
 					$GLOBALS['egw']->db->capabilities['case_insensitive_like'].' '.$GLOBALS['egw']->db->quote(strtolower($query['searchletter']).'%');
1541 1540
 			}
1542 1541
 			$wildcard = '%';
@@ -1550,39 +1549,39 @@  discard block
 block discarded – undo
1550 1549
 				unset($query['advanced_search']['meth_select']);
1551 1550
 			}
1552 1551
 			//if ($do_email ) $email_only = array('id','owner','tid','n_fn','n_family','n_given','org_name','email','email_home');
1553
-			$rows = parent::search($query['advanced_search'] ? $query['advanced_search'] : $query['search'],$id_only,
1554
-				$order,'',$wildcard,false,$op,array((int)$query['start'],(int) $query['num_rows']),$query['col_filter']);
1552
+			$rows = parent::search($query['advanced_search'] ? $query['advanced_search'] : $query['search'], $id_only,
1553
+				$order, '', $wildcard, false, $op, array((int)$query['start'], (int)$query['num_rows']), $query['col_filter']);
1555 1554
 
1556 1555
 			// do we need to read the custom fields, depends on the column is enabled and customfields exist
1557 1556
 			// $query['csv_export'] allways needs to read ALL cf's
1558 1557
 			$columselection = $this->prefs['nextmatch-addressbook.'.($do_email ? 'email' : 'index').'.rows'];
1559
-			$available_distib_lists=$this->get_lists(EGW_ACL_READ);
1560
-			$columselection = $columselection && !$query['csv_export'] ? explode(',',$columselection) : array();
1558
+			$available_distib_lists = $this->get_lists(EGW_ACL_READ);
1559
+			$columselection = $columselection && !$query['csv_export'] ? explode(',', $columselection) : array();
1561 1560
 			if (!$id_only && $rows)
1562 1561
 			{
1563
-				$show_custom_fields = (!$columselection || in_array('customfields',$columselection) || $query['csv_export']) && $this->customfields;
1564
-				$show_calendar = !$columselection || in_array('calendar_calendar',$columselection);
1565
-				$show_distributionlist = !$columselection || in_array('distrib_lists',$columselection) || count($available_distib_lists);
1562
+				$show_custom_fields = (!$columselection || in_array('customfields', $columselection) || $query['csv_export']) && $this->customfields;
1563
+				$show_calendar = !$columselection || in_array('calendar_calendar', $columselection);
1564
+				$show_distributionlist = !$columselection || in_array('distrib_lists', $columselection) || count($available_distib_lists);
1566 1565
 				if ($show_calendar || $show_custom_fields || $show_distributionlist)
1567 1566
 				{
1568
-					foreach($rows as $val)
1567
+					foreach ($rows as $val)
1569 1568
 					{
1570 1569
 						$ids[] = $val['id'];
1571 1570
 					}
1572 1571
 					if ($show_custom_fields)
1573 1572
 					{
1574
-						foreach($columselection as $col)
1573
+						foreach ($columselection as $col)
1575 1574
 						{
1576
-							if ($col[0] == '#') $selected_cfs[] = substr($col,1);
1575
+							if ($col[0] == '#') $selected_cfs[] = substr($col, 1);
1577 1576
 						}
1578
-						$customfields = $this->read_customfields($ids,$selected_cfs);
1577
+						$customfields = $this->read_customfields($ids, $selected_cfs);
1579 1578
 					}
1580 1579
 					if ($show_calendar && !empty($ids)) $calendar = $this->read_calendar($ids);
1581 1580
 					// distributionlist memership for the entrys
1582 1581
 					//_debug_array($this->get_lists(EGW_ACL_EDIT));
1583 1582
 					if ($show_distributionlist && $available_distib_lists)
1584 1583
 					{
1585
-						$distributionlist = $this->read_distributionlist($ids,array_keys($available_distib_lists));
1584
+						$distributionlist = $this->read_distributionlist($ids, array_keys($available_distib_lists));
1586 1585
 					}
1587 1586
 				}
1588 1587
 			}
@@ -1591,20 +1590,20 @@  discard block
 block discarded – undo
1591 1590
 
1592 1591
 		if ($id_only)
1593 1592
 		{
1594
-			foreach($rows as $n => $row)
1593
+			foreach ($rows as $n => $row)
1595 1594
 			{
1596 1595
 				$rows[$n] = $row['id'];
1597 1596
 			}
1598
-			return $this->total;	// no need to set other fields or $readonlys
1597
+			return $this->total; // no need to set other fields or $readonlys
1599 1598
 		}
1600 1599
 		$order = $query['order'];
1601 1600
 
1602 1601
 		$readonlys = array();
1603
-		foreach($rows as $n => &$row)
1602
+		foreach ($rows as $n => &$row)
1604 1603
 		{
1605 1604
 			$given = $row['n_given'] ? $row['n_given'] : ($row['n_prefix'] ? $row['n_prefix'] : '');
1606 1605
 
1607
-			switch($order)
1606
+			switch ($order)
1608 1607
 			{
1609 1608
 				default:	// postalcode, created, modified, ...
1610 1609
 				case 'org_name':
@@ -1621,37 +1620,37 @@  discard block
 block discarded – undo
1621 1620
 					break;
1622 1621
 				case 'n_fileas':
1623 1622
 					if (!$row['n_fileas']) $row['n_fileas'] = $this->fileas($row);
1624
-					list($row['line1'],$row['line2']) = explode(': ',$row['n_fileas']);
1623
+					list($row['line1'], $row['line2']) = explode(': ', $row['n_fileas']);
1625 1624
 					break;
1626 1625
 			}
1627
-			if (isset($this->org_views[(string) $query['org_view']]))
1626
+			if (isset($this->org_views[(string)$query['org_view']]))
1628 1627
 			{
1629 1628
 				$row['type'] = 'home';
1630 1629
 				$row['type_label'] = lang('Organisation');
1631 1630
 
1632
-				if ($query['filter'] && !($this->grants[(int)$query['filter']] & EGW_ACL_DELETE))
1631
+				if ($query['filter'] && !($this->grants[(int)$query['filter']]&EGW_ACL_DELETE))
1633 1632
 				{
1634 1633
 					$row['class'] .= 'rowNoDelete ';
1635 1634
 				}
1636
-				$row['class'] .= 'rowNoEdit ';	// no edit in OrgView
1635
+				$row['class'] .= 'rowNoEdit '; // no edit in OrgView
1637 1636
 			}
1638 1637
 			else
1639 1638
 			{
1640
-				$this->type_icon($row['owner'],$row['private'],$row['tid'],$row['type'],$row['type_label']);
1639
+				$this->type_icon($row['owner'], $row['private'], $row['tid'], $row['type'], $row['type_label']);
1641 1640
 
1642
-				static $tel2show = array('tel_work','tel_cell','tel_home','tel_fax');
1641
+				static $tel2show = array('tel_work', 'tel_cell', 'tel_home', 'tel_fax');
1643 1642
 				static $prefer_marker;
1644 1643
 				if (is_null($prefer_marker))
1645 1644
 				{
1646 1645
 					// as et2 adds options with .text(), it can't be entities, but php knows no string literals with utf-8
1647 1646
 					$prefer_marker = html_entity_decode(' &#9829;', ENT_NOQUOTES, 'utf-8');
1648 1647
 				}
1649
-				foreach($tel2show as $name)
1648
+				foreach ($tel2show as $name)
1650 1649
 				{
1651
-					$row[$name] .= ' '.($row['tel_prefer'] == $name ? $prefer_marker : '');		// .' ' to NOT remove the field
1650
+					$row[$name] .= ' '.($row['tel_prefer'] == $name ? $prefer_marker : ''); // .' ' to NOT remove the field
1652 1651
 				}
1653 1652
 				// allways show the prefered phone, if not already shown
1654
-				if (!in_array($row['tel_prefer'],$tel2show) && $row[$row['tel_prefer']])
1653
+				if (!in_array($row['tel_prefer'], $tel2show) && $row[$row['tel_prefer']])
1655 1654
 				{
1656 1655
 					$row['tel_prefered'] = $row[$row['tel_prefer']].$prefer_marker;
1657 1656
 				}
@@ -1659,32 +1658,32 @@  discard block
 block discarded – undo
1659 1658
 				{
1660 1659
 					$row['class'] .= 'rowAccount rowNoDelete ';
1661 1660
 				}
1662
-				elseif (!$this->check_perms(EGW_ACL_DELETE,$row) || (!$GLOBALS['egw_info']['user']['apps']['admin'] && $this->config['history'] != 'userpurge' && $query['col_filter']['tid'] == addressbook_so::DELETED_TYPE))
1661
+				elseif (!$this->check_perms(EGW_ACL_DELETE, $row) || (!$GLOBALS['egw_info']['user']['apps']['admin'] && $this->config['history'] != 'userpurge' && $query['col_filter']['tid'] == addressbook_so::DELETED_TYPE))
1663 1662
 				{
1664 1663
 					$row['class'] .= 'rowNoDelete ';
1665 1664
 				}
1666
-				if (!$this->check_perms(EGW_ACL_EDIT,$row))
1665
+				if (!$this->check_perms(EGW_ACL_EDIT, $row))
1667 1666
 				{
1668 1667
 					$row['class'] .= 'rowNoEdit ';
1669 1668
 				}
1670 1669
 
1671
-				unset($row['jpegphoto']);	// unused and messes up json encoding (not utf-8)
1670
+				unset($row['jpegphoto']); // unused and messes up json encoding (not utf-8)
1672 1671
 
1673 1672
 				if (isset($customfields[$row['id']]))
1674 1673
 				{
1675
-					foreach($this->customfields as $name => $data)
1674
+					foreach ($this->customfields as $name => $data)
1676 1675
 					{
1677 1676
 						$row['#'.$name] = $customfields[$row['id']]['#'.$name];
1678 1677
 					}
1679 1678
 				}
1680 1679
 				if (isset($distributionlist[$row['id']]))
1681 1680
 				{
1682
-					$row['distrib_lists'] = implode("\n",array_values($distributionlist[$row['id']]));
1681
+					$row['distrib_lists'] = implode("\n", array_values($distributionlist[$row['id']]));
1683 1682
 					//if ($show_distributionlist) $readonlys['distrib_lists'] =true;
1684 1683
 				}
1685 1684
 				if (isset($calendar[$row['id']]))
1686 1685
 				{
1687
-					foreach($calendar[$row['id']] as $name => $data)
1686
+					foreach ($calendar[$row['id']] as $name => $data)
1688 1687
 					{
1689 1688
 						$row[$name] = $data;
1690 1689
 					}
@@ -1692,13 +1691,13 @@  discard block
 block discarded – undo
1692 1691
 			}
1693 1692
 
1694 1693
 			// hide region for address format 'postcode_city'
1695
-			if (($row['addr_format']  = $this->addr_format_by_country($row['adr_one_countryname']))=='postcode_city') unset($row['adr_one_region']);
1696
-			if (($row['addr_format2'] = $this->addr_format_by_country($row['adr_two_countryname']))=='postcode_city') unset($row['adr_two_region']);
1694
+			if (($row['addr_format']  = $this->addr_format_by_country($row['adr_one_countryname'])) == 'postcode_city') unset($row['adr_one_region']);
1695
+			if (($row['addr_format2'] = $this->addr_format_by_country($row['adr_two_countryname'])) == 'postcode_city') unset($row['adr_two_region']);
1697 1696
 
1698 1697
 			// respect category permissions
1699
-			if(!empty($row['cat_id']))
1698
+			if (!empty($row['cat_id']))
1700 1699
 			{
1701
-				$row['cat_id'] = $this->categories->check_list(EGW_ACL_READ,$row['cat_id']);
1700
+				$row['cat_id'] = $this->categories->check_list(EGW_ACL_READ, $row['cat_id']);
1702 1701
 			}
1703 1702
 		}
1704 1703
 		$readonlys['no_distrib_lists'] = (bool)$show_distributionlist;
@@ -1714,23 +1713,21 @@  discard block
 block discarded – undo
1714 1713
 		$GLOBALS['egw_info']['flags']['app_header'] = lang('addressbook');
1715 1714
 		if ($query['filter'] !== '' && !isset($this->org_views[$query['org_view']]))
1716 1715
 		{
1717
-			$GLOBALS['egw_info']['flags']['app_header'] .= ' '.($query['filter'] == '0' ? lang('accounts') :
1718
-				($GLOBALS['egw']->accounts->get_type($query['filter']) == 'g' ?
1719
-					lang('Group %1',$GLOBALS['egw']->accounts->id2name($query['filter'])) :
1720
-					common::grab_owner_name((int)$query['filter']).
1721
-						(substr($query['filter'],-1) == 'p' ? ' ('.lang('private').')' : '')));
1716
+			$GLOBALS['egw_info']['flags']['app_header'] .= ' '.($query['filter'] == '0' ? lang('accounts') : ($GLOBALS['egw']->accounts->get_type($query['filter']) == 'g' ?
1717
+					lang('Group %1', $GLOBALS['egw']->accounts->id2name($query['filter'])) : common::grab_owner_name((int)$query['filter']).
1718
+						(substr($query['filter'], -1) == 'p' ? ' ('.lang('private').')' : '')));
1722 1719
 		}
1723 1720
 		if ($query['org_view'])
1724 1721
 		{
1725 1722
 			$GLOBALS['egw_info']['flags']['app_header'] .= ': '.$query['org_view_label'];
1726 1723
 			// Make sure option is there
1727
-			if(!array_key_exists($query['org_view'], $this->org_views))
1724
+			if (!array_key_exists($query['org_view'], $this->org_views))
1728 1725
 			{
1729 1726
 				$this->org_views += $this->_get_org_name($query['org_view']);
1730 1727
 				$rows['sel_options']['org_view'] = $this->org_views;
1731 1728
 			}
1732 1729
 		}
1733
-		if($query['advanced_search'])
1730
+		if ($query['advanced_search'])
1734 1731
 		{
1735 1732
 			$GLOBALS['egw_info']['flags']['app_header'] .= ': '.lang('Advanced search');
1736 1733
 		}
@@ -1741,11 +1738,11 @@  discard block
 block discarded – undo
1741 1738
 		if ($query['searchletter'])
1742 1739
 		{
1743 1740
 			$order = $order == 'n_given' ? lang('first name') : ($order == 'n_family' ? lang('last name') : lang('Organisation'));
1744
-			$GLOBALS['egw_info']['flags']['app_header'] .= ' - '.lang("%1 starts with '%2'",$order,$query['searchletter']);
1741
+			$GLOBALS['egw_info']['flags']['app_header'] .= ' - '.lang("%1 starts with '%2'", $order, $query['searchletter']);
1745 1742
 		}
1746 1743
 		if ($query['search'] && !$query['advanced_search']) // do not add that, if we have advanced search active
1747 1744
 		{
1748
-			$GLOBALS['egw_info']['flags']['app_header'] .= ' - '.lang("Search for '%1'",$query['search']);
1745
+			$GLOBALS['egw_info']['flags']['app_header'] .= ' - '.lang("Search for '%1'", $query['search']);
1749 1746
 		}
1750 1747
 		return $this->total;
1751 1748
 	}
@@ -1759,7 +1756,7 @@  discard block
 block discarded – undo
1759 1756
 	 * @param string &$icon icon-name
1760 1757
 	 * @param string &$label translated label
1761 1758
 	 */
1762
-	function type_icon($owner,$private,$tid,&$icon,&$label)
1759
+	function type_icon($owner, $private, $tid, &$icon, &$label)
1763 1760
 	{
1764 1761
 		if (!$owner)
1765 1762
 		{
@@ -1774,7 +1771,7 @@  discard block
 block discarded – undo
1774 1771
 		elseif ($GLOBALS['egw']->accounts->get_type($owner) == 'g')
1775 1772
 		{
1776 1773
 			$icon = 'group';
1777
-			$label = lang('group %1',$GLOBALS['egw']->accounts->id2name($owner));
1774
+			$label = lang('group %1', $GLOBALS['egw']->accounts->id2name($owner));
1778 1775
 		}
1779 1776
 		else
1780 1777
 		{
@@ -1782,9 +1779,9 @@  discard block
 block discarded – undo
1782 1779
 			$label = $owner == $this->user ? lang('personal') : common::grab_owner_name($owner);
1783 1780
 		}
1784 1781
 		// show tid icon for tid!='n' AND only if one is defined
1785
-		if ($tid != 'n' && common::image('addressbook',$this->content_types[$tid]['name']))
1782
+		if ($tid != 'n' && common::image('addressbook', $this->content_types[$tid]['name']))
1786 1783
 		{
1787
-			$icon = common::image('addressbook',$this->content_types[$tid]['name']);
1784
+			$icon = common::image('addressbook', $this->content_types[$tid]['name']);
1788 1785
 		}
1789 1786
 
1790 1787
 		// Legacy - from when icons could be anywhere
@@ -1802,19 +1799,19 @@  discard block
 block discarded – undo
1802 1799
 	* @param int $_GET['contact_id'] contact_id mainly for popup use
1803 1800
 	* @param bool $_GET['makecp'] true if you want to copy the contact given by $_GET['contact_id']
1804 1801
 	*/
1805
-	function edit($content=null)
1802
+	function edit($content = null)
1806 1803
 	{
1807 1804
 		if (is_array($content))
1808 1805
 		{
1809 1806
 			list($button) = @each($content['button']);
1810 1807
 			unset($content['button']);
1811
-			$content['private'] = (int) ($content['owner'] && substr($content['owner'],-1) == 'p');
1812
-			$content['owner'] = (string) (int) $content['owner'];
1808
+			$content['private'] = (int)($content['owner'] && substr($content['owner'], -1) == 'p');
1809
+			$content['owner'] = (string)(int)$content['owner'];
1813 1810
 			$content['cat_id'] = $this->config['cat_tab'] === 'Tree' ? $content['cat_id_tree'] : $content['cat_id'];
1814 1811
 			if ($this->config['private_cf_tab']) $content = (array)$content['private_cfs'] + $content;
1815 1812
 			unset($content['private_cfs']);
1816 1813
 
1817
-			switch($button)
1814
+			switch ($button)
1818 1815
 			{
1819 1816
 				case 'save':
1820 1817
 				case 'apply':
@@ -1830,7 +1827,7 @@  discard block
 block discarded – undo
1830 1827
 					}
1831 1828
 					if (is_array($content['upload_photo']) && !empty($content['upload_photo']['tmp_name']) &&
1832 1829
 						$content['upload_photo']['tmp_name'] != 'none' &&
1833
-						($f = fopen($content['upload_photo']['tmp_name'],'r')))
1830
+						($f = fopen($content['upload_photo']['tmp_name'], 'r')))
1834 1831
 					{
1835 1832
 						$content['jpegphoto'] = $this->resize_photo($f);
1836 1833
 						fclose($f);
@@ -1847,12 +1844,12 @@  discard block
 block discarded – undo
1847 1844
 						$old_org_entry = $this->read($content['id']);
1848 1845
 						$old_fullname = ($old_org_entry['n_fn'] ? $old_org_entry['n_fn'] : parent::fullname($old_org_entry));
1849 1846
 					}
1850
-					if ( $content['n_fn'] != $fullname ||  $fullname != $old_fullname)
1847
+					if ($content['n_fn'] != $fullname || $fullname != $old_fullname)
1851 1848
 					{
1852 1849
 						unset($content['n_fn']);
1853 1850
 					}
1854 1851
 					// Country codes
1855
-					foreach(array('adr_one', 'adr_two') as $c_prefix)
1852
+					foreach (array('adr_one', 'adr_two') as $c_prefix)
1856 1853
 					{
1857 1854
 						if ($content[$c_prefix.'_countrycode'] == '-custom-')
1858 1855
 						{
@@ -1861,7 +1858,7 @@  discard block
 block discarded – undo
1861 1858
 					}
1862 1859
 					$content['msg'] = '';
1863 1860
 					$this->error = false;
1864
-					foreach((array)$content['pre_save_callbacks'] as $callback)
1861
+					foreach ((array)$content['pre_save_callbacks'] as $callback)
1865 1862
 					{
1866 1863
 						try {
1867 1864
 							if (($success_msg = call_user_func_array($callback, array(&$content))))
@@ -1871,7 +1868,7 @@  discard block
 block discarded – undo
1871 1868
 						}
1872 1869
 						catch (Exception $ex) {
1873 1870
 							$content['msg'] .= ($content['msg'] ? ', ' : '').$ex->getMessage();
1874
-							$button = 'apply';	// do not close dialog
1871
+							$button = 'apply'; // do not close dialog
1875 1872
 							$this->error = true;
1876 1873
 							break;
1877 1874
 						}
@@ -1884,7 +1881,7 @@  discard block
 block discarded – undo
1884 1881
 					{
1885 1882
 						$content['msg'] .= ($content['msg'] ? ', ' : '').lang('Contact saved');
1886 1883
 
1887
-						foreach((array)$content['post_save_callbacks'] as $callback)
1884
+						foreach ((array)$content['post_save_callbacks'] as $callback)
1888 1885
 						{
1889 1886
 							try {
1890 1887
 								if (($success_msg = call_user_func_array($callback, array(&$content))))
@@ -1892,55 +1889,55 @@  discard block
 block discarded – undo
1892 1889
 									$content['msg'] .= ', '.$success_msg;
1893 1890
 								}
1894 1891
 							}
1895
-							catch(egw_exception_redirect $r)
1892
+							catch (egw_exception_redirect $r)
1896 1893
 							{
1897 1894
 								// catch it to continue execution and rethrow it later
1898 1895
 							}
1899 1896
 							catch (Exception $ex) {
1900 1897
 								$content['msg'] .= ', '.$ex->getMessage();
1901
-								$button = 'apply';	// do not close dialog
1898
+								$button = 'apply'; // do not close dialog
1902 1899
 								$this->error = true;
1903 1900
 								break;
1904 1901
 							}
1905 1902
 						}
1906 1903
 
1907
-						if ($content['change_org'] && $old_org_entry && ($changed = $this->changed_fields($old_org_entry,$content,true)) &&
1908
-							($members = $this->org_similar($old_org_entry['org_name'],$changed)))
1904
+						if ($content['change_org'] && $old_org_entry && ($changed = $this->changed_fields($old_org_entry, $content, true)) &&
1905
+							($members = $this->org_similar($old_org_entry['org_name'], $changed)))
1909 1906
 						{
1910 1907
 							//foreach($changed as $name => $old_value) echo "<p>$name: '$old_value' --> '{$content[$name]}'</p>\n";
1911
-							list($changed_members,$changed_fields,$failed_members) = $this->change_org($old_org_entry['org_name'],$changed,$content,$members);
1908
+							list($changed_members, $changed_fields, $failed_members) = $this->change_org($old_org_entry['org_name'], $changed, $content, $members);
1912 1909
 							if ($changed_members)
1913 1910
 							{
1914
-								$content['msg'] .= ', '.lang('%1 fields in %2 other organisation member(s) changed',$changed_fields,$changed_members);
1911
+								$content['msg'] .= ', '.lang('%1 fields in %2 other organisation member(s) changed', $changed_fields, $changed_members);
1915 1912
 							}
1916 1913
 							if ($failed_members)
1917 1914
 							{
1918
-								$content['msg'] .= ', '.lang('failed to change %1 organisation member(s) (insufficent rights) !!!',$failed_members);
1915
+								$content['msg'] .= ', '.lang('failed to change %1 organisation member(s) (insufficent rights) !!!', $failed_members);
1919 1916
 							}
1920 1917
 						}
1921 1918
 					}
1922
-					elseif($this->error === true)
1919
+					elseif ($this->error === true)
1923 1920
 					{
1924 1921
 						$content['msg'] = lang('Error: the entry has been updated since you opened it for editing!').'<br />'.
1925
-							lang('Copy your changes to the clipboard, %1reload the entry%2 and merge them.','<a href="'.
1926
-								htmlspecialchars(egw::link('/index.php',array(
1922
+							lang('Copy your changes to the clipboard, %1reload the entry%2 and merge them.', '<a href="'.
1923
+								htmlspecialchars(egw::link('/index.php', array(
1927 1924
 									'menuaction' => 'addressbook.addressbook_ui.edit',
1928 1925
 									'contact_id' => $content['id'],
1929
-								))).'">','</a>');
1930
-						break;	// dont refresh the list
1926
+								))).'">', '</a>');
1927
+						break; // dont refresh the list
1931 1928
 					}
1932 1929
 					else
1933 1930
 					{
1934 1931
 						$content['msg'] = lang('Error saving the contact !!!').
1935 1932
 							($this->error ? ' '.$this->error : '');
1936
-						$button = 'apply';	// to not leave the dialog
1933
+						$button = 'apply'; // to not leave the dialog
1937 1934
 					}
1938 1935
 					// writing links for new entry, existing ones are handled by the widget itself
1939 1936
 					if ($links && $content['id'])
1940 1937
 					{
1941
-						egw_link::link('addressbook',$content['id'],$links);
1938
+						egw_link::link('addressbook', $content['id'], $links);
1942 1939
 					}
1943
-					egw_framework::refresh_opener($content['msg'], 'addressbook', $content['id'],  $content['id'] ? 'edit' : 'add',
1940
+					egw_framework::refresh_opener($content['msg'], 'addressbook', $content['id'], $content['id'] ? 'edit' : 'add',
1944 1941
 						null, null, null, $this->error ? 'error' : 'success');
1945 1942
 
1946 1943
 					// re-throw redirect exception, if there's no error
@@ -1961,11 +1958,11 @@  discard block
 block discarded – undo
1961 1958
 					break;
1962 1959
 
1963 1960
 				case 'delete':
1964
-					if($this->action('delete',array($content['id']),false,$success,$failed,$action_msg,'',$content['msg']))
1961
+					if ($this->action('delete', array($content['id']), false, $success, $failed, $action_msg, '', $content['msg']))
1965 1962
 					{
1966 1963
 						if ($GLOBALS['egw']->currentapp == 'addressbook')
1967 1964
 						{
1968
-							egw_framework::refresh_opener(lang('Contact deleted'), 'addressbook', $content['id'], 'delete' );
1965
+							egw_framework::refresh_opener(lang('Contact deleted'), 'addressbook', $content['id'], 'delete');
1969 1966
 							egw_framework::window_close();
1970 1967
 						}
1971 1968
 						else
@@ -1990,7 +1987,7 @@  discard block
 block discarded – undo
1990 1987
 			// new contact --> set some defaults
1991 1988
 			if ($contact_id && is_array($content = $this->read($contact_id)))
1992 1989
 			{
1993
-				$contact_id = $content['id'];	// it could have been: "account:$account_id"
1990
+				$contact_id = $content['id']; // it could have been: "account:$account_id"
1994 1991
 				if (!$this->check_perms(EGW_ACL_EDIT, $content))
1995 1992
 				{
1996 1993
 					$view = true;
@@ -1998,7 +1995,7 @@  discard block
 block discarded – undo
1998 1995
 			}
1999 1996
 			else // not found
2000 1997
 			{
2001
-				$state = egw_session::appsession('index','addressbook');
1998
+				$state = egw_session::appsession('index', 'addressbook');
2002 1999
 				// check if we create the new contact in an existing org
2003 2000
 				if (($org = $_GET['org']))
2004 2001
 				{
@@ -2034,52 +2031,52 @@  discard block
 block discarded – undo
2034 2031
 				{
2035 2032
 					$content['owner'] = (string)$state['filter'];
2036 2033
 				}
2037
-				$content['private'] = (int) ($content['owner'] && substr($content['owner'],-1) == 'p');
2038
-				if ($content['owner'] === '' || !($this->grants[$content['owner'] = (string) (int) $content['owner']] & EGW_ACL_ADD))
2034
+				$content['private'] = (int)($content['owner'] && substr($content['owner'], -1) == 'p');
2035
+				if ($content['owner'] === '' || !($this->grants[$content['owner'] = (string)(int)$content['owner']]&EGW_ACL_ADD))
2039 2036
 				{
2040 2037
 					$content['owner'] = $this->default_addressbook;
2041 2038
 					$content['private'] = (int)$this->default_private;
2042 2039
 
2043
-					if (!($this->grants[$content['owner'] = (string) (int) $content['owner']] & EGW_ACL_ADD))
2040
+					if (!($this->grants[$content['owner'] = (string)(int)$content['owner']]&EGW_ACL_ADD))
2044 2041
 					{
2045
-						$content['owner'] = (string) $this->user;
2042
+						$content['owner'] = (string)$this->user;
2046 2043
 						$content['private'] = 0;
2047 2044
 					}
2048 2045
 				}
2049 2046
 				$new_type = array_keys($this->content_types);
2050 2047
 				// fetch active type to preset the type, if param typeid is not passed
2051
-				$active_tid = egw_cache::getSession('addressbook','active_tid');
2048
+				$active_tid = egw_cache::getSession('addressbook', 'active_tid');
2052 2049
 				if ($active_tid && strtoupper($active_tid) === 'D') unset($active_tid);
2053
-				$content['tid'] = $_GET['typeid'] ? $_GET['typeid'] : ($active_tid?$active_tid:$new_type[0]);
2054
-				foreach($this->get_contact_columns() as $field)
2050
+				$content['tid'] = $_GET['typeid'] ? $_GET['typeid'] : ($active_tid ? $active_tid : $new_type[0]);
2051
+				foreach ($this->get_contact_columns() as $field)
2055 2052
 				{
2056 2053
 					if ($_GET['presets'][$field])
2057 2054
 					{
2058
-						if ($field=='email'||$field=='email_home')
2055
+						if ($field == 'email' || $field == 'email_home')
2059 2056
 						{
2060
-							$singleAddress = imap_rfc822_parse_adrlist($_GET['presets'][$field],'');
2057
+							$singleAddress = imap_rfc822_parse_adrlist($_GET['presets'][$field], '');
2061 2058
 							//error_log(__METHOD__.__LINE__.' Address:'.$singleAddress[0]->mailbox."@".$singleAddress[0]->host.", ".$singleAddress[0]->personal);
2062
-							if (!(!is_array($singleAddress) || count($singleAddress)<1))
2059
+							if (!(!is_array($singleAddress) || count($singleAddress) < 1))
2063 2060
 							{
2064 2061
 								$content[$field] = $singleAddress[0]->mailbox."@".$singleAddress[0]->host;
2065 2062
 								if (!empty($singleAddress[0]->personal))
2066 2063
 								{
2067
-									if (strpos($singleAddress[0]->personal,',')===false)
2064
+									if (strpos($singleAddress[0]->personal, ',') === false)
2068 2065
 									{
2069
-										list($P_n_given,$P_n_family,$P_org_name)=explode(' ',$singleAddress[0]->personal,3);
2070
-										if (strlen(trim($P_n_given))>0) $content['n_given'] = trim($P_n_given);
2071
-										if (strlen(trim($P_n_family))>0) $content['n_family'] = trim($P_n_family);
2072
-										if (strlen(trim($P_org_name))>0) $content['org_name'] = trim($P_org_name);
2066
+										list($P_n_given, $P_n_family, $P_org_name) = explode(' ', $singleAddress[0]->personal, 3);
2067
+										if (strlen(trim($P_n_given)) > 0) $content['n_given'] = trim($P_n_given);
2068
+										if (strlen(trim($P_n_family)) > 0) $content['n_family'] = trim($P_n_family);
2069
+										if (strlen(trim($P_org_name)) > 0) $content['org_name'] = trim($P_org_name);
2073 2070
 									}
2074 2071
 									else
2075 2072
 									{
2076
-										list($P_n_family,$P_other)=explode(',',$singleAddress[0]->personal,2);
2077
-										if (strlen(trim($P_n_family))>0) $content['n_family'] = trim($P_n_family);
2078
-										if (strlen(trim($P_other))>0)
2073
+										list($P_n_family, $P_other) = explode(',', $singleAddress[0]->personal, 2);
2074
+										if (strlen(trim($P_n_family)) > 0) $content['n_family'] = trim($P_n_family);
2075
+										if (strlen(trim($P_other)) > 0)
2079 2076
 										{
2080
-											list($P_n_given,$P_org_name)=explode(',',$P_other,2);
2081
-											if (strlen(trim($P_n_given))>0) $content['n_given'] = trim($P_n_given);
2082
-											if (strlen(trim($P_org_name))>0) $content['org_name'] = trim($P_org_name);
2077
+											list($P_n_given, $P_org_name) = explode(',', $P_other, 2);
2078
+											if (strlen(trim($P_n_given)) > 0) $content['n_given'] = trim($P_n_given);
2079
+											if (strlen(trim($P_org_name)) > 0) $content['org_name'] = trim($P_org_name);
2083 2080
 										}
2084 2081
 									}
2085 2082
 								}
@@ -2097,13 +2094,13 @@  discard block
 block discarded – undo
2097 2094
 				}
2098 2095
 				if (isset($_GET['presets']))
2099 2096
 				{
2100
-					foreach(array('email','email_home','n_family','n_given','org_name') as $field)
2097
+					foreach (array('email', 'email_home', 'n_family', 'n_given', 'org_name') as $field)
2101 2098
 					{
2102 2099
 						if (!empty($content[$field]))
2103 2100
 						{
2104 2101
 							//Set the presets fields in content in order to be able to use them later in client side for checking duplication only on first time load
2105 2102
 							// after save/apply we unset them
2106
-							$content['presets_fields'][]= $field;
2103
+							$content['presets_fields'][] = $field;
2107 2104
 							break;
2108 2105
 						}
2109 2106
 					}
@@ -2115,9 +2112,9 @@  discard block
 block discarded – undo
2115 2112
 				//_debug_array($content);
2116 2113
 			}
2117 2114
 
2118
-			if ($_GET['msg']) $content['msg'] = strip_tags($_GET['msg']);	// dont allow HTML!
2115
+			if ($_GET['msg']) $content['msg'] = strip_tags($_GET['msg']); // dont allow HTML!
2119 2116
 
2120
-			if($content && $_GET['makecp'])	// copy the contact
2117
+			if ($content && $_GET['makecp'])	// copy the contact
2121 2118
 			{
2122 2119
 				$this->copy_contact($content);
2123 2120
 				$content['msg'] = lang('Contact copied');
@@ -2131,12 +2128,12 @@  discard block
 block discarded – undo
2131 2128
 			if (!$contact_id && isset($_REQUEST['link_app']) && isset($_REQUEST['link_id']) && !is_array($content['link_to']['to_id']))
2132 2129
 			{
2133 2130
 				$link_ids = is_array($_REQUEST['link_id']) ? $_REQUEST['link_id'] : array($_REQUEST['link_id']);
2134
-				foreach(is_array($_REQUEST['link_app']) ? $_REQUEST['link_app'] : array($_REQUEST['link_app']) as $n => $link_app)
2131
+				foreach (is_array($_REQUEST['link_app']) ? $_REQUEST['link_app'] : array($_REQUEST['link_app']) as $n => $link_app)
2135 2132
 				{
2136 2133
 					$link_id = $link_ids[$n];
2137
-					if (preg_match('/^[a-z_0-9-]+:[:a-z_0-9-]+$/i',$link_app.':'.$link_id))	// gard against XSS
2134
+					if (preg_match('/^[a-z_0-9-]+:[:a-z_0-9-]+$/i', $link_app.':'.$link_id))	// gard against XSS
2138 2135
 					{
2139
-						egw_link::link('addressbook',$content['link_to']['to_id'],$link_app,$link_id);
2136
+						egw_link::link('addressbook', $content['link_to']['to_id'], $link_app, $link_id);
2140 2137
 					}
2141 2138
 				}
2142 2139
 			}
@@ -2144,8 +2141,8 @@  discard block
 block discarded – undo
2144 2141
 		if ($content['id'])
2145 2142
 		{
2146 2143
 			// last and next calendar date
2147
-			list(,$dates) = each($this->read_calendar(array($content['id']),false));
2148
-			if(is_array($dates)) $content += $dates;
2144
+			list(,$dates) = each($this->read_calendar(array($content['id']), false));
2145
+			if (is_array($dates)) $content += $dates;
2149 2146
 		}
2150 2147
 		// Avoid ID conflict with tree & selectboxes
2151 2148
 		$content['cat_id_tree'] = $content['cat_id'];
@@ -2154,7 +2151,7 @@  discard block
 block discarded – undo
2154 2151
 		if ($this->config['private_cf_tab'])
2155 2152
 		{
2156 2153
 			$content['private_cfs'] = array();
2157
-			foreach(config::get_customfields('addressbook', true) as $name => $cf)
2154
+			foreach (config::get_customfields('addressbook', true) as $name => $cf)
2158 2155
 			{
2159 2156
 				if ($cf['private'] && isset($content['#'.$name]))
2160 2157
 				{
@@ -2167,7 +2164,7 @@  discard block
 block discarded – undo
2167 2164
 		$content['addr_format2'] = $this->addr_format_by_country($content['adr_two_countryname']);
2168 2165
 
2169 2166
 		//_debug_array($content);
2170
-		$readonlys['button[delete]'] = !$content['owner'] || !$this->check_perms(EGW_ACL_DELETE,$content);
2167
+		$readonlys['button[delete]'] = !$content['owner'] || !$this->check_perms(EGW_ACL_DELETE, $content);
2171 2168
 		$readonlys['button[copy]'] = $readonlys['button[edit]'] = $readonlys['button[vcard]'] = true;
2172 2169
 		$readonlys['button[save]'] = $readonlys['button[apply]'] = $view;
2173 2170
 		if ($view)
@@ -2179,19 +2176,18 @@  discard block
 block discarded – undo
2179 2176
 		$sel_options['fileas_type'] = $this->fileas_options($content);
2180 2177
 		$sel_options['adr_one_countrycode']['-custom-'] = lang('Custom');
2181 2178
 		$sel_options['owner'] = $this->get_addressbooks(EGW_ACL_ADD);
2182
-		if ($content['owner']) unset($sel_options['owner'][0]);	// do not offer to switch to accounts, as we do not support moving contacts to accounts
2183
-		if ((string) $content['owner'] !== '')
2179
+		if ($content['owner']) unset($sel_options['owner'][0]); // do not offer to switch to accounts, as we do not support moving contacts to accounts
2180
+		if ((string)$content['owner'] !== '')
2184 2181
 		{
2185 2182
 			if (!isset($sel_options['owner'][(int)$content['owner']]))
2186 2183
 			{
2187
-				$sel_options['owner'][(int)$content['owner']] = !$content['owner'] ? lang('Accounts') :
2188
-					common::grab_owner_name($content['owner']);
2184
+				$sel_options['owner'][(int)$content['owner']] = !$content['owner'] ? lang('Accounts') : common::grab_owner_name($content['owner']);
2189 2185
 			}
2190
-			$readonlys['owner'] = !$content['owner'] || 		// dont allow to move accounts, as this mean deleting the user incl. all content he owns
2191
-				$content['id'] && !$this->check_perms(EGW_ACL_DELETE,$content);	// you need delete rights to move an existing contact into an other addressbook
2186
+			$readonlys['owner'] = !$content['owner'] || // dont allow to move accounts, as this mean deleting the user incl. all content he owns
2187
+				$content['id'] && !$this->check_perms(EGW_ACL_DELETE, $content); // you need delete rights to move an existing contact into an other addressbook
2192 2188
 		}
2193 2189
 		// set the unsupported fields from the backend to readonly
2194
-		foreach($this->get_fields('unsupported',$content['id'],$content['owner']) as $field)
2190
+		foreach ($this->get_fields('unsupported', $content['id'], $content['owner']) as $field)
2195 2191
 		{
2196 2192
 			$readonlys[$field] = true;
2197 2193
 		}
@@ -2201,7 +2197,7 @@  discard block
 block discarded – undo
2201 2197
 			$readonlys['__ALL__'] = true;
2202 2198
 			$readonlys['button[cancel]'] = false;
2203 2199
 
2204
-			foreach($this->own_account_acl as $field)
2200
+			foreach ($this->own_account_acl as $field)
2205 2201
 			{
2206 2202
 				$readonlys[$field] = false;
2207 2203
 			}
@@ -2209,9 +2205,9 @@  discard block
 block discarded – undo
2209 2205
 		if (isset($readonlys['n_fileas'])) $readonlys['fileas_type'] = $readonlys['n_fileas'];
2210 2206
 		// disable not needed tabs
2211 2207
 		$readonlys['tabs']['cats'] = !($content['cat_tab'] = $this->config['cat_tab']);
2212
-		$readonlys['tabs']['custom'] = !$this->customfields || $this->get_backend($content['id'],$content['owner']) == $this->so_accounts;
2208
+		$readonlys['tabs']['custom'] = !$this->customfields || $this->get_backend($content['id'], $content['owner']) == $this->so_accounts;
2213 2209
 		$readonlys['tabs']['custom_private'] = $readonlys['tabs']['custom'] || !$this->config['private_cf_tab'];
2214
-		$readonlys['tabs']['distribution_list'] = !$content['distrib_lists'];#false;
2210
+		$readonlys['tabs']['distribution_list'] = !$content['distrib_lists']; #false;
2215 2211
 		$readonlys['tabs']['history'] = $this->contact_repository != 'sql' || !$content['id'] ||
2216 2212
 			$this->account_repository != 'sql' && $content['account_id'];
2217 2213
 		if (!$content['id']) $readonlys['button[delete]'] = !$content['id'];
@@ -2221,18 +2217,18 @@  discard block
 block discarded – undo
2221 2217
 		// for editing the own account (by a non-admin), enable only the fields allowed via the "own_account_acl"
2222 2218
 		if (!$content['owner'] && !$this->check_perms(EGW_ACL_EDIT, $content))
2223 2219
 		{
2224
-			$this->_set_readonlys_for_own_account_acl($readonlys,$id);
2220
+			$this->_set_readonlys_for_own_account_acl($readonlys, $id);
2225 2221
 		}
2226
-		for($i = -23; $i<=23; $i++) $tz[$i] = ($i > 0 ? '+' : '').$i;
2222
+		for ($i = -23; $i <= 23; $i++) $tz[$i] = ($i > 0 ? '+' : '').$i;
2227 2223
 		$sel_options['tz'] = $tz;
2228 2224
 		$content['tz'] = $content['tz'] ? $content['tz'] : '0';
2229 2225
 		if (count($this->content_types) > 1)
2230 2226
 		{
2231
-			foreach($this->content_types as $type => $data)
2227
+			foreach ($this->content_types as $type => $data)
2232 2228
 			{
2233 2229
 				$sel_options['tid'][$type] = $data['name'];
2234 2230
 			}
2235
-			$content['typegfx'] = html::image('addressbook',$this->content_types[$content['tid']]['options']['icon'],'',' width="16px" height="16px"');
2231
+			$content['typegfx'] = html::image('addressbook', $this->content_types[$content['tid']]['options']['icon'], '', ' width="16px" height="16px"');
2236 2232
 		}
2237 2233
 		else
2238 2234
 		{
@@ -2246,10 +2242,10 @@  discard block
 block discarded – undo
2246 2242
 		);
2247 2243
 
2248 2244
 		// Links for deleted entries
2249
-		if($content['tid'] == addressbook_so::DELETED_TYPE)
2245
+		if ($content['tid'] == addressbook_so::DELETED_TYPE)
2250 2246
 		{
2251 2247
 			$content['link_to']['show_deleted'] = true;
2252
-			if(!$GLOBALS['egw_info']['user']['apps']['admin'] && $this->config['history'] != 'userpurge')
2248
+			if (!$GLOBALS['egw_info']['user']['apps']['admin'] && $this->config['history'] != 'userpurge')
2253 2249
 			{
2254 2250
 				$readonlys['button[delete]'] = true;
2255 2251
 			}
@@ -2258,33 +2254,33 @@  discard block
 block discarded – undo
2258 2254
 		// Enable history
2259 2255
 		$this->setup_history($content, $sel_options);
2260 2256
 
2261
-		$content['photo'] = $this->photo_src($content['id'],$content['jpegphoto'],'photo',$content['etag']);
2257
+		$content['photo'] = $this->photo_src($content['id'], $content['jpegphoto'], 'photo', $content['etag']);
2262 2258
 
2263 2259
 		if ($content['private']) $content['owner'] .= 'p';
2264 2260
 
2265 2261
 		// for custom types, check if we have a custom edit template named "addressbook.edit.$type", $type is the name
2266
-		if (in_array($content['tid'], array('n',self::DELETED_TYPE)) || !$this->tmpl->read('addressbook.edit.'.$this->content_types[$content['tid']]['name']))
2262
+		if (in_array($content['tid'], array('n', self::DELETED_TYPE)) || !$this->tmpl->read('addressbook.edit.'.$this->content_types[$content['tid']]['name']))
2267 2263
 		{
2268 2264
 			$this->tmpl->read('addressbook.edit');
2269 2265
 		}
2270 2266
 
2271 2267
 		// allow other apps to add tabs to addressbook edit
2272 2268
 		$preserve = $content;
2273
-		$content['jpegphoto'] = !empty($content['jpegphoto']);	// unused and messes up json encoding (not utf-8)
2269
+		$content['jpegphoto'] = !empty($content['jpegphoto']); // unused and messes up json encoding (not utf-8)
2274 2270
 		$this->tmpl->setElementAttribute('tabs', 'add_tabs', true);
2275
-		$tabs =& $this->tmpl->getElementAttribute('tabs', 'tabs');
2271
+		$tabs = & $this->tmpl->getElementAttribute('tabs', 'tabs');
2276 2272
 		if (($first_call = !isset($tabs)))
2277 2273
 		{
2278 2274
 			$tabs = array();
2279 2275
 		}
2280 2276
 		//error_log(__LINE__.': '.__METHOD__."() first_call=$first_call");
2281
-		$hook_data = $GLOBALS['egw']->hooks->process(array('location' => 'addressbook_edit')+$content);
2277
+		$hook_data = $GLOBALS['egw']->hooks->process(array('location' => 'addressbook_edit') + $content);
2282 2278
 		//error_log(__METHOD__."() hook_data=".array2string($hook_data));
2283
-		foreach($hook_data as $extra_tabs)
2279
+		foreach ($hook_data as $extra_tabs)
2284 2280
 		{
2285 2281
 			if (!$extra_tabs) continue;
2286 2282
 
2287
-			foreach(isset($extra_tabs[0]) ? $extra_tabs : array($extra_tabs) as $extra_tab)
2283
+			foreach (isset($extra_tabs[0]) ? $extra_tabs : array($extra_tabs) as $extra_tab)
2288 2284
 			{
2289 2285
 				if ($extra_tab['data'] && is_array($extra_tab['data']))
2290 2286
 				{
@@ -2329,15 +2325,15 @@  discard block
 block discarded – undo
2329 2325
 	 * @param array &$readonlys
2330 2326
 	 * @param int $id
2331 2327
 	 */
2332
-	function _set_readonlys_for_own_account_acl(&$readonlys,$id)
2328
+	function _set_readonlys_for_own_account_acl(&$readonlys, $id)
2333 2329
 	{
2334 2330
 		// regular fields depending on the backend
2335
-		foreach($this->get_fields('supported',$id,0) as $field)
2331
+		foreach ($this->get_fields('supported', $id, 0) as $field)
2336 2332
 		{
2337
-			if (!$this->own_account_acl || !in_array($field,$this->own_account_acl))
2333
+			if (!$this->own_account_acl || !in_array($field, $this->own_account_acl))
2338 2334
 			{
2339 2335
 				$readonlys[$field] = true;
2340
-				switch($field)
2336
+				switch ($field)
2341 2337
 				{
2342 2338
 					case 'tel_work':
2343 2339
 					case 'tel_cell':
@@ -2353,16 +2349,16 @@  discard block
 block discarded – undo
2353 2349
 		// custom fields
2354 2350
 		if ($this->customfields)
2355 2351
 		{
2356
-			foreach($this->customfields as $name => $data)
2352
+			foreach ($this->customfields as $name => $data)
2357 2353
 			{
2358
-				if (!$this->own_account_acl || !in_array('#'.$name,$this->own_account_acl))
2354
+				if (!$this->own_account_acl || !in_array('#'.$name, $this->own_account_acl))
2359 2355
 				{
2360 2356
 					$readonlys['#'.$name] = true;
2361 2357
 				}
2362 2358
 			}
2363 2359
 		}
2364 2360
 		// links
2365
-		if (!$this->own_account_acl || !in_array('link_to',$this->own_account_acl))
2361
+		if (!$this->own_account_acl || !in_array('link_to', $this->own_account_acl))
2366 2362
 		{
2367 2363
 			$readonlys['link_to'] = true;
2368 2364
 		}
@@ -2380,9 +2376,9 @@  discard block
 block discarded – undo
2380 2376
 	 * 	'data' => array of id => "full name (addressbook)" pairs
2381 2377
 	 *  'fileas_options'
2382 2378
 	 */
2383
-	public function ajax_check_values($values, $name, $own_id=0)
2379
+	public function ajax_check_values($values, $name, $own_id = 0)
2384 2380
 	{
2385
-		if (preg_match('/^exec\[([^\]]+)\]$/', $name, $matches)) $name = $matches[1];	// remove exec[ ]
2381
+		if (preg_match('/^exec\[([^\]]+)\]$/', $name, $matches)) $name = $matches[1]; // remove exec[ ]
2386 2382
 
2387 2383
 		$ret = array('doublicates' => array(), 'msg' => null);
2388 2384
 
@@ -2394,7 +2390,7 @@  discard block
 block discarded – undo
2394 2390
 				$contacts = parent::search(array(
2395 2391
 					'email' => $values[$name],
2396 2392
 					'email_home' => $values[$name],
2397
-				),$only_keys=false, $order_by='', $extra_cols='', $wildcard='', $empty=False, $op='OR');
2393
+				), $only_keys = false, $order_by = '', $extra_cols = '', $wildcard = '', $empty = False, $op = 'OR');
2398 2394
 			}
2399 2395
 		}
2400 2396
 		else
@@ -2406,20 +2402,20 @@  discard block
 block discarded – undo
2406 2402
 
2407 2403
 			// if name, firstname or org changed and at least 2 are specified, check for doublicates
2408 2404
 			if (in_array($name, array('n_given', 'n_family', 'org_name')) &&
2409
-				!empty($values['n_given'])+!empty($values['n_family'])+!empty($values['org_name']) >= 2)
2405
+				!empty($values['n_given']) + !empty($values['n_family']) + !empty($values['org_name']) >= 2)
2410 2406
 			{
2411 2407
 				$filter = array();
2412
-				foreach(array('email', 'n_given', 'n_family', 'org_name') as $n)	// use email too, to exclude obvious false positives
2408
+				foreach (array('email', 'n_given', 'n_family', 'org_name') as $n)	// use email too, to exclude obvious false positives
2413 2409
 				{
2414 2410
 					if (!empty($values[$n])) $filter[$n] = $values[$n];
2415 2411
 				}
2416
-				$contacts = parent::search($criteria='', $only_keys=false, $order_by='', $extra_cols='', $wildcard='',
2417
-					$empty=False, $op='AND', $start=false, $filter);
2412
+				$contacts = parent::search($criteria = '', $only_keys = false, $order_by = '', $extra_cols = '', $wildcard = '',
2413
+					$empty = False, $op = 'AND', $start = false, $filter);
2418 2414
 			}
2419 2415
 		}
2420 2416
 		if ($contacts)
2421 2417
 		{
2422
-			foreach($contacts as $contact)
2418
+			foreach ($contacts as $contact)
2423 2419
 			{
2424 2420
 				if ($own_id && $contact['id'] == $own_id) continue;
2425 2421
 
@@ -2443,26 +2439,24 @@  discard block
 block discarded – undo
2443 2439
 	 *
2444 2440
 	 * @param array $content
2445 2441
 	 */
2446
-	function view(array $content=null)
2442
+	function view(array $content = null)
2447 2443
 	{
2448 2444
 		// CRM list comes from content, request, or preference
2449
-		$crm_list = $content['crm_list'] ? $content['crm_list'] :
2450
-			($_GET['crm_list'] ? $_GET['crm_list'] : $GLOBALS['egw_info']['user']['preferences']['addressbook']['crm_list']);
2451
-		if(!$crm_list || $crm_list == '~edit~') $crm_list = 'infolog';
2445
+		$crm_list = $content['crm_list'] ? $content['crm_list'] : ($_GET['crm_list'] ? $_GET['crm_list'] : $GLOBALS['egw_info']['user']['preferences']['addressbook']['crm_list']);
2446
+		if (!$crm_list || $crm_list == '~edit~') $crm_list = 'infolog';
2452 2447
 
2453
-		if(is_array($content))
2448
+		if (is_array($content))
2454 2449
 		{
2455 2450
 			list($button) = each($content['button']);
2456 2451
 			switch ($content['toolbar'] ? $content['toolbar'] : $button)
2457 2452
 			{
2458
-				case 'vcard':
2459
-					egw::redirect_link('/index.php','menuaction=addressbook.uivcard.out&ab_id=' .$content['id']);
2453
+				case 'vcard' : egw::redirect_link('/index.php', 'menuaction=addressbook.uivcard.out&ab_id='.$content['id']);
2460 2454
 
2461 2455
 				case 'cancel':
2462
-					egw::redirect_link('/index.php','menuaction=addressbook.addressbook_ui.index&ajax=true');
2456
+					egw::redirect_link('/index.php', 'menuaction=addressbook.addressbook_ui.index&ajax=true');
2463 2457
 
2464 2458
 				case 'delete':
2465
-					egw::redirect_link('/index.php',array(
2459
+					egw::redirect_link('/index.php', array(
2466 2460
 						'menuaction' => 'addressbook.addressbook_ui.index',
2467 2461
 						'msg' => $this->delete($content) ? lang('Contact deleted') : lang('Error deleting the contact !!!'),
2468 2462
 					));
@@ -2480,9 +2474,9 @@  discard block
 block discarded – undo
2480 2474
 					$num_rows = $this->get_rows($query, $rows, $readonlys, true);
2481 2475
 					//error_log(__METHOD__."() get_rows()=$num_rows rows=".array2string($rows));
2482 2476
 					$contact_id = $rows[0];
2483
-					if(!$contact_id || !is_array($content = $this->read($contact_id)))
2477
+					if (!$contact_id || !is_array($content = $this->read($contact_id)))
2484 2478
 					{
2485
-						egw::redirect_link('/index.php',array(
2479
+						egw::redirect_link('/index.php', array(
2486 2480
 							'menuaction' => 'addressbook.addressbook_ui.index',
2487 2481
 							'msg' => $content,
2488 2482
 							'ajax' => 'true'
@@ -2491,14 +2485,14 @@  discard block
 block discarded – undo
2491 2485
 					$content['index'] = $query['start'];
2492 2486
 
2493 2487
 					// List nextmatch is already there, just update the filter
2494
-					if($contact_id && egw_json_request::isJSONRequest())
2488
+					if ($contact_id && egw_json_request::isJSONRequest())
2495 2489
 					{
2496
-						switch($crm_list)
2490
+						switch ($crm_list)
2497 2491
 						{
2498 2492
 							case 'infolog':
2499 2493
 							case 'tracker':
2500 2494
 							default:
2501
-								egw_json_response::get()->apply('app.addressbook.view_set_list',Array(Array('action'=>'addressbook', 'action_id' => $contact_id)));
2495
+								egw_json_response::get()->apply('app.addressbook.view_set_list', Array(Array('action'=>'addressbook', 'action_id' => $contact_id)));
2502 2496
 								break;
2503 2497
 						}
2504 2498
 
@@ -2529,13 +2523,13 @@  discard block
 block discarded – undo
2529 2523
 				$_GET['index'] = 0;
2530 2524
 			}
2531 2525
 			$contact_id = $_GET['contact_id'] ? $_GET['contact_id'] : ((int)$_GET['account_id'] ? 'account:'.(int)$_GET['account_id'] : 0);
2532
-			if(!$contact_id || !is_array($content = $this->read($contact_id)))
2526
+			if (!$contact_id || !is_array($content = $this->read($contact_id)))
2533 2527
 			{
2534
-				egw::redirect_link('/index.php',array(
2528
+				egw::redirect_link('/index.php', array(
2535 2529
 					'menuaction' => 'addressbook.addressbook_ui.index',
2536 2530
 					'msg' => $content,
2537 2531
 					'ajax' => 'true'
2538
-				)+(isset($_GET['search']) ? array('search' => $_GET['search']) : array()));
2532
+				) + (isset($_GET['search']) ? array('search' => $_GET['search']) : array()));
2539 2533
 			}
2540 2534
 			if (isset($_GET['index']))
2541 2535
 			{
@@ -2548,25 +2542,25 @@  discard block
 block discarded – undo
2548 2542
 				$num_rows = $this->get_rows($query, $rows, $readonlys, true);
2549 2543
 			}
2550 2544
 		}
2551
-		$content['jpegphoto'] = !empty($content['jpegphoto']);	// unused and messes up json encoding (not utf-8)
2545
+		$content['jpegphoto'] = !empty($content['jpegphoto']); // unused and messes up json encoding (not utf-8)
2552 2546
 
2553 2547
 		// make everything not explicit mentioned readonly
2554 2548
 		$readonlys['__ALL__'] = true;
2555 2549
 		$readonlys['photo'] = $readonlys['button[cancel]'] = $readonlys['button[copy]'] =
2556 2550
 			$readonlys['button[ok]'] = $readonlys['button[more]'] = $readonlys['toolbar'] = false;
2557 2551
 
2558
-		foreach(array_keys($this->contact_fields) as $key)
2552
+		foreach (array_keys($this->contact_fields) as $key)
2559 2553
 		{
2560
-			if (in_array($key,array('tel_home','tel_work','tel_cell','tel_fax')))
2554
+			if (in_array($key, array('tel_home', 'tel_work', 'tel_cell', 'tel_fax')))
2561 2555
 			{
2562 2556
 				$content[$key.'2'] = $content[$key];
2563 2557
 			}
2564 2558
 		}
2565 2559
 
2566 2560
 		// respect category permissions
2567
-		if(!empty($content['cat_id']))
2561
+		if (!empty($content['cat_id']))
2568 2562
 		{
2569
-			$content['cat_id'] = $this->categories->check_list(EGW_ACL_READ,$content['cat_id']);
2563
+			$content['cat_id'] = $this->categories->check_list(EGW_ACL_READ, $content['cat_id']);
2570 2564
 		}
2571 2565
 		$content['cat_id_tree'] = $content['cat_id'];
2572 2566
 
@@ -2576,12 +2570,12 @@  discard block
 block discarded – undo
2576 2570
 			'to_id'  => $content['id'],
2577 2571
 		);
2578 2572
 		// Links for deleted entries
2579
-		if($content['tid'] == addressbook_so::DELETED_TYPE)
2573
+		if ($content['tid'] == addressbook_so::DELETED_TYPE)
2580 2574
 		{
2581 2575
 			$content['link_to']['show_deleted'] = true;
2582 2576
 		}
2583
-		$readonlys['button[delete]'] = !$content['owner'] || !$this->check_perms(EGW_ACL_DELETE,$content);
2584
-		$readonlys['button[edit]'] = !$this->check_perms(EGW_ACL_EDIT,$content);
2577
+		$readonlys['button[delete]'] = !$content['owner'] || !$this->check_perms(EGW_ACL_DELETE, $content);
2578
+		$readonlys['button[edit]'] = !$this->check_perms(EGW_ACL_EDIT, $content);
2585 2579
 
2586 2580
 		// how to display addresses
2587 2581
 		$content['addr_format']  = $this->addr_format_by_country($content['adr_one_countryname']);
@@ -2589,16 +2583,16 @@  discard block
 block discarded – undo
2589 2583
 
2590 2584
 		$sel_options['fileas_type'][$content['fileas_type']] = $this->fileas($content);
2591 2585
 		$sel_options['owner'] = $this->get_addressbooks();
2592
-		for($i = -23; $i<=23; $i++) $tz[$i] = ($i > 0 ? '+' : '').$i;
2586
+		for ($i = -23; $i <= 23; $i++) $tz[$i] = ($i > 0 ? '+' : '').$i;
2593 2587
 		$sel_options['tz'] = $tz;
2594 2588
 		$content['tz'] = $content['tz'] ? $content['tz'] : 0;
2595 2589
 		if (count($this->content_types) > 1)
2596 2590
 		{
2597
-			foreach($this->content_types as $type => $data)
2591
+			foreach ($this->content_types as $type => $data)
2598 2592
 			{
2599 2593
 				$sel_options['tid'][$type] = $data['name'];
2600 2594
 			}
2601
-			$content['typegfx'] = html::image('addressbook',$this->content_types[$content['tid']]['options']['icon'],'',' width="16px" height="16px"');
2595
+			$content['typegfx'] = html::image('addressbook', $this->content_types[$content['tid']]['options']['icon'], '', ' width="16px" height="16px"');
2602 2596
 		}
2603 2597
 		else
2604 2598
 		{
@@ -2615,7 +2609,7 @@  discard block
 block discarded – undo
2615 2609
 		{
2616 2610
 			$content['owner'] .= 'p';
2617 2611
 		}
2618
-		$this->tmpl->set_cell_attribute('change_org','disabled',true);
2612
+		$this->tmpl->set_cell_attribute('change_org', 'disabled', true);
2619 2613
 
2620 2614
 		// Prevent double countries - invalid code blanks it, disabling doesn't work
2621 2615
 		$content['adr_one_countrycode'] = '-';
@@ -2628,14 +2622,14 @@  discard block
 block discarded – undo
2628 2622
 		$readonlys['tabs']['cats'] = !($content['cat_tab'] = $this->config['cat_tab']);
2629 2623
 		$readonlys['tabs']['custom'] = !$this->customfields;
2630 2624
 		$readonlys['tabs']['custom_private'] = !$this->customfields || !$this->config['private_cf_tab'];
2631
-		$readonlys['tabs']['distribution_list'] = !$content['distrib_lists'];#false;
2625
+		$readonlys['tabs']['distribution_list'] = !$content['distrib_lists']; #false;
2632 2626
 		$readonlys['tabs']['history'] = $this->contact_repository != 'sql' || !$content['id'] ||
2633 2627
 			$this->account_repository != 'sql' && $content['account_id'];
2634 2628
 		if ($this->config['private_cf_tab']) $content['no_private_cfs'] = 0;
2635 2629
 
2636 2630
 		// last and next calendar date
2637
-		if (!empty($content['id'])) list(,$dates) = each($this->read_calendar(array($content['id']),false));
2638
-		if(is_array($dates)) $content += $dates;
2631
+		if (!empty($content['id'])) list(,$dates) = each($this->read_calendar(array($content['id']), false));
2632
+		if (is_array($dates)) $content += $dates;
2639 2633
 
2640 2634
 		// Disable importexport
2641 2635
 		$GLOBALS['egw_info']['flags']['disable_importexport']['export'] = true;
@@ -2677,7 +2671,7 @@  discard block
 block discarded – undo
2677 2671
 		{
2678 2672
 			unset($actions['back']);
2679 2673
 		}
2680
-		if (!isset($content['index']) || $content['index'] >= $num_rows-1)
2674
+		if (!isset($content['index']) || $content['index'] >= $num_rows - 1)
2681 2675
 		{
2682 2676
 			unset($actions['next']);
2683 2677
 		}
@@ -2689,7 +2683,7 @@  discard block
 block discarded – undo
2689 2683
 		// need to load list's app.js now, as exec calls header before other app can include it
2690 2684
 		egw_framework::validate_file('/'.$crm_list.'/js/app.js');
2691 2685
 
2692
-		$this->tmpl->exec('addressbook.addressbook_ui.view',$content,$sel_options,$readonlys,array(
2686
+		$this->tmpl->exec('addressbook.addressbook_ui.view', $content, $sel_options, $readonlys, array(
2693 2687
 			'id' => $content['id'],
2694 2688
 			'index' => $content['index'],
2695 2689
 			'crm_list' => $crm_list
@@ -2697,12 +2691,12 @@  discard block
 block discarded – undo
2697 2691
 
2698 2692
 		// Only load this on first time - we're using AJAX, so it stays there through submits.
2699 2693
 		// Sending it again (via ajax) will break the addressbook.view etemplate2
2700
-		if($contact_id)
2694
+		if ($contact_id)
2701 2695
 		{
2702 2696
 			$GLOBALS['egw']->hooks->single(array(
2703 2697
 				'location' => 'addressbook_view',
2704 2698
 				'ab_id'    => $content['id']
2705
-			),$crm_list);
2699
+			), $crm_list);
2706 2700
 		}
2707 2701
 	}
2708 2702
 
@@ -2714,30 +2708,30 @@  discard block
 block discarded – undo
2714 2708
 	 */
2715 2709
 	function email2link($email)
2716 2710
 	{
2717
-		if (strpos($email,'@') == false) return '';
2711
+		if (strpos($email, '@') == false) return '';
2718 2712
 
2719
-		if($GLOBALS['egw_info']['user']['apps']['mail'])
2713
+		if ($GLOBALS['egw_info']['user']['apps']['mail'])
2720 2714
 		{
2721 2715
 			return array(
2722 2716
 				'menuaction' => 'mail.mail_compose.compose',
2723 2717
 				'send_to'    => base64_encode($email)
2724 2718
 			);
2725 2719
 		}
2726
-		if($GLOBALS['egw_info']['user']['apps']['felamimail'])
2720
+		if ($GLOBALS['egw_info']['user']['apps']['felamimail'])
2727 2721
 		{
2728 2722
 			return array(
2729 2723
 				'menuaction' => 'felamimail.uicompose.compose',
2730 2724
 				'send_to'    => base64_encode($email)
2731 2725
 			);
2732 2726
 		}
2733
-		if($GLOBALS['egw_info']['user']['apps']['email'])
2727
+		if ($GLOBALS['egw_info']['user']['apps']['email'])
2734 2728
 		{
2735 2729
 			return array(
2736 2730
 				'menuaction' => 'email.uicompose.compose',
2737 2731
 				'to' => $email,
2738 2732
 			);
2739 2733
 		}
2740
-		return 'mailto:' . $email;
2734
+		return 'mailto:'.$email;
2741 2735
 	}
2742 2736
 
2743 2737
 	/**
@@ -2746,16 +2740,16 @@  discard block
 block discarded – undo
2746 2740
 	 * @param array $_content
2747 2741
 	 * @return string
2748 2742
 	 */
2749
-	function search($_content=array())
2743
+	function search($_content = array())
2750 2744
 	{
2751
-		if(!empty($_content))
2745
+		if (!empty($_content))
2752 2746
 		{
2753 2747
 
2754 2748
 			$_content['cat_id'] = $this->config['cat_tab'] === 'Tree' ? $_content['cat_id_tree'] : $_content['cat_id'];
2755 2749
 
2756 2750
 			$response = egw_json_response::get();
2757 2751
 
2758
-			$query = egw_session::appsession('index','addressbook');
2752
+			$query = egw_session::appsession('index', 'addressbook');
2759 2753
 
2760 2754
 			if ($_content['button']['cancelsearch'])
2761 2755
 			{
@@ -2763,26 +2757,26 @@  discard block
 block discarded – undo
2763 2757
 			}
2764 2758
 			else
2765 2759
 			{
2766
-				$query['advanced_search'] = array_intersect_key($_content,array_flip(array_merge($this->get_contact_columns(),array('operator','meth_select'))));
2760
+				$query['advanced_search'] = array_intersect_key($_content, array_flip(array_merge($this->get_contact_columns(), array('operator', 'meth_select'))));
2767 2761
 				foreach ($query['advanced_search'] as $key => $value)
2768 2762
 				{
2769
-					if(!$value) unset($query['advanced_search'][$key]);
2763
+					if (!$value) unset($query['advanced_search'][$key]);
2770 2764
 				}
2771 2765
 				// Skip n_fn, it causes problems in sql
2772 2766
 				unset($query['advanced_search']['n_fn']);
2773 2767
 			}
2774 2768
 			$query['search'] = '';
2775 2769
 			// store the index state in the session
2776
-			egw_session::appsession('index','addressbook',$query);
2770
+			egw_session::appsession('index', 'addressbook', $query);
2777 2771
 
2778 2772
 			// store the advanced search in the session to call it again
2779
-			egw_session::appsession('advanced_search','addressbook',$query['advanced_search']);
2773
+			egw_session::appsession('advanced_search', 'addressbook', $query['advanced_search']);
2780 2774
 
2781 2775
 			// Update client / nextmatch with filters, or clear
2782 2776
 			$response->call("app.addressbook.adv_search", array('advanced_search' => $_content['button']['search'] ? $query['advanced_search'] : ''));
2783 2777
 			if ($_content['button']['cancelsearch'])
2784 2778
 			{
2785
-				egw_framework::window_close (); //$response->addScript('this.close();');
2779
+				egw_framework::window_close(); //$response->addScript('this.close();');
2786 2780
 
2787 2781
 				// No need to reload popup
2788 2782
 				return;
@@ -2793,19 +2787,19 @@  discard block
 block discarded – undo
2793 2787
 
2794 2788
 		// initialize etemplate arrays
2795 2789
 		$sel_options = $readonlys = array();
2796
-		$content = egw_session::appsession('advanced_search','addressbook');
2790
+		$content = egw_session::appsession('advanced_search', 'addressbook');
2797 2791
 		$content['n_fn'] = $this->fullname($content);
2798 2792
 		// Avoid ID conflict with tree & selectboxes
2799 2793
 		$content['cat_id_tree'] = $content['cat_id'];
2800 2794
 
2801
-		for($i = -23; $i<=23; $i++) $tz[$i] = ($i > 0 ? '+' : '').$i;
2795
+		for ($i = -23; $i <= 23; $i++) $tz[$i] = ($i > 0 ? '+' : '').$i;
2802 2796
 		$sel_options['tz'] = $tz + array('' => lang('doesn\'t matter'));
2803 2797
 		$sel_options['tid'][] = lang('all');
2804 2798
 		//foreach($this->content_types as $type => $data) $sel_options['tid'][$type] = $data['name'];
2805 2799
 
2806 2800
 		// configure search options
2807
-		$sel_options['owner'] = $this->get_addressbooks(EGW_ACL_READ,lang('all'));
2808
-		$sel_options['operator'] =  array(
2801
+		$sel_options['owner'] = $this->get_addressbooks(EGW_ACL_READ, lang('all'));
2802
+		$sel_options['operator'] = array(
2809 2803
 			'AND' => 'AND',
2810 2804
 			'OR' => 'OR',
2811 2805
 		);
@@ -2815,12 +2809,12 @@  discard block
 block discarded – undo
2815 2809
 		);
2816 2810
 		if ($this->customfields)
2817 2811
 		{
2818
-			foreach($this->customfields as $name => $data)
2812
+			foreach ($this->customfields as $name => $data)
2819 2813
 			{
2820 2814
 				if (substr($data['type'], 0, 6) == 'select' && !($data['rows'] > 1))
2821 2815
 				{
2822 2816
 					if (!isset($content['#'.$name])) $content['#'.$name] = '';
2823
-					if(!isset($data['values'][''])) $sel_options['#'.$name][''] = lang('Select one');
2817
+					if (!isset($data['values'][''])) $sel_options['#'.$name][''] = lang('Select one');
2824 2818
 				}
2825 2819
 			}
2826 2820
 		}
@@ -2845,8 +2839,8 @@  discard block
 block discarded – undo
2845 2839
 		if ($this->config['private_cf_tab']) $content['no_private_cfs'] = 0;
2846 2840
 
2847 2841
 		$this->tmpl->read('addressbook.edit');
2848
-		$this->tmpl->set_cell_attribute('change_org','disabled',true);
2849
-		return $this->tmpl->exec('addressbook.addressbook_ui.search',$content,$sel_options,$readonlys,array(),2);
2842
+		$this->tmpl->set_cell_attribute('change_org', 'disabled', true);
2843
+		return $this->tmpl->exec('addressbook.addressbook_ui.search', $content, $sel_options, $readonlys, array(), 2);
2850 2844
 	}
2851 2845
 
2852 2846
 	/**
@@ -2855,16 +2849,15 @@  discard block
 block discarded – undo
2855 2849
 	function photo()
2856 2850
 	{
2857 2851
 		ob_start();
2858
-		$contact_id = isset($_GET['contact_id']) ? $_GET['contact_id'] :
2859
-			(isset($_GET['account_id']) ? 'account:'.$_GET['account_id'] : 0);
2852
+		$contact_id = isset($_GET['contact_id']) ? $_GET['contact_id'] : (isset($_GET['account_id']) ? 'account:'.$_GET['account_id'] : 0);
2860 2853
 
2861
-		if (substr($contact_id,0,8) == 'account:')
2854
+		if (substr($contact_id, 0, 8) == 'account:')
2862 2855
 		{
2863
-			$contact_id = $GLOBALS['egw']->accounts->id2name(substr($contact_id,8),'person_id');
2856
+			$contact_id = $GLOBALS['egw']->accounts->id2name(substr($contact_id, 8), 'person_id');
2864 2857
 		}
2865 2858
 		if (!($contact = $this->read($contact_id)) || !$contact['jpegphoto'])
2866 2859
 		{
2867
-			egw::redirect(common::image('addressbook','photo'));
2860
+			egw::redirect(common::image('addressbook', 'photo'));
2868 2861
 		}
2869 2862
 		// use an etag over the image mapp
2870 2863
 		$etag = '"'.$contact['id'].':'.$contact['etag'].'"';
@@ -2876,7 +2869,7 @@  discard block
 block discarded – undo
2876 2869
 			// different url with different etag parameter will force a reload
2877 2870
 			if (isset($_GET['etag']))
2878 2871
 			{
2879
-				egw_session::cache_control(30*86400);	// cache for 30 days
2872
+				egw_session::cache_control(30 * 86400); // cache for 30 days
2880 2873
 			}
2881 2874
 			// if servers send a If-None-Match header, response with 304 Not Modified, if etag matches
2882 2875
 			if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && $_SERVER['HTTP_IF_NONE_MATCH'] === $etag)
@@ -2928,14 +2921,14 @@  discard block
 block discarded – undo
2928 2921
 		parse_navbar();
2929 2922
 
2930 2923
 		// check if user has admin rights AND if a valid fileas type is given (Security)
2931
-		if (!$this->is_admin() || $_GET['type'] != '' && !in_array($_GET['type'],$this->fileas_types))
2924
+		if (!$this->is_admin() || $_GET['type'] != '' && !in_array($_GET['type'], $this->fileas_types))
2932 2925
 		{
2933 2926
 			echo '<h1>'.lang('Permission denied !!!')."</h1>\n";
2934 2927
 		}
2935 2928
 		else
2936 2929
 		{
2937
-			$updated = parent::set_all_fileas($_GET['type'],(boolean)$_GET['all'],$errors,true);	// true = ignore acl
2938
-			echo '<p style="margin-top: 20px;"><b>'.lang('%1 contacts updated (%2 errors).',$updated,$errors)."</b></p>\n";
2930
+			$updated = parent::set_all_fileas($_GET['type'], (boolean)$_GET['all'], $errors, true); // true = ignore acl
2931
+			echo '<p style="margin-top: 20px;"><b>'.lang('%1 contacts updated (%2 errors).', $updated, $errors)."</b></p>\n";
2939 2932
 		}
2940 2933
 		common::egw_footer();
2941 2934
 	}
@@ -2958,8 +2951,8 @@  discard block
 block discarded – undo
2958 2951
 		}
2959 2952
 		else
2960 2953
 		{
2961
-			$updated = parent::set_all_cleanup($errors,true);	// true = ignore acl
2962
-			echo '<p style="margin-top: 20px;"><b>'.lang('%1 contacts updated (%2 errors).',$updated,$errors)."</b></p>\n";
2954
+			$updated = parent::set_all_cleanup($errors, true); // true = ignore acl
2955
+			echo '<p style="margin-top: 20px;"><b>'.lang('%1 contacts updated (%2 errors).', $updated, $errors)."</b></p>\n";
2963 2956
 		}
2964 2957
 		common::egw_footer();
2965 2958
 	}
@@ -2972,7 +2965,7 @@  discard block
 block discarded – undo
2972 2965
 		if ($this->contact_repository == 'ldap' || !$content['id'] ||
2973 2966
 			$this->account_repository == 'ldap' && $content['account_id'])
2974 2967
 		{
2975
-			return;	// no history for ldap as history table only allows integer id's
2968
+			return; // no history for ldap as history table only allows integer id's
2976 2969
 		}
2977 2970
 		$content['history'] = array(
2978 2971
 			'id'	=>	$content['id'],
@@ -2987,7 +2980,7 @@  discard block
 block discarded – undo
2987 2980
 			),
2988 2981
 		);
2989 2982
 
2990
-		foreach($this->content_types as $id => $settings)
2983
+		foreach ($this->content_types as $id => $settings)
2991 2984
 		{
2992 2985
 			$content['history']['status-widgets']['tid'][$id] = $settings['name'];
2993 2986
 		}
Please login to merge, or discard this patch.
Braces   +381 added lines, -99 removed lines patch added patch discarded remove patch
@@ -84,7 +84,10 @@  discard block
 block discarded – undo
84 84
 		);
85 85
 
86 86
 		// make sure the hook for export_limit is registered
87
-		if (!$GLOBALS['egw']->hooks->hook_exists('export_limit','addressbook')) $GLOBALS['egw']->hooks->register_single_app_hook('addressbook','export_limit');
87
+		if (!$GLOBALS['egw']->hooks->hook_exists('export_limit','addressbook'))
88
+		{
89
+			$GLOBALS['egw']->hooks->register_single_app_hook('addressbook','export_limit');
90
+		}
88 91
 
89 92
 		$this->config =& $GLOBALS['egw_info']['server'];
90 93
 
@@ -123,15 +126,21 @@  discard block
 block discarded – undo
123 126
 		{
124 127
 			$do_email = $content['do_email'];
125 128
 
126
-			if (isset($content['nm']['rows']['delete']))	// handle a single delete like delete with the checkboxes
129
+			if (isset($content['nm']['rows']['delete']))
130
+			{
131
+				// handle a single delete like delete with the checkboxes
127 132
 			{
128 133
 				list($id) = @each($content['nm']['rows']['delete']);
134
+			}
129 135
 				$content['nm']['action'] = 'delete';
130 136
 				$content['nm']['selected'] = array($id);
131 137
 			}
132
-			if (isset($content['nm']['rows']['document']))	// handle insert in default document button like an action
138
+			if (isset($content['nm']['rows']['document']))
139
+			{
140
+				// handle insert in default document button like an action
133 141
 			{
134 142
 				list($id) = @each($content['nm']['rows']['document']);
143
+			}
135 144
 				$content['nm']['action'] = 'document';
136 145
 				$content['nm']['selected'] = array($id);
137 146
 			}
@@ -141,10 +150,13 @@  discard block
 block discarded – undo
141 150
 				{
142 151
 					$msg = lang('You need to select some contacts first');
143 152
 				}
144
-				elseif ($content['nm']['action'] == 'view')	// org-view via context menu
153
+				elseif ($content['nm']['action'] == 'view')
154
+				{
155
+					// org-view via context menu
145 156
 				{
146 157
 					$content['nm']['org_view'] = array_shift($content['nm']['selected']);
147 158
 				}
159
+				}
148 160
 				else
149 161
 				{
150 162
 					if ($this->action($content['nm']['action'],$content['nm']['selected'],$content['nm']['select_all'],
@@ -166,10 +178,13 @@  discard block
 block discarded – undo
166 178
 				list($org) = each($content['nm']['rows']['infolog']);
167 179
 				return $this->infolog_org_view($org);
168 180
 			}
169
-			if ($content['nm']['rows']['view'])	// show all contacts of an organisation
181
+			if ($content['nm']['rows']['view'])
182
+			{
183
+				// show all contacts of an organisation
170 184
 			{
171 185
 				list($org_view) = each($content['nm']['rows']['view']);
172 186
 			}
187
+			}
173 188
 			else
174 189
 			{
175 190
 				$org_view = $content['nm']['org_view'];
@@ -259,10 +274,14 @@  discard block
 block discarded – undo
259 274
 		}
260 275
 
261 276
 		// Search parameter passed in
262
-		if ($_GET['search']) {
277
+		if ($_GET['search'])
278
+		{
263 279
 			$content['nm']['search'] = $_GET['search'];
264 280
 		}
265
-		if (isset($typeselection)) $content['nm']['col_filter']['tid'] = $typeselection;
281
+		if (isset($typeselection))
282
+		{
283
+			$content['nm']['col_filter']['tid'] = $typeselection;
284
+		}
266 285
 		// save the tid for use in creating new addressbook entrys via UI. Current tid is to be used as type of new entrys
267 286
 		//error_log(__METHOD__.__LINE__.' '.$content['nm']['col_filter']['tid']);
268 287
 		egw_cache::setSession('addressbook','active_tid',$content['nm']['col_filter']['tid']);
@@ -300,7 +319,10 @@  discard block
 block discarded – undo
300 319
 		$sel_options['adr_one_countrycode']['-custom-'] = lang('No country selected');
301 320
 
302 321
 		// if there is any export limit set, pass it on to the nextmatch, to be evaluated by the export
303
-		if (isset($this->config['contact_export_limit']) && (int)$this->config['contact_export_limit']) $content['nm']['export_limit']=$this->config['contact_export_limit'];
322
+		if (isset($this->config['contact_export_limit']) && (int)$this->config['contact_export_limit'])
323
+		{
324
+			$content['nm']['export_limit']=$this->config['contact_export_limit'];
325
+		}
304 326
 
305 327
 		// dont show tid-selection if we have only one content_type
306 328
 		// be a bit more sophisticated about it
@@ -311,7 +333,10 @@  discard block
 block discarded – undo
311 333
 			//_debug_array(array('Typefilter:'=> $content['nm']['col_filter']['tid'],'Available Types:'=>$availabletypes,'action:'=>'remove invalid filter'));
312 334
 			unset($content['nm']['col_filter']['tid']);
313 335
 		}
314
-		if (!isset($content['nm']['col_filter']['tid'])) $content['nm']['col_filter']['tid'] = $availabletypes[0];
336
+		if (!isset($content['nm']['col_filter']['tid']))
337
+		{
338
+			$content['nm']['col_filter']['tid'] = $availabletypes[0];
339
+		}
315 340
 		if (count($this->content_types) > 1)
316 341
 		{
317 342
 			foreach($this->content_types as $tid => $data)
@@ -405,7 +430,10 @@  discard block
 block discarded – undo
405 430
 			$crm_apps = array('infolog','tracker');
406 431
 			foreach($crm_apps as $app)
407 432
 			{
408
-				if ($GLOBALS['egw_info']['user']['apps'][$app]) $crm_count++;
433
+				if ($GLOBALS['egw_info']['user']['apps'][$app])
434
+				{
435
+					$crm_count++;
436
+				}
409 437
 			}
410 438
 			if($crm_count > 1)
411 439
 			{
@@ -459,7 +487,10 @@  discard block
 block discarded – undo
459 487
 				),
460 488
 			),
461 489
 		);
462
-		if (!$GLOBALS['egw_info']['user']['apps']['preferences']) unset($actions['cats']['children']['cat_edit']);
490
+		if (!$GLOBALS['egw_info']['user']['apps']['preferences'])
491
+		{
492
+			unset($actions['cats']['children']['cat_edit']);
493
+		}
463 494
 		// Submenu for all distributionlist stuff
464 495
 		$actions['lists'] = array(
465 496
 			'caption' => 'Distribution lists',
@@ -472,7 +503,9 @@  discard block
 block discarded – undo
472 503
 			),
473 504
 			'group' => $group,
474 505
 		);
475
-		if (($add_lists = $this->get_lists(EGW_ACL_EDIT)))	// do we have distribution lists?, and are we allowed to edit them
506
+		if (($add_lists = $this->get_lists(EGW_ACL_EDIT)))
507
+		{
508
+			// do we have distribution lists?, and are we allowed to edit them
476 509
 		{
477 510
 			$actions['lists']['children'] += array(
478 511
 				'to_list' => array(
@@ -508,6 +541,7 @@  discard block
 block discarded – undo
508 541
 					'fieldValue' => '!',	// enable if list != ''
509 542
 				),
510 543
 			);
544
+		}
511 545
 			if(is_subclass_of('etemplate', 'etemplate_new'))
512 546
 			{
513 547
 				$actions['lists']['children']['remove_from_list']['fieldId'] = 'filter2';
@@ -516,9 +550,13 @@  discard block
 block discarded – undo
516 550
 			}
517 551
 		}
518 552
 		// move to AB
519
-		if (($move2addressbooks = $this->get_addressbooks(EGW_ACL_ADD)))	// do we have addressbooks, we should
553
+		if (($move2addressbooks = $this->get_addressbooks(EGW_ACL_ADD)))
554
+		{
555
+			// do we have addressbooks, we should
520 556
 		{
521
-			unset($move2addressbooks[0]);	// do not offer action to move contact to an account, as we dont support that currrently
557
+			unset($move2addressbooks[0]);
558
+		}
559
+		// do not offer action to move contact to an account, as we dont support that currrently
522 560
 			foreach($move2addressbooks as $owner => $label)
523 561
 			{
524 562
 				$this->type_icon((int)$owner, substr($owner,-1) == 'p', 'n', $icon, $type_label);
@@ -642,7 +680,9 @@  discard block
 block discarded – undo
642 680
 
643 681
 			);
644 682
 		if (!$this->prefs['preferredMail'])
645
-			$actions['email']['children']['email_business']['checked'] = true;
683
+		{
684
+					$actions['email']['children']['email_business']['checked'] = true;
685
+		}
646 686
 
647 687
 		if ($GLOBALS['egw_info']['user']['apps']['filemanager'])
648 688
 		{
@@ -726,7 +766,10 @@  discard block
 block discarded – undo
726 766
 				'disableClass' => 'rowNoEdit',
727 767
 			);
728 768
 		}
729
-		if (isset($actions['export']['children']['csv']) && !importexport_helper_functions::has_definitions('addressbook','export')) unset($actions['export']['children']['csv']);
769
+		if (isset($actions['export']['children']['csv']) && !importexport_helper_functions::has_definitions('addressbook','export'))
770
+		{
771
+			unset($actions['export']['children']['csv']);
772
+		}
730 773
 
731 774
 		//echo "<p>".__METHOD__."($do_email, $tid_filter, $org_view)</p>\n"; _debug_array($actions);
732 775
 
@@ -749,11 +792,17 @@  discard block
 block discarded – undo
749 792
 	private function _get_org_name($org)
750 793
 	{
751 794
 		$org_name = array();
752
-		if (strpos($org,'*AND*')!== false) $org = str_replace('*AND*','&',$org);
795
+		if (strpos($org,'*AND*')!== false)
796
+		{
797
+			$org = str_replace('*AND*','&',$org);
798
+		}
753 799
 		foreach(explode('|||',$org) as $part)
754 800
 		{
755 801
 			list(,$name) = explode(':',$part,2);
756
-			if ($name) $org_name[] = $name;
802
+			if ($name)
803
+			{
804
+				$org_name[] = $name;
805
+			}
757 806
 		}
758 807
 		$org_name = implode(': ',$org_name);
759 808
 		return $org_name ? array($org => $org_name) : array();
@@ -815,9 +864,15 @@  discard block
 block discarded – undo
815 864
 		$org_contacts = array();
816 865
 		$query = $query == null ? egw_session::appsession('index','addressbook') : $query;
817 866
 		$query['num_rows'] = -1;	// all
818
-		if(!is_array($query['col_filter'])) $query['col_filter'] = array();
867
+		if(!is_array($query['col_filter']))
868
+		{
869
+			$query['col_filter'] = array();
870
+		}
819 871
 
820
-		if(!is_array($org)) $org = array($org);
872
+		if(!is_array($org))
873
+		{
874
+			$org = array($org);
875
+		}
821 876
 		foreach($org as $org_name)
822 877
 		{
823 878
 			error_log("Org: $org_name");
@@ -846,14 +901,23 @@  discard block
 block discarded – undo
846 901
 		$query['searchletter'] = '';
847 902
 		$this->get_rows($query,$checked,$readonlys,true);	// true = only return the id's
848 903
 
849
-		if (count($checked) > 1)	// use a nicely formatted org-name as title in infolog
904
+		if (count($checked) > 1)
905
+		{
906
+			// use a nicely formatted org-name as title in infolog
850 907
 		{
851 908
 			$parts = array();
852
-			if (strpos($org,'*AND*')!== false) $org = str_replace('*AND*','&',$org);
909
+		}
910
+			if (strpos($org,'*AND*')!== false)
911
+			{
912
+				$org = str_replace('*AND*','&',$org);
913
+			}
853 914
 			foreach(explode('|||',$org) as $part)
854 915
 			{
855 916
 				list(,$part) = explode(':',$part,2);
856
-				if ($part) $parts[] = $part;
917
+				if ($part)
918
+				{
919
+					$parts[] = $part;
920
+				}
857 921
 			}
858 922
 			$org = implode(', ',$parts);
859 923
 		}
@@ -877,13 +941,19 @@  discard block
 block discarded – undo
877 941
 
878 942
 		$response = egw_json_response::get();
879 943
 
880
-		if ($success) $response->addScript(egw_framework::set_onload(''));
944
+		if ($success)
945
+		{
946
+			$response->addScript(egw_framework::set_onload(''));
947
+		}
881 948
 
882 949
 		// close window only if no errors AND something added
883 950
 		if ($failed || !$success)
884 951
 		{
885
-			if (!$msg) $msg = $failed ? lang('%1 contact(s) %2, %3 failed because of insufficent rights !!!',$success,$action_msg,$failed) :
952
+			if (!$msg)
953
+			{
954
+				$msg = $failed ? lang('%1 contact(s) %2, %3 failed because of insufficent rights !!!',$success,$action_msg,$failed) :
886 955
 				lang('%1 contact(s) %2',$success,$action_msg);
956
+			}
887 957
 
888 958
 			$response->addScript("alert('".addslashes($msg)."')");
889 959
 			// reset the filter
@@ -891,7 +961,10 @@  discard block
 block discarded – undo
891 961
 		}
892 962
 		else
893 963
 		{
894
-			if (!$msg) $msg = lang('%1 contact(s) %2',$success,$action_msg);
964
+			if (!$msg)
965
+			{
966
+				$msg = lang('%1 contact(s) %2',$success,$action_msg);
967
+			}
895 968
 			$response->addScript("alert('".addslashes($msg)."')");
896 969
 			$response->addScript('egw(window).close();');
897 970
 		}
@@ -986,10 +1059,16 @@  discard block
 block discarded – undo
986 1059
 				$query['org_view'] = $id;
987 1060
 				unset($query['filter2']);
988 1061
 				$this->get_rows($query,$extra,$readonlys,true);	// true = only return the id's
989
-				if ($extra[0]) $org_contacts = array_merge($org_contacts,$extra);
1062
+				if ($extra[0])
1063
+				{
1064
+					$org_contacts = array_merge($org_contacts,$extra);
1065
+				}
990 1066
 			}
991 1067
 		}
992
-		if ($org_contacts) $checked = array_unique($checked ? array_merge($checked,$org_contacts) : $org_contacts);
1068
+		if ($org_contacts)
1069
+		{
1070
+			$checked = array_unique($checked ? array_merge($checked,$org_contacts) : $org_contacts);
1071
+		}
993 1072
 		//_debug_array($checked); exit;
994 1073
 
995 1074
 		if (substr($action,0,8) == 'move_to_')
@@ -1006,9 +1085,12 @@  discard block
 block discarded – undo
1006 1085
 			$document = substr($action,9);
1007 1086
 			$action = 'document';
1008 1087
 		}
1009
-		elseif(substr($action,0,4) == 'cat_')	// cat_add_123 or cat_del_456
1088
+		elseif(substr($action,0,4) == 'cat_')
1089
+		{
1090
+			// cat_add_123 or cat_del_456
1010 1091
 		{
1011 1092
 			$cat_id = (int)substr($action, 8);
1093
+		}
1012 1094
 			$action = substr($action,0,7);
1013 1095
 		}
1014 1096
 		// Security: stop non-admins to export more then the configured number of contacts
@@ -1054,7 +1136,10 @@  discard block
 block discarded – undo
1054 1136
 				return false;
1055 1137
 
1056 1138
 			case 'document':
1057
-				if (!$document) $document = $this->prefs['default_document'];
1139
+				if (!$document)
1140
+				{
1141
+					$document = $this->prefs['default_document'];
1142
+				}
1058 1143
 				$document_merge = new addressbook_merge();
1059 1144
 				$msg = $document_merge->download($document, $checked, '', $this->prefs['document_dir']);
1060 1145
 				$failed = count($checked);
@@ -1210,19 +1295,25 @@  discard block
 block discarded – undo
1210 1295
 					break;
1211 1296
 
1212 1297
 				default:	// move to an other addressbook
1213
-					if (!(int)$action || !($this->grants[(string) (int) $action] & EGW_ACL_EDIT))	// might be ADD in the future
1298
+					if (!(int)$action || !($this->grants[(string) (int) $action] & EGW_ACL_EDIT))
1299
+					{
1300
+						// might be ADD in the future
1214 1301
 					{
1215 1302
 						return false;
1216 1303
 					}
1304
+					}
1217 1305
 					if (!$checkboxes['move_to_copy'])
1218 1306
 					{
1219 1307
 						$action_msg = lang('moved');
1220 1308
 						if (($Ok = !!($contact = $this->read($id)) && $this->check_perms(EGW_ACL_DELETE,$contact)))
1221 1309
 						{
1222
-							if (!$contact['owner'])		// no (mass-)move of accounts
1310
+							if (!$contact['owner'])
1311
+							{
1312
+								// no (mass-)move of accounts
1223 1313
 							{
1224 1314
 								$Ok = false;
1225 1315
 							}
1316
+							}
1226 1317
 							elseif ($contact['owner'] != (int)$action || $contact['private'] != (int)(substr($action,-1) == 'p'))
1227 1318
 							{
1228 1319
 								$contact['owner'] = (int) $action;
@@ -1311,9 +1402,12 @@  discard block
 block discarded – undo
1311 1402
 		$do_email = $query['do_email'];
1312 1403
 		$what = $query['sitemgr_display'] ? $query['sitemgr_display'] : ($do_email ? 'email' : 'index');
1313 1404
 
1314
-		if (!$id_only && !$query['csv_export'])	// do NOT store state for csv_export or querying id's (no regular view)
1405
+		if (!$id_only && !$query['csv_export'])
1406
+		{
1407
+			// do NOT store state for csv_export or querying id's (no regular view)
1315 1408
 		{
1316 1409
 			$store_query = $query;
1410
+		}
1317 1411
 			// Do not store these
1318 1412
 			foreach(array('options-cat_id','actions') as $key)
1319 1413
 			{
@@ -1325,14 +1419,25 @@  discard block
 block discarded – undo
1325 1419
 		{
1326 1420
 			$old_state = egw_session::appsession($what,'addressbook');
1327 1421
 		}
1328
-		if (!isset($this->org_views[(string) $query['org_view']]))   // we dont have an org view, unset the according col_filters
1422
+		if (!isset($this->org_views[(string) $query['org_view']]))
1423
+		{
1424
+			// we dont have an org view, unset the according col_filters
1329 1425
 		{
1330 1426
 			if (isset($query['col_filter']['org_name'])) unset($query['col_filter']['org_name']);
1331
-			if (isset($query['col_filter']['adr_one_locality'])) unset($query['col_filter']['adr_one_locality']);
1332
-			if (isset($query['col_filter']['org_unit'])) unset($query['col_filter']['org_unit']);
1427
+		}
1428
+			if (isset($query['col_filter']['adr_one_locality']))
1429
+			{
1430
+				unset($query['col_filter']['adr_one_locality']);
1431
+			}
1432
+			if (isset($query['col_filter']['org_unit']))
1433
+			{
1434
+				unset($query['col_filter']['org_unit']);
1435
+			}
1333 1436
 		}
1334 1437
 
1335
-		if (isset($this->org_views[(string) $query['org_view']]))	// we have an org view, reset the advanced search
1438
+		if (isset($this->org_views[(string) $query['org_view']]))
1439
+		{
1440
+			// we have an org view, reset the advanced search
1336 1441
 		{
1337 1442
 			//_debug_array(array('Search'=>$query['search'],
1338 1443
 			//	'AdvancedSearch'=>$query['advanced_search']));
@@ -1340,23 +1445,30 @@  discard block
 block discarded – undo
1340 1445
 			//unset($query['advanced_search']);
1341 1446
 			if(!$query['search'] && $old_state['advanced_search']) $query['advanced_search'] = $old_state['advanced_search'];
1342 1447
 		}
1343
-		elseif(!$query['search'] && $old_state['advanced_search'])	// eg. paging in an advanced search
1448
+		}
1449
+		elseif(!$query['search'] && $old_state['advanced_search'])
1450
+		{
1451
+			// eg. paging in an advanced search
1344 1452
 		{
1345 1453
 			$query['advanced_search'] = $old_state['advanced_search'];
1346 1454
 		}
1455
+		}
1347 1456
 		if ($do_email && etemplate::$loop)
1348
-		{	// remove previous addEmail() calls, otherwise they will be run again
1457
+		{
1458
+// remove previous addEmail() calls, otherwise they will be run again
1349 1459
 			egw_framework::set_onload(preg_replace('/addEmail\([^)]+\);/','',egw_framework::set_onload()),true);
1350 1460
 		}
1351 1461
 
1352 1462
 		// Make sure old lettersearch filter doesn't stay - current letter filter will be added later
1353 1463
 		foreach($query['col_filter'] as $key => $col_filter)
1354 1464
 		{
1355
-			if(!is_numeric($key)) continue;
1465
+			if(!is_numeric($key))
1466
+			{
1467
+				continue;
1468
+			}
1356 1469
 			if(preg_match('/'.$GLOBALS['egw']->db->capabilities['case_insensitive_like'].
1357 1470
 				' '.$GLOBALS['egw']->db->quote('[a-z]%').'$/i',$col_filter) == 1
1358
-			)
1359
-			{
1471
+			) {
1360 1472
 				unset($query['col_filter'][$key]);
1361 1473
 			}
1362 1474
 		}
@@ -1367,9 +1479,13 @@  discard block
 block discarded – undo
1367 1479
 			// check if accounts are stored in ldap, which does NOT yet support the org-views
1368 1480
 			if ($this->so_accounts && $query['filter'] === '0' && $query['org_view'])
1369 1481
 			{
1370
-				if ($old_state['filter'] === '0')	// user changed to org_view
1482
+				if ($old_state['filter'] === '0')
1483
+				{
1484
+					// user changed to org_view
1371 1485
 				{
1372
-					$query['filter'] = '';			// --> change filter to all contacts
1486
+					$query['filter'] = '';
1487
+				}
1488
+				// --> change filter to all contacts
1373 1489
 				}
1374 1490
 				else								// user changed to accounts
1375 1491
 				{
@@ -1406,9 +1522,12 @@  discard block
 block discarded – undo
1406 1522
 		{
1407 1523
 			unset($query['col_filter']['cat_id']);
1408 1524
 		}
1409
-		if ($query['filter'] !== '')	// not all addressbooks
1525
+		if ($query['filter'] !== '')
1526
+		{
1527
+			// not all addressbooks
1410 1528
 		{
1411 1529
 			$query['col_filter']['owner'] = (string) (int) $query['filter'];
1530
+		}
1412 1531
 
1413 1532
 			if ($this->private_addressbook)
1414 1533
 			{
@@ -1420,10 +1539,13 @@  discard block
 block discarded – undo
1420 1539
 			unset($query['col_filter']['owner']);
1421 1540
 			unset($query['col_filter']['private']);
1422 1541
 		}
1423
-		if ((int)$query['filter2'])	// not no distribution list
1542
+		if ((int)$query['filter2'])
1543
+		{
1544
+			// not no distribution list
1424 1545
 		{
1425 1546
 			$query['col_filter']['list'] = (string) (int) $query['filter2'];
1426 1547
 		}
1548
+		}
1427 1549
 		else
1428 1550
 		{
1429 1551
 			unset($query['col_filter']['list']);
@@ -1435,12 +1557,15 @@  discard block
 block discarded – undo
1435 1557
 		// enable/disable distribution lists depending on backend
1436 1558
 		$query['no_filter2'] = !$this->lists_available($query['filter']);
1437 1559
 
1438
-		if (isset($this->org_views[(string) $query['org_view']]))	// we have an org view
1560
+		if (isset($this->org_views[(string) $query['org_view']]))
1561
+		{
1562
+			// we have an org view
1439 1563
 		{
1440 1564
 			if($query['actions'] && $query['actions']['open'])
1441 1565
 			{
1442 1566
 				// Just switched from contact view, update actions
1443 1567
 				$query['actions'] = $this->get_actions($query['col_filter']['tid'], $query['org_view']);
1568
+		}
1444 1569
 			}
1445 1570
 			unset($query['col_filter']['list']);	// does not work together
1446 1571
 			$query['no_filter2'] = true;			// switch the distribution list selection off
@@ -1481,9 +1606,12 @@  discard block
 block discarded – undo
1481 1606
 			{
1482 1607
 				$query['template'] = $do_email ? 'addressbook.email.rows' : 'addressbook.index.rows';
1483 1608
 			}
1484
-			if ($query['org_view'])	// view the contacts of one organisation only
1609
+			if ($query['org_view'])
1610
+			{
1611
+				// view the contacts of one organisation only
1485 1612
 			{
1486 1613
 				if (strpos($query['org_view'],'*AND*') !== false) $query['org_view'] = str_replace('*AND*','&',$query['org_view']);
1614
+			}
1487 1615
 				foreach(explode('|||',$query['org_view']) as $part)
1488 1616
 				{
1489 1617
 					list($name,$value) = explode(':',$part,2);
@@ -1502,14 +1630,18 @@  discard block
 block discarded – undo
1502 1630
 			// translate the select order to the really used over all 3 columns
1503 1631
 			$sort = $query['sort'];
1504 1632
 			switch($query['order'])		// "xxx<>'' DESC" sorts contacts with empty order-criteria always at the end
1505
-			{							// we don't exclude them, as the total would otherwise depend on the order-criteria
1633
+			{
1634
+// we don't exclude them, as the total would otherwise depend on the order-criteria
1506 1635
 				case 'org_name':
1507 1636
 					$order = "egw_addressbook.org_name<>''DESC,egw_addressbook.org_name $sort,n_family $sort,n_given $sort";
1508 1637
 					break;
1509 1638
 				default:
1510
-					if ($query['order'][0] == '#')	// we order by a custom field
1639
+					if ($query['order'][0] == '#')
1640
+					{
1641
+						// we order by a custom field
1511 1642
 					{
1512 1643
 						$order = "{$query['order']} $sort,org_name $sort,n_family $sort,n_given $sort";
1644
+					}
1513 1645
 						break;
1514 1646
 					}
1515 1647
 					$query['order'] = 'n_family';
@@ -1533,9 +1665,12 @@  discard block
 block discarded – undo
1533 1665
 				case 'contact_id':
1534 1666
 					$order = "egw_addressbook.$query[order] $sort";
1535 1667
 			}
1536
-			if ($query['searchletter'])	// only show contacts if the order-criteria starts with the given letter
1668
+			if ($query['searchletter'])
1669
+			{
1670
+				// only show contacts if the order-criteria starts with the given letter
1537 1671
 			{
1538 1672
 				$no_letter_search = array('adr_one_postalcode', 'adr_two_postalcode', 'contact_id', 'contact_created','contact_modified');
1673
+			}
1539 1674
 				$query['col_filter'][] = (in_array($query['order'],$no_letter_search) ? 'org_name' : (substr($query['order'],0,1)=='#'?'':'egw_addressbook.').$query['order']).' '.
1540 1675
 					$GLOBALS['egw']->db->capabilities['case_insensitive_like'].' '.$GLOBALS['egw']->db->quote(strtolower($query['searchletter']).'%');
1541 1676
 			}
@@ -1573,11 +1708,17 @@  discard block
 block discarded – undo
1573 1708
 					{
1574 1709
 						foreach($columselection as $col)
1575 1710
 						{
1576
-							if ($col[0] == '#') $selected_cfs[] = substr($col,1);
1711
+							if ($col[0] == '#')
1712
+							{
1713
+								$selected_cfs[] = substr($col,1);
1714
+							}
1577 1715
 						}
1578 1716
 						$customfields = $this->read_customfields($ids,$selected_cfs);
1579 1717
 					}
1580
-					if ($show_calendar && !empty($ids)) $calendar = $this->read_calendar($ids);
1718
+					if ($show_calendar && !empty($ids))
1719
+					{
1720
+						$calendar = $this->read_calendar($ids);
1721
+					}
1581 1722
 					// distributionlist memership for the entrys
1582 1723
 					//_debug_array($this->get_lists(EGW_ACL_EDIT));
1583 1724
 					if ($show_distributionlist && $available_distib_lists)
@@ -1587,7 +1728,10 @@  discard block
 block discarded – undo
1587 1728
 				}
1588 1729
 			}
1589 1730
 		}
1590
-		if (!$rows) $rows = array();
1731
+		if (!$rows)
1732
+		{
1733
+			$rows = array();
1734
+		}
1591 1735
 
1592 1736
 		if ($id_only)
1593 1737
 		{
@@ -1620,7 +1764,10 @@  discard block
 block discarded – undo
1620 1764
 					$row['line2'] = $row['org_name'];
1621 1765
 					break;
1622 1766
 				case 'n_fileas':
1623
-					if (!$row['n_fileas']) $row['n_fileas'] = $this->fileas($row);
1767
+					if (!$row['n_fileas'])
1768
+					{
1769
+						$row['n_fileas'] = $this->fileas($row);
1770
+					}
1624 1771
 					list($row['line1'],$row['line2']) = explode(': ',$row['n_fileas']);
1625 1772
 					break;
1626 1773
 			}
@@ -1692,8 +1839,14 @@  discard block
 block discarded – undo
1692 1839
 			}
1693 1840
 
1694 1841
 			// hide region for address format 'postcode_city'
1695
-			if (($row['addr_format']  = $this->addr_format_by_country($row['adr_one_countryname']))=='postcode_city') unset($row['adr_one_region']);
1696
-			if (($row['addr_format2'] = $this->addr_format_by_country($row['adr_two_countryname']))=='postcode_city') unset($row['adr_two_region']);
1842
+			if (($row['addr_format']  = $this->addr_format_by_country($row['adr_one_countryname']))=='postcode_city')
1843
+			{
1844
+				unset($row['adr_one_region']);
1845
+			}
1846
+			if (($row['addr_format2'] = $this->addr_format_by_country($row['adr_two_countryname']))=='postcode_city')
1847
+			{
1848
+				unset($row['adr_two_region']);
1849
+			}
1697 1850
 
1698 1851
 			// respect category permissions
1699 1852
 			if(!empty($row['cat_id']))
@@ -1704,7 +1857,10 @@  discard block
 block discarded – undo
1704 1857
 		$readonlys['no_distrib_lists'] = (bool)$show_distributionlist;
1705 1858
 
1706 1859
 		// disable customfields column, if we have no customefield(s)
1707
-		if (!$this->customfields) $rows['no_customfields'] = true;
1860
+		if (!$this->customfields)
1861
+		{
1862
+			$rows['no_customfields'] = true;
1863
+		}
1708 1864
 
1709 1865
 		$rows['order'] = $order;
1710 1866
 		$rows['call_popup'] = $this->config['call_popup'];
@@ -1743,10 +1899,13 @@  discard block
 block discarded – undo
1743 1899
 			$order = $order == 'n_given' ? lang('first name') : ($order == 'n_family' ? lang('last name') : lang('Organisation'));
1744 1900
 			$GLOBALS['egw_info']['flags']['app_header'] .= ' - '.lang("%1 starts with '%2'",$order,$query['searchletter']);
1745 1901
 		}
1746
-		if ($query['search'] && !$query['advanced_search']) // do not add that, if we have advanced search active
1902
+		if ($query['search'] && !$query['advanced_search'])
1903
+		{
1904
+			// do not add that, if we have advanced search active
1747 1905
 		{
1748 1906
 			$GLOBALS['egw_info']['flags']['app_header'] .= ' - '.lang("Search for '%1'",$query['search']);
1749 1907
 		}
1908
+		}
1750 1909
 		return $this->total;
1751 1910
 	}
1752 1911
 
@@ -1811,7 +1970,10 @@  discard block
 block discarded – undo
1811 1970
 			$content['private'] = (int) ($content['owner'] && substr($content['owner'],-1) == 'p');
1812 1971
 			$content['owner'] = (string) (int) $content['owner'];
1813 1972
 			$content['cat_id'] = $this->config['cat_tab'] === 'Tree' ? $content['cat_id_tree'] : $content['cat_id'];
1814
-			if ($this->config['private_cf_tab']) $content = (array)$content['private_cfs'] + $content;
1973
+			if ($this->config['private_cf_tab'])
1974
+			{
1975
+				$content = (array)$content['private_cfs'] + $content;
1976
+			}
1815 1977
 			unset($content['private_cfs']);
1816 1978
 
1817 1979
 			switch($button)
@@ -2004,7 +2166,10 @@  discard block
 block discarded – undo
2004 2166
 				{
2005 2167
 					// arguments containing a comma get quoted by etemplate/js/nextmatch_action.js
2006 2168
 					// leading to error in egw_db::column_data_implode, if not unquoted
2007
-					if ($org[0] == '"') $org = substr($org, 1, -1);
2169
+					if ($org[0] == '"')
2170
+					{
2171
+						$org = substr($org, 1, -1);
2172
+					}
2008 2173
 					$content = $this->read_org($org);
2009 2174
 				}
2010 2175
 				elseif ($state['org_view'] && !isset($this->org_views[$state['org_view']]))
@@ -2024,7 +2189,10 @@  discard block
 block discarded – undo
2024 2189
 						$content['adr_two_countryname'] =
2025 2190
 							$GLOBALS['egw']->country->get_full_name($GLOBALS['egw_info']['user']['preferences']['common']['country']);
2026 2191
 					}
2027
-					if ($this->prefs['fileas_default']) $content['fileas_type'] = $this->prefs['fileas_default'];
2192
+					if ($this->prefs['fileas_default'])
2193
+					{
2194
+						$content['fileas_type'] = $this->prefs['fileas_default'];
2195
+					}
2028 2196
 				}
2029 2197
 				if (isset($_GET['owner']) && $_GET['owner'] !== '')
2030 2198
 				{
@@ -2049,7 +2217,10 @@  discard block
 block discarded – undo
2049 2217
 				$new_type = array_keys($this->content_types);
2050 2218
 				// fetch active type to preset the type, if param typeid is not passed
2051 2219
 				$active_tid = egw_cache::getSession('addressbook','active_tid');
2052
-				if ($active_tid && strtoupper($active_tid) === 'D') unset($active_tid);
2220
+				if ($active_tid && strtoupper($active_tid) === 'D')
2221
+				{
2222
+					unset($active_tid);
2223
+				}
2053 2224
 				$content['tid'] = $_GET['typeid'] ? $_GET['typeid'] : ($active_tid?$active_tid:$new_type[0]);
2054 2225
 				foreach($this->get_contact_columns() as $field)
2055 2226
 				{
@@ -2067,19 +2238,37 @@  discard block
 block discarded – undo
2067 2238
 									if (strpos($singleAddress[0]->personal,',')===false)
2068 2239
 									{
2069 2240
 										list($P_n_given,$P_n_family,$P_org_name)=explode(' ',$singleAddress[0]->personal,3);
2070
-										if (strlen(trim($P_n_given))>0) $content['n_given'] = trim($P_n_given);
2071
-										if (strlen(trim($P_n_family))>0) $content['n_family'] = trim($P_n_family);
2072
-										if (strlen(trim($P_org_name))>0) $content['org_name'] = trim($P_org_name);
2241
+										if (strlen(trim($P_n_given))>0)
2242
+										{
2243
+											$content['n_given'] = trim($P_n_given);
2244
+										}
2245
+										if (strlen(trim($P_n_family))>0)
2246
+										{
2247
+											$content['n_family'] = trim($P_n_family);
2248
+										}
2249
+										if (strlen(trim($P_org_name))>0)
2250
+										{
2251
+											$content['org_name'] = trim($P_org_name);
2252
+										}
2073 2253
 									}
2074 2254
 									else
2075 2255
 									{
2076 2256
 										list($P_n_family,$P_other)=explode(',',$singleAddress[0]->personal,2);
2077
-										if (strlen(trim($P_n_family))>0) $content['n_family'] = trim($P_n_family);
2257
+										if (strlen(trim($P_n_family))>0)
2258
+										{
2259
+											$content['n_family'] = trim($P_n_family);
2260
+										}
2078 2261
 										if (strlen(trim($P_other))>0)
2079 2262
 										{
2080 2263
 											list($P_n_given,$P_org_name)=explode(',',$P_other,2);
2081
-											if (strlen(trim($P_n_given))>0) $content['n_given'] = trim($P_n_given);
2082
-											if (strlen(trim($P_org_name))>0) $content['org_name'] = trim($P_org_name);
2264
+											if (strlen(trim($P_n_given))>0)
2265
+											{
2266
+												$content['n_given'] = trim($P_n_given);
2267
+											}
2268
+											if (strlen(trim($P_org_name))>0)
2269
+											{
2270
+												$content['org_name'] = trim($P_org_name);
2271
+											}
2083 2272
 										}
2084 2273
 									}
2085 2274
 								}
@@ -2107,7 +2296,10 @@  discard block
 block discarded – undo
2107 2296
 							break;
2108 2297
 						}
2109 2298
 					}
2110
-					if (empty($content['n_fn'])) $content['n_fn'] = $this->fullname($content);
2299
+					if (empty($content['n_fn']))
2300
+					{
2301
+						$content['n_fn'] = $this->fullname($content);
2302
+					}
2111 2303
 				}
2112 2304
 				$content['creator'] = $this->user;
2113 2305
 				$content['created'] = $this->now_su;
@@ -2115,17 +2307,27 @@  discard block
 block discarded – undo
2115 2307
 				//_debug_array($content);
2116 2308
 			}
2117 2309
 
2118
-			if ($_GET['msg']) $content['msg'] = strip_tags($_GET['msg']);	// dont allow HTML!
2310
+			if ($_GET['msg'])
2311
+			{
2312
+				$content['msg'] = strip_tags($_GET['msg']);
2313
+			}
2314
+			// dont allow HTML!
2119 2315
 
2120
-			if($content && $_GET['makecp'])	// copy the contact
2316
+			if($content && $_GET['makecp'])
2317
+			{
2318
+				// copy the contact
2121 2319
 			{
2122 2320
 				$this->copy_contact($content);
2321
+			}
2123 2322
 				$content['msg'] = lang('Contact copied');
2124 2323
 				$view = false;
2125 2324
 			}
2126 2325
 			else
2127 2326
 			{
2128
-				if (is_numeric($contact_id)) $content['link_to']['to_id'] = $contact_id;
2327
+				if (is_numeric($contact_id))
2328
+				{
2329
+					$content['link_to']['to_id'] = $contact_id;
2330
+				}
2129 2331
 			}
2130 2332
 			// automatic link new entries to entries specified in the url
2131 2333
 			if (!$contact_id && isset($_REQUEST['link_app']) && isset($_REQUEST['link_id']) && !is_array($content['link_to']['to_id']))
@@ -2134,10 +2336,13 @@  discard block
 block discarded – undo
2134 2336
 				foreach(is_array($_REQUEST['link_app']) ? $_REQUEST['link_app'] : array($_REQUEST['link_app']) as $n => $link_app)
2135 2337
 				{
2136 2338
 					$link_id = $link_ids[$n];
2137
-					if (preg_match('/^[a-z_0-9-]+:[:a-z_0-9-]+$/i',$link_app.':'.$link_id))	// gard against XSS
2339
+					if (preg_match('/^[a-z_0-9-]+:[:a-z_0-9-]+$/i',$link_app.':'.$link_id))
2340
+					{
2341
+						// gard against XSS
2138 2342
 					{
2139 2343
 						egw_link::link('addressbook',$content['link_to']['to_id'],$link_app,$link_id);
2140 2344
 					}
2345
+					}
2141 2346
 				}
2142 2347
 			}
2143 2348
 		}
@@ -2145,7 +2350,10 @@  discard block
 block discarded – undo
2145 2350
 		{
2146 2351
 			// last and next calendar date
2147 2352
 			list(,$dates) = each($this->read_calendar(array($content['id']),false));
2148
-			if(is_array($dates)) $content += $dates;
2353
+			if(is_array($dates))
2354
+			{
2355
+				$content += $dates;
2356
+			}
2149 2357
 		}
2150 2358
 		// Avoid ID conflict with tree & selectboxes
2151 2359
 		$content['cat_id_tree'] = $content['cat_id'];
@@ -2179,7 +2387,11 @@  discard block
 block discarded – undo
2179 2387
 		$sel_options['fileas_type'] = $this->fileas_options($content);
2180 2388
 		$sel_options['adr_one_countrycode']['-custom-'] = lang('Custom');
2181 2389
 		$sel_options['owner'] = $this->get_addressbooks(EGW_ACL_ADD);
2182
-		if ($content['owner']) unset($sel_options['owner'][0]);	// do not offer to switch to accounts, as we do not support moving contacts to accounts
2390
+		if ($content['owner'])
2391
+		{
2392
+			unset($sel_options['owner'][0]);
2393
+		}
2394
+		// do not offer to switch to accounts, as we do not support moving contacts to accounts
2183 2395
 		if ((string) $content['owner'] !== '')
2184 2396
 		{
2185 2397
 			if (!isset($sel_options['owner'][(int)$content['owner']]))
@@ -2206,7 +2418,10 @@  discard block
 block discarded – undo
2206 2418
 				$readonlys[$field] = false;
2207 2419
 			}
2208 2420
 		}
2209
-		if (isset($readonlys['n_fileas'])) $readonlys['fileas_type'] = $readonlys['n_fileas'];
2421
+		if (isset($readonlys['n_fileas']))
2422
+		{
2423
+			$readonlys['fileas_type'] = $readonlys['n_fileas'];
2424
+		}
2210 2425
 		// disable not needed tabs
2211 2426
 		$readonlys['tabs']['cats'] = !($content['cat_tab'] = $this->config['cat_tab']);
2212 2427
 		$readonlys['tabs']['custom'] = !$this->customfields || $this->get_backend($content['id'],$content['owner']) == $this->so_accounts;
@@ -2214,8 +2429,14 @@  discard block
 block discarded – undo
2214 2429
 		$readonlys['tabs']['distribution_list'] = !$content['distrib_lists'];#false;
2215 2430
 		$readonlys['tabs']['history'] = $this->contact_repository != 'sql' || !$content['id'] ||
2216 2431
 			$this->account_repository != 'sql' && $content['account_id'];
2217
-		if (!$content['id']) $readonlys['button[delete]'] = !$content['id'];
2218
-		if ($this->config['private_cf_tab']) $content['no_private_cfs'] = 0;
2432
+		if (!$content['id'])
2433
+		{
2434
+			$readonlys['button[delete]'] = !$content['id'];
2435
+		}
2436
+		if ($this->config['private_cf_tab'])
2437
+		{
2438
+			$content['no_private_cfs'] = 0;
2439
+		}
2219 2440
 		$readonlys['change_org'] = empty($content['org_name']) || $view;
2220 2441
 
2221 2442
 		// for editing the own account (by a non-admin), enable only the fields allowed via the "own_account_acl"
@@ -2223,7 +2444,10 @@  discard block
 block discarded – undo
2223 2444
 		{
2224 2445
 			$this->_set_readonlys_for_own_account_acl($readonlys,$id);
2225 2446
 		}
2226
-		for($i = -23; $i<=23; $i++) $tz[$i] = ($i > 0 ? '+' : '').$i;
2447
+		for($i = -23; $i<=23; $i++)
2448
+		{
2449
+			$tz[$i] = ($i > 0 ? '+' : '').$i;
2450
+		}
2227 2451
 		$sel_options['tz'] = $tz;
2228 2452
 		$content['tz'] = $content['tz'] ? $content['tz'] : '0';
2229 2453
 		if (count($this->content_types) > 1)
@@ -2260,7 +2484,10 @@  discard block
 block discarded – undo
2260 2484
 
2261 2485
 		$content['photo'] = $this->photo_src($content['id'],$content['jpegphoto'],'photo',$content['etag']);
2262 2486
 
2263
-		if ($content['private']) $content['owner'] .= 'p';
2487
+		if ($content['private'])
2488
+		{
2489
+			$content['owner'] .= 'p';
2490
+		}
2264 2491
 
2265 2492
 		// for custom types, check if we have a custom edit template named "addressbook.edit.$type", $type is the name
2266 2493
 		if (in_array($content['tid'], array('n',self::DELETED_TYPE)) || !$this->tmpl->read('addressbook.edit.'.$this->content_types[$content['tid']]['name']))
@@ -2282,7 +2509,10 @@  discard block
 block discarded – undo
2282 2509
 		//error_log(__METHOD__."() hook_data=".array2string($hook_data));
2283 2510
 		foreach($hook_data as $extra_tabs)
2284 2511
 		{
2285
-			if (!$extra_tabs) continue;
2512
+			if (!$extra_tabs)
2513
+			{
2514
+				continue;
2515
+			}
2286 2516
 
2287 2517
 			foreach(isset($extra_tabs[0]) ? $extra_tabs : array($extra_tabs) as $extra_tab)
2288 2518
 			{
@@ -2299,7 +2529,10 @@  discard block
 block discarded – undo
2299 2529
 					$readonlys = array_merge($readonlys, $extra_tab['readonlys']);
2300 2530
 				}
2301 2531
 				// we must NOT add tabs and callbacks more then once!
2302
-				if (!$first_call) continue;
2532
+				if (!$first_call)
2533
+				{
2534
+					continue;
2535
+				}
2303 2536
 
2304 2537
 				if (!empty($extra_tab['pre_save_callback']))
2305 2538
 				{
@@ -2382,20 +2615,27 @@  discard block
 block discarded – undo
2382 2615
 	 */
2383 2616
 	public function ajax_check_values($values, $name, $own_id=0)
2384 2617
 	{
2385
-		if (preg_match('/^exec\[([^\]]+)\]$/', $name, $matches)) $name = $matches[1];	// remove exec[ ]
2618
+		if (preg_match('/^exec\[([^\]]+)\]$/', $name, $matches))
2619
+		{
2620
+			$name = $matches[1];
2621
+		}
2622
+		// remove exec[ ]
2386 2623
 
2387 2624
 		$ret = array('doublicates' => array(), 'msg' => null);
2388 2625
 
2389 2626
 		// if email changed, check for doublicates
2390 2627
 		if (in_array($name, array('email', 'email_home')))
2391 2628
 		{
2392
-			if (preg_match('/^'.url_widget::EMAIL_PREG.'$/i', $values[$name]))	// only search for real email addresses, to not return to many contacts
2629
+			if (preg_match('/^'.url_widget::EMAIL_PREG.'$/i', $values[$name]))
2630
+			{
2631
+				// only search for real email addresses, to not return to many contacts
2393 2632
 			{
2394 2633
 				$contacts = parent::search(array(
2395 2634
 					'email' => $values[$name],
2396 2635
 					'email_home' => $values[$name],
2397 2636
 				),$only_keys=false, $order_by='', $extra_cols='', $wildcard='', $empty=False, $op='OR');
2398 2637
 			}
2638
+			}
2399 2639
 		}
2400 2640
 		else
2401 2641
 		{
@@ -2409,10 +2649,13 @@  discard block
 block discarded – undo
2409 2649
 				!empty($values['n_given'])+!empty($values['n_family'])+!empty($values['org_name']) >= 2)
2410 2650
 			{
2411 2651
 				$filter = array();
2412
-				foreach(array('email', 'n_given', 'n_family', 'org_name') as $n)	// use email too, to exclude obvious false positives
2652
+				foreach(array('email', 'n_given', 'n_family', 'org_name') as $n)
2653
+				{
2654
+					// use email too, to exclude obvious false positives
2413 2655
 				{
2414 2656
 					if (!empty($values[$n])) $filter[$n] = $values[$n];
2415 2657
 				}
2658
+				}
2416 2659
 				$contacts = parent::search($criteria='', $only_keys=false, $order_by='', $extra_cols='', $wildcard='',
2417 2660
 					$empty=False, $op='AND', $start=false, $filter);
2418 2661
 			}
@@ -2421,7 +2664,10 @@  discard block
 block discarded – undo
2421 2664
 		{
2422 2665
 			foreach($contacts as $contact)
2423 2666
 			{
2424
-				if ($own_id && $contact['id'] == $own_id) continue;
2667
+				if ($own_id && $contact['id'] == $own_id)
2668
+				{
2669
+					continue;
2670
+				}
2425 2671
 
2426 2672
 				$ret['doublicates'][$contact['id']] = $this->fileas($contact).' ('.
2427 2673
 					(!$contact['owner'] ? lang('Accounts') : ($contact['owner'] == $this->user ?
@@ -2448,7 +2694,10 @@  discard block
 block discarded – undo
2448 2694
 		// CRM list comes from content, request, or preference
2449 2695
 		$crm_list = $content['crm_list'] ? $content['crm_list'] :
2450 2696
 			($_GET['crm_list'] ? $_GET['crm_list'] : $GLOBALS['egw_info']['user']['preferences']['addressbook']['crm_list']);
2451
-		if(!$crm_list || $crm_list == '~edit~') $crm_list = 'infolog';
2697
+		if(!$crm_list || $crm_list == '~edit~')
2698
+		{
2699
+			$crm_list = 'infolog';
2700
+		}
2452 2701
 
2453 2702
 		if(is_array($content))
2454 2703
 		{
@@ -2471,7 +2720,10 @@  discard block
 block discarded – undo
2471 2720
 					$inc = 1;
2472 2721
 					// fall through
2473 2722
 				case 'back':
2474
-					if (!isset($inc)) $inc = -1;
2723
+					if (!isset($inc))
2724
+					{
2725
+						$inc = -1;
2726
+					}
2475 2727
 					// get next/previous contact in selection
2476 2728
 					$query = egw_session::appsession('index', 'addressbook');
2477 2729
 					$query['start'] = $content['index'] + $inc;
@@ -2589,7 +2841,10 @@  discard block
 block discarded – undo
2589 2841
 
2590 2842
 		$sel_options['fileas_type'][$content['fileas_type']] = $this->fileas($content);
2591 2843
 		$sel_options['owner'] = $this->get_addressbooks();
2592
-		for($i = -23; $i<=23; $i++) $tz[$i] = ($i > 0 ? '+' : '').$i;
2844
+		for($i = -23; $i<=23; $i++)
2845
+		{
2846
+			$tz[$i] = ($i > 0 ? '+' : '').$i;
2847
+		}
2593 2848
 		$sel_options['tz'] = $tz;
2594 2849
 		$content['tz'] = $content['tz'] ? $content['tz'] : 0;
2595 2850
 		if (count($this->content_types) > 1)
@@ -2631,11 +2886,20 @@  discard block
 block discarded – undo
2631 2886
 		$readonlys['tabs']['distribution_list'] = !$content['distrib_lists'];#false;
2632 2887
 		$readonlys['tabs']['history'] = $this->contact_repository != 'sql' || !$content['id'] ||
2633 2888
 			$this->account_repository != 'sql' && $content['account_id'];
2634
-		if ($this->config['private_cf_tab']) $content['no_private_cfs'] = 0;
2889
+		if ($this->config['private_cf_tab'])
2890
+		{
2891
+			$content['no_private_cfs'] = 0;
2892
+		}
2635 2893
 
2636 2894
 		// last and next calendar date
2637
-		if (!empty($content['id'])) list(,$dates) = each($this->read_calendar(array($content['id']),false));
2638
-		if(is_array($dates)) $content += $dates;
2895
+		if (!empty($content['id']))
2896
+		{
2897
+			list(,$dates) = each($this->read_calendar(array($content['id']),false));
2898
+		}
2899
+		if(is_array($dates))
2900
+		{
2901
+			$content += $dates;
2902
+		}
2639 2903
 
2640 2904
 		// Disable importexport
2641 2905
 		$GLOBALS['egw_info']['flags']['disable_importexport']['export'] = true;
@@ -2714,7 +2978,10 @@  discard block
 block discarded – undo
2714 2978
 	 */
2715 2979
 	function email2link($email)
2716 2980
 	{
2717
-		if (strpos($email,'@') == false) return '';
2981
+		if (strpos($email,'@') == false)
2982
+		{
2983
+			return '';
2984
+		}
2718 2985
 
2719 2986
 		if($GLOBALS['egw_info']['user']['apps']['mail'])
2720 2987
 		{
@@ -2766,7 +3033,10 @@  discard block
 block discarded – undo
2766 3033
 				$query['advanced_search'] = array_intersect_key($_content,array_flip(array_merge($this->get_contact_columns(),array('operator','meth_select'))));
2767 3034
 				foreach ($query['advanced_search'] as $key => $value)
2768 3035
 				{
2769
-					if(!$value) unset($query['advanced_search'][$key]);
3036
+					if(!$value)
3037
+					{
3038
+						unset($query['advanced_search'][$key]);
3039
+					}
2770 3040
 				}
2771 3041
 				// Skip n_fn, it causes problems in sql
2772 3042
 				unset($query['advanced_search']['n_fn']);
@@ -2798,7 +3068,10 @@  discard block
 block discarded – undo
2798 3068
 		// Avoid ID conflict with tree & selectboxes
2799 3069
 		$content['cat_id_tree'] = $content['cat_id'];
2800 3070
 
2801
-		for($i = -23; $i<=23; $i++) $tz[$i] = ($i > 0 ? '+' : '').$i;
3071
+		for($i = -23; $i<=23; $i++)
3072
+		{
3073
+			$tz[$i] = ($i > 0 ? '+' : '').$i;
3074
+		}
2802 3075
 		$sel_options['tz'] = $tz + array('' => lang('doesn\'t matter'));
2803 3076
 		$sel_options['tid'][] = lang('all');
2804 3077
 		//foreach($this->content_types as $type => $data) $sel_options['tid'][$type] = $data['name'];
@@ -2819,8 +3092,14 @@  discard block
 block discarded – undo
2819 3092
 			{
2820 3093
 				if (substr($data['type'], 0, 6) == 'select' && !($data['rows'] > 1))
2821 3094
 				{
2822
-					if (!isset($content['#'.$name])) $content['#'.$name] = '';
2823
-					if(!isset($data['values'][''])) $sel_options['#'.$name][''] = lang('Select one');
3095
+					if (!isset($content['#'.$name]))
3096
+					{
3097
+						$content['#'.$name] = '';
3098
+					}
3099
+					if(!isset($data['values']['']))
3100
+					{
3101
+						$sel_options['#'.$name][''] = lang('Select one');
3102
+					}
2824 3103
 				}
2825 3104
 			}
2826 3105
 		}
@@ -2842,7 +3121,10 @@  discard block
 block discarded – undo
2842 3121
 		$content['no_tid'] = true;
2843 3122
 		$content['showsearchbuttons'] = true; // enable search operation and search buttons| they're disabled by default
2844 3123
 
2845
-		if ($this->config['private_cf_tab']) $content['no_private_cfs'] = 0;
3124
+		if ($this->config['private_cf_tab'])
3125
+		{
3126
+			$content['no_private_cfs'] = 0;
3127
+		}
2846 3128
 
2847 3129
 		$this->tmpl->read('addressbook.edit');
2848 3130
 		$this->tmpl->set_cell_attribute('change_org','disabled',true);
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2498,7 +2498,7 @@
 block discarded – undo
2498 2498
 							case 'infolog':
2499 2499
 							case 'tracker':
2500 2500
 							default:
2501
-								egw_json_response::get()->apply('app.addressbook.view_set_list',Array(Array('action'=>'addressbook', 'action_id' => $contact_id)));
2501
+								egw_json_response::get()->apply('app.addressbook.view_set_list',array(array('action'=>'addressbook', 'action_id' => $contact_id)));
2502 2502
 								break;
2503 2503
 						}
2504 2504
 
Please login to merge, or discard this patch.
login.php 4 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -168,7 +168,7 @@
 block discarded – undo
168 168
 	// some apache mod_auth_* modules use REMOTE_USER instead of PHP_AUTH_USER, thanks to Sylvain Beucler
169 169
 	if ($GLOBALS['egw_info']['server']['auth_type'] == 'http' && !isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['REMOTE_USER']))
170 170
 	{
171
-        	$_SERVER['PHP_AUTH_USER'] = $_SERVER['REMOTE_USER'];
171
+			$_SERVER['PHP_AUTH_USER'] = $_SERVER['REMOTE_USER'];
172 172
 	}
173 173
 	if($GLOBALS['egw_info']['server']['auth_type'] == 'http' && isset($_SERVER['PHP_AUTH_USER']))
174 174
 	{
Please login to merge, or discard this patch.
Braces   +10 added lines, -3 removed lines patch added patch discarded remove patch
@@ -365,14 +365,21 @@
 block discarded – undo
365 365
 				$extra_vars .= ($extra_vars ? '&' : '').'cd=yes';
366 366
 			}
367 367
 
368
-			if(strpos($_SERVER['HTTP_REFERER'], $_SERVER['REQUEST_URI']) === false) {
368
+			if(strpos($_SERVER['HTTP_REFERER'], $_SERVER['REQUEST_URI']) === false)
369
+			{
369 370
 				// login requuest does not come from login.php
370 371
 				// redirect to referer on logout
371 372
 				Api\Cache::setSession('login', 'referer', $_SERVER['HTTP_REFERER']);
372 373
 			}
373 374
 			$strength = ($GLOBALS['egw_info']['server']['force_pwd_strength']?$GLOBALS['egw_info']['server']['force_pwd_strength']:false);
374
-			if ($strength && $strength>5) $strength =5;
375
-			if ($strength && $strength<0) $strength = false;
375
+			if ($strength && $strength>5)
376
+			{
377
+				$strength =5;
378
+			}
379
+			if ($strength && $strength<0)
380
+			{
381
+				$strength = false;
382
+			}
376 383
 			// Check for save passwd
377 384
 			if($strength && $GLOBALS['egw_info']['server']['check_save_passwd'] && !$GLOBALS['egw']->acl->check('nopasswordchange', 1, 'preferences') &&
378 385
 				($unsave_msg = $GLOBALS['egw']->auth->crackcheck($passwd, $strength)))
Please login to merge, or discard this patch.
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -122,6 +122,9 @@
 block discarded – undo
122 122
 	   exit;
123 123
 	}
124 124
 
125
+	/**
126
+	 * @return string
127
+	 */
125 128
 	function check_logoutcode($code)
126 129
 	{
127 130
 		switch($code)
Please login to merge, or discard this patch.
Spacing   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @version $Id$
12 12
  */
13 13
 
14
-$submit = False;			// set to some initial value
14
+$submit = False; // set to some initial value
15 15
 
16 16
 $GLOBALS['egw_info'] = array('flags' => array(
17 17
 	'disable_Template_class'  => True,
@@ -19,10 +19,10 @@  discard block
 block discarded – undo
19 19
 	'currentapp'              => 'login',
20 20
 ));
21 21
 
22
-if(file_exists('./header.inc.php'))
22
+if (file_exists('./header.inc.php'))
23 23
 {
24 24
 	include('./header.inc.php');
25
-	if(!function_exists('CreateObject'))
25
+	if (!function_exists('CreateObject'))
26 26
 	{
27 27
 		Header('Location: setup/index.php');
28 28
 		exit;
@@ -38,17 +38,17 @@  discard block
 block discarded – undo
38 38
  * Destroy any existing anonymous session.
39 39
  * Copied from logout.php. Maybe make it a common function?
40 40
  */
41
-if(isset($GLOBALS['sitemgr_info']) && $GLOBALS['egw_info']['user']['userid'] == $GLOBALS['sitemgr_info']['anonymous_user'])
41
+if (isset($GLOBALS['sitemgr_info']) && $GLOBALS['egw_info']['user']['userid'] == $GLOBALS['sitemgr_info']['anonymous_user'])
42 42
 {
43
-	if($GLOBALS['egw']->session->verify())
43
+	if ($GLOBALS['egw']->session->verify())
44 44
 	{
45 45
 		$GLOBALS['egw']->hooks->process('logout');
46
-		$GLOBALS['egw']->session->destroy($GLOBALS['sessionid'],$GLOBALS['kp3']);
46
+		$GLOBALS['egw']->session->destroy($GLOBALS['sessionid'], $GLOBALS['kp3']);
47 47
 	}
48 48
 }
49 49
 
50 50
 // CAS :
51
-if($GLOBALS['egw_info']['server']['auth_type'] == 'cas')
51
+if ($GLOBALS['egw_info']['server']['auth_type'] == 'cas')
52 52
 {
53 53
 	ob_end_clean();
54 54
 
@@ -56,32 +56,32 @@  discard block
 block discarded – undo
56 56
 
57 57
 	//phpCAS::setDebug('/var/log/log_phpcas.php');
58 58
 
59
-	if($GLOBALS['egw_info']['server']['cas_authentication_mode'] == 'Proxy')
59
+	if ($GLOBALS['egw_info']['server']['cas_authentication_mode'] == 'Proxy')
60 60
 	{
61 61
 		phpCAS::proxy(CAS_VERSION_2_0,
62 62
 			$GLOBALS['egw_info']['server']['cas_server_host_name'],
63
-			(int) $GLOBALS['egw_info']['server']['cas_server_port'],
64
-			$GLOBALS['egw_info']['server']['cas_server_uri'] );
63
+			(int)$GLOBALS['egw_info']['server']['cas_server_port'],
64
+			$GLOBALS['egw_info']['server']['cas_server_uri']);
65 65
 	}
66 66
 	else
67 67
 	{
68 68
 		phpCAS::client(CAS_VERSION_2_0,
69 69
 			$GLOBALS['egw_info']['server']['cas_server_host_name'],
70
-			(int) $GLOBALS['egw_info']['server']['cas_server_port'],
71
-			$GLOBALS['egw_info']['server']['cas_server_uri'] );
70
+			(int)$GLOBALS['egw_info']['server']['cas_server_port'],
71
+			$GLOBALS['egw_info']['server']['cas_server_uri']);
72 72
 	}
73 73
 
74
-	if($GLOBALS['egw_info']['server']['cas_ssl_validation'] == 'PEMCertificate')
74
+	if ($GLOBALS['egw_info']['server']['cas_ssl_validation'] == 'PEMCertificate')
75 75
 	{
76 76
 		// Set the certificate of the CAS server (PEM Certificate)
77 77
 		phpCAS::setCasServerCert($GLOBALS['egw_info']['server']['cas_cert']);
78 78
 	}
79
-	elseif($GLOBALS['egw_info']['server']['cas_ssl_validation'] == 'CACertificate')
79
+	elseif ($GLOBALS['egw_info']['server']['cas_ssl_validation'] == 'CACertificate')
80 80
 	{
81 81
 		// Set the CA certificate of the CAS server
82 82
 		phpCAS::setCasServerCACert($GLOBALS['egw_info']['server']['cas_cert']);
83 83
 	}
84
-	elseif($GLOBALS['egw_info']['server']['cas_ssl_validation'] == 'No')
84
+	elseif ($GLOBALS['egw_info']['server']['cas_ssl_validation'] == 'No')
85 85
 	{
86 86
 		// no SSL validation for the CAS server
87 87
 		phpCAS::setNoCasServerValidation();
@@ -92,11 +92,11 @@  discard block
 block discarded – undo
92 92
 	ob_start();
93 93
 
94 94
 	$login = phpCAS::getUser();
95
-	$password = phpCAS::retrievePT("imap://".$GLOBALS['egw_info']['server']['mail_server'],$err_code,$output);
96
-	$GLOBALS['sessionid'] = $GLOBALS['egw']->session->create($login,$password,'text');
95
+	$password = phpCAS::retrievePT("imap://".$GLOBALS['egw_info']['server']['mail_server'], $err_code, $output);
96
+	$GLOBALS['sessionid'] = $GLOBALS['egw']->session->create($login, $password, 'text');
97 97
 
98 98
 	/* set auth_cookie */
99
-	$GLOBALS['egw']->redirect_link($forward,$extra_vars);
99
+	$GLOBALS['egw']->redirect_link($forward, $extra_vars);
100 100
 }
101 101
 else
102 102
 {
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	$GLOBALS['egw']->framework = egw_framework::factory();
117 117
 
118 118
 	// This is used for system downtime, to prevent new logins.
119
-	if($GLOBALS['egw_info']['server']['deny_all_logins'])
119
+	if ($GLOBALS['egw_info']['server']['deny_all_logins'])
120 120
 	{
121 121
 	   echo $GLOBALS['egw']->framework->denylogin_screen();
122 122
 	   exit;
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 
125 125
 	function check_logoutcode($code)
126 126
 	{
127
-		switch($code)
127
+		switch ($code)
128 128
 		{
129 129
 			case 1:
130 130
 				return lang('You have been successfully logged out');
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 	{
162 162
         	$_SERVER['PHP_AUTH_USER'] = $_SERVER['REMOTE_USER'];
163 163
 	}
164
-	if($GLOBALS['egw_info']['server']['auth_type'] == 'http' && isset($_SERVER['PHP_AUTH_USER']))
164
+	if ($GLOBALS['egw_info']['server']['auth_type'] == 'http' && isset($_SERVER['PHP_AUTH_USER']))
165 165
 	{
166 166
 		$submit = True;
167 167
 		$login  = $_SERVER['PHP_AUTH_USER'];
@@ -173,11 +173,11 @@  discard block
 block discarded – undo
173 173
 		$passwd = get_magic_quotes_gpc() ? stripslashes($_POST['passwd']) : $_POST['passwd'];
174 174
 		$passwd_type = $_POST['passwd_type'];
175 175
 
176
-		if($GLOBALS['egw_info']['server']['allow_cookie_auth'])
176
+		if ($GLOBALS['egw_info']['server']['allow_cookie_auth'])
177 177
 		{
178
-			$eGW_remember = explode('::::',get_magic_quotes_gpc() ? stripslashes($_COOKIE['eGW_remember']) : $_COOKIE['eGW_remember']);
178
+			$eGW_remember = explode('::::', get_magic_quotes_gpc() ? stripslashes($_COOKIE['eGW_remember']) : $_COOKIE['eGW_remember']);
179 179
 
180
-			if($eGW_remember[0] && $eGW_remember[1] && $eGW_remember[2])
180
+			if ($eGW_remember[0] && $eGW_remember[1] && $eGW_remember[2])
181 181
 			{
182 182
 				$_SERVER['PHP_AUTH_USER'] = $login = $eGW_remember[0];
183 183
 				$_SERVER['PHP_AUTH_PW'] = $passwd = $eGW_remember[1];
@@ -185,10 +185,10 @@  discard block
 block discarded – undo
185 185
 				$submit = True;
186 186
 			}
187 187
 		}
188
-		if(!$passwd && ($GLOBALS['egw_info']['server']['auto_anon_login']) && !$_GET['cd'])
188
+		if (!$passwd && ($GLOBALS['egw_info']['server']['auto_anon_login']) && !$_GET['cd'])
189 189
 		{
190 190
 			$_SERVER['PHP_AUTH_USER'] = $login = 'anonymous';
191
-			$_SERVER['PHP_AUTH_PW'] =  $passwd = 'anonymous';
191
+			$_SERVER['PHP_AUTH_PW'] = $passwd = 'anonymous';
192 192
 			$passwd_type = 'text';
193 193
 			$submit = True;
194 194
 		}
@@ -196,26 +196,26 @@  discard block
 block discarded – undo
196 196
 
197 197
 	# Apache + mod_ssl style SSL certificate authentication
198 198
 	# Certificate (chain) verification occurs inside mod_ssl
199
-	if($GLOBALS['egw_info']['server']['auth_type'] == 'sqlssl' && isset($_SERVER['SSL_CLIENT_S_DN']) && !isset($_GET['cd']))
199
+	if ($GLOBALS['egw_info']['server']['auth_type'] == 'sqlssl' && isset($_SERVER['SSL_CLIENT_S_DN']) && !isset($_GET['cd']))
200 200
 	{
201 201
 	   // an X.509 subject looks like:
202 202
 	   // CN=john.doe/OU=Department/O=Company/C=xx/[email protected]/L=City/
203 203
 	   // the username is deliberately lowercase, to ease LDAP integration
204
-	   $sslattribs = explode('/',$_SERVER['SSL_CLIENT_S_DN']);
204
+	   $sslattribs = explode('/', $_SERVER['SSL_CLIENT_S_DN']);
205 205
 	   # skip the part in front of the first '/' (nothing)
206
-	   while(($sslattrib = next($sslattribs)))
206
+	   while (($sslattrib = next($sslattribs)))
207 207
 	   {
208
-		  list($key,$val) = explode('=',$sslattrib);
208
+		  list($key, $val) = explode('=', $sslattrib);
209 209
 		  $sslattributes[$key] = $val;
210 210
 	   }
211 211
 
212
-	   if(isset($sslattributes['Email']))
212
+	   if (isset($sslattributes['Email']))
213 213
 	   {
214 214
 		  $submit = True;
215 215
 
216 216
 		  # login will be set here if the user logged out and uses a different username with
217 217
 		  # the same SSL-certificate.
218
-		  if(!isset($_POST['login'])&&isset($sslattributes['Email']))
218
+		  if (!isset($_POST['login']) && isset($sslattributes['Email']))
219 219
 		  {
220 220
 			 $login = $sslattributes['Email'];
221 221
 			 # not checked against the database, but delivered to authentication module
@@ -227,13 +227,13 @@  discard block
 block discarded – undo
227 227
 	   unset($sslattributes);
228 228
 	}
229 229
 
230
-	if(isset($passwd_type) || $_POST['submitit_x'] || $_POST['submitit_y'] || $submit)
230
+	if (isset($passwd_type) || $_POST['submitit_x'] || $_POST['submitit_y'] || $submit)
231 231
 	{
232
-		if(getenv('REQUEST_METHOD') != 'POST' && $_SERVER['REQUEST_METHOD'] != 'POST' &&
232
+		if (getenv('REQUEST_METHOD') != 'POST' && $_SERVER['REQUEST_METHOD'] != 'POST' &&
233 233
 			!isset($_SERVER['PHP_AUTH_USER']) && !isset($_SERVER['SSL_CLIENT_S_DN']))
234 234
 		{
235
-			$GLOBALS['egw']->session->egw_setcookie('eGW_remember','',0,'/');
236
-			egw::redirect_link('/login.php','cd=5');
235
+			$GLOBALS['egw']->session->egw_setcookie('eGW_remember', '', 0, '/');
236
+			egw::redirect_link('/login.php', 'cd=5');
237 237
 		}
238 238
 		/* cookie enabled check comment out, as it seems to cause a redirect loop under certain conditions and browsers :-(
239 239
 		if ($_COOKIE['eGW_cookie_test'] !== 'enabled')
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 		}*/
243 243
 
244 244
 		// don't get login data again when $submit is true
245
-		if($submit == false)
245
+		if ($submit == false)
246 246
 		{
247 247
 			$login = $_POST['login'];
248 248
 		}
@@ -250,14 +250,14 @@  discard block
 block discarded – undo
250 250
 		//conference - for strings like [email protected]@default , allows
251 251
 		//that user have a login that is his e-mail. (viniciuscb)
252 252
 		// remove blanks
253
-		$login_parts = array_map('trim',explode('@',$login));
254
-		$login = implode('@',$login_parts);
253
+		$login_parts = array_map('trim', explode('@', $login));
254
+		$login = implode('@', $login_parts);
255 255
 
256 256
 		$got_login = false;
257 257
 		if (count($login_parts) > 1)
258 258
 		{
259 259
 			//Last part of login string, when separated by @, is a domain name
260
-			if (array_key_exists(array_pop($login_parts),$GLOBALS['egw_domain']))
260
+			if (array_key_exists(array_pop($login_parts), $GLOBALS['egw_domain']))
261 261
 			{
262 262
 				$got_login = true;
263 263
 			}
@@ -265,17 +265,17 @@  discard block
 block discarded – undo
265 265
 
266 266
 		if (!$got_login)
267 267
 		{
268
-			if(isset($_POST['logindomain']))
268
+			if (isset($_POST['logindomain']))
269 269
 			{
270
-				$login .= '@' . $_POST['logindomain'];
270
+				$login .= '@'.$_POST['logindomain'];
271 271
 			}
272
-			elseif(!isset($GLOBALS['egw_domain'][$GLOBALS['egw_info']['user']['domain']]))
272
+			elseif (!isset($GLOBALS['egw_domain'][$GLOBALS['egw_info']['user']['domain']]))
273 273
 			{
274 274
 				$login .= '@'.$GLOBALS['egw_info']['server']['default_domain'];
275 275
 			}
276 276
 		}
277 277
 		$GLOBALS['sessionid'] = $GLOBALS['egw']->session->create($login, $passwd,
278
-			$passwd_type, false, true, true);	// true = let session fail on forced password change
278
+			$passwd_type, false, true, true); // true = let session fail on forced password change
279 279
 
280 280
 		if (!$GLOBALS['sessionid'] && $GLOBALS['egw']->session->cd_reason == egw_session::CD_FORCE_PASSWORD_CHANGE)
281 281
 		{
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 				}
288 288
 				else
289 289
 				{
290
-					$GLOBALS['sessionid'] = $GLOBALS['egw']->session->create($login,$_POST['new_passwd'],$passwd_type);
290
+					$GLOBALS['sessionid'] = $GLOBALS['egw']->session->create($login, $_POST['new_passwd'], $passwd_type);
291 291
 				}
292 292
 			}
293 293
 			else
@@ -299,46 +299,46 @@  discard block
 block discarded – undo
299 299
 		{
300 300
 			// will show new login-screen incl. new password field below
301 301
 		}
302
-		elseif (!isset($GLOBALS['sessionid']) || ! $GLOBALS['sessionid'])
302
+		elseif (!isset($GLOBALS['sessionid']) || !$GLOBALS['sessionid'])
303 303
 		{
304
-			$GLOBALS['egw']->session->egw_setcookie('eGW_remember','',0,'/');
305
-			egw::redirect_link('/login.php?cd=' . $GLOBALS['egw']->session->cd_reason);
304
+			$GLOBALS['egw']->session->egw_setcookie('eGW_remember', '', 0, '/');
305
+			egw::redirect_link('/login.php?cd='.$GLOBALS['egw']->session->cd_reason);
306 306
 		}
307 307
 		else
308 308
 		{
309 309
 			/* set auth_cookie  */
310
-			if($GLOBALS['egw_info']['server']['allow_cookie_auth'] && $_POST['remember_me'] && $_POST['passwd'])
310
+			if ($GLOBALS['egw_info']['server']['allow_cookie_auth'] && $_POST['remember_me'] && $_POST['passwd'])
311 311
 			{
312 312
 				switch ($_POST['remember_me'])
313 313
 				{
314 314
 					case '1hour' :
315
-						$remember_time = time()+60*60;
315
+						$remember_time = time() + 60 * 60;
316 316
 						break;
317 317
 					case '1day' :
318
-						$remember_time = time()+60*60*24;
318
+						$remember_time = time() + 60 * 60 * 24;
319 319
 						break;
320 320
 					case '1week' :
321
-						$remember_time = time()+60*60*24*7;
321
+						$remember_time = time() + 60 * 60 * 24 * 7;
322 322
 						break;
323 323
 					case '1month' :
324
-						$remember_time = time()+60*60*24*30;
324
+						$remember_time = time() + 60 * 60 * 24 * 30;
325 325
 						break;
326 326
 					case 'forever' :
327 327
 					default:
328 328
 						$remember_time = 2147483647;
329 329
 						break;
330 330
 				}
331
-				$GLOBALS['egw']->session->egw_setcookie('eGW_remember',implode('::::',array(
331
+				$GLOBALS['egw']->session->egw_setcookie('eGW_remember', implode('::::', array(
332 332
 					'login' => $login,
333 333
 					'passwd' => $passwd,
334 334
 					'passwd_type' => $passwd_type)),
335
-					$remember_time,'/');	// make the cookie valid for the whole site (incl. sitemgr) and not only the eGW install-dir
335
+					$remember_time, '/'); // make the cookie valid for the whole site (incl. sitemgr) and not only the eGW install-dir
336 336
 			}
337 337
 
338
-			if ($_POST['lang'] && preg_match('/^[a-z]{2}(-[a-z]{2})?$/',$_POST['lang']) &&
338
+			if ($_POST['lang'] && preg_match('/^[a-z]{2}(-[a-z]{2})?$/', $_POST['lang']) &&
339 339
 				$_POST['lang'] != $GLOBALS['egw_info']['user']['preferences']['common']['lang'])
340 340
 			{
341
-				$GLOBALS['egw']->preferences->add('common','lang',$_POST['lang'],'session');
341
+				$GLOBALS['egw']->preferences->add('common', 'lang', $_POST['lang'], 'session');
342 342
 			}
343 343
 
344 344
 			// check if new translations are available
@@ -352,27 +352,27 @@  discard block
 block discarded – undo
352 352
 			}
353 353
 			else
354 354
 			{
355
-				list($forward,$extra_vars) = explode('?',$forward,2);
355
+				list($forward, $extra_vars) = explode('?', $forward, 2);
356 356
 				$extra_vars .= ($extra_vars ? '&' : '').'cd=yes';
357 357
 			}
358 358
 
359
-			if(strpos($_SERVER['HTTP_REFERER'], $_SERVER['REQUEST_URI']) === false) {
359
+			if (strpos($_SERVER['HTTP_REFERER'], $_SERVER['REQUEST_URI']) === false) {
360 360
 				// login requuest does not come from login.php
361 361
 				// redirect to referer on logout
362 362
 				$GLOBALS['egw']->session->appsession('referer', 'login', $_SERVER['HTTP_REFERER']);
363 363
 			}
364
-			$strength = ($GLOBALS['egw_info']['server']['force_pwd_strength']?$GLOBALS['egw_info']['server']['force_pwd_strength']:false);
365
-			if ($strength && $strength>5) $strength =5;
366
-			if ($strength && $strength<0) $strength = false;
364
+			$strength = ($GLOBALS['egw_info']['server']['force_pwd_strength'] ? $GLOBALS['egw_info']['server']['force_pwd_strength'] : false);
365
+			if ($strength && $strength > 5) $strength = 5;
366
+			if ($strength && $strength < 0) $strength = false;
367 367
 			// Check for save passwd
368
-			if($strength && $GLOBALS['egw_info']['server']['check_save_passwd'] && !$GLOBALS['egw']->acl->check('nopasswordchange', 1, 'preferences') &&
368
+			if ($strength && $GLOBALS['egw_info']['server']['check_save_passwd'] && !$GLOBALS['egw']->acl->check('nopasswordchange', 1, 'preferences') &&
369 369
 				($unsave_msg = $GLOBALS['egw']->auth->crackcheck($passwd, $strength)))
370 370
 			{
371
-				error_log('login::'.__LINE__.' User '. $login. ' authenticated with an unsave password'.' '.$unsave_msg);
371
+				error_log('login::'.__LINE__.' User '.$login.' authenticated with an unsave password'.' '.$unsave_msg);
372 372
 				$message = lang('eGroupWare checked your password for safetyness. You have to change your password for the following reason:')."\n";
373 373
 				egw::redirect_link('/index.php', array(
374 374
 					'menuaction' => 'preferences.uipassword.change',
375
-					'message' => $message . $unsave_msg,
375
+					'message' => $message.$unsave_msg,
376 376
 					'cd' => 'yes',
377 377
 				));
378 378
 			}
@@ -380,66 +380,66 @@  discard block
 block discarded – undo
380 380
 			{
381 381
 				// commiting the session, before redirecting might fix racecondition in session creation
382 382
 				$GLOBALS['egw']->session->commit_session();
383
-				egw::redirect_link($forward,$extra_vars);
383
+				egw::redirect_link($forward, $extra_vars);
384 384
 			}
385 385
 		}
386 386
 	}
387 387
 	// show login screen
388
-	if(isset($_COOKIE['last_loginid']))
388
+	if (isset($_COOKIE['last_loginid']))
389 389
 	{
390 390
 		$prefs = new preferences($GLOBALS['egw']->accounts->name2id($_COOKIE['last_loginid']));
391 391
 
392
-		if($prefs->account_id)
392
+		if ($prefs->account_id)
393 393
 		{
394 394
 			$GLOBALS['egw_info']['user']['preferences'] = $prefs->read_repository();
395 395
 		}
396 396
 	}
397
-	if ($_GET['lang'] && preg_match('/^[a-z]{2}(-[a-z]{2})?$/',$_GET['lang']))
397
+	if ($_GET['lang'] && preg_match('/^[a-z]{2}(-[a-z]{2})?$/', $_GET['lang']))
398 398
 	{
399 399
 		$GLOBALS['egw_info']['user']['preferences']['common']['lang'] = $_GET['lang'];
400 400
 	}
401
-	elseif(!isset($_COOKIE['last_loginid']) || !$prefs->account_id)
401
+	elseif (!isset($_COOKIE['last_loginid']) || !$prefs->account_id)
402 402
 	{
403 403
 		// If the lastloginid cookies isn't set, we will default to the first language,
404 404
 		// the users browser accepts.
405
-		list($lang) = explode(',',$_SERVER['HTTP_ACCEPT_LANGUAGE']);
406
-		if(strlen($lang) > 2)
405
+		list($lang) = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
406
+		if (strlen($lang) > 2)
407 407
 		{
408
-			$lang = substr($lang,0,2);
408
+			$lang = substr($lang, 0, 2);
409 409
 		}
410 410
 		$GLOBALS['egw_info']['user']['preferences']['common']['lang'] = $lang;
411 411
 	}
412 412
 	if ($_COOKIE['eGW_cookie_test'] !== 'enabled')
413 413
 	{
414
-		egw_session::egw_setcookie('eGW_cookie_test','enabled',0);
414
+		egw_session::egw_setcookie('eGW_cookie_test', 'enabled', 0);
415 415
 	}
416 416
 	#print 'LANG:' . $GLOBALS['egw_info']['user']['preferences']['common']['lang'] . '<br>';
417
-	translation::init();	// this will set the language according to the (new) set prefs
417
+	translation::init(); // this will set the language according to the (new) set prefs
418 418
 	translation::add_app('login');
419 419
 	translation::add_app('loginscreen');
420
-	$GLOBALS['loginscreenmessage'] = translation::translate('loginscreen_message',false,'');
421
-	if($GLOBALS['loginscreenmessage'] == 'loginscreen_message' || empty($GLOBALS['loginscreenmessage']))
420
+	$GLOBALS['loginscreenmessage'] = translation::translate('loginscreen_message', false, '');
421
+	if ($GLOBALS['loginscreenmessage'] == 'loginscreen_message' || empty($GLOBALS['loginscreenmessage']))
422 422
 	{
423
-		translation::add_app('loginscreen','en');	// trying the en one
424
-		$GLOBALS['loginscreenmessage'] = translation::translate('loginscreen_message',false,'');
423
+		translation::add_app('loginscreen', 'en'); // trying the en one
424
+		$GLOBALS['loginscreenmessage'] = translation::translate('loginscreen_message', false, '');
425 425
 	}
426
-	if($GLOBALS['loginscreenmessage'] == 'loginscreen_message' || empty($GLOBALS['loginscreenmessage']))
426
+	if ($GLOBALS['loginscreenmessage'] == 'loginscreen_message' || empty($GLOBALS['loginscreenmessage']))
427 427
 	{
428 428
 	   // remove the global var since the lang loginscreen message and its fallback (en) is empty or not set
429 429
 	   unset($GLOBALS['loginscreenmessage']);
430 430
 	}
431 431
 
432
-	foreach($_GET as $name => $value)
432
+	foreach ($_GET as $name => $value)
433 433
 	{
434
-		if(strpos($name,'phpgw_') !== false)
434
+		if (strpos($name, 'phpgw_') !== false)
435 435
 		{
436
-			$extra_vars .= '&' . $name . '=' . urlencode($value);
436
+			$extra_vars .= '&'.$name.'='.urlencode($value);
437 437
 		}
438 438
 	}
439 439
 
440
-	if($extra_vars)
440
+	if ($extra_vars)
441 441
 	{
442
-		$extra_vars = '?' . substr($extra_vars,1);
442
+		$extra_vars = '?'.substr($extra_vars, 1);
443 443
 	}
444 444
 
445 445
 	$GLOBALS['egw']->framework->login_screen($extra_vars, $force_password_change);
Please login to merge, or discard this patch.
index.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,8 +19,8 @@
 block discarded – undo
19 19
 // or an uncoditional redirect to this file or copy groupdav.htaccess to your docroot as .htaccess
20 20
 if ($_SERVER['REQUEST_METHOD'] == 'PROPFIND' || $_SERVER['REQUEST_METHOD'] == 'OPTIONS')
21 21
 {
22
-        header('Location: groupdav.php/');
23
-        exit;
22
+		header('Location: groupdav.php/');
23
+		exit;
24 24
 }
25 25
 
26 26
 // forward for not existing or empty header to setup
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -20,13 +20,13 @@  discard block
 block discarded – undo
20 20
 }
21 21
 
22 22
 // forward for not existing or empty header to setup
23
-if(!file_exists('header.inc.php') || !filesize('header.inc.php'))
23
+if (!file_exists('header.inc.php') || !filesize('header.inc.php'))
24 24
 {
25 25
 	Header('Location: setup/index.php');
26 26
 	exit;
27 27
 }
28 28
 
29
-if(isset($_GET['hasupdates']) && $_GET['hasupdates'] == 'yes')
29
+if (isset($_GET['hasupdates']) && $_GET['hasupdates'] == 'yes')
30 30
 {
31 31
 	$hasupdates = True;
32 32
 }
@@ -34,10 +34,10 @@  discard block
 block discarded – undo
34 34
 /*
35 35
 	This is the menuaction driver for the multi-layered design
36 36
 */
37
-if(isset($_GET['menuaction']) && preg_match('/^[A-Za-z0-9_]+\.[A-Za-z0-9_]+\.[A-Za-z0-9_]+$/',$_GET['menuaction']))
37
+if (isset($_GET['menuaction']) && preg_match('/^[A-Za-z0-9_]+\.[A-Za-z0-9_]+\.[A-Za-z0-9_]+$/', $_GET['menuaction']))
38 38
 {
39
-	list($app,$class,$method) = explode('.',$_GET['menuaction']);
40
-	if(! $app || ! $class || ! $method)
39
+	list($app, $class, $method) = explode('.', $_GET['menuaction']);
40
+	if (!$app || !$class || !$method)
41 41
 	{
42 42
 		$invalid_data = True;
43 43
 	}
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	$invalid_data = True;
49 49
 }
50 50
 //error_log(__METHOD__."$app,$class,$method");
51
-if($app == 'phpgwapi')
51
+if ($app == 'phpgwapi')
52 52
 {
53 53
 	$app = 'home';
54 54
 	$api_requested = True;
@@ -64,14 +64,14 @@  discard block
 block discarded – undo
64 64
 include('./header.inc.php');
65 65
 // check if users are supposed to change their password every x sdays, then check if password is of old age or the devil-admin reset the users password
66 66
 // and forced the user to change his password on next login.
67
-auth::check_password_age($app,$class,$method);
67
+auth::check_password_age($app, $class, $method);
68 68
 
69 69
 // user changed timezone
70 70
 if (isset($_GET['tz']))
71 71
 {
72
-	egw_time::setUserPrefs($_GET['tz']);	// throws exception, if tz is invalid
72
+	egw_time::setUserPrefs($_GET['tz']); // throws exception, if tz is invalid
73 73
 
74
-	$GLOBALS['egw']->preferences->add('common','tz',$_GET['tz']);
74
+	$GLOBALS['egw']->preferences->add('common', 'tz', $_GET['tz']);
75 75
 	$GLOBALS['egw']->preferences->save_repository();
76 76
 
77 77
 	if (($referer = common::get_referer()))
@@ -82,30 +82,30 @@  discard block
 block discarded – undo
82 82
 
83 83
 // 	Check if we are using windows or normal webpage
84 84
 $windowed = false;
85
-$tpl_info = EGW_SERVER_ROOT . '/phpgwapi/templates/' . basename($GLOBALS['egw_info']['user']['preferences']['common']['template_set']) . '/setup/setup.inc.php';
85
+$tpl_info = EGW_SERVER_ROOT.'/phpgwapi/templates/'.basename($GLOBALS['egw_info']['user']['preferences']['common']['template_set']).'/setup/setup.inc.php';
86 86
 if (!file_exists($tpl_info))
87 87
 {
88
-	$tpl_info = EGW_SERVER_ROOT.'/'.basename($GLOBALS['egw_info']['user']['preferences']['common']['template_set']) . '/setup/setup.inc.php';
88
+	$tpl_info = EGW_SERVER_ROOT.'/'.basename($GLOBALS['egw_info']['user']['preferences']['common']['template_set']).'/setup/setup.inc.php';
89 89
 }
90
-if(@file_exists($tpl_info))
90
+if (@file_exists($tpl_info))
91 91
 {
92 92
 	include_once($tpl_info);
93
-	if($GLOBALS['egw_info']['template'][$GLOBALS['egw_info']['user']['preferences']['common']['template_set']]['windowed'])
93
+	if ($GLOBALS['egw_info']['template'][$GLOBALS['egw_info']['user']['preferences']['common']['template_set']]['windowed'])
94 94
 	{
95 95
 		$windowed = true;
96 96
 	}
97 97
 }
98 98
 
99 99
 
100
-if($app == 'home' && !$class && !$api_requested && !($windowed && $_GET['cd'] == 'yes' && !html::$ua_mobile))
100
+if ($app == 'home' && !$class && !$api_requested && !($windowed && $_GET['cd'] == 'yes' && !html::$ua_mobile))
101 101
 {
102 102
 	if ($GLOBALS['egw_info']['server']['force_default_app'] && $GLOBALS['egw_info']['server']['force_default_app'] != 'user_choice')
103 103
 	{
104 104
 		$GLOBALS['egw_info']['user']['preferences']['common']['default_app'] = $GLOBALS['egw_info']['server']['force_default_app'];
105 105
 	}
106
-	if($GLOBALS['egw_info']['user']['preferences']['common']['default_app'] && !$hasupdates)
106
+	if ($GLOBALS['egw_info']['user']['preferences']['common']['default_app'] && !$hasupdates)
107 107
 	{
108
-		egw::redirect(egw_framework::index($GLOBALS['egw_info']['user']['preferences']['common']['default_app']),$GLOBALS['egw_info']['user']['preferences']['common']['default_app']);
108
+		egw::redirect(egw_framework::index($GLOBALS['egw_info']['user']['preferences']['common']['default_app']), $GLOBALS['egw_info']['user']['preferences']['common']['default_app']);
109 109
 	}
110 110
 	else
111 111
 	{
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	}
114 114
 }
115 115
 
116
-if($windowed && $_GET['cd'] == 'yes')
116
+if ($windowed && $_GET['cd'] == 'yes')
117 117
 {
118 118
 	$GLOBALS['egw_info']['flags'] = array(
119 119
 		'noheader'   => False,
@@ -125,13 +125,13 @@  discard block
 block discarded – undo
125 125
 }
126 126
 else
127 127
 {
128
-	if($api_requested)
128
+	if ($api_requested)
129 129
 	{
130 130
 		$app = 'phpgwapi';
131 131
 	}
132 132
 
133 133
 	$obj = CreateObject($app.'.'.$class);
134
-	if((is_array($obj->public_functions) && $obj->public_functions[$method]) && !$invalid_data)
134
+	if ((is_array($obj->public_functions) && $obj->public_functions[$method]) && !$invalid_data)
135 135
 	{
136 136
 		$obj->$method();
137 137
 		unset($app);
@@ -142,9 +142,9 @@  discard block
 block discarded – undo
142 142
 	}
143 143
 	else
144 144
 	{
145
-		if(!$app || !$class || !$method || $invalid_data)
145
+		if (!$app || !$class || !$method || $invalid_data)
146 146
 		{
147
-			if(@is_object($GLOBALS['egw']->log))
147
+			if (@is_object($GLOBALS['egw']->log))
148 148
 			{
149 149
 				$GLOBALS['egw']->log->message(array(
150 150
 					'text' => 'W-BadmenuactionVariable, menuaction missing or corrupt: %1',
@@ -155,9 +155,9 @@  discard block
 block discarded – undo
155 155
 			}
156 156
 		}
157 157
 
158
-		if(!is_array($GLOBALS[$class]->public_functions) || !$GLOBALS[$class]->public_functions[$method] && $method)
158
+		if (!is_array($GLOBALS[$class]->public_functions) || !$GLOBALS[$class]->public_functions[$method] && $method)
159 159
 		{
160
-			if(@is_object($GLOBALS['egw']->log))
160
+			if (@is_object($GLOBALS['egw']->log))
161 161
 			{
162 162
 				$GLOBALS['egw']->log->message(array(
163 163
 					'text' => 'W-BadmenuactionVariable, attempted to access private method: %1',
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 				));
168 168
 			}
169 169
 		}
170
-		if(@is_object($GLOBALS['egw']->log))
170
+		if (@is_object($GLOBALS['egw']->log))
171 171
 		{
172 172
 			$GLOBALS['egw']->log->commit();
173 173
 		}
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 		$GLOBALS['egw']->redirect_link('/home/index.php');
176 176
 	}
177 177
 
178
-	if(!isset($GLOBALS['egw_info']['nofooter']))
178
+	if (!isset($GLOBALS['egw_info']['nofooter']))
179 179
 	{
180 180
 		common::egw_footer();
181 181
 	}
Please login to merge, or discard this patch.
infolog/setup/setup.inc.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,16 +14,16 @@
 block discarded – undo
14 14
 $setup_info['infolog']['name']      = 'infolog';
15 15
 $setup_info['infolog']['version']   = '16.1';
16 16
 $setup_info['infolog']['app_order'] = 5;
17
-$setup_info['infolog']['tables']    = array('egw_infolog','egw_infolog_extra');
17
+$setup_info['infolog']['tables']    = array('egw_infolog', 'egw_infolog_extra');
18 18
 $setup_info['infolog']['enable']    = 1;
19
-$setup_info['infolog']['index']    = 'infolog.infolog_ui.index&ajax=true';
19
+$setup_info['infolog']['index'] = 'infolog.infolog_ui.index&ajax=true';
20 20
 
21 21
 $setup_info['infolog']['author'] =
22 22
 $setup_info['infolog']['maintainer'] = array(
23 23
 	'name'  => 'Ralf Becker',
24 24
 	'email' => '[email protected]'
25 25
 );
26
-$setup_info['infolog']['license']  = 'GPL';
26
+$setup_info['infolog']['license'] = 'GPL';
27 27
 $setup_info['infolog']['description'] =
28 28
 	'<p><b>CRM</b> (customer-relation-management) type app using Addressbook providing
29 29
 	Todo List, Notes and Phonelog. <b>InfoLog</b> is orininaly based on eGroupWare\'s
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,11 +47,11 @@
 block discarded – undo
47 47
 /* Dependencies for this app to work */
48 48
 $setup_info['admin']['depends'][] = array(
49 49
 	'appname' => 'phpgwapi',
50
-	'versions' => Array('14.1')
50
+	'versions' => array('14.1')
51 51
 );
52 52
 $setup_info['admin']['depends'][] = array(
53 53
 	'appname' => 'etemplate',
54
-	'versions' => Array('14.1')
54
+	'versions' => array('14.1')
55 55
 );
56 56
 
57 57
 
Please login to merge, or discard this patch.
infolog/setup/tables_current.inc.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -14,53 +14,53 @@
 block discarded – undo
14 14
 $phpgw_baseline = array(
15 15
 	'egw_infolog' => array(
16 16
 		'fd' => array(
17
-			'info_id' => array('type' => 'auto','nullable' => False,'comment' => 'id of the infolog-entry'),
18
-			'info_type' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => 'task','comment' => 'infolog-type e.g. task, phone, email or note'),
19
-			'info_from' => array('type' => 'varchar','precision' => '255','comment' => 'text of the primary link'),
20
-			'info_addr' => array('type' => 'varchar','precision' => '255','comment' => 'textfield for phone-number or email of the primary contact'),
21
-			'info_subject' => array('type' => 'varchar','precision' => '255','comment' => 'title of the infolog-entry'),
22
-			'info_des' => array('type' => 'text','comment' => 'desciption of the infolog-entry'),
23
-			'info_owner' => array('type' => 'int','meta' => 'account','precision' => '4','nullable' => False,'comment' => 'owner of the entry, can be account or group'),
24
-			'info_responsible' => array('type' => 'ascii','meta' => 'account-commasep','precision' => '255','nullable' => False,'default' => '0','comment' => 'responsible users or groups (multiple)'),
25
-			'info_access' => array('type' => 'ascii','precision' => '10','default' => 'public','comment' => 'public or privat'),
26
-			'info_cat' => array('type' => 'int','meta' => 'category','precision' => '4','nullable' => False,'default' => '0','comment' => 'category id'),
27
-			'info_datemodified' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False,'comment' => 'timestamp of the last mofification'),
28
-			'info_startdate' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False,'default' => '0','comment' => 'timestamp of the startdate'),
29
-			'info_enddate' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False,'default' => '0','comment' => 'timestamp of the enddate'),
30
-			'info_id_parent' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0','comment' => 'id of the parent infolog'),
31
-			'info_planned_time' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0','comment' => 'pm-field: planned time'),
32
-			'info_replanned_time' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0','comment' => 'pm-field: replanned time'),
33
-			'info_used_time' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0','comment' => 'pm-field: used time'),
34
-			'info_status' => array('type' => 'varchar','precision' => '40','default' => 'done','comment' => 'status e.g. ongoing, done ...'),
35
-			'info_confirm' => array('type' => 'ascii','precision' => '10','default' => 'not'),
36
-			'info_modifier' => array('type' => 'int','meta' => 'user','precision' => '4','nullable' => False,'default' => '0','comment' => 'account id of the last modifier'),
37
-			'info_link_id' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0','comment' => 'id of the primary link'),
38
-			'info_priority' => array('type' => 'int','precision' => '2','default' => '1','comment' => '0=Low, 1=Normal, 2=High, 3=Urgent'),
39
-			'pl_id' => array('type' => 'int','precision' => '4','comment' => 'pm-field: id of the pricelist'),
40
-			'info_price' => array('type' => 'float','precision' => '8','comment' => 'pm-field: price-field'),
41
-			'info_percent' => array('type' => 'int','meta' => 'percent','precision' => '2','default' => '0','comment' => 'percentage of completion'),
42
-			'info_datecompleted' => array('type' => 'int','meta' => 'timestamp','precision' => '8','comment' => 'timestamp of completion'),
43
-			'info_location' => array('type' => 'varchar','precision' => '255','comment' => 'textfield location'),
44
-			'info_custom_from' => array('type' => 'int','precision' => '1','comment' => 'tick-box to show infolog_from'),
45
-			'info_uid' => array('type' => 'ascii','precision' => '128','comment' => 'unique id of the infolog-entry'),
46
-			'info_cc' => array('type' => 'varchar','precision' => '255','comment' => 'textfield for email-adress to be notified via email of changes'),
47
-			'caldav_name' => array('type' => 'ascii','precision' => '128','comment' => 'name part of CalDAV URL, if specified by client'),
48
-			'info_etag' => array('type' => 'int','precision' => '4','default' => '0','comment' => 'etag, not yet used'),
49
-			'info_created' => array('type' => 'int','meta' => 'timestamp','precision' => '8','comment' => 'timestamp of the creation date'),
50
-			'info_creator' => array('type' => 'int','meta' => 'user','precision' => '4','comment' => 'account id of the creator')
17
+			'info_id' => array('type' => 'auto', 'nullable' => False, 'comment' => 'id of the infolog-entry'),
18
+			'info_type' => array('type' => 'varchar', 'precision' => '40', 'nullable' => False, 'default' => 'task', 'comment' => 'infolog-type e.g. task, phone, email or note'),
19
+			'info_from' => array('type' => 'varchar', 'precision' => '255', 'comment' => 'text of the primary link'),
20
+			'info_addr' => array('type' => 'varchar', 'precision' => '255', 'comment' => 'textfield for phone-number or email of the primary contact'),
21
+			'info_subject' => array('type' => 'varchar', 'precision' => '255', 'comment' => 'title of the infolog-entry'),
22
+			'info_des' => array('type' => 'text', 'comment' => 'desciption of the infolog-entry'),
23
+			'info_owner' => array('type' => 'int', 'meta' => 'account', 'precision' => '4', 'nullable' => False, 'comment' => 'owner of the entry, can be account or group'),
24
+			'info_responsible' => array('type' => 'ascii', 'meta' => 'account-commasep', 'precision' => '255', 'nullable' => False, 'default' => '0', 'comment' => 'responsible users or groups (multiple)'),
25
+			'info_access' => array('type' => 'ascii', 'precision' => '10', 'default' => 'public', 'comment' => 'public or privat'),
26
+			'info_cat' => array('type' => 'int', 'meta' => 'category', 'precision' => '4', 'nullable' => False, 'default' => '0', 'comment' => 'category id'),
27
+			'info_datemodified' => array('type' => 'int', 'meta' => 'timestamp', 'precision' => '8', 'nullable' => False, 'comment' => 'timestamp of the last mofification'),
28
+			'info_startdate' => array('type' => 'int', 'meta' => 'timestamp', 'precision' => '8', 'nullable' => False, 'default' => '0', 'comment' => 'timestamp of the startdate'),
29
+			'info_enddate' => array('type' => 'int', 'meta' => 'timestamp', 'precision' => '8', 'nullable' => False, 'default' => '0', 'comment' => 'timestamp of the enddate'),
30
+			'info_id_parent' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0', 'comment' => 'id of the parent infolog'),
31
+			'info_planned_time' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0', 'comment' => 'pm-field: planned time'),
32
+			'info_replanned_time' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0', 'comment' => 'pm-field: replanned time'),
33
+			'info_used_time' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0', 'comment' => 'pm-field: used time'),
34
+			'info_status' => array('type' => 'varchar', 'precision' => '40', 'default' => 'done', 'comment' => 'status e.g. ongoing, done ...'),
35
+			'info_confirm' => array('type' => 'ascii', 'precision' => '10', 'default' => 'not'),
36
+			'info_modifier' => array('type' => 'int', 'meta' => 'user', 'precision' => '4', 'nullable' => False, 'default' => '0', 'comment' => 'account id of the last modifier'),
37
+			'info_link_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0', 'comment' => 'id of the primary link'),
38
+			'info_priority' => array('type' => 'int', 'precision' => '2', 'default' => '1', 'comment' => '0=Low, 1=Normal, 2=High, 3=Urgent'),
39
+			'pl_id' => array('type' => 'int', 'precision' => '4', 'comment' => 'pm-field: id of the pricelist'),
40
+			'info_price' => array('type' => 'float', 'precision' => '8', 'comment' => 'pm-field: price-field'),
41
+			'info_percent' => array('type' => 'int', 'meta' => 'percent', 'precision' => '2', 'default' => '0', 'comment' => 'percentage of completion'),
42
+			'info_datecompleted' => array('type' => 'int', 'meta' => 'timestamp', 'precision' => '8', 'comment' => 'timestamp of completion'),
43
+			'info_location' => array('type' => 'varchar', 'precision' => '255', 'comment' => 'textfield location'),
44
+			'info_custom_from' => array('type' => 'int', 'precision' => '1', 'comment' => 'tick-box to show infolog_from'),
45
+			'info_uid' => array('type' => 'ascii', 'precision' => '128', 'comment' => 'unique id of the infolog-entry'),
46
+			'info_cc' => array('type' => 'varchar', 'precision' => '255', 'comment' => 'textfield for email-adress to be notified via email of changes'),
47
+			'caldav_name' => array('type' => 'ascii', 'precision' => '128', 'comment' => 'name part of CalDAV URL, if specified by client'),
48
+			'info_etag' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'comment' => 'etag, not yet used'),
49
+			'info_created' => array('type' => 'int', 'meta' => 'timestamp', 'precision' => '8', 'comment' => 'timestamp of the creation date'),
50
+			'info_creator' => array('type' => 'int', 'meta' => 'user', 'precision' => '4', 'comment' => 'account id of the creator')
51 51
 		),
52 52
 		'pk' => array('info_id'),
53 53
 		'fk' => array(),
54
-		'ix' => array('caldav_name',array('info_owner','info_responsible','info_status','info_startdate'),array('info_id_parent','info_owner','info_responsible','info_status','info_startdate')),
54
+		'ix' => array('caldav_name', array('info_owner', 'info_responsible', 'info_status', 'info_startdate'), array('info_id_parent', 'info_owner', 'info_responsible', 'info_status', 'info_startdate')),
55 55
 		'uc' => array()
56 56
 	),
57 57
 	'egw_infolog_extra' => array(
58 58
 		'fd' => array(
59
-			'info_id' => array('type' => 'int','precision' => '4','nullable' => False),
60
-			'info_extra_name' => array('type' => 'varchar','meta' => 'cfname','precision' => '64','nullable' => False),
61
-			'info_extra_value' => array('type' => 'varchar','meta' => 'cfvalue','precision' => '16384','nullable' => False)
59
+			'info_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False),
60
+			'info_extra_name' => array('type' => 'varchar', 'meta' => 'cfname', 'precision' => '64', 'nullable' => False),
61
+			'info_extra_value' => array('type' => 'varchar', 'meta' => 'cfvalue', 'precision' => '16384', 'nullable' => False)
62 62
 		),
63
-		'pk' => array('info_id','info_extra_name'),
63
+		'pk' => array('info_id', 'info_extra_name'),
64 64
 		'fk' => array(),
65 65
 		'ix' => array(),
66 66
 		'uc' => array()
Please login to merge, or discard this patch.
infolog/setup/tables_update.inc.php 1 patch
Spacing   +209 added lines, -209 removed lines patch added patch discarded remove patch
@@ -13,8 +13,8 @@  discard block
 block discarded – undo
13 13
 
14 14
 function infolog_upgrade0_9_11()
15 15
 {
16
-	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_infolog','info_datecreated','info_datemodified');
17
-	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_infolog','info_event_id',array(
16
+	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_infolog', 'info_datecreated', 'info_datemodified');
17
+	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_infolog', 'info_event_id', array(
18 18
 		'type' => 'int',
19 19
 		'precision' => '4',
20 20
 		'default' => '0',
@@ -27,16 +27,16 @@  discard block
 block discarded – undo
27 27
 
28 28
 function infolog_upgrade0_9_15_001()
29 29
 {
30
-	$GLOBALS['egw_setup']->oProc->CreateTable('phpgw_links',array(
30
+	$GLOBALS['egw_setup']->oProc->CreateTable('phpgw_links', array(
31 31
 		'fd' => array(
32
-			'link_id' => array('type' => 'auto','nullable' => False),
33
-			'link_app1' => array('type' => 'varchar','precision' => '25','nullable' => False),
34
-			'link_id1' => array('type' => 'varchar','precision' => '50','nullable' => False),
35
-			'link_app2' => array('type' => 'varchar','precision' => '25','nullable' => False),
36
-			'link_id2' => array('type' => 'varchar','precision' => '50','nullable' => False),
37
-			'link_remark' => array('type' => 'varchar','precision' => '50','nullable' => True),
38
-			'link_lastmod' => array('type' => 'int','precision' => '4','nullable' => False),
39
-			'link_owner' => array('type' => 'int','precision' => '4','nullable' => False)
32
+			'link_id' => array('type' => 'auto', 'nullable' => False),
33
+			'link_app1' => array('type' => 'varchar', 'precision' => '25', 'nullable' => False),
34
+			'link_id1' => array('type' => 'varchar', 'precision' => '50', 'nullable' => False),
35
+			'link_app2' => array('type' => 'varchar', 'precision' => '25', 'nullable' => False),
36
+			'link_id2' => array('type' => 'varchar', 'precision' => '50', 'nullable' => False),
37
+			'link_remark' => array('type' => 'varchar', 'precision' => '50', 'nullable' => True),
38
+			'link_lastmod' => array('type' => 'int', 'precision' => '4', 'nullable' => False),
39
+			'link_owner' => array('type' => 'int', 'precision' => '4', 'nullable' => False)
40 40
 		),
41 41
 		'pk' => array('link_id'),
42 42
 		'fk' => array(),
@@ -62,90 +62,90 @@  discard block
 block discarded – undo
62 62
 	//echo "<p>copying calendar-links: $insert.$select</p>\n";
63 63
 	$GLOBALS['egw_setup']->oProc->query($insert.$select3);
64 64
 
65
-	$GLOBALS['egw_setup']->oProc->DropColumn('phpgw_infolog',array(
65
+	$GLOBALS['egw_setup']->oProc->DropColumn('phpgw_infolog', array(
66 66
 		'fd' => array(
67
-			'info_id' => array('type' => 'auto','nullable' => False),
68
-			'info_type' => array('type' => 'varchar','precision' => '255','default' => 'task','nullable' => False),
69
-			'info_proj_id' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False),
70
-			'info_from' => array('type' => 'varchar','precision' => '64','nullable' => True),
71
-			'info_addr' => array('type' => 'varchar','precision' => '64','nullable' => True),
72
-			'info_subject' => array('type' => 'varchar','precision' => '64','nullable' => True),
73
-			'info_des' => array('type' => 'text','nullable' => True),
74
-			'info_owner' => array('type' => 'int','precision' => '4','nullable' => False),
75
-			'info_responsible' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False),
76
-			'info_access' => array('type' => 'varchar','precision' => '10','nullable' => True,'default' => 'public'),
77
-			'info_cat' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False),
78
-			'info_datemodified' => array('type' => 'int','precision' => '4','nullable' => False),
79
-			'info_startdate' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False),
80
-			'info_enddate' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False),
81
-			'info_id_parent' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False),
82
-			'info_pri' => array('type' => 'varchar','precision' => '255','nullable' => True,'default' => 'normal'),
83
-			'info_time' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False),
84
-			'info_bill_cat' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False),
85
-			'info_status' => array('type' => 'varchar','precision' => '255','nullable' => True,'default' => 'done'),
86
-			'info_confirm' => array('type' => 'varchar','precision' => '255','nullable' => True,'default' => 'not'),
87
-			'info_event_id' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False)
67
+			'info_id' => array('type' => 'auto', 'nullable' => False),
68
+			'info_type' => array('type' => 'varchar', 'precision' => '255', 'default' => 'task', 'nullable' => False),
69
+			'info_proj_id' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False),
70
+			'info_from' => array('type' => 'varchar', 'precision' => '64', 'nullable' => True),
71
+			'info_addr' => array('type' => 'varchar', 'precision' => '64', 'nullable' => True),
72
+			'info_subject' => array('type' => 'varchar', 'precision' => '64', 'nullable' => True),
73
+			'info_des' => array('type' => 'text', 'nullable' => True),
74
+			'info_owner' => array('type' => 'int', 'precision' => '4', 'nullable' => False),
75
+			'info_responsible' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False),
76
+			'info_access' => array('type' => 'varchar', 'precision' => '10', 'nullable' => True, 'default' => 'public'),
77
+			'info_cat' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False),
78
+			'info_datemodified' => array('type' => 'int', 'precision' => '4', 'nullable' => False),
79
+			'info_startdate' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False),
80
+			'info_enddate' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False),
81
+			'info_id_parent' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False),
82
+			'info_pri' => array('type' => 'varchar', 'precision' => '255', 'nullable' => True, 'default' => 'normal'),
83
+			'info_time' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False),
84
+			'info_bill_cat' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False),
85
+			'info_status' => array('type' => 'varchar', 'precision' => '255', 'nullable' => True, 'default' => 'done'),
86
+			'info_confirm' => array('type' => 'varchar', 'precision' => '255', 'nullable' => True, 'default' => 'not'),
87
+			'info_event_id' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False)
88 88
 		),
89 89
 		'pk' => array('info_id'),
90 90
 		'fk' => array(),
91 91
 		'ix' => array(),
92 92
 		'uc' => array()
93
-	),'info_addr_id');
94
-	$GLOBALS['egw_setup']->oProc->DropColumn('phpgw_infolog',array(
93
+	), 'info_addr_id');
94
+	$GLOBALS['egw_setup']->oProc->DropColumn('phpgw_infolog', array(
95 95
 		'fd' => array(
96
-			'info_id' => array('type' => 'auto','nullable' => False),
97
-			'info_type' => array('type' => 'varchar','precision' => '255','default' => 'task','nullable' => False),
98
-			'info_from' => array('type' => 'varchar','precision' => '64','nullable' => True),
99
-			'info_addr' => array('type' => 'varchar','precision' => '64','nullable' => True),
100
-			'info_subject' => array('type' => 'varchar','precision' => '64','nullable' => True),
101
-			'info_des' => array('type' => 'text','nullable' => True),
102
-			'info_owner' => array('type' => 'int','precision' => '4','nullable' => False),
103
-			'info_responsible' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False),
104
-			'info_access' => array('type' => 'varchar','precision' => '10','nullable' => True,'default' => 'public'),
105
-			'info_cat' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False),
106
-			'info_datemodified' => array('type' => 'int','precision' => '4','nullable' => False),
107
-			'info_startdate' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False),
108
-			'info_enddate' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False),
109
-			'info_id_parent' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False),
110
-			'info_pri' => array('type' => 'varchar','precision' => '255','nullable' => True,'default' => 'normal'),
111
-			'info_time' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False),
112
-			'info_bill_cat' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False),
113
-			'info_status' => array('type' => 'varchar','precision' => '255','nullable' => True,'default' => 'done'),
114
-			'info_confirm' => array('type' => 'varchar','precision' => '255','nullable' => True,'default' => 'not'),
115
-			'info_event_id' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False)
96
+			'info_id' => array('type' => 'auto', 'nullable' => False),
97
+			'info_type' => array('type' => 'varchar', 'precision' => '255', 'default' => 'task', 'nullable' => False),
98
+			'info_from' => array('type' => 'varchar', 'precision' => '64', 'nullable' => True),
99
+			'info_addr' => array('type' => 'varchar', 'precision' => '64', 'nullable' => True),
100
+			'info_subject' => array('type' => 'varchar', 'precision' => '64', 'nullable' => True),
101
+			'info_des' => array('type' => 'text', 'nullable' => True),
102
+			'info_owner' => array('type' => 'int', 'precision' => '4', 'nullable' => False),
103
+			'info_responsible' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False),
104
+			'info_access' => array('type' => 'varchar', 'precision' => '10', 'nullable' => True, 'default' => 'public'),
105
+			'info_cat' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False),
106
+			'info_datemodified' => array('type' => 'int', 'precision' => '4', 'nullable' => False),
107
+			'info_startdate' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False),
108
+			'info_enddate' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False),
109
+			'info_id_parent' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False),
110
+			'info_pri' => array('type' => 'varchar', 'precision' => '255', 'nullable' => True, 'default' => 'normal'),
111
+			'info_time' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False),
112
+			'info_bill_cat' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False),
113
+			'info_status' => array('type' => 'varchar', 'precision' => '255', 'nullable' => True, 'default' => 'done'),
114
+			'info_confirm' => array('type' => 'varchar', 'precision' => '255', 'nullable' => True, 'default' => 'not'),
115
+			'info_event_id' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False)
116 116
 		),
117 117
 		'pk' => array('info_id'),
118 118
 		'fk' => array(),
119 119
 		'ix' => array(),
120 120
 		'uc' => array()
121
-	),'info_proj_id');
122
-	$GLOBALS['egw_setup']->oProc->DropColumn('phpgw_infolog',array(
121
+	), 'info_proj_id');
122
+	$GLOBALS['egw_setup']->oProc->DropColumn('phpgw_infolog', array(
123 123
 		'fd' => array(
124
-			'info_id' => array('type' => 'auto','nullable' => False),
125
-			'info_type' => array('type' => 'varchar','precision' => '255','default' => 'task','nullable' => False),
126
-			'info_from' => array('type' => 'varchar','precision' => '64','nullable' => True),
127
-			'info_addr' => array('type' => 'varchar','precision' => '64','nullable' => True),
128
-			'info_subject' => array('type' => 'varchar','precision' => '64','nullable' => True),
129
-			'info_des' => array('type' => 'text','nullable' => True),
130
-			'info_owner' => array('type' => 'int','precision' => '4','nullable' => False),
131
-			'info_responsible' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False),
132
-			'info_access' => array('type' => 'varchar','precision' => '10','nullable' => True,'default' => 'public'),
133
-			'info_cat' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False),
134
-			'info_datemodified' => array('type' => 'int','precision' => '4','nullable' => False),
135
-			'info_startdate' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False),
136
-			'info_enddate' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False),
137
-			'info_id_parent' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False),
138
-			'info_pri' => array('type' => 'varchar','precision' => '255','nullable' => True,'default' => 'normal'),
139
-			'info_time' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False),
140
-			'info_bill_cat' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False),
141
-			'info_status' => array('type' => 'varchar','precision' => '255','nullable' => True,'default' => 'done'),
142
-			'info_confirm' => array('type' => 'varchar','precision' => '255','nullable' => True,'default' => 'not')
124
+			'info_id' => array('type' => 'auto', 'nullable' => False),
125
+			'info_type' => array('type' => 'varchar', 'precision' => '255', 'default' => 'task', 'nullable' => False),
126
+			'info_from' => array('type' => 'varchar', 'precision' => '64', 'nullable' => True),
127
+			'info_addr' => array('type' => 'varchar', 'precision' => '64', 'nullable' => True),
128
+			'info_subject' => array('type' => 'varchar', 'precision' => '64', 'nullable' => True),
129
+			'info_des' => array('type' => 'text', 'nullable' => True),
130
+			'info_owner' => array('type' => 'int', 'precision' => '4', 'nullable' => False),
131
+			'info_responsible' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False),
132
+			'info_access' => array('type' => 'varchar', 'precision' => '10', 'nullable' => True, 'default' => 'public'),
133
+			'info_cat' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False),
134
+			'info_datemodified' => array('type' => 'int', 'precision' => '4', 'nullable' => False),
135
+			'info_startdate' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False),
136
+			'info_enddate' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False),
137
+			'info_id_parent' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False),
138
+			'info_pri' => array('type' => 'varchar', 'precision' => '255', 'nullable' => True, 'default' => 'normal'),
139
+			'info_time' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False),
140
+			'info_bill_cat' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False),
141
+			'info_status' => array('type' => 'varchar', 'precision' => '255', 'nullable' => True, 'default' => 'done'),
142
+			'info_confirm' => array('type' => 'varchar', 'precision' => '255', 'nullable' => True, 'default' => 'not')
143 143
 		),
144 144
 		'pk' => array('info_id'),
145 145
 		'fk' => array(),
146 146
 		'ix' => array(),
147 147
 		'uc' => array()
148
-	),'info_event_id');
148
+	), 'info_event_id');
149 149
 
150 150
 	return $GLOBALS['setup_info']['infolog']['currentver'] = '0.9.15.003';
151 151
 }
@@ -153,37 +153,37 @@  discard block
 block discarded – undo
153 153
 
154 154
 function infolog_upgrade0_9_15_003()
155 155
 {
156
-	$GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog','info_type',array(
156
+	$GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog', 'info_type', array(
157 157
 		'type' => 'varchar',
158 158
 		'precision' => '10',
159 159
 		'nullable' => False,
160 160
 		'default' => 'task'
161 161
 	));
162
-	$GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog','info_pri',array(
162
+	$GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog', 'info_pri', array(
163 163
 		'type' => 'varchar',
164 164
 		'precision' => '10',
165 165
 		'nullable' => True,
166 166
 		'default' => 'normal'
167 167
 	));
168
-	$GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog','info_status',array(
168
+	$GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog', 'info_status', array(
169 169
 		'type' => 'varchar',
170 170
 		'precision' => '10',
171 171
 		'nullable' => True,
172 172
 		'default' => 'done'
173 173
 	));
174
-	$GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog','info_confirm',array(
174
+	$GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog', 'info_confirm', array(
175 175
 		'type' => 'varchar',
176 176
 		'precision' => '10',
177 177
 		'nullable' => True,
178 178
 		'default' => 'not'
179 179
 	));
180
-	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_infolog','info_modifier',array(
180
+	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_infolog', 'info_modifier', array(
181 181
 		'type' => 'int',
182 182
 		'precision' => '4',
183 183
 		'nullable' => False,
184 184
 		'default' => '0'
185 185
 	));
186
-	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_infolog','info_link_id',array(
186
+	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_infolog', 'info_link_id', array(
187 187
 		'type' => 'int',
188 188
 		'precision' => '4',
189 189
 		'nullable' => False,
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 		$links[$GLOBALS['egw_setup']->oProc->f(1)] = $GLOBALS['egw_setup']->oProc->f(0);
199 199
 	}
200 200
 	reset($links);
201
-	while (list($info_id,$link_id) = each($links))
201
+	while (list($info_id, $link_id) = each($links))
202 202
 	{
203 203
 		$GLOBALS['egw_setup']->oProc->query("UPDATE phpgw_infolog SET info_link_id=$link_id WHERE info_id=$info_id");
204 204
 	}
@@ -211,9 +211,9 @@  discard block
 block discarded – undo
211 211
 {
212 212
 	// this update correctes wrong escapes of ' and " in the past
213 213
 	//
214
-	$db2 = $GLOBALS['egw_setup']->db;	// we need a 2. result-set
214
+	$db2 = $GLOBALS['egw_setup']->db; // we need a 2. result-set
215 215
 
216
-	$to_correct = array('info_from','info_subject','info_des');
216
+	$to_correct = array('info_from', 'info_subject', 'info_des');
217 217
 	foreach ($to_correct as $col)
218 218
 	{
219 219
 		$GLOBALS['egw_setup']->oProc->query("SELECT info_id,$col FROM phpgw_infolog WHERE $col LIKE '%\\'%' OR $col LIKE '%\"%'");
@@ -230,13 +230,13 @@  discard block
 block discarded – undo
230 230
 
231 231
 function infolog_upgrade0_9_15_005()
232 232
 {
233
-	$GLOBALS['egw_setup']->oProc->CreateTable('phpgw_infolog_extra',array(
233
+	$GLOBALS['egw_setup']->oProc->CreateTable('phpgw_infolog_extra', array(
234 234
 		'fd' => array(
235
-			'info_id' => array('type' => 'int','precision' => '4','nullable' => False),
236
-			'info_extra_name' => array('type' => 'varchar','precision' => '32','nullable' => False),
237
-			'info_extra_value' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '')
235
+			'info_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False),
236
+			'info_extra_name' => array('type' => 'varchar', 'precision' => '32', 'nullable' => False),
237
+			'info_extra_value' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '')
238 238
 		),
239
-		'pk' => array('info_id','info_extra_name'),
239
+		'pk' => array('info_id', 'info_extra_name'),
240 240
 		'fk' => array(),
241 241
 		'ix' => array(),
242 242
 		'uc' => array()
@@ -249,20 +249,20 @@  discard block
 block discarded – undo
249 249
 // the following series of updates add some indices, to speedup the selects
250 250
 function infolog_upgrade0_9_15_006()
251 251
 {
252
-	$GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_links',array(
252
+	$GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_links', array(
253 253
 		'fd' => array(
254
-			'link_id' => array('type' => 'auto','nullable' => False),
255
-			'link_app1' => array('type' => 'varchar','precision' => '25','nullable' => False),
256
-			'link_id1' => array('type' => 'varchar','precision' => '50','nullable' => False),
257
-			'link_app2' => array('type' => 'varchar','precision' => '25','nullable' => False),
258
-			'link_id2' => array('type' => 'varchar','precision' => '50','nullable' => False),
259
-			'link_remark' => array('type' => 'varchar','precision' => '50'),
260
-			'link_lastmod' => array('type' => 'int','precision' => '4','nullable' => False),
261
-			'link_owner' => array('type' => 'int','precision' => '4','nullable' => False)
254
+			'link_id' => array('type' => 'auto', 'nullable' => False),
255
+			'link_app1' => array('type' => 'varchar', 'precision' => '25', 'nullable' => False),
256
+			'link_id1' => array('type' => 'varchar', 'precision' => '50', 'nullable' => False),
257
+			'link_app2' => array('type' => 'varchar', 'precision' => '25', 'nullable' => False),
258
+			'link_id2' => array('type' => 'varchar', 'precision' => '50', 'nullable' => False),
259
+			'link_remark' => array('type' => 'varchar', 'precision' => '50'),
260
+			'link_lastmod' => array('type' => 'int', 'precision' => '4', 'nullable' => False),
261
+			'link_owner' => array('type' => 'int', 'precision' => '4', 'nullable' => False)
262 262
 		),
263 263
 		'pk' => array('link_id'),
264 264
 		'fk' => array(),
265
-		'ix' => array(array('link_app1','link_id1','link_lastmod'),array('link_app2','link_id2','link_lastmod')),
265
+		'ix' => array(array('link_app1', 'link_id1', 'link_lastmod'), array('link_app2', 'link_id2', 'link_lastmod')),
266 266
 		'uc' => array()
267 267
 	));
268 268
 
@@ -272,33 +272,33 @@  discard block
 block discarded – undo
272 272
 
273 273
 function infolog_upgrade0_9_15_007()
274 274
 {
275
-	$GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_infolog',array(
275
+	$GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_infolog', array(
276 276
 		'fd' => array(
277
-			'info_id' => array('type' => 'auto','nullable' => False),
278
-			'info_type' => array('type' => 'varchar','precision' => '10','nullable' => False,'default' => 'task'),
279
-			'info_from' => array('type' => 'varchar','precision' => '64'),
280
-			'info_addr' => array('type' => 'varchar','precision' => '64'),
281
-			'info_subject' => array('type' => 'varchar','precision' => '64'),
277
+			'info_id' => array('type' => 'auto', 'nullable' => False),
278
+			'info_type' => array('type' => 'varchar', 'precision' => '10', 'nullable' => False, 'default' => 'task'),
279
+			'info_from' => array('type' => 'varchar', 'precision' => '64'),
280
+			'info_addr' => array('type' => 'varchar', 'precision' => '64'),
281
+			'info_subject' => array('type' => 'varchar', 'precision' => '64'),
282 282
 			'info_des' => array('type' => 'text'),
283
-			'info_owner' => array('type' => 'int','precision' => '4','nullable' => False),
284
-			'info_responsible' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'),
285
-			'info_access' => array('type' => 'varchar','precision' => '10','default' => 'public'),
286
-			'info_cat' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'),
287
-			'info_datemodified' => array('type' => 'int','precision' => '4','nullable' => False),
288
-			'info_startdate' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'),
289
-			'info_enddate' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'),
290
-			'info_id_parent' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'),
291
-			'info_pri' => array('type' => 'varchar','precision' => '10','default' => 'normal'),
292
-			'info_time' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'),
293
-			'info_bill_cat' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'),
294
-			'info_status' => array('type' => 'varchar','precision' => '10','default' => 'done'),
295
-			'info_confirm' => array('type' => 'varchar','precision' => '10','default' => 'not'),
296
-			'info_modifier' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'),
297
-			'info_link_id' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0')
283
+			'info_owner' => array('type' => 'int', 'precision' => '4', 'nullable' => False),
284
+			'info_responsible' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'),
285
+			'info_access' => array('type' => 'varchar', 'precision' => '10', 'default' => 'public'),
286
+			'info_cat' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'),
287
+			'info_datemodified' => array('type' => 'int', 'precision' => '4', 'nullable' => False),
288
+			'info_startdate' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'),
289
+			'info_enddate' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'),
290
+			'info_id_parent' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'),
291
+			'info_pri' => array('type' => 'varchar', 'precision' => '10', 'default' => 'normal'),
292
+			'info_time' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'),
293
+			'info_bill_cat' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'),
294
+			'info_status' => array('type' => 'varchar', 'precision' => '10', 'default' => 'done'),
295
+			'info_confirm' => array('type' => 'varchar', 'precision' => '10', 'default' => 'not'),
296
+			'info_modifier' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'),
297
+			'info_link_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0')
298 298
 		),
299 299
 		'pk' => array('info_id'),
300 300
 		'fk' => array(),
301
-		'ix' => array(array('info_owner','info_responsible','info_status','info_startdate'),array('info_id_parent','info_owner','info_responsible','info_status','info_startdate')),
301
+		'ix' => array(array('info_owner', 'info_responsible', 'info_status', 'info_startdate'), array('info_id_parent', 'info_owner', 'info_responsible', 'info_status', 'info_startdate')),
302 302
 		'uc' => array()
303 303
 	));
304 304
 
@@ -310,8 +310,8 @@  discard block
 block discarded – undo
310 310
 function infolog_upgrade0_9_15_008()
311 311
 {
312 312
 	// update the sequenzes for refreshed tables (postgres only)
313
-	$GLOBALS['egw_setup']->oProc->UpdateSequence('phpgw_infolog','info_id');
314
-	$GLOBALS['egw_setup']->oProc->UpdateSequence('phpgw_links','link_id');
313
+	$GLOBALS['egw_setup']->oProc->UpdateSequence('phpgw_infolog', 'info_id');
314
+	$GLOBALS['egw_setup']->oProc->UpdateSequence('phpgw_links', 'link_id');
315 315
 
316 316
 	return $GLOBALS['setup_info']['infolog']['currentver'] = '1.0.0';
317 317
 }
@@ -320,25 +320,25 @@  discard block
 block discarded – undo
320 320
 function infolog_upgrade1_0_0()
321 321
 {
322 322
 	// longer columns to cope with multibyte charsets
323
-	$GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog','info_type',array(
323
+	$GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog', 'info_type', array(
324 324
 		'type' => 'varchar',
325 325
 		'precision' => '40',
326 326
 		'nullable' => False,
327 327
 		'default' => 'task'
328 328
 	));
329
-	$GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog','info_from',array(
329
+	$GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog', 'info_from', array(
330 330
 		'type' => 'varchar',
331 331
 		'precision' => '255'
332 332
 	));
333
-	$GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog','info_addr',array(
333
+	$GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog', 'info_addr', array(
334 334
 		'type' => 'varchar',
335 335
 		'precision' => '255'
336 336
 	));
337
-	$GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog','info_subject',array(
337
+	$GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog', 'info_subject', array(
338 338
 		'type' => 'varchar',
339 339
 		'precision' => '255'
340 340
 	));
341
-	$GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog','info_status',array(
341
+	$GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog', 'info_status', array(
342 342
 		'type' => 'varchar',
343 343
 		'precision' => '40',
344 344
 		'default' => 'done'
@@ -350,21 +350,21 @@  discard block
 block discarded – undo
350 350
 
351 351
 function infolog_upgrade1_0_0_001()
352 352
 {
353
-	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_infolog','info_time','info_planned_time');
354
-	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_infolog','info_bill_cat','info_used_time');
353
+	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_infolog', 'info_time', 'info_planned_time');
354
+	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_infolog', 'info_bill_cat', 'info_used_time');
355 355
 	// timestamps have to be 8byte ints
356
-	$GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog','info_datemodified',array(
356
+	$GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog', 'info_datemodified', array(
357 357
 		'type' => 'int',
358 358
 		'precision' => '8',
359 359
 		'nullable' => False
360 360
 	));
361
-	$GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog','info_startdate',array(
361
+	$GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog', 'info_startdate', array(
362 362
 		'type' => 'int',
363 363
 		'precision' => '8',
364 364
 		'nullable' => False,
365 365
 		'default' => '0'
366 366
 	));
367
-	$GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog','info_enddate',array(
367
+	$GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog', 'info_enddate', array(
368 368
 		'type' => 'int',
369 369
 		'precision' => '8',
370 370
 		'nullable' => False,
@@ -372,49 +372,49 @@  discard block
 block discarded – undo
372 372
 	));
373 373
 
374 374
 	// setting numerical priority 3=urgent, 2=high, 1=normal, 0=
375
-	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_infolog','info_priority',array(
375
+	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_infolog', 'info_priority', array(
376 376
 		'type' => 'int',
377 377
 		'precision' => '2',
378 378
 		'default' => '1'
379 379
 	));
380
-	$GLOBALS['egw_setup']->oProc->query("UPDATE phpgw_infolog SET info_priority=(CASE WHEN info_pri='urgent' THEN 3 WHEN info_pri='high' THEN 2 WHEN info_pri='low' THEN 0 ELSE 1 END)",__LINE__,__FILE__);
380
+	$GLOBALS['egw_setup']->oProc->query("UPDATE phpgw_infolog SET info_priority=(CASE WHEN info_pri='urgent' THEN 3 WHEN info_pri='high' THEN 2 WHEN info_pri='low' THEN 0 ELSE 1 END)", __LINE__, __FILE__);
381 381
 
382
-	$GLOBALS['egw_setup']->oProc->DropColumn('phpgw_infolog',array(
382
+	$GLOBALS['egw_setup']->oProc->DropColumn('phpgw_infolog', array(
383 383
 		'fd' => array(
384
-			'info_id' => array('type' => 'auto','nullable' => False),
385
-			'info_type' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => 'task'),
386
-			'info_from' => array('type' => 'varchar','precision' => '255'),
387
-			'info_addr' => array('type' => 'varchar','precision' => '255'),
388
-			'info_subject' => array('type' => 'varchar','precision' => '255'),
384
+			'info_id' => array('type' => 'auto', 'nullable' => False),
385
+			'info_type' => array('type' => 'varchar', 'precision' => '40', 'nullable' => False, 'default' => 'task'),
386
+			'info_from' => array('type' => 'varchar', 'precision' => '255'),
387
+			'info_addr' => array('type' => 'varchar', 'precision' => '255'),
388
+			'info_subject' => array('type' => 'varchar', 'precision' => '255'),
389 389
 			'info_des' => array('type' => 'text'),
390
-			'info_owner' => array('type' => 'int','precision' => '4','nullable' => False),
391
-			'info_responsible' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'),
392
-			'info_access' => array('type' => 'varchar','precision' => '10','default' => 'public'),
393
-			'info_cat' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'),
394
-			'info_datemodified' => array('type' => 'int','precision' => '8','nullable' => False),
395
-			'info_startdate' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'),
396
-			'info_enddate' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'),
397
-			'info_id_parent' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'),
398
-			'info_planned_time' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'),
399
-			'info_used_time' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'),
400
-			'info_status' => array('type' => 'varchar','precision' => '40','default' => 'done'),
401
-			'info_confirm' => array('type' => 'varchar','precision' => '10','default' => 'not'),
402
-			'info_modifier' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'),
403
-			'info_link_id' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'),
404
-			'info_priority' => array('type' => 'int','precision' => '2','default' => '1')
390
+			'info_owner' => array('type' => 'int', 'precision' => '4', 'nullable' => False),
391
+			'info_responsible' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'),
392
+			'info_access' => array('type' => 'varchar', 'precision' => '10', 'default' => 'public'),
393
+			'info_cat' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'),
394
+			'info_datemodified' => array('type' => 'int', 'precision' => '8', 'nullable' => False),
395
+			'info_startdate' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'),
396
+			'info_enddate' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'),
397
+			'info_id_parent' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'),
398
+			'info_planned_time' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'),
399
+			'info_used_time' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'),
400
+			'info_status' => array('type' => 'varchar', 'precision' => '40', 'default' => 'done'),
401
+			'info_confirm' => array('type' => 'varchar', 'precision' => '10', 'default' => 'not'),
402
+			'info_modifier' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'),
403
+			'info_link_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'),
404
+			'info_priority' => array('type' => 'int', 'precision' => '2', 'default' => '1')
405 405
 		),
406 406
 		'pk' => array('info_id'),
407 407
 		'fk' => array(),
408
-		'ix' => array(array('info_owner','info_responsible','info_status','info_startdate'),array('info_id_parent','info_owner','info_responsible','info_status','info_startdate')),
408
+		'ix' => array(array('info_owner', 'info_responsible', 'info_status', 'info_startdate'), array('info_id_parent', 'info_owner', 'info_responsible', 'info_status', 'info_startdate')),
409 409
 		'uc' => array()
410
-	),'info_pri');
410
+	), 'info_pri');
411 411
 
412
-	$GLOBALS['egw_setup']->oProc->RenameTable('phpgw_infolog','egw_infolog');
413
-	$GLOBALS['egw_setup']->oProc->RenameTable('phpgw_infolog_extra','egw_infolog_extra');
412
+	$GLOBALS['egw_setup']->oProc->RenameTable('phpgw_infolog', 'egw_infolog');
413
+	$GLOBALS['egw_setup']->oProc->RenameTable('phpgw_infolog_extra', 'egw_infolog_extra');
414 414
 	// only rename links table, if it has not been moved into the API and therefor been already renamed by the API update
415 415
 	if ($GLOBALS['egw_setup']->oProc->GetTableDefinition('phpgw_links'))
416 416
 	{
417
-		$GLOBALS['egw_setup']->oProc->RenameTable('phpgw_links','egw_links');
417
+		$GLOBALS['egw_setup']->oProc->RenameTable('phpgw_links', 'egw_links');
418 418
 	}
419 419
 
420 420
 	return $GLOBALS['setup_info']['infolog']['currentver'] = '1.0.1.001';
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
 
424 424
 function infolog_upgrade1_0_1_001()
425 425
 {
426
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_infolog','info_responsible',array(
426
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_infolog', 'info_responsible', array(
427 427
 		'type' => 'varchar',
428 428
 		'precision' => '255',
429 429
 		'nullable' => False,
@@ -442,12 +442,12 @@  discard block
 block discarded – undo
442 442
 
443 443
 function infolog_upgrade1_2()
444 444
 {
445
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog','pl_id',array(
445
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog', 'pl_id', array(
446 446
 		'type' => 'int',
447 447
 		'precision' => '4'
448 448
 	));
449 449
 
450
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog','info_price',array(
450
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog', 'info_price', array(
451 451
 		'type' => 'float',
452 452
 		'precision' => '8'
453 453
 	));
@@ -458,38 +458,38 @@  discard block
 block discarded – undo
458 458
 
459 459
 function infolog_upgrade1_2_001()
460 460
 {
461
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog','info_percent',array(
461
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog', 'info_percent', array(
462 462
 		'type' => 'int',
463 463
 		'precision' => '2',
464 464
 		'default' => '0'
465 465
 	));
466
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog','info_datecompleted',array(
466
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog', 'info_datecompleted', array(
467 467
 		'type' => 'int',
468 468
 		'precision' => '8'
469 469
 	));
470
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog','info_location',array(
470
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog', 'info_location', array(
471 471
 		'type' => 'varchar',
472 472
 		'precision' => '255'
473 473
 	));
474 474
 
475 475
 	// all not explicit named stati have the default percent 0
476
-	$GLOBALS['egw_setup']->oProc->query("UPDATE egw_infolog SET info_percent=10 WHERE info_status='ongoing'",__LINE__,__FILE__);
477
-	$GLOBALS['egw_setup']->oProc->query("UPDATE egw_infolog SET info_percent=50 WHERE info_status='will-call'",__LINE__,__FILE__);
476
+	$GLOBALS['egw_setup']->oProc->query("UPDATE egw_infolog SET info_percent=10 WHERE info_status='ongoing'", __LINE__, __FILE__);
477
+	$GLOBALS['egw_setup']->oProc->query("UPDATE egw_infolog SET info_percent=50 WHERE info_status='will-call'", __LINE__, __FILE__);
478 478
 
479
-	for($p = 0; $p <= 90; $p += 10)
479
+	for ($p = 0; $p <= 90; $p += 10)
480 480
 	{
481 481
 		$GLOBALS['egw_setup']->oProc->query("UPDATE egw_infolog SET info_percent=$p,info_status='".(!$p ? 'not-started' : 'ongoing').
482
-			"' WHERE info_status = '$p%'",__LINE__,__FILE__);
482
+			"' WHERE info_status = '$p%'", __LINE__, __FILE__);
483 483
 	}
484
-	$GLOBALS['egw_setup']->oProc->query("UPDATE egw_infolog SET info_datecompleted=info_datemodified,info_percent=100 WHERE info_status IN ('done','billed','100%')",__LINE__,__FILE__);
484
+	$GLOBALS['egw_setup']->oProc->query("UPDATE egw_infolog SET info_datecompleted=info_datemodified,info_percent=100 WHERE info_status IN ('done','billed','100%')", __LINE__, __FILE__);
485 485
 
486 486
 	// remove the percentages from the custom stati, if they exist
487
-	$config =& CreateObject('phpgwapi.config','infolog');
487
+	$config = & CreateObject('phpgwapi.config', 'infolog');
488 488
 	$config->read_repository();
489 489
 	if (is_array($config->config_data['status']['task']))
490 490
 	{
491 491
 		$config->config_data['status']['task'] = array_diff($config->config_data['status']['task'],
492
-			array('0%','10%','20%','30%','40%','50%','60%','70%','80%','90%','100%'));
492
+			array('0%', '10%', '20%', '30%', '40%', '50%', '60%', '70%', '80%', '90%', '100%'));
493 493
 		$config->save_repository();
494 494
 	}
495 495
 	return $GLOBALS['setup_info']['infolog']['currentver'] = '1.2.002';
@@ -499,11 +499,11 @@  discard block
 block discarded – undo
499 499
 function infolog_upgrade1_2_002()
500 500
 {
501 501
 	// change the phone-status: call --> not-started, will-call --> ongoing to be able to sync them
502
-	$GLOBALS['egw_setup']->oProc->query("UPDATE egw_infolog SET info_status='not-started' WHERE info_status='call'",__LINE__,__FILE__);
503
-	$GLOBALS['egw_setup']->oProc->query("UPDATE egw_infolog SET info_status='ongoing' WHERE info_status='will-call'",__LINE__,__FILE__);
502
+	$GLOBALS['egw_setup']->oProc->query("UPDATE egw_infolog SET info_status='not-started' WHERE info_status='call'", __LINE__, __FILE__);
503
+	$GLOBALS['egw_setup']->oProc->query("UPDATE egw_infolog SET info_status='ongoing' WHERE info_status='will-call'", __LINE__, __FILE__);
504 504
 
505 505
 	// remove the call and will-call from the custom stati, if they exist
506
-	$config =& CreateObject('phpgwapi.config','infolog');
506
+	$config = & CreateObject('phpgwapi.config', 'infolog');
507 507
 	$config->read_repository();
508 508
 	if (is_array($config->config_data['status']['phone']))
509 509
 	{
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
 function infolog_upgrade1_2_003()
520 520
 {
521 521
 	// fix wrong info_responsible='' --> '0'
522
-	$GLOBALS['egw_setup']->oProc->query("UPDATE egw_infolog SET info_responsible='0' WHERE info_responsible=''",__LINE__,__FILE__);
522
+	$GLOBALS['egw_setup']->oProc->query("UPDATE egw_infolog SET info_responsible='0' WHERE info_responsible=''", __LINE__, __FILE__);
523 523
 
524 524
 	return $GLOBALS['setup_info']['infolog']['currentver'] = '1.2.004';
525 525
 }
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
 function infolog_upgrade1_2_004()
529 529
 {
530 530
 	// column to save if from contains a custom text
531
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog','info_custom_from',array(
531
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog', 'info_custom_from', array(
532 532
 		'type' => 'int',
533 533
 		'precision' => '1',
534 534
 	));
@@ -545,13 +545,13 @@  discard block
 block discarded – undo
545 545
 
546 546
 function infolog_upgrade1_4()
547 547
 {
548
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog','info_uid',array(
548
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog', 'info_uid', array(
549 549
 		'type' => 'varchar',
550 550
 		'precision' => '255'
551 551
 	));
552
-	$GLOBALS['egw_setup']->db->query("SELECT config_value FROM egw_config WHERE config_app='phpgwapi' AND config_name='install_id'",__LINE__,__FILE__);
552
+	$GLOBALS['egw_setup']->db->query("SELECT config_value FROM egw_config WHERE config_app='phpgwapi' AND config_name='install_id'", __LINE__, __FILE__);
553 553
 	$install_id = $GLOBALS['egw_setup']->db->next_record() ? $GLOBALS['egw_setup']->db->f(0) : md5(time());
554
-	$GLOBALS['egw_setup']->db->query('UPDATE egw_infolog SET info_uid='.$GLOBALS['egw_setup']->db->concat("'infolog-'",'info_id',"'-$install_id'"),__LINE__,__FILE__);
554
+	$GLOBALS['egw_setup']->db->query('UPDATE egw_infolog SET info_uid='.$GLOBALS['egw_setup']->db->concat("'infolog-'", 'info_id', "'-$install_id'"), __LINE__, __FILE__);
555 555
 
556 556
 	return $GLOBALS['setup_info']['infolog']['currentver'] = '1.5.001';
557 557
 }
@@ -564,17 +564,17 @@  discard block
 block discarded – undo
564 564
  */
565 565
 function infolog_upgrade1_5_001()
566 566
 {
567
-	foreach($GLOBALS['egw_setup']->db->select('egw_infolog','info_id,info_link_id,org_name,adr_one_locality,n_family,n_given',array(
567
+	foreach ($GLOBALS['egw_setup']->db->select('egw_infolog', 'info_id,info_link_id,org_name,adr_one_locality,n_family,n_given', array(
568 568
 		'info_from' => '',
569 569
 		'info_link_id > 0',
570
-	),__LINE__,__FILE__,false,'','infolog',0,
570
+	), __LINE__, __FILE__, false, '', 'infolog', 0,
571 571
 	" JOIN egw_links ON info_link_id=link_id AND link_app2='addressbook'".
572 572
 	" JOIN egw_addressbook ON contact_id=link_id2") as $row)
573 573
 	{
574 574
 		$from = ($row['org_name'] ? $row['org_name'].', '.$row['adr_one_locality'].': ' : '').
575 575
 			$row['n_family'].($row['n_given'] ? ', '.$row['n_given'] : '');
576
-		$GLOBALS['egw_setup']->db->update('egw_infolog',array('info_from' => $from),
577
-			array('info_id' => $row['info_id']),__LINE__,__FILE__,'infolog');
576
+		$GLOBALS['egw_setup']->db->update('egw_infolog', array('info_from' => $from),
577
+			array('info_id' => $row['info_id']), __LINE__, __FILE__, 'infolog');
578 578
 	}
579 579
 	return $GLOBALS['setup_info']['infolog']['currentver'] = '1.5.002';
580 580
 }
@@ -587,12 +587,12 @@  discard block
 block discarded – undo
587 587
  */
588 588
 function infolog_upgrade1_5_002()
589 589
 {
590
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_infolog_extra','info_extra_name',array(
590
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_infolog_extra', 'info_extra_name', array(
591 591
 		'type' => 'varchar',
592 592
 		'precision' => '64',
593 593
 		'nullable' => False
594 594
 	));
595
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_infolog_extra','info_extra_value',array(
595
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_infolog_extra', 'info_extra_value', array(
596 596
 		'type' => 'text',
597 597
 		'nullable' => False
598 598
 	));
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
  */
609 609
 function infolog_upgrade1_5_003()
610 610
 {
611
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog','info_replanned_time',array(
611
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog', 'info_replanned_time', array(
612 612
 		'type' => 'int',
613 613
 		'precision' => '4',
614 614
 		'nullable' => False,
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
 
638 638
 function infolog_upgrade1_8()
639 639
 {
640
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog','info_cc',array(
640
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog', 'info_cc', array(
641 641
 		'type' => 'varchar',
642 642
 		'precision' => '255'
643 643
 	));
@@ -651,29 +651,29 @@  discard block
 block discarded – undo
651 651
  */
652 652
 function infolog_upgrade1_9_001()
653 653
 {
654
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog','caldav_name',array(
654
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog', 'caldav_name', array(
655 655
 		'type' => 'varchar',
656 656
 		'precision' => '64',
657 657
 		'comment' => 'name part of CalDAV URL, if specified by client'
658 658
 	));
659 659
 	$GLOBALS['egw_setup']->db->query('UPDATE egw_infolog SET caldav_name='.
660 660
 		$GLOBALS['egw_setup']->db->concat(
661
-			$GLOBALS['egw_setup']->db->to_varchar('info_id'),"'.ics'"),__LINE__,__FILE__);
661
+			$GLOBALS['egw_setup']->db->to_varchar('info_id'), "'.ics'"), __LINE__, __FILE__);
662 662
 
663
-	$GLOBALS['egw_setup']->oProc->CreateIndex('egw_infolog','caldav_name');
663
+	$GLOBALS['egw_setup']->oProc->CreateIndex('egw_infolog', 'caldav_name');
664 664
 
665
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog','info_etag',array(
665
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog', 'info_etag', array(
666 666
 		'type' => 'int',
667 667
 		'precision' => '4',
668 668
 		'default' => '0',
669 669
 		'comment' => 'etag, not yet used'
670 670
 	));
671 671
 
672
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog','info_created',array(
672
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog', 'info_created', array(
673 673
 		'type' => 'int',
674 674
 		'precision' => '8',
675 675
 	));
676
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog','info_creator',array(
676
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog', 'info_creator', array(
677 677
 		'type' => 'int',
678 678
 		'precision' => '4',
679 679
 	));
@@ -688,18 +688,18 @@  discard block
 block discarded – undo
688 688
 function infolog_upgrade1_9_002()
689 689
 {
690 690
 	$ids = array();
691
-	foreach($GLOBALS['egw_setup']->db->query('SELECT sub.info_id
691
+	foreach ($GLOBALS['egw_setup']->db->query('SELECT sub.info_id
692 692
 FROM egw_infolog sub
693 693
 JOIN egw_infolog parent ON sub.info_id_parent=parent.info_id
694
-WHERE parent.caldav_name=sub.caldav_name',__LINE__,__FILE__) as $row)
694
+WHERE parent.caldav_name=sub.caldav_name',__LINE__, __FILE__) as $row)
695 695
 	{
696 696
 		$ids[] = $row['info_id'];
697 697
 	}
698 698
 	if ($ids)
699 699
 	{
700 700
 		$GLOBALS['egw_setup']->db->query('UPDATE egw_infolog SET caldav_name='.
701
-			$GLOBALS['egw_setup']->db->concat('info_id',"'.ics'").
702
-			' WHERE info_id IN ('.implode(',',$ids).')',__LINE__,__FILE__);
701
+			$GLOBALS['egw_setup']->db->concat('info_id', "'.ics'").
702
+			' WHERE info_id IN ('.implode(',', $ids).')', __LINE__, __FILE__);
703 703
 	}
704 704
 	return $GLOBALS['setup_info']['infolog']['currentver'] = '1.9.003';
705 705
 }
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
 
708 708
 function infolog_upgrade1_9_003()
709 709
 {
710
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_infolog','caldav_name',array(
710
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_infolog', 'caldav_name', array(
711 711
 		'type' => 'varchar',
712 712
 		'precision' => '200',
713 713
 		'comment' => 'name part of CalDAV URL, if specified by client'
@@ -752,7 +752,7 @@  discard block
 block discarded – undo
752 752
 }
753 753
 function infolog_upgrade14_2()
754 754
 {
755
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_infolog','info_responsible',array(
755
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_infolog', 'info_responsible', array(
756 756
 		'type' => 'ascii',
757 757
 		'meta' => 'account-commasep',
758 758
 		'precision' => '255',
@@ -760,23 +760,23 @@  discard block
 block discarded – undo
760 760
 		'default' => '0',
761 761
 		'comment' => 'responsible users or groups (multiple)'
762 762
 	));
763
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_infolog','info_access',array(
763
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_infolog', 'info_access', array(
764 764
 		'type' => 'ascii',
765 765
 		'precision' => '10',
766 766
 		'default' => 'public',
767 767
 		'comment' => 'public or privat'
768 768
 	));
769
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_infolog','info_confirm',array(
769
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_infolog', 'info_confirm', array(
770 770
 		'type' => 'ascii',
771 771
 		'precision' => '10',
772 772
 		'default' => 'not'
773 773
 	));
774
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_infolog','info_uid',array(
774
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_infolog', 'info_uid', array(
775 775
 		'type' => 'ascii',
776 776
 		'precision' => '128',
777 777
 		'comment' => 'unique id of the infolog-entry'
778 778
 	));
779
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_infolog','caldav_name',array(
779
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_infolog', 'caldav_name', array(
780 780
 		'type' => 'ascii',
781 781
 		'precision' => '128',
782 782
 		'comment' => 'name part of CalDAV URL, if specified by client'
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
 
789 789
 function infolog_upgrade14_2_001()
790 790
 {
791
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_infolog_extra','info_extra_value',array(
791
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_infolog_extra', 'info_extra_value', array(
792 792
 		'type' => 'varchar',
793 793
 		'meta' => 'cfvalue',
794 794
 		'precision' => '16384',
Please login to merge, or discard this patch.
infolog/inc/class.infolog_import_ical.inc.php 4 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -15,10 +15,10 @@  discard block
 block discarded – undo
15 15
  * import ical for infolog
16 16
  * Not a lot of options for this, just uses the ical class
17 17
  */
18
-class infolog_import_ical implements importexport_iface_import_plugin  {
18
+class infolog_import_ical implements importexport_iface_import_plugin {
19 19
 
20 20
 	private static $plugin_options = array(
21
-		'conditions',		/* => array containing condition arrays:
21
+		'conditions', /* => array containing condition arrays:
22 22
 				'type' => exists, // exists
23 23
 				'string' => '#kundennummer',
24 24
 				'true' => array(
@@ -79,19 +79,19 @@  discard block
 block discarded – undo
79 79
 	 * @param string $_charset
80 80
 	 * @param definition $_definition
81 81
 	 */
82
-	public function import( $_stream, importexport_definition $_definition ) {
82
+	public function import($_stream, importexport_definition $_definition) {
83 83
 
84 84
 		$this->definition = $_definition;
85 85
 
86 86
 		// dry run?
87
-		$this->dry_run = isset( $_definition->plugin_options['dry_run'] ) ? $_definition->plugin_options['dry_run'] :  false;
87
+		$this->dry_run = isset($_definition->plugin_options['dry_run']) ? $_definition->plugin_options['dry_run'] : false;
88 88
 
89 89
 		$success = 0;
90 90
 
91 91
 		// Failures
92 92
 		$this->errors = array();
93 93
 
94
-		@set_time_limit(0);     // try switching execution time limit off
94
+		@set_time_limit(0); // try switching execution time limit off
95 95
 
96 96
 		$infolog_ical = new infolog_ical();
97 97
 		if (!$infolog_ical->importVTODO(stream_get_contents($_stream)))
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -104,8 +104,7 @@
 block discarded – undo
104 104
 	/**
105 105
 	 * imports entries according to given definition object.
106 106
 	 * @param resource $_stream
107
-	 * @param string $_charset
108
-	 * @param definition $_definition
107
+	 * @param importexport_definition $_definition
109 108
 	 */
110 109
 	public function import( $_stream, importexport_definition $_definition ) {
111 110
 		$import_csv = new importexport_import_csv( $_stream, array(
Please login to merge, or discard this patch.
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
 	protected $errors = array();
72 72
 
73 73
 	/**
74
-         * List of actions, and how many times that action was taken
75
-         */
76
-        protected $results = array();
74
+	 * List of actions, and how many times that action was taken
75
+	 */
76
+		protected $results = array();
77 77
 
78 78
 	/**
79 79
 	 * imports entries according to given definition object.
@@ -163,39 +163,39 @@  discard block
 block discarded – undo
163 163
 	}
164 164
 
165 165
 	/**
166
-        * Returns warnings that were encountered during importing
167
-        * Maximum of one warning message per record, but you can append if you need to
168
-        *
169
-        * @return Array (
170
-        *       record_# => warning message
171
-        *       )
172
-        */
173
-        public function get_warnings() {
166
+	 * Returns warnings that were encountered during importing
167
+	 * Maximum of one warning message per record, but you can append if you need to
168
+	 *
169
+	 * @return Array (
170
+	 *       record_# => warning message
171
+	 *       )
172
+	 */
173
+		public function get_warnings() {
174 174
 		return $this->warnings;
175 175
 	}
176 176
 
177 177
 	/**
178
-        * Returns errors that were encountered during importing
179
-        * Maximum of one error message per record, but you can append if you need to
180
-        *
181
-        * @return Array (
182
-        *       record_# => error message
183
-        *       )
184
-        */
185
-        public function get_errors() {
178
+	 * Returns errors that were encountered during importing
179
+	 * Maximum of one error message per record, but you can append if you need to
180
+	 *
181
+	 * @return Array (
182
+	 *       record_# => error message
183
+	 *       )
184
+	 */
185
+		public function get_errors() {
186 186
 		return $this->errors;
187 187
 	}
188 188
 
189 189
 	/**
190
-        * Returns a list of actions taken, and the number of records for that action.
191
-        * Actions are things like 'insert', 'update', 'delete', and may be different for each plugin.
192
-        *
193
-        * @return Array (
194
-        *       action => record count
195
-        * )
196
-        */
197
-        public function get_results() {
198
-                return $this->results;
199
-        }
190
+	 * Returns a list of actions taken, and the number of records for that action.
191
+	 * Actions are things like 'insert', 'update', 'delete', and may be different for each plugin.
192
+	 *
193
+	 * @return Array (
194
+	 *       action => record count
195
+	 * )
196
+	 */
197
+		public function get_results() {
198
+				return $this->results;
199
+		}
200 200
 } // end of iface_export_plugin
201 201
 ?>
Please login to merge, or discard this patch.
Braces   +20 added lines, -10 removed lines patch added patch discarded remove patch
@@ -16,7 +16,8 @@  discard block
 block discarded – undo
16 16
  * import ical for infolog
17 17
  * Not a lot of options for this, just uses the ical class
18 18
  */
19
-class infolog_import_ical implements importexport_iface_import_plugin  {
19
+class infolog_import_ical implements importexport_iface_import_plugin
20
+{
20 21
 
21 22
 	private static $plugin_options = array(
22 23
 		'conditions',		/* => array containing condition arrays:
@@ -81,7 +82,8 @@  discard block
 block discarded – undo
81 82
 	 * @param string $_charset
82 83
 	 * @param definition $_definition
83 84
 	 */
84
-	public function import( $_stream, importexport_definition $_definition ) {
85
+	public function import( $_stream, importexport_definition $_definition )
86
+	{
85 87
 
86 88
 		$this->definition = $_definition;
87 89
 
@@ -115,7 +117,8 @@  discard block
 block discarded – undo
115 117
 	 *
116 118
 	 * @return string name
117 119
 	 */
118
-	public static function get_name() {
120
+	public static function get_name()
121
+	{
119 122
 		return lang('Infolog iCal import');
120 123
 	}
121 124
 
@@ -124,7 +127,8 @@  discard block
 block discarded – undo
124 127
 	 *
125 128
 	 * @return string descriprion
126 129
 	 */
127
-	public static function get_description() {
130
+	public static function get_description()
131
+	{
128 132
 		return lang("Imports TODOs into Infolog from an iCal File.");
129 133
 	}
130 134
 
@@ -133,7 +137,8 @@  discard block
 block discarded – undo
133 137
 	 *
134 138
 	 * @return string suffix (comma seperated)
135 139
 	 */
136
-	public static function get_filesuffix() {
140
+	public static function get_filesuffix()
141
+	{
137 142
 		return 'ics';
138 143
 	}
139 144
 
@@ -149,7 +154,8 @@  discard block
 block discarded – undo
149 154
 	 * 		preserv		=> array,
150 155
 	 * )
151 156
 	 */
152
-	public function get_options_etpl() {
157
+	public function get_options_etpl()
158
+	{
153 159
 		// lets do it!
154 160
 	}
155 161
 
@@ -158,7 +164,8 @@  discard block
 block discarded – undo
158 164
 	 *
159 165
 	 * @return string etemplate name
160 166
 	 */
161
-	public function get_selectors_etpl() {
167
+	public function get_selectors_etpl()
168
+	{
162 169
 		// lets do it!
163 170
 	}
164 171
 
@@ -170,7 +177,8 @@  discard block
 block discarded – undo
170 177
         *       record_# => warning message
171 178
         *       )
172 179
         */
173
-        public function get_warnings() {
180
+        public function get_warnings()
181
+        {
174 182
 		return $this->warnings;
175 183
 	}
176 184
 
@@ -182,7 +190,8 @@  discard block
 block discarded – undo
182 190
         *       record_# => error message
183 191
         *       )
184 192
         */
185
-        public function get_errors() {
193
+        public function get_errors()
194
+        {
186 195
 		return $this->errors;
187 196
 	}
188 197
 
@@ -194,7 +203,8 @@  discard block
 block discarded – undo
194 203
         *       action => record count
195 204
         * )
196 205
         */
197
-        public function get_results() {
206
+        public function get_results()
207
+        {
198 208
                 return $this->results;
199 209
         }
200 210
 } // end of iface_export_plugin
Please login to merge, or discard this patch.
infolog/inc/class.infolog_egw_record.inc.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,11 +25,11 @@
 block discarded – undo
25 25
 	// Used in conversions
26 26
 	static $types = array(
27 27
 		'select' => array('info_type', 'info_status', 'info_priority', 'pl_id'),
28
-                'select-cat' => array('info_cat'),
29
-                'select-account' => array('info_owner','info_responsible','info_modifier'),
30
-                'date-time' => array('info_startdate', 'info_enddate','info_datecompleted', 'info_datemodified','info_created'),
28
+				'select-cat' => array('info_cat'),
29
+				'select-account' => array('info_owner','info_responsible','info_modifier'),
30
+				'date-time' => array('info_startdate', 'info_enddate','info_datecompleted', 'info_datemodified','info_created'),
31 31
 		'links' => array('info_link_id'),
32
-        );
32
+		);
33 33
 
34 34
 	/**
35 35
 	 * constructor
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 	static $types = array(
27 27
 		'select' => array('info_type', 'info_status', 'info_priority', 'pl_id'),
28 28
                 'select-cat' => array('info_cat'),
29
-                'select-account' => array('info_owner','info_responsible','info_modifier'),
30
-                'date-time' => array('info_startdate', 'info_enddate','info_datecompleted', 'info_datemodified','info_created'),
29
+                'select-account' => array('info_owner', 'info_responsible', 'info_modifier'),
30
+                'date-time' => array('info_startdate', 'info_enddate', 'info_datecompleted', 'info_datemodified', 'info_created'),
31 31
 		'links' => array('info_link_id'),
32 32
         );
33 33
 
@@ -37,10 +37,10 @@  discard block
 block discarded – undo
37 37
 	 *
38 38
 	 * @param string $_identifier
39 39
 	 */
40
-	public function __construct( $_identifier='' ){
40
+	public function __construct($_identifier = '') {
41 41
 		$this->identifier = $_identifier;
42
-		if(self::$bo == null) self::$bo = new infolog_bo();
43
-		if($_identifier) {
42
+		if (self::$bo == null) self::$bo = new infolog_bo();
43
+		if ($_identifier) {
44 44
 			$rec = self::$bo->read($this->identifier);
45 45
 			if (is_array($rec)) $this->set_record($rec);
46 46
 		}
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 * @todo add some checks
96 96
 	 * @return void
97 97
 	 */
98
-	public function set_record(array $_record){
98
+	public function set_record(array $_record) {
99 99
 		$this->record = $_record;
100 100
 	}
101 101
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 *
134 134
 	 * @return string identifier
135 135
 	 */
136
-	public function save ( $_dst_identifier ) {
136
+	public function save($_dst_identifier) {
137 137
 
138 138
 	}
139 139
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	 * @param string $_dst_identifier
144 144
 	 * @return string dst_identifier
145 145
 	 */
146
-	public function copy ( $_dst_identifier ) {
146
+	public function copy($_dst_identifier) {
147 147
 
148 148
 	}
149 149
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	 * @param string $_dst_identifier
155 155
 	 * @return string dst_identifier
156 156
 	 */
157
-	public function move ( $_dst_identifier ) {
157
+	public function move($_dst_identifier) {
158 158
 
159 159
 	}
160 160
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 	 * delets current record from backend
163 163
 	 *
164 164
 	 */
165
-	public function delete () {
165
+	public function delete() {
166 166
 
167 167
 	}
168 168
 
Please login to merge, or discard this patch.
Braces   +38 added lines, -17 removed lines patch added patch discarded remove patch
@@ -37,12 +37,20 @@  discard block
 block discarded – undo
37 37
 	 *
38 38
 	 * @param string $_identifier
39 39
 	 */
40
-	public function __construct( $_identifier='' ){
40
+	public function __construct( $_identifier='' )
41
+	{
41 42
 		$this->identifier = $_identifier;
42
-		if(self::$bo == null) self::$bo = new infolog_bo();
43
-		if($_identifier) {
43
+		if(self::$bo == null)
44
+		{
45
+			self::$bo = new infolog_bo();
46
+		}
47
+		if($_identifier)
48
+		{
44 49
 			$rec = self::$bo->read($this->identifier);
45
-			if (is_array($rec)) $this->set_record($rec);
50
+			if (is_array($rec))
51
+			{
52
+				$this->set_record($rec);
53
+			}
46 54
 		}
47 55
 	}
48 56
 
@@ -51,7 +59,8 @@  discard block
 block discarded – undo
51 59
 	 *
52 60
 	 * @param string $_attribute_name
53 61
 	 */
54
-	public function __get($_attribute_name) {
62
+	public function __get($_attribute_name)
63
+	{
55 64
 		return $this->record[$_attribute_name];
56 65
 	}
57 66
 
@@ -61,7 +70,8 @@  discard block
 block discarded – undo
61 70
 	 * @param string $_attribute_name
62 71
 	 * @param data $data
63 72
 	 */
64
-	public function __set($_attribute_name, $data) {
73
+	public function __set($_attribute_name, $data)
74
+	{
65 75
 		$this->record[$_attribute_name] = $data;
66 76
 	}
67 77
 
@@ -73,7 +83,8 @@  discard block
 block discarded – undo
73 83
 	 *
74 84
 	 * @return array complete record as associative array
75 85
 	 */
76
-	public function get_record_array() {
86
+	public function get_record_array()
87
+	{
77 88
 		return $this->record;
78 89
 	}
79 90
 
@@ -82,8 +93,10 @@  discard block
 block discarded – undo
82 93
 	 *
83 94
 	 *@return string tiltle
84 95
 	 */
85
-	public function get_title() {
86
-		if (empty($this->record)) {
96
+	public function get_title()
97
+	{
98
+		if (empty($this->record))
99
+		{
87 100
 			$this->get_record();
88 101
 		}
89 102
 		return self::$bo->link_title($this->record);
@@ -95,7 +108,8 @@  discard block
 block discarded – undo
95 108
 	 * @todo add some checks
96 109
 	 * @return void
97 110
 	 */
98
-	public function set_record(array $_record){
111
+	public function set_record(array $_record)
112
+	{
99 113
 		$this->record = $_record;
100 114
 	}
101 115
 
@@ -104,7 +118,8 @@  discard block
 block discarded – undo
104 118
 	 *
105 119
 	 * @return string identifier of current record
106 120
 	 */
107
-	public function get_identifier() {
121
+	public function get_identifier()
122
+	{
108 123
 		return $this->identifier;
109 124
 	}
110 125
 
@@ -114,7 +129,8 @@  discard block
 block discarded – undo
114 129
 	 *
115 130
 	 * @return string Full URL of an icon, or appname/icon_name
116 131
 	 */
117
-	public function get_icon() {
132
+	public function get_icon()
133
+	{
118 134
 		$icon = 'infolog/navbar';
119 135
 		$ui = new infolog_ui();
120 136
 		if (!($icon = $ui->icons['type'][$this->info_type]))
@@ -133,7 +149,8 @@  discard block
 block discarded – undo
133 149
 	 *
134 150
 	 * @return string identifier
135 151
 	 */
136
-	public function save ( $_dst_identifier ) {
152
+	public function save ( $_dst_identifier )
153
+	{
137 154
 
138 155
 	}
139 156
 
@@ -143,7 +160,8 @@  discard block
 block discarded – undo
143 160
 	 * @param string $_dst_identifier
144 161
 	 * @return string dst_identifier
145 162
 	 */
146
-	public function copy ( $_dst_identifier ) {
163
+	public function copy ( $_dst_identifier )
164
+	{
147 165
 
148 166
 	}
149 167
 
@@ -154,7 +172,8 @@  discard block
 block discarded – undo
154 172
 	 * @param string $_dst_identifier
155 173
 	 * @return string dst_identifier
156 174
 	 */
157
-	public function move ( $_dst_identifier ) {
175
+	public function move ( $_dst_identifier )
176
+	{
158 177
 
159 178
 	}
160 179
 
@@ -162,7 +181,8 @@  discard block
 block discarded – undo
162 181
 	 * delets current record from backend
163 182
 	 *
164 183
 	 */
165
-	public function delete () {
184
+	public function delete ()
185
+	{
166 186
 
167 187
 	}
168 188
 
@@ -170,7 +190,8 @@  discard block
 block discarded – undo
170 190
 	 * destructor
171 191
 	 *
172 192
 	 */
173
-	public function __destruct() {
193
+	public function __destruct()
194
+	{
174 195
 	}
175 196
 
176 197
 } // end of egw_addressbook_record
Please login to merge, or discard this patch.
infolog/inc/class.infolog_export_csv.inc.php 5 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -259,10 +259,10 @@
 block discarded – undo
259 259
 	}
260 260
 
261 261
 	/**
262
-	* Convert some internal data to something with more meaning
263
-	*
264
-	* This is for something specific to Infolog, in addition to the normal conversions.
265
-	*/
262
+	 * Convert some internal data to something with more meaning
263
+	 *
264
+	 * This is for something specific to Infolog, in addition to the normal conversions.
265
+	 */
266 266
 	public static function convert(infolog_egw_record &$record) {
267 267
 		// Stub, for now
268 268
 	}
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
 	/**
30 30
 	 * Exports records as defined in $_definition
31 31
 	 *
32
-	 * @param egw_record $_definition
32
+	 * @param importexport_definition $_definition
33 33
 	 */
34 34
 	public function export( $_stream, importexport_definition $_definition) {
35 35
 		$options = $_definition->plugin_options;
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -247,7 +247,7 @@
 block discarded – undo
247 247
 		$this->selects['info_status'] = $this->bo->get_status();
248 248
 	}
249 249
 
250
-	public function get_filter_fields(Array &$filters)
250
+	public function get_filter_fields(array &$filters)
251 251
 	{
252 252
 		foreach($filters as $field_name => &$settings)
253 253
 		{
Please login to merge, or discard this patch.
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 *
29 29
 	 * @param egw_record $_definition
30 30
 	 */
31
-	public function export( $_stream, importexport_definition $_definition) {
31
+	public function export($_stream, importexport_definition $_definition) {
32 32
 		$options = $_definition->plugin_options;
33 33
 
34 34
 		$selection = array();
@@ -39,45 +39,45 @@  discard block
 block discarded – undo
39 39
 		$this->export_object->set_mapping($options['mapping']);
40 40
 
41 41
 		$ids = array();
42
-		switch($options['selection'])
42
+		switch ($options['selection'])
43 43
 		{
44 44
 			case 'search':
45
-				$query = array_merge((array)$GLOBALS['egw']->session->appsession('session_data','infolog'), $query);
45
+				$query = array_merge((array)$GLOBALS['egw']->session->appsession('session_data', 'infolog'), $query);
46 46
 				// Fall through
47 47
 			case 'filter':
48 48
 			case 'all':
49 49
 				// do we need to query the cf's
50 50
 				$query['custom_fields'] = false;
51
-				foreach($options['mapping'] + (array)$_definition->filter as $field => $map) {
52
-					if($field[0] == '#') {
51
+				foreach ($options['mapping'] + (array)$_definition->filter as $field => $map) {
52
+					if ($field[0] == '#') {
53 53
 						$query['custom_fields'] = true;
54 54
 						$query['selectcols'] .= ",$field";
55 55
 
56
-						if($GLOBALS['egw_info']['user']['apps'][$this->bo->customfields[substr($field,1)]['type']])
56
+						if ($GLOBALS['egw_info']['user']['apps'][$this->bo->customfields[substr($field, 1)]['type']])
57 57
 						{
58
-							$cf_links[$field] = $this->bo->customfields[substr($field,1)]['type'];
58
+							$cf_links[$field] = $this->bo->customfields[substr($field, 1)]['type'];
59 59
 						}
60 60
 					}
61 61
 				}
62
-				if($options['selection'] == 'filter')
62
+				if ($options['selection'] == 'filter')
63 63
 				{
64 64
 					$fields = importexport_helper_functions::get_filter_fields($_definition->application, $this);
65 65
 					$query['col_filter'] = $_definition->filter;
66 66
 
67 67
 					// Backend expects a string
68
-					if($query['col_filter']['info_responsible'])
68
+					if ($query['col_filter']['info_responsible'])
69 69
 					{
70
-						$query['col_filter']['info_responsible'] = implode(',',$query['col_filter']['info_responsible']);
70
+						$query['col_filter']['info_responsible'] = implode(',', $query['col_filter']['info_responsible']);
71 71
 					}
72 72
 
73 73
 					// Handle ranges
74
-					foreach($query['col_filter'] as $field => $value)
74
+					foreach ($query['col_filter'] as $field => $value)
75 75
 					{
76
-						if(!is_array($value) || (!$value['from'] && !$value['to'])) continue;
76
+						if (!is_array($value) || (!$value['from'] && !$value['to'])) continue;
77 77
 
78 78
 						// Ranges are inclusive, so should be provided that way (from 2 to 10 includes 2 and 10)
79
-						if($value['from']) $query['col_filter'][] = "$field >= " . (int)$value['from'];
80
-						if($value['to']) $query['col_filter'][] = "$field <= " . (int)$value['to'];
79
+						if ($value['from']) $query['col_filter'][] = "$field >= ".(int)$value['from'];
80
+						if ($value['to']) $query['col_filter'][] = "$field <= ".(int)$value['to'];
81 81
 						unset($query['col_filter'][$field]);
82 82
 					}
83 83
 				}
@@ -89,11 +89,11 @@  discard block
 block discarded – undo
89 89
 
90 90
 					// Pre-load any cfs that are links
91 91
 					$cf_preload = array();
92
-					foreach($cf_links as $field => $app) {
93
-						foreach($selection as &$row) {
94
-							if($row[$field]) $cf_preload[$app][] = $row[$field];
92
+					foreach ($cf_links as $field => $app) {
93
+						foreach ($selection as &$row) {
94
+							if ($row[$field]) $cf_preload[$app][] = $row[$field];
95 95
 						}
96
-						if($cf_preload[$app]){
96
+						if ($cf_preload[$app]) {
97 97
 							 $selects[$field] = egw_link::titles($app, $cf_preload[$app]);
98 98
 							//error_log('Preload ' . $field . '['.$app . ']: ' . implode(',',$cf_preload[$app]));
99 99
 						}
@@ -101,12 +101,12 @@  discard block
 block discarded – undo
101 101
 
102 102
 					$this->export_records($this->export_object, $options, $selection, $ids);
103 103
 					$query['start'] += $query['num_rows'];
104
-				} while($query['start'] < $query['total']);
104
+				} while ($query['start'] < $query['total']);
105 105
 
106 106
 				return $this->export_object;
107 107
 				break;
108 108
 			default:
109
-				$ids = $selection = explode(',',$options['selection']);
109
+				$ids = $selection = explode(',', $options['selection']);
110 110
 				$this->export_records($this->export_object, $options, $selection, $ids);
111 111
 				break;
112 112
 		}
@@ -116,33 +116,33 @@  discard block
 block discarded – undo
116 116
 	protected function export_records(&$export_object, $options, &$selection, $ids = array())
117 117
 	{
118 118
 		// Pre-load links all at once
119
-		if($ids && $options['mapping']['info_link_id'])
119
+		if ($ids && $options['mapping']['info_link_id'])
120 120
 		{
121 121
 			$links = egw_link::get_links_multiple('infolog', $ids, true, '!'.egw_link::VFS_APPNAME);
122
-			foreach($links as $id => $link) {
123
-				if(!is_array($selection[$id])) break;
122
+			foreach ($links as $id => $link) {
123
+				if (!is_array($selection[$id])) break;
124 124
 				$selection[$id]['info_link_id'] = $link;
125
-				if($options['convert']) $selection[$id]['info_link_id'] = egw_link::title($link['app'], $link['id']);
125
+				if ($options['convert']) $selection[$id]['info_link_id'] = egw_link::title($link['app'], $link['id']);
126 126
 			}
127 127
 		}
128 128
 		// If exporting PM fields, pre-load them all at once
129
-		if($ids && ($options['mapping']['pm_id'] || $options['mapping']['project']))
129
+		if ($ids && ($options['mapping']['pm_id'] || $options['mapping']['project']))
130 130
 		{
131 131
 			$projects = egw_link::get_links_multiple('infolog', $ids, true, 'projectmanager');
132
-			foreach($projects as $id => $links)
132
+			foreach ($projects as $id => $links)
133 133
 			{
134
-				if(!is_array($selection[$id])) break;
134
+				if (!is_array($selection[$id])) break;
135 135
 				$selection[$id]['pm_id'] = current($links);
136 136
 				$selection[$id]['project'] = egw_link::title('projectmanager', $selection[$id]['pm_id']);
137
-				$this->selects['pl_id'] = ExecMethod('projectmanager.projectmanager_pricelist_bo.pricelist',$selection[$id]['pm_id']);
137
+				$this->selects['pl_id'] = ExecMethod('projectmanager.projectmanager_pricelist_bo.pricelist', $selection[$id]['pm_id']);
138 138
 			}
139 139
 		}
140 140
 
141 141
 		foreach ($selection as $_identifier) {
142
-			if(!is_array($_identifier)) {
142
+			if (!is_array($_identifier)) {
143 143
 				$record = new infolog_egw_record($_identifier);
144
-				if($link = $links[$record->info_id]) $record->info_link_id = $options['convert'] ? egw_link::title($link['app'], $link['id']) : $link;
145
-				if($project = $projects[$record->info_id])
144
+				if ($link = $links[$record->info_id]) $record->info_link_id = $options['convert'] ? egw_link::title($link['app'], $link['id']) : $link;
145
+				if ($project = $projects[$record->info_id])
146 146
 				{
147 147
 					$record->pm_id = current($project);
148 148
 					$record->project = egw_link::title('projectmanager', $record->pm_id);
@@ -152,20 +152,20 @@  discard block
 block discarded – undo
152 152
 				$record->set_record($_identifier);
153 153
 			}
154 154
 			// Some conversion
155
-			if($options['convert']) {
155
+			if ($options['convert']) {
156 156
 				$this->selects['info_status'] = $this->bo->get_status($record->info_type);
157 157
 				importexport_export_csv::convert($record, infolog_egw_record::$types, 'infolog', $this->selects);
158 158
 				$this->convert($record);
159 159
 
160 160
 				// Force 0 times to ''
161
-				foreach(array('info_planned_time', 'info_used_time', 'info_replanned_time') as $field)
161
+				foreach (array('info_planned_time', 'info_used_time', 'info_replanned_time') as $field)
162 162
 				{
163
-					if($record->$field == 0) $record->$field = '';
163
+					if ($record->$field == 0) $record->$field = '';
164 164
 				}
165 165
 			} else {
166 166
 				// Implode arrays, so they don't say 'Array'
167
-				foreach($record->get_record_array() as $key => $value) {
168
-					if(is_array($value)) $record->$key = implode(',', $value);
167
+				foreach ($record->get_record_array() as $key => $value) {
168
+					if (is_array($value)) $record->$key = implode(',', $value);
169 169
 				}
170 170
 			}
171 171
 			$export_object->export_record($record);
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 	 */
211 211
 	public function get_filename()
212 212
 	{
213
-		if(is_object($this->export_object) && $this->export_object->get_num_of_records() == 1)
213
+		if (is_object($this->export_object) && $this->export_object->get_num_of_records() == 1)
214 214
 		{
215 215
 			return $this->export_object->record->get_title();
216 216
 		}
@@ -240,18 +240,18 @@  discard block
 block discarded – undo
240 240
 	{
241 241
 		$this->selects['info_type'] = $this->bo->enums['type'];
242 242
 		$this->selects['info_priority'] = $this->bo->enums['priority'];
243
-		$this->selects['pl_id'] = ExecMethod('projectmanager.projectmanager_pricelist_bo.pricelist',false);
243
+		$this->selects['pl_id'] = ExecMethod('projectmanager.projectmanager_pricelist_bo.pricelist', false);
244 244
 		$this->selects['info_status'] = $this->bo->get_status();
245 245
 	}
246 246
 
247 247
 	public function get_filter_fields(Array &$filters)
248 248
 	{
249
-		foreach($filters as $field_name => &$settings)
249
+		foreach ($filters as $field_name => &$settings)
250 250
 		{
251
-			if($this->selects[$field_name]) $settings['values'] = $this->selects[$field_name];
251
+			if ($this->selects[$field_name]) $settings['values'] = $this->selects[$field_name];
252 252
 			
253 253
 			// Infolog can't handle ranges in custom fields due to the way searching is done.
254
-			if(strpos($field_name, '#') === 0 && strpos($settings['type'],'date') === 0) unset($filters[$field_name]);
254
+			if (strpos($field_name, '#') === 0 && strpos($settings['type'], 'date') === 0) unset($filters[$field_name]);
255 255
 		}
256 256
 	}
257 257
 
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 	*
261 261
 	* This is for something specific to Infolog, in addition to the normal conversions.
262 262
 	*/
263
-	public static function convert(infolog_egw_record &$record) {
263
+	public static function convert(infolog_egw_record&$record) {
264 264
 		// Stub, for now
265 265
 	}
266 266
 }
Please login to merge, or discard this patch.
Braces   +94 added lines, -34 removed lines patch added patch discarded remove patch
@@ -14,10 +14,12 @@  discard block
 block discarded – undo
14 14
 /**
15 15
  * export plugin of infolog
16 16
  */
17
-class infolog_export_csv implements importexport_iface_export_plugin {
17
+class infolog_export_csv implements importexport_iface_export_plugin
18
+{
18 19
 
19 20
 
20
-	public function __construct() {
21
+	public function __construct()
22
+	{
21 23
 		translation::add_app('infolog');
22 24
 		$this->bo = new infolog_bo();
23 25
 		$this->get_selects();
@@ -28,7 +30,8 @@  discard block
 block discarded – undo
28 30
 	 *
29 31
 	 * @param egw_record $_definition
30 32
 	 */
31
-	public function export( $_stream, importexport_definition $_definition) {
33
+	public function export( $_stream, importexport_definition $_definition)
34
+	{
32 35
 		$options = $_definition->plugin_options;
33 36
 
34 37
 		$selection = array();
@@ -48,8 +51,10 @@  discard block
 block discarded – undo
48 51
 			case 'all':
49 52
 				// do we need to query the cf's
50 53
 				$query['custom_fields'] = false;
51
-				foreach($options['mapping'] + (array)$_definition->filter as $field => $map) {
52
-					if($field[0] == '#') {
54
+				foreach($options['mapping'] + (array)$_definition->filter as $field => $map)
55
+				{
56
+					if($field[0] == '#')
57
+					{
53 58
 						$query['custom_fields'] = true;
54 59
 						$query['selectcols'] .= ",$field";
55 60
 
@@ -73,11 +78,20 @@  discard block
 block discarded – undo
73 78
 					// Handle ranges
74 79
 					foreach($query['col_filter'] as $field => $value)
75 80
 					{
76
-						if(!is_array($value) || (!$value['from'] && !$value['to'])) continue;
81
+						if(!is_array($value) || (!$value['from'] && !$value['to']))
82
+						{
83
+							continue;
84
+						}
77 85
 
78 86
 						// Ranges are inclusive, so should be provided that way (from 2 to 10 includes 2 and 10)
79
-						if($value['from']) $query['col_filter'][] = "$field >= " . (int)$value['from'];
80
-						if($value['to']) $query['col_filter'][] = "$field <= " . (int)$value['to'];
87
+						if($value['from'])
88
+						{
89
+							$query['col_filter'][] = "$field >= " . (int)$value['from'];
90
+						}
91
+						if($value['to'])
92
+						{
93
+							$query['col_filter'][] = "$field <= " . (int)$value['to'];
94
+						}
81 95
 						unset($query['col_filter'][$field]);
82 96
 					}
83 97
 				}
@@ -89,11 +103,17 @@  discard block
 block discarded – undo
89 103
 
90 104
 					// Pre-load any cfs that are links
91 105
 					$cf_preload = array();
92
-					foreach($cf_links as $field => $app) {
93
-						foreach($selection as &$row) {
94
-							if($row[$field]) $cf_preload[$app][] = $row[$field];
106
+					foreach($cf_links as $field => $app)
107
+					{
108
+						foreach($selection as &$row)
109
+						{
110
+							if($row[$field])
111
+							{
112
+								$cf_preload[$app][] = $row[$field];
113
+							}
95 114
 						}
96
-						if($cf_preload[$app]){
115
+						if($cf_preload[$app])
116
+						{
97 117
 							 $selects[$field] = egw_link::titles($app, $cf_preload[$app]);
98 118
 							//error_log('Preload ' . $field . '['.$app . ']: ' . implode(',',$cf_preload[$app]));
99 119
 						}
@@ -119,10 +139,17 @@  discard block
 block discarded – undo
119 139
 		if($ids && $options['mapping']['info_link_id'])
120 140
 		{
121 141
 			$links = egw_link::get_links_multiple('infolog', $ids, true, '!'.egw_link::VFS_APPNAME);
122
-			foreach($links as $id => $link) {
123
-				if(!is_array($selection[$id])) break;
142
+			foreach($links as $id => $link)
143
+			{
144
+				if(!is_array($selection[$id]))
145
+				{
146
+					break;
147
+				}
124 148
 				$selection[$id]['info_link_id'] = $link;
125
-				if($options['convert']) $selection[$id]['info_link_id'] = egw_link::title($link['app'], $link['id']);
149
+				if($options['convert'])
150
+				{
151
+					$selection[$id]['info_link_id'] = egw_link::title($link['app'], $link['id']);
152
+				}
126 153
 			}
127 154
 		}
128 155
 		// If exporting PM fields, pre-load them all at once
@@ -131,28 +158,39 @@  discard block
 block discarded – undo
131 158
 			$projects = egw_link::get_links_multiple('infolog', $ids, true, 'projectmanager');
132 159
 			foreach($projects as $id => $links)
133 160
 			{
134
-				if(!is_array($selection[$id])) break;
161
+				if(!is_array($selection[$id]))
162
+				{
163
+					break;
164
+				}
135 165
 				$selection[$id]['pm_id'] = current($links);
136 166
 				$selection[$id]['project'] = egw_link::title('projectmanager', $selection[$id]['pm_id']);
137 167
 				$this->selects['pl_id'] = ExecMethod('projectmanager.projectmanager_pricelist_bo.pricelist',$selection[$id]['pm_id']);
138 168
 			}
139 169
 		}
140 170
 
141
-		foreach ($selection as $_identifier) {
142
-			if(!is_array($_identifier)) {
171
+		foreach ($selection as $_identifier)
172
+		{
173
+			if(!is_array($_identifier))
174
+			{
143 175
 				$record = new infolog_egw_record($_identifier);
144
-				if($link = $links[$record->info_id]) $record->info_link_id = $options['convert'] ? egw_link::title($link['app'], $link['id']) : $link;
176
+				if($link = $links[$record->info_id])
177
+				{
178
+					$record->info_link_id = $options['convert'] ? egw_link::title($link['app'], $link['id']) : $link;
179
+				}
145 180
 				if($project = $projects[$record->info_id])
146 181
 				{
147 182
 					$record->pm_id = current($project);
148 183
 					$record->project = egw_link::title('projectmanager', $record->pm_id);
149 184
 				}
150
-			} else {
185
+			}
186
+			else
187
+			{
151 188
 				$record = new infolog_egw_record();
152 189
 				$record->set_record($_identifier);
153 190
 			}
154 191
 			// Some conversion
155
-			if($options['convert']) {
192
+			if($options['convert'])
193
+			{
156 194
 				$this->selects['info_status'] = $this->bo->get_status($record->info_type);
157 195
 				importexport_export_csv::convert($record, infolog_egw_record::$types, 'infolog', $this->selects);
158 196
 				$this->convert($record);
@@ -160,12 +198,21 @@  discard block
 block discarded – undo
160 198
 				// Force 0 times to ''
161 199
 				foreach(array('info_planned_time', 'info_used_time', 'info_replanned_time') as $field)
162 200
 				{
163
-					if($record->$field == 0) $record->$field = '';
201
+					if($record->$field == 0)
202
+					{
203
+						$record->$field = '';
204
+					}
164 205
 				}
165
-			} else {
206
+			}
207
+			else
208
+			{
166 209
 				// Implode arrays, so they don't say 'Array'
167
-				foreach($record->get_record_array() as $key => $value) {
168
-					if(is_array($value)) $record->$key = implode(',', $value);
210
+				foreach($record->get_record_array() as $key => $value)
211
+				{
212
+					if(is_array($value))
213
+					{
214
+						$record->$key = implode(',', $value);
215
+					}
169 216
 				}
170 217
 			}
171 218
 			$export_object->export_record($record);
@@ -178,7 +225,8 @@  discard block
 block discarded – undo
178 225
 	 *
179 226
 	 * @return string name
180 227
 	 */
181
-	public static function get_name() {
228
+	public static function get_name()
229
+	{
182 230
 		return lang('Infolog CSV export');
183 231
 	}
184 232
 
@@ -187,7 +235,8 @@  discard block
 block discarded – undo
187 235
 	 *
188 236
 	 * @return string descriprion
189 237
 	 */
190
-	public static function get_description() {
238
+	public static function get_description()
239
+	{
191 240
 		return lang("Exports Infolog entries into a CSV File.");
192 241
 	}
193 242
 
@@ -196,11 +245,13 @@  discard block
 block discarded – undo
196 245
 	 *
197 246
 	 * @return string suffix
198 247
 	 */
199
-	public static function get_filesuffix() {
248
+	public static function get_filesuffix()
249
+	{
200 250
 		return 'csv';
201 251
 	}
202 252
 
203
-	public static function get_mimetype() {
253
+	public static function get_mimetype()
254
+	{
204 255
 		return 'text/csv';
205 256
 	}
206 257
 
@@ -223,14 +274,16 @@  discard block
 block discarded – undo
223 274
 	 *
224 275
 	 * @return string html
225 276
 	 */
226
-	public function get_options_etpl() {
277
+	public function get_options_etpl()
278
+	{
227 279
 	}
228 280
 
229 281
 	/**
230 282
 	 * returns slectors of this plugin via xajax
231 283
 	 *
232 284
 	 */
233
-	public function get_selectors_etpl() {
285
+	public function get_selectors_etpl()
286
+	{
234 287
 		return array(
235 288
 			'name'	=> 'infolog.export_csv_selectors',
236 289
 		);
@@ -248,10 +301,16 @@  discard block
 block discarded – undo
248 301
 	{
249 302
 		foreach($filters as $field_name => &$settings)
250 303
 		{
251
-			if($this->selects[$field_name]) $settings['values'] = $this->selects[$field_name];
304
+			if($this->selects[$field_name])
305
+			{
306
+				$settings['values'] = $this->selects[$field_name];
307
+			}
252 308
 			
253 309
 			// Infolog can't handle ranges in custom fields due to the way searching is done.
254
-			if(strpos($field_name, '#') === 0 && strpos($settings['type'],'date') === 0) unset($filters[$field_name]);
310
+			if(strpos($field_name, '#') === 0 && strpos($settings['type'],'date') === 0)
311
+			{
312
+				unset($filters[$field_name]);
313
+			}
255 314
 		}
256 315
 	}
257 316
 
@@ -260,7 +319,8 @@  discard block
 block discarded – undo
260 319
 	*
261 320
 	* This is for something specific to Infolog, in addition to the normal conversions.
262 321
 	*/
263
-	public static function convert(infolog_egw_record &$record) {
322
+	public static function convert(infolog_egw_record &$record)
323
+	{
264 324
 		// Stub, for now
265 325
 	}
266 326
 }
Please login to merge, or discard this patch.