Completed
Push — 16.1 ( 592c74...b502d4 )
by Ralf
43:09 queued 19:16
created
calendar/inc/class.calendar_uilist.inc.php 3 patches
Doc Comments   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -539,8 +539,9 @@
 block discarded – undo
539 539
 	 * @param int &$success number of succeded actions
540 540
 	 * @param int &$failed number of failed actions (not enought permissions)
541 541
 	 * @param string &$action_msg translated verb for the actions, to be used in a message like %1 events 'deleted'
542
-	 * @param string/array $session_name 'calendar_list'
543
-	 * @return boolean true if all actions succeded, false otherwise
542
+	 * @param string $session_name 'calendar_list'
543
+	 * @param null|string $msg
544
+	 * @return null|boolean true if all actions succeded, false otherwise
544 545
 	 */
545 546
 	function action($action,$checked,$use_all,&$success,&$failed,&$action_msg,$session_name,&$msg,$skip_notification=false)
546 547
 	{
Please login to merge, or discard this patch.
Braces   +44 added lines, -12 removed lines patch added patch discarded remove patch
@@ -77,8 +77,14 @@  discard block
 block discarded – undo
77 77
 	 */
78 78
 	function listview($_content=null,$msg='',$home=false)
79 79
 	{
80
-		if ($_GET['msg']) $msg .= $_GET['msg'];
81
-		if ($this->group_warning) $msg .= $this->group_warning;
80
+		if ($_GET['msg'])
81
+		{
82
+			$msg .= $_GET['msg'];
83
+		}
84
+		if ($this->group_warning)
85
+		{
86
+			$msg .= $this->group_warning;
87
+		}
82 88
 
83 89
 		$etpl = new Etemplate('calendar.list');
84 90
 
@@ -106,7 +112,8 @@  discard block
 block discarded – undo
106 112
 			{
107 113
 				// Allow merge using the date range filter
108 114
 				if(strpos($_content['nm']['action'],'document') !== false &&
109
-					!count($_content['nm']['selected']) && !$_content['nm']['select_all']) {
115
+					!count($_content['nm']['selected']) && !$_content['nm']['select_all'])
116
+				{
110 117
 					$_content['nm']['selected'][] = $this->get_merge_range($_content['nm']);
111 118
 				}
112 119
 				if (!count($_content['nm']['selected']) && !$_content['nm']['select_all'])
@@ -165,15 +172,21 @@  discard block
 block discarded – undo
165 172
 		{
166 173
 			$params = null;
167 174
 			parse_str(substr($json_data['request']['parameters'][0], 10), $params);	// cut off "/index.php?"
168
-			if (isset($params['keywords']))	// new search => set filters so every match is shown
175
+			if (isset($params['keywords']))
176
+			{
177
+				// new search => set filters so every match is shown
169 178
 			{
170 179
 				$this->adjust_for_search($params['keywords'], $content['nm']);
171 180
 			}
181
+			}
172 182
 		}
173
-		if (isset($_REQUEST['keywords']))	// new search => set filters so every match is shown
183
+		if (isset($_REQUEST['keywords']))
184
+		{
185
+			// new search => set filters so every match is shown
174 186
 		{
175 187
 			$this->adjust_for_search($_REQUEST['keywords'],$content['nm']);
176 188
 		}
189
+		}
177 190
 		$sel_options['filter'] = &$this->date_filters;
178 191
 
179 192
 		// Send categories for row styling - calendar uses no_cat, so they don't go automatically
@@ -263,9 +276,12 @@  discard block
 block discarded – undo
263 276
 		$old_params = Api\Cache::getSession('calendar', 'calendar_list');
264 277
 		if (is_array($old_params))
265 278
 		{
266
-			if ($old_params['filter'] && $old_params['filter'] != $params['filter'])	// filter changed => order accordingly
279
+			if ($old_params['filter'] && $old_params['filter'] != $params['filter'])
280
+			{
281
+				// filter changed => order accordingly
267 282
 			{
268 283
 				$params['order'] = 'cal_start';
284
+			}
269 285
 				$params['sort'] = $params['filter'] == 'before' ? 'DESC' : 'ASC';
270 286
 			}
271 287
 			if ($old_params['search'] != $params['search'])
@@ -292,7 +308,10 @@  discard block
 block discarded – undo
292 308
 			$cfs = array();
293 309
 			foreach($select_cols as $col)
294 310
 			{
295
-				if ($col[0] == '#') $cfs[] = substr($col,1);
311
+				if ($col[0] == '#')
312
+				{
313
+					$cfs[] = substr($col,1);
314
+				}
296 315
 			}
297 316
 		}
298 317
 		$search_params = array(
@@ -524,7 +543,10 @@  discard block
 block discarded – undo
524 543
 		{
525 544
 			$rows['format'] = '64';
526 545
 		}
527
-		if ($this->cat_id) $rows['no_cat_id'] = true;
546
+		if ($this->cat_id)
547
+		{
548
+			$rows['no_cat_id'] = true;
549
+		}
528 550
 		if (!$GLOBALS['egw_info']['user']['apps']['projectmanager'])
529 551
 		{
530 552
 			$params['options-selectcols']['pm_id'] = false;
@@ -590,7 +612,10 @@  discard block
 block discarded – undo
590 612
 			$this->get_rows($query,$events,$readonlys);
591 613
 			foreach($events as $key => $event)
592 614
 			{
593
-				if (!in_array($event['id'],$checked) && !in_array($event['id'].':'.$event['recur_date'], $checked)) unset($events[$key]);
615
+				if (!in_array($event['id'],$checked) && !in_array($event['id'].':'.$event['recur_date'], $checked))
616
+				{
617
+					unset($events[$key]);
618
+				}
594 619
 			}
595 620
 			$checked = array_values($events); // Clear keys
596 621
 		}
@@ -604,7 +629,10 @@  discard block
 block discarded – undo
604 629
 				$ids = array();
605 630
 				foreach($checked as $id)
606 631
 				{
607
-					if (is_array($id)) $id = $id['id'];
632
+					if (is_array($id))
633
+					{
634
+						$id = $id['id'];
635
+					}
608 636
 					// get rid of recurrences, doublicate series and calendar-integration events
609 637
 					if (($id = (int)$id))
610 638
 					{
@@ -618,7 +646,10 @@  discard block
 block discarded – undo
618 646
 				exit();
619 647
 
620 648
 			case 'document':
621
-				if (!$settings) $settings = $GLOBALS['egw_info']['user']['preferences']['calendar']['default_document'];
649
+				if (!$settings)
650
+				{
651
+					$settings = $GLOBALS['egw_info']['user']['preferences']['calendar']['default_document'];
652
+				}
622 653
 				$document_merge = new calendar_merge();
623 654
 				$msg = $document_merge->download($settings, $checked, '', $GLOBALS['egw_info']['user']['preferences']['calendar']['document_dir']);
624 655
 				$failed = count($checked);
@@ -805,7 +836,8 @@  discard block
 block discarded – undo
805 836
 						$success++;
806 837
 
807 838
 						// Can't link to just one of a recurring series of events
808
-						if(!$recur_date || $app) {
839
+						if(!$recur_date || $app)
840
+						{
809 841
 							// Create link
810 842
 							$link_id = $app ? $app_id : $id;
811 843
 							Link::link($app ? $app : 'calendar', $link_id, 'timesheet', $timesheet_bo->data['ts_id']);
Please login to merge, or discard this patch.
Spacing   +152 added lines, -152 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 *
40 40
 	 * @var mixed
41 41
 	 */
42
-	var $debug=false;
42
+	var $debug = false;
43 43
 	/**
44 44
 	 * Filternames
45 45
 	 *
@@ -60,11 +60,11 @@  discard block
 block discarded – undo
60 60
 	 *
61 61
 	 * @param array $set_states =null to manualy set / change one of the states, default NULL = use $_REQUEST
62 62
 	 */
63
-	function __construct($set_states=null)
63
+	function __construct($set_states = null)
64 64
 	{
65
-		parent::__construct(true,$set_states);	// call the parent's constructor
65
+		parent::__construct(true, $set_states); // call the parent's constructor
66 66
 
67
-		foreach($this->date_filters as $name => $label)
67
+		foreach ($this->date_filters as $name => $label)
68 68
 		{
69 69
 			$this->date_filters[$name] = lang($label);
70 70
 		}
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	/**
76 76
 	 * Show the listview
77 77
 	 */
78
-	function listview($_content=null,$msg='',$home=false)
78
+	function listview($_content = null, $msg = '', $home = false)
79 79
 	{
80 80
 		if ($_GET['msg']) $msg .= $_GET['msg'];
81 81
 		if ($this->group_warning) $msg .= $this->group_warning;
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 		$etpl = new Etemplate('calendar.list');
84 84
 
85 85
 		// Handle merge from sidebox
86
-		if($_GET['merge'])
86
+		if ($_GET['merge'])
87 87
 		{
88 88
 			$_content['nm']['action'] = 'document_'.$_GET['merge'];
89 89
 			$_content['nm']['select_all'] = true;
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 		if (is_array($_content))
93 93
 		{
94 94
 			// handle a single button like actions
95
-			foreach(array('delete','timesheet','document') as $button)
95
+			foreach (array('delete', 'timesheet', 'document') as $button)
96 96
 			{
97 97
 				if ($_content['nm']['rows'][$button])
98 98
 				{
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 			if ($_content['nm']['action'])
106 106
 			{
107 107
 				// Allow merge using the date range filter
108
-				if(strpos($_content['nm']['action'],'document') !== false &&
108
+				if (strpos($_content['nm']['action'], 'document') !== false &&
109 109
 					!count($_content['nm']['selected']) && !$_content['nm']['select_all']) {
110 110
 					$_content['nm']['selected'][] = $this->get_merge_range($_content['nm']);
111 111
 				}
@@ -116,14 +116,14 @@  discard block
 block discarded – undo
116 116
 				else
117 117
 				{
118 118
 					$success = $failed = $action_msg = null;
119
-					if ($this->action($_content['nm']['action'],$_content['nm']['selected'],$_content['nm']['select_all'],
120
-						$success,$failed,$action_msg,'calendar_list',$msg, $_content['nm']['checkboxes']['no_notifications']))
119
+					if ($this->action($_content['nm']['action'], $_content['nm']['selected'], $_content['nm']['select_all'],
120
+						$success, $failed, $action_msg, 'calendar_list', $msg, $_content['nm']['checkboxes']['no_notifications']))
121 121
 					{
122
-						$msg .= lang('%1 event(s) %2',$success,$action_msg);
122
+						$msg .= lang('%1 event(s) %2', $success, $action_msg);
123 123
 					}
124
-					elseif(is_null($msg))
124
+					elseif (is_null($msg))
125 125
 					{
126
-						$msg .= lang('%1 event(s) %2, %3 failed because of insufficent rights !!!',$success,$action_msg,$failed);
126
+						$msg .= lang('%1 event(s) %2, %3 failed because of insufficent rights !!!', $success, $action_msg, $failed);
127 127
 					}
128 128
 				}
129 129
 			}
@@ -135,15 +135,15 @@  discard block
 block discarded – undo
135 135
 		{
136 136
 			$content['nm'] = array(
137 137
 				'get_rows'        =>	'calendar.calendar_uilist.get_rows',
138
-	 			'filter_no_lang'  => True,	// I  set no_lang for filter (=dont translate the options)
139
-				'no_filter2'      => True,	// I  disable the 2. filter (params are the same as for filter)
140
-				'no_cat'          => True,	// I  disable the cat-selectbox
138
+	 			'filter_no_lang'  => True, // I  set no_lang for filter (=dont translate the options)
139
+				'no_filter2'      => True, // I  disable the 2. filter (params are the same as for filter)
140
+				'no_cat'          => True, // I  disable the cat-selectbox
141 141
 				'filter'          => 'after',
142
-				'order'           => 'cal_start',// IO name of the column to sort after (optional for the sortheaders)
143
-				'sort'            => 'ASC',// IO direction of the sort: 'ASC' or 'DESC'
142
+				'order'           => 'cal_start', // IO name of the column to sort after (optional for the sortheaders)
143
+				'sort'            => 'ASC', // IO direction of the sort: 'ASC' or 'DESC'
144 144
 				'default_cols'    => '!week,weekday,cal_title,cal_description,recure,cal_location,cal_owner,cat_id,pm_id',
145 145
 				'filter_onchange' => "app.calendar.filter_change",
146
-				'row_id'          => 'row_id',	// set in get rows "$event[id]:$event[recur_date]"
146
+				'row_id'          => 'row_id', // set in get rows "$event[id]:$event[recur_date]"
147 147
 				'row_modified'    => 'modified',
148 148
 				'favorites'       => true,
149 149
 				'placeholder_actions' => array('add')
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 		}
152 152
 		$content['nm']['actions'] = $this->get_actions();
153 153
 
154
-		if (isset($_GET['filter']) && in_array($_GET['filter'],array_keys($this->date_filters)))
154
+		if (isset($_GET['filter']) && in_array($_GET['filter'], array_keys($this->date_filters)))
155 155
 		{
156 156
 			$content['nm']['filter'] = $_GET['filter'];
157 157
 		}
@@ -159,16 +159,16 @@  discard block
 block discarded – undo
159 159
 		{
160 160
 			$content['nm']['search'] = $_GET['search'];
161 161
 		}
162
-		if($this->owner)
162
+		if ($this->owner)
163 163
 		{
164
-			$content['nm']['col_filter']['participant'] = is_array($this->owner) ? $this->owner : explode(',',$this->owner);
164
+			$content['nm']['col_filter']['participant'] = is_array($this->owner) ? $this->owner : explode(',', $this->owner);
165 165
 		}
166 166
 		// search via jdots ajax_exec uses $_REQUEST['json_data'] instead of regular GET parameters
167 167
 		if (isset($_REQUEST['json_data']) && ($json_data = json_decode($_REQUEST['json_data'], true)) &&
168 168
 			!empty($json_data['request']['parameters'][0]))
169 169
 		{
170 170
 			$params = null;
171
-			parse_str(substr($json_data['request']['parameters'][0], 10), $params);	// cut off "/index.php?"
171
+			parse_str(substr($json_data['request']['parameters'][0], 10), $params); // cut off "/index.php?"
172 172
 			if (isset($params['keywords']))	// new search => set filters so every match is shown
173 173
 			{
174 174
 				$this->adjust_for_search($params['keywords'], $content['nm']);
@@ -176,22 +176,22 @@  discard block
 block discarded – undo
176 176
 		}
177 177
 		if (isset($_REQUEST['keywords']))	// new search => set filters so every match is shown
178 178
 		{
179
-			$this->adjust_for_search($_REQUEST['keywords'],$content['nm']);
179
+			$this->adjust_for_search($_REQUEST['keywords'], $content['nm']);
180 180
 		}
181 181
 		$sel_options['filter'] = &$this->date_filters;
182 182
 
183 183
 		// Send categories for row styling - calendar uses no_cat, so they don't go automatically
184 184
 		$sel_options['category'] = array('' => lang('all')) + Etemplate\Widget\Select::typeOptions('select-cat', ',,calendar');
185 185
 		// Prevent double encoding - widget does this on its own, but we're just grabbing the options
186
-		foreach($sel_options['category'] as &$label)
186
+		foreach ($sel_options['category'] as &$label)
187 187
 		{
188
-			if(!is_array($label))
188
+			if (!is_array($label))
189 189
 			{
190
-				$label = html_entity_decode($label, ENT_NOQUOTES,'utf-8');
190
+				$label = html_entity_decode($label, ENT_NOQUOTES, 'utf-8');
191 191
 			}
192
-			elseif($label['label'])
192
+			elseif ($label['label'])
193 193
 			{
194
-				$label['label'] = html_entity_decode($label['label'], ENT_NOQUOTES,'utf-8');
194
+				$label['label'] = html_entity_decode($label['label'], ENT_NOQUOTES, 'utf-8');
195 195
 			}
196 196
 		}
197 197
 
@@ -199,15 +199,15 @@  discard block
 block discarded – undo
199 199
 		if ($this->prefs['limit_des_lines'] > 0 || (string)$this->prefs['limit_des_lines'] == '')
200 200
 		{
201 201
 			$content['css'] .= '<style type="text/css">@media screen { .listDescription {  max-height: '.
202
-				(($this->prefs['limit_des_lines'] ? $this->prefs['limit_des_lines'] : 5) * 1.35).	   // dono why em is not real lines
202
+				(($this->prefs['limit_des_lines'] ? $this->prefs['limit_des_lines'] : 5) * 1.35).// dono why em is not real lines
203 203
 				'em; overflow: auto; }}</style>';
204 204
 		}
205 205
 
206
-		if($msg)
206
+		if ($msg)
207 207
 		{
208 208
 			Framework::message($msg);
209 209
 		}
210
-		$html = $etpl->exec('calendar.calendar_uilist.listview',$content,$sel_options,array(),array(),$home ? -1 : 0);
210
+		$html = $etpl->exec('calendar.calendar_uilist.listview', $content, $sel_options, array(), array(), $home ? -1 : 0);
211 211
 
212 212
 		// Not sure why this has to be echoed instead of appended, but that's what works.
213 213
 		//echo calendar_uiviews::edit_series();
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 	/**
219 219
 	 * set filter for search, so that everything is shown
220 220
 	 */
221
-	function adjust_for_search($keywords,&$params)
221
+	function adjust_for_search($keywords, &$params)
222 222
 	{
223 223
 		$params['search'] = $keywords;
224 224
 		$params['start']  = 0;
@@ -242,9 +242,9 @@  discard block
 block discarded – undo
242 242
 	 * @param array &$rows returned rows/events
243 243
 	 * @param array &$readonlys eg. to disable buttons based on Acl
244 244
 	 */
245
-	function get_rows(&$params,&$rows,&$readonlys)
245
+	function get_rows(&$params, &$rows, &$readonlys)
246 246
 	{
247
-		unset($readonlys);	// not used;
247
+		unset($readonlys); // not used;
248 248
 		//echo "uilist::get_rows() params="; _debug_array($params);
249 249
 		$this->filter = $params['filter'];
250 250
 		if ($params['filter'] == 'custom')
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 			}
275 275
 			if ($old_params['search'] != $params['search'])
276 276
 			{
277
-				$this->adjust_for_search($params['search'],$params);
277
+				$this->adjust_for_search($params['search'], $params);
278 278
 				$this->filter = $params['filter'];
279 279
 			}
280 280
 		}
@@ -282,28 +282,28 @@  discard block
 block discarded – undo
282 282
 		if (!$params['csv_export'])
283 283
 		{
284 284
 			Api\Cache::setSession('calendar', 'calendar_list',
285
-				array_diff_key ($params, array_flip(array('rows', 'actions', 'action_links', 'placeholder_actions'))));
285
+				array_diff_key($params, array_flip(array('rows', 'actions', 'action_links', 'placeholder_actions'))));
286 286
 		}
287 287
 		// do we need to query custom fields and which
288 288
 		// Check stored preference if selectcols isn't available (ie: first call)
289 289
 		$select_cols = $params['selectcols'] ? $params['selectcols'] : $GLOBALS['egw_info']['user']['preferences']['calendar']['nextmatch-calendar.list.rows'];
290
-		if(!is_array($params['selectcols']))
290
+		if (!is_array($params['selectcols']))
291 291
 		{
292
-			$select_cols = explode(',',$select_cols);
292
+			$select_cols = explode(',', $select_cols);
293 293
 		}
294
-		if (in_array('cfs',$select_cols))
294
+		if (in_array('cfs', $select_cols))
295 295
 		{
296 296
 			$cfs = array();
297
-			foreach($select_cols as $col)
297
+			foreach ($select_cols as $col)
298 298
 			{
299
-				if ($col[0] == '#') $cfs[] = substr($col,1);
299
+				if ($col[0] == '#') $cfs[] = substr($col, 1);
300 300
 			}
301 301
 		}
302 302
 		$search_params = array(
303 303
 			'cat_id'  => $params['cat_id'] ? $params['cat_id'] : 0,
304 304
 			'filter'  => $this->filter,
305 305
 			'query'   => $params['search'],
306
-			'offset'  => (int) $params['start'],
306
+			'offset'  => (int)$params['start'],
307 307
 			'num_rows'=> $params['num_rows'],
308 308
 			'order'   => $params['order'] ? $params['order'].' '.$params['sort'] : 'cal_start ASC',
309 309
 			'cfs'	 => $params['csv_export'] ? array() : $cfs,
@@ -311,24 +311,24 @@  discard block
 block discarded – undo
311 311
 		// Non-blocking events above blocking
312 312
 		$search_params['order'] .= ', cal_non_blocking DESC';
313 313
 
314
-		switch($this->filter)
314
+		switch ($this->filter)
315 315
 		{
316 316
 			case 'all':
317 317
 				break;
318 318
 			case 'before':
319
-				$search_params['end'] = $params['date'] ? Api\DateTime::to($params['date'],'ts') : $this->date;
320
-				$label = lang('Before %1',$this->bo->long_date($search_params['end']));
319
+				$search_params['end'] = $params['date'] ? Api\DateTime::to($params['date'], 'ts') : $this->date;
320
+				$label = lang('Before %1', $this->bo->long_date($search_params['end']));
321 321
 				break;
322 322
 			case 'custom':
323
-				$this->first = $search_params['start'] = Api\DateTime::to($params['startdate'],'ts');
324
-				$this->last  = $search_params['end'] = strtotime('+1 day', $this->bo->date2ts($params['enddate']))-1;
325
-				$label = $this->bo->long_date($this->first,$this->last);
323
+				$this->first = $search_params['start'] = Api\DateTime::to($params['startdate'], 'ts');
324
+				$this->last  = $search_params['end'] = strtotime('+1 day', $this->bo->date2ts($params['enddate'])) - 1;
325
+				$label = $this->bo->long_date($this->first, $this->last);
326 326
 				break;
327 327
 			case 'today':
328 328
 				$today = new Api\DateTime();
329 329
 				$today->setTime(0, 0, 0);
330 330
 				$this->first = $search_params['start'] = $today->format('ts');
331
-				$today->setTime(23,59,59);
331
+				$today->setTime(23, 59, 59);
332 332
 				$this->last  = $search_params['end'] = $today->format('ts');
333 333
 				break;
334 334
 			case 'week':
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 				$this->last['hour'] = 23; $this->last['minute'] = $this->last['sec'] = 59;
341 341
 				unset($this->last['raw']);
342 342
 				$this->last = $this->bo->date2ts($this->last);
343
-				$this->date_filters['week'] = $label = lang('Week').' '.adodb_date('W',$this->first).': '.$this->bo->long_date($this->first,$this->last);
343
+				$this->date_filters['week'] = $label = lang('Week').' '.adodb_date('W', $this->first).': '.$this->bo->long_date($this->first, $this->last);
344 344
 				$search_params['start'] = $this->first;
345 345
 				$search_params['end'] = $this->last;
346 346
 				$params['startdate'] = Api\DateTime::to($this->first, Api\DateTime::ET2);
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 				unset($this->first['raw']);
354 354
 				$this->last = $this->first;
355 355
 				$this->last['month'] += 1;
356
-				$this->date_filters['month'] = $label = lang(adodb_date('F',$this->bo->date2ts($params['date']))).' '.$this->first['year'];
356
+				$this->date_filters['month'] = $label = lang(adodb_date('F', $this->bo->date2ts($params['date']))).' '.$this->first['year'];
357 357
 				$this->first = $this->bo->date2ts($this->first);
358 358
 				$this->last = $this->bo->date2ts($this->last);
359 359
 				$this->last--;
@@ -366,22 +366,22 @@  discard block
 block discarded – undo
366 366
 				// fall through to after given date
367 367
 			case 'after':
368 368
 			default:
369
-				$this->date = $params['startdate'] ? Api\DateTime::to($params['startdate'],'ts') : $this->date;
370
-				$label = lang('After %1',$this->bo->long_date($this->date));
369
+				$this->date = $params['startdate'] ? Api\DateTime::to($params['startdate'], 'ts') : $this->date;
370
+				$label = lang('After %1', $this->bo->long_date($this->date));
371 371
 				$search_params['start'] = $this->date;
372 372
 				break;
373 373
 		}
374
-		if($params['status_filter'])
374
+		if ($params['status_filter'])
375 375
 		{
376 376
 			$search_params['filter'] = $params['status_filter'];
377 377
 		}
378 378
 		if ($params['col_filter']['participant'])
379 379
 		{
380
-			$search_params['users'] = is_array($params['col_filter']['participant']) ? $params['col_filter']['participant'] : array( $params['col_filter']['participant']);
380
+			$search_params['users'] = is_array($params['col_filter']['participant']) ? $params['col_filter']['participant'] : array($params['col_filter']['participant']);
381 381
 		}
382 382
 		elseif (!$params['col_filter'] || !$params['col_filter']['participant'])
383 383
 		{
384
-			$search_params['users'] = $params['owner'] ? $params['owner'] : explode(',',$this->owner);
384
+			$search_params['users'] = $params['owner'] ? $params['owner'] : explode(',', $this->owner);
385 385
 		}
386 386
 		// Allow private to stay for all viewed owners, even if in separate calendars
387 387
 		$search_params['private_allowed'] = (array)$params['selected_owners'] + (array)$search_params['users'];
@@ -389,9 +389,9 @@  discard block
 block discarded – undo
389 389
 		if ($params['col_filter'])
390 390
 		{
391 391
 			$col_filter = array();
392
-			foreach($params['col_filter'] as $name => $val)
392
+			foreach ($params['col_filter'] as $name => $val)
393 393
 			{
394
-				if (!in_array($name, array('participant','row_id')) && (string)$val !== '')
394
+				if (!in_array($name, array('participant', 'row_id')) && (string)$val !== '')
395 395
 				{
396 396
 					$col_filter[$name] = $val;
397 397
 				}
@@ -401,18 +401,18 @@  discard block
 block discarded – undo
401 401
 
402 402
 		// App header is mostly taken care of on the client side, but here we update
403 403
 		// it to match changing list filters
404
-		if($params['view'] && $params['view'] == 'listview')
404
+		if ($params['view'] && $params['view'] == 'listview')
405 405
 		{
406 406
 			Api\Json\Response::get()->call('app.calendar.set_app_header',
407
-				(count($search_params['users']) == 1 ? $this->bo->participant_name($search_params['users'][0]).': ' : '') .
407
+				(count($search_params['users']) == 1 ? $this->bo->participant_name($search_params['users'][0]).': ' : '').
408 408
 				$label);
409 409
 		}
410
-		foreach((array) $this->bo->search($search_params, !empty($col_filter) ? $col_filter : null) as $event)
410
+		foreach ((array)$this->bo->search($search_params, !empty($col_filter) ? $col_filter : null) as $event)
411 411
 		{
412 412
 
413 413
 			if ($params['csv_export'])
414 414
 			{
415
-				$event['participants'] = implode(",\n",$this->bo->participants($event,true));
415
+				$event['participants'] = implode(",\n", $this->bo->participants($event, true));
416 416
 			}
417 417
 			else
418 418
 			{
@@ -420,23 +420,23 @@  discard block
 block discarded – undo
420 420
 			}
421 421
 
422 422
 			$matches = null;
423
-			if(!(int)$event['id'] && preg_match('/^([a-z_-]+)([0-9]+)$/i',$event['id'],$matches))
423
+			if (!(int)$event['id'] && preg_match('/^([a-z_-]+)([0-9]+)$/i', $event['id'], $matches))
424 424
 			{
425 425
 				$app = $matches[1];
426 426
 				$app_id = $matches[2];
427 427
 				$icons = array();
428
-				if (($is_private = calendar_bo::integration_get_private($app,$app_id,$event)))
428
+				if (($is_private = calendar_bo::integration_get_private($app, $app_id, $event)))
429 429
 				{
430
-					$icons[] = Api\Html::image('calendar','private');
430
+					$icons[] = Api\Html::image('calendar', 'private');
431 431
 				}
432 432
 				else
433 433
 				{
434
-					$icons = calendar_uiviews::integration_get_icons($app,$app_id,$event);
434
+					$icons = calendar_uiviews::integration_get_icons($app, $app_id, $event);
435 435
 				}
436 436
 			}
437 437
 			else
438 438
 			{
439
-				$is_private = !$this->bo->check_perms(Acl::READ,$event);
439
+				$is_private = !$this->bo->check_perms(Acl::READ, $event);
440 440
 			}
441 441
 			if ($is_private)
442 442
 			{
@@ -447,9 +447,9 @@  discard block
 block discarded – undo
447 447
 			$event['app_id'] = $event['id'];
448 448
 
449 449
 			// Edit link
450
-			if($app && $app_id)
450
+			if ($app && $app_id)
451 451
 			{
452
-				$popup = calendar_uiviews::integration_get_popup($app,$app_id);
452
+				$popup = calendar_uiviews::integration_get_popup($app, $app_id);
453 453
 
454 454
 				// Need to strip off 'onclick'
455 455
 				$event['edit_link'] = preg_replace('/ ?onclick="(.+)"/i', '$1', $popup);
@@ -460,18 +460,18 @@  discard block
 block discarded – undo
460 460
 				// populate js_integration_data, if not already set
461 461
 				if (!isset($js_integration_data[$app]))
462 462
 				{
463
-					$js_integration_data[$app] = calendar_bo::integration_get_data($app,'edit_link');
463
+					$js_integration_data[$app] = calendar_bo::integration_get_data($app, 'edit_link');
464 464
 				}
465 465
 			}
466 466
 			elseif ($event['recur_type'] != MCAL_RECUR_NONE)
467 467
 			{
468
-				$event['app_id'] .= ':'.Api\DateTime::to($event['recur_date'] ? $event['recur_date'] : $event['start'],'ts');
468
+				$event['app_id'] .= ':'.Api\DateTime::to($event['recur_date'] ? $event['recur_date'] : $event['start'], 'ts');
469 469
 			}
470 470
 
471 471
 			// Format start and end with timezone
472
-			foreach(array('start','end') as $time)
472
+			foreach (array('start', 'end') as $time)
473 473
 			{
474
-				$event[$time] = Api\DateTime::to($event[$time],'Y-m-d\TH:i:s\Z');
474
+				$event[$time] = Api\DateTime::to($event[$time], 'Y-m-d\TH:i:s\Z');
475 475
 			}
476 476
 
477 477
 			$rows[] = $event;
@@ -481,35 +481,35 @@  discard block
 block discarded – undo
481 481
 		// set js_calendar_integration object, to use it in app.js cal_open() function
482 482
 		$params['js_integration_data'] = json_encode($js_integration_data);
483 483
 
484
-		$wv=0;
485
-		$dv=0;
484
+		$wv = 0;
485
+		$dv = 0;
486 486
 
487 487
 		// Add in some select options
488
-		$users = is_array($search_params['users']) ? $search_params['users'] : explode(',',$search_params['users']);
488
+		$users = is_array($search_params['users']) ? $search_params['users'] : explode(',', $search_params['users']);
489 489
 
490 490
 		$this->bo->warnings['groupmembers'] = '';
491
-		if(($message = $this->check_owners_access($users)))
491
+		if (($message = $this->check_owners_access($users)))
492 492
 		{
493 493
 			Api\Json\Response::get()->error($message);
494 494
 		}
495
-		else if($this->bo->warnings['groupmembers'])
495
+		else if ($this->bo->warnings['groupmembers'])
496 496
 		{
497 497
 			Api\Json\Response::get()->error($this->bo->warnings['groupmembers']);
498 498
 		}
499 499
 		$rows['sel_options']['filter'] = $this->date_filters;
500
-		if($label)
500
+		if ($label)
501 501
 		{
502 502
 			$rows['sel_options']['filter'][$params['filter']] = $label;
503 503
 		}
504
-		foreach($users as $owner)
504
+		foreach ($users as $owner)
505 505
 		{
506
-			if(!is_int($owner) && $this->bo->resources[$owner[0]])
506
+			if (!is_int($owner) && $this->bo->resources[$owner[0]])
507 507
 			{
508 508
 				$app = $this->bo->resources[$owner[0]]['app'];
509
-				$_owner = substr($owner,1);
509
+				$_owner = substr($owner, 1);
510 510
 				// Try link first
511
-				$title = Link::title($app, $_owner );
512
-				if($title)
511
+				$title = Link::title($app, $_owner);
512
+				if ($title)
513 513
 				{
514 514
 					$rows['sel_options']['owner'][$owner] = $title;
515 515
 				}
@@ -517,15 +517,15 @@  discard block
 block discarded – undo
517 517
 		}
518 518
 		$params['options-selectcols']['week'] = lang('Week');
519 519
 		$params['options-selectcols']['weekday'] = lang('Weekday');
520
-		if ((substr($this->cal_prefs['nextmatch-calendar.list.rows'],0,4) == 'week' && strlen($this->cal_prefs['nextmatch-calendar.list.rows'])==4) || substr($this->cal_prefs['nextmatch-calendar.list.rows'],0,5) == 'week,')
520
+		if ((substr($this->cal_prefs['nextmatch-calendar.list.rows'], 0, 4) == 'week' && strlen($this->cal_prefs['nextmatch-calendar.list.rows']) == 4) || substr($this->cal_prefs['nextmatch-calendar.list.rows'], 0, 5) == 'week,')
521 521
 		{
522
-			$rows['format'] = '32';	// prefix date with week-number
523
-			$wv=1;
522
+			$rows['format'] = '32'; // prefix date with week-number
523
+			$wv = 1;
524 524
 		}
525
-		if (!(strpos($this->cal_prefs['nextmatch-calendar.list.rows'],'weekday')===FALSE))
525
+		if (!(strpos($this->cal_prefs['nextmatch-calendar.list.rows'], 'weekday') === FALSE))
526 526
 		{
527 527
 			$rows['format'] = '16';
528
-			$dv=1;
528
+			$dv = 1;
529 529
 		}
530 530
 		if ($wv && $dv)
531 531
 		{
@@ -552,36 +552,36 @@  discard block
 block discarded – undo
552 552
 	 * @param string/array $session_name 'calendar_list'
553 553
 	 * @return boolean true if all actions succeded, false otherwise
554 554
 	 */
555
-	function action($action,$checked,$use_all,&$success,&$failed,&$action_msg,$session_name,&$msg,$skip_notification=false)
555
+	function action($action, $checked, $use_all, &$success, &$failed, &$action_msg, $session_name, &$msg, $skip_notification = false)
556 556
 	{
557 557
 		//error_log(__METHOD__."('$action', ".array2string($checked).', all='.(int)$use_all.", ...)");
558 558
 		$success = $failed = 0;
559 559
 		$msg = null;
560 560
 
561 561
 		// Split out combined values
562
-		if(strpos($action, 'status') !== false)
562
+		if (strpos($action, 'status') !== false)
563 563
 		{
564 564
 			list($action, $status) = explode('-', $action);
565 565
 		}
566 566
 		elseif (strpos($action, '_') !== false)
567 567
 		{
568
-			list($action, $settings) = explode('_', $action,2);
568
+			list($action, $settings) = explode('_', $action, 2);
569 569
 		}
570 570
 
571 571
 		if ($use_all)
572 572
 		{
573 573
 			// get the whole selection
574 574
 			$query = is_array($session_name) ? $session_name : Api\Cache::getSession('calendar', $session_name);
575
-			@set_time_limit(0);				// switch off the execution time limit, as for big selections it's too small
576
-			$query['num_rows'] = -1;		// all
575
+			@set_time_limit(0); // switch off the execution time limit, as for big selections it's too small
576
+			$query['num_rows'] = -1; // all
577 577
 			$readonlys = null;
578
-			$this->get_rows($query,$checked,$readonlys,!in_array($action,array('ical','document')));	   // true = only return the id's
578
+			$this->get_rows($query, $checked, $readonlys, !in_array($action, array('ical', 'document'))); // true = only return the id's
579 579
 			// Get rid of any extras (rows that aren't events)
580
-			if(in_array($action,array('ical','document')))
580
+			if (in_array($action, array('ical', 'document')))
581 581
 			{
582
-				foreach($checked as $key => $event)
582
+				foreach ($checked as $key => $event)
583 583
 				{
584
-					if(!is_numeric($key))
584
+					if (!is_numeric($key))
585 585
 					{
586 586
 						unset($checked[$key]);
587 587
 					}
@@ -589,27 +589,27 @@  discard block
 block discarded – undo
589 589
 			}
590 590
 		}
591 591
 		// for calendar integration we have to fetch all rows and unset the not selected ones, as we can not filter by id
592
-		elseif($action == 'document')
592
+		elseif ($action == 'document')
593 593
 		{
594 594
 			$query = is_array($session_name) ? $session_name : Api\Cache::getSession('calendar', $session_name);
595
-			@set_time_limit(0);				// switch off the execution time limit, as for big selections it's too small
595
+			@set_time_limit(0); // switch off the execution time limit, as for big selections it's too small
596 596
 			$events = null;
597
-			$this->get_rows($query,$events,$readonlys);
598
-			foreach($events as $key => $event)
597
+			$this->get_rows($query, $events, $readonlys);
598
+			foreach ($events as $key => $event)
599 599
 			{
600
-				if (!in_array($event['id'],$checked) && !in_array($event['id'].':'.$event['recur_date'], $checked)) unset($events[$key]);
600
+				if (!in_array($event['id'], $checked) && !in_array($event['id'].':'.$event['recur_date'], $checked)) unset($events[$key]);
601 601
 			}
602 602
 			$checked = array_values($events); // Clear keys
603 603
 		}
604 604
 
605 605
 		// Actions where one action is done to the group
606
-		switch($action)
606
+		switch ($action)
607 607
 		{
608 608
 			case 'ical':
609 609
 				// compile list of unique cal_id's, as iCal should contain whole series, not recurrences
610 610
 				// calendar_ical->exportVCal needs to read events again, to get them in server-time
611 611
 				$ids = array();
612
-				foreach($checked as $id)
612
+				foreach ($checked as $id)
613 613
 				{
614 614
 					if (is_array($id)) $id = $id['id'];
615 615
 					// get rid of recurrences, doublicate series and calendar-integration events
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
 					}
620 620
 				}
621 621
 				$boical = new calendar_ical();
622
-				$ical =& $boical->exportVCal($ids, '2.0', 'PUBLISH');
622
+				$ical = & $boical->exportVCal($ids, '2.0', 'PUBLISH');
623 623
 				Api\Header\Content::type('event.ics', 'text/calendar', bytes($ical));
624 624
 				echo $ical;
625 625
 				exit();
@@ -634,19 +634,19 @@  discard block
 block discarded – undo
634 634
 		}
635 635
 
636 636
 		// Actions where the action is applied to each entry
637
-		if(strpos($action, 'timesheet') !== false)
637
+		if (strpos($action, 'timesheet') !== false)
638 638
 		{
639 639
 			$timesheet_bo = new timesheet_bo();
640 640
 		}
641
-		foreach($checked as &$id)
641
+		foreach ($checked as &$id)
642 642
 		{
643 643
 			$recur_date = $app = $app_id = null;
644
-			if(is_array($id) && $id['id'])
644
+			if (is_array($id) && $id['id'])
645 645
 			{
646 646
 				$id = $id['id'];
647 647
 			}
648 648
 			$matches = null;
649
-			if(!(int)$id && preg_match('/^([a-z_-]+)([0-9]+)$/i',$id,$matches))
649
+			if (!(int)$id && preg_match('/^([a-z_-]+)([0-9]+)$/i', $id, $matches))
650 650
 			{
651 651
 				$app = $matches[1];
652 652
 				$app_id = $matches[2];
@@ -654,36 +654,36 @@  discard block
 block discarded – undo
654 654
 			}
655 655
 			else
656 656
 			{
657
-				list($id,$recur_date) = explode(':',$id);
657
+				list($id, $recur_date) = explode(':', $id);
658 658
 			}
659
-			switch($action)
659
+			switch ($action)
660 660
 			{
661 661
 				case 'delete':
662 662
 					$action_msg = lang('deleted');
663
-					if($settings == 'series')
663
+					if ($settings == 'series')
664 664
 					{
665 665
 						// Delete the whole thing
666 666
 						$recur_date = 0;
667 667
 					}
668
-					if ($id && $this->bo->delete($id, $recur_date,false,$skip_notification))
668
+					if ($id && $this->bo->delete($id, $recur_date, false, $skip_notification))
669 669
 					{
670 670
 						$success++;
671
-						if(!$recur_date && $settings == 'series')
671
+						if (!$recur_date && $settings == 'series')
672 672
 						{
673 673
 							// If there are multiple events in a series selected, the next one could purge
674
-							foreach($checked as $key => $c_id)
674
+							foreach ($checked as $key => $c_id)
675 675
 							{
676
-								list($c_id,$recur_date) = explode(':',$c_id);
677
-								if($c_id == $id)
676
+								list($c_id, $recur_date) = explode(':', $c_id);
677
+								if ($c_id == $id)
678 678
 								{
679 679
 									unset($checked[$key]);
680 680
 								}
681 681
 							}
682 682
 						}
683 683
 
684
-						if(Api\Json\Response::isJSONResponse())
684
+						if (Api\Json\Response::isJSONResponse())
685 685
 						{
686
-							Api\Json\Response::get()->call('egw.refresh','','calendar',$id,'delete');
686
+							Api\Json\Response::get()->call('egw.refresh', '', 'calendar', $id, 'delete');
687 687
 						}
688 688
 					}
689 689
 					else
@@ -693,23 +693,23 @@  discard block
 block discarded – undo
693 693
 					break;
694 694
 				case 'undelete':
695 695
 					$action_msg = lang('recovered');
696
-					if($settings == 'series')
696
+					if ($settings == 'series')
697 697
 					{
698 698
 						// unDelete the whole thing
699 699
 						$recur_date = 0;
700 700
 					}
701
-					if ($id && ($event = $this->bo->read($id, $recur_date)) && $this->bo->check_perms(Acl::EDIT,$id) &&
701
+					if ($id && ($event = $this->bo->read($id, $recur_date)) && $this->bo->check_perms(Acl::EDIT, $id) &&
702 702
 						is_array($event) && $event['deleted'])
703 703
 					{
704 704
 						$event['deleted'] = null;
705
-						if($this->bo->save($event))
705
+						if ($this->bo->save($event))
706 706
 						{
707 707
 							$success++;
708 708
 
709
-							if(Api\Json\Response::isJSONResponse())
709
+							if (Api\Json\Response::isJSONResponse())
710 710
 							{
711
-								Api\Json\Response::get()->call('egw.dataStoreUID','calendar::'.$id,$this->to_client($this->bo->read($id,$recur_date)));
712
-								Api\Json\Response::get()->call('egw.refresh','','calendar',$id,'edit');
711
+								Api\Json\Response::get()->call('egw.dataStoreUID', 'calendar::'.$id, $this->to_client($this->bo->read($id, $recur_date)));
712
+								Api\Json\Response::get()->call('egw.refresh', '', 'calendar', $id, 'edit');
713 713
 							}
714 714
 							break;
715 715
 						}
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
 					break;
719 719
 				case 'status':
720 720
 					$action_msg = lang('Status changed');
721
-					if($id && ($event = $this->bo->read($id, $recur_date)))
721
+					if ($id && ($event = $this->bo->read($id, $recur_date)))
722 722
 					{
723 723
 						$old_status = $event['participants'][$GLOBALS['egw_info']['user']['account_id']];
724 724
 						$quantity = $role = null;
@@ -727,12 +727,12 @@  discard block
 block discarded – undo
727 727
 						{
728 728
 							//echo "<p>$uid: status changed '$data[old_status]' --> '$status<'/p>\n";
729 729
 							$new_status = calendar_so::combine_status($status, $quantity, $role);
730
-							if ($this->bo->set_status($event,$GLOBALS['egw_info']['user']['account_id'],$new_status,$recur_date,
731
-								false,true,$skip_notification))
730
+							if ($this->bo->set_status($event, $GLOBALS['egw_info']['user']['account_id'], $new_status, $recur_date,
731
+								false, true, $skip_notification))
732 732
 							{
733
-								if(Api\Json\Response::isJSONResponse())
733
+								if (Api\Json\Response::isJSONResponse())
734 734
 								{
735
-									Api\Json\Response::get()->call('egw.dataStoreUID','calendar::'.$id,$this->to_client($this->bo->read($id,$recur_date)));
735
+									Api\Json\Response::get()->call('egw.dataStoreUID', 'calendar::'.$id, $this->to_client($this->bo->read($id, $recur_date)));
736 736
 								}
737 737
 								$success++;
738 738
 								//$msg = lang('Status changed');
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
 					}
750 750
 					break;
751 751
 				case 'timesheet-add':
752
-					if($id && !$app)
752
+					if ($id && !$app)
753 753
 					{
754 754
 						$event = $this->bo->read($id, $recur_date);
755 755
 					}
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
 						$result = $this->bo->search($query);
762 762
 						$event = $result[$app.$app_id];
763 763
 					}
764
-					if(!$event)
764
+					if (!$event)
765 765
 					{
766 766
 						$failed++;
767 767
 						continue;
@@ -778,16 +778,16 @@  discard block
 block discarded – undo
778 778
 					);
779 779
 
780 780
 					// Add global categories
781
-					$categories = explode(',',$event['category']);
781
+					$categories = explode(',', $event['category']);
782 782
 					$global_categories = array();
783
-					foreach($categories as $cat_id)
783
+					foreach ($categories as $cat_id)
784 784
 					{
785
-						if($GLOBALS['egw']->categories->is_global($cat_id))
785
+						if ($GLOBALS['egw']->categories->is_global($cat_id))
786 786
 						{
787 787
 							$global_categories[] = $cat_id;
788 788
 						}
789 789
 					}
790
-					if(count($global_categories))
790
+					if (count($global_categories))
791 791
 					{
792 792
 						$timesheet['cat_id'] = implode(',', $global_categories);
793 793
 					}
@@ -807,12 +807,12 @@  discard block
 block discarded – undo
807 807
 						}
808 808
 					}
809 809
 
810
-					if(!$err)
810
+					if (!$err)
811 811
 					{
812 812
 						$success++;
813 813
 
814 814
 						// Can't link to just one of a recurring series of events
815
-						if(!$recur_date || $app) {
815
+						if (!$recur_date || $app) {
816 816
 							// Create link
817 817
 							$link_id = $app ? $app_id : $id;
818 818
 							Link::link($app ? $app : 'calendar', $link_id, 'timesheet', $timesheet_bo->data['ts_id']);
@@ -840,7 +840,7 @@  discard block
 block discarded – undo
840 840
 	protected function get_merge_range($nm)
841 841
 	{
842 842
 		$checked = array();
843
-		if($nm['filter'] == 'fixed')
843
+		if ($nm['filter'] == 'fixed')
844 844
 		{
845 845
 			$checked['start'] = $nm['startdate'];
846 846
 			$last = $this->bo->date2array($nm['enddate']);
@@ -849,7 +849,7 @@  discard block
 block discarded – undo
849 849
 		}
850 850
 		else
851 851
 		{
852
-			switch($nm['filter'])
852
+			switch ($nm['filter'])
853 853
 			{
854 854
 				case 'after':
855 855
 					$checked['start'] = $nm['startdate'] ? $nm['startdate'] : strtotime('today');
@@ -862,8 +862,8 @@  discard block
 block discarded – undo
862 862
 					$checked['end'] = $nm['enddate'];
863 863
 					break;
864 864
 				default:
865
-					$date = date_create_from_format('Ymd',$this->date);
866
-					$checked['start']= $date->format('U');
865
+					$date = date_create_from_format('Ymd', $this->date);
866
+					$checked['start'] = $date->format('U');
867 867
 			}
868 868
 		}
869 869
 		return $checked;
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
 				'allowOnMultiple' => false,
889 889
 				'url' => 'menuaction=calendar.calendar_uiforms.edit&cal_id=$id',
890 890
 				'popup' => Link::get_registry('calendar', 'view_popup'),
891
-				'group' => $group=1,
891
+				'group' => $group = 1,
892 892
 				'onExecute' => 'javaScript:app.calendar.cal_open',
893 893
 				'disableClass' => 'rowNoView',
894 894
 			),
@@ -921,7 +921,7 @@  discard block
 block discarded – undo
921 921
 				'group' => $group,
922 922
 			),
923 923
 		);
924
-		$status = array_map('lang',$this->bo->verbose_status);
924
+		$status = array_map('lang', $this->bo->verbose_status);
925 925
 		unset($status['G']);
926 926
 		$actions['status'] = array(
927 927
 			'caption' => 'Change your status',
@@ -930,7 +930,7 @@  discard block
 block discarded – undo
930 930
 			'children' => $status,
931 931
 			'group' => ++$group,
932 932
 		);
933
-		++$group;	// integration with other apps: infolog, calendar, filemanager
933
+		++$group; // integration with other apps: infolog, calendar, filemanager
934 934
 		if ($GLOBALS['egw_info']['user']['apps']['filemanager'])
935 935
 		{
936 936
 			$actions['filemanager'] = array(
@@ -962,7 +962,7 @@  discard block
 block discarded – undo
962 962
 				'url' => 'menuaction=timesheet.timesheet_ui.edit&link_app[]=$app&link_id[]=$id',
963 963
 				'group' => $group,
964 964
 				'allowOnMultiple' => false,
965
-				'hideOnDisabled' => true,	// show only one timesheet action in context menu
965
+				'hideOnDisabled' => true, // show only one timesheet action in context menu
966 966
 				'onExecute' => 'javaScript:app.calendar.cal_fix_app_id',
967 967
 				'popup' => Link::get_registry('timesheet', 'add_popup'),
968 968
 			);
@@ -971,7 +971,7 @@  discard block
 block discarded – undo
971 971
 				'caption' => 'Timesheet',
972 972
 				'group' => $group,
973 973
 				'allowOnMultiple' => 'only',
974
-				'hideOnDisabled' => true,	// show only one timesheet action in context menu
974
+				'hideOnDisabled' => true, // show only one timesheet action in context menu
975 975
 			);
976 976
 		}
977 977
 		$actions['ical'] = array(
@@ -980,11 +980,11 @@  discard block
 block discarded – undo
980 980
 			'group' => ++$group,
981 981
 			'hint' => 'Download this event as iCal',
982 982
 			'disableClass' => 'rowNoView',
983
-			'postSubmit' => true,	// download needs post submit (not Ajax) to work
983
+			'postSubmit' => true, // download needs post submit (not Ajax) to work
984 984
 		);
985 985
 		$actions['documents'] = calendar_merge::document_action(
986 986
 			$this->bo->cal_prefs['document_dir'], ++$group, 'Insert in document', 'document_',
987
-			$this->bo->cal_prefs['default_document'],Api\Storage\Merge::getExportLimit('calendar')
987
+			$this->bo->cal_prefs['default_document'], Api\Storage\Merge::getExportLimit('calendar')
988 988
 		);
989 989
 		++$group;
990 990
 		$actions['delete'] = array(
@@ -994,7 +994,7 @@  discard block
 block discarded – undo
994 994
 			'disableClass' => 'rowNoDelete',
995 995
 		);
996 996
 		// Add in deleted for admins
997
-		if($GLOBALS['egw_info']['server']['calendar_delete_history'])
997
+		if ($GLOBALS['egw_info']['server']['calendar_delete_history'])
998 998
 		{
999 999
 			$actions['undelete'] = array(
1000 1000
 				'caption' => 'Un-delete',
Please login to merge, or discard this patch.
calendar/inc/class.calendar_uiviews.inc.php 3 patches
Doc Comments   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 	/**
413 413
 	 * Displays the planner view
414 414
 	 *
415
-	 * @param boolean|Etemplate $home = false if etemplate return content suitable for home-page
415
+	 * @param null|Etemplate $home = false if etemplate return content suitable for home-page
416 416
 	 */
417 417
 	function &planner($content = array(), $home=false)
418 418
 	{
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
 	 * Used for home app
498 498
 	 *
499 499
 	 * @param int $weeks = 0 number of weeks to show, if 0 (default) all weeks of one month are shown
500
-	 * @param boolean|etemplate2 $home = false if not false return content suitable for home-page
500
+	 * @param null|Etemplate $home = false if not false return content suitable for home-page
501 501
 	 */
502 502
 	function &month($weeks=0,$home=false)
503 503
 	{
@@ -580,6 +580,8 @@  discard block
 block discarded – undo
580 580
 	 * @param int &$first timestamp 0h of first day of week containing the first of the current month
581 581
 	 * @param int &$last timestamp 23:59:59 of last day of week containg the last day of the current month
582 582
 	 * @param int $day = 1 should the alignment be based on the 1. of the month or an other date, eg. the 15.
583
+	 * @param integer $first
584
+	 * @param integer $last
583 585
 	 */
584 586
 	function _week_align_month(&$first,&$last,$day=1)
585 587
 	{
@@ -604,7 +606,7 @@  discard block
 block discarded – undo
604 606
 	 * Displays the weekview, with 5 or 7 days
605 607
 	 *
606 608
 	 * @param int $days = 0 number of days to show, if 0 (default) the value from the URL or the prefs is used
607
-	 * @param boolean|etemplate2 $home = false if not false return content suitable for home-page
609
+	 * @param null|Etemplate $home = false if not false return content suitable for home-page
608 610
 	 */
609 611
 	function week($days=0,$home=false)
610 612
 	{
@@ -740,7 +742,7 @@  discard block
 block discarded – undo
740 742
 	/**
741 743
 	 * Query the open ToDo's via a hook from InfoLog or any other 'calendar_include_todos' provider
742 744
 	 *
743
-	 * @param array/string $todo_label label for the todo-box or array with 2 values: the label and a boolean show_all
745
+	 * @param string $todo_label label for the todo-box or array with 2 values: the label and a boolean show_all
744 746
 	 *	On return $todo_label contains the label for the todo-box
745 747
 	 * @return string/boolean Api\Html with a table of open todo's or false if no hook availible
746 748
 	 */
@@ -824,7 +826,7 @@  discard block
 block discarded – undo
824 826
 	 * - 'edit_popup' => '400x300' (optional)
825 827
 	 *
826 828
 	 * @param string $app
827
-	 * @param int|string $id
829
+	 * @param string $id
828 830
 	 * @return string
829 831
 	 */
830 832
 	public static function integration_get_popup($app,$id)
@@ -864,7 +866,7 @@  discard block
 block discarded – undo
864 866
 	 * Icons specified in $events['icons'] are always displayed!
865 867
 	 *
866 868
 	 * @param string $app
867
-	 * @param int|string $id
869
+	 * @param string $id
868 870
 	 * @param array $event
869 871
 	 * @return array
870 872
 	 */
Please login to merge, or discard this patch.
Braces   +69 added lines, -21 removed lines patch added patch discarded remove patch
@@ -179,7 +179,10 @@  discard block
 block discarded – undo
179 179
 	 */
180 180
 	public function week_number($time)
181 181
 	{
182
-		if (!is_a($time,'DateTime')) $time = new Api\DateTime($time);
182
+		if (!is_a($time,'DateTime'))
183
+		{
184
+			$time = new Api\DateTime($time);
185
+		}
183 186
 
184 187
 		// if week does not start Monday and $time is Sunday --> add one day
185 188
 		if ($this->cal_prefs['weekdaystarts'] != 'Monday' && !($wday = $time->format('w')))
@@ -237,7 +240,8 @@  discard block
 block discarded – undo
237 240
 		$tmpl = new Etemplate('calendar.toolbar');
238 241
 		$tmpl->setElementAttribute('toolbar', 'actions', $this->getToolbarActions($content));
239 242
 		// Adjust toolbar for mobile
240
-		if(Api\Header\UserAgent::mobile()){
243
+		if(Api\Header\UserAgent::mobile())
244
+		{
241 245
 			$tmpl->setElementAttribute('toolbar','class', 'et2_head_toolbar');
242 246
 			$tmpl->setElementAttribute('toolbar','view_range', '3');
243 247
 		}
@@ -396,10 +400,12 @@  discard block
 block discarded – undo
396 400
 		{
397 401
 			foreach (array_keys($actions) as $key)
398 402
 			{
399
-				if (!in_array($key, array('day_view','week_view','next', 'today','previous'))) {
403
+				if (!in_array($key, array('day_view','week_view','next', 'today','previous')))
404
+				{
400 405
 					$actions[$key]['toolbarDefault'] = false;
401 406
 				}
402
-				else {
407
+				else
408
+				{
403 409
 					$actions[$key]['toolbarDefault'] = true;
404 410
 				}
405 411
 			}
@@ -416,29 +422,38 @@  discard block
 block discarded – undo
416 422
 	 */
417 423
 	function &planner($content = array(), $home=false)
418 424
 	{
419
-		if ($this->sortby == 'month')	// yearly planner with month rows
425
+		if ($this->sortby == 'month')
426
+		{
427
+			// yearly planner with month rows
420 428
 		{
421 429
 			$this->first = $this->bo->date2array($this->date);
430
+		}
422 431
 			$this->first['day'] = 1;
423 432
 			unset($this->first['raw']);
424 433
 			$this->last = $this->first;
425 434
 			$this->last['year']++;
426 435
 			$this->last = $this->bo->date2ts($this->last)-1;
427 436
 		}
428
-		elseif (!$this->planner_view || $this->planner_view == 'month')	// planner monthview
437
+		elseif (!$this->planner_view || $this->planner_view == 'month')
438
+		{
439
+			// planner monthview
429 440
 		{
430 441
 			if ($this->day < 15)	// show one complete month
431 442
 			{
432 443
 				$this->_week_align_month($this->first,$this->last);
444
+		}
433 445
 			}
434 446
 			else	// show 2 half month
435 447
 			{
436 448
 				$this->_week_align_month($this->first,$this->last,15);
437 449
 			}
438 450
 		}
439
-		elseif ($this->planner_view == 'week' || $this->planner_view == 'weekN')	// weeekview
451
+		elseif ($this->planner_view == 'week' || $this->planner_view == 'weekN')
452
+		{
453
+			// weeekview
440 454
 		{
441 455
 			$start = new Api\DateTime($this->date);
456
+		}
442 457
 			$start->setWeekstart();
443 458
 			$this->first = $start->format('ts');
444 459
 			$this->last = $this->bo->date2array($this->first);
@@ -477,7 +492,10 @@  discard block
 block discarded – undo
477 492
 			$this->to_client($event);
478 493
 		}
479 494
 
480
-		if ($this->debug > 0) $this->bo->debug_message('uiviews::planner() date=%1: first=%2, last=%3',False,$this->date,$this->bo->date2string($this->first),$this->bo->date2string($this->last));
495
+		if ($this->debug > 0)
496
+		{
497
+			$this->bo->debug_message('uiviews::planner() date=%1: first=%2, last=%3',False,$this->date,$this->bo->date2string($this->first),$this->bo->date2string($this->last));
498
+		}
481 499
 
482 500
 		$tmpl = $home ? $home : new Etemplate('calendar.planner');
483 501
 
@@ -501,7 +519,10 @@  discard block
 block discarded – undo
501 519
 	 */
502 520
 	function &month($weeks=0,$home=false)
503 521
 	{
504
-		if ($this->debug > 0) $this->bo->debug_message('uiviews::month(weeks=%1) date=%2',True,$weeks,$this->date);
522
+		if ($this->debug > 0)
523
+		{
524
+			$this->bo->debug_message('uiviews::month(weeks=%1) date=%2',True,$weeks,$this->date);
525
+		}
505 526
 
506 527
 		if (!$home)
507 528
 		{
@@ -543,7 +564,10 @@  discard block
 block discarded – undo
543 564
 			$weekNavH = "1 month";
544 565
 			$navHeader = lang(adodb_date('F',$this->bo->date2ts($this->date))).' '.$this->year;
545 566
 		}
546
-		if ($this->debug > 0) $this->bo->debug_message('uiviews::month(%1) date=%2: first=%3, last=%4',False,$weeks,$this->date,$this->bo->date2string($this->first),$this->bo->date2string($this->last));
567
+		if ($this->debug > 0)
568
+		{
569
+			$this->bo->debug_message('uiviews::month(%1) date=%2: first=%3, last=%4',False,$weeks,$this->date,$this->bo->date2string($this->first),$this->bo->date2string($this->last));
570
+		}
547 571
 
548 572
 		// Loop through, using Api\DateTime to handle DST
549 573
 		$week = 0;
@@ -588,7 +612,10 @@  discard block
 block discarded – undo
588 612
 		$start->setWeekstart();
589 613
 		$first = $start->format('ts');
590 614
 		$start->setDate($this->year,$this->month+1,$day);
591
-		if ($day == 1) $start->add('-1day');
615
+		if ($day == 1)
616
+		{
617
+			$start->add('-1day');
618
+		}
592 619
 		$start->setWeekstart();
593 620
 		// now we need to calculate the end of the last day of that week
594 621
 		// as simple $last += WEEK_s - 1; does NOT work, if daylight saving changes in that week!!!
@@ -611,19 +638,31 @@  discard block
 block discarded – undo
611 638
 		if (!$days)
612 639
 		{
613 640
 			$days = isset($_GET['days']) ? $_GET['days'] : $this->cal_prefs['days_in_weekview'];
614
-			if ($days != 5) $days = 7;
615
-			if ($days != $this->cal_prefs['days_in_weekview'])	// save the preference
641
+			if ($days != 5)
642
+			{
643
+				$days = 7;
644
+			}
645
+			if ($days != $this->cal_prefs['days_in_weekview'])
646
+			{
647
+				// save the preference
616 648
 			{
617 649
 				$GLOBALS['egw']->preferences->add('calendar','days_in_weekview',$days);
650
+			}
618 651
 				$GLOBALS['egw']->preferences->save_repository();
619 652
 				$this->cal_prefs['days_in_weekview'] = $days;
620 653
 			}
621 654
 		}
622
-		if ($this->debug > 0) $this->bo->debug_message('uiviews::week(days=%1) date=%2',True,$days,$this->date);
655
+		if ($this->debug > 0)
656
+		{
657
+			$this->bo->debug_message('uiviews::week(days=%1) date=%2',True,$days,$this->date);
658
+		}
623 659
 
624
-		if ($days <= 4)		// next 4 days view
660
+		if ($days <= 4)
661
+		{
662
+			// next 4 days view
625 663
 		{
626 664
 			$wd_start = $this->first = $this->bo->date2ts($this->date);
665
+		}
627 666
 			$this->last = strtotime("+$days days",$this->first) - 1;
628 667
 			$view = $days == 1 ? 'day' : 'day4';
629 668
 		}
@@ -632,12 +671,15 @@  discard block
 block discarded – undo
632 671
 			$start = new Api\DateTime($this->date);
633 672
 			$start->setWeekstart();
634 673
 			$wd_start = $this->first = $start->format('ts');
635
-			if ($days <= 5)		// no weekend-days
674
+			if ($days <= 5)
675
+			{
676
+				// no weekend-days
636 677
 			{
637 678
 				switch($this->cal_prefs['weekdaystarts'])
638 679
 				{
639 680
 					case 'Saturday':
640 681
 						$this->first = strtotime("+2 days",$this->first);
682
+			}
641 683
 						break;
642 684
 					case 'Sunday':
643 685
 						$this->first = strtotime("+1 day",$this->first);
@@ -666,7 +708,10 @@  discard block
 block discarded – undo
666 708
 			) + $this->search_params;
667 709
 
668 710
 		$users = $this->search_params['users'];
669
-		if (!is_array($users)) $users = array($users);
711
+		if (!is_array($users))
712
+		{
713
+			$users = array($users);
714
+		}
670 715
 
671 716
 		$content = array('view' => array());
672 717
 
@@ -689,8 +734,7 @@  discard block
 block discarded – undo
689 734
 			$this->last = ($days == 4 ? $this->last : $search_params['end'] = strtotime("+$days days",$this->first) - 1);
690 735
 			if (count($users) == 1 || count($users) >= $this->cal_prefs['week_consolidate']	||// for more then X users, show all in one row
691 736
 				$days == 1 // Showing just 1 day
692
-			)
693
-			{
737
+			) {
694 738
 				$content['view'][] = (array)$this->tagWholeDayOnTop($this->bo->search($search_params)) +
695 739
 					array('owner' => $users);
696 740
 			}
@@ -793,7 +837,8 @@  discard block
 block discarded – undo
793 837
 						}
794 838
 						$todo['icons'] = $icons;
795 839
 						$class = $class == 'row_on' ? 'row_off' : 'row_on';
796
-						if($todo['edit']) {
840
+						if($todo['edit'])
841
+						{
797 842
 							$todo['edit_size'] = $todo['edit']['size'];
798 843
 							unset($todo['edit']['size']);
799 844
 							$edit_icon_href = Api\Html::a_href( $icons, $todo['edit'],'',' data-todo="app|750x590" ');
@@ -914,7 +959,10 @@  discard block
 block discarded – undo
914 959
 		// This disables the event actions for the grid rows (calendar weeks/owners)
915 960
 		foreach($actions as $id => &$action)
916 961
 		{
917
-			if($id=='add') continue;
962
+			if($id=='add')
963
+			{
964
+				continue;
965
+			}
918 966
 			if(!$action['enabled'])
919 967
 			{
920 968
 				$action['enabled'] = 'javaScript:app.calendar.is_event';
Please login to merge, or discard this patch.
Spacing   +130 added lines, -131 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 *
42 42
 	 * @var mixed
43 43
 	 */
44
-	var $debug=false;
44
+	var $debug = false;
45 45
 
46 46
 	/**
47 47
 	 * extra rows above and below the workday
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	 *
93 93
 	 * @var boolean
94 94
 	 */
95
-	var $use_time_grid=true;
95
+	var $use_time_grid = true;
96 96
 
97 97
 	/**
98 98
 	 * Pref value of use_time_grid preference
@@ -105,14 +105,14 @@  discard block
 block discarded – undo
105 105
 	 *
106 106
 	 * @var boolean
107 107
 	 */
108
-	var $scroll_to_wdstart=false;
108
+	var $scroll_to_wdstart = false;
109 109
 
110 110
 	/**
111 111
 	 * counter for the current whole day event of a single day
112 112
 	 *
113 113
 	 * @var int
114 114
 	 */
115
-	var $wholeDayPosCounter=1;
115
+	var $wholeDayPosCounter = 1;
116 116
 
117 117
 	/**
118 118
 	 * Switch to disable private data and possibility to view and edit events
@@ -125,26 +125,26 @@  discard block
 block discarded – undo
125 125
 	 *
126 126
 	 * @param array $set_states = null to manualy set / change one of the states, default NULL = use $_REQUEST
127 127
 	 */
128
-	function __construct($set_states=null)
128
+	function __construct($set_states = null)
129 129
 	{
130
-		parent::__construct(false,$set_states);	// call the parent's constructor
130
+		parent::__construct(false, $set_states); // call the parent's constructor
131 131
 		$this->extraRowsOriginal = $this->extraRows; //save original extraRows value
132 132
 
133 133
 		$GLOBALS['egw_info']['flags']['nonavbar'] = False;
134 134
 
135 135
 		// Check for GET message (from merge)
136
-		if($_GET['msg'])
136
+		if ($_GET['msg'])
137 137
 		{
138 138
 			Framework::message($_GET['msg']);
139 139
 			unset($_GET['msg']);
140 140
 		}
141 141
 		// standard params for calling bocal::search for all views
142
-		$this->owner = str_replace('%2C',',',$this->owner);
142
+		$this->owner = str_replace('%2C', ',', $this->owner);
143 143
 		$this->search_params = array(
144 144
 			'start'   => $this->date,
145
-			'cat_id'  => $this->cat_id ? (is_array($this->cat_id)?$this->cat_id:explode(',',$this->cat_id)) : 0,
146
-			'users'   => explode(',',$this->owner),
147
-			'owner'   => explode(',',$this->owner),
145
+			'cat_id'  => $this->cat_id ? (is_array($this->cat_id) ? $this->cat_id : explode(',', $this->cat_id)) : 0,
146
+			'users'   => explode(',', $this->owner),
147
+			'owner'   => explode(',', $this->owner),
148 148
 			'filter'  => $this->filter,
149 149
 			'daywise' => True,
150 150
 			'use_so_events' => $this->test === 'true',
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 */
171 171
 	public function week_number($time)
172 172
 	{
173
-		if (!is_a($time,'DateTime')) $time = new Api\DateTime($time);
173
+		if (!is_a($time, 'DateTime')) $time = new Api\DateTime($time);
174 174
 
175 175
 		// if week does not start Monday and $time is Sunday --> add one day
176 176
 		if ($this->cal_prefs['weekdaystarts'] != 'Monday' && !($wday = $time->format('w')))
@@ -188,19 +188,19 @@  discard block
 block discarded – undo
188 188
 	/**
189 189
 	 * Load all views used by calendar, client side switches between them as needed
190 190
 	 */
191
-	function index($content=array())
191
+	function index($content = array())
192 192
 	{
193
-		if($content['merge'])
193
+		if ($content['merge'])
194 194
 		{
195 195
 			// View from sidebox is JSON encoded
196
-			$this->manage_states(array_merge($content,json_decode($content['view'],true)));
197
-			if($content['first'])
196
+			$this->manage_states(array_merge($content, json_decode($content['view'], true)));
197
+			if ($content['first'])
198 198
 			{
199
-				$this->first = Api\DateTime::to($content['first'],'ts');
199
+				$this->first = Api\DateTime::to($content['first'], 'ts');
200 200
 			}
201
-			if($content['last'])
201
+			if ($content['last'])
202 202
 			{
203
-				$this->last = Api\DateTime::to($content['last'],'ts');
203
+				$this->last = Api\DateTime::to($content['last'], 'ts');
204 204
 			}
205 205
 			$_GET['merge'] = $content['merge'];
206 206
 			$this->merge();
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 		$GLOBALS['egw_info']['flags']['params']['manual'] = array('page' => 'ManualCalendar'.ucfirst($this->view));
217 217
 
218 218
 		// Sidebox & iframe for old views
219
-		if(in_array($this->view,array('year')) && $_GET['view'])
219
+		if (in_array($this->view, array('year')) && $_GET['view'])
220 220
 		{
221 221
 			$GLOBALS['egw_info']['flags']['nonavbar'] = true;
222 222
 			$this->manage_states($_GET);
@@ -228,24 +228,24 @@  discard block
 block discarded – undo
228 228
 		$tmpl = new Etemplate('calendar.toolbar');
229 229
 		$tmpl->setElementAttribute('toolbar', 'actions', $this->getToolbarActions($content));
230 230
 		// Adjust toolbar for mobile
231
-		if(Api\Header\UserAgent::mobile()){
232
-			$tmpl->setElementAttribute('toolbar','class', 'et2_head_toolbar');
233
-			$tmpl->setElementAttribute('toolbar','view_range', '3');
231
+		if (Api\Header\UserAgent::mobile()) {
232
+			$tmpl->setElementAttribute('toolbar', 'class', 'et2_head_toolbar');
233
+			$tmpl->setElementAttribute('toolbar', 'view_range', '3');
234 234
 		}
235
-		$tmpl->exec('calendar_uiviews::index',array());
235
+		$tmpl->exec('calendar_uiviews::index', array());
236 236
 
237 237
 		// Load the different views once, we'll switch between them on the client side
238 238
 		$todo = new Etemplate('calendar.todo');
239 239
 		$label = '';
240
-		$todo->exec('calendar_uiviews::index',array('todos'=>'', 'label' => $label));
240
+		$todo->exec('calendar_uiviews::index', array('todos'=>'', 'label' => $label));
241 241
 
242 242
 		// Actually, this takes care of most of it...
243 243
 		$this->week();
244 244
 
245 245
 		$planner = new Etemplate('calendar.planner');
246 246
 		// Get the actions
247
-		$planner->setElementAttribute('planner','actions',$this->get_actions());
248
-		$planner->exec('calendar_uiviews::index',array());
247
+		$planner->setElementAttribute('planner', 'actions', $this->get_actions());
248
+		$planner->exec('calendar_uiviews::index', array());
249 249
 
250 250
 		// List view in a separate file
251 251
 		$list_ui = new calendar_uilist();
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 		{
388 388
 			foreach (array_keys($actions) as $key)
389 389
 			{
390
-				if (!in_array($key, array('day_view','week_view','next', 'today','previous'))) {
390
+				if (!in_array($key, array('day_view', 'week_view', 'next', 'today', 'previous'))) {
391 391
 					$actions[$key]['toolbarDefault'] = false;
392 392
 				}
393 393
 				else {
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
 	 *
406 406
 	 * @param boolean|Etemplate $home = false if etemplate return content suitable for home-page
407 407
 	 */
408
-	function &planner($content = array(), $home=false)
408
+	function &planner($content = array(), $home = false)
409 409
 	{
410 410
 		if ($this->sortby == 'month')	// yearly planner with month rows
411 411
 		{
@@ -414,17 +414,17 @@  discard block
 block discarded – undo
414 414
 			unset($this->first['raw']);
415 415
 			$this->last = $this->first;
416 416
 			$this->last['year']++;
417
-			$this->last = $this->bo->date2ts($this->last)-1;
417
+			$this->last = $this->bo->date2ts($this->last) - 1;
418 418
 		}
419 419
 		elseif (!$this->planner_view || $this->planner_view == 'month')	// planner monthview
420 420
 		{
421 421
 			if ($this->day < 15)	// show one complete month
422 422
 			{
423
-				$this->_week_align_month($this->first,$this->last);
423
+				$this->_week_align_month($this->first, $this->last);
424 424
 			}
425 425
 			else	// show 2 half month
426 426
 			{
427
-				$this->_week_align_month($this->first,$this->last,15);
427
+				$this->_week_align_month($this->first, $this->last, 15);
428 428
 			}
429 429
 		}
430 430
 		elseif ($this->planner_view == 'week' || $this->planner_view == 'weekN')	// weeekview
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 			$start->setWeekstart();
434 434
 			$this->first = $start->format('ts');
435 435
 			$this->last = $this->bo->date2array($this->first);
436
-			$this->last['day'] += ($this->planner_view == 'week' ? 7 : 7 * $this->cal_prefs['multiple_weeks'])-1;
436
+			$this->last['day'] += ($this->planner_view == 'week' ? 7 : 7 * $this->cal_prefs['multiple_weeks']) - 1;
437 437
 			$this->last['hour'] = 23; $this->last['minute'] = $this->last['sec'] = 59;
438 438
 			unset($this->last['raw']);
439 439
 			$this->last = $this->bo->date2ts($this->last);
@@ -449,9 +449,9 @@  discard block
 block discarded – undo
449 449
 		}
450 450
 
451 451
 		$merge = $this->merge();
452
-		if($merge)
452
+		if ($merge)
453 453
 		{
454
-			Egw::redirect_link('/index.php',array(
454
+			Egw::redirect_link('/index.php', array(
455 455
 				'menuaction' => 'calendar.calendar_uiviews.index',
456 456
 				'msg'        => $merge,
457 457
 				'ajax'       => 'true'
@@ -464,21 +464,21 @@  discard block
 block discarded – undo
464 464
 		$search_params['end'] = $this->last;
465 465
 		$search_params['enum_groups'] = $this->sortby == 'user';
466 466
 		$content['planner'] = $this->bo->search($search_params);
467
-		foreach($content['planner'] as &$event)
467
+		foreach ($content['planner'] as &$event)
468 468
 		{
469 469
 			$this->to_client($event);
470 470
 		}
471 471
 
472
-		if ($this->debug > 0) $this->bo->debug_message('uiviews::planner() date=%1: first=%2, last=%3',False,$this->date,$this->bo->date2string($this->first),$this->bo->date2string($this->last));
472
+		if ($this->debug > 0) $this->bo->debug_message('uiviews::planner() date=%1: first=%2, last=%3', False, $this->date, $this->bo->date2string($this->first), $this->bo->date2string($this->last));
473 473
 
474 474
 		$tmpl = $home ? $home : new Etemplate('calendar.planner');
475 475
 
476
-		$tmpl->setElementAttribute('planner','start_date', Api\DateTime::to($this->first, Api\DateTime::ET2));
477
-		$tmpl->setElementAttribute('planner','end_date', Api\DateTime::to($this->last, Api\DateTime::ET2));
478
-		$tmpl->setElementAttribute('planner','owner', $search_params['users']);
479
-		$tmpl->setElementAttribute('planner','group_by', $this->sortby);
476
+		$tmpl->setElementAttribute('planner', 'start_date', Api\DateTime::to($this->first, Api\DateTime::ET2));
477
+		$tmpl->setElementAttribute('planner', 'end_date', Api\DateTime::to($this->last, Api\DateTime::ET2));
478
+		$tmpl->setElementAttribute('planner', 'owner', $search_params['users']);
479
+		$tmpl->setElementAttribute('planner', 'group_by', $this->sortby);
480 480
 		// Get the actions
481
-		$tmpl->setElementAttribute('planner','actions',$this->get_actions());
481
+		$tmpl->setElementAttribute('planner', 'actions', $this->get_actions());
482 482
 
483 483
 		$tmpl->exec(__METHOD__, $content);
484 484
 	}
@@ -491,30 +491,30 @@  discard block
 block discarded – undo
491 491
 	 * @param int $weeks = 0 number of weeks to show, if 0 (default) all weeks of one month are shown
492 492
 	 * @param boolean|etemplate2 $home = false if not false return content suitable for home-page
493 493
 	 */
494
-	function &month($weeks=0,$home=false)
494
+	function &month($weeks = 0, $home = false)
495 495
 	{
496
-		if ($this->debug > 0) $this->bo->debug_message('uiviews::month(weeks=%1) date=%2',True,$weeks,$this->date);
496
+		if ($this->debug > 0) $this->bo->debug_message('uiviews::month(weeks=%1) date=%2', True, $weeks, $this->date);
497 497
 
498 498
 		if (!$home)
499 499
 		{
500
-			trigger_error(__METHOD__ .' only used by home app', E_USER_DEPRECATED);
500
+			trigger_error(__METHOD__.' only used by home app', E_USER_DEPRECATED);
501 501
 			return;
502 502
 		}
503 503
 
504
-		$this->use_time_grid = !$this->use_time_grid_pref || $this->use_time_grid_pref == 'all';	// all views
504
+		$this->use_time_grid = !$this->use_time_grid_pref || $this->use_time_grid_pref == 'all'; // all views
505 505
 		$granularity = 0;
506
-		if($weeks)
506
+		if ($weeks)
507 507
 		{
508 508
 			$granularity = ($this->cal_prefs['interval'] ? (int)$this->cal_prefs['interval'] : 30);
509 509
 
510 510
 			$list = $this->cal_prefs['use_time_grid'];
511
-			if(!is_array($list))
511
+			if (!is_array($list))
512 512
 			{
513
-				$list = explode(',',$list);
513
+				$list = explode(',', $list);
514 514
 			}
515
-			if(is_array($list))
515
+			if (is_array($list))
516 516
 			{
517
-				$granularity = in_array('weekN',$list) ? 0 : $granularity;
517
+				$granularity = in_array('weekN', $list) ? 0 : $granularity;
518 518
 			}
519 519
 		}
520 520
 		$content = array('view' => array());
@@ -524,23 +524,23 @@  discard block
 block discarded – undo
524 524
 			$start = new Api\DateTime($this->date);
525 525
 			$start->setWeekstart();
526 526
 			$this->first = $start->format('ts');
527
-			$this->last = strtotime("+$weeks weeks",$this->first) - 1;
527
+			$this->last = strtotime("+$weeks weeks", $this->first) - 1;
528 528
 			$weekNavH = "$weeks weeks";
529 529
 			$navHeader = lang('Week').' '.$this->week_number($this->first).' - '.$this->week_number($this->last).': '.
530
-				$this->bo->long_date($this->first,$this->last);
530
+				$this->bo->long_date($this->first, $this->last);
531 531
 		}
532 532
 		else
533 533
 		{
534
-			$this->_week_align_month($this->first,$this->last);
534
+			$this->_week_align_month($this->first, $this->last);
535 535
 			$weekNavH = "1 month";
536
-			$navHeader = lang(adodb_date('F',$this->bo->date2ts($this->date))).' '.$this->year;
536
+			$navHeader = lang(adodb_date('F', $this->bo->date2ts($this->date))).' '.$this->year;
537 537
 		}
538
-		if ($this->debug > 0) $this->bo->debug_message('uiviews::month(%1) date=%2: first=%3, last=%4',False,$weeks,$this->date,$this->bo->date2string($this->first),$this->bo->date2string($this->last));
538
+		if ($this->debug > 0) $this->bo->debug_message('uiviews::month(%1) date=%2: first=%3, last=%4', False, $weeks, $this->date, $this->bo->date2string($this->first), $this->bo->date2string($this->last));
539 539
 
540 540
 		// Loop through, using Api\DateTime to handle DST
541 541
 		$week = 0;
542 542
 		$week_start = new EGroupware\Api\DateTime($this->first);
543
-		$week_start->setTime(0,0,0);
543
+		$week_start->setTime(0, 0, 0);
544 544
 		$week_end = new Api\DateTime($week_start);
545 545
 		$week_end->add(new DateInterval('P6DT23H59M59S'));
546 546
 		$last = new EGroupware\Api\DateTime($this->last);
@@ -554,14 +554,14 @@  discard block
 block discarded – undo
554 554
 			array(
555 555
 				'id' => $week_start->format('Ymd')
556 556
 			);
557
-			$home->setElementAttribute("view[$week]",'onchange',false);
558
-			$home->setElementAttribute("view[$week]",'granularity',$granularity);
559
-			$home->setElementAttribute("view[$week]",'show_weekend', $this->search_params['weekend']);
557
+			$home->setElementAttribute("view[$week]", 'onchange', false);
558
+			$home->setElementAttribute("view[$week]", 'granularity', $granularity);
559
+			$home->setElementAttribute("view[$week]", 'show_weekend', $this->search_params['weekend']);
560 560
 			$week++;
561 561
 		}
562 562
 
563 563
 		// Get the actions
564
-		$home->setElementAttribute('view','actions',$this->get_actions());
564
+		$home->setElementAttribute('view', 'actions', $this->get_actions());
565 565
 
566 566
 		$home->exec(__METHOD__, $content);
567 567
 	}
@@ -573,13 +573,13 @@  discard block
 block discarded – undo
573 573
 	 * @param int &$last timestamp 23:59:59 of last day of week containg the last day of the current month
574 574
 	 * @param int $day = 1 should the alignment be based on the 1. of the month or an other date, eg. the 15.
575 575
 	 */
576
-	function _week_align_month(&$first,&$last,$day=1)
576
+	function _week_align_month(&$first, &$last, $day = 1)
577 577
 	{
578 578
 		$start = new Api\DateTime($this->date);
579
-		$start->setDate($this->year,$this->month,$this->day=$day);
579
+		$start->setDate($this->year, $this->month, $this->day = $day);
580 580
 		$start->setWeekstart();
581 581
 		$first = $start->format('ts');
582
-		$start->setDate($this->year,$this->month+1,$day);
582
+		$start->setDate($this->year, $this->month + 1, $day);
583 583
 		if ($day == 1) $start->add('-1day');
584 584
 		$start->setWeekstart();
585 585
 		// now we need to calculate the end of the last day of that week
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
 		$arr['day'] += 6;
589 589
 		$arr['hour'] = 23;
590 590
 		$arr['min'] = $arr['sec'] = 59;
591
-		unset($arr['raw']);	// otherwise date2ts does not calc raw new, but uses it
591
+		unset($arr['raw']); // otherwise date2ts does not calc raw new, but uses it
592 592
 		$last = $this->bo->date2ts($arr);
593 593
 	}
594 594
 
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
 	 * @param int $days = 0 number of days to show, if 0 (default) the value from the URL or the prefs is used
599 599
 	 * @param boolean|etemplate2 $home = false if not false return content suitable for home-page
600 600
 	 */
601
-	function week($days=0,$home=false)
601
+	function week($days = 0, $home = false)
602 602
 	{
603 603
 		if (!$days)
604 604
 		{
@@ -606,17 +606,17 @@  discard block
 block discarded – undo
606 606
 			if ($days != 5) $days = 7;
607 607
 			if ($days != $this->cal_prefs['days_in_weekview'])	// save the preference
608 608
 			{
609
-				$GLOBALS['egw']->preferences->add('calendar','days_in_weekview',$days);
609
+				$GLOBALS['egw']->preferences->add('calendar', 'days_in_weekview', $days);
610 610
 				$GLOBALS['egw']->preferences->save_repository();
611 611
 				$this->cal_prefs['days_in_weekview'] = $days;
612 612
 			}
613 613
 		}
614
-		if ($this->debug > 0) $this->bo->debug_message('uiviews::week(days=%1) date=%2',True,$days,$this->date);
614
+		if ($this->debug > 0) $this->bo->debug_message('uiviews::week(days=%1) date=%2', True, $days, $this->date);
615 615
 
616 616
 		if ($days <= 4)		// next 4 days view
617 617
 		{
618 618
 			$wd_start = $this->first = $this->bo->date2ts($this->date);
619
-			$this->last = strtotime("+$days days",$this->first) - 1;
619
+			$this->last = strtotime("+$days days", $this->first) - 1;
620 620
 			$view = $days == 1 ? 'day' : 'day4';
621 621
 		}
622 622
 		else
@@ -626,30 +626,30 @@  discard block
 block discarded – undo
626 626
 			$wd_start = $this->first = $start->format('ts');
627 627
 			if ($days <= 5)		// no weekend-days
628 628
 			{
629
-				switch($this->cal_prefs['weekdaystarts'])
629
+				switch ($this->cal_prefs['weekdaystarts'])
630 630
 				{
631 631
 					case 'Saturday':
632
-						$this->first = strtotime("+2 days",$this->first);
632
+						$this->first = strtotime("+2 days", $this->first);
633 633
 						break;
634 634
 					case 'Sunday':
635
-						$this->first = strtotime("+1 day",$this->first);
635
+						$this->first = strtotime("+1 day", $this->first);
636 636
 						break;
637 637
 				}
638 638
 			}
639
-			$this->last = strtotime("+$days days",$this->first) - 1;
639
+			$this->last = strtotime("+$days days", $this->first) - 1;
640 640
 			$view = 'week';
641 641
 		}
642 642
 
643 643
 		$granularity = ($this->cal_prefs['interval'] ? (int)$this->cal_prefs['interval'] : 30);
644 644
 
645 645
 		$list = $this->cal_prefs['use_time_grid'];
646
-		if(!is_array($list))
646
+		if (!is_array($list))
647 647
 		{
648
-			$list = explode(',',$list);
648
+			$list = explode(',', $list);
649 649
 		}
650
-		if(is_array($list))
650
+		if (is_array($list))
651 651
 		{
652
-			$granularity = in_array($view,$list) ? 0 : $granularity;
652
+			$granularity = in_array($view, $list) ? 0 : $granularity;
653 653
 		}
654 654
 
655 655
 		$search_params = array(
@@ -662,15 +662,15 @@  discard block
 block discarded – undo
662 662
 
663 663
 		$content = array('view' => array());
664 664
 
665
-		if(!$home)
665
+		if (!$home)
666 666
 		{
667 667
 			// Fill with the minimum needed 'weeks'
668 668
 			$min = max(
669 669
 				6, // Some months need 6 weeks for full display
670
-				$this->cal_prefs['multiple_weeks'],  // WeekN view
670
+				$this->cal_prefs['multiple_weeks'], // WeekN view
671 671
 				$this->cal_prefs['week_consolidate'] // We collapse after this many users
672 672
 			);
673
-			for($i = 0; $i < $min; $i++)
673
+			for ($i = 0; $i < $min; $i++)
674 674
 			{
675 675
 				$content['view'][] = array();
676 676
 			}
@@ -678,8 +678,8 @@  discard block
 block discarded – undo
678 678
 		else
679 679
 		{
680 680
 			// Always do 7 days for a week so scrolling works properly
681
-			$this->last = ($days == 4 ? $this->last : $search_params['end'] = strtotime("+$days days",$this->first) - 1);
682
-			if (count($users) == 1 || count($users) >= $this->cal_prefs['week_consolidate']	||// for more then X users, show all in one row
681
+			$this->last = ($days == 4 ? $this->last : $search_params['end'] = strtotime("+$days days", $this->first) - 1);
682
+			if (count($users) == 1 || count($users) >= $this->cal_prefs['week_consolidate'] || // for more then X users, show all in one row
683 683
 				$days == 1 // Showing just 1 day
684 684
 			)
685 685
 			{
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 			}
689 689
 			else
690 690
 			{
691
-				foreach($users as $uid)
691
+				foreach ($users as $uid)
692 692
 				{
693 693
 					$search_params['users'] = $uid;
694 694
 					$content['view'][] = $this->tagWholeDayOnTop($this->bo->search($search_params))
@@ -696,15 +696,15 @@  discard block
 block discarded – undo
696 696
 				}
697 697
 			}
698 698
 		}
699
-		$tmpl = $home ? $home :new Etemplate('calendar.view');
700
-		foreach(array_keys($content['view']) as $index)
699
+		$tmpl = $home ? $home : new Etemplate('calendar.view');
700
+		foreach (array_keys($content['view']) as $index)
701 701
 		{
702
-			$tmpl->setElementAttribute("view[$index]",'granularity',$granularity);
703
-			$tmpl->setElementAttribute("view[$index]",'show_weekend',$this->search_params['weekend']);
702
+			$tmpl->setElementAttribute("view[$index]", 'granularity', $granularity);
703
+			$tmpl->setElementAttribute("view[$index]", 'show_weekend', $this->search_params['weekend']);
704 704
 		}
705 705
 
706 706
 		// Get the actions
707
-		$tmpl->setElementAttribute('view','actions',$this->get_actions());
707
+		$tmpl->setElementAttribute('view', 'actions', $this->get_actions());
708 708
 
709 709
 		$tmpl->exec(__METHOD__, $content);
710 710
 	}
@@ -746,57 +746,56 @@  discard block
 block discarded – undo
746 746
 			'owner'     => $this->owner	// num. id of the user, not necessary current user
747 747
 		));
748 748
 
749
-		if(is_array($todo_label))
749
+		if (is_array($todo_label))
750 750
 		{
751
-			list($label,$showall)=$todo_label;
751
+			list($label, $showall) = $todo_label;
752 752
 		}
753 753
 		else
754 754
 		{
755
-			$label=$todo_label;
756
-			$showall=true;
755
+			$label = $todo_label;
756
+			$showall = true;
757 757
 		}
758 758
 		$maxshow = (int)$GLOBALS['egw_info']['user']['preferences']['infolog']['mainscreen_maxshow'];
759
-		if($maxshow <= 0)
759
+		if ($maxshow <= 0)
760 760
 		{
761
-			$maxshow=10;
761
+			$maxshow = 10;
762 762
 		}
763 763
 		//print_debug("get_todos(): label=$label; showall=$showall; max=$maxshow");
764 764
 
765 765
 		$content = $todo_label = '';
766 766
 		if (is_array($todos_from_hook) && count($todos_from_hook))
767 767
 		{
768
-			foreach($todos_from_hook as $todos)
768
+			foreach ($todos_from_hook as $todos)
769 769
 			{
770 770
 				$i = 0;
771 771
 				if (is_array($todos))
772 772
 				{
773 773
 					$todo_label = !empty($label) ? $label : lang("open ToDo's:");
774 774
 
775
-					foreach($todos as &$todo)
775
+					foreach ($todos as &$todo)
776 776
 					{
777
-						if(!$showall && ($i++ > $maxshow))
777
+						if (!$showall && ($i++ > $maxshow))
778 778
 						{
779 779
 							break;
780 780
 						}
781 781
 						$icons = '';
782
-						foreach($todo['icons'] as $name => $alt)
782
+						foreach ($todo['icons'] as $name => $alt)
783 783
 						{
784
-							$icons .= ($icons?' ':'').Api\Html::image('infolog',$name,lang($alt),'border="0" width="15" height="15"');
784
+							$icons .= ($icons ? ' ' : '').Api\Html::image('infolog', $name, lang($alt), 'border="0" width="15" height="15"');
785 785
 						}
786 786
 						$todo['icons'] = $icons;
787 787
 						$class = $class == 'row_on' ? 'row_off' : 'row_on';
788
-						if($todo['edit']) {
788
+						if ($todo['edit']) {
789 789
 							$todo['edit_size'] = $todo['edit']['size'];
790 790
 							unset($todo['edit']['size']);
791
-							$edit_icon_href = Api\Html::a_href( $icons, $todo['edit'],'',' data-todo="app|750x590" ');
792
-							$edit_href = Api\Html::a_href( $todo['title'], $todo['edit'],'',' data-todo="app|750x590" ');
793
-							$todo['edit'] = Framework::link('/index.php',$todo['edit'],true);
791
+							$edit_icon_href = Api\Html::a_href($icons, $todo['edit'], '', ' data-todo="app|750x590" ');
792
+							$edit_href = Api\Html::a_href($todo['title'], $todo['edit'], '', ' data-todo="app|750x590" ');
793
+							$todo['edit'] = Framework::link('/index.php', $todo['edit'], true);
794 794
 						}
795
-						$icon_href = Api\Html::a_href($icons,$todo['view']);
795
+						$icon_href = Api\Html::a_href($icons, $todo['view']);
796 796
 						$content .= " <tr class=\"$class\">\n  <td valign=\"top\" width=\"15%\" nowrap>".
797
-							($this->bo->printer_friendly?$icons:($edit_icon_href ? $edit_icon_href : $icon_href)).
798
-							"</td>\n  <td>".($this->printer_friendly?$todo['title']:
799
-							$edit_href)."</td>\n </tr>\n";
797
+							($this->bo->printer_friendly ? $icons : ($edit_icon_href ? $edit_icon_href : $icon_href)).
798
+							"</td>\n  <td>".($this->printer_friendly ? $todo['title'] : $edit_href)."</td>\n </tr>\n";
800 799
 						/**
801 800
 						 * ToDo: add delete and closing action
802 801
 						 */
@@ -819,9 +818,9 @@  discard block
 block discarded – undo
819 818
 	 * @param int|string $id
820 819
 	 * @return string
821 820
 	 */
822
-	public static function integration_get_popup($app,$id)
821
+	public static function integration_get_popup($app, $id)
823 822
 	{
824
-		$app_data = calendar_bo::integration_get_data($app,'edit_link');
823
+		$app_data = calendar_bo::integration_get_data($app, 'edit_link');
825 824
 
826 825
 		if (is_array($app_data) && isset($app_data['edit']))
827 826
 		{
@@ -831,7 +830,7 @@  discard block
 block discarded – undo
831 830
 		}
832 831
 		else
833 832
 		{
834
-			$edit = Link::edit($app,$id,$popup_size);
833
+			$edit = Link::edit($app, $id, $popup_size);
835 834
 		}
836 835
 		if ($edit)
837 836
 		{
@@ -860,28 +859,28 @@  discard block
 block discarded – undo
860 859
 	 * @param array $event
861 860
 	 * @return array
862 861
 	 */
863
-	static function integration_get_icons($app,$id,$event)
862
+	static function integration_get_icons($app, $id, $event)
864 863
 	{
865 864
 		$icons = array();
866 865
 		if ($event['icons'])
867 866
 		{
868
-			foreach(explode(',',$event['icons']) as $icon)
867
+			foreach (explode(',', $event['icons']) as $icon)
869 868
 			{
870
-				list($icon_app,$icon) = explode(':',$icon);
871
-				if (Api\Image::find($icon_app,$icon))
869
+				list($icon_app, $icon) = explode(':', $icon);
870
+				if (Api\Image::find($icon_app, $icon))
872 871
 				{
873
-					$icons[] = Api\Html::image($icon_app,$icon);
872
+					$icons[] = Api\Html::image($icon_app, $icon);
874 873
 				}
875 874
 			}
876 875
 		}
877
-		$app_data = calendar_bo::integration_get_data($app,'icons');
876
+		$app_data = calendar_bo::integration_get_data($app, 'icons');
878 877
 		if (is_null($app_data))
879 878
 		{
880
-			$icons[] = Api\Html::image($app,'navbar');	// use navbar icon
879
+			$icons[] = Api\Html::image($app, 'navbar'); // use navbar icon
881 880
 		}
882 881
 		elseif ($app_data)
883 882
 		{
884
-			$icons += (array)ExecMethod2($app_data,$id,$event);
883
+			$icons += (array)ExecMethod2($app_data, $id, $event);
885 884
 		}
886 885
 		return $icons;
887 886
 	}
@@ -904,22 +903,22 @@  discard block
 block discarded – undo
904 903
 		unset($actions['select_all']);
905 904
 
906 905
 		// This disables the event actions for the grid rows (calendar weeks/owners)
907
-		foreach($actions as $id => &$action)
906
+		foreach ($actions as $id => &$action)
908 907
 		{
909
-			if($id=='add') continue;
910
-			if(!$action['enabled'])
908
+			if ($id == 'add') continue;
909
+			if (!$action['enabled'])
911 910
 			{
912 911
 				$action['enabled'] = 'javaScript:app.calendar.is_event';
913 912
 			}
914 913
 		}
915 914
 		$actions['add']['open'] = '{"app":"calendar","type":"add"}';
916
-		$actions['add']['onExecute'] =  'javaScript:app.calendar.action_open';
915
+		$actions['add']['onExecute'] = 'javaScript:app.calendar.action_open';
917 916
 		$actions['copy']['open'] = '{"app": "calendar", "type": "add", "extra": "cal_id=$id&action=copy"}';
918 917
 		$actions['copy']['onExecute'] = 'javaScript:app.calendar.action_open';
919 918
 		$actions['print']['open'] = '{"app": "calendar", "type": "add", "extra": "cal_id=$id&print=1"}';
920 919
 		$actions['print']['onExecute'] = 'javaScript:app.calendar.action_open';
921 920
 
922
-		foreach($actions['status']['children'] as $id => &$status)
921
+		foreach ($actions['status']['children'] as $id => &$status)
923 922
 		{
924 923
 			$status = array(
925 924
 				'id' => $id,
@@ -930,7 +929,7 @@  discard block
 block discarded – undo
930 929
 
931 930
 		if ($actions['filemanager'])
932 931
 		{
933
-			$actions['filemanager']['url'] = '/index.php?'. $actions['filemanager']['url'];
932
+			$actions['filemanager']['url'] = '/index.php?'.$actions['filemanager']['url'];
934 933
 			$actions['filemanager']['onExecute'] = 'javaScript:app.calendar.action_open';
935 934
 		}
936 935
 		if ($actions['infolog_app'])
@@ -975,26 +974,26 @@  discard block
 block discarded – undo
975 974
 				{
976 975
 					$start = $this->bo->date2array($event['start']);
977 976
 					$end = $this->bo->date2array($event['end']);
978
-					if(!$start['hour'] && !$start['minute'] && $end['hour'] == 23 && $end['minute'] == 59)
977
+					if (!$start['hour'] && !$start['minute'] && $end['hour'] == 23 && $end['minute'] == 59)
979 978
 					{
980
-						if($event['non_blocking'])
979
+						if ($event['non_blocking'])
981 980
 						{
982
-							$dayEvents[$day][$num]['whole_day_on_top']=true;
983
-							$this->whole_day_positions[$num]=($this->rowHeight*($num+2));
981
+							$dayEvents[$day][$num]['whole_day_on_top'] = true;
982
+							$this->whole_day_positions[$num] = ($this->rowHeight * ($num + 2));
984 983
 							$extraRowsToAdd++;
985 984
 						}
986 985
 						else
987 986
 						{
988
-							$dayEvents[$day][$num]['whole_day']=true;
987
+							$dayEvents[$day][$num]['whole_day'] = true;
989 988
 						}
990 989
 					}
991 990
 					$this->to_client($dayEvents[$day][$num]);
992 991
 				}
993 992
 				// check after every day if we have to increase $this->extraRows
994
-				if(($this->extraRowsOriginal+$extraRowsToAdd) > $this->extraRows)
993
+				if (($this->extraRowsOriginal + $extraRowsToAdd) > $this->extraRows)
995 994
 				{
996 995
 					$this->remBotExtraRows = $extraRowsToAdd;
997
-					$this->extraRows = ($this->extraRowsOriginal+$extraRowsToAdd);
996
+					$this->extraRows = ($this->extraRowsOriginal + $extraRowsToAdd);
998 997
 				}
999 998
 			}
1000 999
 		}
Please login to merge, or discard this patch.
calendar/setup/tables_update.inc.php 5 patches
Doc Comments   +5 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,6 +11,10 @@  discard block
 block discarded – undo
11 11
 
12 12
 use EGroupware\Api;
13 13
 
14
+/**
15
+ * @param string $table
16
+ * @param string $field
17
+ */
14 18
 function calendar_v0_9_2to0_9_3update_owner($table, $field)
15 19
 {
16 20
 	$GLOBALS['egw_setup']->oProc->query("select distinct($field) from $table");
@@ -2306,7 +2310,7 @@  discard block
 block discarded – undo
2306 2310
  *
2307 2311
  * Also fix recurring events containing a reference to an other master, created when an exception is made a recurring event.
2308 2312
  *
2309
- * @return type
2313
+ * @return string
2310 2314
  */
2311 2315
 function calendar_upgrade14_1()
2312 2316
 {
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1909,7 +1909,7 @@
 block discarded – undo
1909 1909
 			WHERE cal_id='.(int)$row['cal_id'].' AND cal_start='.(int)$row['cal_start'],__LINE__,__FILE__);
1910 1910
 	}
1911 1911
 
1912
-    $GLOBALS['egw_setup']->db->query('UPDATE egw_cal_repeats SET recur_interval=1
1912
+	$GLOBALS['egw_setup']->db->query('UPDATE egw_cal_repeats SET recur_interval=1
1913 1913
 			WHERE recur_interval=0',__LINE__,__FILE__);
1914 1914
 
1915 1915
 	return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.007';
Please login to merge, or discard this patch.
Upper-Lower-Casing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 		{
33 33
 			$GLOBALS['egw_setup']->oProc->query("SELECT account_id FROM $acctstbl WHERE account_lid='".$owner[$i]."'");
34 34
 			$GLOBALS['egw_setup']->oProc->next_record();
35
-			$GLOBALS['egw_setup']->oProc->query("UPDATE $table SET $field=".$GLOBALS['egw_setup']->oProc->f('account_id')." WHERE $field='".$owner[$i]."'");
35
+			$GLOBALS['egw_setup']->oProc->query("update $table SET $field=".$GLOBALS['egw_setup']->oProc->f('account_id')." WHERE $field='".$owner[$i]."'");
36 36
 		}
37 37
 	}
38 38
 	$GLOBALS['egw_setup']->oProc->AlterColumn($table, $field, array('type' => 'int', 'precision' => 4, 'nullable' => false, 'default' => 0));
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 	$db2 = clone($GLOBALS['egw_setup']->db);
189 189
 
190 190
 	$GLOBALS['egw_setup']->oProc->CreateTable('calendar_entry',
191
-		Array(
191
+		array(
192 192
 			'fd' => array(
193 193
 				'cal_id' => array('type' => 'auto', 'nullable' => false),
194 194
 				'cal_owner' => array('type' => 'int', 'precision' => 4, 'nullable' => false, 'default' => '0'),
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 	$GLOBALS['egw_setup']->oProc->DropTable('webcal_entry');
239 239
 
240 240
 	$GLOBALS['egw_setup']->oProc->CreateTable('calendar_entry_user',
241
-		Array(
241
+		array(
242 242
 			'fd' => array(
243 243
 				'cal_id' => array('type' => 'int', 'precision' => 4, 'nullable' => false, 'default' => '0'),
244 244
 				'cal_login' => array('type' => 'int', 'precision' => 4, 'nullable' => false, 'default' => '0'),
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 	$GLOBALS['egw_setup']->oProc->DropTable('webcal_entry_user');
269 269
 
270 270
 	$GLOBALS['egw_setup']->oProc->CreateTable('calendar_entry_repeats',
271
-		Array(
271
+		array(
272 272
 			'fd' => array(
273 273
 				'cal_id' => array('type' => 'int', 'precision' => 4, 'default' => '0', 'nullable' => false),
274 274
 				'cal_type' => array('type' => 'varchar', 'precision' => 20, 'default' => 'daily', 'nullable' => false),
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 	}
311 311
 
312 312
 	$GLOBALS['egw_setup']->oProc->DropTable('webcal_entry_repeats');
313
-	$GLOBALS['egw_setup']->oProc->query("UPDATE {$GLOBALS['egw_setup']->applications_table} SET app_tables='calendar_entry,calendar_entry_user,calendar_entry_repeats' WHERE app_name='calendar'",__LINE__,__FILE__);
313
+	$GLOBALS['egw_setup']->oProc->query("update {$GLOBALS['egw_setup']->applications_table} SET app_tables='calendar_entry,calendar_entry_user,calendar_entry_repeats' WHERE app_name='calendar'",__LINE__,__FILE__);
314 314
 
315 315
 	$GLOBALS['setup_info']['calendar']['currentver'] = '0.9.7pre2';
316 316
 	return $GLOBALS['setup_info']['calendar']['currentver'];
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
 
603 603
 // calendar_entry => phpgw_cal
604 604
 	$GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal',
605
-		Array(
605
+		array(
606 606
 			'fd' => array(
607 607
 				'cal_id' => array('type' => 'auto', 'nullable' => False),
608 608
 				'owner' => array('type' => 'int', 'precision' => 8, 'nullable' => False),
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
 
659 659
 // calendar_entry_repeats => phpgw_cal_repeats
660 660
 	$GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_repeats',
661
-		Array(
661
+		array(
662 662
 			'fd' => array(
663 663
 				'cal_id' => array('type' => 'int', 'precision' => 8,'nullable' => False),
664 664
 				'recur_type' => array('type' => 'int', 'precision' => 8,'nullable' => False),
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
 function calendar_upgrade0_9_11_003()
732 732
 {
733 733
 	$GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_holidays',
734
-		Array(
734
+		array(
735 735
 			'fd' => array(
736 736
 				'locale' => array('type' => 'char', 'precision' => 2,'nullable' => False),
737 737
 				'name' => array('type' => 'varchar', 'precision' => 50,'nullable' => False),
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
 {
768 768
 	$GLOBALS['egw_setup']->oProc->DropTable('phpgw_cal_holidays');
769 769
 	$GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_holidays',
770
-		Array(
770
+		array(
771 771
 			'fd' => array(
772 772
 				'hol_id' => array('type' => 'auto','nullable' => False),
773 773
 				'locale' => array('type' => 'char', 'precision' => 2,'nullable' => False),
@@ -854,7 +854,7 @@  discard block
 block discarded – undo
854 854
 function calendar_upgrade0_9_13_003()
855 855
 {
856 856
 	$GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_alarm',
857
-		Array(
857
+		array(
858 858
 			'fd' => array(
859 859
 				'alarm_id' => array('type' => 'auto','nullable' => False),
860 860
 				'cal_id'   => array('type' => 'int', 'precision' => 8, 'nullable' => False),
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
 
889 889
 function calendar_upgrade0_9_13_005()
890 890
 {
891
-	$calendar_data = Array();
891
+	$calendar_data = array();
892 892
 	$GLOBALS['egw_setup']->oProc->query('SELECT cal_id, category FROM phpgw_cal',__LINE__,__FILE__);
893 893
 	while($GLOBALS['egw_setup']->oProc->next_record())
894 894
 	{
Please login to merge, or discard this patch.
Spacing   +438 added lines, -438 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 		{
21 21
 			$owner[count($owner)] = $GLOBALS['egw_setup']->oProc->f($field);
22 22
 		}
23
-		if($GLOBALS['egw_setup']->alessthanb($GLOBALS['setup_info']['phpgwapi']['currentver'],'0.9.10pre4'))
23
+		if ($GLOBALS['egw_setup']->alessthanb($GLOBALS['setup_info']['phpgwapi']['currentver'], '0.9.10pre4'))
24 24
 		{
25 25
 			$acctstbl = 'accounts';
26 26
 		}
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 		{
29 29
 			$acctstbl = 'phpgw_accounts';
30 30
 		}
31
-		for($i=0;$i<count($owner);$i++)
31
+		for ($i = 0; $i < count($owner); $i++)
32 32
 		{
33 33
 			$GLOBALS['egw_setup']->oProc->query("SELECT account_id FROM $acctstbl WHERE account_lid='".$owner[$i]."'");
34 34
 			$GLOBALS['egw_setup']->oProc->next_record();
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
 
42 42
 function calendar_upgrade0_9_3pre1()
43 43
 {
44
-	calendar_v0_9_2to0_9_3update_owner('webcal_entry','cal_create_by');
45
-	calendar_v0_9_2to0_9_3update_owner('webcal_entry_user','cal_login');
44
+	calendar_v0_9_2to0_9_3update_owner('webcal_entry', 'cal_create_by');
45
+	calendar_v0_9_2to0_9_3update_owner('webcal_entry_user', 'cal_login');
46 46
 	$GLOBALS['setup_info']['calendar']['currentver'] = '0.9.3pre2';
47 47
 	return $GLOBALS['setup_info']['calendar']['currentver'];
48 48
 }
@@ -209,12 +209,12 @@  discard block
 block discarded – undo
209 209
 		)
210 210
 	);
211 211
 
212
-	$GLOBALS['egw_setup']->oProc->query('SELECT count(*) FROM webcal_entry',__LINE__,__FILE__);
212
+	$GLOBALS['egw_setup']->oProc->query('SELECT count(*) FROM webcal_entry', __LINE__, __FILE__);
213 213
 	$GLOBALS['egw_setup']->oProc->next_record();
214
-	if($GLOBALS['egw_setup']->oProc->f(0))
214
+	if ($GLOBALS['egw_setup']->oProc->f(0))
215 215
 	{
216
-		$GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_owner,cal_duration,cal_priority,cal_type,cal_access,cal_name,cal_description,cal_id,cal_date,cal_time,cal_mod_date,cal_mod_time FROM webcal_entry ORDER BY cal_id',__LINE__,__FILE__);
217
-		while($GLOBALS['egw_setup']->oProc->next_record())
216
+		$GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_owner,cal_duration,cal_priority,cal_type,cal_access,cal_name,cal_description,cal_id,cal_date,cal_time,cal_mod_date,cal_mod_time FROM webcal_entry ORDER BY cal_id', __LINE__, __FILE__);
217
+		while ($GLOBALS['egw_setup']->oProc->next_record())
218 218
 		{
219 219
 			$cal_id = $GLOBALS['egw_setup']->oProc->f('cal_id');
220 220
 			$cal_owner = $GLOBALS['egw_setup']->oProc->f('cal_owner');
@@ -224,13 +224,13 @@  discard block
 block discarded – undo
224 224
 			$cal_access = $GLOBALS['egw_setup']->oProc->f('cal_access');
225 225
 			$cal_name = $GLOBALS['egw_setup']->oProc->f('cal_name');
226 226
 			$cal_description = $GLOBALS['egw_setup']->oProc->f('cal_description');
227
-			$datetime = mktime(intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_time')),4))),intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_time')),2,2))),intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_time')),0,2))),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_date'),4,2)),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_date'),6,2)),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_date'),0,4)));
228
-			$moddatetime = mktime(intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_mod_time')),4))),intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_mod_time')),2,2))),intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_mod_time')),0,2))),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_mod_date'),4,2)),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_mod_date'),6,2)),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_mod_date'),0,4)));
229
-			$db2->query('SELECT groups FROM webcal_entry_groups WHERE cal_id='.$cal_id,__LINE__,__FILE__);
227
+			$datetime = mktime(intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_time')), 4))), intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_time')), 2, 2))), intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_time')), 0, 2))), intval(substr($GLOBALS['egw_setup']->oProc->f('cal_date'), 4, 2)), intval(substr($GLOBALS['egw_setup']->oProc->f('cal_date'), 6, 2)), intval(substr($GLOBALS['egw_setup']->oProc->f('cal_date'), 0, 4)));
228
+			$moddatetime = mktime(intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_mod_time')), 4))), intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_mod_time')), 2, 2))), intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_mod_time')), 0, 2))), intval(substr($GLOBALS['egw_setup']->oProc->f('cal_mod_date'), 4, 2)), intval(substr($GLOBALS['egw_setup']->oProc->f('cal_mod_date'), 6, 2)), intval(substr($GLOBALS['egw_setup']->oProc->f('cal_mod_date'), 0, 4)));
229
+			$db2->query('SELECT groups FROM webcal_entry_groups WHERE cal_id='.$cal_id, __LINE__, __FILE__);
230 230
 			$db2->next_record();
231 231
 			$cal_group = $db2->f('groups');
232 232
 			$db2->query('INSERT INTO calendar_entry(cal_id,cal_owner,cal_group,cal_datetime,cal_mdatetime,cal_duration,cal_priority,cal_type,cal_access,cal_name,cal_description) '
233
-				.'VALUES('.$cal_id.",'".$cal_owner."','".$cal_group."',".$datetime.",".$moddatetime.",".$cal_duration.",".$cal_priority.",'".$cal_type."','".$cal_access."','".$cal_name."','".$cal_description."')",__LINE__,__FILE__);
233
+				.'VALUES('.$cal_id.",'".$cal_owner."','".$cal_group."',".$datetime.",".$moddatetime.",".$cal_duration.",".$cal_priority.",'".$cal_type."','".$cal_access."','".$cal_name."','".$cal_description."')", __LINE__, __FILE__);
234 234
 		}
235 235
 	}
236 236
 
@@ -251,17 +251,17 @@  discard block
 block discarded – undo
251 251
 		)
252 252
 	);
253 253
 
254
-	$GLOBALS['egw_setup']->oProc->query('SELECT count(*) FROM webcal_entry_user',__LINE__,__FILE__);
254
+	$GLOBALS['egw_setup']->oProc->query('SELECT count(*) FROM webcal_entry_user', __LINE__, __FILE__);
255 255
 	$GLOBALS['egw_setup']->oProc->next_record();
256
-	if($GLOBALS['egw_setup']->oProc->f(0))
256
+	if ($GLOBALS['egw_setup']->oProc->f(0))
257 257
 	{
258
-		$GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_login,cal_status FROM webcal_entry_user ORDER BY cal_id',__LINE__,__FILE__);
259
-		while($GLOBALS['egw_setup']->oProc->next_record())
258
+		$GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_login,cal_status FROM webcal_entry_user ORDER BY cal_id', __LINE__, __FILE__);
259
+		while ($GLOBALS['egw_setup']->oProc->next_record())
260 260
 		{
261 261
 			$cal_id = $GLOBALS['egw_setup']->oProc->f('cal_id');
262 262
 			$cal_login = $GLOBALS['egw_setup']->oProc->f('cal_login');
263 263
 			$cal_status = $GLOBALS['egw_setup']->oProc->f('cal_status');
264
-			$db2->query('INSERT INTO calendar_entry_user(cal_id,cal_login,cal_status) VALUES('.$cal_id.','.$cal_login.",'".$cal_status."')",__LINE__,__FILE__);
264
+			$db2->query('INSERT INTO calendar_entry_user(cal_id,cal_login,cal_status) VALUES('.$cal_id.','.$cal_login.",'".$cal_status."')", __LINE__, __FILE__);
265 265
 		}
266 266
 	}
267 267
 
@@ -284,18 +284,18 @@  discard block
 block discarded – undo
284 284
 		)
285 285
 	);
286 286
 
287
-	$GLOBALS['egw_setup']->oProc->query('SELECT count(*) FROM webcal_entry_repeats',__LINE__,__FILE__);
287
+	$GLOBALS['egw_setup']->oProc->query('SELECT count(*) FROM webcal_entry_repeats', __LINE__, __FILE__);
288 288
 	$GLOBALS['egw_setup']->oProc->next_record();
289
-	if($GLOBALS['egw_setup']->oProc->f(0))
289
+	if ($GLOBALS['egw_setup']->oProc->f(0))
290 290
 	{
291
-		$GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_type,cal_end,cal_frequency,cal_days FROM webcal_entry_repeats ORDER BY cal_id',__LINE__,__FILE__);
292
-		while($GLOBALS['egw_setup']->oProc->next_record())
291
+		$GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_type,cal_end,cal_frequency,cal_days FROM webcal_entry_repeats ORDER BY cal_id', __LINE__, __FILE__);
292
+		while ($GLOBALS['egw_setup']->oProc->next_record())
293 293
 		{
294 294
 			$cal_id = $GLOBALS['egw_setup']->oProc->f('cal_id');
295 295
 			$cal_type = $GLOBALS['egw_setup']->oProc->f('cal_type');
296
-			if(isset($GLOBALS['egw_setup']->oProc->Record['cal_end']))
296
+			if (isset($GLOBALS['egw_setup']->oProc->Record['cal_end']))
297 297
 			{
298
-				$enddate = mktime(0,0,0,intval(substr($GLOBALS['egw_setup']->oProc->f('cal_end'),4,2)),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_end'),6,2)),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_end'),0,4)));
298
+				$enddate = mktime(0, 0, 0, intval(substr($GLOBALS['egw_setup']->oProc->f('cal_end'), 4, 2)), intval(substr($GLOBALS['egw_setup']->oProc->f('cal_end'), 6, 2)), intval(substr($GLOBALS['egw_setup']->oProc->f('cal_end'), 0, 4)));
299 299
 				$useend = 1;
300 300
 			}
301 301
 			else
@@ -305,12 +305,12 @@  discard block
 block discarded – undo
305 305
 			}
306 306
 			$cal_frequency = $GLOBALS['egw_setup']->oProc->f('cal_frequency');
307 307
 			$cal_days = $GLOBALS['egw_setup']->oProc->f('cal_days');
308
-			$db2->query('INSERT INTO calendar_entry_repeats(cal_id,cal_type,cal_use_end,cal_end,cal_frequency,cal_days) VALUES('.$cal_id.",'".$cal_type."',".$useend.",".$enddate.",".$cal_frequency.",'".$cal_days."')",__LINE__,__FILE__);
308
+			$db2->query('INSERT INTO calendar_entry_repeats(cal_id,cal_type,cal_use_end,cal_end,cal_frequency,cal_days) VALUES('.$cal_id.",'".$cal_type."',".$useend.",".$enddate.",".$cal_frequency.",'".$cal_days."')", __LINE__, __FILE__);
309 309
 		}
310 310
 	}
311 311
 
312 312
 	$GLOBALS['egw_setup']->oProc->DropTable('webcal_entry_repeats');
313
-	$GLOBALS['egw_setup']->oProc->query("UPDATE {$GLOBALS['egw_setup']->applications_table} SET app_tables='calendar_entry,calendar_entry_user,calendar_entry_repeats' WHERE app_name='calendar'",__LINE__,__FILE__);
313
+	$GLOBALS['egw_setup']->oProc->query("UPDATE {$GLOBALS['egw_setup']->applications_table} SET app_tables='calendar_entry,calendar_entry_user,calendar_entry_repeats' WHERE app_name='calendar'", __LINE__, __FILE__);
314 314
 
315 315
 	$GLOBALS['setup_info']['calendar']['currentver'] = '0.9.7pre2';
316 316
 	return $GLOBALS['setup_info']['calendar']['currentver'];
@@ -322,19 +322,19 @@  discard block
 block discarded – undo
322 322
 	$db2 = $GLOBALS['egw_setup']->db;
323 323
 
324 324
 	$GLOBALS['egw_setup']->oProc->RenameColumn('calendar_entry', 'cal_duration', 'cal_edatetime');
325
-	$GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_datetime,cal_owner,cal_edatetime,cal_mdatetime FROM calendar_entry ORDER BY cal_id',__LINE__,__FILE__);
326
-	if($GLOBALS['egw_setup']->oProc->num_rows())
325
+	$GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_datetime,cal_owner,cal_edatetime,cal_mdatetime FROM calendar_entry ORDER BY cal_id', __LINE__, __FILE__);
326
+	if ($GLOBALS['egw_setup']->oProc->num_rows())
327 327
 	{
328
-		while($GLOBALS['egw_setup']->oProc->next_record())
328
+		while ($GLOBALS['egw_setup']->oProc->next_record())
329 329
 		{
330
-			$db2->query("SELECT preference_value FROM preferences WHERE preference_name='tz_offset' AND preference_appname='common' AND preference_owner=".$GLOBALS['egw_setup']->db->f('cal_owner'),__LINE__,__FILE__);
330
+			$db2->query("SELECT preference_value FROM preferences WHERE preference_name='tz_offset' AND preference_appname='common' AND preference_owner=".$GLOBALS['egw_setup']->db->f('cal_owner'), __LINE__, __FILE__);
331 331
 			$db2->next_record();
332 332
 			$tz = $db2->f('preference_value');
333 333
 			$cal_id = $GLOBALS['egw_setup']->oProc->f('cal_id');
334 334
 			$datetime = $GLOBALS['egw_setup']->oProc->f('cal_datetime') - ((60 * 60) * $tz);
335 335
 			$mdatetime = $GLOBALS['egw_setup']->oProc->f('cal_mdatetime') - ((60 * 60) * $tz);
336 336
 			$edatetime = $datetime + (60 * $GLOBALS['egw_setup']->oProc->f('cal_edatetime'));
337
-			$db2->query('UPDATE calendar_entry SET cal_datetime='.$datetime.', cal_edatetime='.$edatetime.', cal_mdatetime='.$mdatetime.' WHERE cal_id='.$cal_id,__LINE__,__FILE__);
337
+			$db2->query('UPDATE calendar_entry SET cal_datetime='.$datetime.', cal_edatetime='.$edatetime.', cal_mdatetime='.$mdatetime.' WHERE cal_id='.$cal_id, __LINE__, __FILE__);
338 338
 		}
339 339
 	}
340 340
 
@@ -582,22 +582,22 @@  discard block
 block discarded – undo
582 582
 {
583 583
 	$db2 = $GLOBALS['egw_setup']->db;
584 584
 
585
-	if(extension_loaded('mcal') == False)
585
+	if (extension_loaded('mcal') == False)
586 586
 	{
587
-		define(RECUR_NONE,0);
588
-		define(RECUR_DAILY,1);
589
-		define(RECUR_WEEKLY,2);
590
-		define(RECUR_MONTHLY_MDAY,3);
591
-		define(RECUR_MONTHLY_WDAY,4);
592
-		define(RECUR_YEARLY,5);
593
-
594
-		define(M_SUNDAY,1);
595
-		define(M_MONDAY,2);
596
-		define(M_TUESDAY,4);
597
-		define(M_WEDNESDAY,8);
598
-		define(M_THURSDAY,16);
599
-		define(M_FRIDAY,32);
600
-		define(M_SATURDAY,64);
587
+		define(RECUR_NONE, 0);
588
+		define(RECUR_DAILY, 1);
589
+		define(RECUR_WEEKLY, 2);
590
+		define(RECUR_MONTHLY_MDAY, 3);
591
+		define(RECUR_MONTHLY_WDAY, 4);
592
+		define(RECUR_YEARLY, 5);
593
+
594
+		define(M_SUNDAY, 1);
595
+		define(M_MONDAY, 2);
596
+		define(M_TUESDAY, 4);
597
+		define(M_WEDNESDAY, 8);
598
+		define(M_THURSDAY, 16);
599
+		define(M_FRIDAY, 32);
600
+		define(M_SATURDAY, 64);
601 601
 	}
602 602
 
603 603
 // calendar_entry => phpgw_cal
@@ -624,13 +624,13 @@  discard block
 block discarded – undo
624 624
 		)
625 625
 	);
626 626
 
627
-	$GLOBALS['egw_setup']->oProc->query('SELECT * FROM calendar_entry',__LINE__,__FILE__);
628
-	while($GLOBALS['egw_setup']->oProc->next_record())
627
+	$GLOBALS['egw_setup']->oProc->query('SELECT * FROM calendar_entry', __LINE__, __FILE__);
628
+	while ($GLOBALS['egw_setup']->oProc->next_record())
629 629
 	{
630 630
 		$id = $GLOBALS['egw_setup']->oProc->f('cal_id');
631 631
 		$owner = $GLOBALS['egw_setup']->oProc->f('cal_owner');
632 632
 		$access = $GLOBALS['egw_setup']->oProc->f('cal_access');
633
-		switch($access)
633
+		switch ($access)
634 634
 		{
635 635
 			case 'private':
636 636
 				$is_public = 0;
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
 		$description = $GLOBALS['egw_setup']->oProc->f('cal_description');
653 653
 
654 654
 		$db2->query("INSERT INTO phpgw_cal(cal_id,owner,groups,datetime,mdatetime,edatetime,priority,cal_type,is_public,title,description) "
655
-			. "VALUES($id,$owner,'$groups',$datetime,$mdatetime,$edatetime,$priority,'$type',$is_public,'$title','$description')",__LINE__,__FILE__);
655
+			. "VALUES($id,$owner,'$groups',$datetime,$mdatetime,$edatetime,$priority,'$type',$is_public,'$title','$description')", __LINE__, __FILE__);
656 656
 	}
657 657
 	$GLOBALS['egw_setup']->oProc->DropTable('calendar_entry');
658 658
 
@@ -660,12 +660,12 @@  discard block
 block discarded – undo
660 660
 	$GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_repeats',
661 661
 		Array(
662 662
 			'fd' => array(
663
-				'cal_id' => array('type' => 'int', 'precision' => 8,'nullable' => False),
664
-				'recur_type' => array('type' => 'int', 'precision' => 8,'nullable' => False),
665
-				'recur_use_end' => array('type' => 'int', 'precision' => 8,'nullable' => True),
666
-				'recur_enddate' => array('type' => 'int', 'precision' => 8,'nullable' => True),
667
-				'recur_interval' => array('type' => 'int', 'precision' => 8,'nullable' => True,'default' => '1'),
668
-				'recur_data' => array('type' => 'int', 'precision' => 8,'nullable' => True,'default' => '1')
663
+				'cal_id' => array('type' => 'int', 'precision' => 8, 'nullable' => False),
664
+				'recur_type' => array('type' => 'int', 'precision' => 8, 'nullable' => False),
665
+				'recur_use_end' => array('type' => 'int', 'precision' => 8, 'nullable' => True),
666
+				'recur_enddate' => array('type' => 'int', 'precision' => 8, 'nullable' => True),
667
+				'recur_interval' => array('type' => 'int', 'precision' => 8, 'nullable' => True, 'default' => '1'),
668
+				'recur_data' => array('type' => 'int', 'precision' => 8, 'nullable' => True, 'default' => '1')
669 669
 			),
670 670
 			'pk' => array(),
671 671
 			'fk' => array(),
@@ -673,12 +673,12 @@  discard block
 block discarded – undo
673 673
 			'uc' => array()
674 674
 		)
675 675
 	);
676
-	$GLOBALS['egw_setup']->oProc->query('SELECT * FROM calendar_entry_repeats',__LINE__,__FILE__);
677
-	while($GLOBALS['egw_setup']->oProc->next_record())
676
+	$GLOBALS['egw_setup']->oProc->query('SELECT * FROM calendar_entry_repeats', __LINE__, __FILE__);
677
+	while ($GLOBALS['egw_setup']->oProc->next_record())
678 678
 	{
679 679
 		$id = $GLOBALS['egw_setup']->oProc->f('cal_id');
680 680
 		$recur_type = $GLOBALS['egw_setup']->oProc->f('cal_type');
681
-		switch($recur_type)
681
+		switch ($recur_type)
682 682
 		{
683 683
 			case 'daily':
684 684
 				$recur_type_num = RECUR_DAILY;
@@ -701,20 +701,20 @@  discard block
 block discarded – undo
701 701
 		$recur_interval = $GLOBALS['egw_setup']->oProc->f('cal_frequency');
702 702
 		$days = strtoupper($GLOBALS['egw_setup']->oProc->f('cal_days'));
703 703
 		$recur_data = 0;
704
-		$recur_data += (substr($days,0,1)=='Y'?M_SUNDAY:0);
705
-		$recur_data += (substr($days,1,1)=='Y'?M_MONDAY:0);
706
-		$recur_data += (substr($days,2,1)=='Y'?M_TUESDAY:0);
707
-		$recur_data += (substr($days,3,1)=='Y'?M_WEDNESDAY:0);
708
-		$recur_data += (substr($days,4,1)=='Y'?M_THURSDAY:0);
709
-		$recur_data += (substr($days,5,1)=='Y'?M_FRIDAY:0);
710
-		$recur_data += (substr($days,6,1)=='Y'?M_SATURDAY:0);
704
+		$recur_data += (substr($days, 0, 1) == 'Y' ?M_SUNDAY:0);
705
+		$recur_data += (substr($days, 1, 1) == 'Y' ?M_MONDAY:0);
706
+		$recur_data += (substr($days, 2, 1) == 'Y' ?M_TUESDAY:0);
707
+		$recur_data += (substr($days, 3, 1) == 'Y' ?M_WEDNESDAY:0);
708
+		$recur_data += (substr($days, 4, 1) == 'Y' ?M_THURSDAY:0);
709
+		$recur_data += (substr($days, 5, 1) == 'Y' ?M_FRIDAY:0);
710
+		$recur_data += (substr($days, 6, 1) == 'Y' ?M_SATURDAY:0);
711 711
 		$db2->query("INSERT INTO phpgw_cal_repeats(cal_id,recur_type,recur_use_end,recur_enddate,recur_interval,recur_data) "
712
-			. "VALUES($id,$recur_type_num,$recur_use_end,$recur_end,$recur_interval,$recur_data)",__LINE__,__FILE__);
712
+			. "VALUES($id,$recur_type_num,$recur_use_end,$recur_end,$recur_interval,$recur_data)", __LINE__, __FILE__);
713 713
 	}
714 714
 	$GLOBALS['egw_setup']->oProc->DropTable('calendar_entry_repeats');
715 715
 
716 716
 // calendar_entry_user => phpgw_cal_user
717
-	$GLOBALS['egw_setup']->oProc->RenameTable('calendar_entry_user','phpgw_cal_user');
717
+	$GLOBALS['egw_setup']->oProc->RenameTable('calendar_entry_user', 'phpgw_cal_user');
718 718
 
719 719
 	$GLOBALS['setup_info']['calendar']['currentver'] = '0.9.11.002';
720 720
 	return $GLOBALS['setup_info']['calendar']['currentver'];
@@ -733,11 +733,11 @@  discard block
 block discarded – undo
733 733
 	$GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_holidays',
734 734
 		Array(
735 735
 			'fd' => array(
736
-				'locale' => array('type' => 'char', 'precision' => 2,'nullable' => False),
737
-				'name' => array('type' => 'varchar', 'precision' => 50,'nullable' => False),
738
-				'date_time' => array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')
736
+				'locale' => array('type' => 'char', 'precision' => 2, 'nullable' => False),
737
+				'name' => array('type' => 'varchar', 'precision' => 50, 'nullable' => False),
738
+				'date_time' => array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0')
739 739
 			),
740
-			'pk' => array('locale','name'),
740
+			'pk' => array('locale', 'name'),
741 741
 			'fk' => array(),
742 742
 			'ix' => array(),
743 743
 			'uc' => array()
@@ -769,10 +769,10 @@  discard block
 block discarded – undo
769 769
 	$GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_holidays',
770 770
 		Array(
771 771
 			'fd' => array(
772
-				'hol_id' => array('type' => 'auto','nullable' => False),
773
-				'locale' => array('type' => 'char', 'precision' => 2,'nullable' => False),
774
-				'name' => array('type' => 'varchar', 'precision' => 50,'nullable' => False),
775
-				'date_time' => array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')
772
+				'hol_id' => array('type' => 'auto', 'nullable' => False),
773
+				'locale' => array('type' => 'char', 'precision' => 2, 'nullable' => False),
774
+				'name' => array('type' => 'varchar', 'precision' => 50, 'nullable' => False),
775
+				'date_time' => array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0')
776 776
 			),
777 777
 			'pk' => array('hol_id'),
778 778
 			'fk' => array(),
@@ -789,10 +789,10 @@  discard block
 block discarded – undo
789 789
 function calendar_upgrade0_9_11_007()
790 790
 {
791 791
 	$GLOBALS['egw_setup']->oProc->query('DELETE FROM phpgw_cal_holidays');
792
-	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays','mday',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0'));
793
-	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays','month_num',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0'));
794
-	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays','occurence',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0'));
795
-	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays','dow',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0'));
792
+	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays', 'mday', array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0'));
793
+	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays', 'month_num', array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0'));
794
+	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays', 'occurence', array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0'));
795
+	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays', 'dow', array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0'));
796 796
 
797 797
 	$GLOBALS['setup_info']['calendar']['currentver'] = '0.9.11.008';
798 798
 	return $GLOBALS['setup_info']['calendar']['currentver'];
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
 function calendar_upgrade0_9_11_009()
810 810
 {
811 811
 	$GLOBALS['egw_setup']->oProc->query('DELETE FROM phpgw_cal_holidays');
812
-	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays','observance_rule',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0'));
812
+	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays', 'observance_rule', array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0'));
813 813
 
814 814
 	$GLOBALS['setup_info']['calendar']['currentver'] = '0.9.11.010';
815 815
 	return $GLOBALS['setup_info']['calendar']['currentver'];
@@ -844,7 +844,7 @@  discard block
 block discarded – undo
844 844
 
845 845
 function calendar_upgrade0_9_13_002()
846 846
 {
847
-	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal','reference',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0'));
847
+	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal', 'reference', array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0'));
848 848
 
849 849
 	$GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.003';
850 850
 	return $GLOBALS['setup_info']['calendar']['currentver'];
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
 	$GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_alarm',
857 857
 		Array(
858 858
 			'fd' => array(
859
-				'alarm_id' => array('type' => 'auto','nullable' => False),
859
+				'alarm_id' => array('type' => 'auto', 'nullable' => False),
860 860
 				'cal_id'   => array('type' => 'int', 'precision' => 8, 'nullable' => False),
861 861
 				'cal_owner'	=> array('type' => 'int', 'precision' => 8, 'nullable' => False),
862 862
 				'cal_time' => array('type' => 'int', 'precision' => 8, 'nullable' => False),
@@ -869,8 +869,8 @@  discard block
 block discarded – undo
869 869
 		)
870 870
 	);
871 871
 
872
-	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal','uid',array('type' => 'varchar', 'precision' => 255,'nullable' => False));
873
-	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal','location',array('type' => 'varchar', 'precision' => 255,'nullable' => True));
872
+	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal', 'uid', array('type' => 'varchar', 'precision' => 255, 'nullable' => False));
873
+	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal', 'location', array('type' => 'varchar', 'precision' => 255, 'nullable' => True));
874 874
 
875 875
 	$GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.004';
876 876
 	return $GLOBALS['setup_info']['calendar']['currentver'];
@@ -879,7 +879,7 @@  discard block
 block discarded – undo
879 879
 
880 880
 function calendar_upgrade0_9_13_004()
881 881
 {
882
-	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_alarm','alarm_enabled',array('type' => 'int', 'precision' => 4,'nullable' => False, 'default' => '1'));
882
+	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_alarm', 'alarm_enabled', array('type' => 'int', 'precision' => 4, 'nullable' => False, 'default' => '1'));
883 883
 
884 884
 	$GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.005';
885 885
 	return $GLOBALS['setup_info']['calendar']['currentver'];
@@ -889,18 +889,18 @@  discard block
 block discarded – undo
889 889
 function calendar_upgrade0_9_13_005()
890 890
 {
891 891
 	$calendar_data = Array();
892
-	$GLOBALS['egw_setup']->oProc->query('SELECT cal_id, category FROM phpgw_cal',__LINE__,__FILE__);
893
-	while($GLOBALS['egw_setup']->oProc->next_record())
892
+	$GLOBALS['egw_setup']->oProc->query('SELECT cal_id, category FROM phpgw_cal', __LINE__, __FILE__);
893
+	while ($GLOBALS['egw_setup']->oProc->next_record())
894 894
 	{
895 895
 		$calendar_data[$GLOBALS['egw_setup']->oProc->f('cal_id')] = $GLOBALS['egw_setup']->oProc->f('category');
896 896
 	}
897 897
 
898
-	$GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_cal','category',array('type' => 'varchar', 'precision' => 30,'nullable' => True));
898
+	$GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_cal', 'category', array('type' => 'varchar', 'precision' => 30, 'nullable' => True));
899 899
 
900 900
 	@reset($calendar_data);
901
-	while($calendar_data && list($cal_id,$category) = each($calendar_data))
901
+	while ($calendar_data && list($cal_id, $category) = each($calendar_data))
902 902
 	{
903
-		$GLOBALS['egw_setup']->oProc->query("UPDATE phpgw_cal SET category='".$category."' WHERE cal_id=".$cal_id,__LINE__,__FILE__);
903
+		$GLOBALS['egw_setup']->oProc->query("UPDATE phpgw_cal SET category='".$category."' WHERE cal_id=".$cal_id, __LINE__, __FILE__);
904 904
 	}
905 905
 	$GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.006';
906 906
 	return $GLOBALS['setup_info']['calendar']['currentver'];
@@ -909,7 +909,7 @@  discard block
 block discarded – undo
909 909
 
910 910
 function calendar_upgrade0_9_13_006()
911 911
 {
912
-	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_repeats','recur_exception',array('type' => 'varchar', 'precision' => 255, 'nullable' => True, 'default' => ''));
912
+	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_repeats', 'recur_exception', array('type' => 'varchar', 'precision' => 255, 'nullable' => True, 'default' => ''));
913 913
 
914 914
 	$GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.007';
915 915
 	return $GLOBALS['setup_info']['calendar']['currentver'];
@@ -919,20 +919,20 @@  discard block
 block discarded – undo
919 919
 
920 920
 function calendar_upgrade0_9_13_007()
921 921
 {
922
-	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_user','cal_type',array(
922
+	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_user', 'cal_type', array(
923 923
 		'type' => 'varchar',
924 924
 		'precision' => '1',
925 925
 		'nullable' => False,
926 926
 		'default' => 'u'
927 927
 	));
928 928
 
929
-	$GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_extra',array(
929
+	$GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_extra', array(
930 930
 		'fd' => array(
931
-			'cal_id' => array('type' => 'int','precision' => '4','nullable' => False),
932
-			'cal_extra_name' => array('type' => 'varchar','precision' => '40','nullable' => False),
933
-			'cal_extra_value' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '')
931
+			'cal_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False),
932
+			'cal_extra_name' => array('type' => 'varchar', 'precision' => '40', 'nullable' => False),
933
+			'cal_extra_value' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '')
934 934
 		),
935
-		'pk' => array('cal_id','cal_extra_name'),
935
+		'pk' => array('cal_id', 'cal_extra_name'),
936 936
 		'fk' => array(),
937 937
 		'ix' => array(),
938 938
 		'uc' => array()
@@ -949,7 +949,7 @@  discard block
 block discarded – undo
949 949
 function calendar_upgrade0_9_16_001()
950 950
 {
951 951
 	// this is to set the default as schema_proc was not setting an empty default
952
-	$GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_cal_user','cal_type',array(
952
+	$GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_cal_user', 'cal_type', array(
953 953
 		'type' => 'varchar',
954 954
 		'precision' => '1',
955 955
 		'nullable' => False,
@@ -966,15 +966,15 @@  discard block
 block discarded – undo
966 966
 
967 967
 function calendar_upgrade0_9_16_002()
968 968
 {
969
-	$GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_repeats',array(
969
+	$GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_repeats', array(
970 970
 		'fd' => array(
971
-			'cal_id' => array('type' => 'int','precision' => '8','nullable' => False),
972
-			'recur_type' => array('type' => 'int','precision' => '8','nullable' => False),
973
-			'recur_use_end' => array('type' => 'int','precision' => '8','default' => '0'),
974
-			'recur_enddate' => array('type' => 'int','precision' => '8'),
975
-			'recur_interval' => array('type' => 'int','precision' => '8','default' => '1'),
976
-			'recur_data' => array('type' => 'int','precision' => '8','default' => '1'),
977
-			'recur_exception' => array('type' => 'varchar','precision' => '255','default' => '')
971
+			'cal_id' => array('type' => 'int', 'precision' => '8', 'nullable' => False),
972
+			'recur_type' => array('type' => 'int', 'precision' => '8', 'nullable' => False),
973
+			'recur_use_end' => array('type' => 'int', 'precision' => '8', 'default' => '0'),
974
+			'recur_enddate' => array('type' => 'int', 'precision' => '8'),
975
+			'recur_interval' => array('type' => 'int', 'precision' => '8', 'default' => '1'),
976
+			'recur_data' => array('type' => 'int', 'precision' => '8', 'default' => '1'),
977
+			'recur_exception' => array('type' => 'varchar', 'precision' => '255', 'default' => '')
978 978
 		),
979 979
 		'pk' => array(),
980 980
 		'fk' => array(),
@@ -990,14 +990,14 @@  discard block
 block discarded – undo
990 990
 
991 991
 function calendar_upgrade0_9_16_003()
992 992
 {
993
-	$GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_user',array(
993
+	$GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_user', array(
994 994
 		'fd' => array(
995
-			'cal_id' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'),
996
-			'cal_login' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'),
997
-			'cal_status' => array('type' => 'char','precision' => '1','default' => 'A'),
998
-			'cal_type' => array('type' => 'varchar','precision' => '1','nullable' => False,'default' => 'u')
995
+			'cal_id' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'),
996
+			'cal_login' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'),
997
+			'cal_status' => array('type' => 'char', 'precision' => '1', 'default' => 'A'),
998
+			'cal_type' => array('type' => 'varchar', 'precision' => '1', 'nullable' => False, 'default' => 'u')
999 999
 		),
1000
-		'pk' => array('cal_id','cal_login','cal_type'),
1000
+		'pk' => array('cal_id', 'cal_login', 'cal_type'),
1001 1001
 		'fk' => array(),
1002 1002
 		'ix' => array(),
1003 1003
 		'uc' => array()
@@ -1011,16 +1011,16 @@  discard block
 block discarded – undo
1011 1011
 
1012 1012
 function calendar_upgrade0_9_16_004()
1013 1013
 {
1014
-	$GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_holidays',array(
1014
+	$GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_holidays', array(
1015 1015
 		'fd' => array(
1016
-			'hol_id' => array('type' => 'auto','nullable' => False),
1017
-			'locale' => array('type' => 'char','precision' => '2','nullable' => False),
1018
-			'name' => array('type' => 'varchar','precision' => '50','nullable' => False),
1019
-			'mday' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'),
1020
-			'month_num' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'),
1021
-			'occurence' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'),
1022
-			'dow' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'),
1023
-			'observance_rule' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0')
1016
+			'hol_id' => array('type' => 'auto', 'nullable' => False),
1017
+			'locale' => array('type' => 'char', 'precision' => '2', 'nullable' => False),
1018
+			'name' => array('type' => 'varchar', 'precision' => '50', 'nullable' => False),
1019
+			'mday' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'),
1020
+			'month_num' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'),
1021
+			'occurence' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'),
1022
+			'dow' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'),
1023
+			'observance_rule' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0')
1024 1024
 		),
1025 1025
 		'pk' => array('hol_id'),
1026 1026
 		'fk' => array(),
@@ -1038,13 +1038,13 @@  discard block
 block discarded – undo
1038 1038
 {
1039 1039
 	// creates uid's for all entries which do not have unique ones, they are '[email protected]'
1040 1040
 	// very old entries even have an empty uid, see 0.9.16.006 update
1041
-	$GLOBALS['egw_setup']->oProc->query("SELECT config_name,config_value FROM {$GLOBALS['egw_setup']->config_table} WHERE config_name IN ('install_id','mail_suffix') AND config_app='phpgwapi'",__LINE__,__FILE__);
1041
+	$GLOBALS['egw_setup']->oProc->query("SELECT config_name,config_value FROM {$GLOBALS['egw_setup']->config_table} WHERE config_name IN ('install_id','mail_suffix') AND config_app='phpgwapi'", __LINE__, __FILE__);
1042 1042
 	while ($GLOBALS['egw_setup']->oProc->next_record())
1043 1043
 	{
1044 1044
 		$config[$GLOBALS['egw_setup']->oProc->f(0)] = $GLOBALS['egw_setup']->oProc->f(1);
1045 1045
 	}
1046 1046
 	$GLOBALS['egw_setup']->oProc->query('UPDATE phpgw_cal SET uid='.
1047
-		$GLOBALS['egw_setup']->db->concat($GLOBALS['egw_setup']->db->quote('cal-'),'cal_id',
1047
+		$GLOBALS['egw_setup']->db->concat($GLOBALS['egw_setup']->db->quote('cal-'), 'cal_id',
1048 1048
 			$GLOBALS['egw_setup']->db->quote('-'.$config['install_id'].'@'.
1049 1049
 			($config['mail_suffix'] ? $config['mail_suffix'] : 'local'))).
1050 1050
 		" WHERE uid LIKE '-@%' OR uid=''");
@@ -1067,7 +1067,7 @@  discard block
 block discarded – undo
1067 1067
 function calendar_upgrade0_9_16_007()
1068 1068
 {
1069 1069
 	// update the sequenzes for refreshed tables (postgres only)
1070
-	$GLOBALS['egw_setup']->oProc->UpdateSequence('phpgw_cal_holidays','hol_id');
1070
+	$GLOBALS['egw_setup']->oProc->UpdateSequence('phpgw_cal_holidays', 'hol_id');
1071 1071
 
1072 1072
 	$GLOBALS['setup_info']['calendar']['currentver'] = '1.0.0';
1073 1073
 	return $GLOBALS['setup_info']['calendar']['currentver'];
@@ -1077,19 +1077,19 @@  discard block
 block discarded – undo
1077 1077
 
1078 1078
 function calendar_upgrade1_0_0()
1079 1079
 {
1080
-	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','uid','cal_uid');
1081
-	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','owner','cal_owner');
1082
-	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','category','cal_category');
1083
-	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','groups','cal_groups');
1084
-	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','datetime','cal_starttime');
1085
-	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','mdatetime','cal_modified');
1086
-	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','edatetime','cal_endtime');
1087
-	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','priority','cal_priority');
1088
-	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','is_public','cal_public');
1089
-	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','title','cal_title');
1090
-	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','description','cal_description');
1091
-	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','location','cal_location');
1092
-	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','reference','cal_reference');
1080
+	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'uid', 'cal_uid');
1081
+	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'owner', 'cal_owner');
1082
+	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'category', 'cal_category');
1083
+	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'groups', 'cal_groups');
1084
+	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'datetime', 'cal_starttime');
1085
+	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'mdatetime', 'cal_modified');
1086
+	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'edatetime', 'cal_endtime');
1087
+	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'priority', 'cal_priority');
1088
+	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'is_public', 'cal_public');
1089
+	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'title', 'cal_title');
1090
+	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'description', 'cal_description');
1091
+	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'location', 'cal_location');
1092
+	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'reference', 'cal_reference');
1093 1093
 
1094 1094
 	$GLOBALS['setup_info']['calendar']['currentver'] = '1.0.0.001';
1095 1095
 	return $GLOBALS['setup_info']['calendar']['currentver'];
@@ -1099,13 +1099,13 @@  discard block
 block discarded – undo
1099 1099
 
1100 1100
 function calendar_upgrade1_0_0_001()
1101 1101
 {
1102
-	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','locale','hol_locale');
1103
-	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','name','hol_name');
1104
-	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','mday','hol_mday');
1105
-	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','month_num','hol_month_num');
1106
-	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','occurence','hol_occurence');
1107
-	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','dow','hol_dow');
1108
-	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','observance_rule','hol_observance_rule');
1102
+	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'locale', 'hol_locale');
1103
+	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'name', 'hol_name');
1104
+	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'mday', 'hol_mday');
1105
+	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'month_num', 'hol_month_num');
1106
+	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'occurence', 'hol_occurence');
1107
+	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'dow', 'hol_dow');
1108
+	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'observance_rule', 'hol_observance_rule');
1109 1109
 
1110 1110
 	$GLOBALS['setup_info']['calendar']['currentver'] = '1.0.0.002';
1111 1111
 	return $GLOBALS['setup_info']['calendar']['currentver'];
@@ -1115,8 +1115,8 @@  discard block
 block discarded – undo
1115 1115
 
1116 1116
 function calendar_upgrade1_0_0_002()
1117 1117
 {
1118
-	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_user','cal_login','cal_user_id');
1119
-	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_user','cal_type','cal_user_type');
1118
+	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_user', 'cal_login', 'cal_user_id');
1119
+	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_user', 'cal_type', 'cal_user_type');
1120 1120
 
1121 1121
 	$GLOBALS['setup_info']['calendar']['currentver'] = '1.0.0.003';
1122 1122
 	return $GLOBALS['setup_info']['calendar']['currentver'];
@@ -1126,7 +1126,7 @@  discard block
 block discarded – undo
1126 1126
 
1127 1127
 function calendar_upgrade1_0_0_003()
1128 1128
 {
1129
-	$GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_cal','cal_title',array(
1129
+	$GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_cal', 'cal_title', array(
1130 1130
 		'type' => 'varchar',
1131 1131
 		'precision' => '255',
1132 1132
 		'nullable' => False,
@@ -1141,15 +1141,15 @@  discard block
 block discarded – undo
1141 1141
 
1142 1142
 function calendar_upgrade1_0_0_004()
1143 1143
 {
1144
-	$GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_repeats',array(
1144
+	$GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_repeats', array(
1145 1145
 		'fd' => array(
1146
-			'cal_id' => array('type' => 'int','precision' => '8','nullable' => False),
1147
-			'recur_type' => array('type' => 'int','precision' => '8','nullable' => False),
1148
-			'recur_use_end' => array('type' => 'int','precision' => '8','default' => '0'),
1149
-			'recur_enddate' => array('type' => 'int','precision' => '8'),
1150
-			'recur_interval' => array('type' => 'int','precision' => '8','default' => '1'),
1151
-			'recur_data' => array('type' => 'int','precision' => '8','default' => '1'),
1152
-			'recur_exception' => array('type' => 'varchar','precision' => '255','default' => '')
1146
+			'cal_id' => array('type' => 'int', 'precision' => '8', 'nullable' => False),
1147
+			'recur_type' => array('type' => 'int', 'precision' => '8', 'nullable' => False),
1148
+			'recur_use_end' => array('type' => 'int', 'precision' => '8', 'default' => '0'),
1149
+			'recur_enddate' => array('type' => 'int', 'precision' => '8'),
1150
+			'recur_interval' => array('type' => 'int', 'precision' => '8', 'default' => '1'),
1151
+			'recur_data' => array('type' => 'int', 'precision' => '8', 'default' => '1'),
1152
+			'recur_exception' => array('type' => 'varchar', 'precision' => '255', 'default' => '')
1153 1153
 		),
1154 1154
 		'pk' => array('cal_id'),
1155 1155
 		'fk' => array(),
@@ -1166,19 +1166,19 @@  discard block
 block discarded – undo
1166 1166
 function calendar_upgrade1_0_0_005()
1167 1167
 {
1168 1168
 	// change prefix of all calendar tables to egw_
1169
-	foreach(array('cal_user','cal_repeats','cal_extra','cal_holidays','cal') as $name)
1169
+	foreach (array('cal_user', 'cal_repeats', 'cal_extra', 'cal_holidays', 'cal') as $name)
1170 1170
 	{
1171
-		$GLOBALS['egw_setup']->oProc->RenameTable('phpgw_'.$name,'egw_'.$name);
1171
+		$GLOBALS['egw_setup']->oProc->RenameTable('phpgw_'.$name, 'egw_'.$name);
1172 1172
 	}
1173 1173
 
1174 1174
 	// create new dates table, with content from the egw_cal table
1175
-	$GLOBALS['egw_setup']->oProc->CreateTable('egw_cal_dates',array(
1175
+	$GLOBALS['egw_setup']->oProc->CreateTable('egw_cal_dates', array(
1176 1176
 		'fd' => array(
1177
-			'cal_id' => array('type' => 'int','precision' => '4','nullable' => False),
1178
-			'cal_start' => array('type' => 'int','precision' => '8','nullable' => False),
1179
-			'cal_end' => array('type' => 'int','precision' => '8','nullable' => False)
1177
+			'cal_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False),
1178
+			'cal_start' => array('type' => 'int', 'precision' => '8', 'nullable' => False),
1179
+			'cal_end' => array('type' => 'int', 'precision' => '8', 'nullable' => False)
1180 1180
 		),
1181
-		'pk' => array('cal_id','cal_start'),
1181
+		'pk' => array('cal_id', 'cal_start'),
1182 1182
 		'fk' => array(),
1183 1183
 		'ix' => array(),
1184 1184
 		'uc' => array()
@@ -1186,49 +1186,49 @@  discard block
 block discarded – undo
1186 1186
 	$GLOBALS['egw_setup']->oProc->query("INSERT INTO egw_cal_dates SELECT cal_id,cal_starttime,cal_endtime FROM egw_cal");
1187 1187
 
1188 1188
 	// drop the fields transfered to the dates table
1189
-	$GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array(
1189
+	$GLOBALS['egw_setup']->oProc->DropColumn('egw_cal', array(
1190 1190
 		'fd' => array(
1191
-			'cal_id' => array('type' => 'auto','nullable' => False),
1192
-			'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False),
1193
-			'cal_owner' => array('type' => 'int','precision' => '8','nullable' => False),
1194
-			'cal_category' => array('type' => 'varchar','precision' => '30'),
1195
-			'cal_groups' => array('type' => 'varchar','precision' => '255'),
1196
-			'cal_modified' => array('type' => 'int','precision' => '8'),
1197
-			'cal_endtime' => array('type' => 'int','precision' => '8'),
1198
-			'cal_priority' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '2'),
1199
-			'cal_type' => array('type' => 'varchar','precision' => '10'),
1200
-			'cal_public' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '1'),
1201
-			'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'),
1191
+			'cal_id' => array('type' => 'auto', 'nullable' => False),
1192
+			'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False),
1193
+			'cal_owner' => array('type' => 'int', 'precision' => '8', 'nullable' => False),
1194
+			'cal_category' => array('type' => 'varchar', 'precision' => '30'),
1195
+			'cal_groups' => array('type' => 'varchar', 'precision' => '255'),
1196
+			'cal_modified' => array('type' => 'int', 'precision' => '8'),
1197
+			'cal_endtime' => array('type' => 'int', 'precision' => '8'),
1198
+			'cal_priority' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '2'),
1199
+			'cal_type' => array('type' => 'varchar', 'precision' => '10'),
1200
+			'cal_public' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '1'),
1201
+			'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'),
1202 1202
 			'cal_description' => array('type' => 'text'),
1203
-			'cal_location' => array('type' => 'varchar','precision' => '255'),
1204
-			'cal_reference' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0')
1203
+			'cal_location' => array('type' => 'varchar', 'precision' => '255'),
1204
+			'cal_reference' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0')
1205 1205
 		),
1206 1206
 		'pk' => array('cal_id'),
1207 1207
 		'fk' => array(),
1208 1208
 		'ix' => array(),
1209 1209
 		'uc' => array()
1210
-	),'cal_starttime');
1211
-	$GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array(
1210
+	), 'cal_starttime');
1211
+	$GLOBALS['egw_setup']->oProc->DropColumn('egw_cal', array(
1212 1212
 		'fd' => array(
1213
-			'cal_id' => array('type' => 'auto','nullable' => False),
1214
-			'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False),
1215
-			'cal_owner' => array('type' => 'int','precision' => '8','nullable' => False),
1216
-			'cal_category' => array('type' => 'varchar','precision' => '30'),
1217
-			'cal_groups' => array('type' => 'varchar','precision' => '255'),
1218
-			'cal_modified' => array('type' => 'int','precision' => '8'),
1219
-			'cal_priority' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '2'),
1220
-			'cal_type' => array('type' => 'varchar','precision' => '10'),
1221
-			'cal_public' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '1'),
1222
-			'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'),
1213
+			'cal_id' => array('type' => 'auto', 'nullable' => False),
1214
+			'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False),
1215
+			'cal_owner' => array('type' => 'int', 'precision' => '8', 'nullable' => False),
1216
+			'cal_category' => array('type' => 'varchar', 'precision' => '30'),
1217
+			'cal_groups' => array('type' => 'varchar', 'precision' => '255'),
1218
+			'cal_modified' => array('type' => 'int', 'precision' => '8'),
1219
+			'cal_priority' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '2'),
1220
+			'cal_type' => array('type' => 'varchar', 'precision' => '10'),
1221
+			'cal_public' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '1'),
1222
+			'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'),
1223 1223
 			'cal_description' => array('type' => 'text'),
1224
-			'cal_location' => array('type' => 'varchar','precision' => '255'),
1225
-			'cal_reference' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0')
1224
+			'cal_location' => array('type' => 'varchar', 'precision' => '255'),
1225
+			'cal_reference' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0')
1226 1226
 		),
1227 1227
 		'pk' => array('cal_id'),
1228 1228
 		'fk' => array(),
1229 1229
 		'ix' => array(),
1230 1230
 		'uc' => array()
1231
-	),'cal_endtime');
1231
+	), 'cal_endtime');
1232 1232
 
1233 1233
 	$GLOBALS['setup_info']['calendar']['currentver'] = '1.0.1.001';
1234 1234
 	return $GLOBALS['setup_info']['calendar']['currentver'];
@@ -1244,15 +1244,15 @@  discard block
 block discarded – undo
1244 1244
 		'precision' => '8',
1245 1245
 		'default' => '0'
1246 1246
 	));*/
1247
-	$GLOBALS['egw_setup']->oProc->RefreshTable('egw_cal_user',array(
1247
+	$GLOBALS['egw_setup']->oProc->RefreshTable('egw_cal_user', array(
1248 1248
 		'fd' => array(
1249
-			'cal_id' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'),
1250
-			'cal_recur_date' => array('type' => 'int','precision' => '8','default' => '0'),
1251
-			'cal_user_type' => array('type' => 'varchar','precision' => '1','nullable' => False,'default' => 'u'),
1252
-			'cal_user_id' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'),
1253
-			'cal_status' => array('type' => 'char','precision' => '1','default' => 'A')
1249
+			'cal_id' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'),
1250
+			'cal_recur_date' => array('type' => 'int', 'precision' => '8', 'default' => '0'),
1251
+			'cal_user_type' => array('type' => 'varchar', 'precision' => '1', 'nullable' => False, 'default' => 'u'),
1252
+			'cal_user_id' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'),
1253
+			'cal_status' => array('type' => 'char', 'precision' => '1', 'default' => 'A')
1254 1254
 		),
1255
-		'pk' => array('cal_id','cal_recur_date','cal_user_type','cal_user_id'),
1255
+		'pk' => array('cal_id', 'cal_recur_date', 'cal_user_type', 'cal_user_id'),
1256 1256
 		'fk' => array(),
1257 1257
 		'ix' => array(),
1258 1258
 		'uc' => array()
@@ -1266,50 +1266,50 @@  discard block
 block discarded – undo
1266 1266
 
1267 1267
 function calendar_upgrade1_0_1_002()
1268 1268
 {
1269
-	$GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array(
1269
+	$GLOBALS['egw_setup']->oProc->DropColumn('egw_cal', array(
1270 1270
 		'fd' => array(
1271
-			'cal_id' => array('type' => 'auto','nullable' => False),
1272
-			'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False),
1273
-			'cal_owner' => array('type' => 'int','precision' => '8','nullable' => False),
1274
-			'cal_category' => array('type' => 'varchar','precision' => '30'),
1275
-			'cal_groups' => array('type' => 'varchar','precision' => '255'),
1276
-			'cal_modified' => array('type' => 'int','precision' => '8'),
1277
-			'cal_priority' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '2'),
1278
-			'cal_public' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '1'),
1279
-			'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'),
1271
+			'cal_id' => array('type' => 'auto', 'nullable' => False),
1272
+			'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False),
1273
+			'cal_owner' => array('type' => 'int', 'precision' => '8', 'nullable' => False),
1274
+			'cal_category' => array('type' => 'varchar', 'precision' => '30'),
1275
+			'cal_groups' => array('type' => 'varchar', 'precision' => '255'),
1276
+			'cal_modified' => array('type' => 'int', 'precision' => '8'),
1277
+			'cal_priority' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '2'),
1278
+			'cal_public' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '1'),
1279
+			'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'),
1280 1280
 			'cal_description' => array('type' => 'text'),
1281
-			'cal_location' => array('type' => 'varchar','precision' => '255'),
1282
-			'cal_reference' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0')
1281
+			'cal_location' => array('type' => 'varchar', 'precision' => '255'),
1282
+			'cal_reference' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0')
1283 1283
 		),
1284 1284
 		'pk' => array('cal_id'),
1285 1285
 		'fk' => array(),
1286 1286
 		'ix' => array(),
1287 1287
 		'uc' => array()
1288
-	),'cal_type');
1289
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_owner',array(
1288
+	), 'cal_type');
1289
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_owner', array(
1290 1290
 		'type' => 'int',
1291 1291
 		'precision' => '4',
1292 1292
 		'nullable' => False
1293 1293
 	));
1294
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_priority',array(
1294
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_priority', array(
1295 1295
 		'type' => 'int',
1296 1296
 		'precision' => '2',
1297 1297
 		'nullable' => False,
1298 1298
 		'default' => '2'
1299 1299
 	));
1300
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_public',array(
1300
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_public', array(
1301 1301
 		'type' => 'int',
1302 1302
 		'precision' => '2',
1303 1303
 		'nullable' => False,
1304 1304
 		'default' => '1'
1305 1305
 	));
1306
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_reference',array(
1306
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_reference', array(
1307 1307
 		'type' => 'int',
1308 1308
 		'precision' => '4',
1309 1309
 		'nullable' => False,
1310 1310
 		'default' => '0'
1311 1311
 	));
1312
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_modifier',array(
1312
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_modifier', array(
1313 1313
 		'type' => 'int',
1314 1314
 		'precision' => '4'
1315 1315
 	));
@@ -1322,36 +1322,36 @@  discard block
 block discarded – undo
1322 1322
 
1323 1323
 function calendar_upgrade1_0_1_003()
1324 1324
 {
1325
-	$GLOBALS['egw_setup']->oProc->DropColumn('egw_cal_repeats',array(
1325
+	$GLOBALS['egw_setup']->oProc->DropColumn('egw_cal_repeats', array(
1326 1326
 		'fd' => array(
1327
-			'cal_id' => array('type' => 'int','precision' => '8','nullable' => False),
1328
-			'recur_type' => array('type' => 'int','precision' => '8','nullable' => False),
1329
-			'recur_enddate' => array('type' => 'int','precision' => '8'),
1330
-			'recur_interval' => array('type' => 'int','precision' => '8','default' => '1'),
1331
-			'recur_data' => array('type' => 'int','precision' => '8','default' => '1'),
1332
-			'recur_exception' => array('type' => 'varchar','precision' => '255','default' => '')
1327
+			'cal_id' => array('type' => 'int', 'precision' => '8', 'nullable' => False),
1328
+			'recur_type' => array('type' => 'int', 'precision' => '8', 'nullable' => False),
1329
+			'recur_enddate' => array('type' => 'int', 'precision' => '8'),
1330
+			'recur_interval' => array('type' => 'int', 'precision' => '8', 'default' => '1'),
1331
+			'recur_data' => array('type' => 'int', 'precision' => '8', 'default' => '1'),
1332
+			'recur_exception' => array('type' => 'varchar', 'precision' => '255', 'default' => '')
1333 1333
 		),
1334 1334
 		'pk' => array('cal_id'),
1335 1335
 		'fk' => array(),
1336 1336
 		'ix' => array(),
1337 1337
 		'uc' => array()
1338
-	),'recur_use_end');
1339
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats','cal_id',array(
1338
+	), 'recur_use_end');
1339
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats', 'cal_id', array(
1340 1340
 		'type' => 'int',
1341 1341
 		'precision' => '4',
1342 1342
 		'nullable' => False
1343 1343
 	));
1344
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats','recur_type',array(
1344
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats', 'recur_type', array(
1345 1345
 		'type' => 'int',
1346 1346
 		'precision' => '2',
1347 1347
 		'nullable' => False
1348 1348
 	));
1349
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats','recur_interval',array(
1349
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats', 'recur_interval', array(
1350 1350
 		'type' => 'int',
1351 1351
 		'precision' => '2',
1352 1352
 		'default' => '1'
1353 1353
 	));
1354
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats','recur_data',array(
1354
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats', 'recur_data', array(
1355 1355
 		'type' => 'int',
1356 1356
 		'precision' => '2',
1357 1357
 		'default' => '1'
@@ -1365,13 +1365,13 @@  discard block
 block discarded – undo
1365 1365
 
1366 1366
 function calendar_upgrade1_0_1_004()
1367 1367
 {
1368
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_id',array(
1368
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_id', array(
1369 1369
 		'type' => 'int',
1370 1370
 		'precision' => '4',
1371 1371
 		'nullable' => False,
1372 1372
 		'default' => '0'
1373 1373
 	));
1374
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_user_id',array(
1374
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_user_id', array(
1375 1375
 		'type' => 'int',
1376 1376
 		'precision' => '4',
1377 1377
 		'nullable' => False,
@@ -1386,7 +1386,7 @@  discard block
 block discarded – undo
1386 1386
 
1387 1387
 function calendar_upgrade1_0_1_005()
1388 1388
 {
1389
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user','cal_quantity',array(
1389
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user', 'cal_quantity', array(
1390 1390
 		'type' => 'int',
1391 1391
 		'precision' => '4',
1392 1392
 		'default' => '1'
@@ -1400,7 +1400,7 @@  discard block
 block discarded – undo
1400 1400
 
1401 1401
 function calendar_upgrade1_0_1_006()
1402 1402
 {
1403
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_non_blocking',array(
1403
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_non_blocking', array(
1404 1404
 		'type' => 'int',
1405 1405
 		'precision' => '2',
1406 1406
 		'default' => '0'
@@ -1414,9 +1414,9 @@  discard block
 block discarded – undo
1414 1414
 
1415 1415
 function calendar_upgrade1_0_1_007()
1416 1416
 {
1417
-	$GLOBALS['egw_setup']->db->update('egw_cal_repeats',array('recur_exception' => null),array('recur_exception' => ''),__LINE__,__FILE__,'calendar');
1417
+	$GLOBALS['egw_setup']->db->update('egw_cal_repeats', array('recur_exception' => null), array('recur_exception' => ''), __LINE__, __FILE__, 'calendar');
1418 1418
 
1419
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats','recur_exception',array(
1419
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats', 'recur_exception', array(
1420 1420
 		'type' => 'text'
1421 1421
 	));
1422 1422
 
@@ -1433,11 +1433,11 @@  discard block
 block discarded – undo
1433 1433
 	{
1434 1434
 		$customfields = array();
1435 1435
 		$order = 0;
1436
-		foreach($config_data['fields'] as $name => $data)
1436
+		foreach ($config_data['fields'] as $name => $data)
1437 1437
 		{
1438 1438
 			if ($name{0} == '#' && !$data['disabled'])	// real not-disabled custom field
1439 1439
 			{
1440
-				$customfields[substr($name,1)] = array(
1440
+				$customfields[substr($name, 1)] = array(
1441 1441
 					'type'  => 'text',
1442 1442
 					'len'   => $data['length'].($data['shown'] ? ','.$data['shown'] : ''),
1443 1443
 					'label' => $data['name'],
@@ -1460,38 +1460,38 @@  discard block
 block discarded – undo
1460 1460
 function calendar_upgrade1_0_1_009()
1461 1461
 {
1462 1462
 	$db2 = clone($GLOBALS['egw_setup']->db);
1463
-	$GLOBALS['egw_setup']->db->select('egw_cal','DISTINCT egw_cal.cal_id,cal_groups,cal_recur_date',"cal_groups != ''",__LINE__,__FILE__,
1464
-		False,'','calendar',0,',egw_cal_user WHERE egw_cal.cal_id=egw_cal_user.cal_id');
1465
-	while(($row = $GLOBALS['egw_setup']->db->row(true)))
1463
+	$GLOBALS['egw_setup']->db->select('egw_cal', 'DISTINCT egw_cal.cal_id,cal_groups,cal_recur_date', "cal_groups != ''", __LINE__, __FILE__,
1464
+		False, '', 'calendar', 0, ',egw_cal_user WHERE egw_cal.cal_id=egw_cal_user.cal_id');
1465
+	while (($row = $GLOBALS['egw_setup']->db->row(true)))
1466 1466
 	{
1467 1467
 		$row['cal_user_type'] = 'u';
1468
-		foreach(explode(',',$row['cal_groups']) as $group)
1468
+		foreach (explode(',', $row['cal_groups']) as $group)
1469 1469
 		{
1470 1470
 			$row['cal_user_id'] = $group;
1471
-			$db2->insert('egw_cal_user',array('cal_status' => 'U'),$row,__LINE__,__FILE__,'calendar');
1471
+			$db2->insert('egw_cal_user', array('cal_status' => 'U'), $row, __LINE__, __FILE__, 'calendar');
1472 1472
 		}
1473 1473
 	}
1474
-	$GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array(
1474
+	$GLOBALS['egw_setup']->oProc->DropColumn('egw_cal', array(
1475 1475
 		'fd' => array(
1476
-			'cal_id' => array('type' => 'auto','nullable' => False),
1477
-			'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False),
1478
-			'cal_owner' => array('type' => 'int','precision' => '4','nullable' => False),
1479
-			'cal_category' => array('type' => 'varchar','precision' => '30'),
1480
-			'cal_modified' => array('type' => 'int','precision' => '8'),
1481
-			'cal_priority' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '2'),
1482
-			'cal_public' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '1'),
1483
-			'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'),
1476
+			'cal_id' => array('type' => 'auto', 'nullable' => False),
1477
+			'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False),
1478
+			'cal_owner' => array('type' => 'int', 'precision' => '4', 'nullable' => False),
1479
+			'cal_category' => array('type' => 'varchar', 'precision' => '30'),
1480
+			'cal_modified' => array('type' => 'int', 'precision' => '8'),
1481
+			'cal_priority' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '2'),
1482
+			'cal_public' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '1'),
1483
+			'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'),
1484 1484
 			'cal_description' => array('type' => 'text'),
1485
-			'cal_location' => array('type' => 'varchar','precision' => '255'),
1486
-			'cal_reference' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'),
1487
-			'cal_modifier' => array('type' => 'int','precision' => '4'),
1488
-			'cal_non_blocking' => array('type' => 'int','precision' => '2','default' => '0')
1485
+			'cal_location' => array('type' => 'varchar', 'precision' => '255'),
1486
+			'cal_reference' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'),
1487
+			'cal_modifier' => array('type' => 'int', 'precision' => '4'),
1488
+			'cal_non_blocking' => array('type' => 'int', 'precision' => '2', 'default' => '0')
1489 1489
 		),
1490 1490
 		'pk' => array('cal_id'),
1491 1491
 		'fk' => array(),
1492 1492
 		'ix' => array(),
1493 1493
 		'uc' => array()
1494
-	),'cal_groups');
1494
+	), 'cal_groups');
1495 1495
 
1496 1496
 	return $GLOBALS['setup_info']['calendar']['currentver'] = '1.2';
1497 1497
 }
@@ -1501,7 +1501,7 @@  discard block
 block discarded – undo
1501 1501
 function calendar_upgrade1_2()
1502 1502
 {
1503 1503
 	// get old alarms (saved before 1.2) working again
1504
-	$GLOBALS['egw_setup']->db->query("UPDATE egw_async SET async_method ='calendar.bocalupdate.send_alarm' WHERE async_method ='calendar.bocalendar.send_alarm'",__LINE__,__FILE__);
1504
+	$GLOBALS['egw_setup']->db->query("UPDATE egw_async SET async_method ='calendar.bocalupdate.send_alarm' WHERE async_method ='calendar.bocalendar.send_alarm'", __LINE__, __FILE__);
1505 1505
 
1506 1506
 	return $GLOBALS['setup_info']['calendar']['currentver'] = '1.2.001';
1507 1507
 }
@@ -1509,7 +1509,7 @@  discard block
 block discarded – undo
1509 1509
 
1510 1510
 function calendar_upgrade1_2_001()
1511 1511
 {
1512
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_special',array(
1512
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_special', array(
1513 1513
 		'type' => 'int',
1514 1514
 		'precision' => '2',
1515 1515
 		'default' => '0'
@@ -1527,7 +1527,7 @@  discard block
 block discarded – undo
1527 1527
 
1528 1528
 function calendar_upgrade1_4()
1529 1529
 {
1530
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_etag',array(
1530
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_etag', array(
1531 1531
 		'type' => 'int',
1532 1532
 		'precision' => '4',
1533 1533
 		'default' => '0'
@@ -1539,59 +1539,59 @@  discard block
 block discarded – undo
1539 1539
 
1540 1540
 function calendar_upgrade1_5()
1541 1541
 {
1542
-	$GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array(
1542
+	$GLOBALS['egw_setup']->oProc->DropColumn('egw_cal', array(
1543 1543
 		'fd' => array(
1544
-			'cal_id' => array('type' => 'auto','nullable' => False),
1545
-			'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False),
1546
-			'cal_owner' => array('type' => 'int','precision' => '4','nullable' => False),
1547
-			'cal_category' => array('type' => 'varchar','precision' => '30'),
1548
-			'cal_modified' => array('type' => 'int','precision' => '8'),
1549
-			'cal_priority' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '2'),
1550
-			'cal_public' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '1'),
1551
-			'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'),
1544
+			'cal_id' => array('type' => 'auto', 'nullable' => False),
1545
+			'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False),
1546
+			'cal_owner' => array('type' => 'int', 'precision' => '4', 'nullable' => False),
1547
+			'cal_category' => array('type' => 'varchar', 'precision' => '30'),
1548
+			'cal_modified' => array('type' => 'int', 'precision' => '8'),
1549
+			'cal_priority' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '2'),
1550
+			'cal_public' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '1'),
1551
+			'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'),
1552 1552
 			'cal_description' => array('type' => 'text'),
1553
-			'cal_location' => array('type' => 'varchar','precision' => '255'),
1554
-			'cal_reference' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'),
1555
-			'cal_modifier' => array('type' => 'int','precision' => '4'),
1556
-			'cal_non_blocking' => array('type' => 'int','precision' => '2','default' => '0'),
1557
-			'cal_special' => array('type' => 'int','precision' => '2','default' => '0'),
1558
-			'cal_etag' => array('type' => 'int','precision' => '4'),
1559
-			'cal_edit_time' => array('type' => 'int','precision' => '8')
1553
+			'cal_location' => array('type' => 'varchar', 'precision' => '255'),
1554
+			'cal_reference' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'),
1555
+			'cal_modifier' => array('type' => 'int', 'precision' => '4'),
1556
+			'cal_non_blocking' => array('type' => 'int', 'precision' => '2', 'default' => '0'),
1557
+			'cal_special' => array('type' => 'int', 'precision' => '2', 'default' => '0'),
1558
+			'cal_etag' => array('type' => 'int', 'precision' => '4'),
1559
+			'cal_edit_time' => array('type' => 'int', 'precision' => '8')
1560 1560
 		),
1561 1561
 		'pk' => array('cal_id'),
1562 1562
 		'fk' => array(),
1563 1563
 		'ix' => array(),
1564 1564
 		'uc' => array()
1565
-	),'cal_edit_user');
1566
-	$GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array(
1565
+	), 'cal_edit_user');
1566
+	$GLOBALS['egw_setup']->oProc->DropColumn('egw_cal', array(
1567 1567
 		'fd' => array(
1568
-			'cal_id' => array('type' => 'auto','nullable' => False),
1569
-			'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False),
1570
-			'cal_owner' => array('type' => 'int','precision' => '4','nullable' => False),
1571
-			'cal_category' => array('type' => 'varchar','precision' => '30'),
1572
-			'cal_modified' => array('type' => 'int','precision' => '8'),
1573
-			'cal_priority' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '2'),
1574
-			'cal_public' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '1'),
1575
-			'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'),
1568
+			'cal_id' => array('type' => 'auto', 'nullable' => False),
1569
+			'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False),
1570
+			'cal_owner' => array('type' => 'int', 'precision' => '4', 'nullable' => False),
1571
+			'cal_category' => array('type' => 'varchar', 'precision' => '30'),
1572
+			'cal_modified' => array('type' => 'int', 'precision' => '8'),
1573
+			'cal_priority' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '2'),
1574
+			'cal_public' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '1'),
1575
+			'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'),
1576 1576
 			'cal_description' => array('type' => 'text'),
1577
-			'cal_location' => array('type' => 'varchar','precision' => '255'),
1578
-			'cal_reference' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'),
1579
-			'cal_modifier' => array('type' => 'int','precision' => '4'),
1580
-			'cal_non_blocking' => array('type' => 'int','precision' => '2','default' => '0'),
1581
-			'cal_special' => array('type' => 'int','precision' => '2','default' => '0'),
1582
-			'cal_etag' => array('type' => 'int','precision' => '4')
1577
+			'cal_location' => array('type' => 'varchar', 'precision' => '255'),
1578
+			'cal_reference' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'),
1579
+			'cal_modifier' => array('type' => 'int', 'precision' => '4'),
1580
+			'cal_non_blocking' => array('type' => 'int', 'precision' => '2', 'default' => '0'),
1581
+			'cal_special' => array('type' => 'int', 'precision' => '2', 'default' => '0'),
1582
+			'cal_etag' => array('type' => 'int', 'precision' => '4')
1583 1583
 		),
1584 1584
 		'pk' => array('cal_id'),
1585 1585
 		'fk' => array(),
1586 1586
 		'ix' => array(),
1587 1587
 		'uc' => array()
1588
-	),'cal_edit_time');
1589
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_etag',array(
1588
+	), 'cal_edit_time');
1589
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_etag', array(
1590 1590
 		'type' => 'int',
1591 1591
 		'precision' => '4',
1592 1592
 		'default' => '0'
1593 1593
 	));
1594
-	$GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_etag=0 WHERE cal_etag IS NULL',__LINE__,__FILE__);
1594
+	$GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_etag=0 WHERE cal_etag IS NULL', __LINE__, __FILE__);
1595 1595
 
1596 1596
 	return $GLOBALS['setup_info']['calendar']['currentver'] = '1.5.001';
1597 1597
 }
@@ -1599,12 +1599,12 @@  discard block
 block discarded – undo
1599 1599
 
1600 1600
 function calendar_upgrade1_5_001()
1601 1601
 {
1602
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_id',array(
1602
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_id', array(
1603 1603
 		'type' => 'int',
1604 1604
 		'precision' => '4',
1605 1605
 		'nullable' => False
1606 1606
 	));
1607
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_user_id',array(
1607
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_user_id', array(
1608 1608
 		'type' => 'varchar',
1609 1609
 		'precision' => '128',
1610 1610
 		'nullable' => False
@@ -1618,12 +1618,12 @@  discard block
 block discarded – undo
1618 1618
 {
1619 1619
 	// update the alarm methods
1620 1620
 	$async = new Api\Asyncservice();
1621
-	foreach((array)$async->read('cal:%') as $job)
1621
+	foreach ((array)$async->read('cal:%') as $job)
1622 1622
 	{
1623 1623
 		if ($job['method'] == 'calendar.bocalupdate.send_alarm')
1624 1624
 		{
1625 1625
 			$job['method'] = 'calendar.calendar_boupdate.send_alarm';
1626
-			$async->write($job,true);
1626
+			$async->write($job, true);
1627 1627
 		}
1628 1628
 	}
1629 1629
 	return $GLOBALS['setup_info']['calendar']['currentver'] = '1.6';
@@ -1640,48 +1640,48 @@  discard block
 block discarded – undo
1640 1640
 {
1641 1641
 	// Set UID of series exception to UID of series master
1642 1642
 	// update cal_etag, cal_modified and cal_modifier to distribute changes on GroupDAV devices
1643
-	foreach($GLOBALS['egw_setup']->db->query('
1643
+	foreach ($GLOBALS['egw_setup']->db->query('
1644 1644
 		SELECT cal_ex.cal_id,cal_ex.cal_uid AS cal_uid_ex,cal_master.cal_uid AS cal_uid_master
1645 1645
 		FROM egw_cal cal_ex
1646 1646
 		JOIN egw_cal cal_master ON cal_ex.cal_reference=cal_master.cal_id
1647
-		WHERE cal_ex.cal_reference != 0',__LINE__,__FILE__) as $row)
1647
+		WHERE cal_ex.cal_reference != 0',__LINE__, __FILE__) as $row)
1648 1648
 	{
1649 1649
 		if (strlen($row['cal_uid_master']) > 0 && $row['cal_uid_ex'] != $row['cal_uid_master'])
1650 1650
 		{
1651 1651
 			$GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_uid=\''.$row['cal_uid_master'].
1652 1652
 				'\',cal_etag=cal_etag+1,cal_modified='.time().
1653
-				',cal_modifier=NULL WHERE cal_id='.(int)$row['cal_id'],__LINE__,__FILE__);
1653
+				',cal_modifier=NULL WHERE cal_id='.(int)$row['cal_id'], __LINE__, __FILE__);
1654 1654
 		}
1655 1655
 	}
1656 1656
 
1657 1657
 	// Search series exception for nearest exception in series master and add that RECURRENCE-ID
1658 1658
 	// as cal_reference (for 1.6.003 and move it to new field cal_recurrence in 1.7.001)
1659 1659
 	$diff = null;
1660
-	foreach($GLOBALS['egw_setup']->db->query('SELECT egw_cal.cal_id,cal_start,recur_exception FROM egw_cal
1660
+	foreach ($GLOBALS['egw_setup']->db->query('SELECT egw_cal.cal_id,cal_start,recur_exception FROM egw_cal
1661 1661
 		JOIN egw_cal_dates ON egw_cal.cal_id=egw_cal_dates.cal_id
1662 1662
 		JOIN egw_cal_repeats ON cal_reference=egw_cal_repeats.cal_id
1663
-		WHERE cal_reference != 0',__LINE__,__FILE__) as $row)
1663
+		WHERE cal_reference != 0',__LINE__, __FILE__) as $row)
1664 1664
 	{
1665 1665
 		$recurrence = null;
1666
-		foreach(explode(',',$row['recur_exception']) as $ts)
1666
+		foreach (explode(',', $row['recur_exception']) as $ts)
1667 1667
 		{
1668
-			if (is_null($recurrence) || abs($ts-$row['cal_start']) < $diff)
1668
+			if (is_null($recurrence) || abs($ts - $row['cal_start']) < $diff)
1669 1669
 			{
1670 1670
 				$recurrence = $ts;
1671
-				$diff = abs($ts-$row['cal_start']);
1671
+				$diff = abs($ts - $row['cal_start']);
1672 1672
 			}
1673 1673
 		}
1674 1674
 		if ($recurrence)
1675 1675
 		{
1676 1676
 			$GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_reference='.(int)$recurrence.
1677
-				' WHERE cal_id='.(int)$row['cal_id'],__LINE__,__FILE__);
1677
+				' WHERE cal_id='.(int)$row['cal_id'], __LINE__, __FILE__);
1678 1678
 		}
1679 1679
 		else
1680 1680
 		{
1681 1681
 			// if we cannot determine the RECURRENCE-ID use cal_start
1682 1682
 			// because RECURRENCE-ID must be present
1683 1683
 			$GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_reference='.(int)$row['cal_start'].
1684
-				' WHERE cal_id='.(int)$row['cal_id'],__LINE__,__FILE__);
1684
+				' WHERE cal_id='.(int)$row['cal_id'], __LINE__, __FILE__);
1685 1685
 		}
1686 1686
 	}
1687 1687
 
@@ -1696,33 +1696,33 @@  discard block
 block discarded – undo
1696 1696
  */
1697 1697
 function calendar_upgrade1_6_003()
1698 1698
 {
1699
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_creator',array(
1699
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_creator', array(
1700 1700
 		'type' => 'int',
1701 1701
 		'precision' => '4',
1702 1702
 		'comment' => 'creating user'
1703 1703
 	));
1704
-	$GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_creator=cal_owner',__LINE__,__FILE__);
1705
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_creator',array(
1704
+	$GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_creator=cal_owner', __LINE__, __FILE__);
1705
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_creator', array(
1706 1706
 		'type' => 'int',
1707 1707
 		'precision' => '4',
1708 1708
 		'nullable' => False,
1709 1709
 		'comment' => 'creating user'
1710 1710
 	));
1711 1711
 
1712
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_created',array(
1712
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_created', array(
1713 1713
 		'type' => 'int',
1714 1714
 		'precision' => '8',
1715 1715
 		'comment' => 'creation time of event'
1716 1716
 	));
1717
-	$GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_created=cal_modified',__LINE__,__FILE__);
1718
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_created',array(
1717
+	$GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_created=cal_modified', __LINE__, __FILE__);
1718
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_created', array(
1719 1719
 		'type' => 'int',
1720 1720
 		'precision' => '8',
1721 1721
 		'nullable' => False,
1722 1722
 		'comment' => 'creation time of event'
1723 1723
 	));
1724 1724
 
1725
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_recurrence',array(
1725
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_recurrence', array(
1726 1726
 		'type' => 'int',
1727 1727
 		'precision' => '8',
1728 1728
 		'nullable' => False,
@@ -1733,14 +1733,14 @@  discard block
 block discarded – undo
1733 1733
 	// move RECURRENCE-ID from temporarily (1.6.003)
1734 1734
 	// used field cal_reference to new field cal_recurrence
1735 1735
 	// and restore cal_reference field of series exceptions with id of the series master
1736
-	foreach($GLOBALS['egw_setup']->db->query('
1736
+	foreach ($GLOBALS['egw_setup']->db->query('
1737 1737
 		SELECT cal_ex.cal_id AS cal_id_ex,cal_master.cal_id AS cal_id_master,
1738 1738
 		cal_ex.cal_reference AS cal_reference_ex,cal_ex.cal_uid AS cal_uid_ex,
1739 1739
 		cal_master.cal_uid AS cal_uid_master
1740 1740
 		FROM egw_cal cal_ex
1741 1741
 		JOIN egw_cal cal_master
1742 1742
 		ON cal_ex.cal_uid=cal_master.cal_uid AND cal_master.cal_reference = 0 AND cal_ex.cal_owner = cal_master.cal_owner
1743
-		WHERE cal_ex.cal_reference !=0 AND cal_master.cal_id IS NOT NULL',__LINE__,__FILE__) as $row)
1743
+		WHERE cal_ex.cal_reference !=0 AND cal_master.cal_id IS NOT NULL',__LINE__, __FILE__) as $row)
1744 1744
 	{
1745 1745
 		$GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_recurrence='.(int)$row['cal_reference_ex'].
1746 1746
 			', cal_reference='.(int)$row['cal_id_master'].
@@ -1757,7 +1757,7 @@  discard block
 block discarded – undo
1757 1757
  */
1758 1758
 function calendar_upgrade1_7_001()
1759 1759
 {
1760
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user','cal_role',array(
1760
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user', 'cal_role', array(
1761 1761
 		'type' => 'varchar',
1762 1762
 		'precision' => '64',
1763 1763
 		'default' => 'REQ-PARTICIPANT'
@@ -1773,14 +1773,14 @@  discard block
 block discarded – undo
1773 1773
  */
1774 1774
 function calendar_upgrade1_7_002()
1775 1775
 {
1776
-	$GLOBALS['egw_setup']->oProc->CreateTable('egw_cal_timezones',array(
1776
+	$GLOBALS['egw_setup']->oProc->CreateTable('egw_cal_timezones', array(
1777 1777
 		'fd' => array(
1778
-			'tz_id' => array('type' => 'auto','nullable' => False),
1779
-			'tz_tzid' => array('type' => 'varchar','precision' => '128','nullable' => False),
1780
-			'tz_alias' => array('type' => 'int','precision' => '4','comment' => 'tz_id for data'),
1781
-			'tz_latitude' => array('type' => 'int','precision' => '4'),
1782
-			'tz_longitude' => array('type' => 'int','precision' => '4'),
1783
-			'tz_component' => array('type' => 'text','comment' => 'iCal VTIMEZONE component')
1778
+			'tz_id' => array('type' => 'auto', 'nullable' => False),
1779
+			'tz_tzid' => array('type' => 'varchar', 'precision' => '128', 'nullable' => False),
1780
+			'tz_alias' => array('type' => 'int', 'precision' => '4', 'comment' => 'tz_id for data'),
1781
+			'tz_latitude' => array('type' => 'int', 'precision' => '4'),
1782
+			'tz_longitude' => array('type' => 'int', 'precision' => '4'),
1783
+			'tz_component' => array('type' => 'text', 'comment' => 'iCal VTIMEZONE component')
1784 1784
 		),
1785 1785
 		'pk' => array('tz_id'),
1786 1786
 		'fk' => array(),
@@ -1800,38 +1800,38 @@  discard block
 block discarded – undo
1800 1800
  */
1801 1801
 function calendar_upgrade1_7_003()
1802 1802
 {
1803
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_user_type',array(
1803
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_user_type', array(
1804 1804
 		'type' => 'varchar',
1805 1805
 		'precision' => '1',
1806 1806
 		'nullable' => False,
1807 1807
 		'default' => 'u',
1808 1808
 		'comment' => 'u=user, g=group, c=contact, r=resource, e=email'
1809 1809
 	));
1810
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_user_id',array(
1810
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_user_id', array(
1811 1811
 		'type' => 'varchar',
1812 1812
 		'precision' => '128',
1813 1813
 		'nullable' => False,
1814 1814
 		'comment' => 'id or email-address for type=e'
1815 1815
 	));
1816
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_status',array(
1816
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_status', array(
1817 1817
 		'type' => 'char',
1818 1818
 		'precision' => '1',
1819 1819
 		'default' => 'A',
1820 1820
 		'comment' => 'U=unknown, A=accepted, R=rejected, T=tentative'
1821 1821
 	));
1822
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_quantity',array(
1822
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_quantity', array(
1823 1823
 		'type' => 'int',
1824 1824
 		'precision' => '4',
1825 1825
 		'default' => '1',
1826 1826
 		'comment' => 'only for certain types (eg. resources)'
1827 1827
 	));
1828
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_role',array(
1828
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_role', array(
1829 1829
 		'type' => 'varchar',
1830 1830
 		'precision' => '64',
1831 1831
 		'default' => 'REQ-PARTICIPANT',
1832 1832
 		'comment' => 'CHAIR, REQ-PARTICIPANT, OPT-PARTICIPANT, NON-PARTICIPANT, X-CAT-$cat_id'
1833 1833
 	));
1834
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user','cal_user_modified',array(
1834
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user', 'cal_user_modified', array(
1835 1835
 		'type' => 'timestamp',
1836 1836
 		'default' => 'current_timestamp',
1837 1837
 		'comment' => 'automatic timestamp of last update'
@@ -1847,19 +1847,19 @@  discard block
 block discarded – undo
1847 1847
  */
1848 1848
 function calendar_upgrade1_7_004()
1849 1849
 {
1850
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_dates','cal_start',array(
1850
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_dates', 'cal_start', array(
1851 1851
 		'type' => 'int',
1852 1852
 		'precision' => '8',
1853 1853
 		'nullable' => False,
1854 1854
 		'comment' => 'starttime in server time'
1855 1855
 	));
1856
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_dates','cal_end',array(
1856
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_dates', 'cal_end', array(
1857 1857
 		'type' => 'int',
1858 1858
 		'precision' => '8',
1859 1859
 		'nullable' => False,
1860 1860
 		'comment' => 'endtime in server time'
1861 1861
 	));
1862
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','tz_id',array(
1862
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'tz_id', array(
1863 1863
 		'type' => 'int',
1864 1864
 		'precision' => '4',
1865 1865
 		'comment' => 'key into egw_cal_timezones'
@@ -1868,7 +1868,7 @@  discard block
 block discarded – undo
1868 1868
 	// set id of server timezone for existing events, as that's the timezone their recurrences are using
1869 1869
 	if (($tzid = date_default_timezone_get()) && ($tz_id = calendar_timezones::tz2id($tzid)))
1870 1870
 	{
1871
-		$GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET tz_id='.(int)$tz_id,__LINE__,__FILE__);
1871
+		$GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET tz_id='.(int)$tz_id, __LINE__, __FILE__);
1872 1872
 	}
1873 1873
 	return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.005';
1874 1874
 }
@@ -1895,22 +1895,22 @@  discard block
 block discarded – undo
1895 1895
  */
1896 1896
 function calendar_upgrade1_7_006()
1897 1897
 {
1898
-	foreach($GLOBALS['egw_setup']->db->query('SELECT * FROM egw_cal_dates
1899
-		WHERE (cal_end-cal_start)%86400=86340',__LINE__,__FILE__) as $row)
1898
+	foreach ($GLOBALS['egw_setup']->db->query('SELECT * FROM egw_cal_dates
1899
+		WHERE (cal_end-cal_start)%86400=86340',__LINE__, __FILE__) as $row)
1900 1900
 	{
1901 1901
 		$GLOBALS['egw_setup']->db->query('UPDATE egw_cal_dates SET cal_end=cal_end+59
1902
-			WHERE cal_id='.(int)$row['cal_id'].' AND cal_start='.(int)$row['cal_start'],__LINE__,__FILE__);
1902
+			WHERE cal_id='.(int)$row['cal_id'].' AND cal_start='.(int)$row['cal_start'], __LINE__, __FILE__);
1903 1903
 	}
1904 1904
 
1905
-	foreach($GLOBALS['egw_setup']->db->query('SELECT * FROM egw_cal_dates
1906
-		WHERE cal_end-cal_start>0 AND (cal_end-cal_start)%86400=0',__LINE__,__FILE__) as $row)
1905
+	foreach ($GLOBALS['egw_setup']->db->query('SELECT * FROM egw_cal_dates
1906
+		WHERE cal_end-cal_start>0 AND (cal_end-cal_start)%86400=0',__LINE__, __FILE__) as $row)
1907 1907
 	{
1908 1908
 		$GLOBALS['egw_setup']->db->query('UPDATE egw_cal_dates SET cal_end=cal_end-1
1909
-			WHERE cal_id='.(int)$row['cal_id'].' AND cal_start='.(int)$row['cal_start'],__LINE__,__FILE__);
1909
+			WHERE cal_id='.(int)$row['cal_id'].' AND cal_start='.(int)$row['cal_start'], __LINE__, __FILE__);
1910 1910
 	}
1911 1911
 
1912 1912
     $GLOBALS['egw_setup']->db->query('UPDATE egw_cal_repeats SET recur_interval=1
1913
-			WHERE recur_interval=0',__LINE__,__FILE__);
1913
+			WHERE recur_interval=0',__LINE__, __FILE__);
1914 1914
 
1915 1915
 	return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.007';
1916 1916
 }
@@ -1926,17 +1926,17 @@  discard block
 block discarded – undo
1926 1926
 {
1927 1927
 	// Set UID of series exception to UID of series master
1928 1928
 	// update cal_etag,cal_modified and cal_modifier to distribute changes on GroupDAV devices
1929
-	foreach($GLOBALS['egw_setup']->db->query('
1929
+	foreach ($GLOBALS['egw_setup']->db->query('
1930 1930
 		SELECT cal_ex.cal_id,cal_ex.cal_uid AS cal_uid_ex,cal_master.cal_uid AS cal_uid_master
1931 1931
 		FROM egw_cal cal_ex
1932 1932
 		JOIN egw_cal cal_master ON cal_ex.cal_reference=cal_master.cal_id
1933
-		WHERE cal_ex.cal_reference != 0',__LINE__,__FILE__) as $row)
1933
+		WHERE cal_ex.cal_reference != 0',__LINE__, __FILE__) as $row)
1934 1934
 	{
1935 1935
 		if (strlen($row['cal_uid_master']) > 0 && $row['cal_uid_ex'] != $row['cal_uid_master'])
1936 1936
 		{
1937 1937
 			$GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_uid=\''.$row['cal_uid_master'].
1938 1938
 				'\',cal_etag=cal_etag+1,cal_modified='.time().
1939
-				',cal_modifier=NULL WHERE cal_id='.(int)$row['cal_id'],__LINE__,__FILE__);
1939
+				',cal_modifier=NULL WHERE cal_id='.(int)$row['cal_id'], __LINE__, __FILE__);
1940 1940
 		}
1941 1941
 	}
1942 1942
 	return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.008';
@@ -1949,7 +1949,7 @@  discard block
 block discarded – undo
1949 1949
  */
1950 1950
 function calendar_upgrade1_7_008()
1951 1951
 {
1952
-	$GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal_user',array('cal_user_type','cal_user_id'));
1952
+	$GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal_user', array('cal_user_type', 'cal_user_id'));
1953 1953
 
1954 1954
 	return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.009';
1955 1955
 }
@@ -1961,22 +1961,22 @@  discard block
 block discarded – undo
1961 1961
  */
1962 1962
 function calendar_upgrade1_7_009()
1963 1963
 {
1964
-	$GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal','cal_uid');
1965
-	$GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal','cal_owner');
1964
+	$GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal', 'cal_uid');
1965
+	$GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal', 'cal_owner');
1966 1966
 
1967 1967
 	return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.010';
1968 1968
 }
1969 1969
 
1970 1970
 function calendar_upgrade1_7_010()
1971 1971
 {
1972
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_deleted',array(
1972
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_deleted', array(
1973 1973
 		'type' => 'bool',
1974 1974
 		'nullable' => False,
1975 1975
 		'default' => '0',
1976 1976
 		'comment' => '1 if the event has been deleted, but you want to keep it around'
1977 1977
 	));
1978 1978
 
1979
-	return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.001';	// was 1.7.011
1979
+	return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.001'; // was 1.7.011
1980 1980
 }
1981 1981
 
1982 1982
 function calendar_upgrade1_7_011()
@@ -2006,36 +2006,36 @@  discard block
 block discarded – undo
2006 2006
 		'precision' => '8',
2007 2007
 		'comment' => 'ts when event was deleted'
2008 2008
 	));*/
2009
-	$GLOBALS['egw_setup']->oProc->RefreshTable('egw_cal',array(
2009
+	$GLOBALS['egw_setup']->oProc->RefreshTable('egw_cal', array(
2010 2010
 		'fd' => array(
2011
-			'cal_id' => array('type' => 'auto','nullable' => False),
2012
-			'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False,'comment' => 'unique id of event(-series)'),
2013
-			'cal_owner' => array('type' => 'int','precision' => '4','nullable' => False,'comment' => 'event owner / calendar'),
2014
-			'cal_category' => array('type' => 'varchar','precision' => '30','comment' => 'category id'),
2015
-			'cal_modified' => array('type' => 'int','precision' => '8','comment' => 'ts of last modification'),
2016
-			'cal_priority' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '2'),
2017
-			'cal_public' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '1','comment' => '1=public, 0=private event'),
2018
-			'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'),
2011
+			'cal_id' => array('type' => 'auto', 'nullable' => False),
2012
+			'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'comment' => 'unique id of event(-series)'),
2013
+			'cal_owner' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'comment' => 'event owner / calendar'),
2014
+			'cal_category' => array('type' => 'varchar', 'precision' => '30', 'comment' => 'category id'),
2015
+			'cal_modified' => array('type' => 'int', 'precision' => '8', 'comment' => 'ts of last modification'),
2016
+			'cal_priority' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '2'),
2017
+			'cal_public' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '1', 'comment' => '1=public, 0=private event'),
2018
+			'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'),
2019 2019
 			'cal_description' => array('type' => 'text'),
2020
-			'cal_location' => array('type' => 'varchar','precision' => '255'),
2021
-			'cal_reference' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0','comment' => 'cal_id of series for exception'),
2022
-			'cal_modifier' => array('type' => 'int','precision' => '4','comment' => 'user who last modified event'),
2023
-			'cal_non_blocking' => array('type' => 'int','precision' => '2','default' => '0','comment' => '1 for non-blocking events'),
2024
-			'cal_special' => array('type' => 'int','precision' => '2','default' => '0'),
2025
-			'cal_etag' => array('type' => 'int','precision' => '4','default' => '0','comment' => 'etag for optimistic locking'),
2026
-			'cal_creator' => array('type' => 'int','precision' => '4','nullable' => False,'comment' => 'creating user'),
2027
-			'cal_created' => array('type' => 'int','precision' => '8','nullable' => False,'comment' => 'creation time of event'),
2028
-			'cal_recurrence' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0','comment' => 'cal_start of original recurrence for exception'),
2029
-			'tz_id' => array('type' => 'int','precision' => '4','comment' => 'key into egw_cal_timezones'),
2030
-			'cal_deleted' => array('type' => 'int','precision' => '8','comment' => 'ts when event was deleted')
2020
+			'cal_location' => array('type' => 'varchar', 'precision' => '255'),
2021
+			'cal_reference' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0', 'comment' => 'cal_id of series for exception'),
2022
+			'cal_modifier' => array('type' => 'int', 'precision' => '4', 'comment' => 'user who last modified event'),
2023
+			'cal_non_blocking' => array('type' => 'int', 'precision' => '2', 'default' => '0', 'comment' => '1 for non-blocking events'),
2024
+			'cal_special' => array('type' => 'int', 'precision' => '2', 'default' => '0'),
2025
+			'cal_etag' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'comment' => 'etag for optimistic locking'),
2026
+			'cal_creator' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'comment' => 'creating user'),
2027
+			'cal_created' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'comment' => 'creation time of event'),
2028
+			'cal_recurrence' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0', 'comment' => 'cal_start of original recurrence for exception'),
2029
+			'tz_id' => array('type' => 'int', 'precision' => '4', 'comment' => 'key into egw_cal_timezones'),
2030
+			'cal_deleted' => array('type' => 'int', 'precision' => '8', 'comment' => 'ts when event was deleted')
2031 2031
 		),
2032 2032
 		'pk' => array('cal_id'),
2033 2033
 		'fk' => array(),
2034
-		'ix' => array('cal_uid','cal_owner','cal_deleted'),
2034
+		'ix' => array('cal_uid', 'cal_owner', 'cal_deleted'),
2035 2035
 		'uc' => array()
2036
-	),array(
2036
+	), array(
2037 2037
 		// for deleted rows use cal_modified as deleted date, NULL for not deleted ones
2038
-		'cal_deleted' => 'CASE cal_deleted WHEN '.$GLOBALS['egw_setup']->db->quote(true,'bool').' THEN cal_modified ELSE NULL END',
2038
+		'cal_deleted' => 'CASE cal_deleted WHEN '.$GLOBALS['egw_setup']->db->quote(true, 'bool').' THEN cal_modified ELSE NULL END',
2039 2039
 	));
2040 2040
 
2041 2041
 	return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.002';
@@ -2047,16 +2047,16 @@  discard block
 block discarded – undo
2047 2047
  */
2048 2048
 function calendar_upgrade1_9_002()
2049 2049
 {
2050
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','caldav_name',array(
2050
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'caldav_name', array(
2051 2051
 		'type' => 'varchar',
2052 2052
 		'precision' => '64',
2053 2053
 		'comment' => 'name part of CalDAV URL, if specified by client'
2054 2054
 	));
2055
-	$GLOBALS['egw_setup']->db->query($sql='UPDATE egw_cal SET caldav_name='.
2055
+	$GLOBALS['egw_setup']->db->query($sql = 'UPDATE egw_cal SET caldav_name='.
2056 2056
 		$GLOBALS['egw_setup']->db->concat(
2057
-			$GLOBALS['egw_setup']->db->to_varchar('cal_id'),"'.ics'"),__LINE__,__FILE__);
2057
+			$GLOBALS['egw_setup']->db->to_varchar('cal_id'), "'.ics'"), __LINE__, __FILE__);
2058 2058
 
2059
-	$GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal','caldav_name');
2059
+	$GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal', 'caldav_name');
2060 2060
 
2061 2061
 	return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.003';
2062 2062
 }
@@ -2067,8 +2067,8 @@  discard block
 block discarded – undo
2067 2067
  */
2068 2068
 function calendar_upgrade1_9_003()
2069 2069
 {
2070
-	$GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal','cal_modified');
2071
-	$GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal_user','cal_user_modified');
2070
+	$GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal', 'cal_modified');
2071
+	$GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal_user', 'cal_user_modified');
2072 2072
 
2073 2073
 	return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.004';
2074 2074
 }
@@ -2080,7 +2080,7 @@  discard block
 block discarded – undo
2080 2080
  */
2081 2081
 function calendar_upgrade1_9_004()
2082 2082
 {
2083
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_dates','recur_exception',array(
2083
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_dates', 'recur_exception', array(
2084 2084
 		'type' => 'bool',
2085 2085
 		'default' => '',
2086 2086
 		'null' => false,
@@ -2088,16 +2088,16 @@  discard block
 block discarded – undo
2088 2088
 	));
2089 2089
 
2090 2090
 	// migrate existing exceptions to egw_cal_dates
2091
-	foreach($GLOBALS['egw_setup']->db->select('egw_cal_repeats',
2091
+	foreach ($GLOBALS['egw_setup']->db->select('egw_cal_repeats',
2092 2092
 		'egw_cal_repeats.cal_id AS cal_id,egw_cal_repeats.recur_exception AS recur_exception,MIN(cal_start) AS cal_start,MIN(cal_end) AS cal_end',
2093 2093
 		'egw_cal_repeats.recur_exception IS NOT NULL', __LINE__, __FILE__, false,
2094 2094
 		'GROUP BY egw_cal_repeats.cal_id,egw_cal_repeats.recur_exception', 'calendar', '',
2095 2095
 		'JOIN egw_cal_dates ON egw_cal_repeats.cal_id=egw_cal_dates.cal_id') as $row)
2096 2096
 	{
2097
-		foreach($row['recur_exception'] ? array_unique(explode(',', $row['recur_exception'])) : array() as $recur_exception)
2097
+		foreach ($row['recur_exception'] ? array_unique(explode(',', $row['recur_exception'])) : array() as $recur_exception)
2098 2098
 		{
2099 2099
 			$GLOBALS['egw_setup']->db->insert('egw_cal_dates', array(
2100
-				'cal_end' => $recur_exception+$row['cal_end']-$row['cal_start'],
2100
+				'cal_end' => $recur_exception + $row['cal_end'] - $row['cal_start'],
2101 2101
 				'recur_exception' => true,
2102 2102
 			), array(
2103 2103
 				'cal_id' => $row['cal_id'],
@@ -2109,11 +2109,11 @@  discard block
 block discarded – undo
2109 2109
 
2110 2110
 	$GLOBALS['egw_setup']->oProc->DropColumn('egw_cal_repeats', array(
2111 2111
 		'fd' => array(
2112
-			'cal_id' => array('type' => 'int','precision' => '4','nullable' => False),
2113
-			'recur_type' => array('type' => 'int','precision' => '2','nullable' => False),
2114
-			'recur_enddate' => array('type' => 'int','precision' => '8'),
2115
-			'recur_interval' => array('type' => 'int','precision' => '2','default' => '1'),
2116
-			'recur_data' => array('type' => 'int','precision' => '2','default' => '1'),
2112
+			'cal_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False),
2113
+			'recur_type' => array('type' => 'int', 'precision' => '2', 'nullable' => False),
2114
+			'recur_enddate' => array('type' => 'int', 'precision' => '8'),
2115
+			'recur_interval' => array('type' => 'int', 'precision' => '2', 'default' => '1'),
2116
+			'recur_data' => array('type' => 'int', 'precision' => '2', 'default' => '1'),
2117 2117
 		),
2118 2118
 		'pk' => array('cal_id'),
2119 2119
 		'fk' => array(),
@@ -2134,19 +2134,19 @@  discard block
 block discarded – undo
2134 2134
 	// returns NULL, if there are no rows!
2135 2135
 	if ((int)$max_description_length <= 16384 && $GLOBALS['egw_setup']->oProc->max_varchar_length >= 16384)
2136 2136
 	{
2137
-		$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_description',array(
2137
+		$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_description', array(
2138 2138
 			'type' => 'varchar',
2139 2139
 			'precision' => '16384'
2140 2140
 		));
2141 2141
 	}
2142 2142
 	// allow more categories
2143
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_category',array(
2143
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_category', array(
2144 2144
 		'type' => 'varchar',
2145 2145
 		'precision' => '64',
2146 2146
 		'comment' => 'category id(s)'
2147 2147
 	));
2148 2148
 	// remove silly default of 1
2149
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_title',array(
2149
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_title', array(
2150 2150
 		'type' => 'varchar',
2151 2151
 		'precision' => '255',
2152 2152
 		'nullable' => False
@@ -2161,14 +2161,14 @@  discard block
 block discarded – undo
2161 2161
 {
2162 2162
 	// PostgreSQL needs temporary a nullable column, to not stall on broken events without dates!
2163 2163
 	// We add that constrain in 1.9.007, after deleting all rows with range_start=0 OR range_start IS NULL
2164
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','range_start',array(
2164
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'range_start', array(
2165 2165
 		'type' => 'int',
2166 2166
 		'precision' => '8',
2167 2167
 		'comment' => 'startdate (of range)'
2168 2168
 	));
2169 2169
 	$GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET range_start = (SELECT MIN(cal_start) FROM egw_cal_dates WHERE egw_cal_dates.cal_id=egw_cal.cal_id)', __LINE__, __FILE__);
2170 2170
 
2171
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','range_end',array(
2171
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'range_end', array(
2172 2172
 		'type' => 'int',
2173 2173
 		'precision' => '8',
2174 2174
 		'comment' => 'enddate (of range, UNTIL of RRULE)'
@@ -2184,18 +2184,18 @@  discard block
 block discarded – undo
2184 2184
 	{
2185 2185
 		$GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET range_end=recur_enddate FROM egw_cal_repeats WHERE egw_cal.cal_id=egw_cal_repeats.cal_id', __LINE__, __FILE__);
2186 2186
 	}
2187
-	$GLOBALS['egw_setup']->oProc->DropColumn('egw_cal_repeats',array(
2187
+	$GLOBALS['egw_setup']->oProc->DropColumn('egw_cal_repeats', array(
2188 2188
 		'fd' => array(
2189
-			'cal_id' => array('type' => 'int','precision' => '4','nullable' => False),
2190
-			'recur_type' => array('type' => 'int','precision' => '2','nullable' => False),
2191
-			'recur_interval' => array('type' => 'int','precision' => '2','default' => '1'),
2192
-			'recur_data' => array('type' => 'int','precision' => '2','default' => '1')
2189
+			'cal_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False),
2190
+			'recur_type' => array('type' => 'int', 'precision' => '2', 'nullable' => False),
2191
+			'recur_interval' => array('type' => 'int', 'precision' => '2', 'default' => '1'),
2192
+			'recur_data' => array('type' => 'int', 'precision' => '2', 'default' => '1')
2193 2193
 		),
2194 2194
 		'pk' => array('cal_id'),
2195 2195
 		'fk' => array(),
2196 2196
 		'ix' => array(),
2197 2197
 		'uc' => array()
2198
-	),'recur_enddate');
2198
+	), 'recur_enddate');
2199 2199
 
2200 2200
 	return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.007';
2201 2201
 }
@@ -2207,14 +2207,14 @@  discard block
 block discarded – undo
2207 2207
  */
2208 2208
 function calendar_upgrade1_9_007()
2209 2209
 {
2210
-	foreach(array('egw_cal_repeats','egw_cal_dates','egw_cal_user','egw_cal_extra') as $table)
2210
+	foreach (array('egw_cal_repeats', 'egw_cal_dates', 'egw_cal_user', 'egw_cal_extra') as $table)
2211 2211
 	{
2212 2212
 		$GLOBALS['egw_setup']->db->query("DELETE FROM $table WHERE cal_id IN (SELECT cal_id FROM egw_cal WHERE range_start=0 OR range_start IS NULL)", __LINE__, __FILE__);
2213 2213
 	}
2214 2214
 	$GLOBALS['egw_setup']->db->query("DELETE FROM egw_cal WHERE range_start=0 OR range_start IS NULL", __LINE__, __FILE__);
2215 2215
 
2216 2216
 	// now we can remove temporary default of 0 from range_start and set it NOT NULL
2217
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','range_start',array(
2217
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'range_start', array(
2218 2218
 		'type' => 'int',
2219 2219
 		'precision' => '8',
2220 2220
 		'nullable' => False,
@@ -2279,7 +2279,7 @@  discard block
 block discarded – undo
2279 2279
 
2280 2280
 function calendar_upgrade1_9_010()
2281 2281
 {
2282
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','caldav_name',array(
2282
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'caldav_name', array(
2283 2283
 		'type' => 'varchar',
2284 2284
 		'precision' => '200',
2285 2285
 		'comment' => 'name part of CalDAV URL, if specified by client'
@@ -2309,7 +2309,7 @@  discard block
 block discarded – undo
2309 2309
 SET cal_reference=0,cal_recurrence=0,cal_etag=cal_etag+1,cal_modifier=0,cal_modified=".time()."
2310 2310
 WHERE cal_reference != 0 AND cal_id IN (SELECT cal_id FROM egw_cal_repeats)", __LINE__, __FILE__);
2311 2311
 
2312
-	foreach($GLOBALS['egw_setup']->db->query(
2312
+	foreach ($GLOBALS['egw_setup']->db->query(
2313 2313
 "SELECT DISTINCT master.cal_id,egw_cal_user.cal_user_type,egw_cal_user.cal_user_id,'E' AS cal_status
2314 2314
 FROM egw_cal_user
2315 2315
 JOIN egw_cal ON egw_cal_user.cal_id=egw_cal.cal_id
@@ -2336,7 +2336,7 @@  discard block
 block discarded – undo
2336 2336
  */
2337 2337
 function calendar_upgrade14_1_001()
2338 2338
 {
2339
-	foreach($GLOBALS['egw_setup']->db->query(
2339
+	foreach ($GLOBALS['egw_setup']->db->query(
2340 2340
 "SELECT egw_cal.cal_id AS cal_id,cal_start,cal_end,range_start,range_end,egw_cal_repeats.*,tz_tzid AS tzid
2341 2341
 FROM egw_cal
2342 2342
 JOIN egw_cal_repeats ON egw_cal_repeats.cal_id=egw_cal.cal_id
@@ -2364,7 +2364,7 @@  discard block
 block discarded – undo
2364 2364
 		$enddate->modify(($event['end'] - $event['start']).' second');
2365 2365
 		if (($range_end = $enddate->format('server')) != $event['range_end'])
2366 2366
 		{
2367
-			$GLOBALS['egw_setup']->db->update('egw_cal',array(
2367
+			$GLOBALS['egw_setup']->db->update('egw_cal', array(
2368 2368
 				'range_end' => $range_end,
2369 2369
 				'cal_etag=cal_etag+1',
2370 2370
 				'cal_modified' => time(),
@@ -2374,7 +2374,7 @@  discard block
 block discarded – undo
2374 2374
 			//error_log(__FUNCTION__."() #$event[id], start=".date('Y-m-d H:i:s', $event['start']).', end='.date('Y-m-d H:i:s', $event['end']).', range_end='.date('Y-m-d H:i:s', $event['recur_enddate']).' --> '.date('Y-m-d H:i:s', $range_end));
2375 2375
 		}
2376 2376
 	}
2377
-	return $GLOBALS['setup_info']['calendar']['currentver'] = '14.2.002';	// skip 14.2.001 update, as query is fixed now
2377
+	return $GLOBALS['setup_info']['calendar']['currentver'] = '14.2.002'; // skip 14.2.001 update, as query is fixed now
2378 2378
 }
2379 2379
 
2380 2380
 /**
@@ -2398,7 +2398,7 @@  discard block
 block discarded – undo
2398 2398
 	// if maximum is bigger then 3
2399 2399
 	if ($values[1] > 3)
2400 2400
 	{
2401
-		switch($GLOBALS['egw_setup']->db->Type)
2401
+		switch ($GLOBALS['egw_setup']->db->Type)
2402 2402
 		{
2403 2403
 			case 'mysql':
2404 2404
 				$sql = "UPDATE egw_cal
@@ -2443,7 +2443,7 @@  discard block
 block discarded – undo
2443 2443
 
2444 2444
 function calendar_upgrade14_2_003()
2445 2445
 {
2446
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_uid',array(
2446
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_uid', array(
2447 2447
 		'type' => 'ascii',
2448 2448
 		'precision' => '128',
2449 2449
 		'nullable' => False,
@@ -2455,13 +2455,13 @@  discard block
 block discarded – undo
2455 2455
 	{
2456 2456
 		$GLOBALS['egw_setup']->db->query("UPDATE egw_cal SET cal_category='' WHERE cal_category NOT REGEXP '^[0-9,]*$'", __LINE__, __FILE__);
2457 2457
 	}
2458
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_category',array(
2458
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_category', array(
2459 2459
 		'type' => 'ascii',
2460 2460
 		'meta' => 'category',
2461 2461
 		'precision' => '64',
2462 2462
 		'comment' => 'category id(s)'
2463 2463
 	));
2464
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','caldav_name',array(
2464
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'caldav_name', array(
2465 2465
 		'type' => 'ascii',
2466 2466
 		'precision' => '128',
2467 2467
 		'comment' => 'name part of CalDAV URL, if specified by client'
@@ -2518,22 +2518,22 @@  discard block
 block discarded – undo
2518 2518
 		'type' => 'auto',
2519 2519
 		'nullable' => False
2520 2520
 	));*/
2521
-	$GLOBALS['egw_setup']->oProc->RefreshTable('egw_cal_user',array(
2521
+	$GLOBALS['egw_setup']->oProc->RefreshTable('egw_cal_user', array(
2522 2522
 		'fd' => array(
2523
-			'cal_id' => array('type' => 'int','precision' => '4','nullable' => False),
2524
-			'cal_recur_date' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False,'default' => '0'),
2525
-			'cal_user_type' => array('type' => 'ascii','precision' => '1','nullable' => False,'default' => 'u','comment' => 'u=user, g=group, c=contact, r=resource, e=email'),
2526
-			'cal_user_id' => array('type' => 'varchar','meta' => array("cal_user_type='u'" => 'account'),'precision' => '128','nullable' => False,'comment' => 'id or email-address for type=e'),
2527
-			'cal_status' => array('type' => 'ascii','precision' => '1','default' => 'A','comment' => 'U=unknown, A=accepted, R=rejected, T=tentative'),
2528
-			'cal_quantity' => array('type' => 'int','precision' => '4','default' => '1','comment' => 'only for certain types (eg. resources)'),
2529
-			'cal_role' => array('type' => 'ascii','precision' => '64','default' => 'REQ-PARTICIPANT','comment' => 'CHAIR, REQ-PARTICIPANT, OPT-PARTICIPANT, NON-PARTICIPANT, X-CAT-$cat_id'),
2530
-			'cal_user_modified' => array('type' => 'timestamp','default' => 'current_timestamp','comment' => 'automatic timestamp of last update'),
2531
-			'cal_user_auto' => array('type' => 'auto','nullable' => False)
2523
+			'cal_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False),
2524
+			'cal_recur_date' => array('type' => 'int', 'meta' => 'timestamp', 'precision' => '8', 'nullable' => False, 'default' => '0'),
2525
+			'cal_user_type' => array('type' => 'ascii', 'precision' => '1', 'nullable' => False, 'default' => 'u', 'comment' => 'u=user, g=group, c=contact, r=resource, e=email'),
2526
+			'cal_user_id' => array('type' => 'varchar', 'meta' => array("cal_user_type='u'" => 'account'), 'precision' => '128', 'nullable' => False, 'comment' => 'id or email-address for type=e'),
2527
+			'cal_status' => array('type' => 'ascii', 'precision' => '1', 'default' => 'A', 'comment' => 'U=unknown, A=accepted, R=rejected, T=tentative'),
2528
+			'cal_quantity' => array('type' => 'int', 'precision' => '4', 'default' => '1', 'comment' => 'only for certain types (eg. resources)'),
2529
+			'cal_role' => array('type' => 'ascii', 'precision' => '64', 'default' => 'REQ-PARTICIPANT', 'comment' => 'CHAIR, REQ-PARTICIPANT, OPT-PARTICIPANT, NON-PARTICIPANT, X-CAT-$cat_id'),
2530
+			'cal_user_modified' => array('type' => 'timestamp', 'default' => 'current_timestamp', 'comment' => 'automatic timestamp of last update'),
2531
+			'cal_user_auto' => array('type' => 'auto', 'nullable' => False)
2532 2532
 		),
2533 2533
 		'pk' => array('cal_user_auto'),
2534 2534
 		'fk' => array(),
2535
-		'ix' => array('cal_user_modified',array('cal_user_type','cal_user_id')),
2536
-		'uc' => array(array('cal_id','cal_recur_date','cal_user_type','cal_user_id'))
2535
+		'ix' => array('cal_user_modified', array('cal_user_type', 'cal_user_id')),
2536
+		'uc' => array(array('cal_id', 'cal_recur_date', 'cal_user_type', 'cal_user_id'))
2537 2537
 	));
2538 2538
 
2539 2539
 	return $GLOBALS['setup_info']['calendar']['currentver'] = '14.2.005';
@@ -2542,12 +2542,12 @@  discard block
 block discarded – undo
2542 2542
 
2543 2543
 function calendar_upgrade14_2_005()
2544 2544
 {
2545
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_timezones','tz_tzid',array(
2545
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_timezones', 'tz_tzid', array(
2546 2546
 		'type' => 'ascii',
2547 2547
 		'precision' => '128',
2548 2548
 		'nullable' => False
2549 2549
 	));
2550
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_timezones','tz_component',array(
2550
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_timezones', 'tz_component', array(
2551 2551
 		'type' => 'ascii',
2552 2552
 		'precision' => '8192',
2553 2553
 		'comment' => 'iCal VTIMEZONE component'
@@ -2563,7 +2563,7 @@  discard block
 block discarded – undo
2563 2563
  */
2564 2564
 function calendar_upgrade14_3()
2565 2565
 {
2566
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user','cal_user_attendee',array(
2566
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user', 'cal_user_attendee', array(
2567 2567
 		'type' => 'varchar',
2568 2568
 		'precision' => '255',
2569 2569
 		'comment' => 'email or json object with attr. cn, url, ...'
@@ -2574,12 +2574,12 @@  discard block
 block discarded – undo
2574 2574
 
2575 2575
 	// delete all but one row, which would give a doublicate key, after above normalising of email addresses
2576 2576
 	// by ordering by status we prever accepted over tentative over unknow over deleted
2577
-	foreach($GLOBALS['egw_setup']->db->select('egw_cal_user', "cal_id,cal_recur_date,$email AS email", array(
2577
+	foreach ($GLOBALS['egw_setup']->db->select('egw_cal_user', "cal_id,cal_recur_date,$email AS email", array(
2578 2578
 		'cal_user_type' => 'e',
2579 2579
 	), __LINE__, __FILE__, false, "GROUP BY cal_id,cal_recur_date,$email HAVING COUNT(*)>1", 'calendar') as $row)
2580 2580
 	{
2581 2581
 		$n = 0;
2582
-		foreach($GLOBALS['egw_setup']->db->select('egw_cal_user', "*,$email AS email", array(
2582
+		foreach ($GLOBALS['egw_setup']->db->select('egw_cal_user', "*,$email AS email", array(
2583 2583
 			'cal_id' => $row['cal_id'],
2584 2584
 			'cal_recur_date' => $row['cal_recur_date'],
2585 2585
 			'cal_user_type' => 'e',
@@ -2588,7 +2588,7 @@  discard block
 block discarded – undo
2588 2588
 		{
2589 2589
 			if (strpos($user['email'], '@') !== false && !$n++) continue;
2590 2590
 			$GLOBALS['egw_setup']->db->delete('egw_cal_user',
2591
-				array_intersect_key($user, array_flip(array('cal_id','cal_recur_date','cal_user_type','cal_user_id','cal_status'))),
2591
+				array_intersect_key($user, array_flip(array('cal_id', 'cal_recur_date', 'cal_user_type', 'cal_user_id', 'cal_status'))),
2592 2592
 				__LINE__, __FILE__, 'calendar');
2593 2593
 		}
2594 2594
 	}
@@ -2598,7 +2598,7 @@  discard block
 block discarded – undo
2598 2598
 		"UPDATE egw_cal_user SET cal_user_attendee=cal_user_id,cal_user_id=MD5($email) WHERE cal_user_type='e'",
2599 2599
 		__LINE__, __FILE__);
2600 2600
 
2601
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_user_id',array(
2601
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_user_id', array(
2602 2602
 		'type' => 'ascii',
2603 2603
 		'meta' => array(
2604 2604
 			"cal_user_type='u'" => 'account'
@@ -2620,7 +2620,7 @@  discard block
 block discarded – undo
2620 2620
 {
2621 2621
 	$GLOBALS['calendar_upgrade14_3_001-run'] = true;
2622 2622
 
2623
-	foreach($GLOBALS['egw_setup']->db->query("SELECT egw_cal_user.cal_id AS cal_id,egw_cal_user.cal_user_id AS cal_user_id,egw_cal_user.cal_user_attendee AS cal_user_attendee
2623
+	foreach ($GLOBALS['egw_setup']->db->query("SELECT egw_cal_user.cal_id AS cal_id,egw_cal_user.cal_user_id AS cal_user_id,egw_cal_user.cal_user_attendee AS cal_user_attendee
2624 2624
 FROM egw_cal_user
2625 2625
 JOIN egw_cal_user euser ON euser.cal_id=egw_cal_user.cal_id AND euser.cal_user_type='e' AND euser.cal_user_id=egw_cal_user.cal_user_id AND euser.cal_user_attendee IS NULL
2626 2626
 WHERE egw_cal_user.cal_user_type='e' AND egw_cal_user.cal_user_attendee IS NOT NULL
@@ -2671,8 +2671,8 @@  discard block
 block discarded – undo
2671 2671
 {
2672 2672
 	Api\Preferences::change_preference('calendar', '/^favorite_/', function($attr, $old_value, $owner)
2673 2673
 	{
2674
-		unset($attr, $owner);	// not used, but required by function signature
2675
-		if($old_value['state'] && is_array($old_value['state']))
2674
+		unset($attr, $owner); // not used, but required by function signature
2675
+		if ($old_value['state'] && is_array($old_value['state']))
2676 2676
 		{
2677 2677
 			unset($old_value['state']['date']);
2678 2678
 			unset($old_value['state']['startdate']);
@@ -2692,15 +2692,15 @@  discard block
 block discarded – undo
2692 2692
 {
2693 2693
 	Api\Preferences::change_preference('calendar', 'use_time_grid', function($attr, $old_value, $owner)
2694 2694
 	{
2695
-		unset($attr, $owner);	// not used, but required by function signature
2696
-		switch($old_value)
2695
+		unset($attr, $owner); // not used, but required by function signature
2696
+		switch ($old_value)
2697 2697
 		{
2698 2698
 			case 'all':
2699 2699
 				return 0;
2700 2700
 			case 'day_week':
2701
-				return ['day','day4','week'];
2701
+				return ['day', 'day4', 'week'];
2702 2702
 			case 'day4':
2703
-				return ['day','day4'];
2703
+				return ['day', 'day4'];
2704 2704
 		}
2705 2705
 		return null;
2706 2706
 	});
@@ -2725,7 +2725,7 @@  discard block
 block discarded – undo
2725 2725
 function calendar_upgrade16_1_001()
2726 2726
 {
2727 2727
 	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_extra', 'cal_extra_value',
2728
-		array('type' => 'varchar','meta' => 'cfvalue','precision' => '16384','nullable' => False,'default' => ''));
2728
+		array('type' => 'varchar', 'meta' => 'cfvalue', 'precision' => '16384', 'nullable' => False, 'default' => ''));
2729 2729
 
2730 2730
 	Api\Preferences::change_preference('calendar', 'defaultresource_sel', 'resources', 'addressbook', 'forced');
2731 2731
 	Api\Preferences::change_preference('calendar', 'defaultresource_sel', 'resources', 'addressbook', 'default');
@@ -2737,8 +2737,8 @@  discard block
 block discarded – undo
2737 2737
 {
2738 2738
 	// Explicitly add months as showing list of events, no times
2739 2739
 	$change = function($attr, $old_value, $owner) {
2740
-		if($owner == Api\Preferences::FORCED_ID) return;
2741
-		if(is_array($old_value) && !in_array('month', $old_value))
2740
+		if ($owner == Api\Preferences::FORCED_ID) return;
2741
+		if (is_array($old_value) && !in_array('month', $old_value))
2742 2742
 		{
2743 2743
 			$old_value[] = 'month';
2744 2744
 		}
Please login to merge, or discard this patch.
Braces   +18 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1429,13 +1429,18 @@  discard block
 block discarded – undo
1429 1429
 function calendar_upgrade1_0_1_008()
1430 1430
 {
1431 1431
 	$config_data = Api\Config::read('calendar');
1432
-	if (isset($config_data['fields']))	// old custom fields
1432
+	if (isset($config_data['fields']))
1433
+	{
1434
+		// old custom fields
1433 1435
 	{
1434 1436
 		$customfields = array();
1437
+	}
1435 1438
 		$order = 0;
1436 1439
 		foreach($config_data['fields'] as $name => $data)
1437 1440
 		{
1438
-			if ($name{0} == '#' && !$data['disabled'])	// real not-disabled custom field
1441
+			if ($name{0} == '#' && !$data['disabled'])
1442
+			{
1443
+				// real not-disabled custom field
1439 1444
 			{
1440 1445
 				$customfields[substr($name,1)] = array(
1441 1446
 					'type'  => 'text',
@@ -1444,6 +1449,7 @@  discard block
 block discarded – undo
1444 1449
 					'order' => ($order += 10),
1445 1450
 				);
1446 1451
 			}
1452
+			}
1447 1453
 		}
1448 1454
 		if (count($customfields))
1449 1455
 		{
@@ -2584,9 +2590,12 @@  discard block
 block discarded – undo
2584 2590
 			'cal_recur_date' => $row['cal_recur_date'],
2585 2591
 			'cal_user_type' => 'e',
2586 2592
 			$email.'='.$GLOBALS['egw_setup']->db->quote($row['email']),
2587
-		), __LINE__, __FILE__, false, 'ORDER BY cal_status', 'calendar') as $user)	// order A, T, U, X
2593
+		), __LINE__, __FILE__, false, 'ORDER BY cal_status', 'calendar') as $user)
2594
+		{
2595
+			// order A, T, U, X
2588 2596
 		{
2589 2597
 			if (strpos($user['email'], '@') !== false && !$n++) continue;
2598
+		}
2590 2599
 			$GLOBALS['egw_setup']->db->delete('egw_cal_user',
2591 2600
 				array_intersect_key($user, array_flip(array('cal_id','cal_recur_date','cal_user_type','cal_user_id','cal_status'))),
2592 2601
 				__LINE__, __FILE__, 'calendar');
@@ -2736,8 +2745,12 @@  discard block
 block discarded – undo
2736 2745
 function calendar_upgrade16_1_002()
2737 2746
 {
2738 2747
 	// Explicitly add months as showing list of events, no times
2739
-	$change = function($attr, $old_value, $owner) {
2740
-		if($owner == Api\Preferences::FORCED_ID) return;
2748
+	$change = function($attr, $old_value, $owner)
2749
+	{
2750
+		if($owner == Api\Preferences::FORCED_ID)
2751
+		{
2752
+			return;
2753
+		}
2741 2754
 		if(is_array($old_value) && !in_array('month', $old_value))
2742 2755
 		{
2743 2756
 			$old_value[] = 'month';
Please login to merge, or discard this patch.
doc/fix_api.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -187,7 +187,7 @@
 block discarded – undo
187 187
  *
188 188
  * @param string $file filename
189 189
  * @param boolean $dry_run =false true: only echo fixed file, not fix it
190
- * @return boolean false on error
190
+ * @return boolean|null false on error
191 191
  */
192 192
 function fix_api($file, $dry_run=false)
193 193
 {
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 
18 18
 // raw replacements
19 19
 $add_use_api = array(
20
-	"#use EGroupware\\\\Api;\n#" => '',	// remove evtl. use EGroupware\Api, as we add it again below
20
+	"#use EGroupware\\\\Api;\n#" => '', // remove evtl. use EGroupware\Api, as we add it again below
21 21
 	"#<\?php\n+\s*/\*+?(.*)\*/#msU" => "<?php\n/**$1*/\n\nuse EGroupware\\Api;",
22 22
 );
23 23
 $replace = array(
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 // enclose class-names and static methods with some syntax check
47 47
 $class_start = '#(?<!function)([\[\s,;().!=])';
48 48
 $class_end = '(::|\\(|\\)|;|\?|:|\\s|,|$)#';
49
-foreach(array(
49
+foreach (array(
50 50
 	'accounts' => 'Api\\Accounts',
51 51
 	'acl' => 'Api\\Acl',
52 52
 	'EGW_ACL_READ' => 'Api\\Acl::READ',
@@ -189,10 +189,10 @@  discard block
 block discarded – undo
189 189
  * @param boolean $dry_run =false true: only echo fixed file, not fix it
190 190
  * @return boolean false on error
191 191
  */
192
-function fix_api($file, $dry_run=false)
192
+function fix_api($file, $dry_run = false)
193 193
 {
194 194
 	global $prog, $replace, $add_use_api;
195
-	if (basename($file) == $prog) return true;	// dont fix ourself ;-)
195
+	if (basename($file) == $prog) return true; // dont fix ourself ;-)
196 196
 
197 197
 	if (($content = $content_in = file_get_contents($file)) === false) return false;
198 198
 
@@ -203,12 +203,12 @@  discard block
 block discarded – undo
203 203
 	}
204 204
 	$content2 = preg_replace(array_keys($replace), array_values($replace), $content);
205 205
 
206
-	if ($content2 == $content_in) return true;	// nothing changed
206
+	if ($content2 == $content_in) return true; // nothing changed
207 207
 
208 208
 	$content = preg_replace(array_keys($add_use_api), array_values($add_use_api), $content2);
209 209
 
210 210
 	// shorten some classes, if used, with further use declarations
211
-	foreach(array('Api\\Etemplate', 'Api\\Vfs', 'Api\\Acl', 'Api\\Egw', 'Api\\Framework', 'Api\\Link') as $namespace)
211
+	foreach (array('Api\\Etemplate', 'Api\\Vfs', 'Api\\Acl', 'Api\\Egw', 'Api\\Framework', 'Api\\Link') as $namespace)
212 212
 	{
213 213
 		if (strpos($content, $namespace) !== false && strpos($content, 'use EGroupware\\'.$namespace) === false)
214 214
 		{
@@ -247,11 +247,11 @@  discard block
 block discarded – undo
247 247
  * @param boolean $dry_run =false true: only echo fixed file, not fix it
248 248
  * @return boolean false on error
249 249
  */
250
-function fix_api_recursive($dir, $dry_run=false)
250
+function fix_api_recursive($dir, $dry_run = false)
251 251
 {
252 252
 	if (!is_dir($dir)) return false;
253 253
 
254
-	foreach(scandir($dir) as $file)
254
+	foreach (scandir($dir) as $file)
255 255
 	{
256 256
 		if ($file == '.' || $file == '..') continue;
257 257
 
@@ -259,13 +259,13 @@  discard block
 block discarded – undo
259 259
 		{
260 260
 			fix_api_recursive($dir.'/'.$file, $dry_run);
261 261
 		}
262
-		elseif(substr($file,-4) == '.php')
262
+		elseif (substr($file, -4) == '.php')
263 263
 		{
264
-			echo "\r".str_repeat(' ',100)."\r".$dir.'/'.$file.': ';
264
+			echo "\r".str_repeat(' ', 100)."\r".$dir.'/'.$file.': ';
265 265
 			fix_api($dir.'/'.$file, $dry_run);
266 266
 		}
267 267
 	}
268
-	echo "\r".str_repeat(' ',100)."\r";
268
+	echo "\r".str_repeat(' ', 100)."\r";
269 269
 	return true;
270 270
 }
271 271
 
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
  *
275 275
  * @param string $error =null
276 276
  */
277
-function usage($error=null)
277
+function usage($error = null)
278 278
 {
279 279
 	global $prog;
280 280
 	echo "Usage: $prog [-h|--help] [-d|--dry-run] file(s) or dir(s)\n\n";
@@ -288,9 +288,9 @@  discard block
 block discarded – undo
288 288
 if (!$args) usage();
289 289
 
290 290
 $dry_run = false;
291
-while(($arg = array_shift($args)) && $arg[0] == '-')
291
+while (($arg = array_shift($args)) && $arg[0] == '-')
292 292
 {
293
-	switch($arg)
293
+	switch ($arg)
294 294
 	{
295 295
 		case '-h':
296 296
 		case '--help':
@@ -323,4 +323,4 @@  discard block
 block discarded – undo
323 323
 		fix_api_recursive($arg, $dry_run);
324 324
 	}
325 325
 }
326
-while(($arg = array_shift($args)));
326
+while (($arg = array_shift($args)));
Please login to merge, or discard this patch.
Braces   +42 added lines, -10 removed lines patch added patch discarded remove patch
@@ -10,10 +10,13 @@  discard block
 block discarded – undo
10 10
  * @version $Id$
11 11
  */
12 12
 
13
-if (php_sapi_name() !== 'cli')	// security precaution: forbit calling as web-page
13
+if (php_sapi_name() !== 'cli')
14
+{
15
+	// security precaution: forbit calling as web-page
14 16
 {
15 17
 	die('<h1>fix_api.php must NOT be called as web-page --> exiting !!!</h1>');
16 18
 }
19
+}
17 20
 
18 21
 // raw replacements
19 22
 $add_use_api = array(
@@ -192,9 +195,16 @@  discard block
 block discarded – undo
192 195
 function fix_api($file, $dry_run=false)
193 196
 {
194 197
 	global $prog, $replace, $add_use_api;
195
-	if (basename($file) == $prog) return true;	// dont fix ourself ;-)
198
+	if (basename($file) == $prog)
199
+	{
200
+		return true;
201
+	}
202
+	// dont fix ourself ;-)
196 203
 
197
-	if (($content = $content_in = file_get_contents($file)) === false) return false;
204
+	if (($content = $content_in = file_get_contents($file)) === false)
205
+	{
206
+		return false;
207
+	}
198 208
 
199 209
 	if (!preg_match("|<\?php\n+\s*/\*\*?.*\*/|msU", $content))
200 210
 	{
@@ -203,7 +213,11 @@  discard block
 block discarded – undo
203 213
 	}
204 214
 	$content2 = preg_replace(array_keys($replace), array_values($replace), $content);
205 215
 
206
-	if ($content2 == $content_in) return true;	// nothing changed
216
+	if ($content2 == $content_in)
217
+	{
218
+		return true;
219
+	}
220
+	// nothing changed
207 221
 
208 222
 	$content = preg_replace(array_keys($add_use_api), array_values($add_use_api), $content2);
209 223
 
@@ -249,11 +263,17 @@  discard block
 block discarded – undo
249 263
  */
250 264
 function fix_api_recursive($dir, $dry_run=false)
251 265
 {
252
-	if (!is_dir($dir)) return false;
266
+	if (!is_dir($dir))
267
+	{
268
+		return false;
269
+	}
253 270
 
254 271
 	foreach(scandir($dir) as $file)
255 272
 	{
256
-		if ($file == '.' || $file == '..') continue;
273
+		if ($file == '.' || $file == '..')
274
+		{
275
+			continue;
276
+		}
257 277
 
258 278
 		if (is_dir($dir.'/'.$file))
259 279
 		{
@@ -278,14 +298,20 @@  discard block
 block discarded – undo
278 298
 {
279 299
 	global $prog;
280 300
 	echo "Usage: $prog [-h|--help] [-d|--dry-run] file(s) or dir(s)\n\n";
281
-	if ($error) echo $error."\n\n";
301
+	if ($error)
302
+	{
303
+		echo $error."\n\n";
304
+	}
282 305
 	exit($error ? 1 : 0);
283 306
 }
284 307
 
285 308
 $args = $_SERVER['argv'];
286 309
 $prog = basename(array_shift($args));
287 310
 
288
-if (!$args) usage();
311
+if (!$args)
312
+{
313
+	usage();
314
+}
289 315
 
290 316
 $dry_run = false;
291 317
 while(($arg = array_shift($args)) && $arg[0] == '-')
@@ -303,16 +329,22 @@  discard block
 block discarded – undo
303 329
 			break;
304 330
 
305 331
 		default:
306
-			if ($args)	// not last argument
332
+			if ($args)
333
+			{
334
+				// not last argument
307 335
 			{
308 336
 				usage("Unknown argument '$arg'!");
309 337
 			}
338
+			}
310 339
 			break 2;
311 340
 	}
312 341
 }
313 342
 
314 343
 do {
315
-	if (!file_exists($arg)) usage("Error: $arg not found!");
344
+	if (!file_exists($arg))
345
+	{
346
+		usage("Error: $arg not found!");
347
+	}
316 348
 
317 349
 	if (!is_dir($arg))
318 350
 	{
Please login to merge, or discard this patch.
doc/fix_depricated.php 3 patches
Doc Comments   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  * Fix depricated stuff in a given file
24 24
  *
25 25
  * @param string $file filename
26
- * @param boolean $replace_file=false replace existing file if modifications are necessary, otherwise .php53 file is created
26
+ * @param boolean $replace_file replace existing file if modifications are necessary, otherwise .php53 file is created
27 27
  * @return boolean false on error
28 28
  */
29 29
 function fix_depricated($file,$replace_file=false)
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
  * Loop recursive through directory and call fix_depricated for each php file
147 147
  *
148 148
  * @param string $dir
149
- * @param boolean $replace_file=false replace existing file if modifications are necessary, otherwise .php53 file is created
149
+ * @param boolean $replace_file replace existing file if modifications are necessary, otherwise .php53 file is created
150 150
  * @return boolean false on error
151 151
  */
152 152
 function fix_depricated_recursive($dir,$replace_file=false)
@@ -174,7 +174,6 @@  discard block
 block discarded – undo
174 174
 /**
175 175
  * Give usage
176 176
  *
177
- * @param string $error=null
178 177
  */
179 178
 function usage($error=null)
180 179
 {
Please login to merge, or discard this patch.
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -26,47 +26,47 @@  discard block
 block discarded – undo
26 26
  * @param boolean $replace_file=false replace existing file if modifications are necessary, otherwise .php53 file is created
27 27
  * @return boolean false on error
28 28
  */
29
-function fix_depricated($file,$replace_file=false)
29
+function fix_depricated($file, $replace_file = false)
30 30
 {
31 31
 	$orig = $lines = file_get_contents($file);
32 32
 	if ($lines === false) return false;
33 33
 	global $prog;
34
-	if (basename($file) == $prog) return true;	// dont fix ourself ;-)
34
+	if (basename($file) == $prog) return true; // dont fix ourself ;-)
35 35
 
36 36
 	// PHP Deprecated:  Assigning the return value of new by reference is deprecated
37
-	if (preg_match('/= *& *new /m',$lines))
37
+	if (preg_match('/= *& *new /m', $lines))
38 38
 	{
39
-		$lines = preg_replace('/= *& *new /','= new ',$lines);
39
+		$lines = preg_replace('/= *& *new /', '= new ', $lines);
40 40
 	}
41 41
 	// PHP Deprecated:  Function split() is deprecated
42
-	if (preg_match_all('/[= \t(]+spliti? *\\(("[^"]*"|\'[^\']*\'),/m',$lines,$matches))
42
+	if (preg_match_all('/[= \t(]+spliti? *\\(("[^"]*"|\'[^\']*\'),/m', $lines, $matches))
43 43
 	{
44 44
 		$replace = array();
45 45
 		//print_r($matches);
46
-		foreach($matches[1] as $key => $pattern)
46
+		foreach ($matches[1] as $key => $pattern)
47 47
 		{
48 48
 			$full_pattern = $matches[0][$key];
49 49
 			// single char --> just explode
50
-			if (strlen($pattern) == 3 || strlen($pattern) == 4 && substr($pattern,0,2) == '"\\')
50
+			if (strlen($pattern) == 3 || strlen($pattern) == 4 && substr($pattern, 0, 2) == '"\\')
51 51
 			{
52
-				$replace[$full_pattern] = str_replace('split','explode',$full_pattern);
52
+				$replace[$full_pattern] = str_replace('split', 'explode', $full_pattern);
53 53
 			}
54 54
 			else
55 55
 			{
56
-				$preg_pattern = $pattern[0].'/'.str_replace('/','\\\\/',substr($pattern,1,-1)).'/'.$pattern[0];
57
-				if (strpos($full_pattern,'spliti')) $preg_pattern = substr($preg_pattern,0,-1).'i'.$pattern[0];
58
-				$replace[$full_pattern] = str_replace(array('spliti','split',$pattern),array('preg_split','preg_split',$preg_pattern),$full_pattern);
56
+				$preg_pattern = $pattern[0].'/'.str_replace('/', '\\\\/', substr($pattern, 1, -1)).'/'.$pattern[0];
57
+				if (strpos($full_pattern, 'spliti')) $preg_pattern = substr($preg_pattern, 0, -1).'i'.$pattern[0];
58
+				$replace[$full_pattern] = str_replace(array('spliti', 'split', $pattern), array('preg_split', 'preg_split', $preg_pattern), $full_pattern);
59 59
 			}
60 60
 		}
61 61
 		//print_r($replace);
62
-		$lines = strtr($lines,$replace);
62
+		$lines = strtr($lines, $replace);
63 63
 	}
64 64
 	// PHP Deprecated:  Function ereg() is deprecated
65
-	if (preg_match_all('/!?eregi? *\\(("[^"]+"[^,]*|\'[^\']+\'[^,]*), *(\$[A-Za-z0-9_\[\]\$\'\"]+)(, *\$[A-Za-z0-9_\[\]\$\'\"]+)?\)([ )&|]+)/m',$lines,$matches))
65
+	if (preg_match_all('/!?eregi? *\\(("[^"]+"[^,]*|\'[^\']+\'[^,]*), *(\$[A-Za-z0-9_\[\]\$\'\"]+)(, *\$[A-Za-z0-9_\[\]\$\'\"]+)?\)([ )&|]+)/m', $lines, $matches))
66 66
 	{
67 67
 		$replace = array();
68 68
 		//print_r($matches);
69
-		foreach($matches[1] as $key => $pattern)
69
+		foreach ($matches[1] as $key => $pattern)
70 70
 		{
71 71
 			$full_pattern = $matches[0][$key];
72 72
 			$what = $matches[2][$key];
@@ -75,25 +75,25 @@  discard block
 block discarded – undo
75 75
 			if (preg_quote($pattern) == $pattern)
76 76
 			{
77 77
 
78
-				$replace[$full_pattern] = (strpos($full_pattern,'eregi')!==false?'strposi':'strpos').'('.$what.','.$pattern.
79
-					') '.($full_pattern[0]=='!'?'===':'!==').' false'.$matches[4][$key];
78
+				$replace[$full_pattern] = (strpos($full_pattern, 'eregi') !== false ? 'strposi' : 'strpos').'('.$what.','.$pattern.
79
+					') '.($full_pattern[0] == '!' ? '===' : '!==').' false'.$matches[4][$key];
80 80
 			}
81 81
 			else
82 82
 			{
83 83
 				// full ereg regular expression --> preg_match
84
-				$preg_pattern = "'/'.".str_replace('/','\\\\/',$pattern).(strpos($full_pattern,'eregi') !== false ? ".'/i'" : ".'/'");
85
-				$replace[$full_pattern] = str_replace(array('eregi','ereg',$pattern),array('preg_match','preg_match',$preg_pattern),$full_pattern);
84
+				$preg_pattern = "'/'.".str_replace('/', '\\\\/', $pattern).(strpos($full_pattern, 'eregi') !== false ? ".'/i'" : ".'/'");
85
+				$replace[$full_pattern] = str_replace(array('eregi', 'ereg', $pattern), array('preg_match', 'preg_match', $preg_pattern), $full_pattern);
86 86
 			}
87 87
 		}
88 88
 		//print_r($replace);
89
-		$lines = strtr($lines,$replace);
89
+		$lines = strtr($lines, $replace);
90 90
 	}
91 91
 	// PHP Deprecated:  Function ereg_replace() is deprecated
92
-	if (preg_match_all('/eregi?_replace *\\((".+"|\'.+\'|[^,]+), *(.+), *[\'s$].+\)[,; =]/m',$lines,$matches))
92
+	if (preg_match_all('/eregi?_replace *\\((".+"|\'.+\'|[^,]+), *(.+), *[\'s$].+\)[,; =]/m', $lines, $matches))
93 93
 	{
94 94
 		$replace = array();
95 95
 		//print_r($matches);
96
-		foreach($matches[1] as $key => $pattern)
96
+		foreach ($matches[1] as $key => $pattern)
97 97
 		{
98 98
 			$full_pattern = $matches[0][$key];
99 99
 			$other = $matches[2][$key];
@@ -101,41 +101,41 @@  discard block
 block discarded – undo
101 101
 			// simple replace --> use str_replace()
102 102
 			if (preg_quote($pattern) == $pattern)
103 103
 			{
104
-				$replace[$full_pattern] = str_replace(array('eregi_replace','ereg_replace'),array('stri_replace','str_replace'),$full_pattern);
104
+				$replace[$full_pattern] = str_replace(array('eregi_replace', 'ereg_replace'), array('stri_replace', 'str_replace'), $full_pattern);
105 105
 			}
106 106
 			else
107 107
 			{
108 108
 				// full ereg regular expression --> preg_replace
109
-				$preg_pattern = "'/'.".str_replace('/','\\\\/',$pattern).(strpos($full_pattern,'eregi') !== false ? ".'/i'" : ".'/'");
110
-				$replace[$full_pattern] = str_replace(array('eregi_replace','ereg_replace',$pattern),
111
-					array('preg_replace','preg_replace',$preg_pattern),$full_pattern);
109
+				$preg_pattern = "'/'.".str_replace('/', '\\\\/', $pattern).(strpos($full_pattern, 'eregi') !== false ? ".'/i'" : ".'/'");
110
+				$replace[$full_pattern] = str_replace(array('eregi_replace', 'ereg_replace', $pattern),
111
+					array('preg_replace', 'preg_replace', $preg_pattern), $full_pattern);
112 112
 			}
113 113
 		}
114 114
 		//print_r($replace);
115
-		$lines = strtr($lines,$replace);
115
+		$lines = strtr($lines, $replace);
116 116
 	}
117 117
 	// remove extra '/' from regular expressions
118
-	$lines = str_replace(array("'/'.'","'.'/'","'.'/i'"),array("'/","/'","/i'"),$lines);
118
+	$lines = str_replace(array("'/'.'", "'.'/'", "'.'/i'"), array("'/", "/'", "/i'"), $lines);
119 119
 
120 120
 	// fix call to not longer existing PDO method $result->fetchSingle()
121
-	$lines = str_replace('->fetchSingle(','->fetchColumn(',$lines);
121
+	$lines = str_replace('->fetchSingle(', '->fetchColumn(', $lines);
122 122
 
123 123
 	// fix calls to deprecated call_user_method(_array)?(method,object[,args])
124
-	if (preg_match('/call_user_method(_array)?\(/',$lines,$matches))
124
+	if (preg_match('/call_user_method(_array)?\(/', $lines, $matches))
125 125
 	{
126
-		$lines = preg_replace('/call_user_method\(([^,]+),([^,\)]+)([,)])/','call_user_func(array(\\2,\\1)\\3',$lines);
127
-		$lines = preg_replace('/call_user_method_array\(([^,]+),([^,\)]+)([,)])/','call_user_func_array(array(\\2,\\1)\\3',$lines);
126
+		$lines = preg_replace('/call_user_method\(([^,]+),([^,\)]+)([,)])/', 'call_user_func(array(\\2,\\1)\\3', $lines);
127
+		$lines = preg_replace('/call_user_method_array\(([^,]+),([^,\)]+)([,)])/', 'call_user_func_array(array(\\2,\\1)\\3', $lines);
128 128
 	}
129 129
 
130 130
 	if ($lines != $orig)
131 131
 	{
132
-		file_put_contents($file.'53',$lines);
133
-		system('/usr/bin/php -l '.$file.'53',$ret);
132
+		file_put_contents($file.'53', $lines);
133
+		system('/usr/bin/php -l '.$file.'53', $ret);
134 134
 		system('/usr/bin/diff -u '.$file.' '.$file.'53');
135 135
 		if (!$ret && $replace_file)
136 136
 		{
137 137
 			unlink($file);
138
-			rename($file.'53',$file);
138
+			rename($file.'53', $file);
139 139
 		}
140 140
 		return !$ret;
141 141
 	}
@@ -149,25 +149,25 @@  discard block
 block discarded – undo
149 149
  * @param boolean $replace_file=false replace existing file if modifications are necessary, otherwise .php53 file is created
150 150
  * @return boolean false on error
151 151
  */
152
-function fix_depricated_recursive($dir,$replace_file=false)
152
+function fix_depricated_recursive($dir, $replace_file = false)
153 153
 {
154 154
 	if (!is_dir($dir)) return false;
155 155
 
156
-	foreach(scandir($dir) as $file)
156
+	foreach (scandir($dir) as $file)
157 157
 	{
158 158
 		if ($file == '.' || $file == '..') continue;
159 159
 
160 160
 		if (is_dir($dir.'/'.$file))
161 161
 		{
162
-			fix_depricated_recursive($dir.'/'.$file,$replace_file);
162
+			fix_depricated_recursive($dir.'/'.$file, $replace_file);
163 163
 		}
164
-		elseif(substr($file,-4) == '.php')
164
+		elseif (substr($file, -4) == '.php')
165 165
 		{
166
-			echo "\r".str_repeat(' ',100)."\r".$dir.'/'.$file.': ';
167
-			fix_depricated($dir.'/'.$file,$replace_file);
166
+			echo "\r".str_repeat(' ', 100)."\r".$dir.'/'.$file.': ';
167
+			fix_depricated($dir.'/'.$file, $replace_file);
168 168
 		}
169 169
 	}
170
-	echo "\r".str_repeat(' ',100)."\r";
170
+	echo "\r".str_repeat(' ', 100)."\r";
171 171
 	return true;
172 172
 }
173 173
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
  *
177 177
  * @param string $error=null
178 178
  */
179
-function usage($error=null)
179
+function usage($error = null)
180 180
 {
181 181
 	global $prog;
182 182
 	echo "Usage: $prog [--replace] [-h|--help] file or dir\n\n";
@@ -190,9 +190,9 @@  discard block
 block discarded – undo
190 190
 if (!$args) usage();
191 191
 
192 192
 $replace_file = false;
193
-while(($arg = array_shift($args)))
193
+while (($arg = array_shift($args)))
194 194
 {
195
-	switch($arg)
195
+	switch ($arg)
196 196
 	{
197 197
 		case '-h':
198 198
 		case '--help':
@@ -216,9 +216,9 @@  discard block
 block discarded – undo
216 216
 
217 217
 if (!is_dir($arg))
218 218
 {
219
-	fix_depricated($arg,$replace_file);
219
+	fix_depricated($arg, $replace_file);
220 220
 }
221 221
 else
222 222
 {
223
-	fix_depricated_recursive($arg,$replace_file);
223
+	fix_depricated_recursive($arg, $replace_file);
224 224
 }
225 225
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +41 added lines, -10 removed lines patch added patch discarded remove patch
@@ -14,10 +14,13 @@  discard block
 block discarded – undo
14 14
  * @version $Id$
15 15
  */
16 16
 
17
-if (php_sapi_name() !== 'cli')	// security precaution: forbit calling as web-page
17
+if (php_sapi_name() !== 'cli')
18
+{
19
+	// security precaution: forbit calling as web-page
18 20
 {
19 21
 	die('<h1>fix_depricated.php must NOT be called as web-page --> exiting !!!</h1>');
20 22
 }
23
+}
21 24
 
22 25
 /**
23 26
  * Fix depricated stuff in a given file
@@ -29,9 +32,16 @@  discard block
 block discarded – undo
29 32
 function fix_depricated($file,$replace_file=false)
30 33
 {
31 34
 	$orig = $lines = file_get_contents($file);
32
-	if ($lines === false) return false;
35
+	if ($lines === false)
36
+	{
37
+		return false;
38
+	}
33 39
 	global $prog;
34
-	if (basename($file) == $prog) return true;	// dont fix ourself ;-)
40
+	if (basename($file) == $prog)
41
+	{
42
+		return true;
43
+	}
44
+	// dont fix ourself ;-)
35 45
 
36 46
 	// PHP Deprecated:  Assigning the return value of new by reference is deprecated
37 47
 	if (preg_match('/= *& *new /m',$lines))
@@ -54,7 +64,10 @@  discard block
 block discarded – undo
54 64
 			else
55 65
 			{
56 66
 				$preg_pattern = $pattern[0].'/'.str_replace('/','\\\\/',substr($pattern,1,-1)).'/'.$pattern[0];
57
-				if (strpos($full_pattern,'spliti')) $preg_pattern = substr($preg_pattern,0,-1).'i'.$pattern[0];
67
+				if (strpos($full_pattern,'spliti'))
68
+				{
69
+					$preg_pattern = substr($preg_pattern,0,-1).'i'.$pattern[0];
70
+				}
58 71
 				$replace[$full_pattern] = str_replace(array('spliti','split',$pattern),array('preg_split','preg_split',$preg_pattern),$full_pattern);
59 72
 			}
60 73
 		}
@@ -151,11 +164,17 @@  discard block
 block discarded – undo
151 164
  */
152 165
 function fix_depricated_recursive($dir,$replace_file=false)
153 166
 {
154
-	if (!is_dir($dir)) return false;
167
+	if (!is_dir($dir))
168
+	{
169
+		return false;
170
+	}
155 171
 
156 172
 	foreach(scandir($dir) as $file)
157 173
 	{
158
-		if ($file == '.' || $file == '..') continue;
174
+		if ($file == '.' || $file == '..')
175
+		{
176
+			continue;
177
+		}
159 178
 
160 179
 		if (is_dir($dir.'/'.$file))
161 180
 		{
@@ -180,14 +199,20 @@  discard block
 block discarded – undo
180 199
 {
181 200
 	global $prog;
182 201
 	echo "Usage: $prog [--replace] [-h|--help] file or dir\n\n";
183
-	if ($error) echo $error."\n\n";
202
+	if ($error)
203
+	{
204
+		echo $error."\n\n";
205
+	}
184 206
 	exit($error ? 1 : 0);
185 207
 }
186 208
 
187 209
 $args = $_SERVER['argv'];
188 210
 $prog = basename(array_shift($args));
189 211
 
190
-if (!$args) usage();
212
+if (!$args)
213
+{
214
+	usage();
215
+}
191 216
 
192 217
 $replace_file = false;
193 218
 while(($arg = array_shift($args)))
@@ -204,15 +229,21 @@  discard block
 block discarded – undo
204 229
 			break;
205 230
 
206 231
 		default:
207
-			if ($args)	// not last argument
232
+			if ($args)
233
+			{
234
+				// not last argument
208 235
 			{
209 236
 				usage("Unknown argument '$arg'!");
210 237
 			}
238
+			}
211 239
 			break 2;
212 240
 	}
213 241
 }
214 242
 
215
-if (!file_exists($arg)) usage("Error: $arg not found!");
243
+if (!file_exists($arg))
244
+{
245
+	usage("Error: $arg not found!");
246
+}
216 247
 
217 248
 if (!is_dir($arg))
218 249
 {
Please login to merge, or discard this patch.
doc/rpm-build/checkout-build-archives.php 4 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -464,6 +464,7 @@  discard block
 block discarded – undo
464 464
  *
465 465
  * @param string $name
466 466
  * @param string $value =null value to use, default $config[$name]
467
+ * @return string
467 468
  */
468 469
 function config_translate($name, $value=null)
469 470
 {
@@ -1194,7 +1195,7 @@  discard block
 block discarded – undo
1194 1195
  * Runs given shell command, exists with error-code after echoing the output of the failed command (if not already running verbose)
1195 1196
  *
1196 1197
  * @param string $cmd
1197
- * @param array& $output=null $output of command, only if !$verbose !!!
1198
+ * @param array& $output $output of command, only if !$verbose !!!
1198 1199
  * @param int|array $no_bailout =null exit code(s) to NOT bail out
1199 1200
  * @return int exit code of $cmd
1200 1201
  */
Please login to merge, or discard this patch.
Braces   +236 added lines, -58 removed lines patch added patch discarded remove patch
@@ -10,10 +10,13 @@  discard block
 block discarded – undo
10 10
  * @version $Id$
11 11
  */
12 12
 
13
-if (php_sapi_name() !== 'cli')	// security precaution: forbit calling setup-cli as web-page
13
+if (php_sapi_name() !== 'cli')
14
+{
15
+	// security precaution: forbit calling setup-cli as web-page
14 16
 {
15 17
 	die('<h1>checkout-build-archives.php must NOT be called as web-page --> exiting !!!</h1>');
16 18
 }
19
+}
17 20
 date_default_timezone_set('Europe/Berlin');	// to get ride of 5.3 warnings
18 21
 
19 22
 $verbose = 0;
@@ -137,7 +140,10 @@  discard block
 block discarded – undo
137 140
 			case 'release':
138 141
 			case 'copychangelog':
139 142
 				$config[$name] = $value;
140
-				if ($value) array_unshift($config['run'],$name);
143
+				if ($value)
144
+				{
145
+					array_unshift($config['run'],$name);
146
+				}
141 147
 				break;
142 148
 
143 149
 			case 'editchangelog':
@@ -153,7 +159,10 @@  discard block
 block discarded – undo
153 159
 				{
154 160
 					usage("Path '$value' not found!");
155 161
 				}
156
-				if (!in_array('obs',$config['run'])) $config['run'][] = 'obs';
162
+				if (!in_array('obs',$config['run']))
163
+				{
164
+					$config['run'][] = 'obs';
165
+				}
157 166
 				// fall through
158 167
 			default:
159 168
 				$config[$name] = $value;
@@ -211,7 +220,10 @@  discard block
 block discarded – undo
211 220
 	}
212 221
 
213 222
 	$cmd = $config['git'].' log '.escapeshellarg($last_tag.'..HEAD');
214
-	if (getcwd() != $path) $cmd = 'cd '.$path.'; '.$cmd;
223
+	if (getcwd() != $path)
224
+	{
225
+		$cmd = 'cd '.$path.'; '.$cmd;
226
+	}
215 227
 	$output = null;
216 228
 	run_cmd($cmd, $output);
217 229
 
@@ -242,7 +254,10 @@  discard block
 block discarded – undo
242 254
 {
243 255
 	global $config, $verbose;
244 256
 
245
-	if ($verbose) echo "Get modules from .mrconfig in checkoutdir $config[checkoutdir]\n";
257
+	if ($verbose)
258
+	{
259
+		echo "Get modules from .mrconfig in checkoutdir $config[checkoutdir]\n";
260
+	}
246 261
 
247 262
 	if (!is_dir($config['checkoutdir']))
248 263
 	{
@@ -273,12 +288,21 @@  discard block
 block discarded – undo
273 288
 		elseif (isset($module) && preg_match('/^checkout\s*=\s*(git\s+clone\s+(-b\s+[0-9.]+\s+)?((git|http)[^ ]+)|svn\s+checkout\s+((svn|http)[^ ]+))/', $line, $matches))
274 289
 		{
275 290
 			$repo = $url = substr($matches[1], 0, 3) == 'svn' ? $matches[5] : $matches[3];
276
-			if (substr($matches[1], 0, 3) == 'svn') $repo = preg_replace('#/(trunk|branches)/.*$#', '', $repo);
291
+			if (substr($matches[1], 0, 3) == 'svn')
292
+			{
293
+				$repo = preg_replace('#/(trunk|branches)/.*$#', '', $repo);
294
+			}
277 295
 			$modules[$repo][$config['aliasdir'].($module ? '/'.$module : '')] = $url;
278
-			if ($module === '' && !isset($baseurl)) $baseurl = str_replace('/egroupware.git', '', $url);
296
+			if ($module === '' && !isset($baseurl))
297
+			{
298
+				$baseurl = str_replace('/egroupware.git', '', $url);
299
+			}
279 300
 		}
280 301
 	}
281
-	if ($verbose) print_r($modules);
302
+	if ($verbose)
303
+	{
304
+		print_r($modules);
305
+	}
282 306
 	return $modules;
283 307
 }
284 308
 
@@ -345,7 +369,11 @@  discard block
 block discarded – undo
345 369
 
346 370
 	$config['tag'] = config_translate('tag');	// allow to use config vars like $version in tag
347 371
 
348
-	if (empty($config['tag'])) return;	// otherwise we copy everything in svn root!
372
+	if (empty($config['tag']))
373
+	{
374
+		return;
375
+	}
376
+	// otherwise we copy everything in svn root!
349 377
 
350 378
 	echo "Creating tag $config[tag]\n";
351 379
 
@@ -361,7 +389,10 @@  discard block
 block discarded – undo
361 389
 	global $config,$verbose;
362 390
 
363 391
 	// push local changes to Github incl. tags
364
-	if ($verbose) echo "Pushing changes and tags\n";
392
+	if ($verbose)
393
+	{
394
+		echo "Pushing changes and tags\n";
395
+	}
365 396
 	chdir($config['checkoutdir']);
366 397
 	run_cmd($config['mr']. ' up');		// in case someone else pushed something
367 398
 	chdir($config['checkoutdir']);
@@ -429,7 +460,10 @@  discard block
 block discarded – undo
429 460
 		{
430 461
 			continue;
431 462
 		}
432
-		if ($verbose) echo "Uploading $path as $content_type\n";
463
+		if ($verbose)
464
+		{
465
+			echo "Uploading $path as $content_type\n";
466
+		}
433 467
 		$name = basename($path);
434 468
 		github_api($config['upload_url'], array(
435 469
 			'name' => $name,
@@ -441,7 +475,10 @@  discard block
 block discarded – undo
441 475
 	{
442 476
 		$target = config_translate('release');	// allow to use config vars like $svnbranch in module
443 477
 		$cmd = $config['rsync'].' '.$archives.' '.$target;
444
-		if ($verbose) echo $cmd."\n";
478
+		if ($verbose)
479
+		{
480
+			echo $cmd."\n";
481
+		}
445 482
 		passthru($cmd);
446 483
 	}
447 484
 }
@@ -474,25 +511,40 @@  discard block
 block discarded – undo
474 511
 	{
475 512
 		case 'POST':
476 513
 			curl_setopt($c, CURLOPT_POST, true);
477
-			if (is_array($data)) $data = json_encode($data, JSON_FORCE_OBJECT);
514
+			if (is_array($data))
515
+			{
516
+				$data = json_encode($data, JSON_FORCE_OBJECT);
517
+			}
478 518
 			curl_setopt($c, CURLOPT_POSTFIELDS, $data);
479 519
 			break;
480 520
 		case 'GET':
481
-			if(count($data)) $url .= '?' . http_build_query($data);
521
+			if(count($data))
522
+			{
523
+				$url .= '?' . http_build_query($data);
524
+			}
482 525
 			break;
483 526
 		case 'FILE':
484 527
 			curl_setopt($c, CURLOPT_HTTPHEADER, array("Content-type: $content_type"));
485 528
 			curl_setopt($c, CURLOPT_POST, true);
486 529
 			curl_setopt($c, CURLOPT_POSTFIELDS, file_get_contents($upload));
487
-			if(count($data)) $url .= '?' . http_build_query($data);
530
+			if(count($data))
531
+			{
532
+				$url .= '?' . http_build_query($data);
533
+			}
488 534
 			break;
489 535
 		default:
490 536
 			throw new Exception(__FUNCTION__.": Unknown/unimplemented method=$method!");
491 537
 	}
492 538
 	curl_setopt($c, CURLOPT_URL, $url);
493 539
 
494
-	if (is_string($data)) $short_data = strlen($data) > 100 ? substr($data, 0, 100).' ...' : $data;
495
-	if ($verbose) echo "Sending $method request to $url ".(isset($short_data)&&$method!='GET'?$short_data:'')."\n";
540
+	if (is_string($data))
541
+	{
542
+		$short_data = strlen($data) > 100 ? substr($data, 0, 100).' ...' : $data;
543
+	}
544
+	if ($verbose)
545
+	{
546
+		echo "Sending $method request to $url ".(isset($short_data)&&$method!='GET'?$short_data:'')."\n";
547
+	}
496 548
 
497 549
 	if (($response = curl_exec($c)) === false)
498 550
 	{
@@ -503,7 +555,10 @@  discard block
 block discarded – undo
503 555
 		throw new Exception("$method request to $url failed ".(isset($short_data)&&$method!='GET'?$short_data:''));
504 556
 	}
505 557
 
506
-	if ($verbose) echo (strlen($response) > 200 ? substr($response, 0, 200).' ...' : $response)."\n";
558
+	if ($verbose)
559
+	{
560
+		echo (strlen($response) > 200 ? substr($response, 0, 200).' ...' : $response)."\n";
561
+	}
507 562
 
508 563
 	curl_close($c);
509 564
 
@@ -520,13 +575,19 @@  discard block
 block discarded – undo
520 575
 {
521 576
 	global $config;
522 577
 
523
-	if (!isset($value)) $value = $config[$name];
578
+	if (!isset($value))
579
+	{
580
+		$value = $config[$name];
581
+	}
524 582
 	if (is_string($value) && strpos($value, '$') !== false)
525 583
 	{
526 584
 		$translate = array();
527 585
 		foreach($config as $n => $val)
528 586
 		{
529
-			if (is_string($val)) $translate['$'.$n] = $val;
587
+			if (is_string($val))
588
+			{
589
+				$translate['$'.$n] = $val;
590
+			}
530 591
 		}
531 592
 		$value = strtr($value, $translate);
532 593
 	}
@@ -628,7 +689,10 @@  discard block
 block discarded – undo
628 689
 	if (is_null($revision))
629 690
 	{
630 691
 		list($tags_url,$branch) = preg_split('#/(branches/|trunk)#',$branch_url);
631
-		if (empty($branch)) $branch = $config['version'];
692
+		if (empty($branch))
693
+		{
694
+			$branch = $config['version'];
695
+		}
632 696
 		$tags_url .= '/tags';
633 697
 		$pattern='|/tags/('.preg_quote($config['version'], '|').'\.[0-9.]+)|';
634 698
 		$matches = null;
@@ -654,11 +718,18 @@  discard block
 block discarded – undo
654 718
 	$message = '';
655 719
 	foreach($xml as $log)
656 720
 	{
657
-		if (!($msg = _match_log_pattern($log->msg, $log_pattern, $prefix))) continue;	// no match --> ignore
721
+		if (!($msg = _match_log_pattern($log->msg, $log_pattern, $prefix)))
722
+		{
723
+			continue;
724
+		}
725
+		// no match --> ignore
658 726
 
659 727
 		$message .= $msg."\n";
660 728
 	}
661
-	if ($verbose) echo $message;
729
+	if ($verbose)
730
+	{
731
+		echo $message;
732
+	}
662 733
 
663 734
 	return $message;
664 735
 }
@@ -689,7 +760,10 @@  discard block
 block discarded – undo
689 760
 	{
690 761
 		return null;
691 762
 	}
692
-	if ($prefix_len && substr($msg,0,$prefix_len) != $prefix) $msg = $prefix.$msg;
763
+	if ($prefix_len && substr($msg,0,$prefix_len) != $prefix)
764
+	{
765
+		$msg = $prefix.$msg;
766
+	}
693 767
 
694 768
 	return $msg;
695 769
 }
@@ -726,7 +800,10 @@  discard block
 block discarded – undo
726 800
 		if (!$is_regexp && strpos($log->paths->path, $pattern) !== false ||
727 801
 			$is_regexp && preg_match($pattern, $log->paths->path, $matches))
728 802
 		{
729
-			if ($verbose) echo "Revision {$log['revision']} matches".($matches?': '.$matches[1] : '')."\n";
803
+			if ($verbose)
804
+			{
805
+				echo "Revision {$log['revision']} matches".($matches?': '.$matches[1] : '')."\n";
806
+			}
730 807
 			return (int)$log['revision'];
731 808
 		}
732 809
 	}
@@ -746,7 +823,10 @@  discard block
 block discarded – undo
746 823
 	{
747 824
 		usage("Path '$config[obs]' not found!");
748 825
 	}
749
-	if ($verbose) echo $only_update_changelog ? "Updating OBS changelogs\n" : "Updating OBS checkout\n";
826
+	if ($verbose)
827
+	{
828
+		echo $only_update_changelog ? "Updating OBS changelogs\n" : "Updating OBS checkout\n";
829
+	}
750 830
 	run_cmd('osc up '.$config['obs']);
751 831
 
752 832
 	$n = 0;
@@ -766,10 +846,16 @@  discard block
 block discarded – undo
766 846
 			if (basename($path) != basename($new_name))
767 847
 			{
768 848
 				unlink($path);
769
-				if ($verbose) echo "rm $path\n";
849
+				if ($verbose)
850
+				{
851
+					echo "rm $path\n";
852
+				}
770 853
 			}
771 854
 			copy($new_name,dirname($path).'/'.basename($new_name));
772
-			if ($verbose) echo "cp $new_name ".dirname($path)."/\n";
855
+			if ($verbose)
856
+			{
857
+				echo "cp $new_name ".dirname($path)."/\n";
858
+			}
773 859
 			++$n;
774 860
 		}
775 861
 		// if we have no changelog (eg. because commands run separate), try parsing it from changelog file
@@ -807,7 +893,10 @@  discard block
 block discarded – undo
807 893
 			if ($content != $content_was)
808 894
 			{
809 895
 				file_put_contents($path,$content);
810
-				if ($verbose) echo "Updated $path\n";
896
+				if ($verbose)
897
+				{
898
+					echo "Updated $path\n";
899
+				}
811 900
 				++$n;
812 901
 			}
813 902
 		}
@@ -845,9 +934,12 @@  discard block
 block discarded – undo
845 934
 			}
846 935
 			$n += empty($lines[$n+1]) ? 2 : 1;	// overead empty line behind header
847 936
 			$logentry = '';
848
-			while($lines[$n])	// entry is terminated by empty line
937
+			while($lines[$n])
938
+			{
939
+				// entry is terminated by empty line
849 940
 			{
850 941
 				$logentry .= (substr($lines[$n], 0, 2) == '  ' ? substr($lines[$n], 2) : $lines[$n])."\n";
942
+			}
851 943
 				++$n;
852 944
 			}
853 945
 			return substr($logentry, 0, -1);	// remove training "\n"
@@ -868,7 +960,10 @@  discard block
 block discarded – undo
868 960
 
869 961
 	list($header) = explode("\n", $content);
870 962
 	$new_header = preg_replace('/\('.preg_quote($config['version']).'\.[0-9.]+[0-9](.*)\)/','('.$config['version'].'.'.$config['packaging'].'\\1)', $header);
871
-	if (substr($config['changelog'],0,2) != '  ') $config['changelog'] = '  '.implode("\n  ",explode("\n",$config['changelog']));
963
+	if (substr($config['changelog'],0,2) != '  ')
964
+	{
965
+		$config['changelog'] = '  '.implode("\n  ",explode("\n",$config['changelog']));
966
+	}
872 967
 	$content = $new_header."\n\n".$config['changelog'].
873 968
 		"\n\n -- ".$config['changelog_packager'].'  '.date('r')."\n\n".$content;
874 969
 
@@ -882,10 +977,13 @@  discard block
 block discarded – undo
882 977
 {
883 978
 	global $config;
884 979
 
885
-	if (substr($config['sourcedir'],0,2) == '~/')	// sha1_file cant deal with '~/rpm'
980
+	if (substr($config['sourcedir'],0,2) == '~/')
981
+	{
982
+		// sha1_file cant deal with '~/rpm'
886 983
 	{
887 984
 		$config['sourcedir'] = getenv('HOME').substr($config['sourcedir'],1);
888 985
 	}
986
+	}
889 987
 	$sumsfile = $config['sourcedir'].'/sha1sum-'.$config['packagename'].'-'.$config['version'].'.'.$config['packaging'].'.txt';
890 988
 
891 989
 	if (!file_exists($sumsfile))
@@ -896,11 +994,17 @@  discard block
 block discarded – undo
896 994
 	// signing it
897 995
 	if (empty($config['gpg']) || !file_exists($config['gpg']))
898 996
 	{
899
-		if (!empty($config['gpg'])) echo "{$config['gpg']} not found --> skipping signing sha1sum file!\n";
997
+		if (!empty($config['gpg']))
998
+		{
999
+			echo "{$config['gpg']} not found --> skipping signing sha1sum file!\n";
1000
+		}
900 1001
 		return;
901 1002
 	}
902 1003
 	echo "Signing sha1sum file:\n";
903
-	if (file_exists($sumsfile.'.asc')) unlink($sumsfile.'.asc');
1004
+	if (file_exists($sumsfile.'.asc'))
1005
+	{
1006
+		unlink($sumsfile.'.asc');
1007
+	}
904 1008
 	$cmd = $config['gpg'].' --local-user '.$config['packager'].' --clearsign '.$sumsfile;
905 1009
 	run_cmd($cmd);
906 1010
 	unlink($sumsfile);	// delete the unsigned file
@@ -913,11 +1017,17 @@  discard block
 block discarded – undo
913 1017
 {
914 1018
 	global $config;
915 1019
 
916
-	if (!file_exists($config['sourcedir'])) mkdir($config['sourcedir'],0755,true);
917
-	if (substr($config['sourcedir'],0,2) == '~/')	// sha1_file cant deal with '~/rpm'
1020
+	if (!file_exists($config['sourcedir']))
1021
+	{
1022
+		mkdir($config['sourcedir'],0755,true);
1023
+	}
1024
+	if (substr($config['sourcedir'],0,2) == '~/')
1025
+	{
1026
+		// sha1_file cant deal with '~/rpm'
918 1027
 	{
919 1028
 		$config['sourcedir'] = getenv('HOME').substr($config['sourcedir'],1);
920 1029
 	}
1030
+	}
921 1031
 	$sumsfile = $config['sourcedir'].'/sha1sum-'.$config['packagename'].'-'.$config['version'].'.'.$config['packaging'].'.txt';
922 1032
 	$sums = '';
923 1033
 
@@ -955,12 +1065,22 @@  discard block
 block discarded – undo
955 1065
 				{
956 1066
 					foreach((array)$config['all-add'] as $add)
957 1067
 					{
958
-						if (substr($add, -4) != '.tar') continue;	// probably a module
959
-						if (!($tar = realpath($add))) throw new Exception("File '$add' not found!");
1068
+						if (substr($add, -4) != '.tar')
1069
+						{
1070
+							continue;
1071
+						}
1072
+						// probably a module
1073
+						if (!($tar = realpath($add)))
1074
+						{
1075
+							throw new Exception("File '$add' not found!");
1076
+						}
960 1077
 						$cmd .= '; '.$config['tar'].' --owner=root --group=root -Af '.$file.' '.$tar;
961 1078
 					}
962 1079
 				}
963
-				if (file_exists($file.'.bz2')) $cmd .= '; rm -f '.$file.'.bz2';
1080
+				if (file_exists($file.'.bz2'))
1081
+				{
1082
+					$cmd .= '; rm -f '.$file.'.bz2';
1083
+				}
964 1084
 				$cmd .= '; '.$config['bzip2'].' '.$file;
965 1085
 				// run cmd now and continue without adding all tar-ball to sums, as we dont want to publish it
966 1086
 				run_cmd($cmd);
@@ -981,7 +1101,10 @@  discard block
 block discarded – undo
981 1101
 
982 1102
 		foreach($config['extra'] as $name => $modules)
983 1103
 		{
984
-			if (is_numeric($name)) $name = $modules;
1104
+			if (is_numeric($name))
1105
+			{
1106
+				$name = $modules;
1107
+			}
985 1108
 			$dirs = ' egroupware/'.implode(' egroupware/', (array)$modules);
986 1109
 			$file = $config['sourcedir'].'/'.$config['packagename'].'-'.$name.'-'.$config['version'].'.'.$config['packaging'].'.'.$type;
987 1110
 			switch($type)
@@ -1022,7 +1145,10 @@  discard block
 block discarded – undo
1022 1145
 	{
1023 1146
 		echo "Updating virus signatures\n";
1024 1147
 		$cmd = '/usr/bin/sudo '.$config['freshclam'];
1025
-		if (!$verbose && function_exists('posix_getuid') && posix_getuid()) echo $cmd."\n";
1148
+		if (!$verbose && function_exists('posix_getuid') && posix_getuid())
1149
+		{
1150
+			echo $cmd."\n";
1151
+		}
1026 1152
 		$output = null;
1027 1153
 		run_cmd($cmd,$output,1);	// 1 = ignore already up to date database
1028 1154
 	}
@@ -1050,7 +1176,10 @@  discard block
 block discarded – undo
1050 1176
 	}
1051 1177
 
1052 1178
 	// we need to stash uncommited changes like .mrconfig, before copying
1053
-	if (file_exists($config['checkoutdir'].'/.git')) run_cmd("cd $config[checkoutdir]; git stash");
1179
+	if (file_exists($config['checkoutdir'].'/.git'))
1180
+	{
1181
+		run_cmd("cd $config[checkoutdir]; git stash");
1182
+	}
1054 1183
 
1055 1184
 	try {
1056 1185
 		$cmd = '/usr/bin/rsync -r --delete --delete-excluded --exclude .svn --exclude .git\* --exclude .mrconfig --exclude node_modules/ '.$config['checkoutdir'].'/ '.$config['egw_buildroot'].'/'.$config['aliasdir'].'/';
@@ -1059,8 +1188,14 @@  discard block
 block discarded – undo
1059 1188
 	catch (Exception $e) {
1060 1189
 		// catch failures to pop stash, before throwing exception
1061 1190
 	}
1062
-	if (file_exists($config['checkoutdir'].'/.git')) run_cmd("git stash pop");
1063
-	if (isset($e)) throw $e;
1191
+	if (file_exists($config['checkoutdir'].'/.git'))
1192
+	{
1193
+		run_cmd("git stash pop");
1194
+	}
1195
+	if (isset($e))
1196
+	{
1197
+		throw $e;
1198
+	}
1064 1199
 
1065 1200
 	if (($cmd = config_translate('patchCmd')) && $cmd[0] != '#')
1066 1201
 	{
@@ -1145,9 +1280,12 @@  discard block
 block discarded – undo
1145 1280
 				if ($ret || substr($line,0,5) == 'URL: ')
1146 1281
 				{
1147 1282
 					$url = substr($line,5);
1148
-					if ($ret || substr($url,0,strlen($svnbranch)) != $svnbranch)	// wrong branch (or no svn dir)
1283
+					if ($ret || substr($url,0,strlen($svnbranch)) != $svnbranch)
1284
+					{
1285
+						// wrong branch (or no svn dir)
1149 1286
 					{
1150 1287
 						echo "Checkout is of wrong branch --> deleting it\n";
1288
+					}
1151 1289
 						system('/bin/rm -rf .svn '.$config['aliasdir']);	// --> remove the whole checkout
1152 1290
 						clearstatcache();
1153 1291
 					}
@@ -1194,19 +1332,31 @@  discard block
 block discarded – undo
1194 1332
 	$svnbranch = $config['svnbase'].'/'.$config['svnbranch'];
1195 1333
 	$url = $svnbranch.'/'.$config['svnalias'];
1196 1334
 	$cmd = $svn.' propget svn:externals --strict '.$url;
1197
-	if ($verbose) echo $cmd."\n";
1335
+	if ($verbose)
1336
+	{
1337
+		echo $cmd."\n";
1338
+	}
1198 1339
 	$output = $ret = null;
1199 1340
 	exec($cmd,$output,$ret);
1200 1341
 	$config['modules'] = array();
1201 1342
 	foreach($output as $line)
1202 1343
 	{
1203 1344
 		$line = trim($line);
1204
-		if (empty($line) || $line[0] == '#') continue;
1345
+		if (empty($line) || $line[0] == '#')
1346
+		{
1347
+			continue;
1348
+		}
1205 1349
 		list($path,$url) = preg_split('/[ \t\r\n]+/',$line);
1206 1350
 		$matches = null;
1207
-		if (!preg_match('/([a-z+]+:\/\/[a-z@.]+\/[a-z]+)\/(branches|tags|trunk)/',$url,$matches)) die("Invalid SVN URL: $url\n");
1351
+		if (!preg_match('/([a-z+]+:\/\/[a-z@.]+\/[a-z]+)\/(branches|tags|trunk)/',$url,$matches))
1352
+		{
1353
+			die("Invalid SVN URL: $url\n");
1354
+		}
1208 1355
 		$repo = $matches[1];
1209
-		if ($repo == 'http://svn.egroupware.org/egroupware') $repo = 'svn+ssh://[email protected]/egroupware';
1356
+		if ($repo == 'http://svn.egroupware.org/egroupware')
1357
+		{
1358
+			$repo = 'svn+ssh://[email protected]/egroupware';
1359
+		}
1210 1360
 		$config['modules'][$repo][$path] = $url;
1211 1361
 	}
1212 1362
 	// process extra modules
@@ -1215,13 +1365,25 @@  discard block
 block discarded – undo
1215 1365
 		$module = config_translate(null, $module);	// allow to use config vars like $svnbranch in module
1216 1366
 		$url = strpos($module,'://') === false ? $svnbranch.'/' : '';
1217 1367
 		$url .= $module;
1218
-		if (strpos($module,'://') !== false) $module = basename($module);
1219
-		if (!preg_match('/([a-z+]+:\/\/[a-z@.]+\/[a-z]+)\/(branches|tags|trunk)/',$url,$matches)) die("Invalid SVN URL: $url\n");
1368
+		if (strpos($module,'://') !== false)
1369
+		{
1370
+			$module = basename($module);
1371
+		}
1372
+		if (!preg_match('/([a-z+]+:\/\/[a-z@.]+\/[a-z]+)\/(branches|tags|trunk)/',$url,$matches))
1373
+		{
1374
+			die("Invalid SVN URL: $url\n");
1375
+		}
1220 1376
 		$repo = $matches[1];
1221
-		if ($repo == 'http://svn.egroupware.org/egroupware') $repo = 'svn+ssh://[email protected]/egroupware';
1377
+		if ($repo == 'http://svn.egroupware.org/egroupware')
1378
+		{
1379
+			$repo = 'svn+ssh://[email protected]/egroupware';
1380
+		}
1222 1381
 		$config['modules'][$repo][$config['aliasdir'].'/'.$module] = $url;
1223 1382
 	}
1224
-	if ($verbose) print_r($config['modules']);
1383
+	if ($verbose)
1384
+	{
1385
+		print_r($config['modules']);
1386
+	}
1225 1387
 	return $config['modules'];
1226 1388
 }
1227 1389
 
@@ -1232,7 +1394,11 @@  discard block
 block discarded – undo
1232 1394
 {
1233 1395
 	global $config,$svn;
1234 1396
 
1235
-	if (empty($config['svntag'])) return;	// otherwise we copy everything in svn root!
1397
+	if (empty($config['svntag']))
1398
+	{
1399
+		return;
1400
+	}
1401
+	// otherwise we copy everything in svn root!
1236 1402
 
1237 1403
 	$config['svntag'] = config_translate('svntag');	// allow to use config vars like $version in tag
1238 1404
 
@@ -1271,11 +1437,17 @@  discard block
 block discarded – undo
1271 1437
 	{
1272 1438
 		$output[] = $cmd;
1273 1439
 		exec($cmd,$output,$ret);
1274
-		if ($verbose) echo implode("\n",$output)."\n";
1440
+		if ($verbose)
1441
+		{
1442
+			echo implode("\n",$output)."\n";
1443
+		}
1275 1444
 	}
1276 1445
 	if ($ret && !in_array($ret,(array)$no_bailout))
1277 1446
 	{
1278
-		if (!$verbose) echo implode("\n",$output)."\n";
1447
+		if (!$verbose)
1448
+		{
1449
+			echo implode("\n",$output)."\n";
1450
+		}
1279 1451
 		throw new Exception("Error during '$cmd' --> aborting",$ret);
1280 1452
 	}
1281 1453
 	return $ret;
@@ -1321,7 +1493,10 @@  discard block
 block discarded – undo
1321 1493
 	echo "options and their defaults:\n";
1322 1494
 	if ($verbose)
1323 1495
 	{
1324
-		if (!isset($config['modules'])) $config['modules'] = get_modules_per_repo();
1496
+		if (!isset($config['modules']))
1497
+		{
1498
+			$config['modules'] = get_modules_per_repo();
1499
+		}
1325 1500
 	}
1326 1501
 	else
1327 1502
 	{
@@ -1329,7 +1504,10 @@  discard block
 block discarded – undo
1329 1504
 	}
1330 1505
 	foreach($config as $name => $default)
1331 1506
 	{
1332
-		if (is_array($default)) $default = json_encode ($default, JSON_UNESCAPED_SLASHES);
1507
+		if (is_array($default))
1508
+		{
1509
+			$default = json_encode ($default, JSON_UNESCAPED_SLASHES);
1510
+		}
1333 1511
 		echo '--'.str_pad($name,20).$default."\n";
1334 1512
 	}
1335 1513
 	if ($error)
Please login to merge, or discard this patch.
Upper-Lower-Casing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 	}
404 404
 
405 405
 	$archives = config_translate('upload');
406
-	echo "Uploading $archives to $config[upload_url]\n";
406
+	echo "uploading $archives to $config[upload_url]\n";
407 407
 
408 408
 	foreach(glob($archives, GLOB_BRACE) as $path)
409 409
 	{
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 		{
430 430
 			continue;
431 431
 		}
432
-		if ($verbose) echo "Uploading $path as $content_type\n";
432
+		if ($verbose) echo "uploading $path as $content_type\n";
433 433
 		$name = basename($path);
434 434
 		github_api($config['upload_url'], array(
435 435
 			'name' => $name,
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
 	curl_setopt($c, CURLOPT_URL, $url);
493 493
 
494 494
 	if (is_string($data)) $short_data = strlen($data) > 100 ? substr($data, 0, 100).' ...' : $data;
495
-	if ($verbose) echo "Sending $method request to $url ".(isset($short_data)&&$method!='GET'?$short_data:'')."\n";
495
+	if ($verbose) echo "sending $method request to $url ".(isset($short_data)&&$method!='GET'?$short_data:'')."\n";
496 496
 
497 497
 	if (($response = curl_exec($c)) === false)
498 498
 	{
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
 		if (!$is_regexp && strpos($log->paths->path, $pattern) !== false ||
727 727
 			$is_regexp && preg_match($pattern, $log->paths->path, $matches))
728 728
 		{
729
-			if ($verbose) echo "Revision {$log['revision']} matches".($matches?': '.$matches[1] : '')."\n";
729
+			if ($verbose) echo "revision {$log['revision']} matches".($matches?': '.$matches[1] : '')."\n";
730 730
 			return (int)$log['revision'];
731 731
 		}
732 732
 	}
@@ -807,7 +807,7 @@  discard block
 block discarded – undo
807 807
 			if ($content != $content_was)
808 808
 			{
809 809
 				file_put_contents($path,$content);
810
-				if ($verbose) echo "Updated $path\n";
810
+				if ($verbose) echo "updated $path\n";
811 811
 				++$n;
812 812
 			}
813 813
 		}
@@ -942,7 +942,7 @@  discard block
 block discarded – undo
942 942
 	}
943 943
 	foreach($config['types'] as $type)
944 944
 	{
945
-		echo "Creating $type archives\n";
945
+		echo "creating $type archives\n";
946 946
 		$tar_type = $type == 'tar.bz2' ? 'j' : 'z';
947 947
 
948 948
 		$file = $config['sourcedir'].'/'.$config['packagename'].'-'.$config['version'].'.'.$config['packaging'].'.'.$type;
@@ -1064,7 +1064,7 @@  discard block
 block discarded – undo
1064 1064
 
1065 1065
 	if (($cmd = config_translate('patchCmd')) && $cmd[0] != '#')
1066 1066
 	{
1067
-		echo "Running $cmd\n";
1067
+		echo "running $cmd\n";
1068 1068
 		run_cmd($cmd);
1069 1069
 	}
1070 1070
 	// fix permissions
Please login to merge, or discard this patch.
Spacing   +179 added lines, -179 removed lines patch added patch discarded remove patch
@@ -14,15 +14,15 @@  discard block
 block discarded – undo
14 14
 {
15 15
 	die('<h1>checkout-build-archives.php must NOT be called as web-page --> exiting !!!</h1>');
16 16
 }
17
-date_default_timezone_set('Europe/Berlin');	// to get ride of 5.3 warnings
17
+date_default_timezone_set('Europe/Berlin'); // to get ride of 5.3 warnings
18 18
 
19 19
 $verbose = 0;
20 20
 $config = array(
21 21
 	'packagename' => 'egroupware-epl',
22
-	'version' => '16.1',        // '14.3'
22
+	'version' => '16.1', // '14.3'
23 23
 	'packaging' => date('Ymd'), // '20160520'
24
-	'branch'  => 'master',        // checked out branch
25
-	'tag' => '$version.$packaging',	// name of tag
24
+	'branch'  => 'master', // checked out branch
25
+	'tag' => '$version.$packaging', // name of tag
26 26
 	'checkoutdir' => realpath(__DIR__.'/../..'),
27 27
 	'egw_buildroot' => '/tmp/build_root/epl_16.1_buildroot',
28 28
 	'sourcedir' => '/home/download/stylite-epl/egroupware-epl-16.1',
@@ -34,11 +34,11 @@  discard block
 block discarded – undo
34 34
 	'svnalias' => 'aliases/default-ssh',    // default alias
35 35
 	'extra' => array('$stylitebase/$svnbranch/stylite', '$stylitebase/$svnbranch/esyncpro', '$stylitebase/trunk/archive'),//, '$stylitebase/$svnbranch/groups'), //,'svn+ssh://[email protected]/stylite/trunk/eventmgr'),
36 36
 	*/
37
-	'extra' => array('stylite', 'esyncpro', 'archive',	// create an extra archive for given apps
37
+	'extra' => array('stylite', 'esyncpro', 'archive', // create an extra archive for given apps
38 38
 		// these apps are placed in egroupware-epl-contrib archive
39 39
 		'contrib' => array('phpgwapi', 'etemplate', 'jdots', 'phpbrain', 'wiki', 'sambaadmin', 'sitemgr', 'phpfreechat')),
40
-	'aliasdir' => 'egroupware',             // directory created by the alias
41
-	'types' => array('tar.bz2','tar.gz','zip','all.tar.bz2'),
40
+	'aliasdir' => 'egroupware', // directory created by the alias
41
+	'types' => array('tar.bz2', 'tar.gz', 'zip', 'all.tar.bz2'),
42 42
 	// add given extra-apps or (uncompressed!) archives to above all.tar.bz2 archive
43 43
 	'all-add' => array('contrib', '/home/stylite/epl-16.1/phpfreechat_data_public.tar'),
44 44
 	// diverse binaries we need
@@ -55,12 +55,12 @@  discard block
 block discarded – undo
55 55
 	'gpg' => trim(`which gpg`),
56 56
 	'editor' => trim(`which vi`),
57 57
 	'rsync' => trim(`which rsync`).' --progress -e ssh --exclude "*-stylite-*" --exclude "*-esyncpro-*"',
58
-	'composer' => ($composer=trim(`which composer.phar`)) ? $composer.' install --ignore-platform-reqs --no-dev' : '',
58
+	'composer' => ($composer = trim(`which composer.phar`)) ? $composer.' install --ignore-platform-reqs --no-dev' : '',
59 59
 	'after-checkout' => 'rm -rf */source */templates/*/source',
60 60
 	'packager' => '[email protected]',
61 61
 	'obs' => '/home/stylite/obs/stylite-epl',
62
-	'obs_package_alias' => '',	// name used in obs package, if different from packagename
63
-	'changelog' => false,   // eg. '* 1. Zeile\n* 2. Zeile' for debian.changes
62
+	'obs_package_alias' => '', // name used in obs package, if different from packagename
63
+	'changelog' => false, // eg. '* 1. Zeile\n* 2. Zeile' for debian.changes
64 64
 	'changelog_packager' => 'Ralf Becker <[email protected]>',
65 65
 	'editchangelog' => '* ',
66 66
 	//'sfuser' => 'ralfbecker',
@@ -69,23 +69,23 @@  discard block
 block discarded – undo
69 69
 	'upload' => '$sourcedir/*egroupware-epl{,-contrib}-$version.$packaging*',
70 70
 	'copychangelog' => '$sourcedir/README', //'$sfuser,[email protected]:/home/frs/project/e/eg/egroupware/README',
71 71
 	'skip' => array(),
72
-	'run' => array('checkout','editchangelog','tag','copy','virusscan','create','sign','obs','copychangelog'),
72
+	'run' => array('checkout', 'editchangelog', 'tag', 'copy', 'virusscan', 'create', 'sign', 'obs', 'copychangelog'),
73 73
 	'patchCmd' => '# run cmd after copy eg. "cd $egw_buildroot; patch -p1 /path/to/patch"',
74
-	'github_user' => 'ralfbecker',	// Github user for following token
75
-	'github_token' => '',	// Github repo personal access token from above user
74
+	'github_user' => 'ralfbecker', // Github user for following token
75
+	'github_token' => '', // Github repo personal access token from above user
76 76
 );
77 77
 
78 78
 // process config from command line
79 79
 $argv = $_SERVER['argv'];
80 80
 $prog = array_shift($argv);
81 81
 
82
-while(($arg = array_shift($argv)))
82
+while (($arg = array_shift($argv)))
83 83
 {
84 84
 	if ($arg == '-v' || $arg == '--verbose')
85 85
 	{
86 86
 		++$verbose;
87 87
 	}
88
-	elseif($arg == '-h' || $arg == '--help')
88
+	elseif ($arg == '-h' || $arg == '--help')
89 89
 	{
90 90
 		if (in_array('editchangelog', $config['skip']) || !in_array('editchangelog', $config['run']))
91 91
 		{
@@ -93,10 +93,10 @@  discard block
 block discarded – undo
93 93
 		}
94 94
 		usage();
95 95
 	}
96
-	elseif(substr($arg,0,2) == '--' && isset($config[$name=substr($arg,2)]))
96
+	elseif (substr($arg, 0, 2) == '--' && isset($config[$name = substr($arg, 2)]))
97 97
 	{
98 98
 		$value = array_shift($argv);
99
-		switch($name)
99
+		switch ($name)
100 100
 		{
101 101
 			case 'extra':	// stored as array and allow to add/delete items with +/- prefix
102 102
 			case 'types':
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 				{
120 120
 					$value = array_unique(preg_split('/[ ,]+/', $value));
121 121
 				}
122
-				switch($op)
122
+				switch ($op)
123 123
 				{
124 124
 					case '+':
125 125
 						$config[$name] = array_unique(array_merge($config[$name], $value));
@@ -137,14 +137,14 @@  discard block
 block discarded – undo
137 137
 			case 'release':
138 138
 			case 'copychangelog':
139 139
 				$config[$name] = $value;
140
-				if ($value) array_unshift($config['run'],$name);
140
+				if ($value) array_unshift($config['run'], $name);
141 141
 				break;
142 142
 
143 143
 			case 'editchangelog':
144 144
 				$config[$name] = $value ? $value : true;
145
-				if (!in_array('editchangelog',$config['run']))
145
+				if (!in_array('editchangelog', $config['run']))
146 146
 				{
147
-					array_unshift($config['run'],'editchangelog');
147
+					array_unshift($config['run'], 'editchangelog');
148 148
 				}
149 149
 				break;
150 150
 
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 				{
154 154
 					usage("Path '$value' not found!");
155 155
 				}
156
-				if (!in_array('obs',$config['run'])) $config['run'][] = 'obs';
156
+				if (!in_array('obs', $config['run'])) $config['run'][] = 'obs';
157 157
 				// fall through
158 158
 			default:
159 159
 				$config[$name] = $value;
@@ -171,16 +171,16 @@  discard block
 block discarded – undo
171 171
 }
172 172
 $svn = $config['svn'];
173 173
 
174
-$run = array_diff($config['run'],$config['skip']);
174
+$run = array_diff($config['run'], $config['skip']);
175 175
 
176 176
 // if we dont edit the changelog, set packaging from changelog
177 177
 if (!in_array('editchangelog', $run))
178 178
 {
179 179
 	parse_current_changelog(true);
180 180
 }
181
-foreach($run as $func)
181
+foreach ($run as $func)
182 182
 {
183
-	chdir(dirname(__FILE__));	// make relative filenames work, if other command changes dir
183
+	chdir(dirname(__FILE__)); // make relative filenames work, if other command changes dir
184 184
 	call_user_func('do_'.$func);
185 185
 }
186 186
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
  * @param string $prefix ='* ' prefix, which if not presend should be added to all log messages
196 196
  * @return string with changelog
197 197
  */
198
-function get_changelog_from_git($_path, $log_pattern=null, &$last_tag=null, $prefix='* ')
198
+function get_changelog_from_git($_path, $log_pattern = null, &$last_tag = null, $prefix = '* ')
199 199
 {
200 200
 	//echo __FUNCTION__."('$branch_url','$log_pattern','$revision','$prefix')\n";
201 201
 	global $config;
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 	run_cmd($cmd, $output);
217 217
 
218 218
 	$changelog = '';
219
-	foreach($output as $line)
219
+	foreach ($output as $line)
220 220
 	{
221 221
 		if (substr($line, 0, 4) == "    " && ($msg = _match_log_pattern(substr($line, 4), $log_pattern, $prefix)))
222 222
 		{
@@ -248,13 +248,13 @@  discard block
 block discarded – undo
248 248
 	{
249 249
 		throw new Exception("checkout directory '{$config['checkoutdir']} does NOT exists or is NO directory!");
250 250
 	}
251
-	if (!($mrconfig = file_get_contents($path=$config['checkoutdir'].'/.mrconfig')))
251
+	if (!($mrconfig = file_get_contents($path = $config['checkoutdir'].'/.mrconfig')))
252 252
 	{
253 253
 		throw new Exception("$path not found!");
254 254
 	}
255 255
 	$module = $baseurl = null;
256 256
 	$modules = array();
257
-	foreach(explode("\n", $mrconfig) as $line)
257
+	foreach (explode("\n", $mrconfig) as $line)
258 258
 	{
259 259
 		$matches = null;
260 260
 		if (isset($baseurl))
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 		$cmd = $config['git'].' clone '.(!empty($config['branch']) ? ' -b '.$config['branch'] : '').
320 320
 			' [email protected]:EGroupware/egroupware.git '.$config['checkoutdir'];
321 321
 		run_cmd($cmd);
322
-		run_cmd('mr up');	// need to run mr up twice for new checkout, because chained .mrconfig wont run first time (because not there yet!)
322
+		run_cmd('mr up'); // need to run mr up twice for new checkout, because chained .mrconfig wont run first time (because not there yet!)
323 323
 	}
324 324
 	elseif (!is_dir($config['checkoutdir']) || !is_writable($config['checkoutdir']))
325 325
 	{
@@ -343,9 +343,9 @@  discard block
 block discarded – undo
343 343
 	}
344 344
 	chdir($config['checkoutdir']);
345 345
 
346
-	$config['tag'] = config_translate('tag');	// allow to use config vars like $version in tag
346
+	$config['tag'] = config_translate('tag'); // allow to use config vars like $version in tag
347 347
 
348
-	if (empty($config['tag'])) return;	// otherwise we copy everything in svn root!
348
+	if (empty($config['tag'])) return; // otherwise we copy everything in svn root!
349 349
 
350 350
 	echo "Creating tag $config[tag]\n";
351 351
 
@@ -358,16 +358,16 @@  discard block
 block discarded – undo
358 358
  */
359 359
 function do_release()
360 360
 {
361
-	global $config,$verbose;
361
+	global $config, $verbose;
362 362
 
363 363
 	// push local changes to Github incl. tags
364 364
 	if ($verbose) echo "Pushing changes and tags\n";
365 365
 	chdir($config['checkoutdir']);
366
-	run_cmd($config['mr']. ' up');		// in case someone else pushed something
366
+	run_cmd($config['mr'].' up'); // in case someone else pushed something
367 367
 	chdir($config['checkoutdir']);
368
-	run_cmd($config['git'].' push');	// regular commits like changelog
368
+	run_cmd($config['git'].' push'); // regular commits like changelog
369 369
 	$tag = config_translate('tag');
370
-	run_cmd($config['mr']. ' push origin '.$tag);	// pushing tags in all apps
370
+	run_cmd($config['mr'].' push origin '.$tag); // pushing tags in all apps
371 371
 
372 372
 	if (empty($config['github_user']) || empty($config['github_token']))
373 373
 	{
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 		'body' => $config['changelog'],
385 385
 	);
386 386
 	$response = github_api("/repos/EGroupware/egroupware/releases", $data);
387
-	$config['upload_url'] = preg_replace('/{\?[^}]+}$/', '', $response['upload_url']);	// remove {?name,label} template
387
+	$config['upload_url'] = preg_replace('/{\?[^}]+}$/', '', $response['upload_url']); // remove {?name,label} template
388 388
 
389 389
 	do_upload();
390 390
 }
@@ -394,33 +394,33 @@  discard block
 block discarded – undo
394 394
  */
395 395
 function do_upload()
396 396
 {
397
-	global $config,$verbose;
397
+	global $config, $verbose;
398 398
 
399 399
 	if (empty($config['upload_url']))
400 400
 	{
401 401
 		$response = github_api("/repos/EGroupware/egroupware/releases", array(), 'GET');
402
-		$config['upload_url'] = preg_replace('/{\?[^}]+}$/', '', $response[0]['upload_url']);	// remove {?name,label} template
402
+		$config['upload_url'] = preg_replace('/{\?[^}]+}$/', '', $response[0]['upload_url']); // remove {?name,label} template
403 403
 	}
404 404
 
405 405
 	$archives = config_translate('upload');
406 406
 	echo "Uploading $archives to $config[upload_url]\n";
407 407
 
408
-	foreach(glob($archives, GLOB_BRACE) as $path)
408
+	foreach (glob($archives, GLOB_BRACE) as $path)
409 409
 	{
410 410
 		$label = null;
411 411
 		if (substr($path, -4) == '.zip')
412 412
 		{
413 413
 			$content_type = 'application/zip';
414 414
 		}
415
-		elseif(substr($path, -7) == '.tar.gz')
415
+		elseif (substr($path, -7) == '.tar.gz')
416 416
 		{
417 417
 			$content_type = 'application/x-gzip';
418 418
 		}
419
-		elseif(substr($path, -8) == '.tar.bz2')
419
+		elseif (substr($path, -8) == '.tar.bz2')
420 420
 		{
421 421
 			$content_type = 'application/x-bzip2';
422 422
 		}
423
-		elseif(substr($path, -8) == '.txt.asc')
423
+		elseif (substr($path, -8) == '.txt.asc')
424 424
 		{
425 425
 			$content_type = 'text/plain';
426 426
 			$label = 'Signed hashes of downloads';
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 
440 440
 	if (!empty($config['release']))
441 441
 	{
442
-		$target = config_translate('release');	// allow to use config vars like $svnbranch in module
442
+		$target = config_translate('release'); // allow to use config vars like $svnbranch in module
443 443
 		$cmd = $config['rsync'].' '.$archives.' '.$target;
444 444
 		if ($verbose) echo $cmd."\n";
445 445
 		passthru($cmd);
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
  * @throws Exception
458 458
  * @return array with response
459 459
  */
460
-function github_api($_url, $data, $method='POST', $upload=null, $content_type=null)
460
+function github_api($_url, $data, $method = 'POST', $upload = null, $content_type = null)
461 461
 {
462 462
 	global $config, $verbose;
463 463
 
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
 	curl_setopt($c, CURLOPT_TIMEOUT, 240);
471 471
 	curl_setopt($c, CURLOPT_FOLLOWLOCATION, true);
472 472
 
473
-	switch($method)
473
+	switch ($method)
474 474
 	{
475 475
 		case 'POST':
476 476
 			curl_setopt($c, CURLOPT_POST, true);
@@ -478,13 +478,13 @@  discard block
 block discarded – undo
478 478
 			curl_setopt($c, CURLOPT_POSTFIELDS, $data);
479 479
 			break;
480 480
 		case 'GET':
481
-			if(count($data)) $url .= '?' . http_build_query($data);
481
+			if (count($data)) $url .= '?'.http_build_query($data);
482 482
 			break;
483 483
 		case 'FILE':
484 484
 			curl_setopt($c, CURLOPT_HTTPHEADER, array("Content-type: $content_type"));
485 485
 			curl_setopt($c, CURLOPT_POST, true);
486 486
 			curl_setopt($c, CURLOPT_POSTFIELDS, file_get_contents($upload));
487
-			if(count($data)) $url .= '?' . http_build_query($data);
487
+			if (count($data)) $url .= '?'.http_build_query($data);
488 488
 			break;
489 489
 		default:
490 490
 			throw new Exception(__FUNCTION__.": Unknown/unimplemented method=$method!");
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
 	curl_setopt($c, CURLOPT_URL, $url);
493 493
 
494 494
 	if (is_string($data)) $short_data = strlen($data) > 100 ? substr($data, 0, 100).' ...' : $data;
495
-	if ($verbose) echo "Sending $method request to $url ".(isset($short_data)&&$method!='GET'?$short_data:'')."\n";
495
+	if ($verbose) echo "Sending $method request to $url ".(isset($short_data) && $method != 'GET' ? $short_data : '')."\n";
496 496
 
497 497
 	if (($response = curl_exec($c)) === false)
498 498
 	{
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
 		curl_setopt($c, CURLOPT_HEADER, true);
501 501
 		curl_setopt($c, CURLOPT_RETURNTRANSFER, false);
502 502
 		curl_exec($c);
503
-		throw new Exception("$method request to $url failed ".(isset($short_data)&&$method!='GET'?$short_data:''));
503
+		throw new Exception("$method request to $url failed ".(isset($short_data) && $method != 'GET' ? $short_data : ''));
504 504
 	}
505 505
 
506 506
 	if ($verbose) echo (strlen($response) > 200 ? substr($response, 0, 200).' ...' : $response)."\n";
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
  * @param string $name
517 517
  * @param string $value =null value to use, default $config[$name]
518 518
  */
519
-function config_translate($name, $value=null)
519
+function config_translate($name, $value = null)
520 520
 {
521 521
 	global $config;
522 522
 
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 	if (is_string($value) && strpos($value, '$') !== false)
525 525
 	{
526 526
 		$translate = array();
527
-		foreach($config as $n => $val)
527
+		foreach ($config as $n => $val)
528 528
 		{
529 529
 			if (is_string($val)) $translate['$'.$n] = $val;
530 530
 		}
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
  */
551 551
 function do_editchangelog()
552 552
 {
553
-	global $config,$svn;
553
+	global $config, $svn;
554 554
 
555 555
 	echo "Querying changelog from Git/SVN\n";
556 556
 	if (!isset($config['modules']))
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
 	// query changelog per repo
561 561
 	$changelog = '';
562 562
 	$last_tag = null;
563
-	foreach($config['modules'] as $branch_url => $modules)
563
+	foreach ($config['modules'] as $branch_url => $modules)
564 564
 	{
565 565
 		$revision = null;
566 566
 		if (substr($branch_url, -4) == '.git')
@@ -573,15 +573,15 @@  discard block
 block discarded – undo
573 573
 			$changelog .= get_changelog_from_svn($branch_url, $config['editchangelog'], $revision);
574 574
 		}
575 575
 	}
576
-	$logfile = tempnam('/tmp','checkout-build-archives');
577
-	file_put_contents($logfile,$changelog);
576
+	$logfile = tempnam('/tmp', 'checkout-build-archives');
577
+	file_put_contents($logfile, $changelog);
578 578
 	$cmd = $config['editor'].' '.escapeshellarg($logfile);
579 579
 	passthru($cmd);
580 580
 	$config['changelog'] = file_get_contents($logfile);
581 581
 	// remove trailing newlines
582
-	while (substr($config['changelog'],-1) == "\n")
582
+	while (substr($config['changelog'], -1) == "\n")
583 583
 	{
584
-		$config['changelog'] = substr($config['changelog'],0,-1);
584
+		$config['changelog'] = substr($config['changelog'], 0, -1);
585 585
 	}
586 586
 	// allow user to abort, by deleting the changelog
587 587
 	if (strlen($config['changelog']) <= 2)
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
 	}
597 597
 	file_put_contents($changelog, update_changelog(file_get_contents($changelog)));
598 598
 
599
-	update_api_setup($api_setup=$config['checkoutdir'].'/api/setup/setup.inc.php');
599
+	update_api_setup($api_setup = $config['checkoutdir'].'/api/setup/setup.inc.php');
600 600
 
601 601
 	if (file_exists($config['checkoutdir'].'/.git'))
602 602
 	{
@@ -609,7 +609,7 @@  discard block
 block discarded – undo
609 609
 	run_cmd($cmd);
610 610
 
611 611
 	// update obs changelogs (so all changlogs are updated in case of a later error and changelog step can be skiped)
612
-	do_obs(true);	// true: only update debian.changes in obs checkouts
612
+	do_obs(true); // true: only update debian.changes in obs checkouts
613 613
 }
614 614
 
615 615
 /**
@@ -623,41 +623,41 @@  discard block
 block discarded – undo
623 623
  * @param string $prefix ='* ' prefix, which if not presend should be added to all log messages
624 624
  * @return string with changelog
625 625
  */
626
-function get_changelog_from_svn($branch_url, $log_pattern=null, &$revision=null, $prefix='* ')
626
+function get_changelog_from_svn($branch_url, $log_pattern = null, &$revision = null, $prefix = '* ')
627 627
 {
628 628
 	//echo __FUNCTION__."('$branch_url','$log_pattern','$revision','$prefix')\n";
629
-	global $config,$verbose,$svn;
629
+	global $config, $verbose, $svn;
630 630
 
631 631
 	if (is_null($revision))
632 632
 	{
633
-		list($tags_url,$branch) = preg_split('#/(branches/|trunk)#',$branch_url);
633
+		list($tags_url, $branch) = preg_split('#/(branches/|trunk)#', $branch_url);
634 634
 		if (empty($branch)) $branch = $config['version'];
635 635
 		$tags_url .= '/tags';
636
-		$pattern='|/tags/('.preg_quote($config['version'], '|').'\.[0-9.]+)|';
636
+		$pattern = '|/tags/('.preg_quote($config['version'], '|').'\.[0-9.]+)|';
637 637
 		$matches = null;
638
-		$revision = get_last_svn_tag($tags_url,$pattern,$matches);
638
+		$revision = get_last_svn_tag($tags_url, $pattern, $matches);
639 639
 		$tag = $matches[1];
640 640
 	}
641
-	elseif(!is_numeric($revision))
641
+	elseif (!is_numeric($revision))
642 642
 	{
643
-		$revision = get_last_svn_tag($tags_url,$tag=$revision);
643
+		$revision = get_last_svn_tag($tags_url, $tag = $revision);
644 644
 	}
645 645
 	$cmd = $svn.' log --xml -r '.escapeshellarg($revision.':HEAD').' '.escapeshellarg($branch_url);
646 646
 	if (($v = $verbose))
647 647
 	{
648 648
 		echo "Querying SVN for log from r$revision".($tag ? " ($tag)" : '').":\n$cmd\n";
649
-		$verbose = false;	// otherwise no $output!
649
+		$verbose = false; // otherwise no $output!
650 650
 	}
651 651
 	$output = array();
652
-	run_cmd($cmd,$output);
652
+	run_cmd($cmd, $output);
653 653
 	$verbose = $v;
654
-	array_shift($output);	// remove the command
654
+	array_shift($output); // remove the command
655 655
 
656
-	$xml = simplexml_load_string($output=implode("\n",$output));
656
+	$xml = simplexml_load_string($output = implode("\n", $output));
657 657
 	$message = '';
658
-	foreach($xml as $log)
658
+	foreach ($xml as $log)
659 659
 	{
660
-		if (!($msg = _match_log_pattern($log->msg, $log_pattern, $prefix))) continue;	// no match --> ignore
660
+		if (!($msg = _match_log_pattern($log->msg, $log_pattern, $prefix))) continue; // no match --> ignore
661 661
 
662 662
 		$message .= $msg."\n";
663 663
 	}
@@ -674,25 +674,25 @@  discard block
 block discarded – undo
674 674
  * @param string $prefix ='* '
675 675
  * @return string
676 676
  */
677
-function _match_log_pattern($msg, $log_pattern, $prefix='* ')
677
+function _match_log_pattern($msg, $log_pattern, $prefix = '* ')
678 678
 {
679 679
 	$pattern_len = strlen($log_pattern);
680 680
 	$prefix_len = strlen($prefix);
681 681
 
682 682
 	$matches = null;
683
-	if ($log_pattern[0] == '/' && preg_match($log_pattern,$msg,$matches))
683
+	if ($log_pattern[0] == '/' && preg_match($log_pattern, $msg, $matches))
684 684
 	{
685 685
 		$msg = $matches[1];
686 686
 	}
687
-	elseif($log_pattern && $log_pattern[0] != '/' && substr($msg,0,$pattern_len) == $log_pattern)
687
+	elseif ($log_pattern && $log_pattern[0] != '/' && substr($msg, 0, $pattern_len) == $log_pattern)
688 688
 	{
689
-		list($msg) = explode("\n",$msg);
689
+		list($msg) = explode("\n", $msg);
690 690
 	}
691
-	elseif($log_pattern)
691
+	elseif ($log_pattern)
692 692
 	{
693 693
 		return null;
694 694
 	}
695
-	if ($prefix_len && substr($msg,0,$prefix_len) != $prefix) $msg = $prefix.$msg;
695
+	if ($prefix_len && substr($msg, 0, $prefix_len) != $prefix) $msg = $prefix.$msg;
696 696
 
697 697
 	return $msg;
698 698
 }
@@ -706,30 +706,30 @@  discard block
 block discarded – undo
706 706
  * @param array &$matches=null on return matches of preg_match
707 707
  * @return int revision of last svn tag matching pattern
708 708
  */
709
-function get_last_svn_tag($tags_url,$pattern,&$matches=null)
709
+function get_last_svn_tag($tags_url, $pattern, &$matches = null)
710 710
 {
711
-	global $verbose,$svn;
711
+	global $verbose, $svn;
712 712
 
713 713
 	$cmd = $svn.' log --xml --limit 40 -v '.escapeshellarg($tags_url);
714 714
 	if (($v = $verbose))
715 715
 	{
716 716
 		echo "Querying SVN for last tags\n$cmd\n";
717
-		$verbose = false;	// otherwise no $output!
717
+		$verbose = false; // otherwise no $output!
718 718
 	}
719 719
 	$output = array();
720
-	run_cmd($cmd,$output);
720
+	run_cmd($cmd, $output);
721 721
 	$verbose = $v;
722
-	array_shift($output);	// remove the command
722
+	array_shift($output); // remove the command
723 723
 
724
-	$xml = simplexml_load_string($output=implode("\n",$output));
724
+	$xml = simplexml_load_string($output = implode("\n", $output));
725 725
 	$is_regexp = $pattern[0] == substr($pattern, -1);
726
-	foreach($xml as $log)
726
+	foreach ($xml as $log)
727 727
 	{
728 728
 		//print_r($log);
729 729
 		if (!$is_regexp && strpos($log->paths->path, $pattern) !== false ||
730 730
 			$is_regexp && preg_match($pattern, $log->paths->path, $matches))
731 731
 		{
732
-			if ($verbose) echo "Revision {$log['revision']} matches".($matches?': '.$matches[1] : '')."\n";
732
+			if ($verbose) echo "Revision {$log['revision']} matches".($matches ? ': '.$matches[1] : '')."\n";
733 733
 			return (int)$log['revision'];
734 734
 		}
735 735
 	}
@@ -741,9 +741,9 @@  discard block
 block discarded – undo
741 741
  *
742 742
  * @param boolean $only_update_changelog =false true update debian.changes, but nothing else, nor commit it
743 743
  */
744
-function do_obs($only_update_changelog=false)
744
+function do_obs($only_update_changelog = false)
745 745
 {
746
-	global $config,$verbose;
746
+	global $config, $verbose;
747 747
 
748 748
 	if (!is_dir($config['obs']))
749 749
 	{
@@ -753,25 +753,25 @@  discard block
 block discarded – undo
753 753
 	run_cmd('osc up '.$config['obs']);
754 754
 
755 755
 	$n = 0;
756
-	foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($config['obs'])) as $path)
756
+	foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($config['obs'])) as $path)
757 757
 	{
758 758
 		if (basename(dirname($path)) == '.osc' ||
759 759
 			!preg_match('/\/('.preg_quote($config['packagename']).
760 760
 				($config['obs_package_alias'] ? '|'.preg_quote($config['obs_package_alias']) : '').
761
-				')[a-z-]*-('.preg_quote($config['version']).'|trunk)/',$path))
761
+				')[a-z-]*-('.preg_quote($config['version']).'|trunk)/', $path))
762 762
 		{
763 763
 			continue;
764 764
 		}
765 765
 		$matches = null;
766
-		if (preg_match('/\/('.preg_quote($config['packagename']).'[a-z-]*)-'.preg_quote($config['version']).'\.[0-9.]+[0-9](\.tar\.(gz|bz2))$/',$path,$matches) &&
767
-			file_exists($new_name=$config['sourcedir'].'/'.$matches[1].'-'.$config['version'].'.'.$config['packaging'].$matches[2]))
766
+		if (preg_match('/\/('.preg_quote($config['packagename']).'[a-z-]*)-'.preg_quote($config['version']).'\.[0-9.]+[0-9](\.tar\.(gz|bz2))$/', $path, $matches) &&
767
+			file_exists($new_name = $config['sourcedir'].'/'.$matches[1].'-'.$config['version'].'.'.$config['packaging'].$matches[2]))
768 768
 		{
769 769
 			if (basename($path) != basename($new_name))
770 770
 			{
771 771
 				unlink($path);
772 772
 				if ($verbose) echo "rm $path\n";
773 773
 			}
774
-			copy($new_name,dirname($path).'/'.basename($new_name));
774
+			copy($new_name, dirname($path).'/'.basename($new_name));
775 775
 			if ($verbose) echo "cp $new_name ".dirname($path)."/\n";
776 776
 			++$n;
777 777
 		}
@@ -781,35 +781,35 @@  discard block
 block discarded – undo
781 781
 			$config['changelog'] = parse_current_changelog();
782 782
 		}
783 783
 		// updating dsc, spec and changelog files
784
-		if (!$only_update_changelog && (substr($path,-4) == '.dsc' || substr($path,-5) == '.spec') ||
784
+		if (!$only_update_changelog && (substr($path, -4) == '.dsc' || substr($path, -5) == '.spec') ||
785 785
 			!empty($config['changelog']) && basename($path) == 'debian.changes')
786 786
 		{
787 787
 			$content = $content_was = file_get_contents($path);
788 788
 
789
-			if (substr($path,-4) == '.dsc' || substr($path,-5) == '.spec')
789
+			if (substr($path, -4) == '.dsc' || substr($path, -5) == '.spec')
790 790
 			{
791
-				$content = preg_replace('/^Version: '.preg_quote($config['version']).'\.[0-9.]+[0-9]/m','Version: '.$config['version'].'.'.$config['packaging'],$content);
791
+				$content = preg_replace('/^Version: '.preg_quote($config['version']).'\.[0-9.]+[0-9]/m', 'Version: '.$config['version'].'.'.$config['packaging'], $content);
792 792
 			}
793
-			if (substr($path,-4) == '.dsc')
793
+			if (substr($path, -4) == '.dsc')
794 794
 			{
795 795
 				$content = preg_replace('/^(Debtransform-Tar: '.preg_quote($config['packagename']).'[a-z-]*)-'.
796 796
 					preg_quote($config['version']).'\.[0-9.]+[0-9](\.tar\.(gz|bz2))$/m',
797
-					'\\1-'.$config['version'].'.'.$config['packaging'].'\\2',$content);
797
+					'\\1-'.$config['version'].'.'.$config['packaging'].'\\2', $content);
798 798
 			}
799
-			if (basename($path) == 'debian.changes' && strpos($content,$config['version'].'.'.$config['packaging']) === false)
799
+			if (basename($path) == 'debian.changes' && strpos($content, $config['version'].'.'.$config['packaging']) === false)
800 800
 			{
801 801
 				$content = update_changelog($content);
802 802
 			}
803
-			if (!empty($config['changelog']) && substr($path,-5) == '.spec' &&
804
-				($pos_changelog = strpos($content,'%changelog')) !== false)
803
+			if (!empty($config['changelog']) && substr($path, -5) == '.spec' &&
804
+				($pos_changelog = strpos($content, '%changelog')) !== false)
805 805
 			{
806 806
 				$pos_changelog += strlen("%changelog\n");
807
-				$content = substr($content,0,$pos_changelog).' *'.date('D M d Y').' '.$config['changelog_packager']."\n".
808
-					$config['changelog']."\n".substr($content,$pos_changelog);
807
+				$content = substr($content, 0, $pos_changelog).' *'.date('D M d Y').' '.$config['changelog_packager']."\n".
808
+					$config['changelog']."\n".substr($content, $pos_changelog);
809 809
 			}
810 810
 			if ($content != $content_was)
811 811
 			{
812
-				file_put_contents($path,$content);
812
+				file_put_contents($path, $content);
813 813
 				if ($verbose) echo "Updated $path\n";
814 814
 				++$n;
815 815
 			}
@@ -830,33 +830,33 @@  discard block
 block discarded – undo
830 830
  * @param boolean $set_packaging =false true: set packaging from last changelog entry
831 831
  * @return string changelog entries without header and footer lines
832 832
  */
833
-function parse_current_changelog($set_packaging=false)
833
+function parse_current_changelog($set_packaging = false)
834 834
 {
835 835
 	global $config;
836 836
 
837 837
 	$changelog = file_get_contents($config['checkoutdir'].'/doc/rpm-build/debian.changes');
838 838
 	$lines = explode("\n", $changelog, 100);
839 839
 	$matches = null;
840
-	foreach($lines as $n => $line)
840
+	foreach ($lines as $n => $line)
841 841
 	{
842
-		if (preg_match($preg='/^'.preg_quote($config['packagename']).' \('.preg_quote($config['version']).'\.'.
842
+		if (preg_match($preg = '/^'.preg_quote($config['packagename']).' \('.preg_quote($config['version']).'\.'.
843 843
 			($set_packaging ? '([0-9]+)' : preg_quote($config['packaging'])).'/', $line, $matches))
844 844
 		{
845 845
 			if ($set_packaging)
846 846
 			{
847 847
 				$config['packaging'] = $matches[1];
848 848
 			}
849
-			$n += empty($lines[$n+1]) ? 2 : 1;	// overead empty line behind header
849
+			$n += empty($lines[$n + 1]) ? 2 : 1; // overead empty line behind header
850 850
 			$logentry = '';
851
-			while($lines[$n])	// entry is terminated by empty line
851
+			while ($lines[$n])	// entry is terminated by empty line
852 852
 			{
853 853
 				$logentry .= (substr($lines[$n], 0, 2) == '  ' ? substr($lines[$n], 2) : $lines[$n])."\n";
854 854
 				++$n;
855 855
 			}
856
-			return substr($logentry, 0, -1);	// remove training "\n"
856
+			return substr($logentry, 0, -1); // remove training "\n"
857 857
 		}
858 858
 	}
859
-	return null;	// paragraph for current version NOT found
859
+	return null; // paragraph for current version NOT found
860 860
 }
861 861
 
862 862
 /**
@@ -870,8 +870,8 @@  discard block
 block discarded – undo
870 870
 	global $config;
871 871
 
872 872
 	list($header) = explode("\n", $content);
873
-	$new_header = preg_replace('/\('.preg_quote($config['version']).'\.[0-9.]+[0-9](.*)\)/','('.$config['version'].'.'.$config['packaging'].'\\1)', $header);
874
-	if (substr($config['changelog'],0,2) != '  ') $config['changelog'] = '  '.implode("\n  ",explode("\n",$config['changelog']));
873
+	$new_header = preg_replace('/\('.preg_quote($config['version']).'\.[0-9.]+[0-9](.*)\)/', '('.$config['version'].'.'.$config['packaging'].'\\1)', $header);
874
+	if (substr($config['changelog'], 0, 2) != '  ') $config['changelog'] = '  '.implode("\n  ", explode("\n", $config['changelog']));
875 875
 	$content = $new_header."\n\n".$config['changelog'].
876 876
 		"\n\n -- ".$config['changelog_packager'].'  '.date('r')."\n\n".$content;
877 877
 
@@ -909,9 +909,9 @@  discard block
 block discarded – undo
909 909
 {
910 910
 	global $config;
911 911
 
912
-	if (substr($config['sourcedir'],0,2) == '~/')	// sha1_file cant deal with '~/rpm'
912
+	if (substr($config['sourcedir'], 0, 2) == '~/')	// sha1_file cant deal with '~/rpm'
913 913
 	{
914
-		$config['sourcedir'] = getenv('HOME').substr($config['sourcedir'],1);
914
+		$config['sourcedir'] = getenv('HOME').substr($config['sourcedir'], 1);
915 915
 	}
916 916
 	$sumsfile = $config['sourcedir'].'/sha1sum-'.$config['packagename'].'-'.$config['version'].'.'.$config['packaging'].'.txt';
917 917
 
@@ -930,7 +930,7 @@  discard block
 block discarded – undo
930 930
 	if (file_exists($sumsfile.'.asc')) unlink($sumsfile.'.asc');
931 931
 	$cmd = $config['gpg'].' --local-user '.$config['packager'].' --clearsign '.$sumsfile;
932 932
 	run_cmd($cmd);
933
-	unlink($sumsfile);	// delete the unsigned file
933
+	unlink($sumsfile); // delete the unsigned file
934 934
 }
935 935
 
936 936
 /**
@@ -940,22 +940,22 @@  discard block
 block discarded – undo
940 940
 {
941 941
 	global $config;
942 942
 
943
-	if (!file_exists($config['sourcedir'])) mkdir($config['sourcedir'],0755,true);
944
-	if (substr($config['sourcedir'],0,2) == '~/')	// sha1_file cant deal with '~/rpm'
943
+	if (!file_exists($config['sourcedir'])) mkdir($config['sourcedir'], 0755, true);
944
+	if (substr($config['sourcedir'], 0, 2) == '~/')	// sha1_file cant deal with '~/rpm'
945 945
 	{
946
-		$config['sourcedir'] = getenv('HOME').substr($config['sourcedir'],1);
946
+		$config['sourcedir'] = getenv('HOME').substr($config['sourcedir'], 1);
947 947
 	}
948 948
 	$sumsfile = $config['sourcedir'].'/sha1sum-'.$config['packagename'].'-'.$config['version'].'.'.$config['packaging'].'.txt';
949 949
 	$sums = '';
950 950
 
951 951
 	chdir($config['egw_buildroot']);
952 952
 
953
-	if($config['extra'])
953
+	if ($config['extra'])
954 954
 	{
955 955
 		$exclude = $exclude_all = array();
956
-		foreach($config['extra'] as $name => $modules)
956
+		foreach ($config['extra'] as $name => $modules)
957 957
 		{
958
-			foreach((array)$modules as $module)
958
+			foreach ((array)$modules as $module)
959 959
 			{
960 960
 				$exclude[] = basename($module);
961 961
 				if (!empty($config['all-add']) && !in_array($module, $config['all-add']) && (is_int($name) || !in_array($name, $config['all-add'])))
@@ -965,24 +965,24 @@  discard block
 block discarded – undo
965 965
 			}
966 966
 		}
967 967
 		$exclude_extra = ' --exclude=egroupware/'.implode(' --exclude=egroupware/', $exclude);
968
-		$exclude_all_extra =  $exclude_all ? ' --exclude=egroupware/'.implode(' --exclude=egroupware/', $exclude_all) : '';
968
+		$exclude_all_extra = $exclude_all ? ' --exclude=egroupware/'.implode(' --exclude=egroupware/', $exclude_all) : '';
969 969
 	}
970
-	foreach($config['types'] as $type)
970
+	foreach ($config['types'] as $type)
971 971
 	{
972 972
 		echo "Creating $type archives\n";
973 973
 		$tar_type = $type == 'tar.bz2' ? 'j' : 'z';
974 974
 
975 975
 		$file = $config['sourcedir'].'/'.$config['packagename'].'-'.$config['version'].'.'.$config['packaging'].'.'.$type;
976
-		switch($type)
976
+		switch ($type)
977 977
 		{
978 978
 			case 'all.tar.bz2':	// single tar-ball for debian builds not easily supporting to use multiple
979 979
 				$file = $config['sourcedir'].'/'.$config['packagename'].'-all-'.$config['version'].'.'.$config['packaging'].'.tar';
980 980
 				$cmd = $config['tar'].' --owner=root --group=root -cf '.$file.$exclude_all_extra.' egroupware';
981 981
 				if (!empty($config['all-add']))
982 982
 				{
983
-					foreach((array)$config['all-add'] as $add)
983
+					foreach ((array)$config['all-add'] as $add)
984 984
 					{
985
-						if (substr($add, -4) != '.tar') continue;	// probably a module
985
+						if (substr($add, -4) != '.tar') continue; // probably a module
986 986
 						if (!($tar = realpath($add))) throw new Exception("File '$add' not found!");
987 987
 						$cmd .= '; '.$config['tar'].' --owner=root --group=root -Af '.$file.' '.$tar;
988 988
 					}
@@ -1006,15 +1006,15 @@  discard block
 block discarded – undo
1006 1006
 		run_cmd($cmd);
1007 1007
 		$sums .= sha1_file($file)."\t".basename($file)."\n";
1008 1008
 
1009
-		foreach($config['extra'] as $name => $modules)
1009
+		foreach ($config['extra'] as $name => $modules)
1010 1010
 		{
1011 1011
 			if (is_numeric($name)) $name = $modules;
1012 1012
 			$dirs = ' egroupware/'.implode(' egroupware/', (array)$modules);
1013 1013
 			$file = $config['sourcedir'].'/'.$config['packagename'].'-'.$name.'-'.$config['version'].'.'.$config['packaging'].'.'.$type;
1014
-			switch($type)
1014
+			switch ($type)
1015 1015
 			{
1016 1016
 				case 'all.tar.bz2':
1017
-					break;	// nothing to do
1017
+					break; // nothing to do
1018 1018
 				case 'tar.bz2':
1019 1019
 				case 'tar.gz':
1020 1020
 					$cmd = $config['tar'].' --owner=root --group=root -c'.$tar_type.'f '.$file.$dirs;
@@ -1029,7 +1029,7 @@  discard block
 block discarded – undo
1029 1029
 		}
1030 1030
 	}
1031 1031
 	// writing sha1sum file
1032
-	file_put_contents($sumsfile,$sums);
1032
+	file_put_contents($sumsfile, $sums);
1033 1033
 }
1034 1034
 
1035 1035
 /**
@@ -1037,7 +1037,7 @@  discard block
 block discarded – undo
1037 1037
  */
1038 1038
 function do_virusscan()
1039 1039
 {
1040
-	global $config,$verbose;
1040
+	global $config, $verbose;
1041 1041
 
1042 1042
 	if (!file_exists($config['clamscan']) || !is_executable($config['clamscan']))
1043 1043
 	{
@@ -1051,7 +1051,7 @@  discard block
 block discarded – undo
1051 1051
 		$cmd = '/usr/bin/sudo '.$config['freshclam'];
1052 1052
 		if (!$verbose && function_exists('posix_getuid') && posix_getuid()) echo $cmd."\n";
1053 1053
 		$output = null;
1054
-		run_cmd($cmd,$output,1);	// 1 = ignore already up to date database
1054
+		run_cmd($cmd, $output, 1); // 1 = ignore already up to date database
1055 1055
 	}
1056 1056
 	echo "Starting virusscan\n";
1057 1057
 	$cmd = $config['clamscan'].' --quiet -r '.$config['egw_buildroot'];
@@ -1108,12 +1108,12 @@  discard block
 block discarded – undo
1108 1108
  */
1109 1109
 function do_svncheckout()
1110 1110
 {
1111
-	global $config,$svn;
1111
+	global $config, $svn;
1112 1112
 
1113 1113
 	echo "Starting svn checkout/update\n";
1114 1114
 	if (!file_exists($config['checkoutdir']))
1115 1115
 	{
1116
-		mkdir($config['checkoutdir'],0755,true);
1116
+		mkdir($config['checkoutdir'], 0755, true);
1117 1117
 	}
1118 1118
 	elseif (!is_dir($config['checkoutdir']) || !is_writable($config['checkoutdir']))
1119 1119
 	{
@@ -1128,17 +1128,17 @@  discard block
 block discarded – undo
1128 1128
 		{
1129 1129
 			get_modules_per_repo();
1130 1130
 		}
1131
-		$config['svntag'] = config_translate('svntag');	// in case svntag command did not run, translate tag name
1131
+		$config['svntag'] = config_translate('svntag'); // in case svntag command did not run, translate tag name
1132 1132
 
1133 1133
 		if (file_exists($config['aliasdir']))
1134 1134
 		{
1135
-			system('/bin/rm -rf .svn '.$config['aliasdir']);	// --> remove the whole checkout, as we dont implement switching tags
1135
+			system('/bin/rm -rf .svn '.$config['aliasdir']); // --> remove the whole checkout, as we dont implement switching tags
1136 1136
 			clearstatcache();
1137 1137
 		}
1138
-		foreach($config['modules'] as $repo => $modules)
1138
+		foreach ($config['modules'] as $repo => $modules)
1139 1139
 		{
1140 1140
 			$cmd = $svn.' co ';
1141
-			foreach($modules as $path => $url)
1141
+			foreach ($modules as $path => $url)
1142 1142
 			{
1143 1143
 				if ($path == $config['aliasdir'])
1144 1144
 				{
@@ -1148,7 +1148,7 @@  discard block
 block discarded – undo
1148 1148
 					$cmd = $svn.' co ';
1149 1149
 					continue;
1150 1150
 				}
1151
-				if(file_exists($config['aliasdir']))
1151
+				if (file_exists($config['aliasdir']))
1152 1152
 				{
1153 1153
 					die("'egroupware' applications must be first one in externals!\n");
1154 1154
 				}
@@ -1166,16 +1166,16 @@  discard block
 block discarded – undo
1166 1166
 			// check if correct branch
1167 1167
 			$cmd = 'LANG=C '.$svn.' info';
1168 1168
 			$output = $ret = null;
1169
-			exec($cmd,$output,$ret);
1170
-			foreach($output as $line)
1169
+			exec($cmd, $output, $ret);
1170
+			foreach ($output as $line)
1171 1171
 			{
1172
-				if ($ret || substr($line,0,5) == 'URL: ')
1172
+				if ($ret || substr($line, 0, 5) == 'URL: ')
1173 1173
 				{
1174
-					$url = substr($line,5);
1175
-					if ($ret || substr($url,0,strlen($svnbranch)) != $svnbranch)	// wrong branch (or no svn dir)
1174
+					$url = substr($line, 5);
1175
+					if ($ret || substr($url, 0, strlen($svnbranch)) != $svnbranch)	// wrong branch (or no svn dir)
1176 1176
 					{
1177 1177
 						echo "Checkout is of wrong branch --> deleting it\n";
1178
-						system('/bin/rm -rf .svn '.$config['aliasdir']);	// --> remove the whole checkout
1178
+						system('/bin/rm -rf .svn '.$config['aliasdir']); // --> remove the whole checkout
1179 1179
 						clearstatcache();
1180 1180
 					}
1181 1181
 					break;
@@ -1187,10 +1187,10 @@  discard block
 block discarded – undo
1187 1187
 		run_cmd($cmd);
1188 1188
 
1189 1189
 		chdir($config['aliasdir']);
1190
-		foreach($config['extra'] as $module)
1190
+		foreach ($config['extra'] as $module)
1191 1191
 		{
1192
-			$module = config_translate(null, $module);	// allow to use config vars like $svnbranch in module
1193
-			$url = strpos($module,'://') === false ? $svnbranch.'/' : '';
1192
+			$module = config_translate(null, $module); // allow to use config vars like $svnbranch in module
1193
+			$url = strpos($module, '://') === false ? $svnbranch.'/' : '';
1194 1194
 			$url .= $module;
1195 1195
 			$cmd = $svn.' co '.$url;
1196 1196
 			run_cmd($cmd);
@@ -1215,7 +1215,7 @@  discard block
 block discarded – undo
1215 1215
  */
1216 1216
 function get_modules_per_svn_repo()
1217 1217
 {
1218
-	global $config,$svn,$verbose;
1218
+	global $config, $svn, $verbose;
1219 1219
 
1220 1220
 	// process alias/externals
1221 1221
 	$svnbranch = $config['svnbase'].'/'.$config['svnbranch'];
@@ -1223,27 +1223,27 @@  discard block
 block discarded – undo
1223 1223
 	$cmd = $svn.' propget svn:externals --strict '.$url;
1224 1224
 	if ($verbose) echo $cmd."\n";
1225 1225
 	$output = $ret = null;
1226
-	exec($cmd,$output,$ret);
1226
+	exec($cmd, $output, $ret);
1227 1227
 	$config['modules'] = array();
1228
-	foreach($output as $line)
1228
+	foreach ($output as $line)
1229 1229
 	{
1230 1230
 		$line = trim($line);
1231 1231
 		if (empty($line) || $line[0] == '#') continue;
1232
-		list($path,$url) = preg_split('/[ \t\r\n]+/',$line);
1232
+		list($path, $url) = preg_split('/[ \t\r\n]+/', $line);
1233 1233
 		$matches = null;
1234
-		if (!preg_match('/([a-z+]+:\/\/[a-z@.]+\/[a-z]+)\/(branches|tags|trunk)/',$url,$matches)) die("Invalid SVN URL: $url\n");
1234
+		if (!preg_match('/([a-z+]+:\/\/[a-z@.]+\/[a-z]+)\/(branches|tags|trunk)/', $url, $matches)) die("Invalid SVN URL: $url\n");
1235 1235
 		$repo = $matches[1];
1236 1236
 		if ($repo == 'http://svn.egroupware.org/egroupware') $repo = 'svn+ssh://[email protected]/egroupware';
1237 1237
 		$config['modules'][$repo][$path] = $url;
1238 1238
 	}
1239 1239
 	// process extra modules
1240
-	foreach($config['extra'] as $module)
1240
+	foreach ($config['extra'] as $module)
1241 1241
 	{
1242
-		$module = config_translate(null, $module);	// allow to use config vars like $svnbranch in module
1243
-		$url = strpos($module,'://') === false ? $svnbranch.'/' : '';
1242
+		$module = config_translate(null, $module); // allow to use config vars like $svnbranch in module
1243
+		$url = strpos($module, '://') === false ? $svnbranch.'/' : '';
1244 1244
 		$url .= $module;
1245
-		if (strpos($module,'://') !== false) $module = basename($module);
1246
-		if (!preg_match('/([a-z+]+:\/\/[a-z@.]+\/[a-z]+)\/(branches|tags|trunk)/',$url,$matches)) die("Invalid SVN URL: $url\n");
1245
+		if (strpos($module, '://') !== false) $module = basename($module);
1246
+		if (!preg_match('/([a-z+]+:\/\/[a-z@.]+\/[a-z]+)\/(branches|tags|trunk)/', $url, $matches)) die("Invalid SVN URL: $url\n");
1247 1247
 		$repo = $matches[1];
1248 1248
 		if ($repo == 'http://svn.egroupware.org/egroupware') $repo = 'svn+ssh://[email protected]/egroupware';
1249 1249
 		$config['modules'][$repo][$config['aliasdir'].'/'.$module] = $url;
@@ -1257,11 +1257,11 @@  discard block
 block discarded – undo
1257 1257
  */
1258 1258
 function do_svntag()
1259 1259
 {
1260
-	global $config,$svn;
1260
+	global $config, $svn;
1261 1261
 
1262
-	if (empty($config['svntag'])) return;	// otherwise we copy everything in svn root!
1262
+	if (empty($config['svntag'])) return; // otherwise we copy everything in svn root!
1263 1263
 
1264
-	$config['svntag'] = config_translate('svntag');	// allow to use config vars like $version in tag
1264
+	$config['svntag'] = config_translate('svntag'); // allow to use config vars like $version in tag
1265 1265
 
1266 1266
 	echo "Creating SVN tag $config[svntag]\n";
1267 1267
 	if (!isset($config['modules']))
@@ -1269,9 +1269,9 @@  discard block
 block discarded – undo
1269 1269
 		get_modules_per_repo();
1270 1270
 	}
1271 1271
 	// create tags (per repo)
1272
-	foreach($config['modules'] as $repo => $modules)
1272
+	foreach ($config['modules'] as $repo => $modules)
1273 1273
 	{
1274
-		$cmd = $svn.' cp --parents -m '.escapeshellarg('Creating '.$config['svntag']).' '.implode(' ',$modules).' '.$repo.'/'.$config['svntag'].'/';
1274
+		$cmd = $svn.' cp --parents -m '.escapeshellarg('Creating '.$config['svntag']).' '.implode(' ', $modules).' '.$repo.'/'.$config['svntag'].'/';
1275 1275
 		run_cmd($cmd);
1276 1276
 	}
1277 1277
 }
@@ -1284,7 +1284,7 @@  discard block
 block discarded – undo
1284 1284
  * @param int|array $no_bailout =null exit code(s) to NOT bail out
1285 1285
  * @return int exit code of $cmd
1286 1286
  */
1287
-function run_cmd($cmd,array &$output=null,$no_bailout=null)
1287
+function run_cmd($cmd, array &$output = null, $no_bailout = null)
1288 1288
 {
1289 1289
 	global $verbose;
1290 1290
 
@@ -1292,18 +1292,18 @@  discard block
 block discarded – undo
1292 1292
 	{
1293 1293
 		echo $cmd."\n";
1294 1294
 		$ret = null;
1295
-		system($cmd,$ret);
1295
+		system($cmd, $ret);
1296 1296
 	}
1297 1297
 	else
1298 1298
 	{
1299 1299
 		$output[] = $cmd;
1300
-		exec($cmd,$output,$ret);
1301
-		if ($verbose) echo implode("\n",$output)."\n";
1300
+		exec($cmd, $output, $ret);
1301
+		if ($verbose) echo implode("\n", $output)."\n";
1302 1302
 	}
1303
-	if ($ret && !in_array($ret,(array)$no_bailout))
1303
+	if ($ret && !in_array($ret, (array)$no_bailout))
1304 1304
 	{
1305
-		if (!$verbose) echo implode("\n",$output)."\n";
1306
-		throw new Exception("Error during '$cmd' --> aborting",$ret);
1305
+		if (!$verbose) echo implode("\n", $output)."\n";
1306
+		throw new Exception("Error during '$cmd' --> aborting", $ret);
1307 1307
 	}
1308 1308
 	return $ret;
1309 1309
 }
@@ -1330,7 +1330,7 @@  discard block
 block discarded – undo
1330 1330
 			return 'NULL';
1331 1331
 		case 'object':
1332 1332
 		case 'array':
1333
-			return str_replace(array("\n",'    '/*,'Array'*/),'',print_r($var,true));
1333
+			return str_replace(array("\n", '    '/*,'Array'*/), '', print_r($var, true));
1334 1334
 	}
1335 1335
 	return 'UNKNOWN TYPE!';
1336 1336
 }
@@ -1340,9 +1340,9 @@  discard block
 block discarded – undo
1340 1340
  *
1341 1341
  * @param string $error =null optional error-message
1342 1342
  */
1343
-function usage($error=null)
1343
+function usage($error = null)
1344 1344
 {
1345
-	global $prog,$config,$verbose;
1345
+	global $prog, $config, $verbose;
1346 1346
 
1347 1347
 	echo "Usage: $prog [-h|--help] [-v|--verbose] [options, ...]\n\n";
1348 1348
 	echo "options and their defaults:\n";
@@ -1352,12 +1352,12 @@  discard block
 block discarded – undo
1352 1352
 	}
1353 1353
 	else
1354 1354
 	{
1355
-		unset($config['modules']);	// they give an error, because of nested array and are quite lengthy
1355
+		unset($config['modules']); // they give an error, because of nested array and are quite lengthy
1356 1356
 	}
1357
-	foreach($config as $name => $default)
1357
+	foreach ($config as $name => $default)
1358 1358
 	{
1359
-		if (is_array($default)) $default = json_encode ($default, JSON_UNESCAPED_SLASHES);
1360
-		echo '--'.str_pad($name,20).$default."\n";
1359
+		if (is_array($default)) $default = json_encode($default, JSON_UNESCAPED_SLASHES);
1360
+		echo '--'.str_pad($name, 20).$default."\n";
1361 1361
 	}
1362 1362
 	if ($error)
1363 1363
 	{
Please login to merge, or discard this patch.
doc/rpm-build/post_install.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
  *
486 486
  * @param string $cmd
487 487
  * @param array &$output=null $output of command
488
- * @param int|array|true $no_bailout =null exit code(s) to NOT bail out, or true to never bail out
488
+ * @param integer $no_bailout =null exit code(s) to NOT bail out, or true to never bail out
489 489
  * @return int exit code of $cmd
490 490
  */
491 491
 function run_cmd($cmd,array &$output=null,$no_bailout=null)
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
  * Read one Univention secret/password eg. _ucr_secret('mysql')
713 713
  *
714 714
  * @param string $name
715
- * @return string|boolean
715
+ * @return false|string
716 716
  */
717 717
 function _ucr_secret($name)
718 718
 {
Please login to merge, or discard this patch.
Braces   +86 added lines, -22 removed lines patch added patch discarded remove patch
@@ -9,10 +9,13 @@  discard block
 block discarded – undo
9 9
  * @version $Id$
10 10
  */
11 11
 
12
-if (php_sapi_name() !== 'cli')	// security precaution: forbit calling post_install as web-page
12
+if (php_sapi_name() !== 'cli')
13
+{
14
+	// security precaution: forbit calling post_install as web-page
13 15
 {
14 16
 	die('<h1>post_install.php must NOT be called as web-page --> exiting !!!</h1>');
15 17
 }
18
+}
16 19
 $verbose = false;
17 20
 $config = array(
18 21
 	'php'         => PHP_BINARY,
@@ -100,7 +103,10 @@  discard block
 block discarded – undo
100 103
 	{
101 104
 		case 'suse':
102 105
 			// openSUSE 12.1+ no longer uses php5
103
-			if (file_exists('/usr/bin/php5')) $config['php'] = '/usr/bin/php5';
106
+			if (file_exists('/usr/bin/php5'))
107
+			{
108
+				$config['php'] = '/usr/bin/php5';
109
+			}
104 110
 			$config['start_db'] = '/sbin/service mysql';
105 111
 			$config['autostart_db'] = '/sbin/chkconfig --level 345 mysql on';
106 112
 			$config['start_webserver'] = '/sbin/service apache2';
@@ -145,9 +151,12 @@  discard block
 block discarded – undo
145 151
 			// fall through
146 152
 		case 'rh':
147 153
 			// some MySQL packages (mysql.com, MariaDB, ...) use "mysql" as service name instead of RH default "mysqld"
148
-			if (file_exists('/usr/bin/systemctl'))	// RHEL 7
154
+			if (file_exists('/usr/bin/systemctl'))
155
+			{
156
+				// RHEL 7
149 157
 			{
150 158
 				$config['start_db'] = '/usr/bin/systemctl %s mariadb';
159
+			}
151 160
 				$config['autostart_db'] = build_cmd('start_db', 'enable');
152 161
 				$config['start_webserver'] = '/usr/bin/systemctl %s httpd';
153 162
 				$config['autostart_webserver'] = build_cmd('start_webserver', 'enable');
@@ -176,11 +185,14 @@  discard block
 block discarded – undo
176 185
 	while($config_set)
177 186
 	{
178 187
 		$val = array_shift($config_set);
179
-		if (($quote = $val[0]) == "'" || $quote == '"')	// arguments might be quoted with ' or "
188
+		if (($quote = $val[0]) == "'" || $quote == '"')
189
+		{
190
+			// arguments might be quoted with ' or "
180 191
 		{
181 192
 			while (substr($val,-1) != $quote)
182 193
 			{
183 194
 				if (!$config_set) throw new Exception('Invalid EGW_POST_INSTALL enviroment variable!');
195
+		}
184 196
 				$val .= ' '.array_shift($config_set);
185 197
 			}
186 198
 			$val = substr($val,1,-1);
@@ -245,8 +257,11 @@  discard block
 block discarded – undo
245 257
 // basic config checks
246 258
 foreach(array('php','source_dir','data_dir','setup-cli') as $name)
247 259
 {
248
-	if (!file_exists($config[$name])) bail_out(1,$config[$name].' not found!');
249
-}
260
+	if (!file_exists($config[$name]))
261
+	{
262
+		bail_out(1,$config[$name].' not found!');
263
+	}
264
+	}
250 265
 
251 266
 // fix important php.ini and conf.d/*.ini settings
252 267
 check_fix_php_apc_ini();
@@ -255,7 +270,9 @@  discard block
 block discarded – undo
255 270
 $setup_cli = $config['php'].' -d memory_limit=-1 '.$config['setup-cli'];
256 271
 
257 272
 // if we have a header, include it
258
-if (file_exists($config['header']) && filesize($config['header']) >= 200)	// default header redirecting to setup is 147 bytes
273
+if (file_exists($config['header']) && filesize($config['header']) >= 200)
274
+{
275
+	// default header redirecting to setup is 147 bytes
259 276
 {
260 277
 	$GLOBALS['egw_info'] = array(
261 278
 		'flags' => array(
@@ -263,6 +280,7 @@  discard block
 block discarded – undo
263 280
 			'currentapp' => 'login',	// stop PHP Notice: Undefined index "currentapp" in pre 16.1 header
264 281
 		)
265 282
 	);
283
+}
266 284
 	include $config['header'];
267 285
 
268 286
 	// get user from header and replace password, as we dont know it
@@ -286,7 +304,10 @@  discard block
 block discarded – undo
286 304
 		if ($ret)
287 305
 		{
288 306
 			system(build_cmd('start_db', 'start'));
289
-			if (!empty($config['autostart_db'])) system($config['autostart_db']);
307
+			if (!empty($config['autostart_db']))
308
+			{
309
+				system($config['autostart_db']);
310
+			}
290 311
 		}
291 312
 	}
292 313
 	// create database
@@ -302,7 +323,10 @@  discard block
 block discarded – undo
302 323
 	@list($config['account_repository'],$config['auth_type'],$rest) = explode(',',$config['account-auth'],3);
303 324
 	$extra_config .= ' '.escapeshellarg('account_repository='.$config['account_repository']);
304 325
 	$extra_config .= ' '.escapeshellarg('auth_type='.(empty($config['auth_type']) ? $config['account_repository'] : $config['auth_type']));
305
-	if (empty($rest)) unset($config['account-auth']);
326
+	if (empty($rest))
327
+	{
328
+		unset($config['account-auth']);
329
+	}
306 330
 	if ($config['account_repository'] == 'ldap' || $config['auth_type'] == 'ldap')
307 331
 	{
308 332
 		// set account_min_id to 1100 if not specified to NOT clash with system accounts
@@ -362,7 +386,10 @@  discard block
 block discarded – undo
362 386
 	$setup_mailserver = $setup_cli.' --config '.escapeshellarg($config['domain'].','.$config['config_user'].','.$config['config_passwd']);
363 387
 	foreach(array('account-auth','smtpserver','smtp','postfix','mailserver','imap','cyrus','sieve','folder') as $name)
364 388
 	{
365
-		if (!empty($config[$name])) $setup_mailserver .= ' --'.$name.' '.escapeshellarg($config[$name]);
389
+		if (!empty($config[$name]))
390
+		{
391
+			$setup_mailserver .= ' --'.$name.' '.escapeshellarg($config[$name]);
392
+		}
366 393
 	}
367 394
 	run_cmd($setup_mailserver);
368 395
 
@@ -378,7 +405,10 @@  discard block
 block discarded – undo
378 405
 		if ($ret)
379 406
 		{
380 407
 			system(build_cmd('start_webserver', 'start'));
381
-			if (!empty($config['autostart_webserver'])) system($config['autostart_webserver']);
408
+			if (!empty($config['autostart_webserver']))
409
+			{
410
+				system($config['autostart_webserver']);
411
+			}
382 412
 		}
383 413
 		else
384 414
 		{
@@ -424,10 +454,16 @@  discard block
 block discarded – undo
424 454
 			$header_update = $setup_cli.' --update-header '.escapeshellarg($config['config_passwd'].','.$config['config_user']);
425 455
 			run_cmd($header_update);
426 456
 			$ret = run_cmd($setup_update,$output,15);
427
-			if ($ret != 15) break;
457
+			if ($ret != 15)
458
+			{
459
+				break;
460
+			}
428 461
 			// fall through
429 462
 		case 15:	// missing configuration (eg. mailserver)
430
-			if (!$verbose) echo implode("\n",(array)$output)."\n";
463
+			if (!$verbose)
464
+			{
465
+				echo implode("\n",(array)$output)."\n";
466
+			}
431 467
 			break;
432 468
 
433 469
 		case 0:
@@ -457,9 +493,15 @@  discard block
 block discarded – undo
457 493
 {
458 494
 	global $config;
459 495
 
460
-	if (isset($config[$cmd])) $cmd = $config[$cmd];
496
+	if (isset($config[$cmd]))
497
+	{
498
+		$cmd = $config[$cmd];
499
+	}
461 500
 
462
-	if (strpos($cmd, '%s')) return str_replace('%s', $arg, $cmd);
501
+	if (strpos($cmd, '%s'))
502
+	{
503
+		return str_replace('%s', $arg, $cmd);
504
+	}
463 505
 
464 506
 	return $cmd.' '.$arg;
465 507
 }
@@ -528,7 +570,10 @@  discard block
 block discarded – undo
528 570
  */
529 571
 function bail_out($ret=1,$output=null)
530 572
 {
531
-	if ($output) echo implode("\n",(array)$output);
573
+	if ($output)
574
+	{
575
+		echo implode("\n",(array)$output);
576
+	}
532 577
 	echo "\n\nInstallation failed --> exiting!\n\n";
533 578
 	exit($ret);
534 579
 }
@@ -574,7 +619,11 @@  discard block
 block discarded – undo
574 619
 	echo "options and their defaults:\n";
575 620
 	foreach($config as $name => $default)
576 621
 	{
577
-		if (in_array($name, array('postfix','cyrus'))) continue;	// do NOT report deprecated options
622
+		if (in_array($name, array('postfix','cyrus')))
623
+		{
624
+			continue;
625
+		}
626
+		// do NOT report deprecated options
578 627
 		if (in_array($name,array('config_passwd','db_pass','admin_passwd','ldap_root_pw')) && strlen($config[$name]) == 16)
579 628
 		{
580 629
 			$default = '<16 char random string>';
@@ -667,7 +716,10 @@  discard block
 block discarded – undo
667 716
 			// only set on host mailserver app is installed: _ucr_get('mail/cyrus/imap') == 'yes' &&
668 717
 			($domains=_ucr_get('mail/hosteddomains')))
669 718
 		{
670
-			if (!is_array($domains)) $domains = explode("\n", $domains);
719
+			if (!is_array($domains))
720
+			{
721
+				$domains = explode("\n", $domains);
722
+			}
671 723
 			$domain = array_shift($domains);
672 724
 			// set "use auth with session credentials",tls,"not user editable","further identities"
673 725
 			$config['smtpserver'] = "$mailserver,465,,,yes,tls,no,yes";
@@ -686,13 +738,19 @@  discard block
 block discarded – undo
686 738
 					$config['imap'] = ',,Imap\\Dovecot';
687 739
 				}
688 740
 				// default with sieve port to 4190, as config is only available on host mailserver app is installed
689
-				if (!($sieve_port = _ucr_get('mail/dovecot/sieve/port'))) $sieve_port = 4190;
741
+				if (!($sieve_port = _ucr_get('mail/dovecot/sieve/port')))
742
+				{
743
+					$sieve_port = 4190;
744
+				}
690 745
 			}
691 746
 			else
692 747
 			{
693 748
 				$config['imap'] = /*'cyrus,'._ucr_secret('cyrus')*/','.',Imap\\Cyrus';
694 749
 				// default with sieve port to 4190, as config is only available on host mailserver app is installed
695
-				if (!($sieve_port = _ucr_get('mail/cyrus/sieve/port'))) $sieve_port = 4190;
750
+				if (!($sieve_port = _ucr_get('mail/cyrus/sieve/port')))
751
+				{
752
+					$sieve_port = 4190;
753
+				}
696 754
 			}
697 755
 			// set folders so mail creates them on first login, UCS does not automatic
698 756
 			$config['folder'] = 'INBOX/Sent,INBOX/Trash,INBOX/Drafts,INBOX/Templates,Spam,,Ham';
@@ -757,7 +815,10 @@  discard block
 block discarded – undo
757 815
 		$shm_size = ini_get('apc.shm_size');
758 816
 		$shm_segments = ini_get('apc.shm_segments');
759 817
 		// ancent APC (3.1.3) in Debian 6/Squezze has size in MB without a unit
760
-		if (($numeric_size = is_numeric($shm_size) && $shm_size <= 1048576)) $shm_size .= 'M';
818
+		if (($numeric_size = is_numeric($shm_size) && $shm_size <= 1048576))
819
+		{
820
+			$shm_size .= 'M';
821
+		}
761 822
 
762 823
 		$size = _size_with_unit($shm_size) * $shm_segments;
763 824
 		//echo "shm_size=$shm_size, shm_segments=$shm_segments --> $size, numeric_size=$numeric_size\n";
@@ -773,7 +834,10 @@  discard block
 block discarded – undo
773 834
 				file_exists($path = $matches[1]) && ($apc_ini = file_get_contents($path)))
774 835
 			{
775 836
 				$new_shm_size = 128 / $shm_segments;
776
-				if (!$numeric_size) $new_shm_size .= 'M';
837
+				if (!$numeric_size)
838
+				{
839
+					$new_shm_size .= 'M';
840
+				}
777 841
 				if (preg_match('|^apc.shm_size\s*=\s*(\d+[KMG]?)$|m', $apc_ini))
778 842
 				{
779 843
 					file_put_contents($path, preg_replace('|^apc.shm_size\s*=\s*(\d+[KMG]?)$|m', 'apc.shm_size='.$new_shm_size, $apc_ini));
Please login to merge, or discard this patch.
Spacing   +82 added lines, -85 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	'php'         => PHP_BINARY,
19 19
 	'source_dir'  => realpath(__DIR__.'/../..'),
20 20
 	'data_dir'    => '/var/lib/egroupware',
21
-	'header'      => '$data_dir/header.inc.php',	// symlinked to source_dir by rpm
21
+	'header'      => '$data_dir/header.inc.php', // symlinked to source_dir by rpm
22 22
 	'setup-cli'   => '$source_dir/setup/setup-cli.php',
23 23
 	'domain'      => 'default',
24 24
 	'config_user' => 'admin',
@@ -30,13 +30,13 @@  discard block
 block discarded – undo
30 30
 	'db_user'     => 'egroupware',
31 31
 	'db_pass'     => randomstring(),
32 32
 	'db_grant_host' => 'localhost',
33
-	'db_root'     => 'root',	// mysql root user/pw to create database
33
+	'db_root'     => 'root', // mysql root user/pw to create database
34 34
 	'db_root_pw'  => '',
35 35
 	'backup'      => '',
36 36
 	'admin_user'  => 'sysop',
37 37
 	'admin_passwd'=> randomstring(),
38 38
 	'admin_email' => '',
39
-	'lang'        => 'en',	// languages for admin user and extra lang to install
39
+	'lang'        => 'en', // languages for admin user and extra lang to install
40 40
 	'charset'     => 'utf-8',
41 41
 	'start_db'    => '/sbin/service mysqld',
42 42
 	'autostart_db' => '/sbin/chkconfig --level 345 mysqld on',
@@ -56,23 +56,23 @@  discard block
 block discarded – undo
56 56
 	'ldap_search_filter' => '(uid=%user)',
57 57
 	'ldap_group_context' => 'ou=groups,$base',
58 58
 	'ldap_encryption_type' => '',
59
-	'sambaadmin/sambasid'=> '',	// SID for sambaadmin
59
+	'sambaadmin/sambasid'=> '', // SID for sambaadmin
60 60
 	'mailserver'    => '',
61 61
 	'smtpserver'    => 'localhost,25',
62
-	'smtp'          => '',	// see setup-cli.php --help config
62
+	'smtp'          => '', // see setup-cli.php --help config
63 63
 	'imap'          => '',
64 64
 	'sieve'         => '',
65 65
 	'folder'        => '',
66
-	'install-update-app' => '',	// install or update a single (non-default) app
67
-	'webserver_user'=> 'apache',	// required to fix permissions
66
+	'install-update-app' => '', // install or update a single (non-default) app
67
+	'webserver_user'=> 'apache', // required to fix permissions
68 68
 	'php5enmod'     => '',
69 69
 );
70 70
 
71 71
 // read language from LANG enviroment variable
72 72
 if (($lang = isset($_ENV['LANG']) ? $_ENV['LANG'] : (isset($_SERVER['LANG']) ? $_SERVER['LANG'] : null)))
73 73
 {
74
-	@list($lang,$nat) = preg_split('/[_.]/',$lang);
75
-	if (in_array($lang.'-'.strtolower($nat),array('es-es','pt-br','zh-tw')))
74
+	@list($lang, $nat) = preg_split('/[_.]/', $lang);
75
+	if (in_array($lang.'-'.strtolower($nat), array('es-es', 'pt-br', 'zh-tw')))
76 76
 	{
77 77
 		$lang .= '-'.strtolower($nat);
78 78
 	}
@@ -85,16 +85,13 @@  discard block
 block discarded – undo
85 85
  *
86 86
  * @param string $distro =null default autodetect
87 87
  */
88
-function set_distro_defaults($distro=null)
88
+function set_distro_defaults($distro = null)
89 89
 {
90 90
 	global $config;
91 91
 	if (is_null($distro))
92 92
 	{
93
-		$distro = file_exists('/etc/SuSE-release') ? 'suse' :
94
-			(file_exists('/etc/mandriva-release') ? 'mandriva' :
95
-			(file_exists('/etc/lsb-release') && preg_match('/^DISTRIB_ID="?Univention"?$/mi',
96
-				file_get_contents('/etc/lsb-release')) ? 'univention' :
97
-			(file_exists('/etc/debian_version') ? 'debian' : 'rh')));
93
+		$distro = file_exists('/etc/SuSE-release') ? 'suse' : (file_exists('/etc/mandriva-release') ? 'mandriva' : (file_exists('/etc/lsb-release') && preg_match('/^DISTRIB_ID="?Univention"?$/mi',
94
+				file_get_contents('/etc/lsb-release')) ? 'univention' : (file_exists('/etc/debian_version') ? 'debian' : 'rh')));
98 95
 	}
99 96
 	switch (($config['distro'] = $distro))
100 97
 	{
@@ -154,9 +151,9 @@  discard block
 block discarded – undo
154 151
 			}
155 152
 			elseif (!file_exists('/etc/init.d/mysqld') && file_exists('/etc/init.d/mysql'))
156 153
 			{
157
-				foreach(array('start_db','autostart_db') as $name)
154
+				foreach (array('start_db', 'autostart_db') as $name)
158 155
 				{
159
-					$config[$name] = str_replace('mysqld','mysql',$config[$name]);
156
+					$config[$name] = str_replace('mysqld', 'mysql', $config[$name]);
160 157
 				}
161 158
 			}
162 159
 			break;
@@ -172,48 +169,48 @@  discard block
 block discarded – undo
172 169
 if (($config_set = isset($_ENV['EGW_POST_INSTALL']) ? $_ENV['EGW_POST_INSTALL'] : @$_SERVER['EGW_POST_INSTALL']))
173 170
 {
174 171
 	$conf = array();
175
-	$config_set = preg_split('/[ \t]+/',trim($config_set));
176
-	while($config_set)
172
+	$config_set = preg_split('/[ \t]+/', trim($config_set));
173
+	while ($config_set)
177 174
 	{
178 175
 		$val = array_shift($config_set);
179 176
 		if (($quote = $val[0]) == "'" || $quote == '"')	// arguments might be quoted with ' or "
180 177
 		{
181
-			while (substr($val,-1) != $quote)
178
+			while (substr($val, -1) != $quote)
182 179
 			{
183 180
 				if (!$config_set) throw new Exception('Invalid EGW_POST_INSTALL enviroment variable!');
184 181
 				$val .= ' '.array_shift($config_set);
185 182
 			}
186
-			$val = substr($val,1,-1);
183
+			$val = substr($val, 1, -1);
187 184
 		}
188 185
 		$conf[] = $val;
189 186
 	}
190
-	$argv = array_merge($conf,$argv);
187
+	$argv = array_merge($conf, $argv);
191 188
 }
192 189
 
193 190
 $auth_type_given = false;
194
-while(($arg = array_shift($argv)))
191
+while (($arg = array_shift($argv)))
195 192
 {
196 193
 	if ($arg == '-v' || $arg == '--verbose')
197 194
 	{
198 195
 		$verbose = true;
199 196
 	}
200
-	elseif($arg == '-h' || $arg == '--help')
197
+	elseif ($arg == '-h' || $arg == '--help')
201 198
 	{
202 199
 		usage();
203 200
 	}
204
-	elseif($arg == '--suse')
201
+	elseif ($arg == '--suse')
205 202
 	{
206 203
 		set_distro_defaults('suse');
207 204
 	}
208
-	elseif($arg == '--distro')
205
+	elseif ($arg == '--distro')
209 206
 	{
210 207
 		set_distro_defaults(array_shift($argv));
211 208
 	}
212
-	elseif(substr($arg,0,2) == '--' && isset($config[$name=substr($arg,2)]))
209
+	elseif (substr($arg, 0, 2) == '--' && isset($config[$name = substr($arg, 2)]))
213 210
 	{
214 211
 		$config[$name] = array_shift($argv);
215 212
 
216
-		switch($name)
213
+		switch ($name)
217 214
 		{
218 215
 			case 'auth_type':
219 216
 				$auth_type_given = true;
@@ -234,18 +231,18 @@  discard block
 block discarded – undo
234 231
 }
235 232
 
236 233
 $replace = array();
237
-foreach($config as $name => $value)
234
+foreach ($config as $name => $value)
238 235
 {
239 236
 	$replace['$'.$name] = $value;
240
-	if (strpos($value,'$') !== false)
237
+	if (strpos($value, '$') !== false)
241 238
 	{
242
-		$config[$name] = strtr($value,$replace);
239
+		$config[$name] = strtr($value, $replace);
243 240
 	}
244 241
 }
245 242
 // basic config checks
246
-foreach(array('php','source_dir','data_dir','setup-cli') as $name)
243
+foreach (array('php', 'source_dir', 'data_dir', 'setup-cli') as $name)
247 244
 {
248
-	if (!file_exists($config[$name])) bail_out(1,$config[$name].' not found!');
245
+	if (!file_exists($config[$name])) bail_out(1, $config[$name].' not found!');
249 246
 }
250 247
 
251 248
 // fix important php.ini and conf.d/*.ini settings
@@ -260,13 +257,13 @@  discard block
 block discarded – undo
260 257
 	$GLOBALS['egw_info'] = array(
261 258
 		'flags' => array(
262 259
 			'noapi' => true,
263
-			'currentapp' => 'login',	// stop PHP Notice: Undefined index "currentapp" in pre 16.1 header
260
+			'currentapp' => 'login', // stop PHP Notice: Undefined index "currentapp" in pre 16.1 header
264 261
 		)
265 262
 	);
266 263
 	include $config['header'];
267 264
 
268 265
 	// get user from header and replace password, as we dont know it
269
-	$old_password = patch_header($config['header'],$config['config_user'],$config['config_passwd']);
266
+	$old_password = patch_header($config['header'], $config['config_user'], $config['config_passwd']);
270 267
 	// register a shutdown function to put old password back in any case
271 268
 	register_shutdown_function(function() use (&$config, $old_password)
272 269
 	{
@@ -274,7 +271,7 @@  discard block
 block discarded – undo
274 271
 	});
275 272
 }
276 273
 // new header or does not include requested domain (!= "default") --> new install
277
-if (!isset($GLOBALS['egw_domain']) ||  $config['domain'] !== 'default' && !isset($GLOBALS['egw_domain'][$config['domain']]))
274
+if (!isset($GLOBALS['egw_domain']) || $config['domain'] !== 'default' && !isset($GLOBALS['egw_domain'][$config['domain']]))
278 275
 {
279 276
 	// --> new install
280 277
 	$extra_config = '';
@@ -291,7 +288,7 @@  discard block
 block discarded – undo
291 288
 	}
292 289
 	// create database
293 290
 	$setup_db = $setup_cli.' --setup-cmd-database sub_command=create_db';
294
-	foreach(array('domain','db_type','db_host','db_port','db_name','db_user','db_pass','db_root','db_root_pw','db_grant_host') as $name)
291
+	foreach (array('domain', 'db_type', 'db_host', 'db_port', 'db_name', 'db_user', 'db_pass', 'db_root', 'db_root_pw', 'db_grant_host') as $name)
295 292
 	{
296 293
 		$setup_db .= ' '.escapeshellarg($name.'='.$config[$name]);
297 294
 	}
@@ -299,7 +296,7 @@  discard block
 block discarded – undo
299 296
 
300 297
 	// check if ldap is required and initialise it
301 298
 	// we need to specify account_repository and auth_type to --install as extra config, otherwise install happens for sql!
302
-	@list($config['account_repository'],$config['auth_type'],$rest) = explode(',',$config['account-auth'],3);
299
+	@list($config['account_repository'], $config['auth_type'], $rest) = explode(',', $config['account-auth'], 3);
303 300
 	$extra_config .= ' '.escapeshellarg('account_repository='.$config['account_repository']);
304 301
 	$extra_config .= ' '.escapeshellarg('auth_type='.(empty($config['auth_type']) ? $config['account_repository'] : $config['auth_type']));
305 302
 	if (empty($rest)) unset($config['account-auth']);
@@ -310,15 +307,15 @@  discard block
 block discarded – undo
310 307
 
311 308
 		$setup_ldap = $setup_cli.' --setup-cmd-ldap sub_command='.
312 309
 			($config['account_repository'] == 'ldap' ? 'create_ldap' : 'test_ldap');
313
-		foreach(array(
314
-			'domain','ldap_suffix','ldap_host','ldap_admin','ldap_admin_pw',	// non-egw params: only used for create
315
-			'ldap_base','ldap_root_dn','ldap_root_pw','ldap_context','ldap_search_filter','ldap_group_context',	// egw params
310
+		foreach (array(
311
+			'domain', 'ldap_suffix', 'ldap_host', 'ldap_admin', 'ldap_admin_pw', // non-egw params: only used for create
312
+			'ldap_base', 'ldap_root_dn', 'ldap_root_pw', 'ldap_context', 'ldap_search_filter', 'ldap_group_context', // egw params
316 313
 			'ldap_encryption_type', 'sambaadmin/sambasid',
317 314
 		) as $name)
318 315
 		{
319
-			if (strpos($value=$config[$name],'$') !== false)
316
+			if (strpos($value = $config[$name], '$') !== false)
320 317
 			{
321
-				$config[$name] = $value = strtr($value,array(
318
+				$config[$name] = $value = strtr($value, array(
322 319
 					'$suffix' => $config['ldap_suffix'],
323 320
 					'$base' => $config['ldap_base'],
324 321
 					'$admin_pw' => $config['ldap_admin_pw'],
@@ -326,7 +323,7 @@  discard block
 block discarded – undo
326 323
 			}
327 324
 			$setup_ldap .= ' '.escapeshellarg($name.'='.$value);
328 325
 
329
-			if (!in_array($name,array('domain','ldap_suffix','ldap_admin','ldap_admin_pw')))
326
+			if (!in_array($name, array('domain', 'ldap_suffix', 'ldap_admin', 'ldap_admin_pw')))
330 327
 			{
331 328
 				$extra_config .= ' '.escapeshellarg($name.'='.$value);
332 329
 			}
@@ -360,7 +357,7 @@  discard block
 block discarded – undo
360 357
 	}
361 358
 	// create mailserver config (fmail requires at least minimal config given as default, otherwise fatal error)
362 359
 	$setup_mailserver = $setup_cli.' --config '.escapeshellarg($config['domain'].','.$config['config_user'].','.$config['config_passwd']);
363
-	foreach(array('account-auth','smtpserver','smtp','postfix','mailserver','imap','cyrus','sieve','folder') as $name)
360
+	foreach (array('account-auth', 'smtpserver', 'smtp', 'postfix', 'mailserver', 'imap', 'cyrus', 'sieve', 'folder') as $name)
364 361
 	{
365 362
 		if (!empty($config[$name])) $setup_mailserver .= ' --'.$name.' '.escapeshellarg($config[$name]);
366 363
 	}
@@ -374,7 +371,7 @@  discard block
 block discarded – undo
374 371
 	// check if webserver is started and start it (permanent) if not
375 372
 	if ($config['start_webserver'])
376 373
 	{
377
-		exec(build_cmd('start_webserver', 'status'),$dummy,$ret);
374
+		exec(build_cmd('start_webserver', 'status'), $dummy, $ret);
378 375
 		if ($ret)
379 376
 		{
380 377
 			system(build_cmd('start_webserver', 'start'));
@@ -416,18 +413,18 @@  discard block
 block discarded – undo
416 413
 	// update egroupware, or single app(s), in later case skip backup
417 414
 	$setup_update = $setup_cli.' --update '.escapeshellarg('all,'.$config['config_user'].','.$config['config_passwd'].
418 415
 		(empty($config['install-update-app']) ? '' : ',no,'.$config['install-update-app']));
419
-	$ret = run_cmd($setup_update,$output,array(4,15));
416
+	$ret = run_cmd($setup_update, $output, array(4, 15));
420 417
 
421
-	switch($ret)
418
+	switch ($ret)
422 419
 	{
423 420
 		case 4:		// header needs an update
424 421
 			$header_update = $setup_cli.' --update-header '.escapeshellarg($config['config_passwd'].','.$config['config_user']);
425 422
 			run_cmd($header_update);
426
-			$ret = run_cmd($setup_update,$output,15);
423
+			$ret = run_cmd($setup_update, $output, 15);
427 424
 			if ($ret != 15) break;
428 425
 			// fall through
429 426
 		case 15:	// missing configuration (eg. mailserver)
430
-			if (!$verbose) echo implode("\n",(array)$output)."\n";
427
+			if (!$verbose) echo implode("\n", (array)$output)."\n";
431 428
 			break;
432 429
 
433 430
 		case 0:
@@ -472,18 +469,18 @@  discard block
 block discarded – undo
472 469
  * @param string $password new password
473 470
  * @return string old password
474 471
  */
475
-function patch_header($filename,&$user,$password)
472
+function patch_header($filename, &$user, $password)
476 473
 {
477 474
 	$header = file_get_contents($filename);
478 475
 
479 476
 	$umatches = $pmatches = null;
480
-	if (!preg_match('/'.preg_quote("\$GLOBALS['egw_info']['server']['header_admin_user'] = '", '/')."([^']+)';/m",$header,$umatches) ||
481
-		!preg_match('/'.preg_quote("\$GLOBALS['egw_info']['server']['header_admin_password'] = '", '/')."([^']*)';/m",$header,$pmatches))
477
+	if (!preg_match('/'.preg_quote("\$GLOBALS['egw_info']['server']['header_admin_user'] = '", '/')."([^']+)';/m", $header, $umatches) ||
478
+		!preg_match('/'.preg_quote("\$GLOBALS['egw_info']['server']['header_admin_password'] = '", '/')."([^']*)';/m", $header, $pmatches))
482 479
 	{
483
-		bail_out(99,"$filename is no regular EGroupware header.inc.php!");
480
+		bail_out(99, "$filename is no regular EGroupware header.inc.php!");
484 481
 	}
485
-	file_put_contents($filename,preg_replace('/'.preg_quote("\$GLOBALS['egw_info']['server']['header_admin_password'] = '", '/')."([^']*)';/m",
486
-		"\$GLOBALS['egw_info']['server']['header_admin_password'] = '".$password."';",$header));
482
+	file_put_contents($filename, preg_replace('/'.preg_quote("\$GLOBALS['egw_info']['server']['header_admin_password'] = '", '/')."([^']*)';/m",
483
+		"\$GLOBALS['egw_info']['server']['header_admin_password'] = '".$password."';", $header));
487 484
 
488 485
 	$user = $umatches[1];
489 486
 
@@ -498,7 +495,7 @@  discard block
 block discarded – undo
498 495
  * @param int|array|true $no_bailout =null exit code(s) to NOT bail out, or true to never bail out
499 496
  * @return int exit code of $cmd
500 497
  */
501
-function run_cmd($cmd,array &$output=null,$no_bailout=null)
498
+function run_cmd($cmd, array &$output = null, $no_bailout = null)
502 499
 {
503 500
 	global $verbose;
504 501
 
@@ -506,16 +503,16 @@  discard block
 block discarded – undo
506 503
 	{
507 504
 		echo $cmd."\n";
508 505
 		$ret = null;
509
-		system($cmd,$ret);
506
+		system($cmd, $ret);
510 507
 	}
511 508
 	else
512 509
 	{
513 510
 		$output[] = $cmd;
514
-		exec($cmd,$output,$ret);
511
+		exec($cmd, $output, $ret);
515 512
 	}
516
-	if ($ret && $no_bailout !== true && !in_array($ret,(array)$no_bailout))
513
+	if ($ret && $no_bailout !== true && !in_array($ret, (array)$no_bailout))
517 514
 	{
518
-		bail_out($ret,$verbose?null:$output);
515
+		bail_out($ret, $verbose ?null:$output);
519 516
 	}
520 517
 	return $ret;
521 518
 }
@@ -526,9 +523,9 @@  discard block
 block discarded – undo
526 523
  * @param int $ret =1
527 524
  * @param array|string $output line(s) to output before temination notice
528 525
  */
529
-function bail_out($ret=1,$output=null)
526
+function bail_out($ret = 1, $output = null)
530 527
 {
531
-	if ($output) echo implode("\n",(array)$output);
528
+	if ($output) echo implode("\n", (array)$output);
532 529
 	echo "\n\nInstallation failed --> exiting!\n\n";
533 530
 	exit($ret);
534 531
 }
@@ -539,24 +536,24 @@  discard block
 block discarded – undo
539 536
  * @param int $len =16
540 537
  * @return string
541 538
  */
542
-function randomstring($len=16)
539
+function randomstring($len = 16)
543 540
 {
544 541
 	static $usedchars = array(
545
-		'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f',
546
-		'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v',
547
-		'w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L',
548
-		'M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
549
-		'@','!','%','&','(',')','=','?',';',':','#','_','-','<',
550
-		'>','|','[',']','}',	// dont add /\,'"{ as we have problems dealing with them
542
+		'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f',
543
+		'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
544
+		'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L',
545
+		'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
546
+		'@', '!', '%', '&', '(', ')', '=', '?', ';', ':', '#', '_', '-', '<',
547
+		'>', '|', '[', ']', '}', // dont add /\,'"{ as we have problems dealing with them
551 548
 	);
552 549
 
553 550
 	// use cryptographically secure random_int available in PHP 7+
554 551
 	$func = function_exists('random_int') ? 'random_int' : 'mt_rand';
555 552
 
556 553
 	$str = '';
557
-	for($i=0; $i < $len; $i++)
554
+	for ($i = 0; $i < $len; $i++)
558 555
 	{
559
-		$str .= $usedchars[$func(0,count($usedchars)-1)];
556
+		$str .= $usedchars[$func(0, count($usedchars) - 1)];
560 557
 	}
561 558
 	return $str;
562 559
 }
@@ -566,20 +563,20 @@  discard block
 block discarded – undo
566 563
  *
567 564
  * @param string $error =null optional error-message
568 565
  */
569
-function usage($error=null)
566
+function usage($error = null)
570 567
 {
571
-	global $prog,$config;
568
+	global $prog, $config;
572 569
 
573 570
 	echo "Usage: $prog [-h|--help] [-v|--verbose] [--distro=(suse|rh|debian)] [options, ...]\n\n";
574 571
 	echo "options and their defaults:\n";
575
-	foreach($config as $name => $default)
572
+	foreach ($config as $name => $default)
576 573
 	{
577
-		if (in_array($name, array('postfix','cyrus'))) continue;	// do NOT report deprecated options
578
-		if (in_array($name,array('config_passwd','db_pass','admin_passwd','ldap_root_pw')) && strlen($config[$name]) == 16)
574
+		if (in_array($name, array('postfix', 'cyrus'))) continue; // do NOT report deprecated options
575
+		if (in_array($name, array('config_passwd', 'db_pass', 'admin_passwd', 'ldap_root_pw')) && strlen($config[$name]) == 16)
579 576
 		{
580 577
 			$default = '<16 char random string>';
581 578
 		}
582
-		echo '--'.str_pad($name,20).$default."\n";
579
+		echo '--'.str_pad($name, 20).$default."\n";
583 580
 	}
584 581
 	if ($error)
585 582
 	{
@@ -629,8 +626,8 @@  discard block
 block discarded – undo
629 626
 	$config['distro'] = 'univention';
630 627
 
631 628
 	// set lang from ucr locale, as cloud-config at least never has anything but EN set in enviroment
632
-	@list($lang,$nat) = preg_split('/[_.]/', _ucr_get('locale/default'));
633
-	if (in_array($lang.'-'.strtolower($nat),array('es-es','pt-br','zh-tw')))
629
+	@list($lang, $nat) = preg_split('/[_.]/', _ucr_get('locale/default'));
630
+	if (in_array($lang.'-'.strtolower($nat), array('es-es', 'pt-br', 'zh-tw')))
634 631
 	{
635 632
 		$lang .= '-'.strtolower($nat);
636 633
 	}
@@ -655,7 +652,7 @@  discard block
 block discarded – undo
655 652
 		// ldap password hash (our default blowfish_crypt seems not to work)
656 653
 		$config['ldap_encryption_type'] = 'sha512_crypt';
657 654
 
658
-		$config['account_min_id'] = 1200;	// UCS use 11xx for internal users/groups
655
+		$config['account_min_id'] = 1200; // UCS use 11xx for internal users/groups
659 656
 
660 657
 		$config['account-auth'] = 'univention,ldap';
661 658
 
@@ -665,7 +662,7 @@  discard block
 block discarded – undo
665 662
 		// mailserver, see setup-cli.php --help config
666 663
 		if (($mailserver = exec('/usr/bin/univention-ldapsearch -x "(univentionAppID=mailserver_*)" univentionAppInstalledOnServer|sed -n "s/univentionAppInstalledOnServer: \(.*\)/\1/p"')) &&
667 664
 			// only set on host mailserver app is installed: _ucr_get('mail/cyrus/imap') == 'yes' &&
668
-			($domains=_ucr_get('mail/hosteddomains')))
665
+			($domains = _ucr_get('mail/hosteddomains')))
669 666
 		{
670 667
 			if (!is_array($domains)) $domains = explode("\n", $domains);
671 668
 			$domain = array_shift($domains);
@@ -714,12 +711,12 @@  discard block
 block discarded – undo
714 711
  */
715 712
 function _ucr_get($name)
716 713
 {
717
-	static $values=null;
714
+	static $values = null;
718 715
 	if (!isset($values))
719 716
 	{
720 717
 		$output = $matches = null;
721 718
 		exec('/usr/sbin/ucr dump', $output);
722
-		foreach($output as $line)
719
+		foreach ($output as $line)
723 720
 		{
724 721
 			if (preg_match("/^([^:]+): (.*)\n?$/", $line, $matches))
725 722
 			{
@@ -795,7 +792,7 @@  discard block
 block discarded – undo
795 792
  */
796 793
 function _size_with_unit($size)
797 794
 {
798
-	switch(strtoupper(substr($size, -1)))
795
+	switch (strtoupper(substr($size, -1)))
799 796
 	{
800 797
 		case 'G':
801 798
 			$size *= 1024;
Please login to merge, or discard this patch.
filemanager/inc/class.filemanager_admin.inc.php 3 patches
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -75,8 +75,7 @@
 block discarded – undo
75 75
 	/**
76 76
 	 * Mount GUI
77 77
 	 *
78
-	 * @param array $content=null
79
-	 * @param string $msg=''
78
+	 * @param array $content
80 79
 	 */
81 80
 	public function index(array $content=null, $msg='', $msg_type=null)
82 81
 	{
Please login to merge, or discard this patch.
Braces   +16 added lines, -4 removed lines patch added patch discarded remove patch
@@ -131,7 +131,10 @@  discard block
 block discarded – undo
131 131
 					($content['mounts']['enable'] || self::$is_setup && $content['mounts']['mount']))
132 132
 				{
133 133
 					$url = str_replace('$path',$path,$content['mounts']['url']);
134
-					if (empty($url) && $this->versioning) $url = Versioning\StreamWrapper::PREFIX.$path;
134
+					if (empty($url) && $this->versioning)
135
+					{
136
+						$url = Versioning\StreamWrapper::PREFIX.$path;
137
+					}
135 138
 
136 139
 					if ($content['mounts']['enable'] && !$this->versioning)
137 140
 					{
@@ -227,16 +230,25 @@  discard block
 block discarded – undo
227 230
 			$content['versionedpath'] = '/';
228 231
 			$content['mtime'] = 100;
229 232
 		}
230
-		if (true) $content = array(
233
+		if (true)
234
+		{
235
+			$content = array(
231 236
 			'versionedpath' => $content['versionedpath'],
232 237
 			'mtime' => $content['mtime'],
233 238
 		);
239
+		}
234 240
 		if ($this->versioning)
235 241
 		{
236 242
 			// statistical information
237 243
 			$content += Versioning\StreamWrapper::summary();
238
-			if ($content['total_files']) $content['percent_files'] = number_format(100.0*$content['version_files']/$content['total_files'],1).'%';
239
-			if ($content['total_size']) $content['percent_size'] = number_format(100.0*$content['version_size']/$content['total_size'],1).'%';
244
+			if ($content['total_files'])
245
+			{
246
+				$content['percent_files'] = number_format(100.0*$content['version_files']/$content['total_files'],1).'%';
247
+			}
248
+			if ($content['total_size'])
249
+			{
250
+				$content['percent_size'] = number_format(100.0*$content['version_size']/$content['total_size'],1).'%';
251
+			}
240 252
 		}
241 253
 		if (!($content['is_root']=Vfs::$is_root))
242 254
 		{
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -78,14 +78,14 @@  discard block
 block discarded – undo
78 78
 	 * @param array $content=null
79 79
 	 * @param string $msg=''
80 80
 	 */
81
-	public function index(array $content=null, $msg='', $msg_type=null)
81
+	public function index(array $content = null, $msg = '', $msg_type = null)
82 82
 	{
83 83
 		if (is_array($content))
84 84
 		{
85 85
 			//_debug_array($content);
86 86
 			if ($content['sudo'])
87 87
 			{
88
-				$msg = $this->sudo($content['user'],$content['password'],self::$is_setup) ?
88
+				$msg = $this->sudo($content['user'], $content['password'], self::$is_setup) ?
89 89
 					lang('Root access granted.') : lang('Wrong username or password!');
90 90
 				$msg_type = Vfs::$is_root ? 'success' : 'error';
91 91
 			}
@@ -99,14 +99,14 @@  discard block
 block discarded – undo
99 99
 				Vfs::chgrp($path, 'Admins');
100 100
 				Vfs::chmod($path, 075);
101 101
 				$msg = Vfs::mount($url, $path) ?
102
-					lang('Successful mounted %1 on %2.',$url,$path) : lang('Error mounting %1 on %2!',$url,$path);
102
+					lang('Successful mounted %1 on %2.', $url, $path) : lang('Error mounting %1 on %2!', $url, $path);
103 103
 				Vfs::$is_root = $backup;
104 104
 			}
105 105
 			elseif (Vfs::$is_root)
106 106
 			{
107 107
 				if ($content['logout'])
108 108
 				{
109
-					$msg = $this->sudo('','',self::$is_setup) ? 'Logout failed!' : lang('Root access stopped.');
109
+					$msg = $this->sudo('', '', self::$is_setup) ? 'Logout failed!' : lang('Root access stopped.');
110 110
 					$msg_type = !Vfs::$is_root ? 'success' : 'error';
111 111
 				}
112 112
 				if ($content['mounts']['disable'] || self::$is_setup && $content['mounts']['umount'])
@@ -122,18 +122,18 @@  discard block
 block discarded – undo
122 122
 					if (!in_array($path, self::$protected_path) && $path != '/')
123 123
 					{
124 124
 						$msg = Vfs::umount($path) ?
125
-							lang('%1 successful unmounted.',$path) : lang('Error unmounting %1!',$path);
125
+							lang('%1 successful unmounted.', $path) : lang('Error unmounting %1!', $path);
126 126
 					}
127 127
 					else	// re-mount / with sqlFS, to disable versioning
128 128
 					{
129
-						$msg = Vfs::mount($url=Vfs\Sqlfs\StreamWrapper::SCHEME.'://default'.$path,$path) ?
130
-							lang('Successful mounted %1 on %2.',$url,$path) : lang('Error mounting %1 on %2!',$url,$path);
129
+						$msg = Vfs::mount($url = Vfs\Sqlfs\StreamWrapper::SCHEME.'://default'.$path, $path) ?
130
+							lang('Successful mounted %1 on %2.', $url, $path) : lang('Error mounting %1 on %2!', $url, $path);
131 131
 					}
132 132
 				}
133 133
 				if (($path = $content['mounts']['path']) &&
134 134
 					($content['mounts']['enable'] || self::$is_setup && $content['mounts']['mount']))
135 135
 				{
136
-					$url = str_replace('$path',$path,$content['mounts']['url']);
136
+					$url = str_replace('$path', $path, $content['mounts']['url']);
137 137
 					if (empty($url) && $this->versioning) $url = Versioning\StreamWrapper::PREFIX.$path;
138 138
 
139 139
 					if ($content['mounts']['enable'] && !$this->versioning)
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 					}
144 144
 					elseif (!Vfs::file_exists($path) || !Vfs::is_dir($path))
145 145
 					{
146
-						$msg = lang('Path %1 not found or not a directory!',$path);
146
+						$msg = lang('Path %1 not found or not a directory!', $path);
147 147
 						$msg_type = 'error';
148 148
 					}
149 149
 					// dont allow to change mount of /apps or /templates (eg. switching on versioning)
@@ -154,8 +154,8 @@  discard block
 block discarded – undo
154 154
 					}
155 155
 					else
156 156
 					{
157
-						$msg = Vfs::mount($url,$path) ?
158
-							lang('Successful mounted %1 on %2.',$url,$path) : lang('Error mounting %1 on %2!',$url,$path);
157
+						$msg = Vfs::mount($url, $path) ?
158
+							lang('Successful mounted %1 on %2.', $url, $path) : lang('Error mounting %1 on %2!', $url, $path);
159 159
 					}
160 160
 				}
161 161
 				if ($content['allow_delete_versions'] != $GLOBALS['egw_info']['server']['allow_delete_versions'])
@@ -200,8 +200,8 @@  discard block
 block discarded – undo
200 200
 								'hidden' => true,
201 201
 								'depth' => true,
202 202
 								'path_preg' => '#/\.(attic|versions)/#',
203
-							)+(!(int)$content['mtime'] ? array() : array(
204
-								'mtime' => ($content['mtime']<0?'-':'+').(int)$content['mtime'],
203
+							) + (!(int)$content['mtime'] ? array() : array(
204
+								'mtime' => ($content['mtime'] < 0 ? '-' : '+').(int)$content['mtime'],
205 205
 							)), function($path) use (&$deleted, &$errors)
206 206
 							{
207 207
 								if (($is_dir = Vfs::is_dir($path)) && Vfs::rmdir($path) ||
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 								}
216 216
 							});
217 217
 						}
218
-						$time = number_format(microtime(true)-$starttime, 1);
218
+						$time = number_format(microtime(true) - $starttime, 1);
219 219
 						$msg = ($errors ? lang('%1 errors deleting!', $errors)."\n\n" : '').
220 220
 							lang('%1 files or directories deleted in %2 seconds.', $deleted, $time);
221 221
 						$msg_type = $errors ? 'error' : 'info';
@@ -238,10 +238,10 @@  discard block
 block discarded – undo
238 238
 		{
239 239
 			// statistical information
240 240
 			$content += Versioning\StreamWrapper::summary();
241
-			if ($content['total_files']) $content['percent_files'] = number_format(100.0*$content['version_files']/$content['total_files'],1).'%';
242
-			if ($content['total_size']) $content['percent_size'] = number_format(100.0*$content['version_size']/$content['total_size'],1).'%';
241
+			if ($content['total_files']) $content['percent_files'] = number_format(100.0 * $content['version_files'] / $content['total_files'], 1).'%';
242
+			if ($content['total_size']) $content['percent_size'] = number_format(100.0 * $content['version_size'] / $content['total_size'], 1).'%';
243 243
 		}
244
-		if (!($content['is_root']=Vfs::$is_root))
244
+		if (!($content['is_root'] = Vfs::$is_root))
245 245
 		{
246 246
 			if (empty($msg))
247 247
 			{
@@ -257,16 +257,16 @@  discard block
 block discarded – undo
257 257
 
258 258
 		$n = 2;
259 259
 		$content['mounts'] = array();
260
-		foreach(Vfs::mount() as $path => $url)
260
+		foreach (Vfs::mount() as $path => $url)
261 261
 		{
262 262
 			$content['mounts'][$n++] = array(
263 263
 				'path' => $path,
264 264
 				'url'  => $url,
265 265
 			);
266 266
 			$readonlys["disable[$path]"] = !$this->versioning || !Vfs::$is_root ||
267
-				Vfs::parse_url($url,PHP_URL_SCHEME) != $this->versioning;
267
+				Vfs::parse_url($url, PHP_URL_SCHEME) != $this->versioning;
268 268
 		}
269
-		$readonlys['umount[/]'] = $readonlys['umount[/apps]'] = true;	// do not allow to unmount / or /apps
269
+		$readonlys['umount[/]'] = $readonlys['umount[/apps]'] = true; // do not allow to unmount / or /apps
270 270
 		$readonlys['url'] = !self::$is_setup;
271 271
 
272 272
 		$sel_options['allow_delete_versions'] = array(
@@ -276,13 +276,13 @@  discard block
 block discarded – undo
276 276
 		);
277 277
 		// show [Mount /etemplates] button for admin, if not already mounted and available
278 278
 		$readonlys['etemplates'] = !class_exists('\EGroupware\Stylite\Vfs\Merge\StreamWrapper') ||
279
-			($fs_tab=Vfs::mount($url)) && isset($fs_tab['/etemplates']) ||
279
+			($fs_tab = Vfs::mount($url)) && isset($fs_tab['/etemplates']) ||
280 280
 			!isset($GLOBALS['egw_info']['user']['apps']['admin']);
281 281
 		//_debug_array($content);
282 282
 
283 283
 		$tpl = new Etemplate('filemanager.admin');
284 284
 		$GLOBALS['egw_info']['flags']['app_header'] = lang('VFS mounts and versioning');
285
-		$tpl->exec('filemanager.filemanager_admin.index',$content,$sel_options,$readonlys);
285
+		$tpl->exec('filemanager.filemanager_admin.index', $content, $sel_options, $readonlys);
286 286
 	}
287 287
 
288 288
 	/**
@@ -302,10 +302,10 @@  discard block
 block discarded – undo
302 302
 		}
303 303
 		$content = '<p>'.implode("</p>\n<p>", (array)$msgs)."</p>\n";
304 304
 
305
-		$content .= Api\Html::form('<p>'.($check_only&&is_array($msgs) ?
305
+		$content .= Api\Html::form('<p>'.($check_only && is_array($msgs) ?
306 306
 			Api\Html::submit_button('fix', lang('Fix reported problems')) : '').
307 307
 			Api\Html::submit_button('cancel', lang('Cancel')).'</p>',
308
-			'','/index.php',array('menuaction'=>'filemanager.filemanager_admin.fsck'));
308
+			'', '/index.php', array('menuaction'=>'filemanager.filemanager_admin.fsck'));
309 309
 
310 310
 		$GLOBALS['egw']->framework->render($content, lang('Admin').' - '.lang('Check virtual filesystem'), true);
311 311
 	}
Please login to merge, or discard this patch.
filemanager/inc/class.filemanager_favorite_portlet.inc.php 4 patches
Doc Comments   -2 removed lines patch added patch discarded remove patch
@@ -92,8 +92,6 @@
 block discarded – undo
92 92
 	 * Here we need to handle any incoming data.  Setup is done in the constructor,
93 93
 	 * output is handled by parent.
94 94
 	 *
95
-	 * @param type $id
96
-	 * @param Etemplate $etemplate
97 95
 	 */
98 96
 	public static function process($content = array())
99 97
 	{
Please login to merge, or discard this patch.
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -104,7 +104,10 @@
 block discarded – undo
104 104
 		if ($content['nm']['action'])
105 105
 		{
106 106
 			$msg = filemanager_ui::action($content['nm']['action'],$content['nm']['selected'],$content['nm']['path']);
107
-			if($msg) Api\Json\Response::get()->apply('egw.message',array($msg));
107
+			if($msg)
108
+			{
109
+				Api\Json\Response::get()->apply('egw.message',array($msg));
110
+			}
108 111
 			foreach($content['nm']['selected'] as &$id)
109 112
 			{
110 113
 				$id = 'filemanager::'.$id;
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
 	 * Construct the portlet
24 24
 	 *
25 25
 	 */
26
-	public function __construct(Array &$context = array(), &$need_reload = false)
26
+	public function __construct(array &$context = array(), &$need_reload = false)
27 27
 	{
28 28
 		$context['appname'] = 'filemanager';
29 29
 
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -28,13 +28,13 @@  discard block
 block discarded – undo
28 28
 		$context['appname'] = 'filemanager';
29 29
 
30 30
 		// Let parent handle the basic stuff
31
-		parent::__construct($context,$need_reload);
31
+		parent::__construct($context, $need_reload);
32 32
 
33 33
 		$this->nm_settings += array(
34 34
 			'get_rows'       => 'filemanager.filemanager_favorite_portlet.get_rows',
35 35
 			'csv_export'     => true,
36 36
 			// Use a different template so it can be accessed from client side
37
-			'template'       => ($this->nm_settings['view'] == 'tile' ? 'filemanager.tile' : 'filemanager.home.rows' ),
37
+			'template'       => ($this->nm_settings['view'] == 'tile' ? 'filemanager.tile' : 'filemanager.home.rows'),
38 38
 			// Filemanager needs this header, it's an important component for actions, but we reduce it to the minimum
39 39
 			'header_left'    => 'filemanager.home.header_left',
40 40
 			// Use a reduced column set for home, user can change if needed
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 			'parent_id'      => 'dir',
47 47
 			'is_parent'      => 'mime',
48 48
 			'is_parent_value'=> Vfs::DIR_MIME_TYPE,
49
-			'placeholder_actions' => array('mkdir','file_drop_mail','file_drop_move','file_drop_copy','file_drop_symlink')
49
+			'placeholder_actions' => array('mkdir', 'file_drop_mail', 'file_drop_move', 'file_drop_copy', 'file_drop_symlink')
50 50
 		);
51 51
 	}
52 52
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 		$ui = new filemanager_ui();
81 81
 		$total = $ui->get_rows($query, $rows, $readonlys);
82 82
 		// Change template to match selected view
83
-		if($query['view'])
83
+		if ($query['view'])
84 84
 		{
85 85
 			$query['template'] = ($query['view'] == 'row' ? 'filemanager.home.rows' : 'filemanager.tile');
86 86
 		}
@@ -103,14 +103,14 @@  discard block
 block discarded – undo
103 103
 		// the etemplate exec to fire again.
104 104
 		if ($content['nm']['action'])
105 105
 		{
106
-			$msg = filemanager_ui::action($content['nm']['action'],$content['nm']['selected'],$content['nm']['path']);
107
-			if($msg) Api\Json\Response::get()->apply('egw.message',array($msg));
108
-			foreach($content['nm']['selected'] as &$id)
106
+			$msg = filemanager_ui::action($content['nm']['action'], $content['nm']['selected'], $content['nm']['path']);
107
+			if ($msg) Api\Json\Response::get()->apply('egw.message', array($msg));
108
+			foreach ($content['nm']['selected'] as &$id)
109 109
 			{
110 110
 				$id = 'filemanager::'.$id;
111 111
 			}
112 112
 			// Directly request an update - this will get filemanager tab too
113
-			Api\Json\Response::get()->apply('egw.dataRefreshUIDs',array($content['nm']['selected']));
113
+			Api\Json\Response::get()->apply('egw.dataRefreshUIDs', array($content['nm']['selected']));
114 114
 		}
115 115
 	}
116 116
  }
117 117
\ No newline at end of file
Please login to merge, or discard this patch.