PHP5-ify
authorJan Schneider <jan@horde.org>
Thu, 26 Feb 2009 11:10:03 +0000 (12:10 +0100)
committerJan Schneider <jan@horde.org>
Thu, 26 Feb 2009 11:10:03 +0000 (12:10 +0100)
kronolith/lib/Driver.php
kronolith/lib/Driver/holidays.php
kronolith/lib/Driver/ical.php
kronolith/lib/Driver/kolab.php
kronolith/lib/Driver/sql.php

index fc74b2b..6e824cd 100644 (file)
@@ -7,28 +7,28 @@
  * @author  Jan Schneider <jan@horde.org>
  * @package Kronolith
  */
-class Kronolith_Driver {
-
+class Kronolith_Driver
+{
     /**
      * A hash containing any parameters for the current driver.
      *
      * @var array
      */
-    var $_params = array();
+    protected $_params = array();
 
     /**
      * The current calendar.
      *
      * @var string
      */
-    var $_calendar;
+    protected $_calendar;
 
     /**
      * An error message to throw when something is wrong.
      *
      * @var string
      */
-    var $_errormsg;
+    private $_errormsg;
 
     /**
      * Constructor.
@@ -38,7 +38,7 @@ class Kronolith_Driver {
      *
      * @param array $params  Any parameters needed for this driver.
      */
-    function Kronolith_Driver($params = array(), $errormsg = null)
+    public function __construct($params = array(), $errormsg = null)
     {
         $this->_params = $params;
         if ($errormsg === null) {
@@ -55,12 +55,12 @@ class Kronolith_Driver {
      *
      * @return mixed  The parameter value or null if not set.
      */
-    function getParam($param)
+    public function getParam($param)
     {
         return isset($this->_params[$param]) ? $this->_params[$param] : null;
     }
 
-    function open($calendar)
+    public function open($calendar)
     {
         $this->_calendar = $calendar;
     }
@@ -70,7 +70,7 @@ class Kronolith_Driver {
      *
      * @return string  The current calendar name.
      */
-    function getCalendar()
+    public function getCalendar()
     {
         return $this->_calendar;
     }
@@ -83,7 +83,7 @@ class Kronolith_Driver {
      *
      * @return string  A nice unique string (should be 255 chars or less).
      */
-    function generateUID()
+    public function generateUID()
     {
         return date('YmdHis') . '.'
             . substr(str_pad(base_convert(microtime(), 10, 36), 16, uniqid(mt_rand()), STR_PAD_LEFT), -16)
@@ -98,7 +98,7 @@ class Kronolith_Driver {
      *
      * @return mixed  True or a PEAR_Error on failure.
      */
-    function rename($from, $to)
+    public function rename($from, $to)
     {
         return true;
     }
@@ -111,7 +111,7 @@ class Kronolith_Driver {
      *
      * @return mixed  An array of Kronolith_Events or a PEAR_Error.
      */
-    function search($query)
+    public function search($query)
     {
         /* Our default implementation first gets <em>all</em> events in a
          * specific period, and then filters based on the actual values that
@@ -163,7 +163,7 @@ class Kronolith_Driver {
      * @return Horde_Date|boolean  The date of the next recurrence or false if
      *                             the event does not recur after $afterDate.
      */
-    function nextRecurrence($eventId, $afterDate)
+    public function nextRecurrence($eventId, $afterDate)
     {
         $event = &$this->getEvent($eventId);
         if (is_a($event, 'PEAR_Error')) {
@@ -186,7 +186,7 @@ class Kronolith_Driver {
      * @return Kronolith_Driver  The newly created concrete Kronolith_Driver
      *                           instance, or a PEAR_Error on error.
      */
-    function factory($driver = null, $params = null)
+    public function factory($driver = null, $params = null)
     {
         if ($driver === null) {
             $driver = $GLOBALS['conf']['calendar']['driver'];
@@ -215,7 +215,7 @@ class Kronolith_Driver {
     /**
      * Stub to initiate a driver.
      */
-    function initialize()
+    public function initialize()
     {
         return true;
     }
@@ -223,16 +223,23 @@ class Kronolith_Driver {
     /**
      * Stub to be overridden in the child class.
      */
-    function &getEvent()
+    public function getEvent()
     {
-        $error = PEAR::raiseError($this->_errormsg);
-        return $error;
+        return PEAR::raiseError($this->_errormsg);
+    }
+
+    /**
+     * Stub to be overridden in the child class.
+     */
+    public function getByUID($uid, $calendars = null, $getAll = false)
+    {
+        return PEAR::raiseError($this->_errormsg);
     }
 
     /**
      * Stub to be overridden in the child class.
      */
-    function listAlarms($date, $fullevent = false)
+    public function listAlarms($date, $fullevent = false)
     {
         return PEAR::raiseError($this->_errormsg);
     }
@@ -240,15 +247,15 @@ class Kronolith_Driver {
     /**
      * Stub to be overridden in the child class.
      */
-    function listEvents()
+    public function listEvents()
     {
         return PEAR::raiseError($this->_errormsg);
     }
 
     /**
-     * Stub o be overridden in the child class.
+     * Stub to be overridden in the child class.
      */
-    function saveEvent()
+    public function saveEvent()
     {
         return PEAR::raiseError($this->_errormsg);
     }
@@ -256,7 +263,39 @@ class Kronolith_Driver {
     /**
      * Stub for child class to override if it can implement.
      */
-    function removeUserData($user)
+    public function exists()
+    {
+        return PEAR::raiseError('Not supported');
+    }
+
+    /**
+     * Stub to be overridden in the child class.
+     */
+    public function move($eventId, $newCalendar)
+    {
+        return PEAR::raiseError('Not supported');
+    }
+
+    /**
+     * Stub to be overridden in the child class.
+     */
+    public function delete($calendar)
+    {
+        return PEAR::raiseError('Not supported');
+    }
+
+    /**
+     * Stub to be overridden in the child class.
+     */
+    public function deleteEvent($eventId)
+    {
+        return PEAR::raiseError('Not supported');
+    }
+
+    /**
+     * Stub for child class to override if it can implement.
+     */
+    public function removeUserData($user)
     {
         return PEAR::raiseError(_("Removing user data is not supported with the current calendar storage backend."));
     }
@@ -270,106 +309,106 @@ class Kronolith_Driver {
  * @author  Jan Schneider <jan@horde.org>
  * @package Kronolith
  */
-class Kronolith_Event {
-
+class Kronolith_Event
+{
     /**
      * Flag that is set to true if this event has data from either a storage
      * backend or a form or other import method.
      *
      * @var boolean
      */
-    var $initialized = false;
+    public $initialized = false;
 
     /**
      * Flag that is set to true if this event exists in a storage driver.
      *
      * @var boolean
      */
-    var $stored = false;
+    public $stored = false;
 
     /**
      * The driver unique identifier for this event.
      *
      * @var string
      */
-    var $eventID = null;
+    public $eventID = null;
 
     /**
      * The UID for this event.
      *
      * @var string
      */
-    var $_uid = null;
+    protected $_uid = null;
 
     /**
      * The iCalendar SEQUENCE for this event.
      *
      * @var integer
      */
-    var $_sequence = null;
+    protected $_sequence = null;
 
     /**
      * The user id of the creator of the event.
      *
      * @var string
      */
-    var $creatorID = null;
+    public $creatorID = null;
 
     /**
      * The title of this event.
      *
      * @var string
      */
-    var $title = '';
+    public $title = '';
 
     /**
      * The location this event occurs at.
      *
      * @var string
      */
-    var $location = '';
+    public $location = '';
 
     /**
      * The status of this event.
      *
      * @var integer
      */
-    var $status = Kronolith::STATUS_CONFIRMED;
+    public $status = Kronolith::STATUS_CONFIRMED;
 
     /**
      * The description for this event
      *
      * @var string
      */
-    var $description = '';
+    public $description = '';
 
     /**
      * Remote description of this event (URL).
      *
      * @var string
      */
-    var $remoteUrl = '';
+    public $remoteUrl = '';
 
     /**
      * Remote calendar name.
      *
      * @var string
      */
-    var $remoteCal = '';
+    public $remoteCal = '';
 
     /**
      * Whether the event is private.
      *
      * @var boolean
      */
-    var $private = false;
+    public $private = false;
 
     /**
      * This tag's events.
      *
      * @var mixed  Array of tags or comma delimited string.
      */
-    var $tags = array();
+    public $tags = array();
 
     /**
      * All the attendees of this event.
@@ -381,84 +420,84 @@ class Kronolith_Event {
      *
      * @var array
      */
-    var $attendees = array();
+    public $attendees = array();
 
     /**
      * The start time of the event.
      *
      * @var Horde_Date
      */
-    var $start;
+    public $start;
 
     /**
      * The end time of the event.
      *
      * @var Horde_Date
      */
-    var $end;
+    public $end;
 
     /**
      * The duration of this event in minutes
      *
      * @var integer
      */
-    var $durMin = 0;
+    public $durMin = 0;
 
     /**
      * Whether this is an all-day event.
      *
      * @var boolean
      */
-    var $allday = false;
+    public $allday = false;
 
     /**
      * Number of minutes before the event starts to trigger an alarm.
      *
      * @var integer
      */
-    var $alarm = 0;
+    public $alarm = 0;
 
     /**
      * The particular alarm methods overridden for this event.
      *
      * @var array
      */
-    var $methods;
+    public $methods;
 
     /**
      * The identifier of the calender this event exists on.
      *
      * @var string
      */
-    var $_calendar;
+    protected $_calendar;
 
     /**
      * The HTML background color to be used for this event.
      *
      * @var string
      */
-    var $_backgroundColor;
+    protected $_backgroundColor;
 
     /**
      * The HTML foreground color to be used for this event.
      *
      * @var string
      */
-    var $_foregroundColor;
+    protected $_foregroundColor;
 
     /**
      * The VarRenderer class to use for printing select elements.
      *
      * @var Horde_UI_VarRenderer
      */
-    var $_varRenderer;
+    private $_varRenderer;
 
     /**
      * The Horde_Date_Recurrence class for this event.
      *
      * @var Horde_Date_Recurrence
      */
-    var $recurrence;
+    public $recurrence;
 
     /**
      * Constructor.
@@ -468,7 +507,7 @@ class Kronolith_Event {
      * @param mixed $eventObject        Backend specific event object
      *                                  that this will represent.
      */
-    function Kronolith_Event(&$driver, $eventObject = null)
+    public function __construct(&$driver, $eventObject = null)
     {
         static $alarm;
 
@@ -501,7 +540,7 @@ class Kronolith_Event {
      * @return Kronolith_Driver  A driver that this event can use to save
      *                           itself, etc.
      */
-    function &getDriver()
+    public function getDriver()
     {
         global $kronolith_driver;
         if ($kronolith_driver->getCalendar() != $this->_calendar) {
@@ -516,7 +555,7 @@ class Kronolith_Event {
      *
      * @return Horde_Share  This event's share.
      */
-    function &getShare()
+    public function getShare()
     {
         if (isset($GLOBALS['all_calendars'][$this->getCalendar()])) {
             $share = $GLOBALS['all_calendars'][$this->getCalendar()];
@@ -534,7 +573,7 @@ class Kronolith_Event {
      *
      * @return boolean
      */
-    function hasPermission($permission, $user = null)
+    public function hasPermission($permission, $user = null)
     {
         if ($user === null) {
             $user = Auth::getAuth();
@@ -561,7 +600,7 @@ class Kronolith_Event {
      *
      * @return mixed  True or a PEAR_Error on failure.
      */
-    function save()
+    public function save()
     {
         if (!$this->isInitialized()) {
             return PEAR::raiseError('Event not yet initialized');
@@ -592,7 +631,7 @@ class Kronolith_Event {
      *
      * @return Horde_iCalendar_vevent  The vEvent object for this event.
      */
-    function &toiCalendar(&$calendar)
+    public function toiCalendar(&$calendar)
     {
         $vEvent = &Horde_iCalendar::newComponent('vevent', $calendar);
         $v1 = $calendar->getAttribute('VERSION') == '1.0';
@@ -832,7 +871,7 @@ class Kronolith_Event {
      * @param Horde_iCalendar_vevent $vEvent  The iCalendar data to update
      *                                        from.
      */
-    function fromiCalendar($vEvent)
+    public function fromiCalendar($vEvent)
     {
         // Unique ID.
         $uid = $vEvent->getAttribute('UID');
@@ -1066,7 +1105,7 @@ class Kronolith_Event {
      *
      * @param array $hash  Array containing all the values.
      */
-    function fromHash($hash)
+    public function fromHash($hash)
     {
         // See if it's a new event.
         if ($this->getId() === null) {
@@ -1186,7 +1225,7 @@ class Kronolith_Event {
      *
      * @return array  Alarm hash or null.
      */
-    function toAlarm($time, $user = null, $prefs = null)
+    public function toAlarm($time, $user = null, $prefs = null)
     {
         if (!$this->getAlarm()) {
             return;
@@ -1259,7 +1298,7 @@ class Kronolith_Event {
      *
      * @return object  A simple object.
      */
-    function toJSON()
+    public function toJSON()
     {
         $json = new stdClass;
         $json->t = $this->getTitle();
@@ -1272,7 +1311,7 @@ class Kronolith_Event {
     /**
      * TODO
      */
-    function isInitialized()
+    public function isInitialized()
     {
         return $this->initialized;
     }
@@ -1280,7 +1319,7 @@ class Kronolith_Event {
     /**
      * TODO
      */
-    function isStored()
+    public function isStored()
     {
         return $this->stored;
     }
@@ -1292,7 +1331,7 @@ class Kronolith_Event {
      *
      * @return boolean  True if event exists, false otherwise.
      */
-    function exists()
+    public function exists()
     {
         if (!isset($this->_uid) || !isset($this->_calendar)) {
             return false;
@@ -1307,7 +1346,7 @@ class Kronolith_Event {
         }
     }
 
-    function getDuration()
+    public function getDuration()
     {
         static $duration = null;
         if (isset($duration)) {
@@ -1361,7 +1400,7 @@ class Kronolith_Event {
      *
      * @return boolean  True if this is a recurring event.
      */
-    function recurs()
+    public function recurs()
     {
         return isset($this->recurrence) &&
             !$this->recurrence->hasRecurType(Horde_Date_Recurrence::RECUR_NONE);
@@ -1372,7 +1411,7 @@ class Kronolith_Event {
      *
      * @return string  Human readable recurring type.
      */
-    function getRecurName()
+    public function getRecurName()
     {
         return $this->recurs()
             ? $this->recurrence->getRecurName()
@@ -1387,7 +1426,7 @@ class Kronolith_Event {
      *
      * @return string  The formatted date and delete link.
      */
-    function exceptionLink($date)
+    public function exceptionLink($date)
     {
         if (!preg_match('/(\d{4})(\d{2})(\d{2})/', $date, $match)) {
             return '';
@@ -1408,22 +1447,22 @@ class Kronolith_Event {
      *
      * @return string  List of exception dates and delete links.
      */
-    function exceptionsList()
+    public function exceptionsList()
     {
         return implode(', ', array_map(array($this, 'exceptionLink'), $this->recurrence->getExceptions()));
     }
 
-    function getCalendar()
+    public function getCalendar()
     {
         return $this->_calendar;
     }
 
-    function setCalendar($calendar)
+    public function setCalendar($calendar)
     {
         $this->_calendar = $calendar;
     }
 
-    function isRemote()
+    public function isRemote()
     {
         return (bool)$this->remoteCal;
     }
@@ -1433,7 +1472,7 @@ class Kronolith_Event {
      *
      * @return string  The local identifier for this event.
      */
-    function getId()
+    public function getId()
     {
         return $this->eventID;
     }
@@ -1443,7 +1482,7 @@ class Kronolith_Event {
      *
      * @param string $eventId  The local identifier for this event.
      */
-    function setId($eventId)
+    public function setId($eventId)
     {
         if (substr($eventId, 0, 10) == 'kronolith:') {
             $eventId = substr($eventId, 10);
@@ -1456,7 +1495,7 @@ class Kronolith_Event {
      *
      * @return string  The global UID for this event.
      */
-    function getUID()
+    public function getUID()
     {
         return $this->_uid;
     }
@@ -1466,7 +1505,7 @@ class Kronolith_Event {
      *
      * @param string $uid  The global UID for this event.
      */
-    function setUID($uid)
+    public function setUID($uid)
     {
         $this->_uid = $uid;
     }
@@ -1476,7 +1515,7 @@ class Kronolith_Event {
      *
      * @return integer  The sequence for this event.
      */
-    function getSequence()
+    public function getSequence()
     {
         return $this->_sequence;
     }
@@ -1486,7 +1525,7 @@ class Kronolith_Event {
      *
      * @return string  The creator id
      */
-    function getCreatorId()
+    public function getCreatorId()
     {
         return !empty($this->creatorID) ? $this->creatorID : Auth::getAuth();
     }
@@ -1496,7 +1535,7 @@ class Kronolith_Event {
      *
      * @param string $creatorID  The user id for the user who created the event
      */
-    function setCreatorId($creatorID)
+    public function setCreatorId($creatorID)
     {
         $this->creatorID = $creatorID;
     }
@@ -1508,7 +1547,7 @@ class Kronolith_Event {
      *
      * @return string  The title of this event.
      */
-    function getTitle($user = null)
+    public function getTitle($user = null)
     {
         if (isset($this->external) ||
             isset($this->contactID) ||
@@ -1544,7 +1583,7 @@ class Kronolith_Event {
      *
      * @param string  The new title for this event.
      */
-    function setTitle($title)
+    public function setTitle($title)
     {
         $this->title = $title;
     }
@@ -1554,7 +1593,7 @@ class Kronolith_Event {
      *
      * @return string  The description of this event.
      */
-    function getDescription()
+    public function getDescription()
     {
         return $this->description;
     }
@@ -1564,7 +1603,7 @@ class Kronolith_Event {
      *
      * @param string $description  The new description for this event.
      */
-    function setDescription($description)
+    public function setDescription($description)
     {
         $this->description = $description;
     }
@@ -1574,7 +1613,7 @@ class Kronolith_Event {
      *
      * @return string  The location of this event.
      */
-    function getLocation()
+    public function getLocation()
     {
         return $this->location;
     }
@@ -1584,7 +1623,7 @@ class Kronolith_Event {
      *
      * @param string $location  The new location for this event.
      */
-    function setLocation($location)
+    public function setLocation($location)
     {
         $this->location = $location;
     }
@@ -1594,7 +1633,7 @@ class Kronolith_Event {
      *
      * @return boolean  Whether this even is private.
      */
-    function isPrivate()
+    public function isPrivate()
     {
         return $this->private;
     }
@@ -1604,7 +1643,7 @@ class Kronolith_Event {
      *
      * @param boolean $private  Whether this event should be marked private.
      */
-    function setPrivate($private)
+    public function setPrivate($private)
     {
         $this->private = !empty($private);
     }
@@ -1614,7 +1653,7 @@ class Kronolith_Event {
      *
      * @return integer  The status of this event.
      */
-    function getStatus()
+    public function getStatus()
     {
         return $this->status;
     }
@@ -1626,7 +1665,7 @@ class Kronolith_Event {
      *
      * @return boolean  True if the events status is the same as $status.
      */
-    function hasStatus($status)
+    public function hasStatus($status)
     {
         return ($status == $this->status);
     }
@@ -1636,7 +1675,7 @@ class Kronolith_Event {
      *
      * @param integer $status  The new event status.
      */
-    function setStatus($status)
+    public function setStatus($status)
     {
         $this->status = $status;
     }
@@ -1646,7 +1685,7 @@ class Kronolith_Event {
      *
      * @return array  A copy of the attendees array.
      */
-    function getAttendees()
+    public function getAttendees()
     {
         return $this->attendees;
     }
@@ -1660,7 +1699,7 @@ class Kronolith_Event {
      * @return boolean  True if the specified attendee is present for this
      *                  event.
      */
-    function hasAttendee($email)
+    public function hasAttendee($email)
     {
         $email = String::lower($email);
         return isset($this->attendees[$email]);
@@ -1672,7 +1711,7 @@ class Kronolith_Event {
      * @param array $attendees  The new attendees array. This should be of the
      *                          correct format to avoid driver problems.
      */
-    function setAttendees($attendees)
+    public function setAttendees($attendees)
     {
         $this->attendees = array_change_key_case($attendees);
     }
@@ -1688,7 +1727,7 @@ class Kronolith_Event {
      * @param integer $response    The response code of the attendee.
      * @param string $name         The name of the attendee.
      */
-    function addAttendee($email, $attendance, $response, $name = null)
+    public function addAttendee($email, $attendance, $response, $name = null)
     {
         $email = String::lower($email);
         if ($attendance == Kronolith::PART_IGNORE) {
@@ -1715,7 +1754,7 @@ class Kronolith_Event {
      *
      * @param string $email  The email address of the attendee.
      */
-    function removeAttendee($email)
+    public function removeAttendee($email)
     {
         $email = String::lower($email);
         if (isset($this->attendees[$email])) {
@@ -1723,7 +1762,7 @@ class Kronolith_Event {
         }
     }
 
-    function isAllDay()
+    public function isAllDay()
     {
         return $this->allday ||
             ($this->start->hour == 0 && $this->start->min == 0 && $this->start->sec == 0 &&
@@ -1734,17 +1773,17 @@ class Kronolith_Event {
               $this->end->year > $this->start->year));
     }
 
-    function getAlarm()
+    public function getAlarm()
     {
         return $this->alarm;
     }
 
-    function setAlarm($alarm)
+    public function setAlarm($alarm)
     {
         $this->alarm = $alarm;
     }
 
-    function readForm()
+    public function readForm()
     {
         global $prefs, $cManager;
 
@@ -1968,7 +2007,7 @@ class Kronolith_Event {
         $this->initialized = true;
     }
 
-    function html($property)
+    public function html($property)
     {
         global $prefs;
 
@@ -2153,7 +2192,7 @@ class Kronolith_Event {
             '</select>';
     }
 
-    function js($property)
+    public function js($property)
     {
         switch ($property) {
         case 'start[month]':
@@ -2186,7 +2225,7 @@ class Kronolith_Event {
      *
      * @return string
      */
-    function getViewUrl($params = array(), $full = false)
+    public function getViewUrl($params = array(), $full = false)
     {
         $params['eventID'] = $this->eventID;
         if ($this->remoteUrl) {
@@ -2206,7 +2245,7 @@ class Kronolith_Event {
      *
      * @return string
      */
-    function getEditUrl($params = array())
+    public function getEditUrl($params = array())
     {
         $params['view'] = 'EditEvent';
         $params['eventID'] = $this->eventID;
@@ -2225,7 +2264,7 @@ class Kronolith_Event {
      *
      * @return string
      */
-    function getDeleteUrl($params = array())
+    public function getDeleteUrl($params = array())
     {
         $params['view'] = 'DeleteEvent';
         $params['eventID'] = $this->eventID;
@@ -2238,7 +2277,7 @@ class Kronolith_Event {
      *
      * @return string
      */
-    function getExportUrl($params = array())
+    public function getExportUrl($params = array())
     {
         $params['view'] = 'ExportEvent';
         $params['eventID'] = $this->eventID;
@@ -2252,7 +2291,7 @@ class Kronolith_Event {
         return Horde::applicationUrl(Util::addParameter('event.php', $params));
     }
 
-    function getLink($datetime = null, $icons = true, $from_url = null, $full = false)
+    public function getLink($datetime = null, $icons = true, $from_url = null, $full = false)
     {
         global $prefs, $registry;
 
@@ -2384,7 +2423,7 @@ class Kronolith_Event {
      *
      * @return string  A CSS string with color definitions.
      */
-    function getCSSColors($with_attribute = true)
+    public function getCSSColors($with_attribute = true)
     {
         $css = 'background-color:' . $this->_backgroundColor . ';color:' . $this->_foregroundColor;
         if ($with_attribute) {
@@ -2396,7 +2435,7 @@ class Kronolith_Event {
     /**
      * @return string  A tooltip for quick descriptions of this event.
      */
-    function getTooltip()
+    public function getTooltip()
     {
         $tooltip = $this->getTimeRange()
             . "\n" . sprintf(_("Owner: %s"), ($this->getCreatorId() == Auth::getAuth() ?
@@ -2419,7 +2458,7 @@ class Kronolith_Event {
      * @return string  The time range of the event ("All Day", "1:00pm-3:00pm",
      *                 "08:00-22:00").
      */
-    function getTimeRange()
+    public function getTimeRange()
     {
         if ($this->isAllDay()) {
             return _("All day");
@@ -2443,7 +2482,7 @@ class Kronolith_Event {
     /**
      * @return string  The CSS class for the event based on its status.
      */
-    function getStatusClass()
+    public function getStatusClass()
     {
         switch ($this->status) {
         case Kronolith::STATUS_CANCELLED:
@@ -2457,7 +2496,7 @@ class Kronolith_Event {
         return 'event';
     }
 
-    function _formIDEncode($id)
+    private function _formIDEncode($id)
     {
         return str_replace(array('[', ']'),
                            array('_', ''),
index de41e7b..4823feb 100644 (file)
@@ -8,9 +8,10 @@
  * @package Kronolith
  */
 
-class Kronolith_Driver_holidays extends Kronolith_Driver {
+class Kronolith_Driver_holidays extends Kronolith_Driver
+{
 
-    function listAlarms($date, $fullevent = false)
+    public function listAlarms($date, $fullevent = false)
     {
         return array();
     }
@@ -29,7 +30,7 @@ class Kronolith_Driver_holidays extends Kronolith_Driver {
      *
      * @return array  An array of all holidays within the given datespan.
      */
-    function listEvents($startDate = null, $endDate = null, $hasAlarm = false)
+    public function listEvents($startDate = null, $endDate = null, $hasAlarm = false)
     {
         global $language;
 
@@ -61,7 +62,7 @@ class Kronolith_Driver_holidays extends Kronolith_Driver {
         return $events;
     }
 
-    function _getEvents($dh, $startDate, $endDate)
+    private function _getEvents($dh, $startDate, $endDate)
     {
         $events = array();
         for ($date = new Horde_Date($startDate);
@@ -87,72 +88,7 @@ class Kronolith_Driver_holidays extends Kronolith_Driver {
         return $events;
     }
 
-    function &getEvent($eventId = null)
-    {
-        return false;
-    }
-
-    /**
-     * Get an event or events with the given UID value.
-     *
-     * @param string $uid The UID to match
-     * @param array $calendars A restricted array of calendar ids to search
-     * @param boolean $getAll Return all matching events? If this is false,
-     * an error will be returned if more than one event is found.
-     *
-     * @return Kronolith_Event
-     */
-    function &getByUID($uid, $calendars = null, $getAll = false)
-    {
-        return PEAR::raiseError('Not supported');
-    }
-
-    function exists()
-    {
-        return PEAR::raiseError('Not supported');
-    }
-
-    function saveEvent($event)
-    {
-        return PEAR::raiseError('Not supported');
-    }
-
-    /**
-     * Moves an event to a new calendar.
-     *
-     * @param string $eventId      The event to move.
-     * @param string $newCalendar  The new calendar.
-     */
-    function move($eventId, $newCalendar)
-    {
-        return PEAR::raiseError('Not supported');
-    }
-
-    /**
-     * Deletes a calendar and all its events.
-     *
-     * @param string $calendar  The name of the calendar to delete.
-     *
-     * @return mixed  True or a PEAR_Error on failure.
-     */
-    function delete($calendar)
-    {
-        return PEAR::raiseError('Not supported');
-    }
-
-    /**
-     * Deletes an event.
-     *
-     * @param string $eventId  The ID of the event to delete.
-     *
-     * @return mixed  True or a PEAR_Error on failure.
-     */
-    function deleteEvent($eventId)
-    {
-        return PEAR::raiseError('Not supported');
-    }
-
-    function _getTranslationFile($driver)
+    private function _getTranslationFile($driver)
     {
         static $data_dir;
         if (!isset($data_dir)) {
@@ -179,21 +115,21 @@ class Kronolith_Driver_holidays extends Kronolith_Driver {
 
 }
 
-class Kronolith_Event_holidays extends Kronolith_Event {
-
+class Kronolith_Event_holidays extends Kronolith_Event
+{
     /**
      * The status of this event.
      *
      * @var integer
      */
-    var $status = Kronolith::STATUS_FREE;
+    public $status = Kronolith::STATUS_FREE;
 
     /**
      * Whether this is an all-day event.
      *
      * @var boolean
      */
-    var $allday = true;
+    public $allday = true;
 
     /**
      * Parse in an event from the driver.
@@ -201,7 +137,7 @@ class Kronolith_Event_holidays extends Kronolith_Event {
      * @param Date_Holidays_Holiday $dhEvent  A holiday returned
      *                                        from the driver
      */
-    function fromDriver($dhEvent)
+    public function fromDriver($dhEvent)
     {
         $this->stored = true;
         $this->initialized = true;
@@ -218,7 +154,7 @@ class Kronolith_Event_holidays extends Kronolith_Event {
      *
      * @return string The title of this event
      */
-    function getTitle()
+    public function getTitle()
     {
         return $this->title;
     }
@@ -231,7 +167,7 @@ class Kronolith_Event_holidays extends Kronolith_Event {
      *
      * @return boolean <code>true</code>
      */
-    function isAllDay()
+    public function isAllDay()
     {
         return true;
     }
index 55327bf..d633f28 100644 (file)
@@ -1,7 +1,4 @@
 <?php
-
-require_once 'Horde/iCalendar.php';
-
 /**
  * The Kronolith_Driver_ical:: class implements the Kronolith_Driver
  * API for iCalendar data.
@@ -16,17 +13,17 @@ require_once 'Horde/iCalendar.php';
  * @author  Jan Schneider <jan@horde.org>
  * @package Kronolith
  */
-class Kronolith_Driver_ical extends Kronolith_Driver {
-
+class Kronolith_Driver_ical extends Kronolith_Driver
+{
     /**
      * Cache events as we fetch them to avoid fetching or parsing the same
      * event twice.
      *
      * @var array
      */
-    var $_cache = array();
+    private $_cache = array();
 
-    function listAlarms($date, $fullevent = false)
+    public function listAlarms($date, $fullevent = false)
     {
         return array();
     }
@@ -42,7 +39,8 @@ class Kronolith_Driver_ical extends Kronolith_Driver {
      *
      * @return array  Events in the given time range.
      */
-    function listEvents($startDate = null, $endDate = null, $hasAlarm = false)
+    public function listEvents($startDate = null, $endDate = null,
+                               $hasAlarm = false)
     {
         $data = $this->_getRemoteCalendar();
         if (is_a($data, 'PEAR_Error')) {
@@ -108,7 +106,7 @@ class Kronolith_Driver_ical extends Kronolith_Driver {
         return $events;
     }
 
-    function getEvent($eventId = null)
+    public function getEvent($eventId = null)
     {
         $data = $this->_getRemoteCalendar();
         if (is_a($data, 'PEAR_Error')) {
@@ -126,7 +124,7 @@ class Kronolith_Driver_ical extends Kronolith_Driver {
             $event = new Kronolith_Event_ical($this);
             $event->status = Kronolith::STATUS_FREE;
             $event->fromiCalendar($components[$eventId]);
-            $event->remoteCal = $url;
+            $event->remoteCal = $this->_params['url'];
             $event->eventID = $eventId;
 
             return $event;
@@ -136,66 +134,6 @@ class Kronolith_Driver_ical extends Kronolith_Driver {
     }
 
     /**
-     * Get an event or events with the given UID value.
-     *
-     * @param string $uid The UID to match
-     * @param array $calendars A restricted array of calendar ids to search
-     * @param boolean $getAll Return all matching events? If this is false,
-     * an error will be returned if more than one event is found.
-     *
-     * @return Kronolith_Event
-     */
-    function &getByUID($uid, $calendars = null, $getAll = false)
-    {
-        return PEAR::raiseError('Not supported');
-    }
-
-    function exists()
-    {
-        return PEAR::raiseError('Not supported');
-    }
-
-    function saveEvent($event)
-    {
-        return PEAR::raiseError('Not supported');
-    }
-
-    /**
-     * Move an event to a new calendar.
-     *
-     * @param string $eventId      The event to move.
-     * @param string $newCalendar  The new calendar.
-     */
-    function move($eventId, $newCalendar)
-    {
-        return PEAR::raiseError('Not supported');
-    }
-
-    /**
-     * Delete a calendar and all its events.
-     *
-     * @param string $calendar  The name of the calendar to delete.
-     *
-     * @return mixed  True or a PEAR_Error on failure.
-     */
-    function delete($calendar)
-    {
-        return PEAR::raiseError('Not supported');
-    }
-
-    /**
-     * Delete an event.
-     *
-     * @param string $eventId  The ID of the event to delete.
-     *
-     * @return mixed  True or a PEAR_Error on failure.
-     */
-    function deleteEvent($eventId)
-    {
-        return PEAR::raiseError('Not supported');
-    }
-
-    /**
      * Fetches a remote calendar into the session and return the data.
      *
      * @return mixed  Either the calendar data, or an error on failure.
@@ -243,16 +181,17 @@ class Kronolith_Driver_ical extends Kronolith_Driver {
 
 }
 
-class Kronolith_Event_ical extends Kronolith_Event {
+class Kronolith_Event_ical extends Kronolith_Event
+{
 
-    function fromDriver($vEvent)
+    public function fromDriver($vEvent)
     {
         $this->fromiCalendar($vEvent);
         $this->initialized = true;
         $this->stored = true;
     }
 
-    function toDriver()
+    public function toDriver()
     {
         return $this->toiCalendar();
     }
index 9bda3e0..9d83e2e 100644 (file)
@@ -16,28 +16,28 @@ require_once 'Horde/Identity.php';
  * @author  Stuart Binge <omicron@mighty.co.za>
  * @package Kronolith
  */
-class Kronolith_Driver_kolab extends Kronolith_Driver {
-
+class Kronolith_Driver_kolab extends Kronolith_Driver
+{
     /**
      * Our Kolab server connection.
      *
      * @var Kolab
      */
-    var $_kolab = null;
+    private $_kolab = null;
 
     /**
      * The wrapper to decide between the Kolab implementation
      *
      * @var Kronolith_Driver_kolab_wrapper
      */
-    var $_wrapper = null;
+    private $_wrapper = null;
 
     /**
      * Attempts to open a Kolab Groupware folder.
      *
      * @return boolean  True on success, PEAR_Error on failure.
      */
-    function initialize()
+    public function initialize()
     {
         $this->_kolab = new Kolab();
         if (empty($this->_kolab->version)) {
@@ -54,7 +54,7 @@ class Kronolith_Driver_kolab extends Kronolith_Driver {
     /**
      * Change current calendar
      */
-    function open($calendar)
+    public function open($calendar)
     {
         if ($this->_calendar != $calendar) {
             $this->_calendar = $calendar;
@@ -64,7 +64,7 @@ class Kronolith_Driver_kolab extends Kronolith_Driver {
         return true;
     }
 
-    function listAlarms($date, $fullevent = false)
+    public function listAlarms($date, $fullevent = false)
     {
         return $this->_wrapper->listAlarms($date, $fullevent);
     }
@@ -78,7 +78,7 @@ class Kronolith_Driver_kolab extends Kronolith_Driver {
      *
      * @return mixed  Returns a string with event_id or false if not found.
      */
-    function exists($uid, $calendar_id = null)
+    public function exists($uid, $calendar_id = null)
     {
         return $this->_wrapper->exists($uid, $calendar_id);
     }
@@ -94,12 +94,12 @@ class Kronolith_Driver_kolab extends Kronolith_Driver {
      *
      * @return array  Events in the given time range.
      */
-    function listEvents($startDate = null, $endDate = null, $hasAlarm = false)
+    public function listEvents($startDate = null, $endDate = null, $hasAlarm = false)
     {
         return $this->_wrapper->listEvents($startDate, $endDate, $hasAlarm);
     }
 
-    function getEvent($eventID = null)
+    public function getEvent($eventID = null)
     {
         return $this->_wrapper->getEvent($eventID);
     }
@@ -114,12 +114,12 @@ class Kronolith_Driver_kolab extends Kronolith_Driver {
      *
      * @return Kronolith_Event
      */
-    function getByUID($uid, $calendars = null, $getAll = false)
+    public function getByUID($uid, $calendars = null, $getAll = false)
     {
         return $this->_wrapper->getByUID($uid, $calendars, $getAll);
     }
 
-    function saveEvent(&$event)
+    public function saveEvent(&$event)
     {
         return $this->_wrapper->saveEvent($event);
     }
@@ -130,7 +130,7 @@ class Kronolith_Driver_kolab extends Kronolith_Driver {
      * @param string $eventId      The event to move.
      * @param string $newCalendar  The new calendar.
      */
-    function move($eventID, $newCalendar)
+    public function move($eventID, $newCalendar)
     {
         return $this->_wrapper->move($eventID, $newCalendar);
     }
@@ -142,7 +142,7 @@ class Kronolith_Driver_kolab extends Kronolith_Driver {
      *
      * @return mixed  True or a PEAR_Error on failure.
      */
-    function delete($calendar)
+    public function delete($calendar)
     {
         return $this->_wrapper->delete($calendar);
     }
@@ -155,7 +155,7 @@ class Kronolith_Driver_kolab extends Kronolith_Driver {
      *
      * @return mixed  True or a PEAR_Error on failure.
      */
-    function rename($from, $to)
+    public function rename($from, $to)
     {
         return $this->_wrapper->rename($from, $to);
     }
@@ -167,14 +167,15 @@ class Kronolith_Driver_kolab extends Kronolith_Driver {
      *
      * @return mixed  True or a PEAR_Error on failure.
      */
-    function deleteEvent($eventID, $silent = false)
+    public function deleteEvent($eventID, $silent = false)
     {
         return $this->_wrapper->deleteEvent($eventID, $silent);
     }
 }
 
 /**
- * Horde Kronolith wrapper to distinguish between both Kolab driver implementations.
+ * Horde Kronolith wrapper to distinguish between both Kolab driver
+ * implementations.
  *
  * $Horde: kronolith/lib/Driver/kolab.php,v 1.77 2009/01/06 18:01:01 jan Exp $
  *
@@ -186,14 +187,14 @@ class Kronolith_Driver_kolab extends Kronolith_Driver {
  * @author  Gunnar Wrobel <wrobel@pardus.de>
  * @package Kronolith
  */
-
-class Kronolith_Driver_kolab_wrapper {
+class Kronolith_Driver_kolab_wrapper
+{
     /**
      * Our Kolab server connection.
      *
      * @var Kolab
      */
-    var $_kolab = null;
+    private $_kolab = null;
 
     /**
      * Link to the parent driver object
@@ -201,18 +202,19 @@ class Kronolith_Driver_kolab_wrapper {
      * @var Kronolith_Driver
      */
 
-    var $_driver = null;
+    private $_driver = null;
 
     /**
       * Constructor
       *
       * @param Kronolith_driver $driver     Reference to the Kronolith_Driver
       */
-    function Kronolith_Driver_kolab_wrapper(&$driver)
+    public function __contruct(&$driver)
     {
         $this->_driver = $driver;
         $this->_kolab = $driver->_kolab;
     }
+
 }
 
 
@@ -227,19 +229,19 @@ class Kronolith_Driver_kolab_wrapper {
  * @author  Stuart Binge <omicron@mighty.co.za>
  * @package Kronolith
  */
-class Kronolith_Driver_kolab_wrapper_old extends Kronolith_Driver_kolab_wrapper {
-
+class Kronolith_Driver_kolab_wrapper_old extends Kronolith_Driver_kolab_wrapper
+{
     /**
      * Indicates if the wrapper has connected or not
      *
      * @var boolean
      */
-    var $_connected = false;
+    private $_connected = false;
 
     /**
      * Reset internal variable on share change
      */
-    function reset()
+    public function reset()
     {
         $this->_connected = false;
     }
@@ -252,7 +254,7 @@ class Kronolith_Driver_kolab_wrapper_old extends Kronolith_Driver_kolab_wrapper
      *
      * @return mixed True on success, a PEAR error otherwise
      */
-    function connect()
+    public function connect()
     {
         if ($this->_connected) {
             return true;
@@ -268,7 +270,7 @@ class Kronolith_Driver_kolab_wrapper_old extends Kronolith_Driver_kolab_wrapper
         return true;
     }
 
-    function listAlarms($date, $fullevent = false)
+    public function listAlarms($date, $fullevent = false)
     {
         if (!$this->_kolab) {
             return array();
@@ -337,7 +339,7 @@ class Kronolith_Driver_kolab_wrapper_old extends Kronolith_Driver_kolab_wrapper
      *
      * @return mixed  Returns a string with event_id or false if not found.
      */
-    function exists($uid, $calendar_id = null)
+    public function exists($uid, $calendar_id = null)
     {
         $this->connect();
 
@@ -360,7 +362,7 @@ class Kronolith_Driver_kolab_wrapper_old extends Kronolith_Driver_kolab_wrapper
      *
      * @return array  Events in the given time range.
      */
-    function listEvents($startDate = null, $endDate = null, $hasAlarm = false)
+    public function listEvents($startDate = null, $endDate = null, $hasAlarm = false)
     {
         $this->connect();
 
@@ -392,7 +394,7 @@ class Kronolith_Driver_kolab_wrapper_old extends Kronolith_Driver_kolab_wrapper
         return $events;
     }
 
-    function getEvent($eventID = null)
+    public function getEvent($eventID = null)
     {
         if (is_null($eventID)) {
             return new Kronolith_Event_kolab_old($this->_driver);
@@ -421,7 +423,7 @@ class Kronolith_Driver_kolab_wrapper_old extends Kronolith_Driver_kolab_wrapper
      *
      * @return Kronolith_Event
      */
-    function getByUID($uid, $calendars = null, $getAll = false)
+    public function getByUID($uid, $calendars = null, $getAll = false)
     {
         if (!is_array($calendars)) {
             $calendars = array_keys(Kronolith::listCalendars(true, PERMS_READ));
@@ -448,7 +450,7 @@ class Kronolith_Driver_kolab_wrapper_old extends Kronolith_Driver_kolab_wrapper
         return PEAR::raiseError(sprintf(_("Event not found: %s"), $uid));
     }
 
-    function saveEvent(&$event)
+    public function saveEvent(&$event)
     {
         $this->connect();
 
@@ -673,7 +675,7 @@ class Kronolith_Driver_kolab_wrapper_old extends Kronolith_Driver_kolab_wrapper
      * @param string $eventId      The event to move.
      * @param string $newCalendar  The new calendar.
      */
-    function move($eventID, $newCalendar)
+    public function move($eventID, $newCalendar)
     {
         $this->connect();
 
@@ -694,7 +696,7 @@ class Kronolith_Driver_kolab_wrapper_old extends Kronolith_Driver_kolab_wrapper
      *
      * @return mixed  True or a PEAR_Error on failure.
      */
-    function delete($calendar)
+    public function delete($calendar)
     {
         // For the old code we don't care
         return true;
@@ -708,7 +710,7 @@ class Kronolith_Driver_kolab_wrapper_old extends Kronolith_Driver_kolab_wrapper
      *
      * @return mixed  True or a PEAR_Error on failure.
      */
-    function rename($from, $to)
+    public function rename($from, $to)
     {
         // For the old code we don't care
         return true;
@@ -721,7 +723,7 @@ class Kronolith_Driver_kolab_wrapper_old extends Kronolith_Driver_kolab_wrapper
      *
      * @return mixed  True or a PEAR_Error on failure.
      */
-    function deleteEvent($eventID, $silent = false)
+    public function deleteEvent($eventID, $silent = false)
     {
         $this->connect();
 
@@ -752,9 +754,10 @@ class Kronolith_Driver_kolab_wrapper_old extends Kronolith_Driver_kolab_wrapper
 
 }
 
-class Kronolith_Event_kolab_old extends Kronolith_Event {
+class Kronolith_Event_kolab_old extends Kronolith_Event
+{
 
-    function fromDriver($dummy)
+    public function fromDriver($dummy)
     {
         $driver = $this->getDriver();
         $kolab = $driver->_kolab;
@@ -934,7 +937,7 @@ class Kronolith_Event_kolab_old extends Kronolith_Event {
         $this->stored = true;
     }
 
-    function toDriver()
+    public function toDriver()
     {
     }
 
@@ -942,6 +945,7 @@ class Kronolith_Event_kolab_old extends Kronolith_Event {
 
 /**
  * Horde Kronolith driver for the Kolab IMAP Server.
+ *
  * Copyright 2004-2009 The Horde Project (http://www.horde.org/)
  *
  * See the enclosed file LICENSE for license information (ASL).  If you
@@ -951,33 +955,33 @@ class Kronolith_Event_kolab_old extends Kronolith_Event {
  * @author  Stuart Binge <omicron@mighty.co.za>
  * @package Kronolith
  */
-class Kronolith_Driver_kolab_wrapper_new extends Kronolith_Driver_kolab_wrapper {
-
+class Kronolith_Driver_kolab_wrapper_new extends Kronolith_Driver_kolab_wrapper
+{
     /**
      * Internal cache of Kronolith_Event_kolab_new. eventID/UID is key
      *
      * @var array
      */
-    var $_events_cache;
+    private $_events_cache;
 
     /**
      * Indicates if we have synchronized this folder
      *
      * @var boolean
      */
-    var $_synchronized;
+    private $_synchronized;
 
     /**
      * Shortcut to the imap connection
      *
      * @var Kolab_IMAP
      */
-    var $_store;
+    private $_store;
 
     /**
       * Constructor
       */
-    function Kronolith_Driver_kolab_wrapper_new(&$driver)
+    public function __construct($driver)
     {
         parent::Kronolith_Driver_kolab_wrapper($driver);
         $this->reset();
@@ -986,7 +990,7 @@ class Kronolith_Driver_kolab_wrapper_new extends Kronolith_Driver_kolab_wrapper
     /**
      * Reset internal variable on share change
      */
-    function reset()
+    public function reset()
     {
         $this->_events_cache = array();
         $this->_synchronized = false;
@@ -995,7 +999,7 @@ class Kronolith_Driver_kolab_wrapper_new extends Kronolith_Driver_kolab_wrapper
     // We delay initial synchronization to the first use
     // so multiple calendars don't add to the total latency.
     // This function must be called before all internal driver functions
-    function synchronize($force = false)
+    public function synchronize($force = false)
     {
         if ($this->_synchronized && !$force) {
             return;
@@ -1018,7 +1022,7 @@ class Kronolith_Driver_kolab_wrapper_new extends Kronolith_Driver_kolab_wrapper
         $this->_synchronized = true;
     }
 
-    function listAlarms($date, $fullevent = false)
+    public function listAlarms($date, $fullevent = false)
     {
         $allevents = $this->listEvents($date, null, true);
         $events = array();
@@ -1076,7 +1080,7 @@ class Kronolith_Driver_kolab_wrapper_new extends Kronolith_Driver_kolab_wrapper
      * @return string|boolean  Returns a string with event_id or false if
      *                         not found.
      */
-    function exists($uid, $calendar_id = null)
+    public function exists($uid, $calendar_id = null)
     {
         // Log error if someone uses this function in an unsupported way
         if ($calendar_id != $this->_driver->_calendar) {
@@ -1107,7 +1111,7 @@ class Kronolith_Driver_kolab_wrapper_new extends Kronolith_Driver_kolab_wrapper
      *
      * @return array  Events in the given time range.
      */
-    function listEvents($startDate = null, $endDate = null, $hasAlarm = false)
+    public function listEvents($startDate = null, $endDate = null, $hasAlarm = false)
     {
         $result = $this->synchronize();
         if (is_a($result, 'PEAR_Error')) {
@@ -1163,7 +1167,7 @@ class Kronolith_Driver_kolab_wrapper_new extends Kronolith_Driver_kolab_wrapper
         return $ids;
     }
 
-    function getEvent($eventId = null)
+    public function getEvent($eventId = null)
     {
         if (is_null($eventId)) {
             return new Kronolith_Event_kolab_new($this->_driver);
@@ -1191,7 +1195,7 @@ class Kronolith_Driver_kolab_wrapper_new extends Kronolith_Driver_kolab_wrapper
      *
      * @return Kronolith_Event
      */
-    function getByUID($uid, $calendars = null, $getAll = false)
+    public function getByUID($uid, $calendars = null, $getAll = false)
     {
         if (!is_array($calendars)) {
             $calendars = array_keys(Kronolith::listCalendars(true, PERMS_READ));
@@ -1228,7 +1232,7 @@ class Kronolith_Driver_kolab_wrapper_new extends Kronolith_Driver_kolab_wrapper
      *
      * @return mixed  UID on success, a PEAR error otherwise
      */
-    function saveEvent(&$event)
+    public function saveEvent(&$event)
     {
         $result = $this->synchronize();
         if (is_a($result, 'PEAR_Error')) {
@@ -1291,7 +1295,7 @@ class Kronolith_Driver_kolab_wrapper_new extends Kronolith_Driver_kolab_wrapper
      * @param string $eventId      The event to move.
      * @param string $newCalendar  The new calendar.
      */
-    function move($eventId, $newCalendar)
+    public function move($eventId, $newCalendar)
     {
         $event = $this->getEvent($eventId);
 
@@ -1330,7 +1334,7 @@ class Kronolith_Driver_kolab_wrapper_new extends Kronolith_Driver_kolab_wrapper
      *
      * @return mixed  True or a PEAR_Error on failure.
      */
-    function delete($calendar)
+    public function delete($calendar)
     {
         $this->_driver->open($calendar);
         $result = $this->synchronize();
@@ -1353,7 +1357,7 @@ class Kronolith_Driver_kolab_wrapper_new extends Kronolith_Driver_kolab_wrapper
      *
      * @return mixed  True or a PEAR_Error on failure.
      */
-    function rename($from, $to)
+    public function rename($from, $to)
     {
         // FIXME: We can't do much here. We'd need to be called after
         // renaming the share here. This needs to be checked again.
@@ -1369,7 +1373,7 @@ class Kronolith_Driver_kolab_wrapper_new extends Kronolith_Driver_kolab_wrapper
      *
      * @return mixed  True or a PEAR_Error on failure.
      */
-    function deleteEvent($eventId, $silent = false)
+    public function deleteEvent($eventId, $silent = false)
     {
         $result = $this->synchronize();
         if (is_a($result, 'PEAR_Error')) {
@@ -1412,9 +1416,10 @@ class Kronolith_Driver_kolab_wrapper_new extends Kronolith_Driver_kolab_wrapper
 /**
  * @package Kronolith
  */
-class Kronolith_Event_kolab_new extends Kronolith_Event {
+class Kronolith_Event_kolab_new extends Kronolith_Event
+{
 
-    function fromDriver($event)
+    public function fromDriver($event)
     {
         $this->eventID = $event['uid'];
         $this->setUID($this->eventID);
@@ -1530,7 +1535,7 @@ class Kronolith_Event_kolab_new extends Kronolith_Event {
         $this->stored = true;
     }
 
-    function toDriver()
+    public function toDriver()
     {
         $event = array();
         $event['uid'] = $this->getUID();
@@ -1641,4 +1646,5 @@ class Kronolith_Event_kolab_new extends Kronolith_Event {
 
         return $event;
     }
+
 }
index b8c0a83..ab2ab36 100644 (file)
@@ -1,20 +1,21 @@
 <?php
 /**
- * The Kronolith_Driver_sql:: class implements the Kronolith_Driver
- * API for a SQL backend.
+ * The Kronolith_Driver_sql:: class implements the Kronolith_Driver API for a
+ * SQL backend.
  *
  * @author  Luc Saillard <luc.saillard@fr.alcove.com>
  * @author  Chuck Hagenbuch <chuck@horde.org>
+ * @author  Jan Schneider <jan@horde.org>
  * @package Kronolith
  */
-class Kronolith_Driver_sql extends Kronolith_Driver {
-
+class Kronolith_Driver_sql extends Kronolith_Driver
+{
     /**
      * The object handle for the current database connection.
      *
      * @var DB
      */
-    var $_db;
+    private $_db;
 
     /**
      * Handle for the current database connection, used for writing. Defaults
@@ -22,7 +23,7 @@ class Kronolith_Driver_sql extends Kronolith_Driver {
      *
      * @var DB
      */
-    var $_write_db;
+    private $_write_db;
 
     /**
      * Cache events as we fetch them to avoid fetching the same event from the
@@ -30,9 +31,9 @@ class Kronolith_Driver_sql extends Kronolith_Driver {
      *
      * @var array
      */
-    var $_cache = array();
+    private $_cache = array();
 
-    function listAlarms($date, $fullevent = false)
+    public function listAlarms($date, $fullevent = false)
     {
         require_once 'Date/Calc.php';
 
@@ -94,7 +95,7 @@ class Kronolith_Driver_sql extends Kronolith_Driver {
         return is_array($events) ? $events : array();
     }
 
-    function search($query)
+    public function search($query)
     {
         require_once 'Horde/SQL.php';
 
@@ -187,7 +188,7 @@ class Kronolith_Driver_sql extends Kronolith_Driver {
      * @return string|boolean  Returns a string with event_id or false if
      *                         not found.
      */
-    function exists($uid, $calendar_id = null)
+    public function exists($uid, $calendar_id = null)
     {
         $query = 'SELECT event_id  FROM ' . $this->_params['table'] . ' WHERE event_uid = ?';
         $values = array($uid);
@@ -226,7 +227,8 @@ class Kronolith_Driver_sql extends Kronolith_Driver {
      *
      * @return array  Events in the given time range.
      */
-    function listEvents($startDate = null, $endDate = null, $hasAlarm = false)
+    public function listEvents($startDate = null, $endDate = null,
+                               $hasAlarm = false)
     {
         if (empty($endDate)) {
             $endInterval = new Horde_Date(array('mday' => 31, 'month' => 12,
@@ -261,8 +263,8 @@ class Kronolith_Driver_sql extends Kronolith_Driver {
      * @return array  Events in the given time range satisfying the given
      *                conditions.
      */
-    function listEventsConditional($startInterval, $endInterval,
-                                   $conditions = '', $vals = array())
+    public function listEventsConditional($startInterval, $endInterval,
+                                          $conditions = '', $vals = array())
     {
         $q = 'SELECT event_id, event_uid, event_description, event_location,' .
             ' event_private, event_status, event_attendees,' .
@@ -350,7 +352,7 @@ class Kronolith_Driver_sql extends Kronolith_Driver {
         return $events;
     }
 
-    function getEvent($eventId = null)
+    public function getEvent($eventId = null)
     {
         if (is_null($eventId)) {
             return new Kronolith_Event_sql($this);
@@ -399,7 +401,7 @@ class Kronolith_Driver_sql extends Kronolith_Driver {
      *
      * @return Kronolith_Event
      */
-    function getByUID($uid, $calendars = null, $getAll = false)
+    public 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,' .
@@ -479,7 +481,7 @@ class Kronolith_Driver_sql extends Kronolith_Driver {
      *
      * @param Kronolith_Event $event  The event to save.
      */
-    function saveEvent(&$event)
+    public function saveEvent($event)
     {
         if ($event->isStored() || $event->exists()) {
             $values = array();
@@ -589,7 +591,7 @@ class Kronolith_Driver_sql extends Kronolith_Driver {
      * @param string $eventId      The event to move.
      * @param string $newCalendar  The new calendar.
      */
-    function move($eventId, $newCalendar)
+    public function move($eventId, $newCalendar)
     {
         /* Fetch the event for later use. */
         $event = $this->getEvent($eventId);
@@ -630,7 +632,7 @@ class Kronolith_Driver_sql extends Kronolith_Driver {
      *
      * @return mixed  True or a PEAR_Error on failure.
      */
-    function delete($calendar)
+    public function delete($calendar)
     {
         $query = 'DELETE FROM ' . $this->_params['table'] . ' WHERE calendar_id = ?';
         $values = array($calendar);
@@ -652,7 +654,7 @@ class Kronolith_Driver_sql extends Kronolith_Driver {
      *
      * @return mixed  True or a PEAR_Error on failure.
      */
-    function deleteEvent($eventId, $silent = false)
+    public function deleteEvent($eventId, $silent = false)
     {
         /* Fetch the event for later use. */
         $event = $this->getEvent($eventId);
@@ -705,7 +707,7 @@ class Kronolith_Driver_sql extends Kronolith_Driver {
      *
      * @return boolean True.
      */
-    function initialize()
+    public function initialize()
     {
         Horde::assertDriverConfig($this->_params, 'calendar',
             array('phptype'));
@@ -753,7 +755,7 @@ class Kronolith_Driver_sql extends Kronolith_Driver {
 
     /**
      */
-    function _initConn(&$db)
+    private function _initConn(&$db)
     {
         // Set DB portability options.
         switch ($db->phptype) {
@@ -798,7 +800,7 @@ class Kronolith_Driver_sql extends Kronolith_Driver {
      *
      * @return mixed  The converted value.
      */
-    function convertFromDriver($value)
+    public function convertFromDriver($value)
     {
         return String::convertCharset($value, $this->_params['charset']);
     }
@@ -811,7 +813,7 @@ class Kronolith_Driver_sql extends Kronolith_Driver {
      *
      * @return mixed  The converted value.
      */
-    function convertToDriver($value)
+    public function convertToDriver($value)
     {
         return String::convertCharset($value, NLS::getCharset(), $this->_params['charset']);
     }
@@ -824,7 +826,7 @@ class Kronolith_Driver_sql extends Kronolith_Driver {
      *
      * @param mixed  True | PEAR_Error
      */
-    function removeUserData($user)
+    public function removeUserData($user)
     {
         if (!Auth::isAdmin()) {
             return PEAR::raiseError(_("Permission Denied"));
@@ -861,14 +863,14 @@ class Kronolith_Driver_sql extends Kronolith_Driver {
 /**
  * @package Kronolith
  */
-class Kronolith_Event_sql extends Kronolith_Event {
-
+class Kronolith_Event_sql extends Kronolith_Event
+{
     /**
      * @var array
      */
-    var $_properties = array();
+    private $_properties = array();
 
-    function fromDriver($SQLEvent)
+    public function fromDriver($SQLEvent)
     {
         $driver = $this->getDriver();
 
@@ -951,7 +953,7 @@ class Kronolith_Event_sql extends Kronolith_Event {
         $this->stored = true;
     }
 
-    function toDriver()
+    public function toDriver()
     {
         $driver = $this->getDriver();
 
@@ -1020,7 +1022,7 @@ class Kronolith_Event_sql extends Kronolith_Event {
         }
     }
 
-    function getProperties()
+    public function getProperties()
     {
         return $this->_properties;
     }