3
* Turba deletefile.php.
5
* Copyright 2000-2013 Horde LLC (http://www.horde.org/)
7
* See the enclosed file LICENSE for license information (ASL). If you
8
* did not receive this file, see http://www.horde.org/licenses/apache.
10
* @author Chuck Hagenbuch <chuck@horde.org>
13
require_once __DIR__ . '/lib/Application.php';
14
Horde_Registry::appInit('turba');
16
$source = Horde_Util::getPost('source');
17
if ($source === null || !isset($cfgSources[$source])) {
18
$notification->push(_("Not found"), 'horde.error');
19
Horde::url($prefs->getValue('initial_page'), true)->redirect();
22
$driver = $injector->getInstance('Turba_Factory_Driver')->create($source);
25
$contact = $driver->getObject(Horde_Util::getPost('key'));
26
} catch (Horde_Exception $e) {
27
$notification->push($e);
28
Horde::url($prefs->getValue('initial_page'), true)->redirect();
31
if (!$contact->isEditable()) {
32
$notification->push(_("Permission denied"), 'horde.error');
33
Horde::url($prefs->getValue('initial_page'), true)->redirect();
36
$file = Horde_Util::getPost('file');
39
$contact->deleteFile($file);
40
$notification->push(sprintf(_("The file \"%s\" has been deleted."), $file), 'horde.success');
41
} catch (Turba_Exception $e) {
42
$notification->push($e, 'horde.error');
45
$contact->url('Contact', true)->redirect();