forked from horde/kronolith
-
Notifications
You must be signed in to change notification settings - Fork 0
/
event.php
60 lines (53 loc) · 1.97 KB
/
event.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
/**
* Copyright 1999-2017 Horde LLC (http://www.horde.org/)
*
* See the enclosed file LICENSE for license information (GPL). If you
* did not receive this file, see http://www.horde.org/licenses/gpl.
*
* @author Chuck Hagenbuch <chuck@horde.org>
* @package Kronolith
*/
require_once __DIR__ . '/lib/Application.php';
Horde_Registry::appInit('kronolith');
$viewName = Horde_Util::getFormData('view', 'Event');
$view = Kronolith::getView($viewName);
if (is_string($view->event)) {
$notification->push($view->event, 'horde.error');
Horde::url($prefs->getValue('defaultview') . '.php', true)->redirect();
}
if (Kronolith::showAjaxView()) {
Horde::url('', true)->setAnchor('event:' . $view->event->calendarType . '|' . $view->event->calendar . ':' . $view->event->id . ':' . Horde_Util::getFormData('datetime', Kronolith::currentDate()->dateString()))->redirect();
}
switch ($viewName) {
case 'DeleteEvent':
/* Shortcut when we're deleting events and don't want confirmation. */
if (!$view->event->recurs() &&
!($prefs->getValue('confirm_delete') ||
Horde_Util::getFormData('confirm'))) {
Horde::url('delete.php?' . $_SERVER['QUERY_STRING'], true)->redirect();
}
break;
case 'EditEvent':
if ($view->event->private &&
$view->event->creator != $GLOBALS['registry']->getAuth()) {
if ($url = Horde::verifySignedUrl(Horde_Util::getFormData('url'))) {
$url = new Horde_Url($url, true);
} else {
$url = Horde::url($prefs->getValue('defaultview') . '.php', true);
}
$url->unique()->redirect();
}
break;
}
$page_output->header(array(
'body_class' => $prefs->getValue('show_panel') ? 'rightPanel' : null,
'title' => $view->getTitle()
));
require KRONOLITH_TEMPLATES . '/javascript_defs.php';
$notification->notify(array('listeners' => 'status'));
echo '<div id="page">';
Kronolith::eventTabs($viewName, $view->event);
$view->html();
echo '</div>';
$page_output->footer();