@@ -121,11 +121,14 @@ discard block |
||
| 121 | 121 | if (!$owner || !is_numeric($owner) || $GLOBALS['egw']->accounts->get_type($owner) != 'u' || |
| 122 | 122 | !$this->bo->check_perms(Acl::ADD,0,$owner)) |
| 123 | 123 | { |
| 124 | - if ($owner) // make an owner who is no user or we have no add-rights a participant |
|
| 124 | + if ($owner) |
|
| 125 | + { |
|
| 126 | + // make an owner who is no user or we have no add-rights a participant |
|
| 125 | 127 | { |
| 126 | 128 | if(!is_array($owner)) |
| 127 | 129 | { |
| 128 | 130 | $owner = explode(',',$owner); |
| 131 | + } |
|
| 129 | 132 | } |
| 130 | 133 | // if we come from ressources we don't need any users selected in calendar |
| 131 | 134 | if (!isset($_GET['participants']) || $_GET['participants'][0] != 'r') |
@@ -157,9 +160,17 @@ discard block |
||
| 157 | 160 | $participant_types['u'] = $participant_types = $participants = array(); |
| 158 | 161 | foreach($extra_participants as $uid) |
| 159 | 162 | { |
| 160 | - if (isset($participants[$uid])) continue; // already included |
|
| 163 | + if (isset($participants[$uid])) |
|
| 164 | + { |
|
| 165 | + continue; |
|
| 166 | + } |
|
| 167 | + // already included |
|
| 161 | 168 | |
| 162 | - if (!$this->bo->check_acl_invite($uid)) continue; // no right to invite --> ignored |
|
| 169 | + if (!$this->bo->check_acl_invite($uid)) |
|
| 170 | + { |
|
| 171 | + continue; |
|
| 172 | + } |
|
| 173 | + // no right to invite --> ignored |
|
| 163 | 174 | |
| 164 | 175 | if (is_numeric($uid)) |
| 165 | 176 | { |
@@ -197,10 +208,13 @@ discard block |
||
| 197 | 208 | } |
| 198 | 209 | } |
| 199 | 210 | } |
| 200 | - if (!$participants) // if all participants got removed, include current user |
|
| 211 | + if (!$participants) |
|
| 212 | + { |
|
| 213 | + // if all participants got removed, include current user |
|
| 201 | 214 | { |
| 202 | 215 | $participants[$this->user] = $participant_types['u'][$this->user] = calendar_so::combine_status('A',1,'CHAIR'); |
| 203 | 216 | } |
| 217 | + } |
|
| 204 | 218 | if(isset($_GET['cat_id'])) |
| 205 | 219 | { |
| 206 | 220 | $cat_id = explode(',',$_GET['cat_id']); |
@@ -250,10 +264,13 @@ discard block |
||
| 250 | 264 | */ |
| 251 | 265 | function process_edit($content) |
| 252 | 266 | { |
| 253 | - if (!is_array($content)) // redirect from etemplate, if POST empty |
|
| 267 | + if (!is_array($content)) |
|
| 268 | + { |
|
| 269 | + // redirect from etemplate, if POST empty |
|
| 254 | 270 | { |
| 255 | 271 | return $this->edit(null,null,strip_tags($_GET['msg'])); |
| 256 | 272 | } |
| 273 | + } |
|
| 257 | 274 | // clear notification errors |
| 258 | 275 | notifications::errors(true); |
| 259 | 276 | $messages = null; |
@@ -266,7 +283,11 @@ discard block |
||
| 266 | 283 | $update_type = $content['id'] ? ($content['recur_type'] == MCAL_RECUR_NONE ? 'update' : 'edit') : 'add'; |
| 267 | 284 | |
| 268 | 285 | list($button) = @each($content['button']); |
| 269 | - if (!$button && $content['action']) $button = $content['action']; // action selectbox |
|
| 286 | + if (!$button && $content['action']) |
|
| 287 | + { |
|
| 288 | + $button = $content['action']; |
|
| 289 | + } |
|
| 290 | + // action selectbox |
|
| 270 | 291 | unset($content['button']); unset($content['action']); |
| 271 | 292 | |
| 272 | 293 | $view = $content['view']; |
@@ -279,7 +300,10 @@ discard block |
||
| 279 | 300 | { |
| 280 | 301 | list($date) = each($content['recur_exception']['delete_exception']); |
| 281 | 302 | // eT2 converts time to |
| 282 | - if (!is_numeric($date)) $date = Api\DateTime::to (str_replace('Z','', $date), 'ts'); |
|
| 303 | + if (!is_numeric($date)) |
|
| 304 | + { |
|
| 305 | + $date = Api\DateTime::to (str_replace('Z','', $date), 'ts'); |
|
| 306 | + } |
|
| 283 | 307 | unset($content['recur_exception']['delete_exception']); |
| 284 | 308 | if (($key = array_search($date,$content['recur_exception'])) !== false) |
| 285 | 309 | { |
@@ -288,7 +312,10 @@ discard block |
||
| 288 | 312 | foreach ($recur_exceptions as $id) |
| 289 | 313 | { |
| 290 | 314 | if (!($exception = $this->bo->read($id)) || |
| 291 | - $exception['recurrence'] != $content['recur_exception'][$key]) continue; |
|
| 315 | + $exception['recurrence'] != $content['recur_exception'][$key]) |
|
| 316 | + { |
|
| 317 | + continue; |
|
| 318 | + } |
|
| 292 | 319 | $exception['uid'] = Api\CalDAV::generate_uid('calendar', $id); |
| 293 | 320 | $exception['reference'] = $exception['recurrence'] = 0; |
| 294 | 321 | $this->bo->update($exception, true, true,false,true,$messages,$content['no_notifications']); |
@@ -363,7 +390,10 @@ discard block |
||
| 363 | 390 | $event['end'] = $this->bo->date2ts($event['end']); |
| 364 | 391 | } |
| 365 | 392 | // some checks for recurrences, if you give a date, make it a weekly repeating event and visa versa |
| 366 | - if ($event['recur_type'] == MCAL_RECUR_NONE && $event['recur_data']) $event['recur_type'] = MCAL_RECUR_WEEKLY; |
|
| 393 | + if ($event['recur_type'] == MCAL_RECUR_NONE && $event['recur_data']) |
|
| 394 | + { |
|
| 395 | + $event['recur_type'] = MCAL_RECUR_WEEKLY; |
|
| 396 | + } |
|
| 367 | 397 | if ($event['recur_type'] == MCAL_RECUR_WEEKLY && !$event['recur_data']) |
| 368 | 398 | { |
| 369 | 399 | $event['recur_data'] = 1 << (int)date('w',$event['start']); |
@@ -489,7 +519,11 @@ discard block |
||
| 489 | 519 | break; |
| 490 | 520 | |
| 491 | 521 | default: // existing participant row |
| 492 | - if (!is_array($data)) continue; // widgets in participant tab, above participant list |
|
| 522 | + if (!is_array($data)) |
|
| 523 | + { |
|
| 524 | + continue; |
|
| 525 | + } |
|
| 526 | + // widgets in participant tab, above participant list |
|
| 493 | 527 | foreach(array('uid','status','quantity','role') as $name) |
| 494 | 528 | { |
| 495 | 529 | $$name = $data[$name]; |
@@ -621,7 +655,10 @@ discard block |
||
| 621 | 655 | { |
| 622 | 656 | foreach($participants as $id => &$p_response) |
| 623 | 657 | { |
| 624 | - if($type == 'u' && $id == $event['owner']) continue; |
|
| 658 | + if($type == 'u' && $id == $event['owner']) |
|
| 659 | + { |
|
| 660 | + continue; |
|
| 661 | + } |
|
| 625 | 662 | calendar_so::split_status($p_response, $quantity, $role); |
| 626 | 663 | // if resource defines callback for status of new status (eg. Resources app acknowledges direct booking acl), call it |
| 627 | 664 | $status = isset($this->bo->resources[$type]['new_status']) ? ExecMethod($this->bo->resources[$type]['new_status'],$id) : 'U'; |
@@ -703,17 +740,23 @@ discard block |
||
| 703 | 740 | { |
| 704 | 741 | foreach (array_keys($event['participants']) as $uid) |
| 705 | 742 | { |
| 706 | - if ($uid[0] == 'r') //ressource detection |
|
| 743 | + if ($uid[0] == 'r') |
|
| 744 | + { |
|
| 745 | + //ressource detection |
|
| 707 | 746 | { |
| 708 | 747 | $msg = lang('Error: ressources reservation in private events is not allowed!!!'); |
| 748 | + } |
|
| 709 | 749 | $button = ''; |
| 710 | 750 | break 2; //break foreach and case |
| 711 | 751 | } |
| 712 | 752 | } |
| 713 | 753 | } |
| 714 | - if ($content['edit_single']) // we edited a single event from a series |
|
| 754 | + if ($content['edit_single']) |
|
| 755 | + { |
|
| 756 | + // we edited a single event from a series |
|
| 715 | 757 | { |
| 716 | 758 | $event['reference'] = $event['id']; |
| 759 | + } |
|
| 717 | 760 | $event['recurrence'] = $content['edit_single']; |
| 718 | 761 | unset($event['id']); |
| 719 | 762 | $conflicts = $this->bo->update($event,$ignore_conflicts,true,false,true,$messages,$content['no_notifications']); |
@@ -815,7 +858,10 @@ discard block |
||
| 815 | 858 | case 'no': |
| 816 | 859 | break; |
| 817 | 860 | case 'startday': |
| 818 | - if ($sameday) break; |
|
| 861 | + if ($sameday) |
|
| 862 | + { |
|
| 863 | + break; |
|
| 864 | + } |
|
| 819 | 865 | default: |
| 820 | 866 | $status_reset_to_unknown = true; |
| 821 | 867 | $event['participants'][$uid] = calendar_so::combine_status('U',$q,$r); |
@@ -977,7 +1023,10 @@ discard block |
||
| 977 | 1023 | if ($event['recur_type'] != MCAL_RECUR_NONE && $content['reference'] == 0 && !$content['edit_single']) |
| 978 | 1024 | { |
| 979 | 1025 | $msg = lang('Series deleted'); |
| 980 | - if ($exceptions_kept) $msg .= lang(', exceptions preserved'); |
|
| 1026 | + if ($exceptions_kept) |
|
| 1027 | + { |
|
| 1028 | + $msg .= lang(', exceptions preserved'); |
|
| 1029 | + } |
|
| 981 | 1030 | } |
| 982 | 1031 | else |
| 983 | 1032 | { |
@@ -1013,11 +1062,14 @@ discard block |
||
| 1013 | 1062 | { |
| 1014 | 1063 | $msg = lang("Can't add alarms in the past !!!"); |
| 1015 | 1064 | } |
| 1016 | - elseif ($event['id']) // save the alarm immediatly |
|
| 1065 | + elseif ($event['id']) |
|
| 1066 | + { |
|
| 1067 | + // save the alarm immediatly |
|
| 1017 | 1068 | { |
| 1018 | 1069 | if (($alarm_id = $this->bo->save_alarm($event['id'],$alarm))) |
| 1019 | 1070 | { |
| 1020 | 1071 | $alarm['id'] = $alarm_id; |
| 1072 | + } |
|
| 1021 | 1073 | $event['alarm'][$alarm_id] = $alarm; |
| 1022 | 1074 | |
| 1023 | 1075 | $msg = lang('Alarm added'); |
@@ -1030,7 +1082,9 @@ discard block |
||
| 1030 | 1082 | } |
| 1031 | 1083 | else |
| 1032 | 1084 | { |
| 1033 | - for($alarm['id']=1; isset($event['alarm'][$alarm['id']]); $alarm['id']++) {} // get a temporary non-conflicting, numeric id |
|
| 1085 | + for($alarm['id']=1; isset($event['alarm'][$alarm['id']]); $alarm['id']++) |
|
| 1086 | + { |
|
| 1087 | +} // get a temporary non-conflicting, numeric id |
|
| 1034 | 1088 | $event['alarm'][$alarm['id']] = $alarm; |
| 1035 | 1089 | } |
| 1036 | 1090 | } |
@@ -1053,10 +1107,13 @@ discard block |
||
| 1053 | 1107 | } |
| 1054 | 1108 | if (in_array($button,array('cancel','save','delete','delete_exceptions','delete_keep_exceptions')) && $noerror) |
| 1055 | 1109 | { |
| 1056 | - if ($content['lock_token']) // remove an existing lock |
|
| 1110 | + if ($content['lock_token']) |
|
| 1111 | + { |
|
| 1112 | + // remove an existing lock |
|
| 1057 | 1113 | { |
| 1058 | 1114 | Vfs::unlock(Vfs::app_entry_lock_path('calendar',$content['id']),$content['lock_token'],false); |
| 1059 | 1115 | } |
| 1116 | + } |
|
| 1060 | 1117 | if ($content['no_popup']) |
| 1061 | 1118 | { |
| 1062 | 1119 | Egw::redirect_link('/index.php',array( |
@@ -1113,13 +1170,19 @@ discard block |
||
| 1113 | 1170 | } |
| 1114 | 1171 | |
| 1115 | 1172 | // Copy links |
| 1116 | - if(!is_array($event['link_to'])) $event['link_to'] = array(); |
|
| 1173 | + if(!is_array($event['link_to'])) |
|
| 1174 | + { |
|
| 1175 | + $event['link_to'] = array(); |
|
| 1176 | + } |
|
| 1117 | 1177 | $event['link_to']['to_app'] = 'calendar'; |
| 1118 | 1178 | $event['link_to']['to_id'] = 0; |
| 1119 | 1179 | |
| 1120 | 1180 | foreach(Link::get_links($event['link_to']['to_app'], $event['id']) as $link) |
| 1121 | 1181 | { |
| 1122 | - if(!$link['id']) continue; |
|
| 1182 | + if(!$link['id']) |
|
| 1183 | + { |
|
| 1184 | + continue; |
|
| 1185 | + } |
|
| 1123 | 1186 | if ($link['app'] != Link::VFS_APPNAME) |
| 1124 | 1187 | { |
| 1125 | 1188 | Link::link('calendar', $event['link_to']['to_id'], $link['app'], $link['id'], $link['remark']); |
@@ -1187,8 +1250,7 @@ discard block |
||
| 1187 | 1250 | if (Api\DateTime::to($old_event['start'],'Ymd') < Api\DateTime::to($as_of_date,'Ymd') || |
| 1188 | 1251 | // Adjust for requested date in the past |
| 1189 | 1252 | Api\DateTime::to($as_of_date,'ts') < time() |
| 1190 | - ) |
|
| 1191 | - { |
|
| 1253 | + ) { |
|
| 1192 | 1254 | |
| 1193 | 1255 | unset($orig_event); |
| 1194 | 1256 | // copy event by unsetting the id(s) |
@@ -1276,30 +1338,48 @@ discard block |
||
| 1276 | 1338 | foreach($event['participants'] as $uid => $status) |
| 1277 | 1339 | { |
| 1278 | 1340 | //error_log(__METHOD__.__LINE__.' '.$uid.':'.array2string($status)); |
| 1279 | - if (empty($status)) continue; |
|
| 1341 | + if (empty($status)) |
|
| 1342 | + { |
|
| 1343 | + continue; |
|
| 1344 | + } |
|
| 1280 | 1345 | $toadd = ''; |
| 1281 | - if ((isset($status['status']) && $status['status'] == 'R') || (isset($status['uid']) && $status['uid'] == $this->user)) continue; |
|
| 1346 | + if ((isset($status['status']) && $status['status'] == 'R') || (isset($status['uid']) && $status['uid'] == $this->user)) |
|
| 1347 | + { |
|
| 1348 | + continue; |
|
| 1349 | + } |
|
| 1282 | 1350 | |
| 1283 | 1351 | if (isset($status['uid']) && is_numeric($status['uid']) && $GLOBALS['egw']->accounts->get_type($status['uid']) == 'u') |
| 1284 | 1352 | { |
| 1285 | - if (!($email = $GLOBALS['egw']->accounts->id2name($status['uid'],'account_email'))) continue; |
|
| 1353 | + if (!($email = $GLOBALS['egw']->accounts->id2name($status['uid'],'account_email'))) |
|
| 1354 | + { |
|
| 1355 | + continue; |
|
| 1356 | + } |
|
| 1286 | 1357 | |
| 1287 | 1358 | $toadd = $GLOBALS['egw']->accounts->id2name($status['uid'], 'account_firstname').' '. |
| 1288 | 1359 | $GLOBALS['egw']->accounts->id2name($status['uid'], 'account_lastname').' <'.$email.'>'; |
| 1289 | 1360 | |
| 1290 | - if (!in_array($toadd,$to)) $to[] = $toadd; |
|
| 1361 | + if (!in_array($toadd,$to)) |
|
| 1362 | + { |
|
| 1363 | + $to[] = $toadd; |
|
| 1364 | + } |
|
| 1291 | 1365 | } |
| 1292 | 1366 | elseif ($uid < 0) |
| 1293 | 1367 | { |
| 1294 | 1368 | foreach($GLOBALS['egw']->accounts->members($uid,true) as $uid) |
| 1295 | 1369 | { |
| 1296 | - if (!($email = $GLOBALS['egw']->accounts->id2name($uid,'account_email'))) continue; |
|
| 1370 | + if (!($email = $GLOBALS['egw']->accounts->id2name($uid,'account_email'))) |
|
| 1371 | + { |
|
| 1372 | + continue; |
|
| 1373 | + } |
|
| 1297 | 1374 | |
| 1298 | 1375 | $toadd = $GLOBALS['egw']->accounts->id2name($uid, 'account_firstname').' '. |
| 1299 | 1376 | $GLOBALS['egw']->accounts->id2name($uid, 'account_lastname').' <'.$email.'>'; |
| 1300 | 1377 | |
| 1301 | 1378 | // dont add groupmembers if they already rejected the event, or are the current user |
| 1302 | - if (!in_array($toadd,$to) && ($event['participants'][$uid] !== 'R' && $uid != $this->user)) $to[] = $toadd; |
|
| 1379 | + if (!in_array($toadd,$to) && ($event['participants'][$uid] !== 'R' && $uid != $this->user)) |
|
| 1380 | + { |
|
| 1381 | + $to[] = $toadd; |
|
| 1382 | + } |
|
| 1303 | 1383 | } |
| 1304 | 1384 | } |
| 1305 | 1385 | elseif(!empty($status['uid'])&& !is_numeric(substr($status['uid'],0,1)) && ($info = $this->bo->resource_info($status['uid']))) |
@@ -1351,7 +1431,10 @@ discard block |
||
| 1351 | 1431 | 'preset[type]' => 'text/calendar'.($asrequest?'; method=REQUEST':''), |
| 1352 | 1432 | 'preset[size]' => filesize($ics_file), |
| 1353 | 1433 | ); |
| 1354 | - if ($asrequest) $vars['preset[msg]'] = lang('You attempt to mail a meetingrequest to the recipients above. Depending on the client this mail is opened with, the recipient may or may not see the mailbody below, but only see the meeting request attached.'); |
|
| 1434 | + if ($asrequest) |
|
| 1435 | + { |
|
| 1436 | + $vars['preset[msg]'] = lang('You attempt to mail a meetingrequest to the recipients above. Depending on the client this mail is opened with, the recipient may or may not see the mailbody below, but only see the meeting request attached.'); |
|
| 1437 | + } |
|
| 1355 | 1438 | $response = Api\Json\Response::get(); |
| 1356 | 1439 | $response->call('app.calendar.custom_mail', $vars); |
| 1357 | 1440 | } |
@@ -1537,9 +1620,15 @@ discard block |
||
| 1537 | 1620 | } |
| 1538 | 1621 | } |
| 1539 | 1622 | // set new start and end if given by $_GET |
| 1540 | - if(isset($_GET['start'])) { $event['start'] = Api\DateTime::to($_GET['start'],'ts'); } |
|
| 1541 | - if(isset($_GET['end'])) { $event['end'] = Api\DateTime::to($_GET['end'],'ts'); } |
|
| 1542 | - if(isset($_GET['non_blocking'])) { $event['non_blocking'] = (bool)$_GET['non_blocking']; } |
|
| 1623 | + if(isset($_GET['start'])) |
|
| 1624 | + { |
|
| 1625 | +$event['start'] = Api\DateTime::to($_GET['start'],'ts'); } |
|
| 1626 | + if(isset($_GET['end'])) |
|
| 1627 | + { |
|
| 1628 | +$event['end'] = Api\DateTime::to($_GET['end'],'ts'); } |
|
| 1629 | + if(isset($_GET['non_blocking'])) |
|
| 1630 | + { |
|
| 1631 | +$event['non_blocking'] = (bool)$_GET['non_blocking']; } |
|
| 1543 | 1632 | // check if the event is the whole day |
| 1544 | 1633 | $start = $this->bo->date2array($event['start']); |
| 1545 | 1634 | $end = $this->bo->date2array($event['end']); |
@@ -1552,10 +1641,13 @@ discard block |
||
| 1552 | 1641 | foreach(is_array($_REQUEST['link_app']) ? $_REQUEST['link_app'] : array($_REQUEST['link_app']) as $n => $link_app) |
| 1553 | 1642 | { |
| 1554 | 1643 | $link_id = $link_ids[$n]; |
| 1555 | - if(!preg_match('/^[a-z_0-9-]+:[:a-z_0-9-]+$/i',$link_app.':'.$link_id)) // guard against XSS |
|
| 1644 | + if(!preg_match('/^[a-z_0-9-]+:[:a-z_0-9-]+$/i',$link_app.':'.$link_id)) |
|
| 1645 | + { |
|
| 1646 | + // guard against XSS |
|
| 1556 | 1647 | { |
| 1557 | 1648 | continue; |
| 1558 | 1649 | } |
| 1650 | + } |
|
| 1559 | 1651 | if(!$n) |
| 1560 | 1652 | { |
| 1561 | 1653 | $event['title'] = Link::title($link_app,$link_id); |
@@ -1564,7 +1656,10 @@ discard block |
||
| 1564 | 1656 | { |
| 1565 | 1657 | foreach((array)$set['link_app'] as $i => $l_app) |
| 1566 | 1658 | { |
| 1567 | - if (($l_id=$set['link_id'][$i])) Link::link('calendar',$event['link_to']['to_id'],$l_app,$l_id); |
|
| 1659 | + if (($l_id=$set['link_id'][$i])) |
|
| 1660 | + { |
|
| 1661 | + Link::link('calendar',$event['link_to']['to_id'],$l_app,$l_id); |
|
| 1662 | + } |
|
| 1568 | 1663 | } |
| 1569 | 1664 | unset($set['link_app']); |
| 1570 | 1665 | unset($set['link_id']); |
@@ -1590,10 +1685,13 @@ discard block |
||
| 1590 | 1685 | $lock_path = Vfs::app_entry_lock_path('calendar',$event['id']); |
| 1591 | 1686 | $lock_owner = 'mailto:'.$GLOBALS['egw_info']['user']['account_email']; |
| 1592 | 1687 | |
| 1593 | - if (($preserv['lock_token'] = $event['lock_token'])) // already locked --> refresh the lock |
|
| 1688 | + if (($preserv['lock_token'] = $event['lock_token'])) |
|
| 1689 | + { |
|
| 1690 | + // already locked --> refresh the lock |
|
| 1594 | 1691 | { |
| 1595 | 1692 | Vfs::lock($lock_path,$preserv['lock_token'],$locktime,$lock_owner,$scope='shared',$type='write',true,false); |
| 1596 | 1693 | } |
| 1694 | + } |
|
| 1597 | 1695 | if (($lock = Vfs::checkLock($lock_path)) && $lock['owner'] != $lock_owner) |
| 1598 | 1696 | { |
| 1599 | 1697 | $msg .= ' '.lang('This entry is currently opened by %1!', |
@@ -1627,14 +1725,20 @@ discard block |
||
| 1627 | 1725 | )); |
| 1628 | 1726 | Framework::message($msg, $msg_type); |
| 1629 | 1727 | $content['duration'] = $content['end'] - $content['start']; |
| 1630 | - if (isset($this->durations[$content['duration']])) $content['end'] = ''; |
|
| 1728 | + if (isset($this->durations[$content['duration']])) |
|
| 1729 | + { |
|
| 1730 | + $content['end'] = ''; |
|
| 1731 | + } |
|
| 1631 | 1732 | |
| 1632 | 1733 | $row = 3; |
| 1633 | 1734 | $readonlys = $content['participants'] = $preserv['participants'] = array(); |
| 1634 | 1735 | // preserve some ui elements, if set eg. under error-conditions |
| 1635 | 1736 | foreach(array('quantity','resource','role') as $n) |
| 1636 | 1737 | { |
| 1637 | - if (isset($event['participants'][$n])) $content['participants'][$n] = $event['participants'][$n]; |
|
| 1738 | + if (isset($event['participants'][$n])) |
|
| 1739 | + { |
|
| 1740 | + $content['participants'][$n] = $event['participants'][$n]; |
|
| 1741 | + } |
|
| 1638 | 1742 | } |
| 1639 | 1743 | foreach($event['participant_types'] as $type => $participants) |
| 1640 | 1744 | { |
@@ -1676,9 +1780,13 @@ discard block |
||
| 1676 | 1780 | //echo "<p>$uid ($quantity): $role --> {$content['participants'][$row]['role']}</p>\n"; |
| 1677 | 1781 | |
| 1678 | 1782 | if (($no_status = !$this->bo->check_status_perms($uid,$event)) || $view) |
| 1679 | - $readonlys['participants'][$row]['status'] = $no_status; |
|
| 1783 | + { |
|
| 1784 | + $readonlys['participants'][$row]['status'] = $no_status; |
|
| 1785 | + } |
|
| 1680 | 1786 | if ($preserv['hide_delete'] || !$this->bo->check_perms(Acl::EDIT,$event)) |
| 1681 | - $readonlys['participants']['delete'][$uid] = true; |
|
| 1787 | + { |
|
| 1788 | + $readonlys['participants']['delete'][$uid] = true; |
|
| 1789 | + } |
|
| 1682 | 1790 | // todo: make the participants available as links with email as title |
| 1683 | 1791 | $content['participants'][$row++]['title'] = $this->get_title($uid); |
| 1684 | 1792 | // enumerate group-invitations, so people can accept/reject them |
@@ -1709,7 +1817,11 @@ discard block |
||
| 1709 | 1817 | $content['participants']['cal_resources'] = ''; |
| 1710 | 1818 | foreach($this->bo->resources as $data) |
| 1711 | 1819 | { |
| 1712 | - if ($data['app'] == 'email') continue; // make no sense, as we cant search for email |
|
| 1820 | + if ($data['app'] == 'email') |
|
| 1821 | + { |
|
| 1822 | + continue; |
|
| 1823 | + } |
|
| 1824 | + // make no sense, as we cant search for email |
|
| 1713 | 1825 | $content['participants']['cal_resources'] .= ','.$data['app']; |
| 1714 | 1826 | } |
| 1715 | 1827 | } |
@@ -1737,9 +1849,18 @@ discard block |
||
| 1737 | 1849 | $hours = (int) (($alarm['offset'] % DAY_s) / HOUR_s); |
| 1738 | 1850 | $minutes = (int) (($alarm['offset'] % HOUR_s) / 60); |
| 1739 | 1851 | $label = array(); |
| 1740 | - if ($days) $label[] = $days.' '.lang('days'); |
|
| 1741 | - if ($hours) $label[] = $hours.' '.lang('hours'); |
|
| 1742 | - if ($minutes) $label[] = $minutes.' '.lang('Minutes'); |
|
| 1852 | + if ($days) |
|
| 1853 | + { |
|
| 1854 | + $label[] = $days.' '.lang('days'); |
|
| 1855 | + } |
|
| 1856 | + if ($hours) |
|
| 1857 | + { |
|
| 1858 | + $label[] = $hours.' '.lang('hours'); |
|
| 1859 | + } |
|
| 1860 | + if ($minutes) |
|
| 1861 | + { |
|
| 1862 | + $label[] = $minutes.' '.lang('Minutes'); |
|
| 1863 | + } |
|
| 1743 | 1864 | $alarm['offset'] = implode(', ',$label) . ' ' . ($after ? lang('after') : lang('before')); |
| 1744 | 1865 | $content['alarm'][] = $alarm; |
| 1745 | 1866 | |
@@ -1802,25 +1923,34 @@ discard block |
||
| 1802 | 1923 | 'participants' => $this->accountsel->account_selection == 'none', |
| 1803 | 1924 | 'history' => !$event['id'], |
| 1804 | 1925 | ); |
| 1805 | - if (!isset($GLOBALS['egw_info']['user']['apps']['mail'])) // no mail without mail-app |
|
| 1926 | + if (!isset($GLOBALS['egw_info']['user']['apps']['mail'])) |
|
| 1927 | + { |
|
| 1928 | + // no mail without mail-app |
|
| 1806 | 1929 | { |
| 1807 | 1930 | unset($sel_options['action']['mail']); |
| 1931 | + } |
|
| 1808 | 1932 | unset($sel_options['action']['sendmeetingrequest']); |
| 1809 | 1933 | } |
| 1810 | - if (!$event['id']) // no ical export for new (not saved) events |
|
| 1934 | + if (!$event['id']) |
|
| 1935 | + { |
|
| 1936 | + // no ical export for new (not saved) events |
|
| 1811 | 1937 | { |
| 1812 | 1938 | $readonlys['action'] = true; |
| 1813 | 1939 | } |
| 1940 | + } |
|
| 1814 | 1941 | if (!($readonlys['button[exception]'] = !$this->bo->check_perms(Acl::EDIT,$event) || $event['recur_type'] == MCAL_RECUR_NONE || ($event['recur_enddate'] &&$event['start'] > $event['recur_enddate']))) |
| 1815 | 1942 | { |
| 1816 | 1943 | $content['exception_label'] = $this->bo->long_date(max($preserved['actual_date'], $event['start'])); |
| 1817 | 1944 | } |
| 1818 | 1945 | $readonlys['button[delete]'] = !$event['id'] || $preserved['hide_delete'] || !$this->bo->check_perms(Acl::DELETE,$event); |
| 1819 | 1946 | |
| 1820 | - if (!$event['id'] || $this->bo->check_perms(Acl::EDIT,$event)) // new event or edit rights to the event ==> allow to add alarm for all users |
|
| 1947 | + if (!$event['id'] || $this->bo->check_perms(Acl::EDIT,$event)) |
|
| 1948 | + { |
|
| 1949 | + // new event or edit rights to the event ==> allow to add alarm for all users |
|
| 1821 | 1950 | { |
| 1822 | 1951 | $sel_options['owner'][0] = lang('All participants'); |
| 1823 | 1952 | } |
| 1953 | + } |
|
| 1824 | 1954 | if (isset($event['participant_types']['u'][$this->user])) |
| 1825 | 1955 | { |
| 1826 | 1956 | $sel_options['owner'][$this->user] = $this->bo->participant_name($this->user); |
@@ -1862,7 +1992,10 @@ discard block |
||
| 1862 | 1992 | |
| 1863 | 1993 | $content['cancel_needs_refresh'] = (bool)$_GET['cancel_needs_refresh']; |
| 1864 | 1994 | |
| 1865 | - if (!empty($preserved['lock_token'])) $content['lock_token'] = $preserved['lock_token']; |
|
| 1995 | + if (!empty($preserved['lock_token'])) |
|
| 1996 | + { |
|
| 1997 | + $content['lock_token'] = $preserved['lock_token']; |
|
| 1998 | + } |
|
| 1866 | 1999 | |
| 1867 | 2000 | // non_interactive==true from $_GET calls immediate save action without displaying the edit form |
| 1868 | 2001 | if(isset($_GET['non_interactive']) && (bool)$_GET['non_interactive'] === true) |
@@ -2064,7 +2197,10 @@ discard block |
||
| 2064 | 2197 | // set status and send notification / meeting response |
| 2065 | 2198 | if ($this->bo->set_status($event['id'], $user, $status)) |
| 2066 | 2199 | { |
| 2067 | - if (!$msg) $msg = lang('Status changed'); |
|
| 2200 | + if (!$msg) |
|
| 2201 | + { |
|
| 2202 | + $msg = lang('Status changed'); |
|
| 2203 | + } |
|
| 2068 | 2204 | } |
| 2069 | 2205 | break; |
| 2070 | 2206 | |
@@ -2143,13 +2279,16 @@ discard block |
||
| 2143 | 2279 | |
| 2144 | 2280 | foreach (array_keys($allConflicts) as $pId) |
| 2145 | 2281 | { |
| 2146 | - if(substr($pId,0,1) == 'r' && $resources_config ) // resources Allow ignore conflicts |
|
| 2282 | + if(substr($pId,0,1) == 'r' && $resources_config ) |
|
| 2283 | + { |
|
| 2284 | + // resources Allow ignore conflicts |
|
| 2147 | 2285 | { |
| 2148 | 2286 | |
| 2149 | 2287 | switch ($resources_config['ignoreconflicts']) |
| 2150 | 2288 | { |
| 2151 | 2289 | case 'no': |
| 2152 | 2290 | $readonlys['button[ignore]'] = true; |
| 2291 | + } |
|
| 2153 | 2292 | break; |
| 2154 | 2293 | case 'allusers': |
| 2155 | 2294 | $readonlys['button[ignore]'] = false; |
@@ -2293,7 +2432,10 @@ discard block |
||
| 2293 | 2432 | } |
| 2294 | 2433 | else |
| 2295 | 2434 | { |
| 2296 | - if (!$content['duration']) $content['duration'] = $content['end'] - $content['start']; |
|
| 2435 | + if (!$content['duration']) |
|
| 2436 | + { |
|
| 2437 | + $content['duration'] = $content['end'] - $content['start']; |
|
| 2438 | + } |
|
| 2297 | 2439 | $weekds = 0; |
| 2298 | 2440 | foreach ($content['weekdays'] as &$wdays) |
| 2299 | 2441 | { |
@@ -2315,7 +2457,10 @@ discard block |
||
| 2315 | 2457 | $GLOBALS['egw_info']['flags']['app_header'] = lang('calendar') . ' - ' . lang('freetime search'); |
| 2316 | 2458 | |
| 2317 | 2459 | $sel_options['duration'] = $this->durations; |
| 2318 | - if ($content['duration'] && isset($sel_options['duration'][$content['duration']])) $content['end'] = ''; |
|
| 2460 | + if ($content['duration'] && isset($sel_options['duration'][$content['duration']])) |
|
| 2461 | + { |
|
| 2462 | + $content['end'] = ''; |
|
| 2463 | + } |
|
| 2319 | 2464 | |
| 2320 | 2465 | $etpl->exec('calendar.calendar_uiforms.freetimesearch',$content,$sel_options,NULL,array( |
| 2321 | 2466 | 'participants' => $content['participants'], |
@@ -2336,7 +2481,10 @@ discard block |
||
| 2336 | 2481 | */ |
| 2337 | 2482 | function freetime($participants,$start,$end,$duration=1,$cal_id=0) |
| 2338 | 2483 | { |
| 2339 | - if ($this->debug > 2) $this->bo->debug_message(__METHOD__.'(participants=%1, start=%2, end=%3, duration=%4, cal_id=%5)',true,$participants,$start,$end,$duration,$cal_id); |
|
| 2484 | + if ($this->debug > 2) |
|
| 2485 | + { |
|
| 2486 | + $this->bo->debug_message(__METHOD__.'(participants=%1, start=%2, end=%3, duration=%4, cal_id=%5)',true,$participants,$start,$end,$duration,$cal_id); |
|
| 2487 | + } |
|
| 2340 | 2488 | |
| 2341 | 2489 | $busy = $this->bo->search(array( |
| 2342 | 2490 | 'start' => $start, |
@@ -2353,15 +2501,26 @@ discard block |
||
| 2353 | 2501 | $n = 0; |
| 2354 | 2502 | foreach($busy as $event) |
| 2355 | 2503 | { |
| 2356 | - if ((int)$cal_id && $event['id'] == (int)$cal_id) continue; // ignore our own event |
|
| 2504 | + if ((int)$cal_id && $event['id'] == (int)$cal_id) |
|
| 2505 | + { |
|
| 2506 | + continue; |
|
| 2507 | + } |
|
| 2508 | + // ignore our own event |
|
| 2357 | 2509 | |
| 2358 | - if ($event['non_blocking']) continue; // ignore non_blocking events |
|
| 2510 | + if ($event['non_blocking']) |
|
| 2511 | + { |
|
| 2512 | + continue; |
|
| 2513 | + } |
|
| 2514 | + // ignore non_blocking events |
|
| 2359 | 2515 | |
| 2360 | 2516 | // check if from all wanted participants at least one has a not rejected status in found event |
| 2361 | 2517 | $non_rejected_found = false; |
| 2362 | 2518 | foreach($participants as $uid) |
| 2363 | 2519 | { |
| 2364 | - if ($event['participants'][$uid] == 'R') continue; |
|
| 2520 | + if ($event['participants'][$uid] == 'R') |
|
| 2521 | + { |
|
| 2522 | + continue; |
|
| 2523 | + } |
|
| 2365 | 2524 | |
| 2366 | 2525 | if (isset($event['participants'][$uid]) || |
| 2367 | 2526 | $uid > 0 && array_intersect(array_keys((array)$event['participants']), |
@@ -2371,7 +2530,10 @@ discard block |
||
| 2371 | 2530 | break; |
| 2372 | 2531 | } |
| 2373 | 2532 | } |
| 2374 | - if (!$non_rejected_found) continue; |
|
| 2533 | + if (!$non_rejected_found) |
|
| 2534 | + { |
|
| 2535 | + continue; |
|
| 2536 | + } |
|
| 2375 | 2537 | |
| 2376 | 2538 | if ($this->debug) |
| 2377 | 2539 | { |
@@ -2402,11 +2564,17 @@ discard block |
||
| 2402 | 2564 | 'start' => $ft_start, |
| 2403 | 2565 | 'end' => $ft_end, |
| 2404 | 2566 | ); |
| 2405 | - if ($this->debug > 1) echo "<p>freetime: ".date('D d.m.Y H:i',$ft_start)." - ".date('D d.m.Y H:i',$ft_end)."</p>\n"; |
|
| 2567 | + if ($this->debug > 1) |
|
| 2568 | + { |
|
| 2569 | + echo "<p>freetime: ".date('D d.m.Y H:i',$ft_start)." - ".date('D d.m.Y H:i',$ft_end)."</p>\n"; |
|
| 2570 | + } |
|
| 2406 | 2571 | } |
| 2407 | 2572 | $ft_start = $event['end']; |
| 2408 | 2573 | } |
| 2409 | - if ($this->debug > 0) $this->bo->debug_message('uiforms::freetime(participants=%1, start=%2, end=%3, duration=%4, cal_id=%5) freetime=%6',true,$participants,$start,$end,$duration,$cal_id,$freetime); |
|
| 2574 | + if ($this->debug > 0) |
|
| 2575 | + { |
|
| 2576 | + $this->bo->debug_message('uiforms::freetime(participants=%1, start=%2, end=%3, duration=%4, cal_id=%5) freetime=%6',true,$participants,$start,$end,$duration,$cal_id,$freetime); |
|
| 2577 | + } |
|
| 2410 | 2578 | |
| 2411 | 2579 | return $freetime; |
| 2412 | 2580 | } |
@@ -2426,10 +2594,16 @@ discard block |
||
| 2426 | 2594 | */ |
| 2427 | 2595 | function split_freetime_daywise($freetime, $duration, $weekdays, $_start_time, $_end_time, &$sel_options) |
| 2428 | 2596 | { |
| 2429 | - if ($this->debug > 1) $this->bo->debug_message('uiforms::split_freetime_daywise(freetime=%1, duration=%2, start_time=%3, end_time=%4)',true,$freetime,$duration,$_start_time,$_end_time); |
|
| 2597 | + if ($this->debug > 1) |
|
| 2598 | + { |
|
| 2599 | + $this->bo->debug_message('uiforms::split_freetime_daywise(freetime=%1, duration=%2, start_time=%3, end_time=%4)',true,$freetime,$duration,$_start_time,$_end_time); |
|
| 2600 | + } |
|
| 2430 | 2601 | |
| 2431 | 2602 | $freetime_daywise = array(); |
| 2432 | - if (!is_array($sel_options)) $sel_options = array(); |
|
| 2603 | + if (!is_array($sel_options)) |
|
| 2604 | + { |
|
| 2605 | + $sel_options = array(); |
|
| 2606 | + } |
|
| 2433 | 2607 | $time_format = $this->common_prefs['timeformat'] == 12 ? 'h:i a' : 'H:i'; |
| 2434 | 2608 | |
| 2435 | 2609 | $start_time = (int) $_start_time; // ignore leading zeros |
@@ -2439,7 +2613,10 @@ discard block |
||
| 2439 | 2613 | if (($end_time - $start_time)*HOUR_s < $duration) |
| 2440 | 2614 | { |
| 2441 | 2615 | $end_time = 0; |
| 2442 | - if ($this->debug > 1) $this->bo->debug_message('uiforms::split_freetime_daywise(, duration=%2, start_time=%3,..) end_time set to 0, it never fits durationn otherwise',true,$duration,$start_time); |
|
| 2616 | + if ($this->debug > 1) |
|
| 2617 | + { |
|
| 2618 | + $this->bo->debug_message('uiforms::split_freetime_daywise(, duration=%2, start_time=%3,..) end_time set to 0, it never fits durationn otherwise',true,$duration,$start_time); |
|
| 2619 | + } |
|
| 2443 | 2620 | } |
| 2444 | 2621 | $n = 0; |
| 2445 | 2622 | foreach($freetime as $ft) |
@@ -2460,13 +2637,19 @@ discard block |
||
| 2460 | 2637 | } |
| 2461 | 2638 | $start = $t < $ft['start'] ? $ft['start'] : $t; |
| 2462 | 2639 | |
| 2463 | - if ($start-$daybegin < $start_time*HOUR_s) // start earlier then start_time |
|
| 2640 | + if ($start-$daybegin < $start_time*HOUR_s) |
|
| 2641 | + { |
|
| 2642 | + // start earlier then start_time |
|
| 2464 | 2643 | { |
| 2465 | 2644 | $start = $daybegin + $start_time*HOUR_s; |
| 2466 | 2645 | } |
| 2646 | + } |
|
| 2467 | 2647 | // if end_time given use it, else the original slot's end |
| 2468 | 2648 | $end = $end_time ? $daybegin + $end_time*HOUR_s : $ft['end']; |
| 2469 | - if ($end > $ft['end']) $end = $ft['end']; |
|
| 2649 | + if ($end > $ft['end']) |
|
| 2650 | + { |
|
| 2651 | + $end = $ft['end']; |
|
| 2652 | + } |
|
| 2470 | 2653 | |
| 2471 | 2654 | // slot to small for duration |
| 2472 | 2655 | if ($end - $start < $duration) |
@@ -2508,7 +2691,10 @@ discard block |
||
| 2508 | 2691 | { |
| 2509 | 2692 | $msg = lang('Permission denied'); |
| 2510 | 2693 | |
| 2511 | - if ($return_error) return $msg; |
|
| 2694 | + if ($return_error) |
|
| 2695 | + { |
|
| 2696 | + return $msg; |
|
| 2697 | + } |
|
| 2512 | 2698 | } |
| 2513 | 2699 | else |
| 2514 | 2700 | { |
@@ -2570,27 +2756,42 @@ discard block |
||
| 2570 | 2756 | { |
| 2571 | 2757 | list($button) = each($_content['button']); |
| 2572 | 2758 | unset($_content['button']); |
| 2573 | - if ($button != 'cancel') // store changed Acl |
|
| 2759 | + if ($button != 'cancel') |
|
| 2760 | + { |
|
| 2761 | + // store changed Acl |
|
| 2574 | 2762 | { |
| 2575 | 2763 | foreach($_content as $data) |
| 2576 | 2764 | { |
| 2577 | 2765 | if (!($cat_id = $data['cat_id'])) continue; |
| 2766 | + } |
|
| 2578 | 2767 | foreach(array_merge((array)$data['add'],(array)$data['status'],array_keys((array)$data['old'])) as $account_id) |
| 2579 | 2768 | { |
| 2580 | 2769 | $rights = 0; |
| 2581 | - if (in_array($account_id,(array)$data['add'])) $rights |= calendar_boupdate::CAT_ACL_ADD; |
|
| 2582 | - if (in_array($account_id,(array)$data['status'])) $rights |= calendar_boupdate::CAT_ACL_STATUS; |
|
| 2583 | - if ($account_id) $this->bo->set_cat_rights($cat_id,$account_id,$rights); |
|
| 2770 | + if (in_array($account_id,(array)$data['add'])) |
|
| 2771 | + { |
|
| 2772 | + $rights |= calendar_boupdate::CAT_ACL_ADD; |
|
| 2773 | + } |
|
| 2774 | + if (in_array($account_id,(array)$data['status'])) |
|
| 2775 | + { |
|
| 2776 | + $rights |= calendar_boupdate::CAT_ACL_STATUS; |
|
| 2777 | + } |
|
| 2778 | + if ($account_id) |
|
| 2779 | + { |
|
| 2780 | + $this->bo->set_cat_rights($cat_id,$account_id,$rights); |
|
| 2781 | + } |
|
| 2584 | 2782 | } |
| 2585 | 2783 | } |
| 2586 | 2784 | } |
| 2587 | - if ($button != 'apply') // end dialog |
|
| 2785 | + if ($button != 'apply') |
|
| 2786 | + { |
|
| 2787 | + // end dialog |
|
| 2588 | 2788 | { |
| 2589 | 2789 | Egw::redirect_link('/index.php', array( |
| 2590 | 2790 | 'menuaction' => 'admin.admin_ui.index', |
| 2591 | 2791 | 'ajax' => 'true' |
| 2592 | 2792 | ), 'admin'); |
| 2593 | 2793 | } |
| 2794 | + } |
|
| 2594 | 2795 | } |
| 2595 | 2796 | $content= $preserv = array(); |
| 2596 | 2797 | $n = 1; |
@@ -2604,8 +2805,14 @@ discard block |
||
| 2604 | 2805 | ); |
| 2605 | 2806 | foreach($data as $account_id => $rights) |
| 2606 | 2807 | { |
| 2607 | - if ($rights & calendar_boupdate::CAT_ACL_ADD) $row['add'][] = $account_id; |
|
| 2608 | - if ($rights & calendar_boupdate::CAT_ACL_STATUS) $row['status'][] = $account_id; |
|
| 2808 | + if ($rights & calendar_boupdate::CAT_ACL_ADD) |
|
| 2809 | + { |
|
| 2810 | + $row['add'][] = $account_id; |
|
| 2811 | + } |
|
| 2812 | + if ($rights & calendar_boupdate::CAT_ACL_STATUS) |
|
| 2813 | + { |
|
| 2814 | + $row['status'][] = $account_id; |
|
| 2815 | + } |
|
| 2609 | 2816 | } |
| 2610 | 2817 | $content[$n] = $row; |
| 2611 | 2818 | $preserv[$n] = array( |
@@ -2733,7 +2940,10 @@ discard block |
||
| 2733 | 2940 | break; |
| 2734 | 2941 | } |
| 2735 | 2942 | } |
| 2736 | - if($return) return; |
|
| 2943 | + if($return) |
|
| 2944 | + { |
|
| 2945 | + return; |
|
| 2946 | + } |
|
| 2737 | 2947 | } |
| 2738 | 2948 | $old_event=$event=$this->bo->read($eventId); |
| 2739 | 2949 | if (!$durationT) |
@@ -2827,7 +3037,10 @@ discard block |
||
| 2827 | 3037 | $this->bo->update($event,true, true, false, true, $message,true); |
| 2828 | 3038 | |
| 2829 | 3039 | // Whole day non blocking with DAY_s would add a day |
| 2830 | - if($duration==DAY_s) $duration=0; |
|
| 3040 | + if($duration==DAY_s) |
|
| 3041 | + { |
|
| 3042 | + $duration=0; |
|
| 3043 | + } |
|
| 2831 | 3044 | } |
| 2832 | 3045 | |
| 2833 | 3046 | $status_reset_to_unknown = false; |
@@ -2845,7 +3058,10 @@ discard block |
||
| 2845 | 3058 | case 'no': |
| 2846 | 3059 | break; |
| 2847 | 3060 | case 'startday': |
| 2848 | - if ($sameday) break; |
|
| 3061 | + if ($sameday) |
|
| 3062 | + { |
|
| 3063 | + break; |
|
| 3064 | + } |
|
| 2849 | 3065 | default: |
| 2850 | 3066 | $status_reset_to_unknown = true; |
| 2851 | 3067 | $event['participants'][$uid] = calendar_so::combine_status('U',$q,$r); |
@@ -2889,7 +3105,10 @@ discard block |
||
| 2889 | 3105 | { |
| 2890 | 3106 | $response->call('egw.message', implode('<br />', $message)); |
| 2891 | 3107 | } |
| 2892 | - if($event['id'] != $eventId ) $this->update_client($_eventId); |
|
| 3108 | + if($event['id'] != $eventId ) |
|
| 3109 | + { |
|
| 3110 | + $this->update_client($_eventId); |
|
| 3111 | + } |
|
| 2893 | 3112 | if ($status_reset_to_unknown) |
| 2894 | 3113 | { |
| 2895 | 3114 | foreach((array)$event['participants'] as $uid => $status) |