1<?php 2/** 3 * Turba deletefile.php. 4 * 5 * Copyright 2000-2017 Horde LLC (http://www.horde.org/) 6 * 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. 9 * 10 * @author Chuck Hagenbuch <chuck@horde.org> 11 */ 12 13require_once __DIR__ . '/lib/Application.php'; 14Horde_Registry::appInit('turba'); 15 16$source = Horde_Util::getPost('source'); 17if ($source === null || !isset($cfgSources[$source])) { 18 $notification->push(_("Not found"), 'horde.error'); 19 Horde::url($prefs->getValue('initial_page'), true)->redirect(); 20} 21 22$driver = $injector->getInstance('Turba_Factory_Driver')->create($source); 23 24try { 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(); 29} 30 31if (!$contact->isEditable()) { 32 $notification->push(_("Permission denied"), 'horde.error'); 33 Horde::url($prefs->getValue('initial_page'), true)->redirect(); 34} 35 36$file = Horde_Util::getPost('file'); 37 38try { 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'); 43} 44 45$contact->url('Contact', true)->redirect(); 46