*
* @param integer $identity The identity to verify.
*
- * @return bool|object True if the properties are valid.
* @throws Horde_Exception
*/
public function verify($identity = null)
$var = new Horde_Form_Variable('', 'replyto_addr', $email, false);
/* Verify From address. */
- if ($email->isValid($var, $vars, $this->getValue('from_addr', $identity), $error_message)) {
- return true;
+ if (!$email->isValid($var, $vars, $this->getValue('from_addr', $identity), $error_message)) {
+ throw new Horde_Exception($error_message);
}
-
- throw new Horde_Exception($error_message);
}
/**
$result = $registry->call('contacts/import', array(array('name' => $newName, 'email' => $newAddress), 'array', $prefs->getValue('add_source')));
- $contact_link = $registry->link('contacts/show', array('uid' => $result, 'source' => $prefs->getValue('add_source')));
+ $escapeName = @htmlspecialchars($newName, ENT_COMPAT, Horde_Nls::getCharset());
- $old_error = error_reporting(0);
- $escapeName = htmlspecialchars($newName, ENT_COMPAT, Horde_Nls::getCharset());
- error_reporting($old_error);
+ try {
+ if ($contact_link = $registry->link('contacts/show', array('uid' => $result, 'source' => $prefs->getValue('add_source')))) {
+ return Horde::link(Horde::url($contact_link), sprintf(_("Go to address book entry of \"%s\""), $newName)) . $escapeName . '</a>';
+ }
+ } catch (Horde_Exception $e) {}
- return (!empty($contact_link) && !($contact_link instanceof PEAR_Error))
- ? Horde::link(Horde::url($contact_link), sprintf(_("Go to address book entry of \"%s\""), $newName)) . $escapeName . '</a>'
- : $escapeName;
+ return $escapeName;
}
/**
break;
}
- $r = $history->log(self::_getUniqueHistoryId($val), $params);
-
- /* On error, log the error message only since informing the user
- * is just a waste of time and a potential point of confusion,
- * especially since they most likely don't even know the message
- * is being logged. */
- if ($r instanceof PEAR_Error) {
- $entry = sprintf('Could not log message details to Horde_History. Error returned: %s', $r->getMessage());
+ try {
+ $history->log(self::_getUniqueHistoryId($val), $params);
+ } catch (Horde_Exception $e) {
+ /* On error, log the error message only since informing the
+ * user is just a waste of time and a potential point of
+ * confusion, especially since they most likely don't even
+ * know the message is being logged. */
+ $entry = sprintf('Could not log message details to Horde_History. Error returned: %s', $e->getMessage());
Horde::logMessage($entry, __FILE__, __LINE__, PEAR_LOG_ERR);
}
}
*/
static public function getLog($msg_id)
{
- $history = Horde_History::singleton();
-
- $res = $history->getHistory(self::_getUniqueHistoryId($msg_id));
- if ($res instanceof PEAR_Error) {
- throw new Horde_Exception($res);
- }
-
- return $res;
+ return Horde_History::singleton()->getHistory(self::_getUniqueHistoryId($msg_id));
}
/**
*
* @param integer $identity The identity to verify.
*
- * @return boolean|object True if the properties are valid or a PEAR_Error
- * with an error description otherwise.
+ * @throws Horde_Exception
*/
public function verify($identity = null)
{
- $result = parent::verify($identity);
- if ($result instanceof PEAR_Error) {
- return $result;
- }
+ parent::verify($identity);
if (!isset($identity)) {
$identity = $this->_default;
$vars = new Horde_Variables();
$var = new Horde_Form_Variable('', 'replyto_addr', $email, false);
- /* Verify From address. */
- if (!$email->isValid($var, $vars, $this->getValue('from_addr', $identity), $error_message)) {
- return PEAR::raiseError($error_message);
- }
-
/* Verify Reply-to address. */
if (!$email->isValid($var, $vars, $this->getValue('replyto_addr', $identity), $error_message)) {
- return PEAR::raiseError($error_message);
+ throw new Horde_Exception($error_message);
}
/* Clean up Alias, Tie-to, and BCC addresses. */
/* Validate addresses */
foreach ($data as $address) {
if (!$email->isValid($var, $vars, $address, $error_message)) {
- return PEAR::raiseError($error_message);
+ throw new Horde_Exception($error_message);
}
}
$this->setValue($val, $data, $identity);
}
-
- return true;
}
/**
Horde_Registry::appInit('imp');
$imp_smime = Horde_Crypt::singleton(array('IMP', 'Smime'));
-$secure_check = Horde::isConnectionSecure();
/* Run through the action handlers */
$actionID = Horde_Util::getFormData('actionID');
}
$t->set('personalkey-help', Horde_Help::link('imp', 'smime-overview-personalkey'));
- $t->set('secure_check', $secure_check instanceof PEAR_Error);
+ $t->set('secure_check', Horde::isConnectionSecure());
if (!$t->get('secure_check')) {
$t->set('has_key', $prefs->getValue('smime_public_key') && $prefs->getValue('smime_private_key'));
if ($t->get('has_key')) {