Remove all Horde::fatal()'s from horde-hatchery
authorMichael M Slusarz <slusarz@curecanti.org>
Fri, 17 Jul 2009 19:25:37 +0000 (13:25 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Fri, 17 Jul 2009 19:53:30 +0000 (13:53 -0600)
42 files changed:
babel/lib/base.php
babel/viewsource.php
chora/lib/base.php
crumb/lib/Driver/sql.php
crumb/lib/base.php
fima/lib/base.php
folks/lib/Driver/sql.php
folks/lib/Friends/sql.php
folks/lib/base.php
framework/Model/lib/Horde/Form.php
imp/acl.php
imp/attachment.php
imp/fetchmailprefs.php
imp/filterprefs.php
imp/lib/IMP.php
imp/lib/base.php
imp/pgp.php
imp/smime.php
imp/stationery.php
imp/view.php
ingo/filters.php
ingo/lib/Driver/Ldap.php
ingo/lib/Ingo.php
ingo/lib/Storage/Sql.php
ingo/lib/base.php
jeta/lib/base.php
kastalia/download.php
kastalia/lib/base.php
kronolith/lib/base.php
kronolith/pref_api.php
news/files.php
news/lib/Categories.php
news/lib/Driver.php
news/lib/Driver/sql.php
news/lib/base.php
skoli/lib/base.php
skoli/pref_api.php
timeobjects/lib/base.php
turba/lib/Object.php
turba/lib/base.php
turba/scripts/upgrades/2.1_to_2.2_sql_schema.php
turba/view.php

index db363b6..c68e9b2 100644 (file)
@@ -35,7 +35,7 @@ try {
     if ($e->getCode() == 'permission_denied') {
         Horde::authenticationFailureRedirect();
     }
-    Horde::fatal($e, __FILE__, __LINE__, false);
+    throw $e;
 }
 
 $conf = &$GLOBALS['conf'];
@@ -65,19 +65,19 @@ $template = new Horde_Template();
 
 /* 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;
@@ -88,7 +88,7 @@ if (($lang = Horde_Util::getFormData('display_language')) !== null) {
     }
     $_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')));
@@ -102,11 +102,11 @@ if ($app) {
 $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 */
index a61a4c4..b62b1bd 100644 (file)
@@ -22,12 +22,12 @@ if ($app == 'horde') {
 }
 
 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
@@ -44,38 +44,38 @@ require $registry->get('templates', 'horde') . '/common-footer.inc';
 
 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("(&lt;\?php&nbsp;)+", "", highlight_string("<?php ".$code_line, 1))."<br />";
        }
-       
+
        if ($r1 == $sline) {
            $r .= sprintf('<tr><td align="right" class="control"><b>%s&nbsp;</b></td><td class="item0">%s</td></tr>', $r1, $r2);
        } else {
            $r .= sprintf('<tr><td align="right" class="control">%s&nbsp;</td><td>%s</td></tr>', $r1, $r2);
        }
     }
-    
+
     $r = '<table width="100%" cellspacing=0>' . $r . '</table>';
 
     echo "<div class=\"code\">".$r."</div>";
index 40c0a08..23521c3 100644 (file)
@@ -37,7 +37,7 @@ try {
     if ($e->getCode() == 'permission_denied') {
         Horde::authenticationFailureRedirect();
     }
-    Horde::fatal($e, __FILE__, __LINE__, false);
+    throw $e;
 }
 $conf = &$GLOBALS['conf'];
 define('CHORA_TEMPLATES', $registry->get('templates'));
index d8a9065..bbcbcfd 100644 (file)
@@ -20,8 +20,6 @@
  * 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
@@ -96,7 +94,7 @@ class Crumb_Driver_sql extends Crumb_Driver {
     /**
      * 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()
     {
@@ -122,7 +120,7 @@ class Crumb_Driver_sql extends Crumb_Driver {
         $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.
@@ -140,7 +138,7 @@ class Crumb_Driver_sql extends Crumb_Driver {
             $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.
index 6a7a23f..4481d3c 100644 (file)
@@ -30,7 +30,7 @@ try {
     if ($e->getCode() == 'permission_denied') {
         Horde::authenticationFailureRedirect();
     }
-    Horde::fatal($e, __FILE__, __LINE__, false);
+    throw $e;
 }
 $conf = &$GLOBALS['conf'];
 @define('CRUMB_TEMPLATES', $registry->get('templates'));
index ea8b8e5..e793a15 100644 (file)
@@ -33,7 +33,7 @@ try {
     if ($e->getCode() == 'permission_denied') {
         Horde::authenticationFailureRedirect();
     }
-    Horde::fatal($e, __FILE__, __LINE__, false);
+    throw $e;
 }
 $conf = &$GLOBALS['conf'];
 @define('FIMA_TEMPLATES', $registry->get('templates'));
index 41c254b..7c1c519 100644 (file)
@@ -557,7 +557,7 @@ class Folks_Driver_sql extends Folks_Driver {
     /**
      * 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()
     {
@@ -579,7 +579,7 @@ class Folks_Driver_sql extends Folks_Driver {
         $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.
@@ -597,7 +597,7 @@ class Folks_Driver_sql extends Folks_Driver {
             $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.
@@ -616,4 +616,4 @@ class Folks_Driver_sql extends Folks_Driver {
 
         return true;
     }
-}
\ No newline at end of file
+}
index a31ad88..fd4d037 100644 (file)
@@ -196,7 +196,7 @@ class Folks_Friends_sql extends Folks_Friends {
     /**
      * 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()
     {
@@ -223,7 +223,7 @@ class Folks_Friends_sql extends Folks_Friends {
         $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.
@@ -241,7 +241,7 @@ class Folks_Friends_sql extends Folks_Friends {
             $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.
index b3d65d8..e1ca9cd 100644 (file)
@@ -25,7 +25,7 @@ try {
     if ($e->getCode() == 'permission_denied') {
         Horde::authenticationFailureRedirect();
     }
-    Horde::fatal($e, __FILE__, __LINE__, false);
+    throw $e;
 }
 $conf = &$GLOBALS['conf'];
 define('FOLKS_TEMPLATES', $registry->get('templates'));
index 89b9f6c..4735833 100644 (file)
@@ -112,7 +112,7 @@ class Horde_Form {
     {
         $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);
index 4d11959..0682a88 100644 (file)
@@ -70,11 +70,7 @@ case 'imp_acl_set':
     }
 
     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);
@@ -126,19 +122,12 @@ if (empty($folder)) {
     $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');
index 7c90c6f..e1b6d87 100644 (file)
@@ -25,7 +25,7 @@ $self_url = Horde::selfUrl(false, true, true);
 
 // 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.
@@ -33,13 +33,13 @@ $mail_user = Horde_Util::getFormData('u');
 $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.
@@ -48,7 +48,7 @@ $time_stamp = basename($time_stamp);
 $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.
@@ -112,7 +112,7 @@ if ($conf['compose']['link_attachments_notify']) {
 $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) {
index 7c3573d..6eeceb5 100644 (file)
@@ -88,11 +88,7 @@ case 'fetchmail_prefs_delete':
 }
 
 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');
index b54ca6b..02a1d71 100644 (file)
 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']);
index 103aa39..779e4da 100644 (file)
@@ -1641,14 +1641,11 @@ class IMP
      * 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']));
     }
 
     /**
index 5941794..f43f120 100644 (file)
@@ -66,7 +66,7 @@ try {
     if ($e->getCode() == 'permission_denied') {
         Horde::authenticationFailureRedirect();
     }
-    Horde::fatal($e, __FILE__, __LINE__, false);
+    throw $e;
 }
 $conf = &$GLOBALS['conf'];
 if (!defined('IMP_TEMPLATES')) {
index 2e1ffed..82eca7a 100644 (file)
@@ -71,12 +71,7 @@ function _reloadWindow()
 
 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 */
@@ -258,14 +253,10 @@ case 'save_options':
 
 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. */
@@ -302,11 +293,7 @@ try {
     $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';
index b74b4cb..db011bf 100644 (file)
@@ -80,12 +80,7 @@ function _printKeyInfo($cert)
 
 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 */
@@ -178,14 +173,10 @@ case 'process_import_personal_certs':
 
 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. */
@@ -219,11 +210,7 @@ try {
     $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';
index f288f74..e05c19d 100644 (file)
@@ -95,11 +95,7 @@ if ($stationery['t'] == 'html') {
 
 /* 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');
index 742afa3..d5c4665 100644 (file)
@@ -82,11 +82,7 @@ if ($actionID == 'compose_attach_preview') {
         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 */
@@ -111,12 +107,8 @@ case 'download_all':
     }
 
     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);
@@ -135,12 +127,8 @@ case 'download_render':
 
         /* 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 {
index 786ec33..760affa 100644 (file)
@@ -15,7 +15,7 @@ require_once dirname(__FILE__) . '/lib/base.php';
 /* 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. */
index d6a5ddf..5986d9c 100644 (file)
@@ -13,11 +13,13 @@ class Ingo_Driver_Ldap extends Ingo_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(
index 1bf533b..9b2f9f2 100644 (file)
@@ -207,13 +207,13 @@ class Ingo
      * 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;
@@ -237,16 +237,16 @@ class Ingo
 
         /* 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. */
@@ -260,14 +260,15 @@ class Ingo
     /**
      * 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;
index 6b3c45b..137fa03 100644 (file)
@@ -56,6 +56,8 @@ class Ingo_Storage_Sql extends Ingo_Storage
      * Constructor.
      *
      * @param array $params  Additional parameters for the subclass.
+     *
+     * @throws Horde_Exception
      */
     public function __construct($params = array())
     {
@@ -84,7 +86,7 @@ class Ingo_Storage_Sql extends Ingo_Storage
                                         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) {
@@ -103,7 +105,7 @@ class Ingo_Storage_Sql extends Ingo_Storage
                                       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) {
index 63b913d..7b9ed37 100644 (file)
@@ -26,7 +26,7 @@ try {
     if ($e->getCode() == 'permission_denied') {
         Horde::authenticationFailureRedirect();
     }
-    Horde::fatal($e, __FILE__, __LINE__, false);
+    throw $e;
 }
 $conf = &$GLOBALS['conf'];
 
index 019e895..6f855fb 100644 (file)
@@ -25,7 +25,7 @@ try {
     if ($e->getCode() == 'permission_denied') {
         Horde::authenticationFailureRedirect();
     }
-    Horde::fatal($e, __FILE__, __LINE__, false);
+    throw $e;
 }
 
 $conf = &$GLOBALS['conf'];
index 577c37b..72ab0f4 100755 (executable)
@@ -37,7 +37,7 @@ try {
     if ($e->getCode() == 'permission_denied') {
         Horde::authenticationFailureRedirect();
     }
-    Horde::fatal($e, __FILE__, __LINE__, false);
+    throw $e;
 }
 //################### </MANUELLER ANMELDE CHECK (WENN base.php NICHT INCLUDIERT WIRD)> ###################
 
index 7827951..52e3596 100755 (executable)
@@ -27,7 +27,7 @@ try {
     if ($e->getCode() == 'permission_denied') {
         Horde::authenticationFailureRedirect();
     }
-    Horde::fatal($e, __FILE__, __LINE__, false);
+    throw $e;
 }
 $conf = &$GLOBALS['conf'];
 @define('KASTALIA_TEMPLATES', $registry->get('templates'));
index 53fec49..580311f 100644 (file)
@@ -34,7 +34,7 @@ try {
     if ($e->getCode() == 'permission_denied') {
         Horde::authenticationFailureRedirect();
     }
-    Horde::fatal($e, __FILE__, __LINE__, false);
+    throw $e;
 }
 $conf = &$GLOBALS['conf'];
 define('KRONOLITH_TEMPLATES', $registry->get('templates'));
index 795a75c..887a76e 100644 (file)
@@ -34,11 +34,7 @@ require_once $appbase . '/lib/base.php';
 $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) {
index 4085fb0..e0df5ee 100644 (file)
@@ -31,7 +31,7 @@ case 'download_file':
     $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>';
@@ -48,7 +48,7 @@ case 'view_file':
     $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>';
@@ -95,12 +95,8 @@ case 'download_zip_all':
         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;
 
@@ -110,7 +106,7 @@ case 'download_zip':
     $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>';
@@ -120,12 +116,8 @@ case 'download_zip':
 
     $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;
 
index bff3ab9..2c7727f 100644 (file)
@@ -598,7 +598,7 @@ class News_Categories {
     /**
      * 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()
     {
index ea772e4..691226a 100644 (file)
@@ -30,8 +30,8 @@ class News_Driver {
      * @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())
     {
@@ -39,7 +39,7 @@ class News_Driver {
         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);
index 3c6dea7..e8fad41 100644 (file)
@@ -371,7 +371,8 @@ class News_Driver_sql extends News_Driver {
     /**
      * 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()
     {
@@ -396,7 +397,7 @@ class News_Driver_sql extends News_Driver {
         $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.
@@ -414,7 +415,7 @@ class News_Driver_sql extends News_Driver {
             $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.
index 2c7c865..a046d63 100644 (file)
@@ -30,7 +30,7 @@ try {
     if ($e->getCode() == 'permission_denied') {
         Horde::authenticationFailureRedirect();
     }
-    Horde::fatal($e, __FILE__, __LINE__, false);
+    throw $e;
 }
 $conf = &$GLOBALS['conf'];
 define('NEWS_TEMPLATES', $registry->get('templates'));
index 78654c2..1405fa0 100644 (file)
@@ -25,7 +25,7 @@ try {
     if ($e->getCode() == 'permission_denied') {
         Horde::authenticationFailureRedirect();
     }
-    Horde::fatal($e, __FILE__, __LINE__, false);
+    throw $e;
 }
 $conf = &$GLOBALS['conf'];
 @define('SKOLI_TEMPLATES', $registry->get('templates'));
index dbe151e..5e1ab14 100644 (file)
@@ -36,11 +36,7 @@ require_once $appbase . '/lib/base.php';
 $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) {
index 7b194b4..28b3be9 100644 (file)
@@ -36,7 +36,7 @@ try {
     if ($e->getCode() == 'permission_denied') {
         Horde::authenticationFailureRedirect();
     }
-    Horde::fatal($e, __FILE__, __LINE__, false);
+    throw $e;
 }
 
 if (!defined('TIMEOBJECTS_BASE')) {
index 12aaed5..06f9d77 100644 (file)
@@ -379,13 +379,15 @@ class Turba_Object {
 
     /**
      * 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')) {
index 46296fb..b009115 100644 (file)
@@ -24,7 +24,7 @@ try {
     if ($e->getCode() == 'permission_denied') {
         Horde::authenticationFailureRedirect();
     }
-    Horde::fatal($e, __FILE__, __LINE__, false);
+    throw $e;
 }
 $conf = $GLOBALS['conf'];
 define('TURBA_TEMPLATES', $registry->get('templates'));
index 5572edb..a093009 100755 (executable)
@@ -55,7 +55,7 @@ $config['password'] = $db_pass;
 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');
index f96d36d..63bed7f 100644 (file)
@@ -13,7 +13,7 @@
 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');
@@ -24,32 +24,32 @@ $type = Horde_Util::getFormData('type');
 
 /* 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 */