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
|
<?php
/**
* $Horde: kronolith/attend.php,v 1.2.2.7 2008/05/24 17:47:51 jan Exp $
*
* Copyright 2005-2008 The Horde Project (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (GPL). If you
* did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
*
* @author Jan Schneider <jan@horde.org>
*/
@define('AUTH_HANDLER', true);
@define('KRONOLITH_BASE', dirname(__FILE__));
require_once KRONOLITH_BASE . '/lib/base.php';
$cal = Util::getFormData('c');
$id = Util::getFormData('e');
$uid = Util::getFormData('i');
$user = Util::getFormData('u');
switch (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');
$title = '';
} else {
if (empty($uid)) {
$kronolith_driver->open($cal);
$event = $kronolith_driver->getEvent($id);
} else {
$event = $kronolith_driver->getByUID($uid);
}
if (is_a($event, 'PEAR_Error')) {
$notification->push($event, 'horde.error');
$title = '';
} elseif (!$event->hasAttendee($user)) {
$notification->push(_("You are not an attendee of the specified event."), 'horde.error');
$title = $event->getTitle();
} else {
$event->addAttendee($user, KRONOLITH_PART_IGNORE, $action);
$result = $event->save();
if (is_a($result, 'PEAR_Error')) {
$notification->push($result, 'horde.error');
} elseif (!empty($msg)) {
$notification->push($msg, 'horde.success');
}
$title = $event->getTitle();
}
}
require KRONOLITH_TEMPLATES . '/common-header.inc';
?>
<div id="menu"><h1> <?php echo htmlspecialchars($title) ?></h1></div>
<?php
$notification->notify(array('listeners' => 'status'));
require $registry->get('templates', 'horde') . '/common-footer.inc';
|