This file is indexed.

/usr/share/php/Horde/Kolab/Format/Date.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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<?php
/**
 * Helper functions to handle format conversions.
 *
 * PHP version 5
 *
 * @category Kolab
 * @package  Kolab_Format
 * @author   Stuart Binge <omicron@mighty.co.za>
 * @author   Thomas Jarosch <thomas.jarosch@intra2net.com>
 * @license  http://www.horde.org/licenses/lgpl21 LGPL 2.1
 * @link     http://www.horde.org/libraries/Horde_Kolab_Format
 */

/**
 * Kolab date handling functions. Based upon Kolab.php from Stuart Binge.
 *
 * Copyright 2004-2016 Horde LLC (http://www.horde.org/)
 *
 * 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   Stuart Binge <omicron@mighty.co.za>
 * @author   Thomas Jarosch <thomas.jarosch@intra2net.com>
 * @license  http://www.horde.org/licenses/lgpl21 LGPL
 * @link     http://www.horde.org/libraries/Horde_Kolab_Format
 */
class Horde_Kolab_Format_Date
{
    /**
     * Parse the provided string into a PHP DateTime object.
     *
     * @todo Drop in version 3.0.0.
     *
     * @param string $date_time The Kolab date-time value.
     *
     * @return DateTime The date-time value represented as PHP DateTime object.
     */
    public static function readUtcDateTime($date_time)
    {
        return self::readDateTime($date_time);
    }

    /**
     * Parse the provided string into a PHP DateTime object.
     *
     * @todo Drop $timezone parameter in version 3.0.0.
     *
     * @param string $date     The Kolab date value.
     * @param string $timezone The associated timezone. Deprecated.
     *
     * @return DateTime The date-time value represented as PHP DateTime object.
     */
    public static function readDate($date, $timezone = null)
    {
        if (empty($date)) {
            return false;
        }

        return DateTime::createFromFormat(
            '!Y-m-d', $date
        );
    }

    /**
     * Parse the provided string into a PHP DateTime object.
     *
     * @todo Drop $timezone parameter in version 3.0.0.
     *
     * @param string $date_time The Kolab date-time value.
     * @param string $timezone  The associated timezone. Deprecated.
     *
     * @return DateTime The date-time value represented as PHP DateTime object.
     */
    public static function readDateTime($date_time, $timezone = null)
    {
        if (empty($date_time)) {
            return false;
        }

        try {
            $date = new DateTime($date_time);
            $date->setTimezone(new DateTimeZone('UTC'));
            return $date;
        } catch (Exception $e) {
            return false;
        }
    }

    /**
     * Parse the provided string into a PHP DateTime object.
     *
     * @todo Drop $timezone parameter in version 3.0.0.
     *
     * @param string $date      The string representation of the date (& time).
     * @param string $timezone  The associated timezone. Deprecated.
     *
     * @return DateTime The date-time value represented as PHP DateTime object.
     */
    public static function readDateOrDateTime($date, $timezone = null)
    {
        if (empty($date)) {
            return null;
        }

        return strlen($date) == 10
            ? self::readDate($date, $timezone)
            : self::readDateTime($date, $timezone);
    }

    /**
     * Write the provided PHP DateTime object into a Kolab format UTC date-time
     * representation.
     *
     * @todo Drop in version 3.0.0.
     *
     * @param DateTime $date_time The PHP DateTime object.
     *
     * @return string The Kolab format UTC date-time string.
     */
    public static function writeUtcDateTime(DateTime $date_time)
    {
        return self::writeDateTime($date_time);
    }

    /**
     * Write the provided PHP DateTime object into a Kolab format date-time
     * representation.
     *
     * @param DateTime $date_time The PHP DateTime object.
     *
     * @return string The Kolab format date-time string.
     */
    public static function writeDateTime(DateTime $date_time)
    {
        $date_time->setTimezone(new DateTimeZone('UTC'));
        return $date_time->format('Y-m-d\TH:i:s\Z');
    }

    /**
     * Write the provided PHP DateTime object into a Kolab format date
     * representation.
     *
     * @param DateTime $date The PHP DateTime object.
     *
     * @return string The Kolab format UTC date string.
     */
    public static function writeDate(DateTime $date)
    {
        return $date->format('Y-m-d');
    }
}