From b71a58d1690c0c2d6493e74a0619bdf6520f962f Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Wed, 25 Feb 2009 23:45:05 +0100 Subject: [PATCH] Class constants, update Kronolith::. --- kronolith/add.php | 2 +- kronolith/attend.php | 10 +- kronolith/attendees.php | 14 +- kronolith/delete.php | 4 +- kronolith/edit.php | 2 +- kronolith/lib/Driver.php | 56 +++---- kronolith/lib/Driver/holidays.php | 2 +- kronolith/lib/Driver/ical.php | 4 +- kronolith/lib/Driver/kolab.php | 86 +++++----- kronolith/lib/FreeBusy.php | 6 +- kronolith/lib/Kronolith.php | 234 ++++++++++++++-------------- kronolith/lib/Storage/kolab.php | 4 +- kronolith/lib/Storage/sql.php | 2 +- kronolith/lib/Views/Year.php | 2 +- kronolith/lib/api.php | 2 +- kronolith/lib/tests/toicalendar.phpt | 18 +-- kronolith/search.php | 2 +- kronolith/templates/attendees/attendees.inc | 14 +- 18 files changed, 233 insertions(+), 231 deletions(-) diff --git a/kronolith/add.php b/kronolith/add.php index 50e250074..0a84ba5b5 100644 --- a/kronolith/add.php +++ b/kronolith/add.php @@ -46,7 +46,7 @@ if (!Util::getFormData('cancel')) { if (is_a($event, 'PEAR_Error')) { $notification->push($event, 'horde.error'); } else { - Kronolith::sendITipNotifications($event, $notification, KRONOLITH_ITIP_REQUEST); + Kronolith::sendITipNotifications($event, $notification, Kronolith::ITIP_REQUEST); } } } diff --git a/kronolith/attend.php b/kronolith/attend.php index 53e049923..d8b272ec9 100644 --- a/kronolith/attend.php +++ b/kronolith/attend.php @@ -20,22 +20,22 @@ $user = Util::getFormData('u'); switch (Util::getFormData('a')) { case 'accept': - $action = KRONOLITH_RESPONSE_ACCEPTED; + $action = Kronolith::RESPONSE_ACCEPTED; $msg = _("You have successfully accepted attendence to this event."); break; case 'decline': - $action = KRONOLITH_RESPONSE_DECLINED; + $action = Kronolith::RESPONSE_DECLINED; $msg = _("You have successfully declined attendence to this event."); break; case 'tentative': - $action = KRONOLITH_RESPONSE_TENTATIVE; + $action = Kronolith::RESPONSE_TENTATIVE; $msg = _("You have tentatively accepted attendence to this event."); break; default: - $action = KRONOLITH_RESPONSE_NONE; + $action = Kronolith::RESPONSE_NONE; $msg = ''; break; } @@ -57,7 +57,7 @@ if (((empty($cal) || empty($id)) && empty($uid)) || empty($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); + $event->addAttendee($user, Kronolith::PART_IGNORE, $action); $result = $event->save(); if (is_a($result, 'PEAR_Error')) { $notification->push($result, 'horde.error'); diff --git a/kronolith/attendees.php b/kronolith/attendees.php index e0429ff0b..36f59a7b5 100644 --- a/kronolith/attendees.php +++ b/kronolith/attendees.php @@ -66,8 +66,8 @@ case 'add': // If there is only a mailbox part, then it is just a local name. if (empty($newAttendeeParsedPart->host)) { $attendees[] = array( - 'attendance' => KRONOLITH_PART_REQUIRED, - 'response' => KRONOLITH_RESPONSE_NONE, + 'attendance' => Kronolith::PART_REQUIRED, + 'response' => Kronolith::RESPONSE_NONE, 'name' => $newAttendee, ); continue; @@ -88,8 +88,8 @@ case 'add': // values. if (!isset($attendees[$email])) $attendees[$email] = array( - 'attendance' => KRONOLITH_PART_REQUIRED, - 'response' => KRONOLITH_RESPONSE_NONE, + 'attendance' => Kronolith::PART_REQUIRED, + 'response' => Kronolith::RESPONSE_NONE, 'name' => $name, ); } catch (Horde_Mime_Exception $e) { @@ -223,8 +223,8 @@ if (!is_a($vfb, 'PEAR_Error')) { // Add the Free/Busy information for each attendee. foreach ($attendees as $email => $status) { if (strpos($email, '@') !== false && - ($status['attendance'] == KRONOLITH_PART_REQUIRED || - $status['attendance'] == KRONOLITH_PART_OPTIONAL)) { + ($status['attendance'] == Kronolith::PART_REQUIRED || + $status['attendance'] == Kronolith::PART_OPTIONAL)) { $vfb = Kronolith_Freebusy::get($email); if (!is_a($vfb, 'PEAR_Error')) { $organizer = $vfb->getAttribute('ORGANIZER'); @@ -232,7 +232,7 @@ foreach ($attendees as $email => $status) { $vfb->setAttribute('ORGANIZER', 'mailto:' . $email, array(), false); } - if ($status['attendance'] == KRONOLITH_PART_REQUIRED) { + if ($status['attendance'] == Kronolith::PART_REQUIRED) { $attendee_view->addRequiredMember($vfb); } else { $attendee_view->addOptionalMember($vfb); diff --git a/kronolith/delete.php b/kronolith/delete.php index 90d0acc5b..90dec9969 100644 --- a/kronolith/delete.php +++ b/kronolith/delete.php @@ -26,7 +26,7 @@ if ($eventID = Util::getFormData('eventID')) { if (!$share->hasPermission(Auth::getAuth(), PERMS_DELETE, $event->getCreatorID())) { $notification->push(_("You do not have permission to delete this event."), 'horde.warning'); } else { - $notification_type = KRONOLITH_ITIP_CANCEL; + $notification_type = Kronolith::ITIP_CANCEL; $instance = null; if (Util::getFormData('future')) { $recurEnd = new Horde_Date(array('hour' => 0, 'min' => 0, 'sec' => 0, @@ -42,7 +42,7 @@ if ($eventID = Util::getFormData('eventID')) { $event->recurrence->setRecurEnd($recurEnd); $event->save(); } - $notification_type = KRONOLITH_ITIP_REQUEST; + $notification_type = Kronolith::ITIP_REQUEST; } elseif (Util::getFormData('current')) { $event->recurrence->addException(Util::getFormData('year'), Util::getFormData('month'), diff --git a/kronolith/edit.php b/kronolith/edit.php index 441ef4f63..ebf157689 100644 --- a/kronolith/edit.php +++ b/kronolith/edit.php @@ -17,7 +17,7 @@ function _save(&$event) if (is_a($res, 'PEAR_Error')) { $GLOBALS['notification']->push(sprintf(_("There was an error editing the event: %s"), $res->getMessage()), 'horde.error'); } elseif (Util::getFormData('sendupdates', false)) { - Kronolith::sendITipNotifications($event, $GLOBALS['notification'], KRONOLITH_ITIP_REQUEST); + Kronolith::sendITipNotifications($event, $GLOBALS['notification'], Kronolith::ITIP_REQUEST); } } diff --git a/kronolith/lib/Driver.php b/kronolith/lib/Driver.php index 093e9d06f..c9988a2c5 100644 --- a/kronolith/lib/Driver.php +++ b/kronolith/lib/Driver.php @@ -334,7 +334,7 @@ class Kronolith_Event { * * @var integer */ - var $status = KRONOLITH_STATUS_CONFIRMED; + var $status = Kronolith::STATUS_CONFIRMED; /** * The description for this event @@ -666,21 +666,21 @@ class Kronolith_Event { // Status. switch ($this->getStatus()) { - case KRONOLITH_STATUS_FREE: + case Kronolith::STATUS_FREE: // This is not an official iCalendar value, but we need it for // synchronization. $vEvent->setAttribute('STATUS', 'FREE'); $vEvent->setAttribute('TRANSP', $v1 ? 1 : 'TRANSPARENT'); break; - case KRONOLITH_STATUS_TENTATIVE: + case Kronolith::STATUS_TENTATIVE: $vEvent->setAttribute('STATUS', 'TENTATIVE'); $vEvent->setAttribute('TRANSP', $v1 ? 0 : 'OPAQUE'); break; - case KRONOLITH_STATUS_CONFIRMED: + case Kronolith::STATUS_CONFIRMED: $vEvent->setAttribute('STATUS', 'CONFIRMED'); $vEvent->setAttribute('TRANSP', $v1 ? 0 : 'OPAQUE'); break; - case KRONOLITH_STATUS_CANCELLED: + case Kronolith::STATUS_CANCELLED: if ($v1) { $vEvent->setAttribute('STATUS', 'DECLINED'); $vEvent->setAttribute('TRANSP', 1); @@ -695,7 +695,7 @@ class Kronolith_Event { foreach ($this->getAttendees() as $email => $status) { $params = array(); switch ($status['attendance']) { - case KRONOLITH_PART_REQUIRED: + case Kronolith::PART_REQUIRED: if ($v1) { $params['EXPECT'] = 'REQUIRE'; } else { @@ -703,7 +703,7 @@ class Kronolith_Event { } break; - case KRONOLITH_PART_OPTIONAL: + case Kronolith::PART_OPTIONAL: if ($v1) { $params['EXPECT'] = 'REQUEST'; } else { @@ -711,7 +711,7 @@ class Kronolith_Event { } break; - case KRONOLITH_PART_NONE: + case Kronolith::PART_NONE: if ($v1) { $params['EXPECT'] = 'FYI'; } else { @@ -721,7 +721,7 @@ class Kronolith_Event { } switch ($status['response']) { - case KRONOLITH_RESPONSE_NONE: + case Kronolith::RESPONSE_NONE: if ($v1) { $params['STATUS'] = 'NEEDS ACTION'; $params['RSVP'] = 'YES'; @@ -731,7 +731,7 @@ class Kronolith_Event { } break; - case KRONOLITH_RESPONSE_ACCEPTED: + case Kronolith::RESPONSE_ACCEPTED: if ($v1) { $params['STATUS'] = 'ACCEPTED'; } else { @@ -739,7 +739,7 @@ class Kronolith_Event { } break; - case KRONOLITH_RESPONSE_DECLINED: + case Kronolith::RESPONSE_DECLINED: if ($v1) { $params['STATUS'] = 'DECLINED'; } else { @@ -747,7 +747,7 @@ class Kronolith_Event { } break; - case KRONOLITH_RESPONSE_TENTATIVE: + case Kronolith::RESPONSE_TENTATIVE: if ($v1) { $params['STATUS'] = 'TENTATIVE'; } else { @@ -896,8 +896,8 @@ class Kronolith_Event { if ($status == 'DECLINED') { $status = 'CANCELLED'; } - if (defined('KRONOLITH_STATUS_' . $status)) { - $this->setStatus(constant('KRONOLITH_STATUS_' . $status)); + if (defined('Kronolith::STATUS_' . $status)) { + $this->setStatus(constant('Kronolith::STATUS_' . $status)); } } @@ -985,16 +985,16 @@ class Kronolith_Event { $attendee[$i]); $email = Horde_Mime_Address::bareAddress($attendee[$i]); // Default according to rfc2445: - $attendance = KRONOLITH_PART_REQUIRED; + $attendance = Kronolith::PART_REQUIRED; // vCalendar 2.0 style: if (!empty($params[$i]['ROLE'])) { switch($params[$i]['ROLE']) { case 'OPT-PARTICIPANT': - $attendance = KRONOLITH_PART_OPTIONAL; + $attendance = Kronolith::PART_OPTIONAL; break; case 'NON-PARTICIPANT': - $attendance = KRONOLITH_PART_NONE; + $attendance = Kronolith::PART_NONE; break; } } @@ -1002,15 +1002,15 @@ class Kronolith_Event { if (!empty($params[$i]['EXPECT'])) { switch($params[$i]['EXPECT']) { case 'REQUEST': - $attendance = KRONOLITH_PART_OPTIONAL; + $attendance = Kronolith::PART_OPTIONAL; break; case 'FYI': - $attendance = KRONOLITH_PART_NONE; + $attendance = Kronolith::PART_NONE; break; } } - $response = KRONOLITH_RESPONSE_NONE; + $response = Kronolith::RESPONSE_NONE; if (empty($params[$i]['PARTSTAT']) && !empty($params[$i]['STATUS'])) { $params[$i]['PARTSTAT'] = $params[$i]['STATUS']; @@ -1019,15 +1019,15 @@ class Kronolith_Event { if (!empty($params[$i]['PARTSTAT'])) { switch($params[$i]['PARTSTAT']) { case 'ACCEPTED': - $response = KRONOLITH_RESPONSE_ACCEPTED; + $response = Kronolith::RESPONSE_ACCEPTED; break; case 'DECLINED': - $response = KRONOLITH_RESPONSE_DECLINED; + $response = Kronolith::RESPONSE_DECLINED; break; case 'TENTATIVE': - $response = KRONOLITH_RESPONSE_TENTATIVE; + $response = Kronolith::RESPONSE_TENTATIVE; break; } } @@ -1693,11 +1693,11 @@ class Kronolith_Event { function addAttendee($email, $attendance, $response, $name = null) { $email = String::lower($email); - if ($attendance == KRONOLITH_PART_IGNORE) { + if ($attendance == Kronolith::PART_IGNORE) { if (isset($this->attendees[$email])) { $attendance = $this->attendees[$email]['attendance']; } else { - $attendance = KRONOLITH_PART_REQUIRED; + $attendance = Kronolith::PART_REQUIRED; } } if (empty($name) && isset($this->attendees[$email]) && @@ -2448,11 +2448,11 @@ class Kronolith_Event { function getStatusClass() { switch ($this->status) { - case KRONOLITH_STATUS_CANCELLED: + case Kronolith::STATUS_CANCELLED: return 'event-cancelled'; - case KRONOLITH_STATUS_TENTATIVE: - case KRONOLITH_STATUS_FREE: + case Kronolith::STATUS_TENTATIVE: + case Kronolith::STATUS_FREE: return 'event-tentative'; } diff --git a/kronolith/lib/Driver/holidays.php b/kronolith/lib/Driver/holidays.php index 1cfc970db..de41e7b5c 100644 --- a/kronolith/lib/Driver/holidays.php +++ b/kronolith/lib/Driver/holidays.php @@ -186,7 +186,7 @@ class Kronolith_Event_holidays extends Kronolith_Event { * * @var integer */ - var $status = KRONOLITH_STATUS_FREE; + var $status = Kronolith::STATUS_FREE; /** * Whether this is an all-day event. diff --git a/kronolith/lib/Driver/ical.php b/kronolith/lib/Driver/ical.php index 1ee993121..55327bf7d 100644 --- a/kronolith/lib/Driver/ical.php +++ b/kronolith/lib/Driver/ical.php @@ -62,7 +62,7 @@ class Kronolith_Driver_ical extends Kronolith_Driver { $component = $components[$i]; if ($component->getType() == 'vEvent') { $event = new Kronolith_Event_ical($this); - $event->status = KRONOLITH_STATUS_FREE; + $event->status = Kronolith::STATUS_FREE; $event->fromiCalendar($component); $event->remoteCal = $this->_params['url']; $event->eventID = $i; @@ -124,7 +124,7 @@ class Kronolith_Driver_ical extends Kronolith_Driver { if (isset($components[$eventId]) && $components[$eventId]->getType() == 'vEvent') { $event = new Kronolith_Event_ical($this); - $event->status = KRONOLITH_STATUS_FREE; + $event->status = Kronolith::STATUS_FREE; $event->fromiCalendar($components[$eventId]); $event->remoteCal = $url; $event->eventID = $eventId; diff --git a/kronolith/lib/Driver/kolab.php b/kronolith/lib/Driver/kolab.php index 071973114..9bda3e081 100644 --- a/kronolith/lib/Driver/kolab.php +++ b/kronolith/lib/Driver/kolab.php @@ -494,16 +494,16 @@ class Kronolith_Driver_kolab_wrapper_old extends Kronolith_Driver_kolab_wrapper } switch ($event->status) { - case KRONOLITH_STATUS_FREE: - case KRONOLITH_STATUS_CANCELLED: + case Kronolith::STATUS_FREE: + case Kronolith::STATUS_CANCELLED: $this->_kolab->setVal('show-time-as', 'free'); break; - case KRONOLITH_STATUS_TENTATIVE: + case Kronolith::STATUS_TENTATIVE: $this->_kolab->setVal('show-time-as', 'tentative'); break; - case KRONOLITH_STATUS_CONFIRMED: + case Kronolith::STATUS_CONFIRMED: default: $this->_kolab->setVal('show-time-as', 'busy'); break; @@ -515,33 +515,33 @@ class Kronolith_Driver_kolab_wrapper_old extends Kronolith_Driver_kolab_wrapper $this->_kolab->setElemVal($attendee, 'smtp-address', $email); switch ($status['response']) { - case KRONOLITH_RESPONSE_ACCEPTED: + case Kronolith::RESPONSE_ACCEPTED: $this->_kolab->setElemVal($attendee, 'status', 'accepted'); break; - case KRONOLITH_RESPONSE_DECLINED: + case Kronolith::RESPONSE_DECLINED: $this->_kolab->setElemVal($attendee, 'status', 'declined'); break; - case KRONOLITH_RESPONSE_TENTATIVE: + case Kronolith::RESPONSE_TENTATIVE: $this->_kolab->setElemVal($attendee, 'status', 'tentative'); break; - case KRONOLITH_RESPONSE_NONE: + case Kronolith::RESPONSE_NONE: default: $this->_kolab->setElemVal($attendee, 'status', 'none'); } switch ($status['attendance']) { - case KRONOLITH_PART_OPTIONAL: + case Kronolith::PART_OPTIONAL: $this->_kolab->setElemVal($attendee, 'role', 'optional'); break; - case KRONOLITH_PART_NONE: + case Kronolith::PART_NONE: $this->_kolab->setElemVal($attendee, 'role', 'resource'); break; - case KRONOLITH_PART_REQUIRED: + case Kronolith::PART_REQUIRED: default: $this->_kolab->setElemVal($attendee, 'role', 'required'); } @@ -781,17 +781,17 @@ class Kronolith_Event_kolab_old extends Kronolith_Event { $status = $kolab->getVal('show-time-as'); switch ($status) { case 'free': - $this->status = KRONOLITH_STATUS_FREE; + $this->status = Kronolith::STATUS_FREE; break; case 'tentative': - $this->status = KRONOLITH_STATUS_TENTATIVE; + $this->status = Kronolith::STATUS_TENTATIVE; break; case 'busy': case 'outofoffice': default: - $this->status = KRONOLITH_STATUS_CONFIRMED; + $this->status = Kronolith::STATUS_CONFIRMED; } $attendees = array_change_key_case($kolab->getAllRootElems('attendee')); @@ -806,36 +806,36 @@ class Kronolith_Event_kolab_old extends Kronolith_Event { $role = $kolab->getElemVal($attendee, 'role'); switch ($role) { case 'optional': - $role = KRONOLITH_PART_OPTIONAL; + $role = Kronolith::PART_OPTIONAL; break; case 'resource': - $role = KRONOLITH_PART_NONE; + $role = Kronolith::PART_NONE; break; case 'required': default: - $role = KRONOLITH_PART_REQUIRED; + $role = Kronolith::PART_REQUIRED; break; } $status = $kolab->getElemVal($attendee, 'status'); switch ($status) { case 'accepted': - $status = KRONOLITH_RESPONSE_ACCEPTED; + $status = Kronolith::RESPONSE_ACCEPTED; break; case 'declined': - $status = KRONOLITH_RESPONSE_DECLINED; + $status = Kronolith::RESPONSE_DECLINED; break; case 'tentative': - $status = KRONOLITH_RESPONSE_TENTATIVE; + $status = Kronolith::RESPONSE_TENTATIVE; break; case 'none': default: - $status = KRONOLITH_RESPONSE_NONE; + $status = Kronolith::RESPONSE_NONE; break; } @@ -1453,20 +1453,20 @@ class Kronolith_Event_kolab_new extends Kronolith_Event { if (isset($event['show-time-as'])) { switch ($event['show-time-as']) { case 'free': - $this->status = KRONOLITH_STATUS_FREE; + $this->status = Kronolith::STATUS_FREE; break; case 'tentative': - $this->status = KRONOLITH_STATUS_TENTATIVE; + $this->status = Kronolith::STATUS_TENTATIVE; break; case 'busy': case 'outofoffice': default: - $this->status = KRONOLITH_STATUS_CONFIRMED; + $this->status = Kronolith::STATUS_CONFIRMED; } } else { - $this->status = KRONOLITH_STATUS_CONFIRMED; + $this->status = Kronolith::STATUS_CONFIRMED; } // Recurrence @@ -1484,36 +1484,36 @@ class Kronolith_Event_kolab_new extends Kronolith_Event { $role = $attendee['role']; switch ($role) { case 'optional': - $role = KRONOLITH_PART_OPTIONAL; + $role = Kronolith::PART_OPTIONAL; break; case 'resource': - $role = KRONOLITH_PART_NONE; + $role = Kronolith::PART_NONE; break; case 'required': default: - $role = KRONOLITH_PART_REQUIRED; + $role = Kronolith::PART_REQUIRED; break; } $status = $attendee['status']; switch ($status) { case 'accepted': - $status = KRONOLITH_RESPONSE_ACCEPTED; + $status = Kronolith::RESPONSE_ACCEPTED; break; case 'declined': - $status = KRONOLITH_RESPONSE_DECLINED; + $status = Kronolith::RESPONSE_DECLINED; break; case 'tentative': - $status = KRONOLITH_RESPONSE_TENTATIVE; + $status = Kronolith::RESPONSE_TENTATIVE; break; case 'none': default: - $status = KRONOLITH_RESPONSE_NONE; + $status = Kronolith::RESPONSE_NONE; break; } @@ -1562,17 +1562,17 @@ class Kronolith_Event_kolab_new extends Kronolith_Event { $event['_is_all_day'] = $this->isAllDay(); switch ($this->status) { - case KRONOLITH_STATUS_FREE: - case KRONOLITH_STATUS_CANCELLED: + case Kronolith::STATUS_FREE: + case Kronolith::STATUS_CANCELLED: $event['show-time-as'] = 'free'; break; - case KRONOLITH_STATUS_TENTATIVE: + case Kronolith::STATUS_TENTATIVE: $event['show-time-as'] = 'tentative'; break; // No mapping for outofoffice - case KRONOLITH_STATUS_CONFIRMED: + case Kronolith::STATUS_CONFIRMED: default: $event['show-time-as'] = 'busy'; } @@ -1601,15 +1601,15 @@ class Kronolith_Event_kolab_new extends Kronolith_Event { } switch ($attendee['attendance']) { - case KRONOLITH_PART_OPTIONAL: + case Kronolith::PART_OPTIONAL: $new_attendee['role'] = 'optional'; break; - case KRONOLITH_PART_NONE: + case Kronolith::PART_NONE: $new_attendee['role'] = 'resource'; break; - case KRONOLITH_PART_REQUIRED: + case Kronolith::PART_REQUIRED: default: $new_attendee['role'] = 'required'; break; @@ -1618,19 +1618,19 @@ class Kronolith_Event_kolab_new extends Kronolith_Event { $new_attendee['request-response'] = '0'; switch ($attendee['response']) { - case KRONOLITH_RESPONSE_ACCEPTED: + case Kronolith::RESPONSE_ACCEPTED: $new_attendee['status'] = 'accepted'; break; - case KRONOLITH_RESPONSE_DECLINED: + case Kronolith::RESPONSE_DECLINED: $new_attendee['status'] = 'declined'; break; - case KRONOLITH_RESPONSE_TENTATIVE: + case Kronolith::RESPONSE_TENTATIVE: $new_attendee['status'] = 'tentative'; break; - case KRONOLITH_RESPONSE_NONE: + case Kronolith::RESPONSE_NONE: default: $new_attendee['status'] = 'none'; break; diff --git a/kronolith/lib/FreeBusy.php b/kronolith/lib/FreeBusy.php index 58eeae214..2da1307e6 100644 --- a/kronolith/lib/FreeBusy.php +++ b/kronolith/lib/FreeBusy.php @@ -88,10 +88,10 @@ class Kronolith_FreeBusy { /* Add all the busy periods. */ foreach ($busy as $events) { foreach ($events as $event) { - if ($event->hasStatus(KRONOLITH_STATUS_FREE)) { + if ($event->hasStatus(Kronolith::STATUS_FREE)) { continue; } - if ($event->hasStatus(KRONOLITH_STATUS_CANCELLED)) { + if ($event->hasStatus(Kronolith::STATUS_CANCELLED)) { continue; } @@ -203,7 +203,7 @@ class Kronolith_FreeBusy { $fb = $storage->search($email); if (!is_a($fb, 'PEAR_Error')) { return $fb; - } elseif ($fb->getCode() == KRONOLITH_ERROR_FB_NOT_FOUND) { + } elseif ($fb->getCode() == Kronolith::ERROR_FB_NOT_FOUND) { return $url ? PEAR::raiseError(sprintf(_("No free/busy information found at the free/busy url of %s."), $email)) : PEAR::raiseError(sprintf(_("No free/busy url found for %s."), $email)); diff --git a/kronolith/lib/Kronolith.php b/kronolith/lib/Kronolith.php index 60f91eaec..ae05140e9 100644 --- a/kronolith/lib/Kronolith.php +++ b/kronolith/lib/Kronolith.php @@ -3,32 +3,6 @@ * @package Kronolith */ -/** Event status */ -define('KRONOLITH_STATUS_NONE', 0); -define('KRONOLITH_STATUS_TENTATIVE', 1); -define('KRONOLITH_STATUS_CONFIRMED', 2); -define('KRONOLITH_STATUS_CANCELLED', 3); -define('KRONOLITH_STATUS_FREE', 4); - -/** Invitation responses */ -define('KRONOLITH_RESPONSE_NONE', 1); -define('KRONOLITH_RESPONSE_ACCEPTED', 2); -define('KRONOLITH_RESPONSE_DECLINED', 3); -define('KRONOLITH_RESPONSE_TENTATIVE', 4); - -/** Attendee status */ -define('KRONOLITH_PART_REQUIRED', 1); -define('KRONOLITH_PART_OPTIONAL', 2); -define('KRONOLITH_PART_NONE', 3); -define('KRONOLITH_PART_IGNORE', 4); - -/** iTip requests */ -define('KRONOLITH_ITIP_REQUEST', 1); -define('KRONOLITH_ITIP_CANCEL', 2); - -/** Free/Busy not found */ -define('KRONOLITH_ERROR_FB_NOT_FOUND', 1); - /** The event can be delegated. */ define('PERMS_DELEGATE', 1024); @@ -40,12 +14,43 @@ define('PERMS_DELEGATE', 1024); */ class Kronolith { + /** Event status */ + const STATUS_NONE = 0; + const STATUS_TENTATIVE = 1; + const STATUS_CONFIRMED = 2; + const STATUS_CANCELLED = 3; + const STATUS_FREE = 4; + + /** Invitation responses */ + const RESPONSE_NONE = 1; + const RESPONSE_ACCEPTED = 2; + const RESPONSE_DECLINED = 3; + const RESPONSE_TENTATIVE = 4; + + /** Attendee status */ + const PART_REQUIRED = 1; + const PART_OPTIONAL = 2; + const PART_NONE = 3; + const PART_IGNORE = 4; + + /** iTip requests */ + const ITIP_REQUEST = 1; + const ITIP_CANCEL = 2; + + /** Free/Busy not found */ + const ERROR_FB_NOT_FOUND = 1; + /** * Driver singleton instances. * * @var array */ - static protected $_instances = array(); + static private $_instances = array(); + + /** + * @var Kronolith_Tagger + */ + static private $_tagger; /** * Output everything up to but not including the tag. @@ -55,7 +60,7 @@ class Kronolith * Each entry contains the three elements necessary * for a Horde::addScriptFile() call. */ - function header($title, $scripts = array()) + public static function header($title, $scripts = array()) { // Don't autoload any javascript files. Horde::disableAutoloadHordeJS(); @@ -115,7 +120,7 @@ class Kronolith * * @return string */ - function includeJSVars() + public static function includeJSVars() { global $browser, $conf, $prefs, $registry; @@ -163,7 +168,7 @@ class Kronolith * @return string The javascript text to output, or empty if the page * headers have not yet been sent. */ - function addInlineScript($script, $onload = false) + public static function addInlineScript($script, $onload = false) { if (is_array($script)) { $script = implode(';', $script); @@ -200,7 +205,7 @@ class Kronolith * * @return string The javascript text to output. */ - function outputInlineScript() + public static function outputInlineScript() { if (!empty($GLOBALS['__kronolith_inline_script'])) { echo '\n"; } @@ -231,7 +236,7 @@ class Kronolith * Outputs the necessary script tags, honoring local configuration choices * as to script caching. */ - function includeScriptFiles() + public static function includeScriptFiles() { global $conf; @@ -315,7 +320,7 @@ class Kronolith * * @param boolean $print Include print CSS? */ - function includeStylesheetFiles($print = false) + public static function includeStylesheetFiles($print = false) { global $conf, $prefs, $registry; @@ -419,7 +424,7 @@ class Kronolith * * @return string The URL to the cache page. */ - function getCacheURL($type, $cid) + public static function getCacheURL($type, $cid) { $parts = array( $GLOBALS['registry']->get('webroot'), @@ -437,7 +442,7 @@ class Kronolith * * @param string $type Either 'css' or 'js'. */ - function _filesystemGC($type) + public static function _filesystemGC($type) { static $dir_list = array(); @@ -476,7 +481,7 @@ class Kronolith * * @return array The events happening in this time period. */ - function listEventIds($startDate = null, $endDate = null, + public static function listEventIds($startDate = null, $endDate = null, $calendars = null, $alarmsOnly = false) { global $kronolith_driver; @@ -516,7 +521,7 @@ class Kronolith * * @return array The alarms active on $date. */ - function listAlarms($date, $calendars, $fullevent = false) + public static function listAlarms($date, $calendars, $fullevent = false) { global $kronolith_driver; @@ -541,7 +546,7 @@ class Kronolith * * @return array The events */ - function search($query) + public static function search($query) { global $kronolith_driver; @@ -568,7 +573,7 @@ class Kronolith /** * Initial app setup code. */ - function initialize() + public static function initialize() { /* Store the request timestamp if it's not already present. */ if (!isset($_SERVER['REQUEST_TIME'])) { @@ -787,7 +792,7 @@ class Kronolith * 1 = Login tasks pending * 2 = Login tasks pending, previous tasks interrupted */ - function loginTasksFlag($set = null) + public static function loginTasksFlag($set = null) { if (($set !== null)) { $_SESSION['kronolith_session']['_logintasks'] = $set; @@ -808,7 +813,7 @@ class Kronolith * * @return array The matching holidays as an array. */ - function listHolidayEvents($startDate = null, $endDate = null) + public static function listHolidayEvents($startDate = null, $endDate = null) { if (!@include_once('Date/Holidays.php')) { Horde::logMessage('Support for Date_Holidays has been enabled but the package seems to be missing.', @@ -838,7 +843,7 @@ class Kronolith * * @return array The events happening in this time period. */ - function listEvents($startDate = null, $endDate = null, $calendars = null, + public static function listEvents($startDate = null, $endDate = null, $calendars = null, $showRecurrence = true, $alarmsOnly = false, $showRemote = true) { @@ -954,7 +959,7 @@ class Kronolith $event->description = isset($eventsListItem['description']) ? $eventsListItem['description'] : ''; $event->start = $eventStart; $event->end = $eventEnd; - $event->status = KRONOLITH_STATUS_FREE; + $event->status = Kronolith::STATUS_FREE; if (isset($eventsListItem['recurrence'])) { $recurrence = new Horde_Date_Recurrence($eventStart); $recurrence->setRecurType($eventsListItem['recurrence']['type']); @@ -1030,7 +1035,7 @@ class Kronolith * * @access private */ - function _getEvents(&$results, &$event, $startDate, $endDate, + public static function _getEvents(&$results, &$event, $startDate, $endDate, $startOfPeriod, $endOfPeriod, $showRecurrence) { @@ -1199,7 +1204,7 @@ class Kronolith * recurrence. * @param Horde_Date $eventEnd The event's end at the actual recurrence. */ - function _addCoverDates(&$results, $event, $eventStart, $eventEnd) + public static function _addCoverDates(&$results, $event, $eventStart, $eventEnd) { $i = $eventStart->mday; $loopDate = new Horde_Date(array('month' => $eventStart->month, @@ -1225,7 +1230,7 @@ class Kronolith * * @return integer The number of events. */ - function countEvents() + public static function countEvents() { global $kronolith_driver; @@ -1258,7 +1263,7 @@ class Kronolith /** * Returns the real name, if available, of a user. */ - function getUserName($uid) + public static function getUserName($uid) { static $names = array(); @@ -1278,7 +1283,7 @@ class Kronolith /** * Returns the email address, if available, of a user. */ - function getUserEmail($uid) + public static function getUserEmail($uid) { static $emails = array(); @@ -1297,7 +1302,7 @@ class Kronolith /** * Checks if an email address belongs to a user. */ - function isUserEmail($uid, $email) + public static function isUserEmail($uid, $email) { static $emails = array(); @@ -1323,7 +1328,7 @@ class Kronolith * * @return string The translated displayable recurrence value string. */ - function recurToString($type) + public static function recurToString($type) { switch ($type) { case Horde_Date_Recurrence::RECUR_NONE: @@ -1351,23 +1356,23 @@ class Kronolith * for display. * * @param integer $status The meeting status; one of the - * KRONOLITH_STATUS_XXX constants. + * Kronolith::STATUS_XXX constants. * * @return string The translated displayable meeting status string. */ - function statusToString($status) + public static function statusToString($status) { switch ($status) { - case KRONOLITH_STATUS_CONFIRMED: + case Kronolith::STATUS_CONFIRMED: return _("Confirmed"); - case KRONOLITH_STATUS_CANCELLED: + case Kronolith::STATUS_CANCELLED: return _("Cancelled"); - case KRONOLITH_STATUS_FREE: + case Kronolith::STATUS_FREE: return _("Free"); - case KRONOLITH_STATUS_TENTATIVE: + case Kronolith::STATUS_TENTATIVE: default: return _("Tentative"); } @@ -1378,23 +1383,23 @@ class Kronolith * suitable for display. * * @param integer $response The attendee response; one of the - * KRONOLITH_RESPONSE_XXX constants. + * Kronolith::RESPONSE_XXX constants. * * @return string The translated displayable attendee response string. */ - function responseToString($response) + public static function responseToString($response) { switch ($response) { - case KRONOLITH_RESPONSE_ACCEPTED: + case Kronolith::RESPONSE_ACCEPTED: return _("Accepted"); - case KRONOLITH_RESPONSE_DECLINED: + case Kronolith::RESPONSE_DECLINED: return _("Declined"); - case KRONOLITH_RESPONSE_TENTATIVE: + case Kronolith::RESPONSE_TENTATIVE: return _("Tentative"); - case KRONOLITH_RESPONSE_NONE: + case Kronolith::RESPONSE_NONE: default: return _("None"); } @@ -1405,21 +1410,21 @@ class Kronolith * suitable for display. * * @param integer $part The attendee participation; one of the - * KRONOLITH_PART_XXX constants. + * Kronolith::PART_XXX constants. * * @return string The translated displayable attendee participation * string. */ - function partToString($part) + public static function partToString($part) { switch ($part) { - case KRONOLITH_PART_OPTIONAL: + case Kronolith::PART_OPTIONAL: return _("Optional"); - case KRONOLITH_PART_NONE: + case Kronolith::PART_NONE: return _("None"); - case KRONOLITH_PART_REQUIRED: + case Kronolith::PART_REQUIRED: default: return _("Required"); } @@ -1433,21 +1438,21 @@ class Kronolith * * @return string The Kronolith response value. */ - function responseFromICal($response) + public static function responseFromICal($response) { switch (String::upper($response)) { case 'ACCEPTED': - return KRONOLITH_RESPONSE_ACCEPTED; + return Kronolith::RESPONSE_ACCEPTED; case 'DECLINED': - return KRONOLITH_RESPONSE_DECLINED; + return Kronolith::RESPONSE_DECLINED; case 'TENTATIVE': - return KRONOLITH_RESPONSE_TENTATIVE; + return Kronolith::RESPONSE_TENTATIVE; case 'NEEDS-ACTION': default: - return KRONOLITH_RESPONSE_NONE; + return Kronolith::RESPONSE_NONE; } } @@ -1460,25 +1465,25 @@ class Kronolith * * @return string The HTML "; $statii = array( - KRONOLITH_STATUS_FREE, - KRONOLITH_STATUS_TENTATIVE, - KRONOLITH_STATUS_CONFIRMED, - KRONOLITH_STATUS_CANCELLED + Kronolith::STATUS_FREE, + Kronolith::STATUS_TENTATIVE, + Kronolith::STATUS_CONFIRMED, + Kronolith::STATUS_CANCELLED ); if (!isset($current)) { - $current = KRONOLITH_STATUS_NONE; + $current = Kronolith::STATUS_NONE; } if ($any) { - $html .= ""; } @@ -1502,7 +1507,7 @@ class Kronolith * * @return array The calendar list. */ - function listCalendars($owneronly = false, $permission = PERMS_SHOW) + public static function listCalendars($owneronly = false, $permission = PERMS_SHOW) { $calendars = $GLOBALS['kronolith_shares']->listShares(Auth::getAuth(), $permission, $owneronly ? Auth::getAuth() : null, 0, 0, 'name'); if (is_a($calendars, 'PEAR_Error')) { @@ -1517,7 +1522,7 @@ class Kronolith * Returns the default calendar for the current user at the specified * permissions level. */ - function getDefaultCalendar($permission = PERMS_SHOW) + public static function getDefaultCalendar($permission = PERMS_SHOW) { global $prefs; @@ -1544,7 +1549,7 @@ class Kronolith * * @return string The calendar's feed URL. */ - function feedUrl($calendar) + public static function feedUrl($calendar) { if (isset($GLOBALS['conf']['urls']['pretty']) && $GLOBALS['conf']['urls']['pretty'] == 'rewrite') { @@ -1563,7 +1568,7 @@ class Kronolith * * @return string The calendar's embed snippit. */ - function embedCode($calendar) + public static function embedCode($calendar) { /* Get the base url */ $url = Horde::applicationURL('imple.php', true, -1); @@ -1580,7 +1585,7 @@ class Kronolith * * @return string Attendee list. */ - function attendeeList() + public static function attendeeList() { if (!isset($_SESSION['kronolith']['attendees']) || !is_array($_SESSION['kronolith']['attendees'])) { @@ -1604,12 +1609,12 @@ class Kronolith * @param Notification $notification A notification object used to show * result status. * @param integer $action The type of notification to send. - * One of the KRONOLITH_ITIP_* values. + * One of the Kronolith::ITIP_* values. * @param Horde_Date $instance If cancelling a single instance of a * recurring event, the date of this * intance. */ - function sendITipNotifications(&$event, &$notification, $action, + public static function sendITipNotifications(&$event, &$notification, $action, $instance = null) { global $conf; @@ -1646,23 +1651,23 @@ class Kronolith * not need to participate, or has declined participating, or * doesn't have an email address. */ if (strpos($email, '@') === false || - $status['attendance'] == KRONOLITH_PART_NONE || - $status['response'] == KRONOLITH_RESPONSE_DECLINED) { + $status['attendance'] == Kronolith::PART_NONE || + $status['response'] == Kronolith::RESPONSE_DECLINED) { continue; } /* Determine all notification-specific strings. */ switch ($action) { - case KRONOLITH_ITIP_CANCEL: + case Kronolith::ITIP_CANCEL: /* Cancellation. */ $method = 'CANCEL'; $filename = 'event-cancellation.ics'; $subject = sprintf(_("Cancelled: %s"), $event->getTitle()); break; - case KRONOLITH_ITIP_REQUEST: + case Kronolith::ITIP_REQUEST: default: - if ($status['response'] == KRONOLITH_RESPONSE_NONE) { + if ($status['response'] == Kronolith::RESPONSE_NONE) { /* Invitation. */ $method = 'REQUEST'; $filename = 'event-invitation.ics'; @@ -1697,7 +1702,7 @@ class Kronolith } $message .= _("Attached is an iCalendar file with more information about the event. If your mail client supports iTip requests you can use this file to easily update your local copy of the event."); - if ($action == KRONOLITH_ITIP_REQUEST) { + if ($action == Kronolith::ITIP_REQUEST) { $attend_link = Util::addParameter(Horde::applicationUrl('attend.php', true, -1), array('c' => $event->getCalendar(), 'e' => $event->getId(), 'u' => $email), null, false); $message .= "\n\n" . sprintf(_("If your email client doesn't support iTip requests you can use one of the following links to accept or decline the event.\n\nTo accept the event:\n%s\n\nTo accept the event tentatively:\n%s\n\nTo decline the event:\n%s\n"), Util::addParameter($attend_link, 'a', 'accept', false), Util::addParameter($attend_link, 'a', 'tentative', false), Util::addParameter($attend_link, 'a', 'decline', false)); } @@ -1707,7 +1712,7 @@ class Kronolith $iCal->setAttribute('METHOD', $method); $iCal->setAttribute('X-WR-CALNAME', String::convertCharset($share->get('name'), NLS::getCharset(), 'utf-8')); $vevent = $event->toiCalendar($iCal); - if ($action == KRONOLITH_ITIP_CANCEL && !empty($instance)) { + if ($action == Kronolith::ITIP_CANCEL && !empty($instance)) { $vevent->setAttribute('RECURRENCE-ID', $instance, array('VALUE' => 'DATE')); } $iCal->addComponent($vevent); @@ -1751,7 +1756,7 @@ class Kronolith * @param string $action The event action. One of "add", "edit", * or "delete". */ - function sendNotification(&$event, $action) + public static function sendNotification(&$event, $action) { global $conf; @@ -1896,7 +1901,7 @@ class Kronolith * @return mixed The user's email, time, and language preferences if they * want a notification for this calendar. */ - function _notificationPref($user, $mode, $calendar = null) + public static function _notificationPref($user, $mode, $calendar = null) { $prefs = &Prefs::singleton($GLOBALS['conf']['prefs']['driver'], 'kronolith', $user, '', null, @@ -1931,7 +1936,7 @@ class Kronolith /** * @return Horde_Date */ - function currentDate() + public static function currentDate() { if ($date = Util::getFormData('date')) { return new Horde_Date($date . '000000'); @@ -1950,7 +1955,7 @@ class Kronolith * * @return mixed The value of the specified permission. */ - function hasPermission($permission) + public static function hasPermission($permission) { global $perms; @@ -1973,7 +1978,7 @@ class Kronolith /** * @param string $tabname */ - function tabs($tabname = null) + public static function tabs($tabname = null) { $date = Kronolith::currentDate(); $date_stamp = $date->dateString(); @@ -2003,7 +2008,7 @@ class Kronolith * @param string $tabname * @param Kronolith_Event $event */ - function eventTabs($tabname, $event) + public static function eventTabs($tabname, $event) { if (!$event->isInitialized()) { return; @@ -2107,7 +2112,7 @@ class Kronolith * * @param string $view The name of the view. */ - function getView($view) + public static function getView($view) { switch ($view) { case 'Day': @@ -2196,7 +2201,7 @@ class Kronolith * Should we show event location, based on the show_location * preference and $print_view? */ - function viewShowLocation() + public static function viewShowLocation() { $show = @unserialize($GLOBALS['prefs']->getValue('show_location')); if (!empty($GLOBALS['print_view'])) { @@ -2210,7 +2215,7 @@ class Kronolith * Should we show event time, based on the show_time preference * and $print_view? */ - function viewShowTime() + public static function viewShowTime() { $show = @unserialize($GLOBALS['prefs']->getValue('show_time')); if (!empty($GLOBALS['print_view'])) { @@ -2229,7 +2234,7 @@ class Kronolith * * @return string A HTML color code. */ - function backgroundColor($calendar) + public static function backgroundColor($calendar) { $color = is_array($calendar) ? @$calendar['color'] : $calendar->get('color'); return empty($color) ? '#dddddd' : $color; @@ -2243,7 +2248,7 @@ class Kronolith * definition. * @return string A HTML color code. */ - function foregroundColor($calendar) + public static function foregroundColor($calendar) { return Horde_Image::brightness(Kronolith::backgroundColor($calendar)) < 128 ? '#f6f6f6' : '#000'; } @@ -2259,7 +2264,7 @@ class Kronolith * * @return string A CSS string with color definitions. */ - function getCSSColors($calendar, $with_attribute = true) + public static function getCSSColors($calendar, $with_attribute = true) { $css = 'background-color:' . Kronolith::backgroundColor($calendar) . ';color:' . Kronolith::foregroundColor($calendar); if ($with_attribute) { @@ -2271,7 +2276,7 @@ class Kronolith /** * Builds Kronolith's list of menu items. */ - function getMenu($returnType = 'object') + public static function getMenu($returnType = 'object') { global $conf, $registry, $browser, $prefs; @@ -2317,7 +2322,7 @@ class Kronolith /** * Used with usort() to sort events based on their start times. */ - function _sortEventStartTime($a, $b) + public static function _sortEventStartTime($a, $b) { $diff = $a->start->compareDateTime($b->start); if ($diff == 0) { @@ -2327,16 +2332,13 @@ class Kronolith } } - function getTagger() + public static function getTagger() { - static $_tagger; - - if (empty($_tagger)) { - $_tagger = new Kronolith_Tagger(); + if (empty(self::$_tagger)) { + self::$_tagger = new Kronolith_Tagger(); } - return $_tagger; + return self::$_tagger; } - } diff --git a/kronolith/lib/Storage/kolab.php b/kronolith/lib/Storage/kolab.php index 3e958eee7..a28c3613b 100644 --- a/kronolith/lib/Storage/kolab.php +++ b/kronolith/lib/Storage/kolab.php @@ -62,7 +62,7 @@ class Kronolith_Storage_kolab extends Kronolith_Storage { @$http->sendRequest(); if ($http->getResponseCode() != 200) { return PEAR::raiseError(sprintf(_("Unable to retrieve free/busy information for %s"), - $email), KRONOLITH_ERROR_FB_NOT_FOUND); + $email), Kronolith::ERROR_FB_NOT_FOUND); } $vfb_text = $http->getResponseBody(); @@ -72,7 +72,7 @@ class Kronolith_Storage_kolab extends Kronolith_Storage { $vfb = &$iCal->findComponent('VFREEBUSY'); if ($vfb === false) { return PEAR::raiseError(sprintf(_("No free/busy information is available for %s"), - $email), KRONOLITH_ERROR_FB_NOT_FOUND); + $email), Kronolith::ERROR_FB_NOT_FOUND); } return $vfb; diff --git a/kronolith/lib/Storage/sql.php b/kronolith/lib/Storage/sql.php index 19c34d546..6ea632b33 100644 --- a/kronolith/lib/Storage/sql.php +++ b/kronolith/lib/Storage/sql.php @@ -154,7 +154,7 @@ class Kronolith_Storage_sql extends Kronolith_Storage { return $vfb; } } - return PEAR::raiseError(_("Not found"), KRONOLITH_ERROR_FB_NOT_FOUND); + return PEAR::raiseError(_("Not found"), Kronolith::ERROR_FB_NOT_FOUND); } /** diff --git a/kronolith/lib/Views/Year.php b/kronolith/lib/Views/Year.php index 7714f302c..b57934c22 100644 --- a/kronolith/lib/Views/Year.php +++ b/kronolith/lib/Views/Year.php @@ -126,7 +126,7 @@ class Kronolith_View_Year { * them. */ $day_events = ''; foreach ($this->_events[$date->dateString()] as $event) { - if ($event->getStatus() == KRONOLITH_STATUS_CONFIRMED) { + if ($event->getStatus() == Kronolith::STATUS_CONFIRMED) { /* Set the background color to distinguish the day */ $style = 'year-event'; } diff --git a/kronolith/lib/api.php b/kronolith/lib/api.php index aa34b3cb8..274156deb 100644 --- a/kronolith/lib/api.php +++ b/kronolith/lib/api.php @@ -1225,7 +1225,7 @@ function _kronolith_updateAttendee($response, $sender = null) $name = isset($atparms[$index]['CN']) ? $atparms[$index]['CN'] : null; if ($event->hasAttendee($attendee)) { if (is_null($sender) || $sender_lcase == $attendee) { - $event->addAttendee($attendee, KRONOLITH_PART_IGNORE, Kronolith::responseFromICal($atparms[$index]['PARTSTAT']), $name); + $event->addAttendee($attendee, Kronolith::PART_IGNORE, Kronolith::responseFromICal($atparms[$index]['PARTSTAT']), $name); $found = true; } else { $error = _("The attendee hasn't been updated because the update was not sent from the attendee."); diff --git a/kronolith/lib/tests/toicalendar.phpt b/kronolith/lib/tests/toicalendar.phpt index 37f2a8381..1e920a173 100644 --- a/kronolith/lib/tests/toicalendar.phpt +++ b/kronolith/lib/tests/toicalendar.phpt @@ -37,27 +37,27 @@ $ical->addComponent($cal); echo $ical->exportvCalendar() . "\n"; $object->setPrivate(true); -$object->setStatus(KRONOLITH_STATUS_TENTATIVE); +$object->setStatus(Kronolith::STATUS_TENTATIVE); $object->recurrence = new Horde_Date_Recurrence($object->start); $object->recurrence->setRecurType(Horde_Date_Recurrence::RECUR_MONTHLY_DATE); $object->recurrence->setRecurInterval(1); $object->recurrence->addException(2007, 4, 15); $object->setAttendees( array('juergen@example.com' => - array('attendance' => KRONOLITH_PART_REQUIRED, - 'response' => KRONOLITH_RESPONSE_NONE, + array('attendance' => Kronolith::PART_REQUIRED, + 'response' => Kronolith::RESPONSE_NONE, 'name' => 'Jürgen Doe'), 0 => - array('attendance' => KRONOLITH_PART_OPTIONAL, - 'response' => KRONOLITH_RESPONSE_ACCEPTED, + array('attendance' => Kronolith::PART_OPTIONAL, + 'response' => Kronolith::RESPONSE_ACCEPTED, 'name' => 'Jane Doe'), 'jack@example.com' => - array('attendance' => KRONOLITH_PART_NONE, - 'response' => KRONOLITH_RESPONSE_DECLINED, + array('attendance' => Kronolith::PART_NONE, + 'response' => Kronolith::RESPONSE_DECLINED, 'name' => 'Jack Doe'), 'jenny@example.com' => - array('attendance' => KRONOLITH_PART_NONE, - 'response' => KRONOLITH_RESPONSE_TENTATIVE))); + array('attendance' => Kronolith::PART_NONE, + 'response' => Kronolith::RESPONSE_TENTATIVE))); $ical = new Horde_iCalendar('1.0'); $cal = $object->toiCalendar($ical); diff --git a/kronolith/search.php b/kronolith/search.php index 3e6f9218c..9c1e71419 100644 --- a/kronolith/search.php +++ b/kronolith/search.php @@ -49,7 +49,7 @@ if ($search_mode != 'basic') { if (isset($q_title)) { /* We're returning from a previous search. */ $event->readForm(); - if (Util::getFormData('status') == KRONOLITH_STATUS_NONE) { + if (Util::getFormData('status') == Kronolith::STATUS_NONE) { $event->status = null; } } diff --git a/kronolith/templates/attendees/attendees.inc b/kronolith/templates/attendees/attendees.inc index 8d88be4bb..b4a0b2380 100644 --- a/kronolith/templates/attendees/attendees.inc +++ b/kronolith/templates/attendees/attendees.inc @@ -59,17 +59,17 @@ function switchDateView(view, date) -- 2.11.0