Completed
Push — master ( 9d054b...106a1b )
by Klaus
23:45 queued 04:19
created
calendar/inc/class.calendar_datasource.inc.php 1 patch
Braces   +13 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,7 +24,11 @@  discard block
 block discarded – undo
24 24
 	 */
25 25
 	function __construct()
26 26
 	{
27
-		if (false) parent::__construct();	// can not be called, but gives IDE warning
27
+		if (false)
28
+		{
29
+			parent::__construct();
30
+		}
31
+		// can not be called, but gives IDE warning
28 32
 
29 33
 		$this->datasource('calendar');
30 34
 
@@ -96,16 +100,22 @@  discard block
 block discarded – undo
96 100
 				$c->read_repository();
97 101
 				$this->pm_config = $c->config_data;
98 102
 				unset($c);
99
-				if (!$this->pm_config['hours_per_workday']) $this->pm_config['hours_per_workday'] = 8;
103
+				if (!$this->pm_config['hours_per_workday'])
104
+				{
105
+					$this->pm_config['hours_per_workday'] = 8;
106
+				}
100 107
 			}
101 108
 			$ds['pe_planned_time'] -= $nights * 60 * (24 - $this->pm_config['hours_per_workday']);
102 109
 		}
103 110
 		foreach($data['participants'] as $uid => $status)
104 111
 		{
105
-			if ($status != 'R' && is_numeric($uid))	// only users for now
112
+			if ($status != 'R' && is_numeric($uid))
113
+			{
114
+				// only users for now
106 115
 			{
107 116
 				$ds['pe_resources'][] = $uid;
108 117
 			}
118
+			}
109 119
 		}
110 120
 		// if we have multiple participants we have to multiply the time by the number of participants to get the total time
111 121
 		$ds['pe_planned_time'] *= count($ds['pe_resources']);
Please login to merge, or discard this patch.
calendar/inc/class.calendar_export_ical.inc.php 1 patch
Braces   +28 added lines, -12 removed lines patch added patch discarded remove patch
@@ -16,14 +16,16 @@  discard block
 block discarded – undo
16 16
 /**
17 17
  * iCal export plugin of calendar
18 18
  */
19
-class calendar_export_ical extends calendar_export_csv {
19
+class calendar_export_ical extends calendar_export_csv
20
+{
20 21
 
21 22
 	/**
22 23
 	 * Exports records as defined in $_definition
23 24
 	 *
24 25
 	 * @param egw_record $_definition
25 26
 	 */
26
-	public function export( $_stream, importexport_definition $_definition) {
27
+	public function export( $_stream, importexport_definition $_definition)
28
+	{
27 29
 		$options = $_definition->plugin_options;
28 30
 		$this->bo = new calendar_bo();
29 31
 		$boical = new calendar_ical();
@@ -32,7 +34,10 @@  discard block
 block discarded – undo
32 34
 		$cfs = array();
33 35
 
34 36
 		$limit_exception = Api\Storage\Merge::is_export_limit_excepted();
35
-		if (!$limit_exception) $export_limit = Api\Storage\Merge::getExportLimit('calendar');
37
+		if (!$limit_exception)
38
+		{
39
+			$export_limit = Api\Storage\Merge::getExportLimit('calendar');
40
+		}
36 41
 
37 42
 		if($options['selection'] == 'criteria')
38 43
 		{
@@ -44,7 +49,8 @@  discard block
 block discarded – undo
44 49
 				'users'         => $options['criteria']['owner'],
45 50
 				'cfs'		=> $cfs // Otherwise we shouldn't get any custom fields
46 51
 			);
47
-			if(Api\Storage\Merge::hasExportLimit($export_limit) && !$limit_exception) {
52
+			if(Api\Storage\Merge::hasExportLimit($export_limit) && !$limit_exception)
53
+			{
48 54
 				$query['offset'] = 0;
49 55
 				$query['num_rows'] = (int)$export_limit;  // ! int of 'no' is 0
50 56
 			}
@@ -61,7 +67,8 @@  discard block
 block discarded – undo
61 67
 				$query['start'] = 0;
62 68
 				$query['cfs'] = $cfs;
63 69
 
64
-				if(Api\Storage\Merge::hasExportLimit($export_limit) && !$limit_exception) {
70
+				if(Api\Storage\Merge::hasExportLimit($export_limit) && !$limit_exception)
71
+				{
65 72
 					$query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0
66 73
 				}
67 74
 				$ui = new calendar_uilist();
@@ -117,7 +124,10 @@  discard block
 block discarded – undo
117 124
 		foreach($events as $event)
118 125
 		{
119 126
 			$id = is_array($event) ? $event['id'] : $event;
120
-			if (($id = (int)$id)) $ids[$id] = $id;
127
+			if (($id = (int)$id))
128
+			{
129
+				$ids[$id] = $id;
130
+			}
121 131
 		}
122 132
 
123 133
 		$ical =& $boical->exportVCal($ids,'2.0','PUBLISH',false);
@@ -129,7 +139,8 @@  discard block
 block discarded – undo
129 139
 	 *
130 140
 	 * @return string name
131 141
 	 */
132
-	public static function get_name() {
142
+	public static function get_name()
143
+	{
133 144
 		return lang('Calendar iCal export');
134 145
 	}
135 146
 
@@ -138,7 +149,8 @@  discard block
 block discarded – undo
138 149
 	 *
139 150
 	 * @return string descriprion
140 151
 	 */
141
-	public static function get_description() {
152
+	public static function get_description()
153
+	{
142 154
 		return lang("Exports events from your Calendar in iCal format.");
143 155
 	}
144 156
 
@@ -147,11 +159,13 @@  discard block
 block discarded – undo
147 159
 	 *
148 160
 	 * @return string suffix
149 161
 	 */
150
-	public static function get_filesuffix() {
162
+	public static function get_filesuffix()
163
+	{
151 164
 		return 'ics';
152 165
 	}
153 166
 
154
-	public static function get_mimetype() {
167
+	public static function get_mimetype()
168
+	{
155 169
 		return 'text/calendar';
156 170
 	}
157 171
 
@@ -159,14 +173,16 @@  discard block
 block discarded – undo
159 173
 	 * return html for options.
160 174
 	 *
161 175
 	 */
162
-	public function get_options_etpl() {
176
+	public function get_options_etpl()
177
+	{
163 178
 	}
164 179
 
165 180
 	/**
166 181
 	 * returns selectors of this plugin
167 182
 	 *
168 183
 	 */
169
-	public function get_selectors_etpl($definition = null) {
184
+	public function get_selectors_etpl($definition = null)
185
+	{
170 186
 		$data = parent::get_selectors_etpl($definition);
171 187
 		return $data;
172 188
 	}
Please login to merge, or discard this patch.
calendar/inc/class.calendar_hooks.inc.php 1 patch
Braces   +25 added lines, -6 removed lines patch added patch discarded remove patch
@@ -100,9 +100,12 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	static function settings($hook_data)
102 102
 	{
103
-		if (!$hook_data['setup'])	// does not work on setup time
103
+		if (!$hook_data['setup'])
104
+		{
105
+			// does not work on setup time
104 106
 		{
105 107
 			$bo = new calendar_bo();
108
+		}
106 109
 			$bo->check_set_default_prefs();
107 110
 		}
108 111
 		$yesno = array(
@@ -195,9 +198,12 @@  discard block
 block discarded – undo
195 198
 			1		=> lang('Yes'),
196 199
 			2		=> lang('With credentials included'),
197 200
 		);
198
-		if (!$hook_data['setup'])	// does not work at setup time
201
+		if (!$hook_data['setup'])
202
+		{
203
+			// does not work at setup time
199 204
 		{
200 205
 			$options = array('0' => lang('none'));
206
+		}
201 207
 			foreach($GLOBALS['egw']->accounts->search(array('type' => 'owngroups','app' => 'calendar')) as $group)
202 208
 			{
203 209
 				$options[$group['account_id']] = Api\Accounts::username($group['account_id']);
@@ -388,9 +394,12 @@  discard block
 block discarded – undo
388 394
 				'default' => '',
389 395
 			),
390 396
 		);
391
-		if (isset($bo))	// add custom time-spans set by CalDAV clients, not in our prefs
397
+		if (isset($bo))
398
+		{
399
+			// add custom time-spans set by CalDAV clients, not in our prefs
392 400
 		{
393 401
 			$prefs = $GLOBALS['egw_info']['user']['preferences']['calendar'];
402
+		}
394 403
 			$data = array(
395 404
 				'prefs' => &$prefs,	// use reference to get preference value back
396 405
 				'preprocess' => true,
@@ -689,7 +698,10 @@  discard block
 block discarded – undo
689 698
 	{
690 699
 		//error_log(__METHOD__."(".array2string($data).")");
691 700
 		// caldav perfs are always user specific and cant by switched off
692
-		if ($data['type'] != 'user') return;
701
+		if ($data['type'] != 'user')
702
+		{
703
+			return;
704
+		}
693 705
 
694 706
 		$account_lid = $GLOBALS['egw_info']['user']['account_lid'];
695 707
 		foreach(array(
@@ -698,16 +710,23 @@  discard block
 block discarded – undo
698 710
 		) as $name => $dav)
699 711
 		{
700 712
 			$pref =& $GLOBALS['egw_info']['user']['preferences']['groupdav'][$dav];
701
-			if (true) $pref = str_replace("\r", '', $pref);	// remove CR messing up multiline preg_match
713
+			if (true)
714
+			{
715
+				$pref = str_replace("\r", '', $pref);
716
+			}
717
+			// remove CR messing up multiline preg_match
702 718
 			$val =& $data['prefs'][$name];
703 719
 
704 720
 			//error_log(__METHOD__."() groupdav[$dav]=$pref, calendar[$name]=$val");
705 721
 
706
-			if ($data['preprocess'])	// showing preferences
722
+			if ($data['preprocess'])
723
+			{
724
+				// showing preferences
707 725
 			{
708 726
 				if (!isset($val))	// no calendar pref --> read value from caldav
709 727
 				{
710 728
 					$matches = null;
729
+			}
711 730
 					if (preg_match('/^ACTION:NONE$/mi', $pref))
712 731
 					{
713 732
 						$val = '';
Please login to merge, or discard this patch.
calendar/inc/class.calendar_timegrid_etemplate_widget.inc.php 1 patch
Braces   +8 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,10 @@  discard block
 block discarded – undo
33 33
 	{
34 34
 		$form_name = self::form_name($cname, $this->id, $expand);
35 35
 		$value =& self::get_array(self::$request->content, $form_name, true);
36
-		if(!is_array($value)) $value = array();
36
+		if(!is_array($value))
37
+		{
38
+			$value = array();
39
+		}
37 40
 
38 41
 		foreach($value as &$events)
39 42
 		{
@@ -43,7 +46,10 @@  discard block
 block discarded – undo
43 46
 			}
44 47
 			foreach($events as &$event)
45 48
 			{
46
-				if(!is_array($event)) continue;
49
+				if(!is_array($event))
50
+				{
51
+					continue;
52
+				}
47 53
 				foreach(array('start','end') as $date)
48 54
 				{
49 55
 					$event[$date] = Api\DateTime::to($event[$date],'Y-m-d\TH:i:s\Z');
Please login to merge, or discard this patch.
calendar/inc/class.calendar_holidays.inc.php 1 patch
Braces   +32 added lines, -8 removed lines patch added patch discarded remove patch
@@ -41,7 +41,10 @@  discard block
 block discarded – undo
41 41
 	 */
42 42
 	public static function read($country, $year=null)
43 43
 	{
44
-		if (!$year) $year = (int)Api\DateTime::to('now', 'Y');
44
+		if (!$year)
45
+		{
46
+			$year = (int)Api\DateTime::to('now', 'Y');
47
+		}
45 48
 		$level = self::is_url($country) ? Api\Cache::INSTANCE : Api\Cache::TREE;
46 49
 
47 50
 		$holidays = Api\Cache::getCache($level, __CLASS__, $country.':'.$year);
@@ -68,7 +71,10 @@  discard block
 block discarded – undo
68 71
 	 */
69 72
 	public static function render($country, $year=null, $until_year=null)
70 73
 	{
71
-		if (!$year) $year = (int)Api\DateTime::to('now', 'Y');
74
+		if (!$year)
75
+		{
76
+			$year = (int)Api\DateTime::to('now', 'Y');
77
+		}
72 78
 		$end_year = $until_year && $year < $until_year ? $until_year : $year;
73 79
 
74 80
 		$starttime = microtime(true);
@@ -81,22 +87,40 @@  discard block
 block discarded – undo
81 87
 		{
82 88
 			$start = new Api\DateTime($event['start']);
83 89
 			$end = new Api\DateTime($event['end']);
84
-			if ($start->format('Y') > $end_year) continue;
85
-			if ($end->format('Y') < $year && !$event['recur_type']) continue;
90
+			if ($start->format('Y') > $end_year)
91
+			{
92
+				continue;
93
+			}
94
+			if ($end->format('Y') < $year && !$event['recur_type'])
95
+			{
96
+				continue;
97
+			}
86 98
 
87 99
 			// recuring events
88 100
 			if ($event['recur_type'])
89 101
 			{
90 102
 				// calendar_rrule limits no enddate, to 5 years
91
-				if (!$event['recur_enddate']) $event['recur_enddate'] = (1+$end_year).'0101';
103
+				if (!$event['recur_enddate'])
104
+				{
105
+					$event['recur_enddate'] = (1+$end_year).'0101';
106
+				}
92 107
 
93 108
 				$rrule = calendar_rrule::event2rrule($event);
94
-				if ($rrule->enddate && $rrule->enddate->format('Y') < $year) continue;
109
+				if ($rrule->enddate && $rrule->enddate->format('Y') < $year)
110
+				{
111
+					continue;
112
+				}
95 113
 
96 114
 				foreach($rrule as $rtime)
97 115
 				{
98
-					if (($y = (int)$rtime->format('Y')) < $year) continue;
99
-					if ($y > $end_year) break;
116
+					if (($y = (int)$rtime->format('Y')) < $year)
117
+					{
118
+						continue;
119
+					}
120
+					if ($y > $end_year)
121
+					{
122
+						break;
123
+					}
100 124
 
101 125
 					$ymd = (int)$rtime->format('Ymd');
102 126
 					$years[$y][(string)$ymd][] = array(
Please login to merge, or discard this patch.
calendar/inc/class.calendar_merge.inc.php 1 patch
Braces   +167 added lines, -53 removed lines patch added patch discarded remove patch
@@ -88,10 +88,12 @@  discard block
 block discarded – undo
88 88
 		{
89 89
 			$this->table_plugins[date('l', strtotime("+$i days"))] = 'day_plugin';
90 90
 		}
91
-		for($i = 1; $i <= 31; $i++) {
91
+		for($i = 1; $i <= 31; $i++)
92
+		{
92 93
 			$this->table_plugins['day_'.$i] = 'day'; // Numerically by day number (1-31)
93 94
 		}
94
-		foreach(self::$relative as $day) {
95
+		foreach(self::$relative as $day)
96
+		{
95 97
 			$this->table_plugins[$day] = 'day'; // Current day
96 98
 		}
97 99
 		$this->query = is_array($this->bo->cal_prefs['saved_states']) ?
@@ -131,9 +133,16 @@  discard block
 block discarded – undo
131 133
 				$events = $ids;
132 134
 				$ids = array('start' => PHP_INT_MAX, 'end' => 0);
133 135
 				$this->ids = array();
134
-				foreach($events as $event) {
135
-					if($event['start'] && Api\DateTime::to($event['start'],'ts') < $ids['start']) $ids['start'] = Api\DateTime::to($event['start'],'ts');
136
-					if($event['end'] && Api\DateTime::to($event['end'],'ts') > $ids['end']) $ids['end'] = Api\DateTime::to($event['end'],'ts');
136
+				foreach($events as $event)
137
+				{
138
+					if($event['start'] && Api\DateTime::to($event['start'],'ts') < $ids['start'])
139
+					{
140
+						$ids['start'] = Api\DateTime::to($event['start'],'ts');
141
+					}
142
+					if($event['end'] && Api\DateTime::to($event['end'],'ts') > $ids['end'])
143
+					{
144
+						$ids['end'] = Api\DateTime::to($event['end'],'ts');
145
+					}
137 146
 					// Keep ids for future use
138 147
 					$this->ids[] = $event['id'];
139 148
 				}
@@ -154,7 +163,8 @@  discard block
 block discarded – undo
154 163
 				'cfs' => strpos($content, '#') !== false ? array_keys(Api\Storage\Customfields::get('calendar')) : null
155 164
 			));
156 165
 			$ids = array();
157
-			foreach($events as $event) {
166
+			foreach($events as $event)
167
+			{
158 168
 				$ids[] = $event;
159 169
 			}
160 170
 		}
@@ -192,9 +202,16 @@  discard block
 block discarded – undo
192 202
 			$events = $id;
193 203
 			$id = array('start' => PHP_INT_MAX, 'end' => 0);
194 204
 			$this->ids = array();
195
-			foreach($events as $event) {
196
-				if($event['start'] && $event['start'] < $id['start']) $id['start'] = $event['start'];
197
-				if($event['end'] && $event['end'] > $id['end']) $id['end'] = $event['end'];
205
+			foreach($events as $event)
206
+			{
207
+				if($event['start'] && $event['start'] < $id['start'])
208
+				{
209
+					$id['start'] = $event['start'];
210
+				}
211
+				if($event['end'] && $event['end'] > $id['end'])
212
+				{
213
+					$id['end'] = $event['end'];
214
+				}
198 215
 				// Keep ids for future use
199 216
 				$this->ids[]  = $event['id'];
200 217
 			}
@@ -221,7 +238,10 @@  discard block
 block discarded – undo
221 238
 				foreach(self::$range_tags as $key => $format)
222 239
 				{
223 240
 					$value = date($format, $key == 'end' ? $id['end'] : $id['start']);
224
-					if($key == 'month') $value = lang($value);
241
+					if($key == 'month')
242
+					{
243
+						$value = lang($value);
244
+					}
225 245
 					$values["$\$range/$key$$"] = $value;
226 246
 				}
227 247
 			}
@@ -240,9 +260,12 @@  discard block
 block discarded – undo
240 260
 	public function calendar_replacements($id,$prefix = '', &$content = '')
241 261
 	{
242 262
 		$replacements = array();
243
-		if(!is_array($id) || !$id['start']) {
263
+		if(!is_array($id) || !$id['start'])
264
+		{
244 265
 			$event = $this->bo->read(is_array($id) ? $id['id'] : $id, is_array($id) ? $id['recur_date'] : null);
245
-		} else {
266
+		}
267
+		else
268
+		{
246 269
 			$event = $id;
247 270
 		}
248 271
 
@@ -261,7 +284,10 @@  discard block
 block discarded – undo
261 284
 		$replacements['$$' . ($prefix ? $prefix . '/' : '') . 'calendar_id'. '$$'] = $event['id'];
262 285
 		foreach($this->bo->event2array($event) as $name => $data)
263 286
 		{
264
-			if (substr($name,-4) == 'date') $name = substr($name,0,-4);
287
+			if (substr($name,-4) == 'date')
288
+			{
289
+				$name = substr($name,0,-4);
290
+			}
265 291
 			$replacements['$$' . ($prefix ? $prefix . '/' : '') . 'calendar_'.$name . '$$'] = is_array($data['data']) ? implode(', ',$data['data']) : $data['data'];
266 292
 		}
267 293
 		// Add seperate lists of participants by type
@@ -300,7 +326,10 @@  discard block
 block discarded – undo
300 326
 			) as $name => $format)
301 327
 			{
302 328
 				$value = Api\DateTime::to($event[$what],$format);
303
-				if ($format == 'l') $value = lang($value);
329
+				if ($format == 'l')
330
+				{
331
+					$value = lang($value);
332
+				}
304 333
 				$replacements['$$' .($prefix ? $prefix.'/':'').'calendar_'.$what.$name.'$$'] = $value;
305 334
 			}
306 335
 		}
@@ -343,24 +372,41 @@  discard block
 block discarded – undo
343 372
 	public function day_plugin($plugin,$date,$n,$repeat)
344 373
 	{
345 374
 		static $days = null;
346
-		if(is_array($date) && !$date['start']) {
375
+		if(is_array($date) && !$date['start'])
376
+		{
347 377
 			// List of IDs
348
-			if($date[0]['start']) {
378
+			if($date[0]['start'])
379
+			{
349 380
 				$id = array('start' => PHP_INT_MAX, 'end' => 0);
350
-				foreach($date as $event) {
351
-					if($event['start'] && $event['start'] < $id['start']) $id['start'] = $event['start'];
352
-					if($event['end'] && $event['end'] > $id['end']) $id['end'] = $event['end'];
381
+				foreach($date as $event)
382
+				{
383
+					if($event['start'] && $event['start'] < $id['start'])
384
+					{
385
+						$id['start'] = $event['start'];
386
+					}
387
+					if($event['end'] && $event['end'] > $id['end'])
388
+					{
389
+						$id['end'] = $event['end'];
390
+					}
353 391
 				}
354 392
 				$date = $id;
355
-			} else {
393
+			}
394
+			else
395
+			{
356 396
 				$event = $this->bo->read(is_array($date) ? $date['id'] : $date, is_array($date) ? $date['recur_date'] : null);
357
-				if(date('l',$event['start']) != $plugin) return array();
397
+				if(date('l',$event['start']) != $plugin)
398
+				{
399
+					return array();
400
+				}
358 401
 				$date = $event['start'];
359 402
 			}
360 403
 		}
361 404
 
362 405
 		$_date = $date['start'] ? $date['start'] : $date;
363
-		if($days[date('Ymd',$_date)][$plugin]) return $days[date('Ymd',$_date)][$plugin][$n];
406
+		if($days[date('Ymd',$_date)][$plugin])
407
+		{
408
+			return $days[date('Ymd',$_date)][$plugin][$n];
409
+		}
364 410
 
365 411
 		$events = $this->bo->search($this->query + array(
366 412
 			'start' => $date['end'] ? $date['start'] : mktime(0,0,0,date('m',$_date),date('d',$_date),date('Y',$_date)),
@@ -372,20 +418,29 @@  discard block
 block discarded – undo
372 418
 			'cfs' => array(),	// read all custom-fields
373 419
 		));
374 420
 
375
-		if (true) $days = array();
421
+		if (true)
422
+		{
423
+			$days = array();
424
+		}
376 425
 		$replacements = array();
377 426
 		$time_format = $GLOBALS['egw_info']['user']['preferences']['common']['timeformat'] == 12 ? 'h:i a' : 'H:i';
378 427
 		foreach($events as $day => $list)
379 428
 		{
380 429
 			foreach($list as $event)
381 430
 			{
382
-				if($this->ids && !in_array($event['id'], $this->ids)) continue;
431
+				if($this->ids && !in_array($event['id'], $this->ids))
432
+				{
433
+					continue;
434
+				}
383 435
 				$start = Api\DateTime::to($event['start'], 'array');
384 436
 				$end = Api\DateTime::to($event['end'], 'array');
385 437
 				$replacements = $this->calendar_replacements($event);
386
-				if($start['year'] == $end['year'] && $start['month'] == $end['month'] && $start['day'] == $end['day']) {
438
+				if($start['year'] == $end['year'] && $start['month'] == $end['month'] && $start['day'] == $end['day'])
439
+				{
387 440
 					$dow = date('l',$event['start']);
388
-				} else {
441
+				}
442
+				else
443
+				{
389 444
 					$dow = date('l', strtotime($day));
390 445
 					// Fancy date+time formatting for multi-day events
391 446
 					$replacements['$$calendar_starttime$$'] = date($time_format, $day == date('Ymd', $event['start']) ? $event['start'] : mktime(0,0,0,0,0,1));
@@ -394,12 +449,14 @@  discard block
 block discarded – undo
394 449
 
395 450
 				$days[date('Ymd',$_date)][$dow][] = $replacements;
396 451
 			}
397
-			if(strpos($repeat, 'day/date') !== false || strpos($repeat, 'day/name') !== false) {
452
+			if(strpos($repeat, 'day/date') !== false || strpos($repeat, 'day/name') !== false)
453
+			{
398 454
 				$date_marker = array(
399 455
 					'$$day/date$$' => date($GLOBALS['egw_info']['user']['preferences']['common']['dateformat'], strtotime($day)),
400 456
 					'$$day/name$$' => lang(date('l', strtotime($day)))
401 457
 				);
402
-				if(!is_array($days[date('Ymd',$_date)][date('l',strtotime($day))])) {
458
+				if(!is_array($days[date('Ymd',$_date)][date('l',strtotime($day))]))
459
+				{
403 460
 					$blank = $this->calendar_replacements(array());
404 461
 					foreach($blank as &$value)
405 462
 					{
@@ -435,16 +492,26 @@  discard block
 block discarded – undo
435 492
 			if($id[0]['start'])
436 493
 			{
437 494
 				$dates = array('start' => PHP_INT_MAX, 'end' => 0);
438
-				foreach($id as $event) {
439
-					if($event['start'] && $event['start'] < $dates['start']) $dates['start'] = $event['start'];
440
-					if($event['end'] && $event['end'] > $dates['end']) $dates['end'] = $event['end'];
495
+				foreach($id as $event)
496
+				{
497
+					if($event['start'] && $event['start'] < $dates['start'])
498
+					{
499
+						$dates['start'] = $event['start'];
500
+					}
501
+					if($event['end'] && $event['end'] > $dates['end'])
502
+					{
503
+						$dates['end'] = $event['end'];
504
+					}
441 505
 				}
442 506
 				$id = $dates;
443 507
 			}
444 508
 			$arr = $this->bo->date2array($id['start']);
445 509
 			$arr['day'] = $which;
446 510
 			$date = $this->bo->date2ts($arr);
447
-			if(is_array($id) && $id['start'] && ($date < $id['start'] || $date > $id['end'])) return array();
511
+			if(is_array($id) && $id['start'] && ($date < $id['start'] || $date > $id['end']))
512
+			{
513
+				return array();
514
+			}
448 515
 		}
449 516
 		elseif ($plugin == 'selected')
450 517
 		{
@@ -454,16 +521,26 @@  discard block
 block discarded – undo
454 521
 		{
455 522
 			$date = strtotime($plugin);
456 523
 		}
457
-		if($type == 'day' && is_array($id) && !$id['start']) {
524
+		if($type == 'day' && is_array($id) && !$id['start'])
525
+		{
458 526
 			$event = $this->bo->read(is_array($id) ? $id['id'] : $id, is_array($id) ? $id['recur_date'] : null);
459
-			if($which && date('d',$event['start']) != $which) return array();
460
-			if(date('Ymd',$date) != date('Ymd', $event['start'])) return array();
527
+			if($which && date('d',$event['start']) != $which)
528
+			{
529
+				return array();
530
+			}
531
+			if(date('Ymd',$date) != date('Ymd', $event['start']))
532
+			{
533
+				return array();
534
+			}
461 535
 			return $n == 0 ? $this->calendar_replacements($event) : array();
462 536
 		}
463 537
 
464 538
 		// Use start for cache, in case of multiple months
465 539
 		$_date = $id['start'] ? $id['start'] : $date;
466
-		if($days[date('Ymd',$_date)][$plugin]) return $days[date('Ymd',$_date)][$plugin][$n];
540
+		if($days[date('Ymd',$_date)][$plugin])
541
+		{
542
+			return $days[date('Ymd',$_date)][$plugin][$n];
543
+		}
467 544
 
468 545
 		$events = $this->bo->search($this->query + array(
469 546
 			'start' => $date,
@@ -476,31 +553,42 @@  discard block
 block discarded – undo
476 553
 		));
477 554
 
478 555
 		$replacements = array();
479
-		if (true) $days = array();
556
+		if (true)
557
+		{
558
+			$days = array();
559
+		}
480 560
 		$time_format = $GLOBALS['egw_info']['user']['preferences']['common']['timeformat'] == 12 ? 'h:i a' : 'H:i';
481 561
 		foreach($events as $day => $list)
482 562
 		{
483 563
 			foreach($list as $event)
484 564
 			{
485
-				if($this->ids && !in_array($event['id'], $this->ids)) continue;
565
+				if($this->ids && !in_array($event['id'], $this->ids))
566
+				{
567
+					continue;
568
+				}
486 569
 				$start = Api\DateTime::to($event['start'], 'array');
487 570
 				$end = Api\DateTime::to($event['end'], 'array');
488 571
 				$replacements = $this->calendar_replacements($event);
489
-				if($start['year'] == $end['year'] && $start['month'] == $end['month'] && $start['day'] == $end['day']) {
572
+				if($start['year'] == $end['year'] && $start['month'] == $end['month'] && $start['day'] == $end['day'])
573
+				{
490 574
 					//$dow = date('l',$event['start']);
491
-				} else {
575
+				}
576
+				else
577
+				{
492 578
 					// Fancy date+time formatting for multi-day events
493 579
 					$replacements['$$calendar_starttime$$'] = date($time_format, $day == date('Ymd', $event['start']) ? $event['start'] : mktime(0,0,0,0,0,1));
494 580
 					$replacements['$$calendar_endtime$$'] = date($time_format, $day == date('Ymd', $event['end']) ? $event['end'] : mktime(23,59,59,0,0,0));
495 581
 				}
496 582
 				$days[date('Ymd',$_date)][$plugin][] = $replacements;
497 583
 			}
498
-			if(strpos($repeat, 'day/date') !== false || strpos($repeat, 'day/name') !== false) {
584
+			if(strpos($repeat, 'day/date') !== false || strpos($repeat, 'day/name') !== false)
585
+			{
499 586
 				$date_marker = array(
500 587
 					'$$day/date$$' => date($GLOBALS['egw_info']['user']['preferences']['common']['dateformat'], strtotime($day)),
501 588
 					'$$day/name$$' => lang(date('l', strtotime($day)))
502 589
 				);
503
-				if(!is_array($days[date('Ymd',$_date)][$plugin])) {
590
+				if(!is_array($days[date('Ymd',$_date)][$plugin]))
591
+				{
504 592
 					$blank = $this->calendar_replacements(array());
505 593
 					foreach($blank as &$value)
506 594
 					{
@@ -528,22 +616,35 @@  discard block
 block discarded – undo
528 616
 	{
529 617
 		unset($plugin);	// not used, but required by function signature
530 618
 
531
-		if(!is_array($id) || !$id['start']) {
619
+		if(!is_array($id) || !$id['start'])
620
+		{
532 621
 			$event = $this->bo->read(is_array($id) ? $id['id'] : $id, is_array($id) ? $id['recur_date'] : null);
533
-		} else {
622
+		}
623
+		else
624
+		{
534 625
 			$event = $id;
535 626
 		}
536 627
 
537
-		if(!is_array($event['participants']) || $n >= count($event['participants'])) return array();
628
+		if(!is_array($event['participants']) || $n >= count($event['participants']))
629
+		{
630
+			return array();
631
+		}
538 632
 
539 633
 		$participant = null;
540 634
 		$status = null;
541 635
 		$i = -1;
542
-		foreach($event['participants'] as $participant => $status) {
543
-			if(++$i == $n) break;
636
+		foreach($event['participants'] as $participant => $status)
637
+		{
638
+			if(++$i == $n)
639
+			{
640
+				break;
641
+			}
544 642
 		}
545 643
 
546
-		if(!$participant) return array();
644
+		if(!$participant)
645
+		{
646
+			return array();
647
+		}
547 648
 
548 649
 		// Add some common information
549 650
 		$quantity = $role = null;
@@ -577,7 +678,10 @@  discard block
 block discarded – undo
577 678
 				$replacements = $this->contact_replacements(substr($participant,1),'');
578 679
 				break;
579 680
 			case 'r':
580
-				if (is_null(self::$resources)) self::$resources = CreateObject('resources.resources_bo');
681
+				if (is_null(self::$resources))
682
+				{
683
+					self::$resources = CreateObject('resources.resources_bo');
684
+				}
581 685
 				if (($resource = self::$resources->read(substr($participant,1))))
582 686
 				{
583 687
 					foreach($resource as $name => $value)
@@ -638,14 +742,23 @@  discard block
 block discarded – undo
638 742
 			'calendar_owner'    => lang('Owner'),
639 743
 		) as $name => $label)
640 744
 		{
641
-			if (in_array($name,array('start','end')) && $n&1)		// main values, which should be in the first column
745
+			if (in_array($name,array('start','end')) && $n&1)
746
+			{
747
+				// main values, which should be in the first column
642 748
 			{
643 749
 				echo "</tr>\n";
750
+			}
644 751
 				$n++;
645 752
 			}
646
-			if (!($n&1)) echo '<tr>';
753
+			if (!($n&1))
754
+			{
755
+				echo '<tr>';
756
+			}
647 757
 			echo '<td>{{'.$name.'}}</td><td>'.$label.'</td>';
648
-			if ($n&1) echo "</tr>\n";
758
+			if ($n&1)
759
+			{
760
+				echo "</tr>\n";
761
+			}
649 762
 			$n++;
650 763
 		}
651 764
 
@@ -696,7 +809,8 @@  discard block
 block discarded – undo
696 809
 		}
697 810
 		echo '</table></td><td colspan="2"><table >';
698 811
 		echo '<tr><td><h3>'.lang('Daily tables').":</h3></td></tr>";
699
-		foreach(self::$relative as $value) {
812
+		foreach(self::$relative as $value)
813
+		{
700 814
 			echo '<tr><td>{{table/'.$value. '}} ... {{endtable}}</td></tr>';
701 815
 		}
702 816
 		echo '<tr><td>{{table/day_n}} ... {{endtable}}</td><td>1 <= n <= 31</td></tr>';
Please login to merge, or discard this patch.
calendar/inc/class.calendar_export_csv.inc.php 1 patch
Braces   +97 added lines, -36 removed lines patch added patch discarded remove patch
@@ -16,9 +16,11 @@  discard block
 block discarded – undo
16 16
 /**
17 17
  * export CSV plugin of calendar
18 18
  */
19
-class calendar_export_csv implements importexport_iface_export_plugin {
19
+class calendar_export_csv implements importexport_iface_export_plugin
20
+{
20 21
 
21
-	public function __construct() {
22
+	public function __construct()
23
+	{
22 24
 		Api\Translation::add_app('calendar');
23 25
 		$this->bo = new calendar_bo();
24 26
 		$this->get_selects();
@@ -29,15 +31,23 @@  discard block
 block discarded – undo
29 31
 	 *
30 32
 	 * @param egw_record $_definition
31 33
 	 */
32
-	public function export( $_stream, importexport_definition $_definition) {
34
+	public function export( $_stream, importexport_definition $_definition)
35
+	{
33 36
 		$options = $_definition->plugin_options;
34 37
 
35 38
 		$limit_exception = Api\Storage\Merge::is_export_limit_excepted();
36
-		if (!$limit_exception) $export_limit = Api\Storage\Merge::getExportLimit('calendar');
39
+		if (!$limit_exception)
40
+		{
41
+			$export_limit = Api\Storage\Merge::getExportLimit('calendar');
42
+		}
37 43
 		// Custom fields need to be specifically requested
38 44
 		$cfs = array();
39
-		foreach($options['mapping'] + (array)$_definition->filter as $key => $label) {
40
-			if($key[0] == '#') $cfs[] = substr($key,1);
45
+		foreach($options['mapping'] + (array)$_definition->filter as $key => $label)
46
+		{
47
+			if($key[0] == '#')
48
+			{
49
+				$cfs[] = substr($key,1);
50
+			}
41 51
 		}
42 52
 
43 53
 		$query = array(
@@ -57,7 +67,8 @@  discard block
 block discarded – undo
57 67
 					'users'         => $options['criteria']['owner'],
58 68
 					'cfs'		=> $cfs // Otherwise we shouldn't get any custom fields
59 69
 				);
60
-				if(Api\Storage\Merge::hasExportLimit($export_limit) && !$limit_exception) {
70
+				if(Api\Storage\Merge::hasExportLimit($export_limit) && !$limit_exception)
71
+				{
61 72
 					$query['offset'] = 0;
62 73
 					$query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0
63 74
 				}
@@ -65,28 +76,34 @@  discard block
 block discarded – undo
65 76
 				break;
66 77
 			case 'search_results':
67 78
 				$states = Api\Cache::getSession('calendar', 'session_data');
68
-				if($states['view'] == 'listview') {
79
+				if($states['view'] == 'listview')
80
+				{
69 81
 					$query = Api\Cache::getSession('calendar', 'calendar_list');
70 82
 					$query['num_rows'] = -1;        // all
71 83
 					$query['csv_export'] = true;	// so get_rows method _can_ produce different content or not store state in the session
72 84
 					$query['start'] = 0;
73 85
 					$query['cfs'] = $cfs;
74 86
 
75
-					if(Api\Storage\Merge::hasExportLimit($export_limit) && !$limit_exception) {
87
+					if(Api\Storage\Merge::hasExportLimit($export_limit) && !$limit_exception)
88
+					{
76 89
 						$query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0
77 90
 					}
78 91
 					$ui = new calendar_uilist();
79 92
 					$ui->get_rows($query, $events, $unused);
80
-				} else {
93
+				}
94
+				else
95
+				{
81 96
 					$query = Api\Cache::getSession('calendar', 'session_data');
82 97
 					$query['users'] = explode(',', $query['owner']);
83 98
 					$query['num_rows'] = -1;
84
-					if(Api\Storage\Merge::hasExportLimit($export_limit) && !$limit_exception) {
99
+					if(Api\Storage\Merge::hasExportLimit($export_limit) && !$limit_exception)
100
+					{
85 101
 						$query['num_rows'] = (int)$export_limit;  // ! int of 'no' is 0
86 102
 					}
87 103
 
88 104
 					$events = array();
89
-					switch($states['view']) {
105
+					switch($states['view'])
106
+					{
90 107
 						case 'month':
91 108
 							$query += $this->get_query_month($states);
92 109
 							break;
@@ -138,8 +155,14 @@  discard block
 block discarded – undo
138 155
 					}
139 156
 
140 157
 					// Ranges are inclusive, so should be provided that way (from 2 to 10 includes 2 and 10)
141
-					if($value['from']) $query['sql_filter'][] = "cal_$field >= " . (int)$value['from'];
142
-					if($value['to']) $query['sql_filter'][] = "cal_$field <= " . (int)$value['to'];
158
+					if($value['from'])
159
+					{
160
+						$query['sql_filter'][] = "cal_$field >= " . (int)$value['from'];
161
+					}
162
+					if($value['to'])
163
+					{
164
+						$query['sql_filter'][] = "cal_$field <= " . (int)$value['to'];
165
+					}
143 166
 
144 167
 				}
145 168
 				if($query['sql_filter'] && is_array($query['sql_filter']))
@@ -157,36 +180,52 @@  discard block
 block discarded – undo
157 180
 		}
158 181
 
159 182
 		$export_object = new importexport_export_csv($_stream, (array)$options);
160
-		if (!$limit_exception) $export_object->export_limit = $export_limit;
183
+		if (!$limit_exception)
184
+		{
185
+			$export_object->export_limit = $export_limit;
186
+		}
161 187
 		$export_object->set_mapping($options['mapping']);
162 188
 		$convert_fields = calendar_egw_record::$types;
163 189
 
164 190
 		$recurrence = $this->bo->recur_types;
165 191
 
166 192
 		$record = new calendar_egw_record();
167
-		foreach ($events as $event) {
193
+		foreach ($events as $event)
194
+		{
168 195
 			// the condition below (2 lines) may only work on enum_recuring=false and using the iterator to test an recurring event on the given timerange
169 196
 			// Get rid of yearly recurring events that don't belong
170 197
 			//if($options['selection']['select'] == 'criteria' && ($event['start'] > $query['end'] || $event['end'] < $query['start'])) continue;
171 198
 			// Add in participants
172
-			if($options['mapping']['participants']) {
199
+			if($options['mapping']['participants'])
200
+			{
173 201
 				$event['participants'] = implode(", ",$this->bo->participants($event,true));
174 202
 			}
175 203
 			if (is_array($event))
176 204
 			{
177 205
 				$record->set_record($event);
178
-				if($options['mapping']['recurrence']) {
206
+				if($options['mapping']['recurrence'])
207
+				{
179 208
 					$record->recurrence = $recurrence[$record->recur_type];
180
-					if($record->recur_type != MCAL_RECUR_NONE) $record->recurrence .= ' / '. $record->recur_interval;
209
+					if($record->recur_type != MCAL_RECUR_NONE)
210
+					{
211
+						$record->recurrence .= ' / '. $record->recur_interval;
212
+					}
181 213
 				}
182 214
 
183 215
 				// Standard stuff
184
-				if($options['convert']) {
216
+				if($options['convert'])
217
+				{
185 218
 					importexport_export_csv::convert($record, $convert_fields, 'calendar', $this->selects);
186
-				} else {
219
+				}
220
+				else
221
+				{
187 222
 					// Implode arrays, so they don't say 'Array'
188
-					foreach($record->get_record_array() as $key => $value) {
189
-						if(is_array($value)) $record->$key = implode(',', $value);
223
+					foreach($record->get_record_array() as $key => $value)
224
+					{
225
+						if(is_array($value))
226
+						{
227
+							$record->$key = implode(',', $value);
228
+						}
190 229
 					}
191 230
 	 			}
192 231
 				$export_object->export_record($record);
@@ -201,7 +240,8 @@  discard block
 block discarded – undo
201 240
 	 *
202 241
 	 * @return string name
203 242
 	 */
204
-	public static function get_name() {
243
+	public static function get_name()
244
+	{
205 245
 		return lang('Calendar CSV export');
206 246
 	}
207 247
 
@@ -210,7 +250,8 @@  discard block
 block discarded – undo
210 250
 	 *
211 251
 	 * @return string descriprion
212 252
 	 */
213
-	public static function get_description() {
253
+	public static function get_description()
254
+	{
214 255
 		return lang("Exports events from your Calendar into a CSV File.");
215 256
 	}
216 257
 
@@ -219,11 +260,13 @@  discard block
 block discarded – undo
219 260
 	 *
220 261
 	 * @return string suffix
221 262
 	 */
222
-	public static function get_filesuffix() {
263
+	public static function get_filesuffix()
264
+	{
223 265
 		return 'csv';
224 266
 	}
225 267
 
226
-	public static function get_mimetype() {
268
+	public static function get_mimetype()
269
+	{
227 270
 		return 'text/csv';
228 271
 	}
229 272
 
@@ -231,19 +274,22 @@  discard block
 block discarded – undo
231 274
 	 * return html for options.
232 275
 	 *
233 276
 	 */
234
-	public function get_options_etpl($definition = null) {
277
+	public function get_options_etpl($definition = null)
278
+	{
235 279
 	}
236 280
 
237 281
 	/**
238 282
 	 * returns selectors of this plugin
239 283
 	 *
240 284
 	 */
241
-	public function get_selectors_etpl($definition = null) {
285
+	public function get_selectors_etpl($definition = null)
286
+	{
242 287
 		$states = $this->bo->cal_prefs['saved_states'];
243 288
 		$list = Api\Cache::getSession('calendar', 'calendar_list');
244 289
 		if(!$list['startdate'])
245 290
 		{
246
-			switch($states['view']) {
291
+			switch($states['view'])
292
+			{
247 293
 				case 'month':
248 294
 					$query = $this->get_query_month($states);
249 295
 					break;
@@ -275,7 +321,10 @@  discard block
 block discarded – undo
275 321
 			$end = $ui->last;
276 322
 
277 323
 			// Special handling
278
-			if($list['filter'] == 'all') $start = $end = null;
324
+			if($list['filter'] == 'all')
325
+			{
326
+				$start = $end = null;
327
+			}
279 328
 			if($list['filter'] == 'before')
280 329
 			{
281 330
 				$end = $start;
@@ -323,24 +372,33 @@  discard block
 block discarded – undo
323 372
 		$days = $states['days'];
324 373
 		$ui = new calendar_uiviews($states);
325 374
 		if (!$days)
326
-                {
375
+		{
327 376
                         $days = isset($_GET['days']) ? $_GET['days'] : $ui->cal_prefs['days_in_weekview'];
328
-                        if ($days != 5) $days = 7;
377
+                        if ($days != 5)
378
+                        {
379
+                        	$days = 7;
380
+                        }
329 381
                 }
330
-		if ($states['view'] == 'week' && $days == 4)         // next 4 days view
382
+		if ($states['view'] == 'week' && $days == 4)
383
+		{
384
+			// next 4 days view
331 385
                 {
332 386
                         $query['start'] = $this->bo->date2ts($states['date']);
387
+		}
333 388
                         $query['end'] = strtotime("+$days days",$query['start']) - 1;
334 389
                 }
335 390
                 else
336 391
                 {
337 392
 			$query['start'] = $ui->datetime->get_weekday_start($states['year'],$states['month'],$states['day']);
338
-			if ($days == 5)         // no weekend-days
393
+			if ($days == 5)
394
+			{
395
+				// no weekend-days
339 396
 			{
340 397
 				switch($ui->cal_prefs['weekdaystarts'])
341 398
 				{
342 399
 					case 'Saturday':
343 400
 						$query['start'] = strtotime("+2 days",$query['start']);
401
+			}
344 402
 						break;
345 403
 					case 'Sunday':
346 404
 						$query['start'] = strtotime("+1 day",$query['start']);
@@ -419,7 +477,10 @@  discard block
 block discarded – undo
419 477
 			}
420 478
 
421 479
 			// Pass on select options
422
-			if($this->selects[$field_name]) $settings['values'] = $this->selects[$field_name];
480
+			if($this->selects[$field_name])
481
+			{
482
+				$settings['values'] = $this->selects[$field_name];
483
+			}
423 484
 		}
424 485
 
425 486
 	}
Please login to merge, or discard this patch.
calendar/inc/class.calendar_import_ical.inc.php 1 patch
Braces   +20 added lines, -10 removed lines patch added patch discarded remove patch
@@ -15,7 +15,8 @@  discard block
 block discarded – undo
15 15
 /**
16 16
  * import ical for calendar
17 17
  */
18
-class calendar_import_ical implements importexport_iface_import_plugin  {
18
+class calendar_import_ical implements importexport_iface_import_plugin
19
+{
19 20
 
20 21
 	private static $plugin_options = array(
21 22
 		'fieldsep', 		// char
@@ -104,7 +105,8 @@  discard block
 block discarded – undo
104 105
 	 * @param string $_charset
105 106
 	 * @param definition $_definition
106 107
 	 */
107
-	public function import( $_stream, importexport_definition $_definition ) {
108
+	public function import( $_stream, importexport_definition $_definition )
109
+	{
108 110
 
109 111
 		$this->definition = $_definition;
110 112
 
@@ -154,7 +156,8 @@  discard block
 block discarded – undo
154 156
 	 *
155 157
 	 * @return string name
156 158
 	 */
157
-	public static function get_name() {
159
+	public static function get_name()
160
+	{
158 161
 		return lang('Calendar iCal import');
159 162
 	}
160 163
 
@@ -163,7 +166,8 @@  discard block
 block discarded – undo
163 166
 	 *
164 167
 	 * @return string descriprion
165 168
 	 */
166
-	public static function get_description() {
169
+	public static function get_description()
170
+	{
167 171
 		return lang("Imports events into your Calendar from an iCal File.");
168 172
 	}
169 173
 
@@ -172,7 +176,8 @@  discard block
 block discarded – undo
172 176
 	 *
173 177
 	 * @return string suffix (comma seperated)
174 178
 	 */
175
-	public static function get_filesuffix() {
179
+	public static function get_filesuffix()
180
+	{
176 181
 		return 'ics';
177 182
 	}
178 183
 
@@ -188,7 +193,8 @@  discard block
 block discarded – undo
188 193
 	 * 		preserv		=> array,
189 194
 	 * )
190 195
 	 */
191
-	public function get_options_etpl() {
196
+	public function get_options_etpl()
197
+	{
192 198
 		// lets do it!
193 199
 	}
194 200
 
@@ -197,7 +203,8 @@  discard block
 block discarded – undo
197 203
 	 *
198 204
 	 * @return string etemplate name
199 205
 	 */
200
-	public function get_selectors_etpl() {
206
+	public function get_selectors_etpl()
207
+	{
201 208
 		// lets do it!
202 209
 	}
203 210
 
@@ -209,7 +216,8 @@  discard block
 block discarded – undo
209 216
         *       record_# => warning message
210 217
         *       )
211 218
         */
212
-        public function get_warnings() {
219
+        public function get_warnings()
220
+        {
213 221
 		return $this->warnings;
214 222
 	}
215 223
 
@@ -221,7 +229,8 @@  discard block
 block discarded – undo
221 229
         *       record_# => error message
222 230
         *       )
223 231
         */
224
-        public function get_errors() {
232
+        public function get_errors()
233
+        {
225 234
 		return $this->errors;
226 235
 	}
227 236
 
@@ -233,7 +242,8 @@  discard block
 block discarded – undo
233 242
         *       action => record count
234 243
         * )
235 244
         */
236
-        public function get_results() {
245
+        public function get_results()
246
+        {
237 247
                 return $this->results;
238 248
         }
239 249
 }
240 250
\ No newline at end of file
Please login to merge, or discard this patch.
calendar/inc/class.calendar_timezones.inc.php 1 patch
Braces   +27 added lines, -6 removed lines patch added patch discarded remove patch
@@ -188,10 +188,18 @@  discard block
 block discarded – undo
188 188
 		{
189 189
 			$updated = false;
190 190
 			$msg = self::import_zones($updated);
191
-			if ($updated) error_log($msg);	// log that timezones have been updated
191
+			if ($updated)
192
+			{
193
+				error_log($msg);
194
+			}
195
+			// log that timezones have been updated
192 196
 
193 197
 			$alias_msg = self::import_tz_aliases($updated);
194
-			if ($updated) error_log($alias_msg);	// log that timezone aliases have been updated
198
+			if ($updated)
199
+			{
200
+				error_log($alias_msg);
201
+			}
202
+			// log that timezone aliases have been updated
195 203
 
196 204
 			self::$import_msg = $msg.'<br/>'.$alias_msg;
197 205
 
@@ -249,7 +257,11 @@  discard block
 block discarded – undo
249 257
 				if ($type == 'aliases')
250 258
 				{
251 259
 					$data = array('alias' => $tz2id[$data['aliasTo']]);
252
-					if (!$data['alias']) continue;	// there's no such tzid
260
+					if (!$data['alias'])
261
+					{
262
+						continue;
263
+					}
264
+					// there's no such tzid
253 265
 				}
254 266
 				// check if already in database
255 267
 				$tz2id[$tzid] = $GLOBALS['egw']->db->select('egw_cal_timezones','tz_id',array(
@@ -266,7 +278,10 @@  discard block
 block discarded – undo
266 278
 				),__LINE__,__FILE__,'calendar');
267 279
 
268 280
 				// only query last insert id, if not already in database (gives warning for PostgreSQL)
269
-				if (!$tz2id[$tzid]) $tz2id[$tzid] = $GLOBALS['egw']->db->get_last_insert_id('egw_cal_timezones','tz_id');
281
+				if (!$tz2id[$tzid])
282
+				{
283
+					$tz2id[$tzid] = $GLOBALS['egw']->db->get_last_insert_id('egw_cal_timezones','tz_id');
284
+				}
270 285
 			}
271 286
 		}
272 287
 		Api\Config::save_value('tz_version', $tz_version, 'phpgwapi');
@@ -306,13 +321,16 @@  discard block
 block discarded – undo
306 321
 		foreach($tz_aliases as $alias => $tzid)
307 322
 		{
308 323
 			if ((!($alias_id=self::tz2id($alias, 'alias')) || self::id2tz($alias_id, 'tzid') !== $tzid) &&	// not in DB or different
309
-				($tz_id = self::tz2id($tzid)))	// given tzid for alias exists in DB
324
+				($tz_id = self::tz2id($tzid)))
325
+			{
326
+				// given tzid for alias exists in DB
310 327
 			{
311 328
 				$GLOBALS['egw']->db->insert('egw_cal_timezones',array(
312 329
 					'tz_alias' => $tz_id,
313 330
 				),array(
314 331
 					'tz_tzid' => $alias,
315 332
 				),__LINE__,__FILE__,'calendar');
333
+			}
316 334
 				++$updates;
317 335
 			}
318 336
 			//error_log(__METHOD__."() alias=$alias, tzid=$tzid --> self::tz2id('$alias', 'alias') = ".array2string($alias_id).",  self::tz2id('$tzid')=".array2string($tz_id));
@@ -402,7 +420,10 @@  discard block
 block discarded – undo
402 420
 			$prefs = $prefs_obj->read();
403 421
 			$tzid = $prefs['common']['tz'];
404 422
 		}
405
-		if (!$tzid) $tzid = Api\DateTime::$server_timezone->getName();
423
+		if (!$tzid)
424
+		{
425
+			$tzid = Api\DateTime::$server_timezone->getName();
426
+		}
406 427
 
407 428
 		switch ($type)
408 429
 		{
Please login to merge, or discard this patch.