@@ -33,7 +33,10 @@ discard block |
||
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 |
||
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'); |
@@ -41,7 +41,10 @@ discard block |
||
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 |
||
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 |
||
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( |
@@ -188,10 +188,18 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | { |
@@ -77,16 +77,31 @@ discard block |
||
77 | 77 | $ui = new calendar_uiviews(); |
78 | 78 | if ($this->favorite) |
79 | 79 | { |
80 | - if($this->favorite['state']['start']) $ui->search_params['start'] = $this->favorite['state']['start']; |
|
81 | - if($this->favorite['state']['cat_id']) $ui->search_params['cat_id'] = $this->favorite['state']['cat_id']; |
|
80 | + if($this->favorite['state']['start']) |
|
81 | + { |
|
82 | + $ui->search_params['start'] = $this->favorite['state']['start']; |
|
83 | + } |
|
84 | + if($this->favorite['state']['cat_id']) |
|
85 | + { |
|
86 | + $ui->search_params['cat_id'] = $this->favorite['state']['cat_id']; |
|
87 | + } |
|
82 | 88 | // Owner can be 0 for current user |
83 | - if(array_key_exists('owner',$this->favorite['state'])) $ui->search_params['users'] = $this->favorite['state']['owner']; |
|
89 | + if(array_key_exists('owner',$this->favorite['state'])) |
|
90 | + { |
|
91 | + $ui->search_params['users'] = $this->favorite['state']['owner']; |
|
92 | + } |
|
84 | 93 | if($ui->search_params['users'] && !is_array($ui->search_params['users'])) |
85 | 94 | { |
86 | 95 | $ui->search_params['users'] = explode(',',$ui->search_params['users']); |
87 | 96 | } |
88 | - if($this->favorite['state']['filter']) $ui->search_params['filter'] = $this->favorite['state']['filter']; |
|
89 | - if($this->favorite['state']['sortby']) $ui->search_params['sortby'] = $this->favorite['state']['sortby']; |
|
97 | + if($this->favorite['state']['filter']) |
|
98 | + { |
|
99 | + $ui->search_params['filter'] = $this->favorite['state']['filter']; |
|
100 | + } |
|
101 | + if($this->favorite['state']['sortby']) |
|
102 | + { |
|
103 | + $ui->search_params['sortby'] = $this->favorite['state']['sortby']; |
|
104 | + } |
|
90 | 105 | $ui->search_params['weekend'] = $this->favorite['state']['weekend']; |
91 | 106 | } |
92 | 107 | $etemplate->read('home.legacy'); |
@@ -246,7 +261,8 @@ discard block |
||
246 | 261 | return $properties; |
247 | 262 | } |
248 | 263 | |
249 | - public function get_actions() { |
|
264 | + public function get_actions() |
|
265 | + { |
|
250 | 266 | if($this->favorite['state']['view'] == 'listview' || !$this->actions) |
251 | 267 | { |
252 | 268 | return array(); |
@@ -14,7 +14,10 @@ |
||
14 | 14 | |
15 | 15 | use EGroupware\Api\Asyncservice; |
16 | 16 | |
17 | -if (!isset($_REQUEST['domain'])) $_REQUEST['domain'] = isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : 'default'; |
|
17 | +if (!isset($_REQUEST['domain'])) |
|
18 | +{ |
|
19 | + $_REQUEST['domain'] = isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : 'default'; |
|
20 | +} |
|
18 | 21 | $path_to_egroupware = realpath(__DIR__.'/..'); // need to be adapted if this script is moved somewhere else |
19 | 22 | |
20 | 23 | // remove the comment from one of the following lines to enable loging |
@@ -48,7 +48,10 @@ |
||
48 | 48 | exit; |
49 | 49 | } |
50 | 50 | |
51 | -if (empty($_GET['debug'])) $content = 'egw.set_images('.$content.", egw && egw.window !== window);\n"; |
|
51 | +if (empty($_GET['debug'])) |
|
52 | +{ |
|
53 | + $content = 'egw.set_images('.$content.", egw && egw.window !== window);\n"; |
|
54 | +} |
|
52 | 55 | |
53 | 56 | // we run our own gzip compression, to set a correct Content-Length of the encoded content |
54 | 57 | if (in_array('gzip', explode(',',$_SERVER['HTTP_ACCEPT_ENCODING'])) && function_exists('gzencode')) |
@@ -80,7 +80,10 @@ discard block |
||
80 | 80 | private function parse_file($file) |
81 | 81 | { |
82 | 82 | // file is from url and can contain query-params, eg. /phpgwapi/inc/jscalendar-setup.php?dateformat=d.m.Y&lang=de |
83 | - if (strpos($file,'?') !== false) list($file) = explode('?',$file); |
|
83 | + if (strpos($file,'?') !== false) |
|
84 | + { |
|
85 | + list($file) = explode('?',$file); |
|
86 | + } |
|
84 | 87 | |
85 | 88 | // Mark the file as parsed |
86 | 89 | $this->parsed_files[$file] = true; |
@@ -326,12 +329,15 @@ discard block |
||
326 | 329 | } |
327 | 330 | } |
328 | 331 | |
329 | - if (self::$DEBUG_MODE) // DEBUG_MODE is currently ALWAYS true. Comment this code out if you don't want error messages. |
|
332 | + if (self::$DEBUG_MODE) |
|
333 | + { |
|
334 | + // DEBUG_MODE is currently ALWAYS true. Comment this code out if you don't want error messages. |
|
330 | 335 | { |
331 | 336 | //error_log(__METHOD__."($package,$file,$app) $path NOT found".($this->debug_processing_file ? " while processing file '{$this->debug_processing_file}'." : "!").' '.function_backtrace()); |
332 | 337 | } |
333 | 338 | |
334 | 339 | return false; |
340 | + } |
|
335 | 341 | } |
336 | 342 | |
337 | 343 | /** |
@@ -377,7 +383,10 @@ discard block |
||
377 | 383 | */ |
378 | 384 | public function include_files(array $files, $clear_files=false) |
379 | 385 | { |
380 | - if ($clear_files) $this->included_files = array(); |
|
386 | + if ($clear_files) |
|
387 | + { |
|
388 | + $this->included_files = array(); |
|
389 | + } |
|
381 | 390 | |
382 | 391 | foreach ($files as $file) |
383 | 392 | { |
@@ -394,7 +403,10 @@ discard block |
||
394 | 403 | public function get_included_files($clear_files=false) |
395 | 404 | { |
396 | 405 | $ret = array_keys($this->included_files); |
397 | - if ($clear_files) $this->included_files = array(); |
|
406 | + if ($clear_files) |
|
407 | + { |
|
408 | + $this->included_files = array(); |
|
409 | + } |
|
398 | 410 | return $ret; |
399 | 411 | } |
400 | 412 |
@@ -547,7 +547,10 @@ |
||
547 | 547 | |
548 | 548 | function check_debug() |
549 | 549 | { |
550 | - if (!$this->debug) return False; |
|
550 | + if (!$this->debug) |
|
551 | + { |
|
552 | + return False; |
|
553 | + } |
|
551 | 554 | |
552 | 555 | foreach(func_get_args() as $arg) |
553 | 556 | { |
@@ -161,7 +161,11 @@ |
||
161 | 161 | { |
162 | 162 | if(strpos($pref_name, $pref_prefix) === 0) |
163 | 163 | { |
164 | - if(!is_array($pref)) continue; // old favorite |
|
164 | + if(!is_array($pref)) |
|
165 | + { |
|
166 | + continue; |
|
167 | + } |
|
168 | + // old favorite |
|
165 | 169 | |
166 | 170 | $favorites[(string)substr($pref_name,strlen($pref_prefix))] = $pref; |
167 | 171 | } |