if ($e->getCode() == 'permission_denied') {
Horde::authenticationFailureRedirect();
}
- Horde::fatal($e, __FILE__, __LINE__, false);
+ throw $e;
}
$conf = &$GLOBALS['conf'];
/* Module selection */
$app = Horde_Util::getFormData('module');
-
+
/* Language selection */
if (($lang = Horde_Util::getFormData('display_language')) !== null) {
$_SESSION['babel']['language'] = $lang;
} elseif (isset($_SESSION['babel']['language'])) {
$lang = $_SESSION['babel']['language'];
} else {
-
+
$tests = Horde_Nls::$config['languages'];
-
+
// Unset English
unset($tests['en_US']);
-
+
foreach($tests as $dir => $desc) {
if (!Babel::hasPermission("language:$dir")) {
continue;
}
$_SESSION['babel']['language'] = $lang;
}
-
+
/* Set up the template fields. */
$template->set('menu', Babel::getMenu('string'));
$template->set('notify', Horde_Util::bufferOutput(array($notification, 'notify'), array('listeners' => 'status')));
$template->set('fmenu', $fmenu);
if ($lang && !Babel::hasPermission("language:$lang")) {
- Horde::fatal(sprintf(_("Access forbidden to '%s'."), $lang), __FILE__, __LINE__, true);
+ throw new Horde_Exception(sprintf(_("Access forbidden to '%s'."), $lang));
}
if ($app && !Babel::hasPermission("module:$app")) {
- Horde::fatal(sprintf(_("Access forbidden to '%s'."), $app), __FILE__, __LINE__, true);
+ throw new Horde_Exception(sprintf(_("Access forbidden to '%s'."), $app));
}
/* Custom sort function */
}
if (empty($srcfile)) {
- Horde::fatal(_("Missing filename!"), __FILE__, __LINE__, false);
+ throw new Horde_Exception(_("Missing filename!"));
}
$rpath = realpath(HORDE_BASE);
if (!preg_match(";$rpath;", $srcfile)) {
- Horde::fatal(sprintf(_("Access denied to %s"), $srcfile), __FILE__, __LINE__, false);
+ throw new Horde_Exception(sprintf(_("Access denied to %s"), $srcfile));
}
// Get File content
function printCode($code, $sline = 1, $sdiff = 10) {
if (!is_array($code)) $code = explode("\n", $code);
-
+
$count_lines = count($code);
$r = '';
-
+
$from = $sline - $sdiff;
$to = $sline + $sdiff;
-
+
foreach ($code as $line => $code_line) {
-
+
if ($from && $line < $from) {
continue;
}
-
+
if ($to && $line > $to) {
break;
}
-
+
$r1 = ($line + 1);
-
+
if (ereg("<\?(php)?[^[:graph:]]", $code_line)) {
$r2 = highlight_string($code_line, 1)."<br />";
} else {
$r2 = ereg_replace("(<\?php )+", "", highlight_string("<?php ".$code_line, 1))."<br />";
}
-
+
if ($r1 == $sline) {
$r .= sprintf('<tr><td align="right" class="control"><b>%s </b></td><td class="item0">%s</td></tr>', $r1, $r2);
} else {
$r .= sprintf('<tr><td align="right" class="control">%s </td><td>%s</td></tr>', $r1, $r2);
}
}
-
+
$r = '<table width="100%" cellspacing=0>' . $r . '</table>';
echo "<div class=\"code\">".$r."</div>";
if ($e->getCode() == 'permission_denied') {
Horde::authenticationFailureRedirect();
}
- Horde::fatal($e, __FILE__, __LINE__, false);
+ throw $e;
}
$conf = &$GLOBALS['conf'];
define('CHORA_TEMPLATES', $registry->get('templates'));
* The table structure can be created by the scripts/sql/crumb_foo.sql
* script.
*
- * $Horde$
- *
* Copyright 2007-2009 The Horde Project (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (GPL). If you
/**
* Attempts to open a persistent connection to the SQL server.
*
- * @return boolean True on success; exits (Horde::fatal()) on error.
+ * @return boolean True on success.
*/
function _connect()
{
$this->_write_db = &DB::connect($this->_params,
array('persistent' => !empty($this->_params['persistent'])));
if (is_a($this->_write_db, 'PEAR_Error')) {
- Horde::fatal($this->_write_db, __FILE__, __LINE__);
+ throw new Horde_Exception($this->_write_db);
}
// Set DB portability options.
$this->_db = &DB::connect($params,
array('persistent' => !empty($params['persistent'])));
if (is_a($this->_db, 'PEAR_Error')) {
- Horde::fatal($this->_db, __FILE__, __LINE__);
+ throw new Horde_Exception($this->_write_db);
}
// Set DB portability options.
if ($e->getCode() == 'permission_denied') {
Horde::authenticationFailureRedirect();
}
- Horde::fatal($e, __FILE__, __LINE__, false);
+ throw $e;
}
$conf = &$GLOBALS['conf'];
@define('CRUMB_TEMPLATES', $registry->get('templates'));
if ($e->getCode() == 'permission_denied') {
Horde::authenticationFailureRedirect();
}
- Horde::fatal($e, __FILE__, __LINE__, false);
+ throw $e;
}
$conf = &$GLOBALS['conf'];
@define('FIMA_TEMPLATES', $registry->get('templates'));
/**
* Attempts to open a persistent connection to the SQL server.
*
- * @return boolean True on success; exits (Horde::fatal()) on error.
+ * @return boolean True on success.
*/
private function _connect()
{
$this->_write_db = DB::connect($this->_params,
array('persistent' => !empty($this->_params['persistent'])));
if ($this->_write_db instanceof PEAR_Error) {
- Horde::fatal($this->_write_db, __FILE__, __LINE__);
+ throw new Horde_Exception($this->_write_db);
}
// Set DB portability options.
$this->_db = DB::connect($params,
array('persistent' => !empty($params['persistent'])));
if ($this->_db instanceof PEAR_Error) {
- Horde::fatal($this->_db, __FILE__, __LINE__);
+ throw new Horde_Exception($this->_db);
}
// Set DB portability options.
return true;
}
-}
\ No newline at end of file
+}
/**
* Attempts to open a persistent connection to the SQL server.
*
- * @return boolean True on success; exits (Horde::fatal()) on error.
+ * @return boolean True on success.
*/
protected function _connect()
{
$this->_write_db = DB::connect($this->_params,
array('persistent' => !empty($this->_params['persistent'])));
if ($this->_write_db instanceof PEAR_Error) {
- Horde::fatal($this->_write_db, __FILE__, __LINE__);
+ throw new Horde_Exception($this->_write_db);
}
// Set DB portability options.
$this->_db = DB::connect($params,
array('persistent' => !empty($params['persistent'])));
if ($this->_db instanceof PEAR_Error) {
- Horde::fatal($this->_db, __FILE__, __LINE__);
+ throw new Horde_Exception($this->_db);
}
// Set DB portability options.
if ($e->getCode() == 'permission_denied') {
Horde::authenticationFailureRedirect();
}
- Horde::fatal($e, __FILE__, __LINE__, false);
+ throw $e;
}
$conf = &$GLOBALS['conf'];
define('FOLKS_TEMPLATES', $registry->get('templates'));
{
$type_class = 'Horde_Form_Type_' . $type;
if (!class_exists($type_class)) {
- Horde::fatal(PEAR::raiseError(sprintf('Nonexistant class "%s" for field type "%s"', $type_class, $type)), __FILE__, __LINE__);
+ throw new Horde_Exception(sprintf('Nonexistant class "%s" for field type "%s"', $type_class, $type));
}
$type_ob = new $type_class();
call_user_func_array(array(&$type_ob, 'init'), $params);
}
if ($ok_form) {
- try {
- $current_acl = $ACLDriver->getACL($folder);
- } catch (Horde_Exception $e) {
- Horde::fatal($e);
- }
+ $current_acl = $ACLDriver->getACL($folder);
foreach ($acls as $user => $acl) {
if ($acl) {
$acl = array_flip($acl);
$folder = 'INBOX';
}
-try {
- $curr_acl = $ACLDriver->getACL($folder);
-} catch (Horde_Exception $e) {
- Horde::fatal($e);
-}
+$curr_acl = $ACLDriver->getACL($folder);
$canEdit = $ACLDriver->canEdit($folder, $_SESSION['imp']['uniquser']);
require_once 'Horde/Prefs/UI.php';
-try {
- extract(Horde::loadConfiguration('prefs.php', array('prefGroups', '_prefs'), 'imp'));
-} catch (Horde_Exception $e) {
- Horde::fatal($e);
-}
+
+extract(Horde::loadConfiguration('prefs.php', array('prefGroups', '_prefs'), 'imp'));
$app = 'imp';
$chunk = Horde_Util::nonInputVar('chunk');
// Lets see if we are even able to send the user an attachment.
if (!$conf['compose']['link_attachments']) {
- Horde::fatal(_("Linked attachments are forbidden."), $self_url, __LINE__);
+ throw new Horde_Exception(_("Linked attachments are forbidden."));
}
// Gather required form variables.
$time_stamp = Horde_Util::getFormData('t');
$file_name = Horde_Util::getFormData('f');
if (is_null($mail_user) || is_null($time_stamp) || is_null($file_name)) {
- Horde::fatal(_("The attachment was not found."), $self_url, __LINE__);
+ throw new Horde_Exception(_("The attachment was not found."));
}
// Initialize the VFS.
$vfsroot = VFS::singleton($conf['vfs']['type'], Horde::getDriverConfig('vfs', $conf['vfs']['type']));
if (is_a($vfsroot, 'PEAR_Error')) {
- Horde::fatal(sprintf(_("Could not create the VFS backend: %s"), $vfsroot->getMessage()), $self_url, __LINE__);
+ throw new Horde_Exception(sprintf(_("Could not create the VFS backend: %s"), $vfsroot->getMessage()));
}
// Check if the file exists.
$file_name = escapeshellcmd(basename($file_name));
$full_path = sprintf(IMP_Compose::VFS_LINK_ATTACH_PATH . '/%s/%d', $mail_user, $time_stamp);
if (!$vfsroot->exists($full_path, $file_name)) {
- Horde::fatal(_("The specified attachment does not exist. It may have been deleted by the original sender."), $self_url, __LINE__);
+ throw new Horde_Exception(_("The specified attachment does not exist. It may have been deleted by the original sender."));
}
// Check to see if we need to send a verification message.
$file_data = $vfsroot->read($full_path, $file_name);
if (is_a($file_data, 'PEAR_Error')) {
Horde::logMessage($file_data, __FILE__, __LINE__, PEAR_LOG_ERR);
- Horde::fatal(_("The specified file cannot be read."), $self_url, __LINE__);
+ throw new Horde_Exception(_("The specified file cannot be read."));
}
$mime_type = Horde_Mime_Magic::analyzeData($file_data, isset($conf['mime']['magic_db']) ? $conf['mime']['magic_db'] : null);
if ($mime_type === false) {
}
require_once 'Horde/Prefs/UI.php';
-try {
- extract(Horde::loadConfiguration('prefs.php', array('prefGroups', '_prefs'), 'imp'));
-} catch (Horde_Exception $e) {
- Horde::fatal($e);
-}
+extract(Horde::loadConfiguration('prefs.php', array('prefGroups', '_prefs'), 'imp'));
$app = 'imp';
$chunk = Horde_Util::nonInputVar('chunk');
require_once dirname(__FILE__) . '/lib/base.php';
require_once 'Horde/Prefs/UI.php';
-try {
- extract(Horde::loadConfiguration('prefs.php', array('prefGroups', '_prefs'), 'imp'));
-} catch (Horde_Exception $e) {
- Horde::fatal($e);
-}
+extract(Horde::loadConfiguration('prefs.php', array('prefGroups', '_prefs'), 'imp'));
/* Are preferences locked? */
$login_locked = $prefs->isLocked('filter_on_login') || empty($_SESSION['imp']['filteravail']);
* associated with creating the object.
*
* @return Horde_Cache A pointer to a Horde_Cache object.
+ * @throws Horde_Exception
*/
public static function getCache()
{
- try {
- return Horde_Cache::singleton($GLOBALS['conf']['cache']['driver'], Horde::getDriverConfig('cache', $GLOBALS['conf']['cache']['driver']));
- } catch (Horde_Exception $e) {
- Horde::fatal($e);
- }
+ return Horde_Cache::singleton($GLOBALS['conf']['cache']['driver'], Horde::getDriverConfig('cache', $GLOBALS['conf']['cache']['driver']));
}
/**
if ($e->getCode() == 'permission_denied') {
Horde::authenticationFailureRedirect();
}
- Horde::fatal($e, __FILE__, __LINE__, false);
+ throw $e;
}
$conf = &$GLOBALS['conf'];
if (!defined('IMP_TEMPLATES')) {
require_once dirname(__FILE__) . '/lib/base.php';
-try {
- $imp_pgp = Horde_Crypt::singleton(array('IMP', 'Pgp'));
-} catch (Horde_Exception $e) {
- Horde::fatal($e);
-}
-
+$imp_pgp = Horde_Crypt::singleton(array('IMP', 'Pgp'));
$secure_check = Horde::isConnectionSecure();
/* Run through the action handlers */
case 'save_attachment_public_key':
/* Retrieve the key from the message. */
- try {
- $contents = IMP_Contents::singleton(Horde_Util::getFormData('uid') . IMP::IDX_SEP . Horde_Util::getFormData('mailbox'));
- } catch (Horde_Exception $e) {
- Horde::fatal($e);
- }
+ $contents = IMP_Contents::singleton(Horde_Util::getFormData('uid') . IMP::IDX_SEP . Horde_Util::getFormData('mailbox'));
$mime_part = $contents->getMIMEPart(Horde_Util::getFormData('mime_id'));
if (empty($mime_part)) {
- Horde::fatal(new Horde_Exception('Cannot retrieve public key from message.'));
+ throw new Horde_Exception('Cannot retrieve public key from message.');
}
/* Add the public key to the storage system. */
$notification->push($e);
}
-try {
- extract(Horde::loadConfiguration('prefs.php', array('prefGroups', '_prefs'), 'imp'));
-} catch (Horde_Exception $e) {
- Horde::fatal($e);
-}
+extract(Horde::loadConfiguration('prefs.php', array('prefGroups', '_prefs'), 'imp'));
require_once 'Horde/Prefs/UI.php';
$app = 'imp';
require_once dirname(__FILE__) . '/lib/base.php';
-try {
- $imp_smime = Horde_Crypt::singleton(array('IMP', 'Smime'));
-} catch (Horde_Exception $e) {
- Horde::fatal($e);
-}
-
+$imp_smime = Horde_Crypt::singleton(array('IMP', 'Smime'));
$secure_check = Horde::isConnectionSecure();
/* Run through the action handlers */
case 'save_attachment_public_key':
/* Retrieve the key from the message. */
- try {
- $contents = IMP_Contents::singleton(Horde_Util::getFormData('uid') . IMP::IDX_SEP . Horde_Util::getFormData('mailbox'));
- } catch (Horde_Exception $e) {
- Horde::fatal($e);
- }
+ $contents = IMP_Contents::singleton(Horde_Util::getFormData('uid') . IMP::IDX_SEP . Horde_Util::getFormData('mailbox'));
$mime_part = $contents->getMIMEPart(Horde_Util::getFormData('mime_id'));
if (empty($mime_part)) {
- Horde::fatal(new Horde_Exception('Cannot retrieve public key from message.'));
+ throw new Horde_Exception('Cannot retrieve public key from message.');
}
/* Add the public key to the storage system. */
$notification->push($e);
}
-try {
- extract(Horde::loadConfiguration('prefs.php', array('prefGroups', '_prefs'), 'imp'));
-} catch (Horde_Exception $e) {
- Horde::fatal($e);
-}
+extract(Horde::loadConfiguration('prefs.php', array('prefGroups', '_prefs'), 'imp'));
require_once 'Horde/Prefs/UI.php';
$app = 'imp';
/* Show the header. */
require_once 'Horde/Prefs/UI.php';
-try {
- extract(Horde::loadConfiguration('prefs.php', array('prefGroups', '_prefs'), 'imp'));
-} catch (Horde_Exception $e) {
- Horde::fatal($e);
-}
+extract(Horde::loadConfiguration('prefs.php', array('prefGroups', '_prefs'), 'imp'));
$app = 'imp';
$chunk = Horde_Util::nonInputVar('chunk');
exit;
}
- try {
- $contents = IMP_Contents::singleton($uid . IMP::IDX_SEP . $mailbox);
- } catch (Horde_Exception $e) {
- Horde::fatal($e);
- }
+ $contents = IMP_Contents::singleton($uid . IMP::IDX_SEP . $mailbox);
}
/* Run through action handlers */
}
if (!empty($tosave)) {
- try {
- $horde_compress = Horde_Compress::factory('zip');
- $body = $horde_compress->compress($tosave, array('stream' => true));
- } catch (Horde_Exception $e) {
- Horde::fatal($e);
- }
+ $horde_compress = Horde_Compress::factory('zip');
+ $body = $horde_compress->compress($tosave, array('stream' => true));
fseek($body, 0, SEEK_END);
$browser->downloadHeaders($zipfile, 'application/zip', false, ftell($body));
rewind($body);
/* Compress output? */
if (Horde_Util::getFormData('zip')) {
- try {
- $horde_compress = Horde_Compress::factory('zip');
- $body = $horde_compress->compress(array(array('data' => $mime->getContents(), 'name' => $name)), array('stream' => true));
- } catch (Horde_Exception $e) {
- Horde::fatal($e);
- }
+ $horde_compress = Horde_Compress::factory('zip');
+ $body = $horde_compress->compress(array(array('data' => $mime->getContents(), 'name' => $name)), array('stream' => true));
$name .= '.zip';
$type = 'application/zip';
} else {
/* Get the list of filter rules. */
$filters = &$ingo_storage->retrieve(Ingo_Storage::ACTION_FILTERS);
if (is_a($filters, 'PEAR_Error')) {
- Horde::fatal($filters, __FILE__, __LINE__);
+ throw new Horde_Exception($filters);
}
/* Load the Ingo_Script:: driver. */
{
/**
* Constructor.
+ *
+ * @throws Horde_Exception
*/
public function __construct($params = array())
{
if (!Horde_Util::extensionExists('ldap')) {
- Horde::fatal(PEAR::raiseError(_("LDAP support is required but the LDAP module is not available or not loaded.")), __FILE__, __LINE__);
+ throw new Horde_Exception(_("LDAP support is required but the LDAP module is not available or not loaded."));
}
$default_params = array(
* single value or an array of multiple values.
*
* @return array The backend entry.
- * Calls Horde::fatal() on error.
+ * @throws Horde_Exception
*/
static public function getBackend()
{
include INGO_BASE . '/config/backends.php';
if (!isset($backends) || !is_array($backends)) {
- Horde::fatal(PEAR::raiseError(_("No backends configured in backends.php")), __FILE__, __LINE__);
+ throw new Horde_Exception(_("No backends configured in backends.php"));
}
$backend = null;
/* Check for valid backend configuration. */
if (!isset($backend)) {
- Horde::fatal(PEAR::raiseError(_("No backend configured for this host")), __FILE__, __LINE__);
+ throw new Horde_Exception(_("No backend configured for this host"));
}
$backends[$backend]['id'] = $name;
$backend = $backends[$backend];
if (empty($backend['script'])) {
- Horde::fatal(PEAR::raiseError(sprintf(_("No \"%s\" element found in backend configuration."), 'script')), __FILE__, __LINE__);
+ throw new Horde_Exception(sprintf(_("No \"%s\" element found in backend configuration."), 'script'));
} elseif (empty($backend['driver'])) {
- Horde::fatal(PEAR::raiseError(sprintf(_("No \"%s\" element found in backend configuration."), 'driver')), __FILE__, __LINE__);
+ throw new Horde_Exception(sprintf(_("No \"%s\" element found in backend configuration."), 'driver'));
}
/* Make sure the 'params' entry exists. */
/**
* Loads a Ingo_Script:: backend and checks for errors.
*
- * @return Ingo_Script Script object on success, PEAR_Error on failure.
+ * @return Ingo_Script Script object on success.
+ * @throws Horde_Exception
*/
static public function loadIngoScript()
{
$ingo_script = Ingo_Script::factory($_SESSION['ingo']['backend']['script'],
isset($_SESSION['ingo']['backend']['scriptparams']) ? $_SESSION['ingo']['backend']['scriptparams'] : array());
if (is_a($ingo_script, 'PEAR_Error')) {
- Horde::fatal($ingo_script, __FILE__, __LINE__);
+ throw new Horde_Exception($ingo_script);
}
return $ingo_script;
* Constructor.
*
* @param array $params Additional parameters for the subclass.
+ *
+ * @throws Horde_Exception
*/
public function __construct($params = array())
{
array('persistent' => !empty($this->_params['persistent']),
'ssl' => !empty($this->_params['ssl'])));
if (is_a($this->_write_db, 'PEAR_Error')) {
- Horde::fatal($this->_write_db, __FILE__, __LINE__);
+ throw new Horde_Exception($this->_write_db);
}
/* Set DB portability options. */
switch ($this->_write_db->phptype) {
array('persistent' => !empty($params['persistent']),
'ssl' => !empty($params['ssl'])));
if (is_a($this->_db, 'PEAR_Error')) {
- Horde::fatal($this->_db, __FILE__, __LINE__);
+ throw new Horde_Exception($this->_db);
}
switch ($this->_db->phptype) {
if ($e->getCode() == 'permission_denied') {
Horde::authenticationFailureRedirect();
}
- Horde::fatal($e, __FILE__, __LINE__, false);
+ throw $e;
}
$conf = &$GLOBALS['conf'];
if ($e->getCode() == 'permission_denied') {
Horde::authenticationFailureRedirect();
}
- Horde::fatal($e, __FILE__, __LINE__, false);
+ throw $e;
}
$conf = &$GLOBALS['conf'];
if ($e->getCode() == 'permission_denied') {
Horde::authenticationFailureRedirect();
}
- Horde::fatal($e, __FILE__, __LINE__, false);
+ throw $e;
}
//################### </MANUELLER ANMELDE CHECK (WENN base.php NICHT INCLUDIERT WIRD)> ###################
if ($e->getCode() == 'permission_denied') {
Horde::authenticationFailureRedirect();
}
- Horde::fatal($e, __FILE__, __LINE__, false);
+ throw $e;
}
$conf = &$GLOBALS['conf'];
@define('KASTALIA_TEMPLATES', $registry->get('templates'));
if ($e->getCode() == 'permission_denied') {
Horde::authenticationFailureRedirect();
}
- Horde::fatal($e, __FILE__, __LINE__, false);
+ throw $e;
}
$conf = &$GLOBALS['conf'];
define('KRONOLITH_TEMPLATES', $registry->get('templates'));
$pref = Horde_Util::getFormData('pref');
if (!$pref) {
$_prefs = array();
- try {
- extract(Horde::loadConfiguration('prefs.php', array('_prefs'), $app));
- } catch (Horde_Exception $e) {
- Horde::fatal($e, __FILE__, __LINE__);
- }
+ extract(Horde::loadConfiguration('prefs.php', array('_prefs'), $app));
echo '<ul id="pref">';
foreach ($_prefs as $pref => $params) {
$data = News::getFile($file_id);
if ($data instanceof PEAR_Error) {
if (Horde_Auth::isAdmin('news:admin')) {
- Horde::fatal($data, __FILE__, __LINE__);
+ throw new Horde_Exception($data);
} else {
header('HTTP/1.0 404 Not Found');
echo '<h1>HTTP/1.0 404 Not Found</h1>';
$data = News::getFile($file_id);
if ($data instanceof PEAR_Error) {
if (Horde_Auth::isAdmin('news:admin')) {
- Horde::fatal($data, __FILE__, __LINE__);
+ throw new Horde_Exception($data);
} else {
header('HTTP/1.0 404 Not Found');
echo '<h1>HTTP/1.0 404 Not Found</h1>';
exit;
}
- try {
- $zip = Horde_Compress::factory('zip');
- $body = $zip->compress($zipfiles);
- } catch (Horde_Exception $e) {
- Horde::fatal($e);
- }
+ $zip = Horde_Compress::factory('zip');
+ $body = $zip->compress($zipfiles);
$browser->downloadHeaders($news_id . '.zip', 'application/zip', false, strlen($body));
echo $body;
$data = News::getFile($file_id);
if ($data instanceof PEAR_Error) {
if (Horde_Auth::isAdmin('news:admin')) {
- Horde::fatal($data, __FILE__, __LINE__);
+ throw new Horde_Exception($data);
} else {
header('HTTP/1.0 404 Not Found');
echo '<h1>HTTP/1.0 404 Not Found</h1>';
$zipfiles = array('data' => $data, 'name' => $file_id);
- try {
- $zip = Horde_Compress::factory('zip');
- $body = $zip->compress($zipfiles);
- } catch (Horde_Exception $e) {
- Horde::fatal($e);
- }
+ $zip = Horde_Compress::factory('zip');
+ $body = $zip->compress($zipfiles);
$browser->downloadHeaders($file_id . '.zip', 'application/zip', false, strlen($body));
echo $body;
/**
* Attempts to open a persistent connection to the SQL server.
*
- * @return boolean True on success; exits (Horde::fatal()) on error.
+ * @return boolean True on success.
*/
private function _connect()
{
* @param array $params A hash containing any additional configuration
* or connection parameters a subclass might need.
*
- * @return News_Driver The newly created concrete News_Driver
- * instance, or false on an error.
+ * @return News_Driver The newly created concrete News_Driver.
+ * @throws Horde_Exception
*/
static function factory($driver = 'sql', $params = array())
{
require_once NEWS_BASE . '/lib/Driver/' . $driver . '.php';
if (!class_exists($class_name)) {
- Horde::fatal('DRIVER MISSING', __FILE__, __LINE__);
+ throw new Horde_Exception('DRIVER MISSING');
}
return new $class_name($params);
/**
* Attempts to open a persistent connection to the SQL server.
*
- * @return boolean True on success; exits (Horde::fatal()) on error.
+ * @return boolean True on success.
+ * @throws Horde_Exception
*/
private function _connect()
{
$this->write_db = &DB::connect($this->_params,
array('persistent' => !empty($this->_params['persistent'])));
if ($this->write_db instanceof PEAR_Error) {
- Horde::fatal($this->write_db, __FILE__, __LINE__);
+ throw new Horde_Exception($this->write_db);
}
// Set DB portability options.
$this->db = &DB::connect($params,
array('persistent' => !empty($params['persistent'])));
if ($this->db instanceof PEAR_Error) {
- Horde::fatal($this->db, __FILE__, __LINE__);
+ throw new Horde_Exception($this->db);
}
// Set DB portability options.
if ($e->getCode() == 'permission_denied') {
Horde::authenticationFailureRedirect();
}
- Horde::fatal($e, __FILE__, __LINE__, false);
+ throw $e;
}
$conf = &$GLOBALS['conf'];
define('NEWS_TEMPLATES', $registry->get('templates'));
if ($e->getCode() == 'permission_denied') {
Horde::authenticationFailureRedirect();
}
- Horde::fatal($e, __FILE__, __LINE__, false);
+ throw $e;
}
$conf = &$GLOBALS['conf'];
@define('SKOLI_TEMPLATES', $registry->get('templates'));
$pref = Horde_Util::getFormData('pref');
if (!$pref) {
$_prefs = array();
- try {
- extract(Horde::loadConfiguration('prefs.php', array('_prefs'), $app));
- } catch (Horde_Exception $e) {
- Horde::fatal($e, __FILE__, __LINE__);
- }
+ extract(Horde::loadConfiguration('prefs.php', array('_prefs'), $app));
echo '<ul id="pref">';
foreach ($_prefs as $pref => $params) {
if ($e->getCode() == 'permission_denied') {
Horde::authenticationFailureRedirect();
}
- Horde::fatal($e, __FILE__, __LINE__, false);
+ throw $e;
}
if (!defined('TIMEOBJECTS_BASE')) {
/**
* Loads the VFS configuration and initializes the VFS backend.
+ *
+ * @throws Horde_Exception
*/
function _vfsInit()
{
if (!isset($this->_vfs)) {
$v_params = Horde::getVFSConfig('documents');
if (is_a($v_params, 'PEAR_Error')) {
- Horde::fatal($v_params, __FILE__, __LINE__);
+ throw new Horde_Exception($v_params);
}
$result = VFS::singleton($v_params['type'], $v_params['params']);
if (is_a($result, 'PEAR_Error')) {
if ($e->getCode() == 'permission_denied') {
Horde::authenticationFailureRedirect();
}
- Horde::fatal($e, __FILE__, __LINE__, false);
+ throw $e;
}
$conf = $GLOBALS['conf'];
define('TURBA_TEMPLATES', $registry->get('templates'));
unset($config['charset']);
$db = DB::connect($config);
if (is_a($db, 'PEAR_Error')) {
- Horde::fatal($db, __FILE__, __LINE__);
+ throw new Horde_Exception($db);
}
if (!$for_real) {
$cli->message('No changes will done to the existing data. Please read the comments in the code, then set the $for_real flag to true before running.', 'cli.message');
require_once dirname(__FILE__) . '/lib/base.php';
if ($conf['documents']['type'] == 'none') {
- Horde::fatal(new Horde_Exception(_("The VFS backend needs to be configured to enable attachment uploads.")));
+ throw new Horde_Exception(_("The VFS backend needs to be configured to enable attachment uploads."));
}
$source = Horde_Util::getFormData('source');
/* Get the object. */
if (!isset($cfgSources[$source])) {
- Horde::fatal(_("The contact you requested does not exist."), __FILE__, __LINE__);
+ throw new Horde_Exception(_("The contact you requested does not exist."));
}
$driver = Turba_Driver::singleton($source);
$object = $driver->getObject($key);
if (is_a($object, 'PEAR_Error')) {
- Horde::fatal($object, __FILE__, __LINE__);
+ throw new Horde_Exception($object);
}
/* Check permissions. */
if (!$object->hasPermission(PERMS_READ)) {
- Horde::fatal(_("You do not have permission to view this contact."), __FILE__, __LINE__);
+ throw new Horde_Exception(_("You do not have permission to view this contact."));
}
$v_params = Horde::getVFSConfig('documents');
if (is_a($v_params, 'PEAR_Error')) {
- Horde::fatal($v_params, __FILE__, __LINE__);
+ throw new Horde_Exception($v_params);
}
$vfs = VFS::singleton($v_params['type'], $v_params['params']);
if (is_a($vfs, 'PEAR_Error')) {
- Horde::fatal($vfs, __FILE__, __LINE__);
+ throw new Horde_Exception($vfs);
} else {
$data = $vfs->read(TURBA_VFS_PATH . '/' . $object->getValue('__uid'), $filename);
}
if (is_a($data, 'PEAR_Error')) {
Horde::logMessage($data, __FILE__, __LINE__, PEAR_LOG_ERR);
- Horde::fatal(sprintf(_("Access denied to %s"), $filename), __FILE__, __LINE__);
+ throw new Horde_Exception(sprintf(_("Access denied to %s"), $filename));
}
/* Run through action handlers */