/usr/share/horde/turba/view.php is in php-horde-turba 4.1.3-1.
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 | <?php
/**
* Turba view.php.
*
* Copyright 2004-2013 Horde LLC (http://www.horde.org/)
*
* See the enclosed file LICENSE for license information (ASL). If you
* did not receive this file, see http://www.horde.org/licenses/apache.
*
* @author Jan Schneider <jan@horde.org>
*/
require_once __DIR__ . '/lib/Application.php';
Horde_Registry::appInit('turba');
$source = Horde_Util::getFormData('source');
$key = Horde_Util::getFormData('key');
$filename = Horde_Util::getFormData('file');
$type = Horde_Util::getFormData('type');
/* Get the object. */
if (!isset($cfgSources[$source])) {
throw new Turba_Exception(_("The contact you requested does not exist."));
}
$driver = $injector->getInstance('Turba_Factory_Driver')->create($source);
$object = $driver->getObject($key);
/* Check permissions. */
if (!$object->hasPermission(Horde_Perms::READ)) {
throw new Turba_Exception(_("You do not have permission to view this contact."));
}
try {
$vfs = $object->vfsInit();
} catch (Horde_Exception $e) {
throw new Turba_Exception($e);
}
try {
$data = $vfs->read(Turba::VFS_PATH . '/' . $object->getValue('__uid'), $filename);
} catch (Horde_Vfs_Exception $e) {
Horde::logMessage($e, 'ERR');
throw new Turba_Exception(sprintf(_("Access denied to %s"), $filename));
}
$mime_part = new Horde_Mime_Part();
$mime_part->setType(Horde_Mime_Magic::extToMime($type));
$mime_part->setContents($data);
$mime_part->setName($filename);
$mime_part->buildMimeIds();
$content = $injector->getInstance('Horde_Core_Factory_MimeViewer')->create($mime_part)->render('full');
$body = $content[1]['data'];
$browser->downloadHeaders($filename, $content[1]['type'], true, strlen($body));
echo $body;
|