This file is indexed.

/usr/bin/kronolith-convert-to-utc is in php-horde-kronolith 4.2.23-1ubuntu1.

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

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
#!/usr/bin/php
<?php
/**
 * This script converts all dates from the user's timezone to UTC.
 */

if (file_exists(__DIR__ . '/../../kronolith/lib/Application.php')) {
    $baseDir = __DIR__ . '/../';
} else {
    require_once 'PEAR/Config.php';
    $baseDir = PEAR_Config::singleton()
        ->get('horde_dir', null, 'pear.horde.org') . '/kronolith/';
}
require_once $baseDir . 'lib/Application.php';
Horde_Registry::appInit('kronolith', array('cli' => true));

/* Prepare DB stuff. */
$db = $injector->getInstance('Horde_Db_Adapter');
try {
    $result = $db->selectAll('SELECT event_title, event_id, event_creator_id, event_start, event_end, event_allday, event_recurenddate, event_exceptionoriginaldate FROM ' . $conf['calendar']['params']['table'] . ' ORDER BY event_creator_id');
} catch (Horde_Db_Exception $e) {
    echo $e->getMessage() . "\n";
    exit;
}

$stmt = 'UPDATE kronolith_events SET event_start = ?, event_end = ?, event_recurenddate = ?, event_exceptionoriginaldate = ? WHERE event_id = ?';

/* Confirm changes. */
if (!isset($argv[1]) || $argv[1] != '--yes') {
    $answer = $cli->prompt('Running this script will convert all existing events to UTC. This conversion is not reversible. Is this what you want?', array('y' => 'Yes', 'n' => 'No'));
    if ($answer != 'y') {
        exit;
    }
}

/* Loop through all events. */
$creator = null;
$utc = new DateTimeZone('UTC');
echo "Converting events for:\n";
$timezone = new DateTimeZone(date_default_timezone_get());
foreach ($result as $row) {
    if ($row['event_allday']) {
        continue;
    }
    if ($row['event_creator_id'] != $creator) {
        if (!is_null($creator)) {
            echo "$count\n";
        }
        $prefs = $injector->getInstance('Horde_Core_Factory_Prefs')->create('horde', array(
            'cache' => false,
            'user' => $row['event_creator_id']
        ));

        $timezone = $prefs->getValue('timezone');
        if (empty($timezone)) {
            $timezone = date_default_timezone_get();
        }
        $timezone = new DateTimeZone($timezone);
        $creator = $row['event_creator_id'];
        $count = 0;
        echo $creator . ': ';
    }
    $start = new DateTime($row['event_start'], $timezone);
    $start->setTimezone($utc);
    $end = new DateTime($row['event_end'], $timezone);
    $end->setTimezone($utc);
    if (!empty($row['event_recurenddate'])) {
        $recur_end = new DateTime($row['event_recurenddate'], $timezone);
        $recur_end->setTimezone($utc);
    }
    if (!empty($row['event_exceptionoriginaldate'])) {
        $eod = new DateTime($row['event_exceptionoriginaldate'], $timezone);
        $eod->setTimezone($utc);
    }

    try {
        $db->update($stmt, array(
            $start->format('Y-m-d H:i:s'),
            $end->format('Y-m-d H:i:s'),
            !empty($row['event_recurenddate']) ? $recur_end->format('Y-m-d H:i:s') : null,
            !empty($row['event_exceptionoriginaldate']) ? $eod->format('Y-m-d H:i:s') : null,
            $row['event_id']));
    } catch (Horde_Db_Exception $e) {
        echo $e->getMessage() . "\n";
        exit;
    }
    $count++;
}
echo "$count\n";