/usr/share/horde/turba/addressbooks/edit.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 | <?php
/**
* Turba addressbooks - edit.
*
* Copyright 2001-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.
*/
require_once __DIR__ . '/../lib/Application.php';
Horde_Registry::appInit('turba');
// Exit if this isn't an authenticated user, or if there's no source
// configured for shares.
if (!$GLOBALS['registry']->getAuth() || !$session->get('turba', 'has_share')) {
Horde::url('', true)->redirect();
}
$vars = Horde_Variables::getDefaultVariables();
try {
$addressbook = $injector->getInstance('Turba_Shares')->getShare($vars->get('a'));
} catch (Horde_Share_Exception $e) {
$notification->push($e);
Horde::url('', true)->redirect();
}
$owner = $addressbook->get('owner') == $GLOBALS['registry']->getAuth() ||
(is_null($addressbook->get('owner')) && $GLOBALS['registry']->isAdmin());
if (!$owner &&
!$addressbook->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::READ)) {
$notification->push(_("You are not allowed to see this addressbook."), 'horde.error');
Horde::url('', true)->redirect();
}
$form = new Turba_Form_EditAddressBook($vars, $addressbook);
// Execute if the form is valid.
if ($owner && $form->validate($vars)) {
$original_name = $addressbook->get('name');
try {
$form->execute();
if ($addressbook->get('name') != $original_name) {
$notification->push(sprintf(_("The addressbook \"%s\" has been renamed to \"%s\"."), $original_name, $addressbook->get('name')), 'horde.success');
} else {
$notification->push(sprintf(_("The addressbook \"%s\" has been saved."), $original_name), 'horde.success');
}
Horde::url('', true)->redirect();
} catch (Turba_Exception $e) {
$notification->push($e);
}
}
$vars->set('name', $addressbook->get('name'));
$vars->set('description', $addressbook->get('desc'));
$page_output->header(array(
'title' => $form->getTitle()
));
$notification->notify(array('listeners' => 'status'));
if ($owner) {
echo $form->renderActive($form->getRenderer(), $vars, Horde::url('addressbooks/edit.php'), 'post');
} else {
echo $form->renderInactive($form->getRenderer(), $vars);
}
$page_output->footer();
|