]>
Commit | Line | Data |
---|---|---|
a5eae6b7 MR |
1 | <?php |
2 | require_once 'calendar.class.php'; | |
3 | require_once 'user_validate.php'; | |
4 | ||
5 | valid_user(); | |
6 | ||
7 | include_once 'config.inc.php'; | |
8 | require_once 'helper.php'; | |
9 | ||
10 | if (! defined($_SESSION['__ROOT__']) && empty($_SESSION['__ROOT__'])) { | |
11 | session_destroy(); | |
12 | header('Location: ' . WEB_ROOT . 'error.html'); | |
13 | exit; | |
14 | } | |
15 | $path = dirname($_SERVER['PHP_SELF']); | |
16 | $url = "$path/edit_event.php"; | |
17 | $_SESSION['EVENT_ACTION'] = 'NEW'; | |
18 | $calendars = $_SESSION['user_settings']->getCalendars(); | |
19 | $query = construct_URL($_SERVER['QUERY_STRING'], | |
20 | array('etag', 'referer', 'cal')); | |
21 | ||
22 | if (count($calendars) < 1) { | |
23 | header('Location: ' . WEB_ROOT . "utils/configure.php"); | |
24 | exit; | |
25 | } | |
26 | else if (count($calendars) == 1) { | |
27 | $options = "?referer=".$query['referer']; | |
28 | $options .= "&cal=" . current($calendars)->name; | |
29 | header('Location: ' . $url . $options); | |
30 | //print "$url$options<br/>"; | |
31 | exit; | |
32 | } | |
33 | else { | |
34 | $cal = current($calendars)->name; | |
35 | $text = '<p>'; | |
36 | $text .= '<form style="text-align: center" action="'.$url.'" method="get">'; | |
37 | $text .= '<input type="hidden" name="referer" value="'.$query['referer'].'" />'; | |
38 | $text .= 'Choose Calender: '; | |
39 | $text .= '<select name="cal">'; | |
40 | foreach ($calendars as $calendar) { | |
41 | $text .= '<option value="'.$calendar->name.'">'.$calendar->name.'</option>'; | |
42 | } | |
43 | $text .= '</select><br/><br/>'; | |
44 | $text .= '<input type="submit" value="Continue" />'; | |
45 | $text .= '</form></p>'; | |
46 | print popup_window($text, $query['referer']."?cal=$cal"); | |
47 | exit; | |
48 | } | |
49 | ?> |