From: Michael M Slusarz Date: Thu, 12 Aug 2010 19:30:40 +0000 (-0600) Subject: Use Horde_Vfs injector; don't call Horde::fatal() directly X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=92b2bb533db454a801b2c2a19f9d5d17182ee924;p=horde.git Use Horde_Vfs injector; don't call Horde::fatal() directly --- diff --git a/whups/view.php b/whups/view.php index 7e9063cfe..71fd7a52e 100644 --- a/whups/view.php +++ b/whups/view.php @@ -21,27 +21,28 @@ if (empty($id)) { exit; } $details = $whups_driver->getTicketDetails($id); -if (is_a($details, 'PEAR_Error')) { +if ($details instanceof PEAR_Error) { if ($details->code === 0) { // No permissions to this ticket. Horde::url($registry->get('webroot', 'horde') . '/login.php', true) ->add('url', Horde::selfUrl(true)) ->redirect(); } else { - Horde::fatal($details->getMessage(), __FILE__, __LINE__); + throw new Horde_Exception($details); } } // Check permissions on this ticket. if (!count(Whups::permissionsFilter($whups_driver->getHistory($id), 'comment', Horde_Perms::READ))) { - Horde::fatal(sprintf(_("You are not allowed to view ticket %d."), $id), __FILE__, __LINE__); + throw new Horde_Exception(sprintf(_("You are not allowed to view ticket %d."), $id)); } -if (empty($conf['vfs']['type'])) { - Horde::fatal(_("The VFS backend needs to be configured to enable attachment uploads."), __FILE__, __LINE__); +try { + $injector->getInstance('Horde_Vfs')->getVfs('whups'); +} catch (Horde_Exception $e) { + throw new Horde_Exception(_("The VFS backend needs to be configured to enable attachment uploads.")); } -$vfs = VFS::factory($conf['vfs']['type'], Horde::getDriverConfig('vfs')); try { $data = $vfs->read(WHUPS_VFS_ATTACH_PATH . '/' . $id, $filename); } catch (VFS_Exception $e) {