예제 #1
0
 //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);
         if ($calendar) {
             $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']) {
             header('Location: ' . $GO_CONFIG->host . 'error_docs/401.php');
             exit;
예제 #2
0
         if ($cal->import_ical_file($GO_SECURITY->user_id, $_FILES['ical_file']['tmp_name'], $calendar_id)) {
             $feedback = '<p class="Success">' . $cal_import_success . '</p>';
         } else {
             $feedback = '<p class="Error">' . $strDataError . '</p>';
         }
         unlink($_FILES['ical_file']['tmp_name']);
     }
     break;
 case 'save':
     $name = smart_addslashes(trim($_POST['name']));
     if ($name != "") {
         if ($_POST['calendar_start_hour'] > $_POST['calendar_end_hour']) {
             $feedback = '<p class="Error">' . $error_invalid_hour_range . '</p>';
         } else {
             if ($calendar_id > 0) {
                 $existing_calendar = $cal->get_calendar_by_name($name);
                 if ($existing_calendar && $existing_calendar['id'] != $calendar_id) {
                     $feedback = "<p class=\"Error\">" . $sc_calendar_exists . "</p>";
                 } else {
                     $cal->update_calendar($calendar_id, $name, $_POST['calendar_start_hour'], $_POST['calendar_end_hour']);
                     if ($_POST['close'] == 'true') {
                         header('Location: ' . $return_to);
                         exit;
                     }
                 }
             } else {
                 if ($cal->get_calendar_by_name($name)) {
                     $feedback = "<p class=\"Error\">" . $sc_calendar_exists . "</p>";
                 } else {
                     if ($calendar_id = $cal->add_calendar($GO_SECURITY->user_id, $name, $_POST['calendar_start_hour'], $_POST['calendar_end_hour'])) {
                         $db = new db();