This file is indexed.

/usr/share/horde/turba/lib/Form/EditContact.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
<?php
/**
 * Copyright 2000-2014 Horde LLC (http://www.horde.org/)
 *
 * See the enclosed file LICENSE for license information (ASL).  If you did
 * did not receive this file, see http://www.horde.org/licenses/apache.
 *
 * @category  Horde
 * @copyright 2000-2014 Horde LLC
 * @license   http://www.horde.org/licenses/apache ASL
 * @package   Turba
 */

/**
 * Form for editing/updating a contact.
 *
 * @category  Horde
 * @copyright 2000-2014 Horde LLC
 * @license   http://www.horde.org/licenses/apache ASL
 * @package   Turba
 */
class Turba_Form_EditContact extends Turba_Form_ContactBase
{
    /**
     * @var Turba_Object
     */
    protected $_contact;

    /**
     * @param Turba_Object $contact
     * @param array $vars
     */
    public function __construct($vars, Turba_Object $contact)
    {
        global $injector;

        parent::__construct($vars, '', 'Turba_View_EditContact');
        $this->_contact = $contact;

        $this->setButtons(_("Save"));
        $this->addHidden('', 'url', 'text', false);
        $this->addHidden('', 'source', 'text', true);
        $this->addHidden('', 'key', 'text', false);

        parent::_addFields($this->_contact);

        if (!($contact->vfsInit() instanceof Horde_Vfs_Null)) {
            $this->addVariable(_("Add file"), 'vfs', 'file', false);
        }

        $object_values = $vars->get('object');
        $object_keys = array_keys($contact->attributes);
        $object_keys[] = '__tags';
        foreach ($object_keys as $info_key) {
            if (!isset($object_values[$info_key])) {
                $object_values[$info_key] = $contact->getValue($info_key);
            }
        }

        $vars->set('object', $object_values);
        $vars->set('source', $contact->getSource());
    }

    public function execute()
    {
        global $attributes, $notification;

        if (!$this->validate($this->_vars)) {
            throw new Turba_Exception('Invalid');
        }

        /* Form valid, save data. */
        $this->getInfo($this->_vars, $info);

        /* Update the contact. */
        foreach ($info['object'] as $info_key => $info_val) {
            if ($info_key != '__key') {
                if ($attributes[$info_key]['type'] == 'image' && !empty($info_val['file'])) {
                    $this->_contact->setValue($info_key, file_get_contents($info_val['file']));
                    if (isset($info_val['type'])) {
                        $this->_contact->setValue($info_key . 'type', $info_val['type']);
                    }
                } else {
                    $this->_contact->setValue($info_key, $info_val);
                }
            }
        }

        try {
            $this->_contact->store();
        } catch (Turba_Exception $e) {
            Horde::log($e, 'ERR');
            $notification->push(_("There was an error saving the contact. Contact your system administrator for further help."), 'horde.error');
            throw $e;
        }

        if (isset($info['vfs'])) {
            try {
                $this->_contact->addFile($info['vfs']);
                $notification->push(sprintf(_("\"%s\" updated."), $this->_contact->getValue('name')), 'horde.success');
            } catch (Turba_Exception $e) {
                $notification->push(sprintf(_("\"%s\" updated, but saving the uploaded file failed: %s"), $this->_contact->getValue('name'), $e->getMessage()), 'horde.warning');
            }
        } else {
            $notification->push(sprintf(_("\"%s\" updated."), $this->_contact->getValue('name')), 'horde.success');
        }

        return true;
    }

    /**
     */
    public function renderActive($renderer, $vars, $action, $method)
    {
        parent::renderActive($renderer, $vars, $action, $method);

        if ($this->_contact->isGroup()) {
            $edit_url = Horde::url('browse.php')->add(array(
                'key' => $this->_contact->getValue('__key'),
                'source' => $this->_contact->getSource()
            ));

            echo '<div class="editGroupMembers">' .
                Horde::link($edit_url) . '<span class="iconImg groupImg"></span>' . _("Edit/View Contact List Members") . '</a>' .
                '</div>';
        }
    }

}