This file is indexed.

/usr/share/horde/turba/lib/Form/EditAddressBook.php is in php-horde-turba 4.2.2-3.

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
155
156
157
158
159
160
161
162
163
164
165
166
<?php
/**
 * Horde_Form for editing address books.
 *
 * See the enclosed file LICENSE for license information (ASL). If you
 * did not receive this file, see http://www.horde.org/licenses/apache.
 *
 * @package Turba
 */

/**
 * The Turba_Form_EditAddressBook class provides the form for
 * editing an address book.
 *
 * @author  Chuck Hagenbuch <chuck@horde.org>
 * @package Turba
 */
class Turba_Form_EditAddressBook extends Horde_Form
{
    /**
     * Address book being edited
     *
     * @var Horde_Share_Object
     */
    protected $_addressbook;

    public function __construct($vars, Horde_Share_Object $addressbook)
    {
        $this->_addressbook = $addressbook;

        $owner = $addressbook->get('owner') == $GLOBALS['registry']->getAuth() ||
            (is_null($addressbook->get('owner')) &&
             $GLOBALS['registry']->isAdmin());

        parent::__construct(
            $vars,
            $owner
                ? sprintf(_("Edit %s"), $addressbook->get('name'))
                : $addressbook->get('name')
        );

        $this->addHidden('', 'a', 'text', true);
        $this->addVariable(_("Name"), 'name', 'text', true);

        if (!$owner) {
            $v = $this->addVariable(_("Owner"), 'owner', 'text', false);
            $owner_name = $GLOBALS['injector']
                ->getInstance('Horde_Core_Factory_Identity')
                ->create($addressbook->get('owner'))
                ->getValue('fullname');
            if (trim($owner_name) == '') {
                $owner_name = $addressbook->get('owner');
            }
            $v->setDefault($owner_name ? $owner_name : _("System"));
        }

        $this->addVariable(_("Description"), 'description', 'longtext', false, false, null, array(4, 60));

        /* Subscription URLs. */
        $url = $GLOBALS['registry']->get('webroot', 'horde');
        if (isset($GLOBALS['conf']['urls']['pretty']) &&
            $GLOBALS['conf']['urls']['pretty'] == 'rewrite') {
            $webdavUrl = $url . '/rpc/turba/';
            $carddavUrl = $url . '/rpc/addressbooks/';
            $accountUrl = $url . '/rpc/';
        } else {
            $webdavUrl = $url . '/rpc.php/turba/';
            $carddavUrl = $url . '/rpc.php/addressbooks/';
            $accountUrl = $url . '/rpc.php/';
        }
        try {
            $accountUrl = Horde::url($accountUrl, true, -1)
                . 'principals/'. $GLOBALS['registry']->getAuth() . '/';
            if ($addressbook->get('owner')) {
                $carddavUrl = Horde::url($carddavUrl, true, -1)
                    . $GLOBALS['registry']->getAuth()
                    . '/'
                    . $GLOBALS['injector']->getInstance('Horde_Dav_Storage')->getExternalCollectionId($addressbook->getName(), 'contacts')
                    . '/';
                $this->addVariable(
                     _("CardDAV Subscription URL"), '', 'link', false, false, null,
                     array(array(
                         'url' => $carddavUrl,
                         'text' => $carddavUrl,
                     'title' => _("Copy this URL to a CardDAV client to subscribe to this address book"),
                         'target' => '_blank')
                     )
                );
            }
            $this->addVariable(
                 _("CardDAV Account URL"), '', 'link', false, false, null,
                 array(array(
                     'url' => $accountUrl,
                     'text' => $accountUrl,
                 'title' => _("Copy this URL to a CarddAV client to subscribe to all your address books"),
                     'target' => '_blank')
                 )
            );
        } catch (Horde_Exception $e) {
        }
        $webdavUrl = Horde::url($webdavUrl, true, -1)
            . ($addressbook->get('owner')
               ? $addressbook->get('owner')
               : '-system-')
            . '/' . $addressbook->getName() . '/';
        $this->addVariable(
             _("WebDAV URL"), '', 'link', false, false, null,
             array(array(
                 'url' => $webdavUrl,
                 'text' => $webdavUrl,
                 'title' => _("Copy this URL to a WebDAV client to browse this address book"),
                 'target' => '_blank')
             )
        );

        /* Permissions link. */
        if (empty($GLOBALS['conf']['share']['no_sharing']) && $owner) {
            $url = Horde::url($GLOBALS['registry']->get('webroot', 'horde')
                              . '/services/shares/edit.php')
                ->add(array('app' => 'turba', 'share' => $addressbook->getName()));
            $this->addVariable(
                 '', '', 'link', false, false, null,
                 array(array(
                     'url' => $url,
                     'text' => _("Change Permissions"),
                     'onclick' => Horde::popupJs(
                          $url,
                          array('params' => array('urlencode' => true)))
                          . 'return false;',
                     'class' => 'horde-button',
                     'target' => '_blank')
                 )
            );
        }

        $this->setButtons(array(
            _("Save"),
            array('class' => 'horde-delete', 'value' => _("Delete")),
            array('class' => 'horde-cancel', 'value' => _("Cancel"))
        ));
    }

    public function execute()
    {
        switch ($this->_vars->submitbutton) {
        case _("Save"):
            $this->_addressbook->set('name', $this->_vars->get('name'));
            $this->_addressbook->set('desc', $this->_vars->get('description'));
            try {
                $this->_addressbook->save();
            } catch (Horde_Share_Exception $e) {
                throw new Turba_Exception(sprintf(_("Unable to save address book \"%s\": %s"), $this->_vars->get('name'), $e->getMessage()));
            }
            break;
        case _("Delete"):
            Horde::url('addressbooks/delete.php')
                ->add('a', $this->_vars->a)
                ->redirect();
            break;
        case _("Cancel"):
            Horde::url('', true)->redirect();
            break;
        }
    }

}