validUser()) {
$view_style = ($_SESSION['user_settings']->getViewStyle()) ?
$_SESSION['user_settings']->getViewStyle() : VIEW_STYLE;
// $timeout = ($_SESSION['user_settings']->getTimeout()) ?
// (int) $_SESSION['user_settings']->getTimeout() : TIMEOUT;
$week_start_sunday = ($_SESSION['user_settings']->getStartWeek() !== NULL) ?
$_SESSION['user_settings']->getStartWeek() : WEEK_START_SUNDAY;
$start_hour = ($_SESSION['user_settings']->getStartHour()) ?
(int) $_SESSION['user_settings']->getStartHour() : START_HOUR;
$end_hour = ($_SESSION['user_settings']->getEndHour()) ?
(int) $_SESSION['user_settings']->getEndHour() : END_HOUR;
}
$pwd = WEB_ROOT;
if ($pwd[strlen($pwd)-1] == '/')
$pwd = substr($pwd, 0, -1);
if (isset($_POST) && count($_POST) > 0) {
$exclude = array('tzid','range','times','untildate');
$start = array('date' => NULL, 'time' => NULL);
$end = array('date' => NULL, 'time' => NULL);
$referer = $_POST['referer'];
$allDay = false;
foreach ($_POST as $key => $value) {
//echo "$key => $value
";
if (strcmp($key, 'referer') == 0)
continue;
if (in_array($key, $exclude))
continue;
if (strcasecmp($key, 'startdate') == 0) {
$start['date'] = join('', explode('-',$value));
continue;
}
if (strcasecmp($key, 'starttime') == 0) {
$start['time'] = $value;
if (strlen($start['time']) < 5)
$start['time'] .= '00';
continue;
}
if (strcasecmp($key, 'enddate') == 0) {
$end['date'] = join('', explode('-',$value));
continue;
}
if (strcasecmp($key, 'endtime') == 0) {
$end['time'] = $value;
if (strlen($end['time']) < 5)
$end['time'] .= '00';
continue;
}
if (strcasecmp("allDay", $key) == 0) {
$allDay = true;
continue;
}
if (strcasecmp("recurrence", $key) == 0) {
$value = "FREQ=$value";
$key = "RRULE";
}
//echo "$key => $value
";
$_SESSION['current_event']->setProperty($key, $value);
}
//echo 'DTSTART: '. $start['date'].'T'.$start['time'];
//echo '
DTEND: '. $end['date'].'T'.$end['time'];
//exit;
if ($allDay) {
$_SESSION['current_event']->setProperty(
'DTSTART;VALUE=DATE', $start['date']);
$_SESSION['current_event']->setProperty(
'DTEND;VALUE=DATE', $end['date']);
//echo "
".$start['date']."
";
//echo $end['date']."
";
}
else {
$start = strtotime($start['date'].'T'.$start['time']);
$end = strtotime($end['date'].'T'.$end['time']);
//echo "
".Calendar::timestamp2ICal($start, FALSE)."
";
//echo Calendar::timestamp2ICal($end, FALSE)."
";
//exit;
$_SESSION['current_event']->setProperty('DTSTART',
Calendar::timestamp2ICal($start, FALSE));
$_SESSION['current_event']->setProperty('DTEND',
Calendar::timestamp2ICal($end, FALSE));
}
//exit;
if (isset($_SESSION['calendar'])) {
$res = $_SESSION['calendar']->update(
$_SESSION['current_event']->getUrl(),
$_SESSION['current_event']->getEtag());
//print_r($res);
//exit;
unset($_SESSION['current_event']);
unset($_SESSION['calendar']);
unset($_SESSION['EVENT_ACTION']);
if (count($res) == 0) {
header('Location: ' . $referer);
exit;
}
$msg = '';
foreach ($res as $elem) {
$k = key($elem);
$msg .= "$k: " . $elem[$k];
}
}
else
throw new Exception("Error updating event");
//print "$msg\n";
$msg = join("", explode("\n", $msg));
$title = TITLE;
$pwd = WEB_ROOT;
$head = <<<__HEAD
Logout |
DAViCal Web Calendar - A Web Interface for DAViCal |
'; $text .= '
'; //print "{$_GET['referer']}"; //exit; print popup_window($text, $query['referer']); exit; } } include TOP_FOLDER.'/include/header.inc.php'; include TOP_FOLDER.'/include/menu.inc.php'; print "