-
Notifications
You must be signed in to change notification settings - Fork 11
/
attend.php
84 lines (74 loc) · 2.61 KB
/
attend.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
/**
* Copyright 2005-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 Jan Schneider <[email protected]>
* @package Kronolith
*/
require_once __DIR__ . '/lib/Application.php';
Horde_Registry::appInit('kronolith', array('authentication' => 'none'));
$cal = Horde_Util::getFormData('c');
$id = Horde_Util::getFormData('e');
$uid = Horde_Util::getFormData('i');
$user = Horde_Util::getFormData('u');
switch (Horde_Util::getFormData('a')) {
case 'accept':
$action = Kronolith::RESPONSE_ACCEPTED;
$msg = _("You have successfully accepted attendence to this event.");
break;
case 'decline':
$action = Kronolith::RESPONSE_DECLINED;
$msg = _("You have successfully declined attendence to this event.");
break;
case 'tentative':
$action = Kronolith::RESPONSE_TENTATIVE;
$msg = _("You have tentatively accepted attendence to this event.");
break;
default:
$action = Kronolith::RESPONSE_NONE;
$msg = '';
break;
}
if (((empty($cal) || empty($id)) && empty($uid)) || empty($user)) {
$notification->push(_("The request was incomplete. Some parameters that are necessary to accept or decline an event are missing."), 'horde.error', array('sticky'));
$title = '';
} else {
try {
if (empty($uid)) {
$event = Kronolith::getDriver(null, $cal)->getEvent($id);
} else {
$event = Kronolith::getDriver()->getByUID($uid);
}
if (!$event->hasAttendee($user)) {
$notification->push(_("You are not an attendee of the specified event."), 'horde.error', array('sticky'));
$title = $event->getTitle();
} else {
$event->addAttendee($user, Kronolith::PART_IGNORE, $action);
try {
$event->save();
if (!empty($msg)) {
$notification->push($msg, 'horde.success', array('sticky'));
}
} catch (Exception $e) {
$notification->push($e, 'horde.error', array('sticky'));
}
$title = $event->getTitle();
}
} catch (Exception $e) {
$notification->push($e, 'horde.error', array('sticky'));
$title = '';
}
}
$page_output->topbar = $page_output->sidebar = false;
$page_output->header(array(
'title' => $title
));
require KRONOLITH_TEMPLATES . '/javascript_defs.php';
?>
<div id="menu"><h1> <?php echo htmlspecialchars($title) ?></h1></div>
<?php
$notification->notify(array('listeners' => 'status'));
$page_output->footer();