From: Michael M Slusarz Date: Fri, 18 Dec 2009 18:49:53 +0000 (-0700) Subject: Add IMP_Exception X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=747fde5768e6f85fc066a620d54cd5db48a2aad6;p=horde.git Add IMP_Exception --- diff --git a/imp/attachment.php b/imp/attachment.php index 3dc49428d..e5e86361f 100644 --- a/imp/attachment.php +++ b/imp/attachment.php @@ -23,7 +23,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']) { - throw new Horde_Exception(_("Linked attachments are forbidden.")); + throw new IMP_Exception(_("Linked attachments are forbidden.")); } // Gather required form variables. @@ -31,13 +31,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)) { - throw new Horde_Exception(_("The attachment was not found.")); + throw new IMP_Exception(_("The attachment was not found.")); } // Initialize the VFS. $vfsroot = VFS::singleton($conf['vfs']['type'], Horde::getDriverConfig('vfs', $conf['vfs']['type'])); if ($vfsroot instanceof PEAR_Error) { - throw new Horde_Exception(sprintf(_("Could not create the VFS backend: %s"), $vfsroot->getMessage())); + throw new IMP_Exception(sprintf(_("Could not create the VFS backend: %s"), $vfsroot->getMessage())); } // Check if the file exists. @@ -46,7 +46,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)) { - throw new Horde_Exception(_("The specified attachment does not exist. It may have been deleted by the original sender.")); + throw new IMP_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. @@ -110,7 +110,7 @@ if ($conf['compose']['link_attachments_notify']) { $file_data = $vfsroot->read($full_path, $file_name); if ($file_data instanceof PEAR_Error) { Horde::logMessage($file_data, __FILE__, __LINE__, PEAR_LOG_ERR); - throw new Horde_Exception(_("The specified file cannot be read.")); + throw new IMP_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) { diff --git a/imp/config/hooks.php.dist b/imp/config/hooks.php.dist index fbf21e69e..0f30312eb 100644 --- a/imp/config/hooks.php.dist +++ b/imp/config/hooks.php.dist @@ -498,11 +498,11 @@ class IMP_Hooks // // $session = ssh2_connect($host); // if (!$session) { -// throw new Horde_Exception(_("Connection to server failed."), 'horde.error'); +// throw new IMP_Exception(_("Connection to server failed."), 'horde.error'); // } // // if (!ssh2_auth_password($session, $user, $pass)) { -// throw new Horde_Exception(_("Authentication failed."), 'horde.error'); +// throw new IMP_Exception(_("Authentication failed."), 'horde.error'); // } // // $stream = ssh2_exec($session, $command, false); @@ -516,7 +516,7 @@ class IMP_Hooks * Retrieves public S/MIME keys of message recipients. * * The hook will be called first when searching for the keys, and further - * lookup techniques will only be used if the hook throws an excpetion or + * lookup techniques will only be used if the hook throws an exception or * returns an empty result. * * @param string $address The email address of the recipient. @@ -558,7 +558,7 @@ class IMP_Hooks * Retrieves public PGP keys of message recipients. * * The hook will be called first when searching for the keys, and further - * lookup techniques will only be used if the hook throws an excpetion or + * lookup techniques will only be used if the hook throws an exception or * returns an empty result. * * @param string $address The email address of the recipient. diff --git a/imp/lib/Exception.php b/imp/lib/Exception.php new file mode 100644 index 000000000..743c8af81 --- /dev/null +++ b/imp/lib/Exception.php @@ -0,0 +1,15 @@ + + * @package IMP + */ +class IMP_Exception extends Horde_Exception +{ +} diff --git a/imp/lib/Imap/Acl.php b/imp/lib/Imap/Acl.php index 0459fcddf..9f11d8264 100644 --- a/imp/lib/Imap/Acl.php +++ b/imp/lib/Imap/Acl.php @@ -40,6 +40,7 @@ class IMP_Imap_Acl * It will only create a new instance if no instance currently exists. * * @return IMP_Imap_Acl The created concrete instance. + * @throws Horde_Exception */ static public function singleton() { @@ -52,6 +53,8 @@ class IMP_Imap_Acl /** * Constructor. + * + * @throws Horde_Exception */ protected function __construct() { diff --git a/imp/pgp.php b/imp/pgp.php index 0f54a32eb..9725d9763 100644 --- a/imp/pgp.php +++ b/imp/pgp.php @@ -265,7 +265,7 @@ case 'save_attachment_public_key': $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)) { - throw new Horde_Exception('Cannot retrieve public key from message.'); + throw new IMP_Exception('Cannot retrieve public key from message.'); } /* Add the public key to the storage system. */ diff --git a/imp/saveimage.php b/imp/saveimage.php index 4894a74c5..914fdfdb2 100644 --- a/imp/saveimage.php +++ b/imp/saveimage.php @@ -40,7 +40,7 @@ case 'save_image': if (!$registry->hasMethod('images/selectGalleries') || !$registry->hasMethod('images/saveImage')) { - throw new Horde_Exception(_("Image saving is not available.")); + throw new IMP_Exception(_("Image saving is not available.")); } /* Build the template. */ diff --git a/imp/smime.php b/imp/smime.php index 46f8f65e9..c0eb48ad6 100644 --- a/imp/smime.php +++ b/imp/smime.php @@ -187,7 +187,7 @@ case 'save_attachment_public_key': $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)) { - throw new Horde_Exception('Cannot retrieve public key from message.'); + throw new IMP_Exception('Cannot retrieve public key from message.'); } /* Add the public key to the storage system. */