{
try {
$GLOBALS['imp_imap']->checkUidvalidity($this->_vars->view);
- } catch (Horde_Exception $e) {
+ } catch (IMP_Exception $e) {
if (!is_object($result)) {
$result = new stdClass;
}
* A value of null returns all message types.
*
* @return array A list with the $limit most favourite recipients.
+ * @throws IMP_Exception
*/
public function favouriteRecipients($limit,
$filter = array('new', 'forward', 'reply', 'redirect'))
* sent-mail folder.
* @throws Horde_Exception
* @throws IMP_Compose_Exception
+ * @throws IMP_Exception
*/
public function buildAndSendMessage($body, $header, $charset, $html,
$opts = array())
Horde::logMessage('The permission for the maximum number of recipients per time period has been enabled, but no backend for the sent-mail logging has been configured for IMP.', 'ERR');
throw new IMP_Compose_Exception(_("The system is not properly configured. A detailed error description has been logged for the administrator."));
}
- $sentmail = IMP_Sentmail::factory();
- $recipients = $sentmail->numberOfRecipients($GLOBALS['conf']['sentmail']['params']['limit_period'], true);
+ try {
+ $recipients = $sentmail->numberOfRecipients($GLOBALS['conf']['sentmail']['params']['limit_period'], true);
+ } catch (IMP_Exception $e) {
+ $recipients = 0;
+ }
foreach ($result as $address) {
$recipients += isset($address['grounpname']) ? count($address['addresses']) : 1;
}
* notification message?
*
* @return boolean True on success.
- * @throws Horde_Exception
+ * @throws IMP_Exception
*/
protected function _processBWlist($indices, $descrip, $reg1, $reg2, $link)
{
try {
$quotaDriver = $GLOBALS['injector']->getInstance('IMP_Quota');
$quota = $quotaDriver->getQuota();
- } catch (Exception $e) {
+ } catch (IMP_Exception $e) {
Horde::logMessage($e, 'ERR');
return false;
}
* @param string $mailbox The mailbox to check. Must be an IMAP mailbox.
*
* @return string The mailbox UIDVALIDITY.
- * @throws Horde_Exception
+ * @throws IMP_Exception
*/
public function checkUidvalidity($mailbox)
{
}
if ($this->_uidvalid[$mailbox]) {
- throw new Horde_Exception(_("Mailbox structure on server has changed."));
+ throw new IMP_Exception(_("Mailbox structure on server has changed."));
}
return $_SESSION['imp']['cache']['uidvalid'][$mailbox];
/**
* Constructor.
*
- * @throws Horde_Exception
+ * @throws IMP_Exception
*/
public function __construct()
{
if ($_SESSION['imp']['protocol'] != 'imap') {
- throw new Horde_Exception(_("ACL requires an IMAP server."));
+ throw new IMP_Exception(_("ACL requires an IMAP server."));
}
if (empty($_SESSION['imp']['imap']['acl'])) {
- throw new Horde_Exception(_("ACLs not configured for this server."));
+ throw new IMP_Exception(_("ACLs not configured for this server."));
}
if (!$GLOBALS['imp_imap']->ob()->queryCapability('ACL')) {
- throw new Horde_Exception(_("IMAP server does not support ACLs."));
+ throw new IMP_Exception(_("IMAP server does not support ACLs."));
}
$this->_protected = array($GLOBALS['imp_imap']->ob()->getParam('username'));
* @param string $mbox The mailbox to get the ACL for.
*
* @return array See Horde_Imap_Client_Base::getACL().
- * @throws Horde_Exception
+ * @throws IMP_Exception
*/
public function getACL($mbox)
{
try {
return $GLOBALS['imp_imap']->ob()->getACL($mbox);
} catch (Horde_Imap_Client_Exception $e) {
- throw new Horde_Exception(_("Could not retrieve ACL"));
+ throw new IMP_Exception(_("Could not retrieve ACL"));
}
}
* @param string $user The user to grant rights to.
* @param array $acl The rights to be granted.
*
- * @throws Horde_Exception
+ * @throws IMP_Exception
*/
public function editACL($mbox, $user, $acl)
{
try {
$GLOBALS['imp_imap']->ob()->setACL($mbox, $user, array('remove' => empty($acl), 'rights' => implode('', $acl)));
} catch (Horde_Imap_Client_Exception $e) {
- throw new Horde_Exception(sprintf(_("Couldn't give user \"%s\" the following rights for the folder \"%s\": %s"), $user, $mbox, implode('', $acl)));
+ throw new IMP_Exception(sprintf(_("Couldn't give user \"%s\" the following rights for the folder \"%s\": %s"), $user, $mbox, implode('', $acl)));
}
}
* @param string $parent The new mailbox name (UTF7-IMAP).
*
* @return string The full path to the new mailbox.
- * @throws Horde_Exception
+ * @throws IMP_Exception
*/
public function createMailboxName($parent, $new)
{
return $new;
}
}
- throw new Horde_Exception(_("Cannot directly create mailbox in this folder."));
+ throw new IMP_Exception(_("Cannot directly create mailbox in this folder."));
}
$mbox = $ns_info['name'];
if (!$error) {
try {
$GLOBALS['imp_imap']->checkUidvalidity($mbox);
- } catch (Horde_Exception $e) {
+ } catch (IMP_Exception $e) {
$error = $e->getMessage();
}
}
if (!$error) {
try {
$GLOBALS['imp_imap']->checkUidvalidity($mbox);
- } catch (Horde_Exception $e) {
+ } catch (IMP_Exception $e) {
$error = $e->getMessage();
}
}
* @param string $partid The MIME ID of the part to strip. All parts are
* stripped if null.
*
- * @throws Horde_Exception
+ * @throws IMP_Exception
*/
public function stripPart($indices, $partid = null)
{
/* Return error if no index was provided. */
if (!($msgList = IMP::parseIndicesList($indices))) {
- throw new Horde_Exception(_("An error occured while attempting to strip the attachment."));
+ throw new IMP_Exception(_("An error occured while attempting to strip the attachment."));
}
/* If more than one index provided, return error. */
reset($msgList);
list($mbox, $index) = each($msgList);
if (each($msgList) || (count($index) > 1)) {
- throw new Horde_Exception(_("An error occured while attempting to strip the attachment."));
+ throw new IMP_Exception(_("An error occured while attempting to strip the attachment."));
}
$index = implode('', $index);
if ($GLOBALS['imp_imap']->isReadOnly($mbox)) {
- throw new Horde_Exception(_("Cannot strip the MIME part as the mailbox is read-only"));
+ throw new IMP_Exception(_("Cannot strip the MIME part as the mailbox is read-only"));
}
$GLOBALS['imp_imap']->checkUidvalidity($mbox);
$uid = $GLOBALS['imp_imap']->ob()->append($mbox, array(array('data' => $message->toString(array('headers' => $res['headertext'][0], 'stream' => true)), 'flags' => $res['flags'])));
} catch (Horde_Imap_Client_Exception $e) {
- throw new Horde_Exception(_("An error occured while attempting to strip the attachment."));
+ throw new IMP_Exception(_("An error occured while attempting to strip the attachment."));
}
$this->delete($indices, array('nuke' => true, 'keeplog' => true));
if (!$error) {
try {
$GLOBALS['imp_imap']->checkUidvalidity($mbox);
- } catch (Horde_Exception $e) {
+ } catch (IMP_Exception $e) {
$error = $e->getMessage();
}
}
if (is_array($val)) {
try {
$GLOBALS['imp_imap']->checkUidvalidity($key);
- } catch (Horde_Exception $e) {
+ } catch (IMP_Exception $e) {
continue;
}
}
try {
$GLOBALS['injector']->getInstance('IMP_Imap_Acl');
- } catch (Exception $e) {
+ } catch (IMP_Exception $e) {
$ui->suppressGroups[] = 'acl';
}
? 'INBOX'
: $ui->vars->folder;
- $curr_acl = $ACL->getACL($folder);
+ try {
+ $curr_acl = $ACL->getACL($folder);
+ } catch (IMP_Exception $e) {
+ $GLOBALS['notification']->notify($e);
+ return '';
+ }
$canEdit = $ACL->canEdit($folder, Horde_Auth::getAuth());
$t = $GLOBALS['injector']->createInstance('Horde_Template');
} else {
$GLOBALS['notification']->push(sprintf(_("All rights on folder \"%s\" successfully removed for user \"%s\"."), $ui->vars->folder, $new_user), 'horde.success');
}
- } catch (Horde_Exception $e) {
+ } catch (IMP_Exception $e) {
$GLOBALS['notification']->push($e);
+ return;
}
}
- $curr_acl = $ACL->getACL($ui->vars->folder);
+ try {
+ $curr_acl = $ACL->getACL($ui->vars->folder);
+ } catch (IMP_Exception $e) {
+ $GLOBALS['notification']->notify($e);
+ return;
+ }
$protected = $ACL->getProtected();
foreach ($acl_list as $user => $val) {
} else {
$GLOBALS['notification']->push(sprintf(_("User \"%s\" successfully given the specified rights for the folder \"%s\"."), $user, $ui->vars->folder), 'horde.success');
}
- } catch (Horde_Exception $e) {
+ } catch (IMP_Exception $e) {
$GLOBALS['notification']->push($e);
}
}
* @return array An array with the following keys:
* 'limit' = Maximum quota allowed
* 'usage' = Currently used portion of quota (in bytes)
- * @throws Horde_Exception
+ * @throws IMP_Exception
*/
public function getQuota()
{
'limit' => $quota[2] * $blocksize);
}
- throw new Horde_Exception(_("Unable to retrieve quota"));
+ throw new IMP_Exception(_("Unable to retrieve quota"));
}
}
* @return array An array with the following keys:
* 'limit' = Maximum quota allowed
* 'usage' = Currently used portion of quota (in bytes)
- * @throws Horde_Exception
+ * @throws IMP_Exception
*/
public function getQuota()
{
try {
$quota = Horde::callHook('quota', array($this->_params), 'imp');
} catch (Horde_Exception_HookNotSet $e) {
- throw new Horde_Exception($e->getMessage());
+ throw new IMP_Exception($e->getMessage());
}
if (count($quota) != 2) {
Horde::logMessage('Incorrect number of return values from quota hook.', 'ERR');
- throw new Horde_Exception(_("Unable to retrieve quota"));
+ throw new IMP_Exception(_("Unable to retrieve quota"));
}
return array('usage' => $quota[0], 'limit' => $quota[1]);
* @return array An array with the following keys:
* 'limit' = Maximum quota allowed
* 'usage' = Currently used portion of quota (in bytes)
- * @throws Horde_Exception
+ * @throws IMP_Exception
*/
public function getQuota()
{
try {
$quota = $GLOBALS['imp_imap']->ob()->getQuotaRoot($GLOBALS['imp_search']->isSearchMbox($GLOBALS['imp_mbox']['mailbox']) ? 'INBOX' : $GLOBALS['imp_mbox']['mailbox']);
} catch (Horde_Imap_Client_Exception $e) {
- throw new Horde_Exception(_("Unable to retrieve quota"));
+ throw new IMP_Exception(_("Unable to retrieve quota"));
}
if (empty($quota)) {
* @return array An array with the following keys:
* 'limit' = Maximum quota allowed
* 'usage' = Currently used portion of quota (in bytes)
- * @throws Horde_Exception
+ * @throws IMP_Exception
*/
public function getQuota()
{
// Read in the quota file and parse it, if possible.
if (!is_file($full)) {
- throw new Horde_Exception(_("Unable to retrieve quota"));
+ throw new IMP_Exception(_("Unable to retrieve quota"));
}
// Read in maildir quota file.
* @return array An array with the following keys:
* 'limit' = Maximum quota allowed
* 'usage' = Currently used portion of quota (in bytes)
- * @throws Horde_Exception
+ * @throws IMP_Exception
*/
public function getQuota()
{
}
}
- throw new Horde_Exception(_("Unable to retrieve quota"));
+ throw new IMP_Exception(_("Unable to retrieve quota"));
}
/**
* @return array An array with the following keys:
* 'limit' = Maximum quota allowed
* 'usage' = Currently used portion of quota (in bytes)
+ * @throws IMP_Exception
*/
public function getQuota()
{
}
}
- throw new Horde_Exception(_("Unable to retrieve quota"));
+ throw new IMP_Exception(_("Unable to retrieve quota"));
}
}
protected $_db;
/**
- * Connects to the database
+ * Connects to the database.
*
- * @throws Horde_Exception
+ * @throws IMP_Exception
*/
protected function _connect()
{
array('persistent' => !empty($this->_params['persistent']),
'ssl' => !empty($this->_params['ssl'])));
if ($this->_db instanceof PEAR_Error) {
- throw new Horde_Exception(_("Unable to connect to SQL server."));
+ throw new IMP_Exception(_("Unable to connect to SQL server."));
}
}
* @return array An array with the following keys:
* 'limit' = Maximum quota allowed
* 'usage' = Currently used portion of quota (in bytes)
- * @throws Horde_Exception
+ * @throws IMP_Exception
*/
public function getQuota()
{
$this->_params['query_quota']);
$result = $this->_db->query($query);
if ($result instanceof PEAR_Error) {
- throw new Horde_Exception_Prior($result);
+ throw new IMP_Exception($result);
}
$row = $result->fetchRow(DB_FETCHMODE_ASSOC);
$this->_params['query_used']);
$result = $this->_db->query($query);
if ($result instanceof PEAR_Error) {
- throw new Horde_Exception_Prior($result);
+ throw new IMP_Exception($result);
}
$row = $result->fetchRow(DB_FETCHMODE_ASSOC);
if (class_exists($class)) {
try {
return new $class($params);
- } catch (Horde_Exception $e) {}
+ } catch (IMP_Exception $e) {}
}
}
/**
* Constructor.
*
- * @throws Horde_Exception
+ * @throws IMP_Exception
*/
protected function __construct($params = array())
{
* A value of null returns all message types.
*
* @return array A list with the $limit most favourite recipients.
- * @throws Horde_Exception
+ * @throws IMP_Exception
*/
public function favouriteRecipients($limit,
$filter = array('new', 'forward', 'reply', 'redirect'))
* user?
*
* @return integer The number of recipients in the given time period.
- * @throws Horde_Exception
+ * @throws IMP_Exception
*/
public function numberOfRecipients($hours, $user = false)
{
*
* @param array $params A hash containing connection parameters.
*
- * @throws Horde_Exception
+ * @throws IMP_Exception
*/
protected function __construct($params = array())
{
parent::__construct($params);
- Horde::assertDriverConfig($this->_params, 'storage', array('phptype', 'table'));
+ try {
+ Horde::assertDriverConfig($this->_params, 'storage', array('phptype', 'table'));
+ } catch (Horde_Exception $e) {
+ throw new IMP_Exception($e);
+ }
if (!isset($this->_params['database'])) {
$this->_params['database'] = '';
array('persistent' => !empty($this->_params['persistent']),
'ssl' => !empty($this->_params['ssl'])));
if ($this->_db instanceof PEAR_Error) {
- throw new Horde_Exception_Prior($this->_db);
+ throw new IMP_Exception($this->_db);
}
/* Set DB portability options. */
* A value of null returns all message types.
*
* @return array A list with the $limit most favourite recipients.
- * @throws Horde_Exception
+ * @throws IMP_Exception
*/
public function favouriteRecipients($limit,
$filter = array('new', 'forward', 'reply', 'redirect'))
$recipients = $this->_db->getAll($query);
if ($recipients instanceof PEAR_Error) {
Horde::logMessage($recipients, 'ERR');
- throw new Horde_Exception_Prior($recipients);
+ throw new IMP_Exception($recipients);
}
/* Extract email addresses. */
* user?
*
* @return integer The number of recipients in the given time period.
- * @throws Horde_Exception
+ * @throws IMP_Exception
*/
public function numberOfRecipients($hours, $user = false)
{
$recipients = $this->_db->getOne($query, array(time() - $hours * 3600));
if ($recipients instanceof PEAR_Error) {
Horde::logMessage($recipients, 'ERR');
- throw new Horde_Exception_Prior($recipients);
+ throw new IMP_Exception($recipients);
}
return $recipients;
$imp_pgp->reloadWindow($vars->reload);
} catch (Horde_Browser_Exception $e) {
$notification->push(_("No PGP public key imported."), 'horde.error');
- throw new Horde_Exception_Prior($e);
+ throw new IMP_Exception($e);
} catch (Horde_Exception $e) {
$notification->push($e);
$vars->actionID = 'import_public_key';
}
} catch (Horde_Browser_Exception $e) {
$notification->push(_("No personal PGP public key imported."), 'horde.error');
- throw new Horde_Exception_Prior($e);
+ throw new IMP_Exception($e);
} catch (Horde_Exception $e) {
$notification->push($e);
$imp_pgp->importKeyDialog('process_import_personal_public_key', $vars->reload);
}
} catch (Horde_Browser_Exception $e) {
$notification->push(_("No personal PGP private key imported."), 'horde.error');
- throw new Horde_Exception_Prior($e);
+ throw new IMP_Exception($e);
} catch (Horde_Exception $e) {
$notification->push($e);
$imp_pgp->importKeyDialog('process_import_personal_private_key', $vars->reload);
$imp_smime->reloadWindow($vars->reload);
} catch (Horde_Browser_Exception $e) {
$notification->push(_("No S/MIME public key imported."), 'horde.error');
- throw new Horde_Exception_Prior($e);
+ throw new IMP_Exception($e);
} catch (Horde_Exception $e) {
$notification->push($e);
$vars->actionID = 'import_public_key';
$notification->push(_("S/MIME Public/Private Keypair successfully added."), 'horde.success');
$imp_smime->reloadWindow($vars->reload);
} catch (Horde_Browser_Exception $e) {
- throw new Horde_Exception_Prior($e);
+ throw new IMP_Exception($e);
} catch (Horde_Exception $e) {
$notification->push(_("Personal S/MIME certificates NOT imported: ") . $e->getMessage(), 'horde.error');
$vars->actionID = 'import_personal_certs';