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) {