From e75c0e96230b24c14ab10e6fccc59ca3a55f00ef Mon Sep 17 00:00:00 2001 From: Chuck Hagenbuch Date: Fri, 27 Mar 2009 16:48:43 -0400 Subject: [PATCH] don't throw exceptions with string --- imp/lib/Crypt/Pgp.php | 4 ++-- imp/lib/Crypt/Smime.php | 38 +++++++++++++++++++------------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/imp/lib/Crypt/Pgp.php b/imp/lib/Crypt/Pgp.php index 106b0c62d..caa81ff41 100644 --- a/imp/lib/Crypt/Pgp.php +++ b/imp/lib/Crypt/Pgp.php @@ -114,7 +114,7 @@ class IMP_Crypt_Pgp extends Horde_Crypt_Pgp /* Make sure the key is valid. */ $key_info = $this->pgpPacketInformation($public_key); if (!isset($key_info['signature'])) { - throw new Horde_Exception(_("Not a valid public key."), 'horde.error'); + throw new Horde_Exception(_("Not a valid public key.")); } /* Remove the '_SIGNATURE' entry. */ @@ -297,7 +297,7 @@ class IMP_Crypt_Pgp extends Horde_Crypt_Pgp global $conf; if (empty($conf['utils']['gnupg_keyserver'])) { - throw new Horde_Exception(_("Public PGP keyserver support has been disabled."), 'horde.warning'); + throw new Horde_Exception(_("Public PGP keyserver support has been disabled.")); } $timeout = (empty($conf['utils']['gnupg_timeout'])) ? PGP_KEYSERVER_TIMEOUT : $conf['utils']['gnupg_timeout']; diff --git a/imp/lib/Crypt/Smime.php b/imp/lib/Crypt/Smime.php index c9764de58..790178756 100644 --- a/imp/lib/Crypt/Smime.php +++ b/imp/lib/Crypt/Smime.php @@ -107,13 +107,13 @@ class IMP_Crypt_Smime extends Horde_Crypt_Smime /* Make sure the certificate is valid. */ $key_info = openssl_x509_parse($cert); if (!is_array($key_info) || !isset($key_info['subject'])) { - throw new Horde_Exception(_("Not a valid public key."), 'horde.error'); + throw new Horde_Exception(_("Not a valid public key.")); } /* Add key to the user's address book. */ $email = $this->getEmailFromKey($cert); if (is_null($email)) { - throw new Horde_Exception(_("No email information located in the public key."), 'horde.error'); + throw new Horde_Exception(_("No email information located in the public key.")); } /* Get the name corresponding to this key. */ @@ -122,12 +122,12 @@ class IMP_Crypt_Smime extends Horde_Crypt_Smime } elseif (isset($key_info['subject']['OU'])) { $name = $key_info['subject']['OU']; } else { - throw new Horde_Exception(_("Not a valid public key."), 'horde.error'); + throw new Horde_Exception(_("Not a valid public key.")); } - $res = $GLOBALS['registry']->call('contacts/addField', array($email, $name, self::PUBKEY_FIELD, $cert, $GLOBALS['prefs']->getValue('add_source'))); - if (is_a($res, 'PEAR_Error')) { - throw new Horde_Exception($res); + $result = $GLOBALS['registry']->call('contacts/addField', array($email, $name, self::PUBKEY_FIELD, $cert, $GLOBALS['prefs']->getValue('add_source'))); + if (is_a($result, 'PEAR_Error')) { + throw new Horde_Exception($result); } } @@ -197,12 +197,12 @@ class IMP_Crypt_Smime extends Horde_Crypt_Smime if (empty($params['sources'])) { return array(); } - $res = $GLOBALS['registry']->call('contacts/getAllAttributeValues', array(self::PUBKEY_FIELD, $params['sources'])); - if (is_a($res, 'PEAR_Error')) { - throw new Horde_Exception($res); + $result = $GLOBALS['registry']->call('contacts/getAllAttributeValues', array(self::PUBKEY_FIELD, $params['sources'])); + if (is_a($result, 'PEAR_Error')) { + throw new Horde_Exception($result); } - return $res; + return $result; } /** @@ -215,9 +215,9 @@ class IMP_Crypt_Smime extends Horde_Crypt_Smime public function deletePublicKey($email) { $params = IMP_Compose::getAddressSearchParams(); - $res = $GLOBALS['registry']->call('contacts/deleteField', array($email, self::PUBKEY_FIELD, $params['sources'])); - if (is_a($res, 'PEAR_Error')) { - throw new Horde_Exception($res); + $result = $GLOBALS['registry']->call('contacts/deleteField', array($email, self::PUBKEY_FIELD, $params['sources'])); + if (is_a($result, 'PEAR_Error')) { + throw new Horde_Exception($result); } } @@ -284,11 +284,11 @@ class IMP_Crypt_Smime extends Horde_Crypt_Smime } elseif (isset($_SESSION['imp']['smime']['null_passphrase'])) { return ($_SESSION['imp']['smime']['null_passphrase']) ? null : false; } else { - $res = $this->verifyPassphrase($private_key, null); + $result = $this->verifyPassphrase($private_key, null); if (!isset($_SESSION['imp']['smime'])) { $_SESSION['imp']['smime'] = array(); } - $_SESSION['imp']['smime']['null_passphrase'] = ($res) ? null : false; + $_SESSION['imp']['smime']['null_passphrase'] = ($result) ? null : false; return $_SESSION['imp']['smime']['null_passphrase']; } } @@ -402,10 +402,10 @@ class IMP_Crypt_Smime extends Horde_Crypt_Smime $params['newpassword'] = $pkpass; } - $res = $this->parsePKCS12Data($pkcs12, $params); - $this->addPersonalPrivateKey($res->private); - $this->addPersonalPublicKey($res->public); - $this->addAdditionalCert($res->certs); + $result = $this->parsePKCS12Data($pkcs12, $params); + $this->addPersonalPrivateKey($result->private); + $this->addPersonalPublicKey($result->public); + $this->addAdditionalCert($result->certs); } /** -- 2.11.0