/usr/share/horde/turba/lib/View/Contact.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 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 | <?php
/**
* The Turba_View_Contact:: class provides an API for viewing events.
*
* @author Chuck Hagenbuch <chuck@horde.org>
* @package Turba
*/
class Turba_View_Contact
{
/**
* @var Turba_Object
*/
public $contact;
/**
* @param Turba_Object &$contact
*/
public function __construct(Turba_Object $contact)
{
$this->contact = $contact;
}
public function getTitle()
{
if (!$this->contact) {
return _("Not Found");
}
return $this->contact->getValue('name');
}
public function html($active = true)
{
global $browser, $conf, $registry;
if (!$this->contact ||
!$this->contact->hasPermission(Horde_Perms::READ)) {
echo '<h3>' . _("The requested contact was not found.") . '</h3>';
return;
}
$vars = new Horde_Variables();
$form = new Turba_Form_Contact($vars, $this->contact);
/* Get the contact's history. */
$history = $this->contact->getHistory();
foreach ($history as $what => $when) {
$v = $form->addVariable(
$what == 'created' ? _("Created") : _("Last Modified"),
'object[__' . $what . ']',
'text',
false,
false);
$v->disable();
$vars->set('object[__' . $what . ']', $when);
}
echo '<div id="Contact"' . ($active ? '' : ' style="display:none"') . '>';
$form->renderInactive(new Horde_Form_Renderer(), $vars);
/* Comments. */
if (!empty($conf['comments']['allow']) && $registry->hasMethod('forums/doComments')) {
try {
$comments = $registry->call('forums/doComments', array('turba', $this->contact->driver->getName() . '.' . $this->contact->getValue('__key'), 'commentCallback'));
} catch (Horde_Exception $e) {
Horde::logMessage($e, 'DEBUG');
$comments = array();
}
}
if (!empty($comments['threads'])) {
echo '<br />' . $comments['threads'];
}
if (!empty($comments['comments'])) {
echo '<br />' . $comments['comments'];
}
echo '</div>';
if ($active && $browser->hasFeature('dom')) {
if ($this->contact->hasPermission(Horde_Perms::EDIT)) {
$edit = new Turba_View_EditContact($this->contact);
$edit->html(false);
}
if ($this->contact->hasPermission(Horde_Perms::DELETE)) {
$delete = new Turba_View_DeleteContact($this->contact);
$delete->html(false);
}
}
}
}
|