This file is indexed.

/usr/share/php/Horde/Kolab/Format/Xml/Event.php is in php-horde-kolab-format 2.0.9-1ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<?php
/**
 * Implementation for events in the Kolab XML format.
 *
 * PHP version 5
 *
 * @category Kolab
 * @package  Kolab_Format
 * @author   Thomas Jarosch <thomas.jarosch@intra2net.com>
 * @author   Gunnar Wrobel <wrobel@pardus.de>
 * @license  http://www.horde.org/licenses/lgpl21 LGPL 2.1
 * @link     http://www.horde.org/libraries/Horde_Kolab_Format
 */

/**
 * Kolab XML handler for event groupware objects.
 *
 * Copyright 2007-2009 Klarälvdalens Datakonsult AB
 *
 * See the enclosed file COPYING for license information (LGPL). If you did not
 * receive this file, see
 * http://www.horde.org/licenses/lgpl21.
 *
 * @category Kolab
 * @package  Kolab_Format
 * @author   Thomas Jarosch <thomas.jarosch@intra2net.com>
 * @author   Gunnar Wrobel <wrobel@pardus.de>
 * @license  http://www.horde.org/licenses/lgpl21 LGPL 2.1
 * @link     http://www.horde.org/libraries/Horde_Kolab_Format
 */
class Horde_Kolab_Format_Xml_Event extends Horde_Kolab_Format_Xml
{
    /**
     * The name of the root element.
     *
     * @var string
     */
    protected $_root_name = 'event';

    /**
     * Specific data fields for the prefs object
     *
     * @var Kolab
     */
    protected $_fields_specific = array(
        'summary'      => 'Horde_Kolab_Format_Xml_Type_String_MaybeMissing',
        'location'     => 'Horde_Kolab_Format_Xml_Type_String_MaybeMissing',
        'organizer'    => 'Horde_Kolab_Format_Xml_Type_Composite_SimplePerson',
        'start-date'   => 'Horde_Kolab_Format_Xml_Type_EventDateTime',
        'alarm'        => 'Horde_Kolab_Format_Xml_Type_Integer',
        'horde-alarm-methods' => 'Horde_Kolab_Format_Xml_Type_String_MaybeMissing',
        'recurrence'   => 'Horde_Kolab_Format_Xml_Type_Composite_Recurrence',
        'attendee'     => 'Horde_Kolab_Format_Xml_Type_Multiple_Attendee',
        'show-time-as' => 'Horde_Kolab_Format_Xml_Type_String_MaybeMissing',
        'color-label'  => 'Horde_Kolab_Format_Xml_Type_String_MaybeMissing',
        'end-date'     => 'Horde_Kolab_Format_Xml_Type_EventDateTime',
    );

    /**
     * Load an object based on the given XML stream. The stream may only contain
     * UTF-8 data.
     *
     * @param resource $xml     The XML stream of the message.
     * @param array    $options Additional options when parsing the XML.
     * <pre>
     * - relaxed: Relaxed error checking (default: false)
     * </pre>
     *
     * @return array The data array representing the object.
     *
     * @throws Horde_Kolab_Format_Exception If parsing the XML data failed.
     *
     * @todo Check encoding of the returned array. It seems to be ISO-8859-1 at
     * the moment and UTF-8 would seem more appropriate.
     */
    public function load($xml, $options = array())
    {
        $object = parent::load($xml, $options);
        if ($object['end-date']['date-only']) {
            $object['end-date']['date']
                ->add(new DateInterval('P1D'));
        }
        $object['start-date'] = $object['start-date']['date'];
        $object['end-date'] = $object['end-date']['date'];
        return $object;
    }

    /**
     * Convert the data to a XML stream. Strings contained in the data array may
     * only be provided as UTF-8 data.
     *
     * @param array $object  The data array representing the object.
     * @param array $options Additional options when writing the XML.
     * <pre>
     * - previous: The previous XML text (default: empty string)
     * - relaxed: Relaxed error checking (default: false)
     * </pre>
     *
     * @return resource The data as XML stream.
     *
     * @throws Horde_Kolab_Format_Exception If converting the data to XML failed.
     */
    public function save($object, $options = array())
    {
        if (!empty($object['_is_all_day'])) {
            $this->_fields_specific['start-date'] = 'Horde_Kolab_Format_Xml_Type_EventDate';
            $this->_fields_specific['end-date'] = 'Horde_Kolab_Format_Xml_Type_EventDate';

            $end_date = clone $object['end-date'];
            if ($end_date->hour == 0 && $end_date->min == 0 && $end_date->sec == 0)
            {
                // move date to previous day 23:59:59. We cut off the time anyway.
                $end_date->sub(new DateInterval('PT1S'));
                $object['end-date'] = $end_date;
            }
        }
        return parent::save($object, $options);
    }
}