From 1f29c9197500160f3bff50775c85ac9db473259f Mon Sep 17 00:00:00 2001 From: Chuck Hagenbuch Date: Sat, 7 Feb 2009 00:08:30 -0500 Subject: [PATCH] remove unnecessary correct() calls --- kronolith/delete.php | 1 - kronolith/edit.php | 1 - kronolith/lib/Block/month.php | 2 - kronolith/lib/Block/monthlist.php | 1 - kronolith/lib/Block/prevmonthlist.php | 2 - kronolith/lib/Block/summary.php | 1 - kronolith/lib/Day.php | 5 - kronolith/lib/Driver.php | 10 -- kronolith/lib/Driver/holidays.php | 3 +- kronolith/lib/Driver/kolab.php | 119 +++++++++++------------- kronolith/lib/Driver/sql.php | 49 +++++----- kronolith/lib/FreeBusy.php | 1 - kronolith/lib/FreeBusy/View/Day.php | 2 - kronolith/lib/FreeBusy/View/Month.php | 4 - kronolith/lib/FreeBusy/View/Week.php | 5 - kronolith/lib/Kronolith.php | 4 - kronolith/lib/Maintenance/Task/purge_events.php | 1 - kronolith/lib/Views/Day.php | 2 - kronolith/lib/Views/Month.php | 4 - kronolith/lib/Views/Week.php | 4 - kronolith/new.php | 1 - kronolith/search.php | 2 - 22 files changed, 79 insertions(+), 145 deletions(-) diff --git a/kronolith/delete.php b/kronolith/delete.php index c64007df7..90d0acc5b 100644 --- a/kronolith/delete.php +++ b/kronolith/delete.php @@ -33,7 +33,6 @@ if ($eventID = Util::getFormData('eventID')) { 'month' => Util::getFormData('month', date('n')), 'mday' => Util::getFormData('mday', date('j')) - 1, 'year' => Util::getFormData('year', date('Y')))); - $recurEnd->correct(); if ($event->end->compareDate($recurEnd) > 0) { $result = $kronolith_driver->deleteEvent($event->getId()); if (is_a($result, 'PEAR_Error')) { diff --git a/kronolith/edit.php b/kronolith/edit.php index c2523886c..4132ad21b 100644 --- a/kronolith/edit.php +++ b/kronolith/edit.php @@ -98,7 +98,6 @@ if ($exception = Util::getFormData('del_exception')) { case 'future': /* Set recurrence end. */ $exception->mday--; - $exception->correct(); if ($event->end->compareDate($exception) > 0) { $result = $kronolith_driver->deleteEvent($event->getId()); if (is_a($result, 'PEAR_Error')) { diff --git a/kronolith/lib/Block/month.php b/kronolith/lib/Block/month.php index 708b52a6c..e280f8fa8 100644 --- a/kronolith/lib/Block/month.php +++ b/kronolith/lib/Block/month.php @@ -112,8 +112,6 @@ class Horde_Block_Kronolith_month extends Horde_Block { $startDate = new Horde_Date(array('year' => $year, 'month' => $month, 'mday' => $startOfView)); $endDate = new Horde_Date(array('year' => $year, 'month' => $month, 'mday' => $startOfView + $daysInView, 'hour' => 23, 'min' => 59, 'sec' => 59)); - $startDate->correct(); - $endDate->correct(); /* Table start. and current month indicator. */ $html = ''; diff --git a/kronolith/lib/Block/monthlist.php b/kronolith/lib/Block/monthlist.php index b0af31039..f87c7583b 100644 --- a/kronolith/lib/Block/monthlist.php +++ b/kronolith/lib/Block/monthlist.php @@ -71,7 +71,6 @@ class Horde_Block_Kronolith_monthlist extends Horde_Block { $startDate = new Horde_Date(array('year' => date('Y'), 'month' => date('n'), 'mday' => date('j'))); $endDate = new Horde_Date(array('year' => date('Y'), 'month' => date('n') + $this->_params['months'], 'mday' => date('j') - 1)); - $endDate->correct(); if (isset($this->_params['calendar']) && $this->_params['calendar'] != '__all') { $calendar = $GLOBALS['kronolith_shares']->getShare($this->_params['calendar']); diff --git a/kronolith/lib/Block/prevmonthlist.php b/kronolith/lib/Block/prevmonthlist.php index 89d77924f..4e86767f6 100644 --- a/kronolith/lib/Block/prevmonthlist.php +++ b/kronolith/lib/Block/prevmonthlist.php @@ -62,9 +62,7 @@ class Horde_Block_Kronolith_prevmonthlist extends Horde_Block { Horde::addScriptFile('tooltip.js', 'horde', true); $startDate = new Horde_Date(array('year' => date('Y'), 'month' => date('n') - $this->_params['months'], 'mday' => date('j'))); - $startDate->correct(); $endDate = new Horde_Date(array('year' => date('Y'), 'month' => date('n'), 'mday' => date('j') - 1)); - $endDate->correct(); $current_month = ''; diff --git a/kronolith/lib/Block/summary.php b/kronolith/lib/Block/summary.php index 8492ca574..46e277a94 100644 --- a/kronolith/lib/Block/summary.php +++ b/kronolith/lib/Block/summary.php @@ -68,7 +68,6 @@ class Horde_Block_Kronolith_summary extends Horde_Block { $startDate = new Horde_Date(array('year' => date('Y'), 'month' => date('n'), 'mday' => date('j'))); $endDate = new Horde_Date(array('year' => date('Y'), 'month' => date('n'), 'mday' => date('j') + $prefs->getValue('summary_days'))); - $endDate->correct(); if (isset($this->_params['calendar']) && $this->_params['calendar'] != '__all') { diff --git a/kronolith/lib/Day.php b/kronolith/lib/Day.php index 10c46c898..b25f24188 100644 --- a/kronolith/lib/Day.php +++ b/kronolith/lib/Day.php @@ -57,7 +57,6 @@ class Kronolith_Day extends Horde_Date { $day = date('j'); } parent::Horde_Date(array('year' => $year, 'month' => $month, 'mday' => $day)); - $this->correct(); $this->_slotsPerHour = $GLOBALS['prefs']->getValue('slots_per_hour'); if (!$this->_slotsPerHour) { @@ -78,7 +77,6 @@ class Kronolith_Day extends Horde_Date { $date = new Horde_Date(array('month' => $this->month, 'mday' => $this->mday + $offset, 'year' => $this->year)); - $date->correct(); return $date->strftime($format); } @@ -87,7 +85,6 @@ class Kronolith_Day extends Horde_Date { $date = new Horde_Date(array('month' => $this->month, 'mday' => $this->mday + 1, 'year' => $this->year)); - $date->correct(); return $date; } @@ -96,7 +93,6 @@ class Kronolith_Day extends Horde_Date { $date = new Horde_Date(array('month' => $this->month, 'mday' => $this->mday - 1, 'year' => $this->year)); - $date->correct(); return $date; } @@ -110,7 +106,6 @@ class Kronolith_Day extends Horde_Date { $date = new Horde_Date(array('month' => $this->month, 'mday' => $this->mday - 1, 'year' => $this->year)); - $date->correct(); return $date->compareDate(new Horde_Date(mktime(0, 0, 0))) == 0; } diff --git a/kronolith/lib/Driver.php b/kronolith/lib/Driver.php index 27c57272b..ef3b7b0ac 100644 --- a/kronolith/lib/Driver.php +++ b/kronolith/lib/Driver.php @@ -769,7 +769,6 @@ class Kronolith_Event { if ($v1) { $alarm = new Horde_Date($this->start); $alarm->min -= $this->alarm; - $alarm->correct(); $vEvent->setAttribute('AALARM', $alarm); } else { $vAlarm = &Horde_iCalendar::newComponent('valarm', $vEvent); @@ -920,7 +919,6 @@ class Kronolith_Event { array('year' => (int)$this->end->year, 'month' => (int)$this->end->month, 'mday' => (int)$this->end->mday + 1)); - $this->end->correct(); } } elseif (is_array($end) && !is_a($end, 'PEAR_Error')) { // Date field @@ -928,21 +926,18 @@ class Kronolith_Event { array('year' => (int)$end['year'], 'month' => (int)$end['month'], 'mday' => (int)$end['mday'])); - $this->end->correct(); } } else { $duration = $vEvent->getAttribute('DURATION'); if (!is_array($duration) && !is_a($duration, 'PEAR_Error')) { $this->end = new Horde_Date($this->start); $this->end->sec += $duration; - $this->end->correct(); } else { // End date equal to start date as per RFC 2445. $this->end = new Horde_Date($this->start); if (is_array($start)) { // Date field $this->end->mday++; - $this->end->correct(); } } } @@ -1116,7 +1111,6 @@ class Kronolith_Event { $hash['duration'] = ($weeks * 60 * 60 * 24 * 7) + ($days * 60 * 60 * 24) + ($hours * 60 * 60) + ($minutes * 60) + $seconds; $this->end = new Horde_Date($this->start); $this->end->sec += $hash['duration']; - $this->end->correct(); } if (!empty($hash['end_date'])) { $date = explode('-', $hash['end_date']); @@ -1206,7 +1200,6 @@ class Kronolith_Event { $methods = !empty($this->methods) ? $this->methods : @unserialize($prefs->getValue('event_alarms')); $start = Util::cloneObject($this->start); $start->min -= $this->getAlarm(); - $start->correct(); if (isset($methods['notify'])) { $methods['notify']['show'] = array( '__app' => $GLOBALS['registry']->getApp(), @@ -1791,7 +1784,6 @@ class Kronolith_Event { 'month' => $start_month, 'mday' => $start_day, 'year' => $start_year)); - $this->start->correct(); if (Util::getFormData('end_or_dur') == 1) { // Event duration. @@ -1800,7 +1792,6 @@ class Kronolith_Event { 'month' => $start_month, 'mday' => $start_day + $dur_day, 'year' => $start_year)); - $this->end->correct(); } else { // Event end. $end = Util::getFormData('end'); @@ -1826,7 +1817,6 @@ class Kronolith_Event { 'month' => $end_month, 'mday' => $end_day, 'year' => $end_year)); - $this->end->correct(); if ($this->end->compareDateTime($this->start) < 0) { $this->end = new Horde_Date($this->start); } diff --git a/kronolith/lib/Driver/holidays.php b/kronolith/lib/Driver/holidays.php index 457ff07d1..fe9e74d98 100644 --- a/kronolith/lib/Driver/holidays.php +++ b/kronolith/lib/Driver/holidays.php @@ -66,7 +66,7 @@ class Kronolith_Driver_holidays extends Kronolith_Driver { $events = array(); for ($date = new Horde_Date($startDate); $date->compareDate($endDate) <= 0; - $date->mday++, $date->correct()) { + $date->mday++) { $holidays = $dh->getHolidayForDate($date->timestamp(), null, true); if (Date_Holidays::isError($holidays)) { Horde::logMessage(sprintf('Unable to retrieve list of holidays from %s to %s', @@ -211,7 +211,6 @@ class Kronolith_Event_holidays extends Kronolith_Event { $this->start = new Horde_Date($dhEvent->_date->getTime()); $this->end = new Horde_Date($this->start); $this->end->mday++; - $this->end->correct(); } /** diff --git a/kronolith/lib/Driver/kolab.php b/kronolith/lib/Driver/kolab.php index 3124cf9c4..b97a2b937 100644 --- a/kronolith/lib/Driver/kolab.php +++ b/kronolith/lib/Driver/kolab.php @@ -39,14 +39,14 @@ class Kronolith_Driver_kolab extends Kronolith_Driver { */ function initialize() { - $this->_kolab = &new Kolab(); + $this->_kolab = new Kolab(); if (empty($this->_kolab->version)) { $wrapper = "Kronolith_Driver_kolab_wrapper_old"; } else { $wrapper = "Kronolith_Driver_kolab_wrapper_new"; } - $this->_wrapper = &new $wrapper($this); + $this->_wrapper = new $wrapper($this); return true; } @@ -99,7 +99,7 @@ class Kronolith_Driver_kolab extends Kronolith_Driver { return $this->_wrapper->listEvents($startDate, $endDate, $hasAlarm); } - function &getEvent($eventID = null) + function getEvent($eventID = null) { return $this->_wrapper->getEvent($eventID); } @@ -114,7 +114,7 @@ class Kronolith_Driver_kolab extends Kronolith_Driver { * * @return Kronolith_Event */ - function &getByUID($uid, $calendars = null, $getAll = false) + function getByUID($uid, $calendars = null, $getAll = false) { return $this->_wrapper->getByUID($uid, $calendars, $getAll); } @@ -210,8 +210,8 @@ class Kronolith_Driver_kolab_wrapper { */ function Kronolith_Driver_kolab_wrapper(&$driver) { - $this->_driver = &$driver; - $this->_kolab = &$driver->_kolab; + $this->_driver = $driver; + $this->_kolab = $driver->_kolab; } } @@ -282,7 +282,7 @@ class Kronolith_Driver_kolab_wrapper_old extends Kronolith_Driver_kolab_wrapper $events = array(); foreach ($allevents as $eventId) { - $event = &$this->getEvent($eventId); + $event = $this->getEvent($eventId); if (is_a($event, 'PEAR_Error')) { return $event; } @@ -294,7 +294,6 @@ class Kronolith_Driver_kolab_wrapper_old extends Kronolith_Driver_kolab_wrapper if (!$event->recurs()) { $start = new Horde_Date($event->start); $start->min -= $event->getAlarm(); - $start->correct(); if ($start->compareDateTime($date) <= 0 && $date->compareDateTime($event->end) <= -1) { $events[] = $fullevent ? $event : $eventId; @@ -306,13 +305,12 @@ class Kronolith_Driver_kolab_wrapper_old extends Kronolith_Driver_kolab_wrapper } $start = new Horde_Date($next); $start->min -= $event->getAlarm(); - $start->correct(); - $end = &new Horde_Date(array('year' => $next->year, - 'month' => $next->month, - 'mday' => $next->mday, - 'hour' => $event->end->hour, - 'min' => $event->end->min, - 'sec' => $event->end->sec)); + $end = new Horde_Date(array('year' => $next->year, + 'month' => $next->month, + 'mday' => $next->mday, + 'hour' => $event->end->hour, + 'min' => $event->end->min, + 'sec' => $event->end->sec)); if ($start->compareDateTime($date) <= 0 && $date->compareDateTime($end) <= -1) { if ($fullevent) { @@ -394,11 +392,10 @@ class Kronolith_Driver_kolab_wrapper_old extends Kronolith_Driver_kolab_wrapper return $events; } - function &getEvent($eventID = null) + function getEvent($eventID = null) { if (is_null($eventID)) { - $event = &new Kronolith_Event_kolab_old($this->_driver); - return $event; + return new Kronolith_Event_kolab_old($this->_driver); } $this->connect(); @@ -408,7 +405,7 @@ class Kronolith_Driver_kolab_wrapper_old extends Kronolith_Driver_kolab_wrapper return $result; } - $event = &new Kronolith_Event_kolab_old($this->_driver); + $event = new Kronolith_Event_kolab_old($this->_driver); $event->fromDriver($this); return $event; @@ -424,7 +421,7 @@ class Kronolith_Driver_kolab_wrapper_old extends Kronolith_Driver_kolab_wrapper * * @return Kronolith_Event */ - function &getByUID($uid, $calendars = null, $getAll = false) + function getByUID($uid, $calendars = null, $getAll = false) { if (!is_array($calendars)) { $calendars = array_keys(Kronolith::listCalendars(true, PERMS_READ)); @@ -434,14 +431,14 @@ class Kronolith_Driver_kolab_wrapper_old extends Kronolith_Driver_kolab_wrapper $this->_driver->open($calendar); $this->connect(); - $event = &$this->getEvent($uid); + $event = $this->getEvent($uid); if (is_a($event, 'PEAR_Error')) { continue; } if ($getAll) { $events = array(); - $events[] = &$event; + $events[] = $event; return $events; } else { return $event; @@ -475,7 +472,7 @@ class Kronolith_Driver_kolab_wrapper_old extends Kronolith_Driver_kolab_wrapper $this->_kolab->newObject($uid); } - $xml_hash = &$this->_kolab->getCurrentObject(); + $xml_hash = $this->_kolab->getCurrentObject(); $this->_kolab->setStr('summary', $event->getTitle()); $this->_kolab->setStr('body', $event->getDescription()); @@ -484,7 +481,7 @@ class Kronolith_Driver_kolab_wrapper_old extends Kronolith_Driver_kolab_wrapper $this->_kolab->setStr('sensitivity', 'private'); } - $organizer = &$this->_kolab->initRootElem('organizer'); + $organizer = $this->_kolab->initRootElem('organizer'); $this->_kolab->setElemStr($organizer, 'smtp-address', $event->getCreatorID()); $this->_kolab->setVal('alarm', $event->getAlarm()); @@ -514,7 +511,7 @@ class Kronolith_Driver_kolab_wrapper_old extends Kronolith_Driver_kolab_wrapper $this->_kolab->delAllRootElems('attendee'); foreach ($event->attendees as $email => $status) { - $attendee = &$this->_kolab->appendRootElem('attendee'); + $attendee = $this->_kolab->appendRootElem('attendee'); $this->_kolab->setElemVal($attendee, 'smtp-address', $email); switch ($status['response']) { @@ -556,7 +553,7 @@ class Kronolith_Driver_kolab_wrapper_old extends Kronolith_Driver_kolab_wrapper $range = 0; if ($event->recurs()) { - $recurrence = &$this->_kolab->initRootElem('recurrence'); + $recurrence = $this->_kolab->initRootElem('recurrence'); $this->_kolab->setElemVal($recurrence, 'interval', $event->recurrence->getRecurInterval()); switch ($event->recurrence->getRecurType()) { @@ -572,7 +569,7 @@ class Kronolith_Driver_kolab_wrapper_old extends Kronolith_Driver_kolab_wrapper for ($i = 0; $i <= 7 ; ++$i) { if ($event->recurrence->recurOnDay(pow(2, $i))) { - $day = &$this->_kolab->appendElem('day', $recurrence); + $day = $this->_kolab->appendElem('day', $recurrence); $day->set_content($days[$i]); } } @@ -632,7 +629,6 @@ class Kronolith_Driver_kolab_wrapper_old extends Kronolith_Driver_kolab_wrapper // fix off-by-one day $recur_end = $event->recurrence->getRecurEnd(); $recur_end->mday -= 1; - $recur_end->correct(); $range = Kolab::encodeDate($recur_end->timestamp()); } elseif ($event->recurrence->getRecurCount()) { $range_type = 'number'; @@ -642,13 +638,13 @@ class Kronolith_Driver_kolab_wrapper_old extends Kronolith_Driver_kolab_wrapper $range = ''; } - $range = &$this->_kolab->setElemVal($recurrence, 'range', $range); + $range = $this->_kolab->setElemVal($recurrence, 'range', $range); $range->set_attribute('type', $range_type); foreach ($event->recurrence->getExceptions() as $exception) { $extime = strtotime($exception); $exception = Kolab::encodeDate($extime); - $exclusion = &$this->_kolab->appendElem('exclusion', $recurrence); + $exclusion = $this->_kolab->appendElem('exclusion', $recurrence); $exclusion->set_content($exception); } } @@ -730,7 +726,7 @@ class Kronolith_Driver_kolab_wrapper_old extends Kronolith_Driver_kolab_wrapper $this->connect(); /* Fetch the event for later use. */ - $event = &$this->getEvent($eventID); + $event = $this->getEvent($eventID); if (is_a($event, 'PEAR_Error')) { return $event; } @@ -760,8 +756,8 @@ class Kronolith_Event_kolab_old extends Kronolith_Event { function fromDriver($dummy) { - $driver = &$this->getDriver(); - $kolab = &$driver->_kolab; + $driver = $this->getDriver(); + $kolab = $driver->_kolab; $this->eventID = $kolab->getUID(); $this->setUID($kolab->getUID()); @@ -774,7 +770,7 @@ class Kronolith_Event_kolab_old extends Kronolith_Event { $this->private = true; } - $organizer = &$kolab->getRootElem('organizer'); + $organizer = $kolab->getRootElem('organizer'); $this->creatorID = $kolab->getElemStr($organizer, 'smtp-address'); $this->alarm = $kolab->getVal('alarm'); @@ -846,7 +842,7 @@ class Kronolith_Event_kolab_old extends Kronolith_Event { $this->addAttendee($email, $role, $status, $kolab->getElemVal($attendee, 'display-name')); } - $recurrence = &$kolab->getRootElem('recurrence'); + $recurrence = $kolab->getRootElem('recurrence'); if ($recurrence !== false) { $this->recurrence = new Horde_Date_Recurrence($this->start); $cycle = $recurrence->get_attribute('cycle'); @@ -911,7 +907,7 @@ class Kronolith_Event_kolab_old extends Kronolith_Event { } } - $range = &$kolab->getElem('range', $recurrence); + $range = $kolab->getElem('range', $recurrence); $range_type = $range->get_attribute('type'); $range_val = $kolab->getElemVal($recurrence, 'range'); @@ -1010,13 +1006,13 @@ class Kronolith_Driver_kolab_wrapper_new extends Kronolith_Driver_kolab_wrapper if (is_a($result, 'PEAR_Error')) { return $result; } - $this->_store = &$this->_kolab->_storage; + $this->_store = $this->_kolab->_storage; // build internal event cache $this->_events_cache = array(); $events = $this->_store->getObjects(); - foreach($events as $event) { - $this->_events_cache[$event['uid']] = &new Kronolith_Event_kolab_new($this->_driver, $event); + foreach ($events as $event) { + $this->_events_cache[$event['uid']] = new Kronolith_Event_kolab_new($this->_driver, $event); } $this->_synchronized = true; @@ -1028,7 +1024,7 @@ class Kronolith_Driver_kolab_wrapper_new extends Kronolith_Driver_kolab_wrapper $events = array(); foreach ($allevents as $eventId) { - $event = &$this->getEvent($eventId); + $event = $this->getEvent($eventId); if (is_a($event, 'PEAR_Error')) { return $event; } @@ -1036,7 +1032,6 @@ class Kronolith_Driver_kolab_wrapper_new extends Kronolith_Driver_kolab_wrapper if (!$event->recurs()) { $start = new Horde_Date($event->start); $start->min -= $event->getAlarm(); - $start->correct(); if ($start->compareDateTime($date) <= 0 && $date->compareDateTime($event->end) <= -1) { $events[] = $fullevent ? $event : $eventId; @@ -1048,13 +1043,12 @@ class Kronolith_Driver_kolab_wrapper_new extends Kronolith_Driver_kolab_wrapper } $start = new Horde_Date($next); $start->min -= $event->getAlarm(); - $start->correct(); - $end = &new Horde_Date(array('year' => $next->year, - 'month' => $next->month, - 'mday' => $next->mday, - 'hour' => $event->end->hour, - 'min' => $event->end->min, - 'sec' => $event->end->sec)); + $end = new Horde_Date(array('year' => $next->year, + 'month' => $next->month, + 'mday' => $next->mday, + 'hour' => $event->end->hour, + 'min' => $event->end->min, + 'sec' => $event->end->sec)); if ($start->compareDateTime($date) <= 0 && $date->compareDateTime($end) <= -1) { if ($fullevent) { @@ -1121,10 +1115,10 @@ class Kronolith_Driver_kolab_wrapper_new extends Kronolith_Driver_kolab_wrapper } if (is_null($startDate)) { - $startDate = &new Horde_Date(array('mday' => 1, 'month' => 1, 'year' => 0000)); + $startDate = new Horde_Date(array('mday' => 1, 'month' => 1, 'year' => 0000)); } if (is_null($endDate)) { - $endDate = &new Horde_Date(array('mday' => 31, 'month' => 12, 'year' => 9999)); + $endDate = new Horde_Date(array('mday' => 31, 'month' => 12, 'year' => 9999)); } $ids = array(); @@ -1152,7 +1146,7 @@ class Kronolith_Driver_kolab_wrapper_new extends Kronolith_Driver_kolab_wrapper if ($next !== false) { $duration = $next->timestamp() - $event->start->timestamp(); - $next_end = &new Horde_Date($event->end->timestamp() + $duration); + $next_end = new Horde_Date($event->end->timestamp() + $duration); if ((!(($endDate->compareDateTime($next) < 0) || ($startDate->compareDateTime($next_end) > 0)))) { @@ -1169,11 +1163,10 @@ class Kronolith_Driver_kolab_wrapper_new extends Kronolith_Driver_kolab_wrapper return $ids; } - function &getEvent($eventId = null) + function getEvent($eventId = null) { if (is_null($eventId)) { - $event = &new Kronolith_Event_kolab_new($this->_driver); - return $event; + return new Kronolith_Event_kolab_new($this->_driver); } $result = $this->synchronize(); @@ -1198,7 +1191,7 @@ class Kronolith_Driver_kolab_wrapper_new extends Kronolith_Driver_kolab_wrapper * * @return Kronolith_Event */ - function &getByUID($uid, $calendars = null, $getAll = false) + function getByUID($uid, $calendars = null, $getAll = false) { if (!is_array($calendars)) { $calendars = array_keys(Kronolith::listCalendars(true, PERMS_READ)); @@ -1213,11 +1206,11 @@ class Kronolith_Driver_kolab_wrapper_new extends Kronolith_Driver_kolab_wrapper } // Ok, found event - $event = &$this->_events_cache[$uid]; + $event = $this->_events_cache[$uid]; if ($getAll) { $events = array(); - $events[] = &$event; + $events[] = $event; return $events; } else { return $event; @@ -1271,7 +1264,7 @@ class Kronolith_Driver_kolab_wrapper_new extends Kronolith_Driver_kolab_wrapper } /* Log the creation/modification of this item in the history log. */ - $history = &Horde_History::singleton(); + $history = Horde_History::singleton(); $history->log('kronolith:' . $event->getCalendar() . ':' . $event->getUID(), $action, true); // refresh IMAP cache @@ -1292,7 +1285,7 @@ class Kronolith_Driver_kolab_wrapper_new extends Kronolith_Driver_kolab_wrapper */ function move($eventId, $newCalendar) { - $event = &$this->getEvent($eventId); + $event = $this->getEvent($eventId); $result = $this->synchronize(); if (is_a($result, 'PEAR_Error')) { @@ -1300,7 +1293,7 @@ class Kronolith_Driver_kolab_wrapper_new extends Kronolith_Driver_kolab_wrapper } global $kronolith_shares; - $target = &$kronolith_shares->getShare($newCalendar); + $target = $kronolith_shares->getShare($newCalendar); $folder = $target->get('folder'); $result = $this->_store->move($eventId, $folder); @@ -1315,7 +1308,7 @@ class Kronolith_Driver_kolab_wrapper_new extends Kronolith_Driver_kolab_wrapper /* Log the moving of this item in the history log. */ $uid = $event->getUID(); - $history = &Horde_History::singleton(); + $history = Horde_History::singleton(); $history->log('kronolith:' . $event->getCalendar() . ':' . $uid, array('action' => 'delete'), true); $history->log('kronolith:' . $newCalendar . ':' . $uid, array('action' => 'add'), true); @@ -1379,7 +1372,7 @@ class Kronolith_Driver_kolab_wrapper_new extends Kronolith_Driver_kolab_wrapper return PEAR::raiseError(sprintf(_("Event not found: %s"), $eventId)); } - $event = &$this->getEvent($eventId); + $event = $this->getEvent($eventId); if ($this->_store->delete($eventId)) { // Notify about the deleted event. @@ -1391,7 +1384,7 @@ class Kronolith_Driver_kolab_wrapper_new extends Kronolith_Driver_kolab_wrapper } /* Log the deletion of this item in the history log. */ - $history = &Horde_History::singleton(); + $history = Horde_History::singleton(); $history->log('kronolith:' . $event->getCalendar() . ':' . $event->getUID(), array('action' => 'delete'), true); if (is_callable('Kolab', 'triggerFreeBusyUpdate')) { diff --git a/kronolith/lib/Driver/sql.php b/kronolith/lib/Driver/sql.php index 6b13ebd87..b70061836 100644 --- a/kronolith/lib/Driver/sql.php +++ b/kronolith/lib/Driver/sql.php @@ -43,7 +43,7 @@ class Kronolith_Driver_sql extends Kronolith_Driver { $events = array(); foreach ($allevents as $eventId) { - $event = &$this->getEvent($eventId); + $event = $this->getEvent($eventId); if (is_a($event, 'PEAR_Error')) { continue; } @@ -51,7 +51,6 @@ class Kronolith_Driver_sql extends Kronolith_Driver { if (!$event->recurs()) { $start = new Horde_Date($event->start); $start->min -= $event->getAlarm(); - $start->correct(); if ($start->compareDateTime($date) <= 0 && $date->compareDateTime($event->end) <= -1) { $events[] = $fullevent ? $event : $eventId; @@ -63,7 +62,6 @@ class Kronolith_Driver_sql extends Kronolith_Driver { } $start = new Horde_Date($next); $start->min -= $event->getAlarm(); - $start->correct(); $diff = Date_Calc::dateDiff($event->start->mday, $event->start->month, $event->start->year, @@ -79,7 +77,6 @@ class Kronolith_Driver_sql extends Kronolith_Driver { 'hour' => $event->end->hour, 'min' => $event->end->min, 'sec' => $event->end->sec)); - $end->correct(); if ($start->compareDateTime($date) <= 0 && $date->compareDateTime($end) <= -1) { if ($fullevent) { @@ -170,7 +167,7 @@ class Kronolith_Driver_sql extends Kronolith_Driver { $events = array(); foreach ($eventIds as $eventId) { - $event = &$this->getEvent($eventId); + $event = $this->getEvent($eventId); if (is_a($event, 'PEAR_Error')) { return $event; } @@ -337,7 +334,7 @@ class Kronolith_Driver_sql extends Kronolith_Driver { /* We have all the information we need to create an event * object for this event, so go ahead and cache it. */ - $this->_cache[$this->_calendar][$row['event_id']] = &new Kronolith_Event_sql($this, $row); + $this->_cache[$this->_calendar][$row['event_id']] = new Kronolith_Event_sql($this, $row); if ($row['event_recurtype'] == Horde_Date_Recurrence::RECUR_NONE) { $events[$row['event_uid']] = $row['event_id']; } else { @@ -353,11 +350,10 @@ class Kronolith_Driver_sql extends Kronolith_Driver { return $events; } - function &getEvent($eventId = null) + function getEvent($eventId = null) { if (is_null($eventId)) { - $event = &new Kronolith_Event_sql($this); - return $event; + return new Kronolith_Event_sql($this); } if (isset($this->_cache[$this->_calendar][$eventId])) { @@ -386,7 +382,7 @@ class Kronolith_Driver_sql extends Kronolith_Driver { } if ($event) { - $this->_cache[$this->_calendar][$eventId] = &new Kronolith_Event_sql($this, $event); + $this->_cache[$this->_calendar][$eventId] = new Kronolith_Event_sql($this, $event); return $this->_cache[$this->_calendar][$eventId]; } else { return PEAR::raiseError(_("Event not found")); @@ -403,7 +399,7 @@ class Kronolith_Driver_sql extends Kronolith_Driver { * * @return Kronolith_Event */ - function &getByUID($uid, $calendars = null, $getAll = false) + function getByUID($uid, $calendars = null, $getAll = false) { $query = 'SELECT event_id, event_uid, calendar_id, event_description,' . ' event_location, event_private, event_status, event_attendees,' . @@ -441,8 +437,8 @@ class Kronolith_Driver_sql extends Kronolith_Driver { $eventArray = array(); foreach ($events as $event) { $this->open($event['calendar_id']); - $this->_cache[$this->_calendar][$event['event_id']] = &new Kronolith_Event_sql($this, $event); - $eventArray[] = &$this->_cache[$this->_calendar][$event['event_id']]; + $this->_cache[$this->_calendar][$event['event_id']] = new Kronolith_Event_sql($this, $event); + $eventArray[] = $this->_cache[$this->_calendar][$event['event_id']]; } if ($getAll) { @@ -511,7 +507,7 @@ class Kronolith_Driver_sql extends Kronolith_Driver { /* Log the modification of this item in the history log. */ if ($event->getUID()) { - $history = &Horde_History::singleton(); + $history = Horde_History::singleton(); $history->log('kronolith:' . $this->_calendar . ':' . $event->getUID(), array('action' => 'modify'), true); } @@ -566,7 +562,7 @@ class Kronolith_Driver_sql extends Kronolith_Driver { } /* Log the creation of this item in the history log. */ - $history = &Horde_History::singleton(); + $history = Horde_History::singleton(); $history->log('kronolith:' . $this->_calendar . ':' . $uid, array('action' => 'add'), true); /* Notify users about the new event. */ @@ -588,7 +584,7 @@ class Kronolith_Driver_sql extends Kronolith_Driver { function move($eventId, $newCalendar) { /* Fetch the event for later use. */ - $event = &$this->getEvent($eventId); + $event = $this->getEvent($eventId); if (is_a($event, 'PEAR_Error')) { return $event; } @@ -611,7 +607,7 @@ class Kronolith_Driver_sql extends Kronolith_Driver { /* Log the moving of this item in the history log. */ $uid = $event->getUID(); if ($uid) { - $history = &Horde_History::singleton(); + $history = Horde_History::singleton(); $history->log('kronolith:' . $this->_calendar . ':' . $uid, array('action' => 'delete'), true); $history->log('kronolith:' . $newCalendar . ':' . $uid, array('action' => 'add'), true); } @@ -651,7 +647,7 @@ class Kronolith_Driver_sql extends Kronolith_Driver { function deleteEvent($eventId, $silent = false) { /* Fetch the event for later use. */ - $event = &$this->getEvent($eventId); + $event = $this->getEvent($eventId); if (is_a($event, 'PEAR_Error')) { return $event; } @@ -672,7 +668,7 @@ class Kronolith_Driver_sql extends Kronolith_Driver { /* Log the deletion of this item in the history log. */ if ($event->getUID()) { - $history = &Horde_History::singleton(); + $history = Horde_History::singleton(); $history->log('kronolith:' . $this->_calendar . ':' . $event->getUID(), array('action' => 'delete'), true); } @@ -716,9 +712,8 @@ class Kronolith_Driver_sql extends Kronolith_Driver { } /* Connect to the SQL server using the supplied parameters. */ - require_once 'DB.php'; - $this->_write_db = &DB::connect($this->_params, - array('persistent' => !empty($this->_params['persistent']))); + $this->_write_db = DB::connect($this->_params, + array('persistent' => !empty($this->_params['persistent']))); if (is_a($this->_write_db, 'PEAR_Error')) { return $this->_write_db; } @@ -728,15 +723,15 @@ class Kronolith_Driver_sql extends Kronolith_Driver { * seperately. */ if (!empty($this->_params['splitread'])) { $params = array_merge($this->_params, $this->_params['read']); - $this->_db = &DB::connect($params, - array('persistent' => !empty($params['persistent']))); + $this->_db = DB::connect($params, + array('persistent' => !empty($params['persistent']))); if (is_a($this->_db, 'PEAR_Error')) { return $this->_db; } $this->_initConn($this->_db); } else { /* Default to the same DB handle for the writer too. */ - $this->_db = &$this->_write_db; + $this->_db = $this->_write_db; } return true; @@ -861,7 +856,7 @@ class Kronolith_Event_sql extends Kronolith_Event { function fromDriver($SQLEvent) { - $driver = &$this->getDriver(); + $driver = $this->getDriver(); $this->allday = (bool)$SQLEvent['event_allday']; if (!$this->allday && $driver->getParam('utc')) { @@ -944,7 +939,7 @@ class Kronolith_Event_sql extends Kronolith_Event { function toDriver() { - $driver = &$this->getDriver(); + $driver = $this->getDriver(); /* Basic fields. */ $this->_properties['event_creator_id'] = $driver->convertToDriver($this->getCreatorId()); diff --git a/kronolith/lib/FreeBusy.php b/kronolith/lib/FreeBusy.php index a78f497e6..58eeae214 100644 --- a/kronolith/lib/FreeBusy.php +++ b/kronolith/lib/FreeBusy.php @@ -47,7 +47,6 @@ class Kronolith_FreeBusy { if (is_null($endstamp) || $endstamp < $startstamp) { $enddate = new Horde_Date($startstamp); $enddate->mday += $GLOBALS['prefs']->getValue('freebusy_days'); - $enddate->correct(); $endstamp = $enddate->timestamp(); } diff --git a/kronolith/lib/FreeBusy/View/Day.php b/kronolith/lib/FreeBusy/View/Day.php index 030d71c31..96dce8a45 100644 --- a/kronolith/lib/FreeBusy/View/Day.php +++ b/kronolith/lib/FreeBusy/View/Day.php @@ -20,10 +20,8 @@ class Kronolith_FreeBusy_View_Day extends Kronolith_FreeBusy_View { $prev = new Horde_Date($this->_start); $prev->mday--; - $prev->correct(); $next = new Horde_Date($this->_start); $next->mday++; - $next->correct(); return Horde::link('#', _("Previous Day"), '', '', 'return switchDate(' . $prev->dateString() . ');') . Horde::img('nav/left.png', '<', null, $registry->getImageDir('horde')) . '' diff --git a/kronolith/lib/FreeBusy/View/Month.php b/kronolith/lib/FreeBusy/View/Month.php index 08be0087c..24075dfe7 100644 --- a/kronolith/lib/FreeBusy/View/Month.php +++ b/kronolith/lib/FreeBusy/View/Month.php @@ -21,13 +21,10 @@ class Kronolith_FreeBusy_View_Month extends Kronolith_FreeBusy_View { $end = new Horde_Date($this->_start); $end->mday += $this->_days - 1; - $end->correct(); $prev = new Horde_Date($this->_start); $prev->month--; - $prev->correct(); $next = new Horde_Date($this->_start); $next->month++; - $next->correct(); return Horde::link('#', _("Previous Month"), '', '', 'return switchDate(' . $prev->dateString() . ');') . Horde::img('nav/left.png', '<', null, $registry->getImageDir('horde')) . '' @@ -56,7 +53,6 @@ class Kronolith_FreeBusy_View_Month extends Kronolith_FreeBusy_View { $span, $dayWidth, $week_label); $week++; $t->mday += 7; - $t->correct(); $span = min($span_left, 7); } $hours_html .= ''; diff --git a/kronolith/lib/FreeBusy/View/Week.php b/kronolith/lib/FreeBusy/View/Week.php index 8310b8860..a75e289d3 100644 --- a/kronolith/lib/FreeBusy/View/Week.php +++ b/kronolith/lib/FreeBusy/View/Week.php @@ -21,13 +21,10 @@ class Kronolith_FreeBusy_View_Week extends Kronolith_FreeBusy_View { $prev = new Horde_Date($this->_start); $prev->mday -= 7; - $prev->correct(); $next = new Horde_Date($this->_start); $next->mday += 7; - $next->correct(); $end = new Horde_Date($this->_start); $end->mday += $this->_days - 1; - $end->correct(); return Horde::link('#', _("Previous Week"), '', '', 'return switchDate(' . $prev->dateString() . ');') . Horde::img('nav/left.png', '<', null, $registry->getImageDir('horde')) . '' @@ -53,7 +50,6 @@ class Kronolith_FreeBusy_View_Week extends Kronolith_FreeBusy_View { $t = new Horde_Date(array('month' => $this->_start->month, 'mday' => $this->_start->mday + $i, 'year' => $this->_start->year)); - $t->correct(); $day_label = Horde::link('#', '', '', '', 'return switchDateView(\'day\',' . $t->dateString() . ');') . $t->strftime($date_format) . ''; $hours_html .= sprintf('', $span, $dayWidth, $day_label); @@ -87,7 +83,6 @@ class Kronolith_FreeBusy_View_Week extends Kronolith_FreeBusy_View { $this->_end->hour = 23; $this->_end->min = $this->_end->sec = 59; $this->_end->mday += $this->_days - 1; - $this->_end->correct(); } } diff --git a/kronolith/lib/Kronolith.php b/kronolith/lib/Kronolith.php index 2b196c01c..dbd381be2 100644 --- a/kronolith/lib/Kronolith.php +++ b/kronolith/lib/Kronolith.php @@ -1255,7 +1255,6 @@ class Kronolith { * starts. */ $next = Util::cloneObject($event->start); ++$next->mday; - $next->correct(); } /* Add all recurrences of the event. */ @@ -1269,7 +1268,6 @@ class Kronolith { $nextEnd->mday += $diff[2]; $nextEnd->hour += $diff[3]; $nextEnd->min += $diff[4]; - $nextEnd->correct(); Kronolith::_addCoverDates($results, $event, $next, $nextEnd); } $next = $event->recurrence->nextRecurrence( @@ -1359,7 +1357,6 @@ class Kronolith { array('month' => $eventStart->month, 'mday' => ++$i, 'year' => $eventStart->year)); - $loopDate->correct(); } } ksort($results); @@ -1392,7 +1389,6 @@ class Kronolith { array('month' => $eventStart->month, 'mday' => ++$i, 'year' => $eventStart->year)); - $loopDate->correct(); } } diff --git a/kronolith/lib/Maintenance/Task/purge_events.php b/kronolith/lib/Maintenance/Task/purge_events.php index 2d9f7e65f..659f1deb6 100644 --- a/kronolith/lib/Maintenance/Task/purge_events.php +++ b/kronolith/lib/Maintenance/Task/purge_events.php @@ -28,7 +28,6 @@ class Maintenance_Task_purge_events extends Maintenance_Task { * time prior to this time. */ $del_time = new Horde_Date($_SERVER['REQUEST_TIME']); $del_time->mday -= $prefs->getValue('purge_events_keep'); - $del_time->correct(); /* Need to have PERMS_DELETE on a calendar to delete events from it */ $calendars = Kronolith::listCalendars(false, PERMS_DELETE); diff --git a/kronolith/lib/Views/Day.php b/kronolith/lib/Views/Day.php index 1bba08c3d..bd5634a9e 100644 --- a/kronolith/lib/Views/Day.php +++ b/kronolith/lib/Views/Day.php @@ -221,7 +221,6 @@ class Kronolith_View_Day extends Kronolith_Day { 'year' => $this->year)); $end_slot = new Horde_Date($start); $end_slot->min += $this->_slotLength; - $end_slot->correct(); if (((!$day_hour_force || $i >= $day_hour_start) && $event->start->compareDateTime($start) >= 0 && $event->start->compareDateTime($end_slot) < 0 || @@ -358,7 +357,6 @@ class Kronolith_View_Day extends Kronolith_Day { 'year' => $this->year)); $end = clone $start; $end->min += $this->_slotLength; - $end->correct(); // Search through our events. foreach ($this->_events as $key => $event) { diff --git a/kronolith/lib/Views/Month.php b/kronolith/lib/Views/Month.php index dd7cd3a4d..df833dd23 100644 --- a/kronolith/lib/Views/Month.php +++ b/kronolith/lib/Views/Month.php @@ -96,8 +96,6 @@ class Kronolith_View_Month { 'hour' => 23, 'min' => 59, 'sec' => 59)); - $startDate->correct(); - $endDate->correct(); if ($prefs->getValue('show_shared_side_by_side')) { $allCalendars = Kronolith::listCalendars(); @@ -152,7 +150,6 @@ class Kronolith_View_Month { $cell = 0; for ($day = $this->_startOfView; $day < $this->_startOfView + $this->_daysInView; ++$day) { $date = new Kronolith_Day($this->month, $day, $this->year); - $date->correct(); $date->hour = $twentyFour ? 12 : 6; $week = $date->weekOfYear(); @@ -233,7 +230,6 @@ class Kronolith_View_Month { { $month = new Horde_Date($this->date); $month->month += $offset; - $month->correct(); return $month; } diff --git a/kronolith/lib/Views/Week.php b/kronolith/lib/Views/Week.php index 2cd3d5c27..43e6a4af2 100644 --- a/kronolith/lib/Views/Week.php +++ b/kronolith/lib/Views/Week.php @@ -68,11 +68,9 @@ class Kronolith_View_Week { $this->startDate = new Horde_Date($day); for ($i = $this->startDay; $i <= $this->endDay; ++$i) { - $day->correct(); $this->days[$i] = new Kronolith_View_Day($day, array()); $day->mday++; } - $day->correct(); $endDate = new Horde_Date($day); $allevents = Kronolith::listEvents($this->startDate, $endDate, $GLOBALS['display_calendars']); if (is_a($allevents, 'PEAR_Error')) { @@ -247,7 +245,6 @@ class Kronolith_View_Week { 'year' => $this->days[$j]->year)); $slot_end = new Horde_Date($start); $slot_end->min += $this->_slotLength; - $slot_end->correct(); if (((!$day_hour_force || $i >= $day_hour_start) && $event->start->compareDateTime($start) >= 0 && $event->start->compareDateTime($slot_end) < 0 || @@ -339,7 +336,6 @@ class Kronolith_View_Week { { $week = new Horde_Date($this->startDate); $week->mday += $offset * 7; - $week->correct(); return $week; } diff --git a/kronolith/new.php b/kronolith/new.php index fa626c8bb..98a6433ff 100644 --- a/kronolith/new.php +++ b/kronolith/new.php @@ -57,7 +57,6 @@ if (Util::getFormData('allday')) { } else { $event->end->hour++; } -$event->end->correct(); $month = $event->start->month; $year = $event->start->year; diff --git a/kronolith/search.php b/kronolith/search.php index d5353c279..3e6f9218c 100644 --- a/kronolith/search.php +++ b/kronolith/search.php @@ -39,7 +39,6 @@ if ($search_mode != 'basic') { $event->start = new Horde_Date(mktime(0, 0, 0)); $event->end = new Horde_Date($event->start); $event->end->mday++; - $event->end->correct(); /* We need to set the event to initialized, otherwise we will end up with * a default end date. */ @@ -110,7 +109,6 @@ if (isset($events)) { $start = $found->recurs() ? $found->recurrence->nextRecurrence($event->start) : $found->start; $end = new Horde_Date($start); $end->min += $found->durMin; - $end->correct(); require KRONOLITH_TEMPLATES . '/search/event_summaries.inc'; } require KRONOLITH_TEMPLATES . '/search/event_footers.inc'; -- 2.11.0
 %s