From 6e3e99db0e636a6bc8e408751deea39f41abd427 Mon Sep 17 00:00:00 2001 From: Gunnar Wrobel Date: Wed, 10 Feb 2010 15:45:50 +0100 Subject: [PATCH] Remove second exception parameter if it is a string. Having a string as does not have any effect as it gets set to zero in the Exception constructor. --- framework/Block/lib/Horde/Block/Layout/Manager.php | 6 ++--- framework/Crypt/lib/Horde/Crypt/Pgp.php | 28 +++++++++++----------- framework/Crypt/lib/Horde/Crypt/Smime.php | 22 ++++++++--------- imp/lib/Quota.php | 2 +- ingo/lib/Storage/Blacklist.php | 2 +- ingo/lib/Storage/Whitelist.php | 2 +- 6 files changed, 31 insertions(+), 31 deletions(-) diff --git a/framework/Block/lib/Horde/Block/Layout/Manager.php b/framework/Block/lib/Horde/Block/Layout/Manager.php index 42766d21d..b1d9c6de6 100644 --- a/framework/Block/lib/Horde/Block/Layout/Manager.php +++ b/framework/Block/lib/Horde/Block/Layout/Manager.php @@ -393,7 +393,7 @@ class Horde_Block_Layout_Manager extends Horde_Block_Layout if (!isset($this->_layout[$row][$col]) || $this->isEmpty($row, $col) || $this->isCovered($row, $col)) { - throw new Horde_Exception('No block exists at the requested position', 'horde.error'); + throw new Horde_Exception('No block exists at the requested position'); } return array( @@ -419,7 +419,7 @@ class Horde_Block_Layout_Manager extends Horde_Block_Layout public function setBlockInfo($row, $col, $info = array()) { if (!isset($this->_layout[$row][$col])) { - throw new Horde_Exception('No block exists at the requested position', 'horde.error'); + throw new Horde_Exception('No block exists at the requested position'); } if (isset($info['app'])) { @@ -484,7 +484,7 @@ class Horde_Block_Layout_Manager extends Horde_Block_Layout return count($this->_layout[$row]); } - throw new Horde_Exception(sprintf('The specified row (%d) does not exist.', $row), 'horde.error'); + throw new Horde_Exception(sprintf('The specified row (%d) does not exist.', $row)); } /** diff --git a/framework/Crypt/lib/Horde/Crypt/Pgp.php b/framework/Crypt/lib/Horde/Crypt/Pgp.php index ff4683a65..b4ab9a59a 100644 --- a/framework/Crypt/lib/Horde/Crypt/Pgp.php +++ b/framework/Crypt/lib/Horde/Crypt/Pgp.php @@ -214,7 +214,7 @@ class Horde_Crypt_Pgp extends Horde_Crypt if (!empty($result->stderr)) { $msg .= ' ' . _("Returned error message:") . ' ' . $result->stderr; } - throw new Horde_Exception($msg, 'horde.error'); + throw new Horde_Exception($msg); } return array('public' => $public_key, 'private' => $secret_key); @@ -644,7 +644,7 @@ class Horde_Crypt_Pgp extends Horde_Crypt /* Get e-mail address of public key. */ $key_info = $this->pgpPacketInformation($public_key); if (!isset($key_info['signature']['id1']['email'])) { - throw new Horde_Exception(_("Could not determine the recipient's e-mail address."), 'horde.error'); + throw new Horde_Exception(_("Could not determine the recipient's e-mail address.")); } /* Encrypt a test message. */ @@ -744,7 +744,7 @@ class Horde_Crypt_Pgp extends Horde_Crypt return substr($start, 0, $length); } - throw new Horde_Exception(_("Could not obtain public key from the keyserver."), 'horde.error'); + throw new Horde_Exception(_("Could not obtain public key from the keyserver.")); } /** @@ -926,9 +926,9 @@ class Horde_Crypt_Pgp extends Horde_Crypt } while (++$connRefuse < self::KEYSERVER_REFUSE); if ($errno == 0) { - throw new Horde_Exception(_("Connection refused to the public keyserver."), 'horde.error'); + throw new Horde_Exception(_("Connection refused to the public keyserver.")); } else { - throw new Horde_Exception(sprintf(_("Connection refused to the public keyserver. Reason: %s (%s)"), Horde_String::convertCharset($errstr, Horde_Nls::getExternalCharset()), $errno), 'horde.error'); + throw new Horde_Exception(sprintf(_("Connection refused to the public keyserver. Reason: %s (%s)"), Horde_String::convertCharset($errstr, Horde_Nls::getExternalCharset()), $errno)); } } @@ -1110,7 +1110,7 @@ class Horde_Crypt_Pgp extends Horde_Crypt $result = $this->_callGpg($cmdline, 'w', empty($params['symmetric']) ? null : $params['passphrase'], true, true); if (empty($result->output)) { $error = preg_replace('/\n.*/', '', $result->stderr); - throw new Horde_Exception(_("Could not PGP encrypt message: ") . $error, 'horde.error'); + throw new Horde_Exception(_("Could not PGP encrypt message: ") . $error); } return $result->output; @@ -1142,7 +1142,7 @@ class Horde_Crypt_Pgp extends Horde_Crypt if (!isset($params['pubkey']) || !isset($params['privkey']) || !isset($params['passphrase'])) { - throw new Horde_Exception(_("A public PGP key, private PGP key, and passphrase are required to sign a message."), 'horde.error'); + throw new Horde_Exception(_("A public PGP key, private PGP key, and passphrase are required to sign a message.")); } /* Create temp files for input. */ @@ -1179,7 +1179,7 @@ class Horde_Crypt_Pgp extends Horde_Crypt $result = $this->_callGpg($cmdline, 'w', $params['passphrase'], true, true); if (empty($result->output)) { $error = preg_replace('/\n.*/', '', $result->stderr); - throw new Horde_Exception(_("Could not PGP sign message: ") . $error, 'horde.error'); + throw new Horde_Exception(_("Could not PGP sign message: ") . $error); } return $result->output; @@ -1218,7 +1218,7 @@ class Horde_Crypt_Pgp extends Horde_Crypt /* Check for required parameters. */ if (!isset($params['passphrase']) && empty($params['no_passphrase'])) { - throw new Horde_Exception(_("A passphrase is required to decrypt a message."), 'horde.error'); + throw new Horde_Exception(_("A passphrase is required to decrypt a message.")); } /* Create temp files. */ @@ -1254,7 +1254,7 @@ class Horde_Crypt_Pgp extends Horde_Crypt } if (empty($result->output)) { $error = preg_replace('/\n.*/', '', $result->stderr); - throw new Horde_Exception(_("Could not decrypt PGP data: ") . $error, 'horde.error'); + throw new Horde_Exception(_("Could not decrypt PGP data: ") . $error); } /* Create the return object. */ @@ -1285,11 +1285,11 @@ class Horde_Crypt_Pgp extends Horde_Crypt { /* Check for required parameters. */ if (!isset($params['pubkey'])) { - throw new Horde_Exception(_("A public PGP key is required to verify a signed message."), 'horde.error'); + throw new Horde_Exception(_("A public PGP key is required to verify a signed message.")); } if (($params['type'] === 'detached-signature') && !isset($params['signature'])) { - throw new Horde_Exception(_("The detached PGP signature block is required to verify the signed message."), 'horde.error'); + throw new Horde_Exception(_("The detached PGP signature block is required to verify the signed message.")); } $good_sig_flag = 0; @@ -1348,7 +1348,7 @@ class Horde_Crypt_Pgp extends Horde_Crypt * Bad signature: * gpg: BAD signature from "blah blah blah (Comment)" */ if (strpos($result, 'gpg: BAD signature') !== false) { - throw new Horde_Exception($result, 'horde.error'); + throw new Horde_Exception($result); } $ob = new stdClass; @@ -1626,7 +1626,7 @@ class Horde_Crypt_Pgp extends Horde_Crypt /* If the key is empty, something went wrong. */ if (empty($results->output)) { - throw new Horde_Exception(_("Revocation key not generated successfully."), 'horde.error'); + throw new Horde_Exception(_("Revocation key not generated successfully.")); } return $results->output; diff --git a/framework/Crypt/lib/Horde/Crypt/Smime.php b/framework/Crypt/lib/Horde/Crypt/Smime.php index 71faac5c8..dd6e6802d 100644 --- a/framework/Crypt/lib/Horde/Crypt/Smime.php +++ b/framework/Crypt/lib/Horde/Crypt/Smime.php @@ -196,9 +196,9 @@ class Horde_Crypt_Smime extends Horde_Crypt if ($result === true) { throw new Horde_Exception(_("Message Verified Successfully but the signer's certificate could not be verified."), 'horde.warning'); } elseif ($result == -1) { - throw new Horde_Exception(_("Verification failed - an unknown error has occurred."), 'horde.error'); + throw new Horde_Exception(_("Verification failed - an unknown error has occurred.")); } else { - throw new Horde_Exception(_("Verification failed - this message may have been tampered with."), 'horde.error'); + throw new Horde_Exception(_("Verification failed - this message may have been tampered with.")); } $ob->cert = file_get_contents($output); @@ -236,7 +236,7 @@ class Horde_Crypt_Smime extends Horde_Crypt return $ret; } - throw new Horde_Exception(_("OpenSSL error: Could not extract data from signed S/MIME part."), 'horde.error'); + throw new Horde_Exception(_("OpenSSL error: Could not extract data from signed S/MIME part.")); } /** @@ -319,7 +319,7 @@ class Horde_Crypt_Smime extends Horde_Crypt { /* Check for required parameters. */ if (!isset($params['pubkey'])) { - throw new Horde_Exception(_("A public S/MIME key is required to encrypt a message."), 'horde.error'); + throw new Horde_Exception(_("A public S/MIME key is required to encrypt a message.")); } /* Create temp files for input/output. */ @@ -338,7 +338,7 @@ class Horde_Crypt_Smime extends Horde_Crypt } } - throw new Horde_Exception(_("Could not S/MIME encrypt message."), 'horde.error'); + throw new Horde_Exception(_("Could not S/MIME encrypt message.")); } /** @@ -368,7 +368,7 @@ class Horde_Crypt_Smime extends Horde_Crypt if (!isset($params['pubkey']) || !isset($params['privkey']) || !array_key_exists('passphrase', $params)) { - throw new Horde_Exception(_("A public S/MIME key, private S/MIME key, and passphrase are required to sign a message."), 'horde.error'); + throw new Horde_Exception(_("A public S/MIME key, private S/MIME key, and passphrase are required to sign a message.")); } /* Create temp files for input/output/certificates. */ @@ -399,7 +399,7 @@ class Horde_Crypt_Smime extends Horde_Crypt } if (!$res) { - throw new Horde_Exception(_("Could not S/MIME sign message."), 'horde.error'); + throw new Horde_Exception(_("Could not S/MIME sign message.")); } $data = file_get_contents($output); @@ -430,7 +430,7 @@ class Horde_Crypt_Smime extends Horde_Crypt if (!isset($params['pubkey']) || !isset($params['privkey']) || !array_key_exists('passphrase', $params)) { - throw new Horde_Exception(_("A public S/MIME key, private S/MIME key, and passphrase are required to decrypt a message."), 'horde.error'); + throw new Horde_Exception(_("A public S/MIME key, private S/MIME key, and passphrase are required to decrypt a message.")); } /* Create temp files for input/output. */ @@ -448,7 +448,7 @@ class Horde_Crypt_Smime extends Horde_Crypt return file_get_contents($output); } - throw new Horde_Exception(_("Could not decrypt S/MIME data."), 'horde.error'); + throw new Horde_Exception(_("Could not decrypt S/MIME data.")); } /** @@ -1225,7 +1225,7 @@ class Horde_Crypt_Smime extends Horde_Crypt $this->checkForOpenSSL(); if (!isset($params['sslpath'])) { - throw new Horde_Exception(_("No path to the OpenSSL binary provided. The OpenSSL binary is necessary to work with PKCS 12 data."), 'horde.error'); + throw new Horde_Exception(_("No path to the OpenSSL binary provided. The OpenSSL binary is necessary to work with PKCS 12 data.")); } $sslpath = escapeshellcmd($params['sslpath']); @@ -1264,7 +1264,7 @@ class Horde_Crypt_Smime extends Horde_Crypt $ob->private = trim(file_get_contents($output)); if (empty($ob->private)) { - throw new Horde_Exception(_("Password incorrect"), 'horde.error'); + throw new Horde_Exception(_("Password incorrect")); } /* Extract the client public key next. */ diff --git a/imp/lib/Quota.php b/imp/lib/Quota.php index 0bed79e65..dd61045f1 100644 --- a/imp/lib/Quota.php +++ b/imp/lib/Quota.php @@ -74,7 +74,7 @@ class IMP_Quota return new $class($params); } - throw new Horde_Exception('Could not create IMP_Quota instance: ' . $driver, 'horde.error'); + throw new Horde_Exception('Could not create IMP_Quota instance: ' . $driver); } /** diff --git a/ingo/lib/Storage/Blacklist.php b/ingo/lib/Storage/Blacklist.php index e1aeca00c..faf7fe80b 100644 --- a/ingo/lib/Storage/Blacklist.php +++ b/ingo/lib/Storage/Blacklist.php @@ -30,7 +30,7 @@ class Ingo_Storage_Blacklist extends Ingo_Storage_Rule if (!empty($GLOBALS['conf']['storage']['maxblacklist'])) { $addr_count = count($addr); if ($addr_count > $GLOBALS['conf']['storage']['maxblacklist']) { - throw new Ingo_Exception(sprintf(_("Maximum number of blacklisted addresses exceeded (Total addresses: %s, Maximum addresses: %s). Could not add new addresses to blacklist."), $addr_count, $GLOBALS['conf']['storage']['maxblacklist']), 'horde.error'); + throw new Ingo_Exception(sprintf(_("Maximum number of blacklisted addresses exceeded (Total addresses: %s, Maximum addresses: %s). Could not add new addresses to blacklist."), $addr_count, $GLOBALS['conf']['storage']['maxblacklist'])); } } diff --git a/ingo/lib/Storage/Whitelist.php b/ingo/lib/Storage/Whitelist.php index 919b92f52..6d3218141 100644 --- a/ingo/lib/Storage/Whitelist.php +++ b/ingo/lib/Storage/Whitelist.php @@ -35,7 +35,7 @@ class Ingo_Storage_Whitelist extends Ingo_Storage_Rule if (!empty($GLOBALS['conf']['storage']['maxwhitelist'])) { $addr_count = count($addr); if ($addr_count > $GLOBALS['conf']['storage']['maxwhitelist']) { - throw new Ingo_Exception(sprintf(_("Maximum number of whitelisted addresses exceeded (Total addresses: %s, Maximum addresses: %s). Could not add new addresses to whitelist."), $addr_count, $GLOBALS['conf']['storage']['maxwhitelist']), 'horde.error'); + throw new Ingo_Exception(sprintf(_("Maximum number of whitelisted addresses exceeded (Total addresses: %s, Maximum addresses: %s). Could not add new addresses to whitelist."), $addr_count, $GLOBALS['conf']['storage']['maxwhitelist'])); } } -- 2.11.0