if (isset($feedback)) { echo '<p class="Error">' . $feedback . '</p>'; } if (!$GO_SECURITY->has_permission($GO_SECURITY->user_id, $event["acl_read"]) && !$GO_SECURITY->has_permission($GO_SECURITY->user_id, $event["acl_write"])) { $GO_SECURITY->add_user_to_acl($GO_SECURITY->user_id, $event["acl_read"]); } $calendar_count = $cal->get_user_calendars($GO_SECURITY->user_id); $calendar_id = isset($_REQUEST['calendar_id']) ? $_REQUEST['calendar_id'] : 0; if ($calendar_count > 1) { echo $sc_select_calendar . ': '; echo '<form name="accept" method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="email" value="' . $_REQUEST['email'] . '" />'; echo '<input type="hidden" name="event_id" value="' . $_REQUEST['event_id'] . '" />'; echo '<input type="hidden" name="member" value="' . $_REQUEST['member'] . '" />'; echo '<table border="0">'; while ($cal->next_record()) { if ($GO_SECURITY->has_permission($GO_SECURITY->user_id, $cal->f('acl_write'))) { $calendars_check = isset($_POST['calendars']) && in_array($cal->f('id'), $_POST['calendars']) ? 'checked' : ''; echo '<tr><td><input type="checkbox" name="calendars[]" value="' . $cal->f('id') . '" ' . $calendars_check . ' /></td><td>' . $cal->f('name') . '</td></tr>'; } } echo '</table>'; $button = new button($cmdOk, "javascript:document.forms[0].submit();"); echo '</form>'; } else { if ($calendar_count == 1) { $cal->next_record(); $calendar_id = $cal->f('id'); if ($calendar_id > 0) { if (!$cal->event_is_subscribed($_REQUEST['event_id'], $calendar_id)) { if ($cal->subscribe_event($_REQUEST['event_id'], $calendar_id)) {
$title = $view['name']; $calendar_id = 0; $cal_start_hour = $view['start_hour']; $cal_end_hour = $view['end_hour']; } } if (!isset($view) || !$view) { //get the calendar properties and check permissions if ($calendar_id != 0 && ($calendar = $cal->get_calendar($calendar_id))) { $calendar['read_permission'] = $GO_SECURITY->has_permission($GO_SECURITY->user_id, $calendar['acl_read']); $calendar['write_permission'] = $GO_SECURITY->has_permission($GO_SECURITY->user_id, $calendar['acl_write']); if (!$calendar['read_permission'] && !$calendar['write_permission']) { //hmm no calendar_id given and default calendar is set //Does this user even have calendars? $cal->get_user_calendars($GO_SECURITY->user_id); if ($cal->next_record()) { //yes he does so set it default $calendar_id = $cal->f('id'); } else { $calendar_name = $_SESSION['GO_SESSION']['name']; $new_calendar_name = $calendar_name; $x = 1; while ($cal->get_calendar_by_name($new_calendar_name)) { $new_calendar_name = $calendar_name . ' (' . $x . ')'; $x++; } if (!($calendar_id = $cal->add_calendar($GO_SECURITY->user_id, addslashes($new_calendar_name), 7, 20))) { $feedback = '<p class="Error">' . $strSaveError . '</p>'; } } $calendar = $cal->get_calendar($calendar_id);