From 9cc18d71a7bf73b8fe87c7acb74f16f8b5ff327c Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Wed, 19 Aug 2009 16:51:19 -0600 Subject: [PATCH] Change way we access imap client ob in preparation for multiple accounts --- imp/ajax.php | 10 +++---- imp/folders.php | 2 +- imp/lib/Api.php | 4 +-- imp/lib/Auth.php | 10 +++---- imp/lib/Block/Newmail.php | 2 +- imp/lib/Block/summary.php | 2 +- imp/lib/Compose.php | 14 +++++----- imp/lib/Contents.php | 10 +++---- imp/lib/Folder.php | 20 +++++++------- imp/lib/IMP.php | 2 +- imp/lib/Identity/imp.php | 2 +- imp/lib/Imap.php | 36 ++++++++++++++++---------- imp/lib/Imap/Acl.php | 12 ++++----- imp/lib/Imap/Flags.php | 2 +- imp/lib/Imap/Tree.php | 4 +-- imp/lib/Mailbox.php | 22 ++++++++-------- imp/lib/Message.php | 24 ++++++++--------- imp/lib/Notification/Listener/Status.php | 2 +- imp/lib/Notification/Listener/StatusMobile.php | 2 +- imp/lib/Quota/Imap.php | 2 +- imp/lib/Search.php | 4 +-- imp/lib/UI/Message.php | 4 +-- imp/lib/Views/ListMessages.php | 4 +-- imp/lib/Views/ShowMessage.php | 2 +- imp/mailbox.php | 6 ++--- imp/message-mimp.php | 4 +-- imp/message.php | 6 ++--- imp/thread.php | 4 +-- 28 files changed, 114 insertions(+), 104 deletions(-) diff --git a/imp/ajax.php b/imp/ajax.php index a047750b1..a819db0b5 100644 --- a/imp/ajax.php +++ b/imp/ajax.php @@ -17,7 +17,7 @@ function _generateDeleteResult($mbox, $indices, $change, $nothread = false) $result = new stdClass; $result->folder = $mbox; - $result->uids = $GLOBALS['imp_imap']->ob->utils->toSequenceString($indices, array('mailbox' => true)); + $result->uids = $GLOBALS['imp_imap']->ob()->utils->toSequenceString($indices, array('mailbox' => true)); $result->remove = intval($GLOBALS['prefs']->getValue('hide_deleted') || $GLOBALS['prefs']->getValue('use_trash')); $result->cacheid = $imp_mailbox->getCacheID($mbox); @@ -50,7 +50,7 @@ function _changed($mbox, $compare, $rw = null) * the IMAP server (saves some STATUS calls). */ if (!is_null($rw) && !$GLOBALS['imp_search']->isSearchMbox($mbox)) { try { - $GLOBALS['imp_imap']->ob->openMailbox($mbox, $rw ? Horde_Imap_Client::OPEN_READWRITE : Horde_Imap_Client::OPEN_AUTO); + $GLOBALS['imp_imap']->ob()->openMailbox($mbox, $rw ? Horde_Imap_Client::OPEN_READWRITE : Horde_Imap_Client::OPEN_AUTO); } catch (Horde_Imap_Client_Exception $e) { return false; } @@ -182,7 +182,7 @@ try { // Process common request variables. $mbox = Horde_Util::getPost('view'); -$indices = $imp_imap->ob->utils->fromSequenceString(Horde_Util::getPost('uid')); +$indices = $imp_imap->ob()->utils->fromSequenceString(Horde_Util::getPost('uid')); $cacheid = Horde_Util::getPost('cacheid'); // Open an output buffer to ensure that we catch errors that might break JSON @@ -508,7 +508,7 @@ case 'ShowPreview': /* We know we are going to be exclusively dealing with this mailbox, so * select it on the IMAP server (saves some STATUS calls). Open R/W to * clear the RECENT flag. */ - $imp_imap->ob->openMailbox($ptr['key'], Horde_Imap_Client::OPEN_READWRITE); + $imp_imap->ob()->openMailbox($ptr['key'], Horde_Imap_Client::OPEN_READWRITE); $show_msg = new IMP_Views_ShowMessage(); $result = (object)$show_msg->showMessage($args); @@ -711,7 +711,7 @@ case 'SendMDN': /* Get the IMP_Headers:: object. */ try { - $fetch_ret = $imp_imap->ob->fetch($mbox, array( + $fetch_ret = $imp_imap->ob()->fetch($mbox, array( Horde_Imap_Client::FETCH_HEADERTEXT => array(array('parse' => true, 'peek' => false)) ), array('ids' => array($index))); } catch (Horde_Imap_Client_Exception $e) { diff --git a/imp/folders.php b/imp/folders.php index bece3fbd5..bea9250ab 100644 --- a/imp/folders.php +++ b/imp/folders.php @@ -403,7 +403,7 @@ if (!empty($newmsgs)) { /* Open the mailbox R/W so we ensure the 'recent' flags are cleared from * the current mailbox. */ foreach ($newmsgs as $mbox => $nm) { - $imp_imap->ob->openMailbox($mbox, Horde_Imap_Client::OPEN_READWRITE); + $imp_imap->ob()->openMailbox($mbox, Horde_Imap_Client::OPEN_READWRITE); } if ($prefs->getValue('nav_popup')) { diff --git a/imp/lib/Api.php b/imp/lib/Api.php index 4153b8d4e..9c881c569 100644 --- a/imp/lib/Api.php +++ b/imp/lib/Api.php @@ -201,7 +201,7 @@ class IMP_Api extends Horde_Registry_Api return false; } - return $GLOBALS['imp_imap']->ob->fetch($mailbox, array(Horde_Imap_Client::FETCH_ENVELOPE => true), array('ids' => $indices)); + return $GLOBALS['imp_imap']->ob()->fetch($mailbox, array(Horde_Imap_Client::FETCH_ENVELOPE => true), array('ids' => $indices)); } /** @@ -242,7 +242,7 @@ class IMP_Api extends Horde_Registry_Api return false; } - return $GLOBALS['imp_imap']->ob->getCacheId($mailbox); + return $GLOBALS['imp_imap']->ob()->getCacheId($mailbox); } /** diff --git a/imp/lib/Auth.php b/imp/lib/Auth.php index 7c8957616..dd9d7344f 100644 --- a/imp/lib/Auth.php +++ b/imp/lib/Auth.php @@ -47,7 +47,7 @@ class IMP_Auth } // Check for valid IMAP Client object. - if (!$GLOBALS['imp_imap']->ob) { + if (!$GLOBALS['imp_imap']->ob()) { if (!isset($credentials['userId']) || !isset($credentials['password'])) { throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN); @@ -71,7 +71,7 @@ class IMP_Auth } try { - $GLOBALS['imp_imap']->ob->login(); + $GLOBALS['imp_imap']->ob()->login(); } catch (Horde_Imap_Client_Exception $e) { self::logMessage($e->getMessage(), __FILE__, __LINE__); if ($e->getCode() == Horde_Imap_Client_Exception::SERVER_CONNECT) { @@ -131,15 +131,15 @@ class IMP_Auth break; } - $imp_imap = $GLOBALS['imp_imap']->ob; + $imap_ob = $GLOBALS['imp_imap']->ob(); $msg = sprintf( $status_msg . ' for %s [%s]%s to {%s:%s [%s]}', empty($_SESSION['imp']['uniquser']) ? '' : $_SESSION['imp']['uniquser'], $_SERVER['REMOTE_ADDR'], empty($_SERVER['HTTP_X_FORWARDED_FOR']) ? '' : ' (forwarded for [' . $_SERVER['HTTP_X_FORWARDED_FOR'] . '])', - $imp_imap ? $imp_imap->getParam('hostspec') : '', - $imp_imap ? $imp_imap->getParam('port') : '', + $imap_ob ? $imap_ob->getParam('hostspec') : '', + $imap_ob ? $imap_ob->getParam('port') : '', empty($_SESSION['imp']['protocol']) ? '' : $_SESSION['imp']['protocol'] ); diff --git a/imp/lib/Block/Newmail.php b/imp/lib/Block/Newmail.php index 6a6ac6a0b..9903bfd3a 100644 --- a/imp/lib/Block/Newmail.php +++ b/imp/lib/Block/Newmail.php @@ -40,7 +40,7 @@ class IMP_Block_Newmail extends Horde_Block $shown = empty($this->_params['msgs_shown']) ? 3 : $this->_params['msgs_shown']; try { - $fetch_ret = $GLOBALS['imp_imap']->ob->fetch('INBOX', array( + $fetch_ret = $GLOBALS['imp_imap']->ob()->fetch('INBOX', array( Horde_Imap_Client::FETCH_ENVELOPE => true ), array('ids' => array_slice($ids, 0, $shown))); reset($fetch_ret); diff --git a/imp/lib/Block/summary.php b/imp/lib/Block/summary.php index a2b06fcdc..cd80c2609 100644 --- a/imp/lib/Block/summary.php +++ b/imp/lib/Block/summary.php @@ -111,7 +111,7 @@ class Horde_Block_imp_summary extends Horde_Block /* Open the mailbox R/W to ensure the 'recent' flags are cleared * from the current mailbox. */ foreach ($newmsgs as $mbox => $nm) { - $GLOBALS['imp_imap']->ob->openMailbox($mbox, Horde_Imap_Client::OPEN_READWRITE); + $GLOBALS['imp_imap']->ob()->openMailbox($mbox, Horde_Imap_Client::OPEN_READWRITE); } if ($prefs->getValue('nav_popup')) { diff --git a/imp/lib/Compose.php b/imp/lib/Compose.php index 96411ca6b..28c2291e8 100644 --- a/imp/lib/Compose.php +++ b/imp/lib/Compose.php @@ -266,7 +266,7 @@ class IMP_Compose /* Add the message to the mailbox. */ try { - $ids = $GLOBALS['imp_imap']->ob->append($drafts_mbox, array(array('data' => $data, 'flags' => $append_flags, 'messageid' => $headers->getValue('message-id')))); + $ids = $GLOBALS['imp_imap']->ob()->append($drafts_mbox, array(array('data' => $data, 'flags' => $append_flags, 'messageid' => $headers->getValue('message-id')))); $this->_metadata['draft_index'] = reset($ids); $this->_modified = true; return sprintf(_("The draft has been saved to the \"%s\" folder."), IMP::displayFolder($drafts_mbox)); @@ -605,7 +605,7 @@ class IMP_Compose } try { - $GLOBALS['imp_imap']->ob->append(Horde_String::convertCharset($opts['sent_folder'], Horde_Nls::getCharset(), 'UTF-8'), array(array('data' => $fcc, 'flags' => $flags))); + $GLOBALS['imp_imap']->ob()->append(Horde_String::convertCharset($opts['sent_folder'], Horde_Nls::getCharset(), 'UTF-8'), array(array('data' => $fcc, 'flags' => $flags))); } catch (Horde_Imap_Client_Exception $e) { $notification->push(sprintf(_("Message sent successfully, but not saved to %s"), IMP::displayFolder($opts['sent_folder']))); $sent_saved = false; @@ -713,8 +713,8 @@ class IMP_Compose * current IMAP / POP3 connection are valid for SMTP authentication as * well. */ if (!empty($params['auth']) && empty($params['username'])) { - $params['username'] = $GLOBALS['imp_imap']->ob->getParam('username'); - $params['password'] = $GLOBALS['imp_imap']->ob->getParam('password'); + $params['username'] = $GLOBALS['imp_imap']->ob()->getParam('username'); + $params['password'] = $GLOBALS['imp_imap']->ob()->getParam('password'); } return array('driver' => $GLOBALS['conf']['mailer']['type'], 'params' => $params); @@ -1206,7 +1206,7 @@ class IMP_Compose $subject = $h->getValue('subject'); $header['subject'] = empty($subject) ? 'Re: ' - : 'Re: ' . $GLOBALS['imp_imap']->ob->utils->getBaseSubject($subject, array('keepblob' => true)); + : 'Re: ' . $GLOBALS['imp_imap']->ob()->utils->getBaseSubject($subject, array('keepblob' => true)); if (in_array($actionID, array('reply', '*'))) { ($header['to'] = $to) || @@ -1381,7 +1381,7 @@ class IMP_Compose $header['subject'] = $h->getValue('subject'); if (!empty($header['subject'])) { $header['title'] = _("Forward") . ': ' . $header['subject']; - $header['subject'] = 'Fwd: ' . $GLOBALS['imp_imap']->ob->utils->getBaseSubject($header['subject'], array('keepblob' => true)); + $header['subject'] = 'Fwd: ' . $GLOBALS['imp_imap']->ob()->utils->getBaseSubject($header['subject'], array('keepblob' => true)); } else { $header['title'] = _("Forward"); $header['subject'] = 'Fwd:'; @@ -1482,7 +1482,7 @@ class IMP_Compose } else { $name = Horde_String::truncate($name, 80); } - return 'Fwd: ' . $GLOBALS['imp_imap']->ob->utils->getBaseSubject($name, array('keepblob' => true)); + return 'Fwd: ' . $GLOBALS['imp_imap']->ob()->utils->getBaseSubject($name, array('keepblob' => true)); } else { return 'Fwd: ' . sprintf(_("%u Forwarded Messages"), $attached); } diff --git a/imp/lib/Contents.php b/imp/lib/Contents.php index b334803f1..c8ecce487 100644 --- a/imp/lib/Contents.php +++ b/imp/lib/Contents.php @@ -126,7 +126,7 @@ class IMP_Contents /* Get the Horde_Mime_Part object for the given index. */ try { - $ret = $GLOBALS['imp_imap']->ob->fetch($this->_mailbox, array( + $ret = $GLOBALS['imp_imap']->ob()->fetch($this->_mailbox, array( Horde_Imap_Client::FETCH_STRUCTURE => array('parse' => true) ), array('ids' => array($this->_index))); } catch (Horde_Imap_Client_Exception $e) { @@ -180,7 +180,7 @@ class IMP_Contents } try { - $res = $GLOBALS['imp_imap']->ob->fetch($this->_mailbox, array( + $res = $GLOBALS['imp_imap']->ob()->fetch($this->_mailbox, array( Horde_Imap_Client::FETCH_BODYTEXT => array(array('peek' => true, 'stream' => !empty($options['stream']))) ), array('ids' => array($this->_index))); return $res[$this->_index]['bodytext'][0]; @@ -241,7 +241,7 @@ class IMP_Contents } try { - $res = $GLOBALS['imp_imap']->ob->fetch($this->_mailbox, $query, array('ids' => array($this->_index))); + $res = $GLOBALS['imp_imap']->ob()->fetch($this->_mailbox, $query, array('ids' => array($this->_index))); if (empty($options['mimeheaders'])) { if (!empty($res[$this->_index]['bodypartdecode'][$id])) { $this->lastBodyPartDecode = $res[$this->_index]['bodypartdecode'][$id]; @@ -277,7 +277,7 @@ class IMP_Contents } try { - $res = $GLOBALS['imp_imap']->ob->fetch($this->_mailbox, array( + $res = $GLOBALS['imp_imap']->ob()->fetch($this->_mailbox, array( Horde_Imap_Client::FETCH_HEADERTEXT => array(array('peek' => true)), Horde_Imap_Client::FETCH_BODYTEXT => array(array('peek' => true, 'stream' => !empty($options['stream']))) ), array('ids' => array($this->_index))); @@ -303,7 +303,7 @@ class IMP_Contents } try { - $res = $GLOBALS['imp_imap']->ob->fetch($this->_mailbox, array( + $res = $GLOBALS['imp_imap']->ob()->fetch($this->_mailbox, array( Horde_Imap_Client::FETCH_HEADERTEXT => array(array('parse' => true, 'peek' => true)) ), array('ids' => array($this->_index))); return $res[$this->_index]['headertext'][0]; diff --git a/imp/lib/Folder.php b/imp/lib/Folder.php index cfd168a4c..99363b2c5 100644 --- a/imp/lib/Folder.php +++ b/imp/lib/Folder.php @@ -187,7 +187,7 @@ class IMP_Folder } try { - $GLOBALS['imp_imap']->ob->deleteMailbox($folder); + $GLOBALS['imp_imap']->ob()->deleteMailbox($folder); $notification->push(sprintf(_("The folder \"%s\" was successfully deleted."), IMP::displayFolder($folder)), 'horde.success'); $deleted[] = $folder; } catch (Horde_Imap_Client_Exception $e) { @@ -266,7 +266,7 @@ class IMP_Folder /* Attempt to create the mailbox. */ try { - $GLOBALS['imp_imap']->ob->createMailbox($folder); + $GLOBALS['imp_imap']->ob()->createMailbox($folder); } catch (Horde_Imap_Client_Exception $e) { $notification->push(sprintf(_("The folder \"%s\" was not created. This is what the server said"), IMP::displayFolder($folder)) . ': ' . $e->getMessage(), 'horde.error'); return false; @@ -308,7 +308,7 @@ class IMP_Folder } try { - $ret = $GLOBALS['imp_imap']->ob->listMailboxes($folder, array('flat' => true)); + $ret = $GLOBALS['imp_imap']->ob()->listMailboxes($folder, array('flat' => true)); return !empty($ret); } catch (Horde_Imap_Client_Exception $e) { return false; @@ -349,7 +349,7 @@ class IMP_Folder $sub_folders = $imaptree->folderList(); try { - $GLOBALS['imp_imap']->ob->renameMailbox($old, $new); + $GLOBALS['imp_imap']->ob()->renameMailbox($old, $new); } catch (Horde_Imap_Client_Exception $e) { $GLOBALS['notification']->push(sprintf(_("Renaming \"%s\" to \"%s\" failed. This is what the server said"), IMP::displayFolder($old), IMP::displayFolder($new)) . ': ' . $e->getMessage(), 'horde.error'); return false; @@ -393,7 +393,7 @@ class IMP_Folder foreach (array_filter($folders) as $folder) { try { - $GLOBALS['imp_imap']->ob->subscribeMailbox($folder, true); + $GLOBALS['imp_imap']->ob()->subscribeMailbox($folder, true); $notification->push(sprintf(_("You were successfully subscribed to \"%s\""), IMP::displayFolder($folder)), 'horde.success'); $subscribed[] = $folder; } catch (Horde_Imap_Client_Exception $e) { @@ -438,7 +438,7 @@ class IMP_Folder $notification->push(sprintf(_("You cannot unsubscribe from \"%s\"."), IMP::displayFolder($folder)), 'horde.error'); } else { try { - $GLOBALS['imp_imap']->ob->subscribeMailbox($folder, false); + $GLOBALS['imp_imap']->ob()->subscribeMailbox($folder, false); $notification->push(sprintf(_("You were successfully unsubscribed from \"%s\""), IMP::displayFolder($folder)), 'horde.success'); $unsubscribed[] = $folder; } catch (Horde_Imap_Client_Exception $e) { @@ -484,7 +484,7 @@ class IMP_Folder foreach ($folder_list as $folder) { try { - $status = $GLOBALS['imp_imap']->ob->status($folder, Horde_Imap_Client::STATUS_MESSAGES); + $status = $GLOBALS['imp_imap']->ob()->status($folder, Horde_Imap_Client::STATUS_MESSAGES); } catch (Horde_Imap_Client_Exception $e) { continue; } @@ -492,7 +492,7 @@ class IMP_Folder /* Download one message at a time to save on memory * overhead. */ try { - $res = $GLOBALS['imp_imap']->ob->fetch($folder, array( + $res = $GLOBALS['imp_imap']->ob()->fetch($folder, array( Horde_Imap_Client::FETCH_FULLMSG => array('peek' => true, 'stream' => true), Horde_Imap_Client::FETCH_ENVELOPE => true, Horde_Imap_Client::FETCH_DATE => true, @@ -545,7 +545,7 @@ class IMP_Folder if (preg_match('/From (.+@.+|- )/A', $line)) { if (!empty($message)) { try { - $GLOBALS['imp_imap']->ob->append($folder, array(array('data' => $message))); + $GLOBALS['imp_imap']->ob()->append($folder, array(array('data' => $message))); ++$msgcount; } catch (Horde_Imap_Client_Exception $e) {} } @@ -558,7 +558,7 @@ class IMP_Folder if (!empty($message)) { try { - $GLOBALS['imp_imap']->ob->append($folder, array(array('data' => $message))); + $GLOBALS['imp_imap']->ob()->append($folder, array(array('data' => $message))); ++$msgcount; } catch (Horde_Imap_Client_Exception $e) {} } diff --git a/imp/lib/IMP.php b/imp/lib/IMP.php index 1b65c94b4..37ab8c707 100644 --- a/imp/lib/IMP.php +++ b/imp/lib/IMP.php @@ -1036,7 +1036,7 @@ class IMP if (!$search_mbox && !empty($GLOBALS['conf']['server']['sort_limit'])) { try { - $status = $GLOBALS['imp_imap']->ob->status($mbox, Horde_Imap_Client::STATUS_MESSAGES); + $status = $GLOBALS['imp_imap']->ob()->status($mbox, Horde_Imap_Client::STATUS_MESSAGES); if ($status['messages'] > $GLOBALS['conf']['server']['sort_limit']) { $ob['limit'] = true; $ob['by'] = Horde_Imap_Client::SORT_ARRIVAL; diff --git a/imp/lib/Identity/imp.php b/imp/lib/Identity/imp.php index 009be826c..42c0ed410 100644 --- a/imp/lib/Identity/imp.php +++ b/imp/lib/Identity/imp.php @@ -230,7 +230,7 @@ class Identity_imp extends Identity $val = $this->getValue('from_addr', $ident); if (empty($val)) { - $val = $GLOBALS['imp_imap']->ob->getParam('username'); + $val = $GLOBALS['imp_imap']->ob()->getParam('username'); } if (!strstr($val, '@')) { diff --git a/imp/lib/Imap.php b/imp/lib/Imap.php index 6b757ecd6..ba13826da 100644 --- a/imp/lib/Imap.php +++ b/imp/lib/Imap.php @@ -18,7 +18,7 @@ class IMP_Imap * * @var Horde_Imap_Client */ - public $ob = null; + protected $_ob = null; /** * Is connection read-only? @@ -61,21 +61,21 @@ class IMP_Imap /* Only need to serialize object once a session. When we do * serialize, make sure we login in order to ensure we have done the * necessary initialization. */ - if ($this->ob && + if ($this->_ob && isset($_SESSION['imp']) && !isset($_SESSION['imp']['imap_ob'])) { - $this->ob->login(); + $this->_ob->login(); /* First login may occur on a non-viewable page. However, * any login alerts received should be displayed to the user at * some point. We need to do an explicit grab of the alarms * right now. */ $notification = Horde_Notification::singleton(); - foreach ($GLOBALS['imp_imap']->ob->alerts() as $alert) { + foreach ($this->_ob->alerts() as $alert) { $notification->push($alert, 'horde.warning'); } - $_SESSION['imp']['imap_ob'] = serialize($this->ob); + $_SESSION['imp']['imap_ob'] = serialize($this->_ob); } } @@ -121,7 +121,7 @@ class IMP_Imap */ protected function _loadImapObject() { - if (!is_null($this->ob)) { + if (!is_null($this->_ob)) { return true; } @@ -132,10 +132,10 @@ class IMP_Imap Horde_Imap_Client::$encryptKey = Horde_Secret::getKey('imp'); $old_error = error_reporting(0); - $this->ob = unserialize($_SESSION['imp']['imap_ob']); + $this->_ob = unserialize($_SESSION['imp']['imap_ob']); error_reporting($old_error); - if (empty($this->ob)) { + if (empty($this->_ob)) { // @todo How to handle bad unserialize? // @todo Log message return false; @@ -160,7 +160,7 @@ class IMP_Imap public function createImapObject($username, $password, $key, $global = true) { - if ($global && !is_null($this->ob)) { + if ($global && !is_null($this->_ob)) { return $GLOBALS['imp_imap']; } @@ -208,7 +208,7 @@ class IMP_Imap } if ($global) { - $this->ob = $ob; + $this->_ob = $ob; $this->_postcreate($protocol); } @@ -261,7 +261,7 @@ class IMP_Imap ($_SESSION['imp']['protocol'] == 'imap') && !$GLOBALS['imp_search']->isSearchMbox($mailbox)) { try { - $status = $this->ob->status($mailbox, Horde_Imap_Client::STATUS_UIDNOTSTICKY); + $status = $this->_ob->status($mailbox, Horde_Imap_Client::STATUS_UIDNOTSTICKY); $res = $status['uidnotsticky']; } catch (Horde_Imap_Client_Exception $e) {} } @@ -288,7 +288,7 @@ class IMP_Imap } if (!isset($this->_uidvalid[$mailbox])) { - $status = $this->ob->status($mailbox, Horde_Imap_Client::STATUS_UIDVALIDITY); + $status = $this->_ob->status($mailbox, Horde_Imap_Client::STATUS_UIDVALIDITY); $ptr = &$_SESSION['imp']['cache']; $val = isset($ptr['uidvalid'][$mailbox]) ? $ptr['uidvalid'][$mailbox] @@ -321,7 +321,7 @@ class IMP_Imap public function getNamespaceList() { try { - return $GLOBALS['imp_imap']->ob->getNamespaces(!empty($_SESSION['imp']['imap_ext']['namespace']) ? $_SESSION['imp']['imap_ext']['namespace'] : array()); + return $this->_ob->getNamespaces(!empty($_SESSION['imp']['imap_ext']['namespace']) ? $_SESSION['imp']['imap_ext']['namespace'] : array()); } catch (Horde_Imap_Client_Exception $e) { // @todo Error handling return array(); @@ -402,4 +402,14 @@ class IMP_Imap return $ns_info['name'] . $mbox; } + /** + * Return the Horde_Imap_Client object. + * + * @return Horde_Imap_Client The imap object. + */ + public function ob() + { + return $this->_ob; + } + } diff --git a/imp/lib/Imap/Acl.php b/imp/lib/Imap/Acl.php index 7af5b5460..0459fcddf 100644 --- a/imp/lib/Imap/Acl.php +++ b/imp/lib/Imap/Acl.php @@ -59,14 +59,14 @@ class IMP_Imap_Acl throw new Horde_Exception(_("ACL requires an IMAP server.")); } - $capability = $GLOBALS['imp_imap']->ob->queryCapability('ACL'); + $capability = $GLOBALS['imp_imap']->ob()->queryCapability('ACL'); if (!$capability) { throw new Horde_Exception(_("IMAP server does not support ACLs.")); } - $rfc4314 = $GLOBALS['imp_imap']->ob->queryCapability('RIGHTS'); + $rfc4314 = $GLOBALS['imp_imap']->ob()->queryCapability('RIGHTS'); - $this->_protected = array($GLOBALS['imp_imap']->ob->getParam('username')); + $this->_protected = array($GLOBALS['imp_imap']->ob()->getParam('username')); $this->_rightsList = array( 'l' => array( @@ -145,7 +145,7 @@ class IMP_Imap_Acl public function getACL($mbox) { try { - return $GLOBALS['imp_imap']->ob->getACL($mbox); + return $GLOBALS['imp_imap']->ob()->getACL($mbox); } catch (Horde_Imap_Client_Exception $e) { throw new Horde_Exception(_("Could not retrieve ACL")); } @@ -164,7 +164,7 @@ class IMP_Imap_Acl public function editACL($mbox, $user, $acl) { try { - $GLOBALS['imp_imap']->ob->setACL($mbox, $user, array('rights' => $acl)); + $GLOBALS['imp_imap']->ob()->setACL($mbox, $user, array('rights' => $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))); } @@ -181,7 +181,7 @@ class IMP_Imap_Acl public function canEdit($mbox, $user) { try { - $rights = $GLOBALS['imp_imap']->ob->listACLRights($mbox, $user); + $rights = $GLOBALS['imp_imap']->ob()->listACLRights($mbox, $user); foreach ($rights as $val) { if (strpos($val, 'a') !== false) { return true; diff --git a/imp/lib/Imap/Flags.php b/imp/lib/Imap/Flags.php index 700e2f7b0..f730e8c35 100644 --- a/imp/lib/Imap/Flags.php +++ b/imp/lib/Imap/Flags.php @@ -94,7 +94,7 @@ class IMP_Imap_Flags * from the PERMANENTFLAGS IMAP response. */ if (!empty($options['mailbox'])) { try { - $status = $GLOBALS['imp_imap']->ob->status($options['mailbox'], Horde_Imap_Client::STATUS_PERMFLAGS); + $status = $GLOBALS['imp_imap']->ob()->status($options['mailbox'], Horde_Imap_Client::STATUS_PERMFLAGS); if (!in_array('\\*', $status['permflags'])) { $avail_flags = array_intersect($avail_flags, $status['permflags']); } diff --git a/imp/lib/Imap/Tree.php b/imp/lib/Imap/Tree.php index facb7f082..a1a19686a 100644 --- a/imp/lib/Imap/Tree.php +++ b/imp/lib/Imap/Tree.php @@ -288,7 +288,7 @@ class IMP_Imap_Tree foreach ($this->_namespaces as $key => $val) { try { - $names = array_merge($names, $GLOBALS['imp_imap']->ob->listMailboxes($key . '*', $showunsub ? Horde_Imap_Client::MBOX_ALL : Horde_Imap_Client::MBOX_SUBSCRIBED, array('flat' => true))); + $names = array_merge($names, $GLOBALS['imp_imap']->ob()->listMailboxes($key . '*', $showunsub ? Horde_Imap_Client::MBOX_ALL : Horde_Imap_Client::MBOX_SUBSCRIBED, array('flat' => true))); if ($showunsub) { $this->_fulllist = $names; } else { @@ -1382,7 +1382,7 @@ class IMP_Imap_Tree public function getElementInfo($name) { try { - return $GLOBALS['imp_imap']->ob->status($name, Horde_Imap_Client::STATUS_MESSAGES | Horde_Imap_Client::STATUS_RECENT | Horde_Imap_Client::STATUS_UNSEEN); + return $GLOBALS['imp_imap']->ob()->status($name, Horde_Imap_Client::STATUS_MESSAGES | Horde_Imap_Client::STATUS_RECENT | Horde_Imap_Client::STATUS_UNSEEN); } catch (Horde_Imap_Client_Exception $e) { return array(); } diff --git a/imp/lib/Mailbox.php b/imp/lib/Mailbox.php index 357c91044..0c5284eb3 100644 --- a/imp/lib/Mailbox.php +++ b/imp/lib/Mailbox.php @@ -226,13 +226,13 @@ class IMP_Mailbox $cache = null; $options['preview'] = 0; } else { - $cache = $GLOBALS['imp_imap']->ob->getCache(); + $cache = $GLOBALS['imp_imap']->ob()->getCache(); } /* Retrieve information from each mailbox. */ foreach ($to_process as $mbox => $ids) { try { - $fetch_res = $GLOBALS['imp_imap']->ob->fetch($mbox, $fetch_criteria, array('ids' => array_keys($ids))); + $fetch_res = $GLOBALS['imp_imap']->ob()->fetch($mbox, $fetch_criteria, array('ids' => array_keys($ids))); if ($options['preview']) { $preview_info = $tostore = array(); @@ -278,7 +278,7 @@ class IMP_Mailbox $uids[$mbox] = array_keys($fetch_res); if (!is_null($cache) && !empty($tostore)) { - $status = $GLOBALS['imp_imap']->ob->status($mbox, Horde_Imap_Client::STATUS_UIDVALIDITY); + $status = $GLOBALS['imp_imap']->ob()->status($mbox, Horde_Imap_Client::STATUS_UIDVALIDITY); $cache->set($mbox, $tostore, $status['uidvalidity']); } } catch (Horde_Imap_Client_Exception $e) {} @@ -338,7 +338,7 @@ class IMP_Mailbox $query->flag('\\deleted', false); } try { - $res = $GLOBALS['imp_imap']->ob->search($this->_mailbox, $query, array('sort' => array($sortpref['by']), 'reverse' => (bool)$sortpref['dir'])); + $res = $GLOBALS['imp_imap']->ob()->search($this->_mailbox, $query, array('sort' => array($sortpref['by']), 'reverse' => (bool)$sortpref['dir'])); $this->_sorted = $res['sort']; } catch (Horde_Imap_Client_Exception $e) { $this->_sorted = array(); @@ -401,7 +401,7 @@ class IMP_Mailbox $criteria->flag('\\deleted', false); } elseif ($count) { try { - $status_res = $GLOBALS['imp_imap']->ob->status($this->_mailbox, $type == 'recent' ? Horde_Imap_Client::STATUS_RECENT : Horde_Imap_Client::STATUS_UNSEEN); + $status_res = $GLOBALS['imp_imap']->ob()->status($this->_mailbox, $type == 'recent' ? Horde_Imap_Client::STATUS_RECENT : Horde_Imap_Client::STATUS_UNSEEN); return $status_res[$type]; } catch (Horde_Imap_Client_Exception $e) { return 0; @@ -415,7 +415,7 @@ class IMP_Mailbox } try { - $res = $GLOBALS['imp_imap']->ob->search($this->_mailbox, $criteria, array('results' => array($results), 'sequence' => true)); + $res = $GLOBALS['imp_imap']->ob()->search($this->_mailbox, $criteria, array('results' => array($results), 'sequence' => true)); return $count ? $res['count'] : $res; } catch (Horde_Imap_Client_Exception $e) { return $count ? 0 : array(); @@ -561,7 +561,7 @@ class IMP_Mailbox $ret['anymsg'] = true; if (!$ret['msgcount'] && !$this->_searchmbox) { try { - $status = $GLOBALS['imp_imap']->ob->status($this->_mailbox, Horde_Imap_Client::STATUS_MESSAGES); + $status = $GLOBALS['imp_imap']->ob()->status($this->_mailbox, Horde_Imap_Client::STATUS_MESSAGES); $ret['anymsg'] = (bool)$status['messages']; } catch (Horde_Imap_Client_Exception $e) { $ret['anymsg'] = false; @@ -598,7 +598,7 @@ class IMP_Mailbox * information is returned via a SELECT/EXAMINE call. */ if ($sortpref['by'] == Horde_Imap_Client::SORT_ARRIVAL) { try { - $res = $GLOBALS['imp_imap']->ob->status($this->_mailbox, Horde_Imap_Client::STATUS_FIRSTUNSEEN); + $res = $GLOBALS['imp_imap']->ob()->status($this->_mailbox, Horde_Imap_Client::STATUS_FIRSTUNSEEN); if (!is_null($res['firstunseen'])) { return $res['firstunseen']; } @@ -662,7 +662,7 @@ class IMP_Mailbox { if (is_null($this->_threadob)) { try { - $this->_threadob = $GLOBALS['imp_imap']->ob->thread($this->_mailbox); + $this->_threadob = $GLOBALS['imp_imap']->ob()->thread($this->_mailbox); $ref_errcode = null; } catch (Horde_Imap_Client_Exception $e) { $ref_errcode = $e->getCode(); @@ -670,7 +670,7 @@ class IMP_Mailbox if ($ref_errcode == Horde_Imap_Client_Exception::NOSUPPORTIMAPEXT) { try { - $this->_threadob = $GLOBALS['imp_imap']->ob->thread($this->_mailbox, array('criteria' => Horde_Imap_Client::THREAD_ORDEREDSUBJECT)); + $this->_threadob = $GLOBALS['imp_imap']->ob()->thread($this->_mailbox, array('criteria' => Horde_Imap_Client::THREAD_ORDEREDSUBJECT)); } catch (Horde_Imap_Client_Exception $e) { $GLOBALS['notification']->push(_("Server does not support thread sorting."), 'horde.error'); return new Horde_Imap_Client_Thread(array(), 'uid'); @@ -820,7 +820,7 @@ class IMP_Mailbox if (!$this->_searchmbox) { $sortpref = IMP::getSort($this->_mailbox); try { - $id = $GLOBALS['imp_imap']->ob->getCacheId($this->_mailbox); + $id = $GLOBALS['imp_imap']->ob()->getCacheId($this->_mailbox); return $id . '|' . $sortpref['by'] . '|' . $sortpref['dir']; } catch (Horde_Imap_Client_Exception $e) {} } diff --git a/imp/lib/Message.php b/imp/lib/Message.php index a1c0d4caf..51601d343 100644 --- a/imp/lib/Message.php +++ b/imp/lib/Message.php @@ -137,7 +137,7 @@ class IMP_Message /* Attempt to copy/move messages to new mailbox. */ if (!$error) { try { - $GLOBALS['imp_imap']->ob->copy($mbox, $targetMbox, array('ids' => $msgIndices, 'move' => $imap_move)); + $GLOBALS['imp_imap']->ob()->copy($mbox, $targetMbox, array('ids' => $msgIndices, 'move' => $imap_move)); $imp_mailbox = IMP_Mailbox::singleton($mbox); if (($action == 'move') && $imp_mailbox->isBuilt()) { @@ -232,7 +232,7 @@ class IMP_Message /* Trash is only valid for IMAP mailboxes. */ if ($use_trash_folder && ($mbox != $trash)) { try { - $GLOBALS['imp_imap']->ob->copy($mbox, $trash, array('ids' => $msgIndices, 'move' => true)); + $GLOBALS['imp_imap']->ob()->copy($mbox, $trash, array('ids' => $msgIndices, 'move' => true)); $imp_mailbox = IMP_Mailbox::singleton($mbox); if ($imp_mailbox->isBuilt()) { @@ -248,7 +248,7 @@ class IMP_Message $fetch = null; if ($maillog_update) { try { - $fetch = $GLOBALS['imp_imap']->ob->fetch($mbox, array(Horde_Imap_Client::FETCH_ENVELOPE => true), array('ids' => $msgIndices)); + $fetch = $GLOBALS['imp_imap']->ob()->fetch($mbox, array(Horde_Imap_Client::FETCH_ENVELOPE => true), array('ids' => $msgIndices)); } catch (Horde_Imap_Client_Exception $e) {} } @@ -272,7 +272,7 @@ class IMP_Message } try { - $GLOBALS['imp_imap']->ob->store($mbox, array('add' => array('\\deleted'), 'ids' => $msgIndices)); + $GLOBALS['imp_imap']->ob()->store($mbox, array('add' => array('\\deleted'), 'ids' => $msgIndices)); if ($expunge_now) { $this->expungeMailbox($indices_array); } @@ -535,7 +535,7 @@ class IMP_Message /* Get the headers for the message. */ try { - $res = $GLOBALS['imp_imap']->ob->fetch($mbox, array( + $res = $GLOBALS['imp_imap']->ob()->fetch($mbox, array( Horde_Imap_Client::FETCH_HEADERTEXT => array(array('peek' => true)), Horde_Imap_Client::FETCH_ENVELOPE => true, Horde_Imap_Client::FETCH_FLAGS => true @@ -549,7 +549,7 @@ class IMP_Message unset($res['flags'][$pos]); } - $uid = $GLOBALS['imp_imap']->ob->append($mbox, array(array('data' => $message->toString(array('headers' => $res['headertext'][0], 'stream' => true)), 'flags' => $res['flags'], 'messageid' => $res['envelope']['message-id']))); + $uid = $GLOBALS['imp_imap']->ob()->append($mbox, array(array('data' => $message->toString(array('headers' => $res['headertext'][0], 'stream' => true)), 'flags' => $res['flags'], 'messageid' => $res['envelope']['message-id']))); } catch (Horde_Imap_Client_Exception $e) { throw new Horde_Exception(_("An error occured while attempting to strip the attachment.")); } @@ -604,7 +604,7 @@ class IMP_Message if (!$error) { /* Flag/unflag the messages now. */ try { - $GLOBALS['imp_imap']->ob->store($mbox, array_merge($action_array, array('ids' => $msgIndices))); + $GLOBALS['imp_imap']->ob()->store($mbox, array_merge($action_array, array('ids' => $msgIndices))); } catch (Horde_Imap_Client_Exception $e) { $error = $e->getMessage(); } @@ -642,7 +642,7 @@ class IMP_Message foreach ($mboxes as $val) { try { - $GLOBALS['imp_imap']->ob->store($val, $action_array); + $GLOBALS['imp_imap']->ob()->store($val, $action_array); } catch (Horde_Imap_Client_Exception $e) { return false; } @@ -702,7 +702,7 @@ class IMP_Message } try { - $update_list[$key] = $GLOBALS['imp_imap']->ob->expunge($key, array('ids' => is_array($val) ? $val : array(), 'list' => $msg_list)); + $update_list[$key] = $GLOBALS['imp_imap']->ob()->expunge($key, array('ids' => is_array($val) ? $val : array(), 'list' => $msg_list)); $imp_mailbox = IMP_Mailbox::singleton($key); if ($imp_mailbox->isBuilt()) { @@ -744,7 +744,7 @@ class IMP_Message /* Make sure there is at least 1 message before attempting to delete. */ try { - $status = $GLOBALS['imp_imap']->ob->status($mbox, Horde_Imap_Client::STATUS_MESSAGES); + $status = $GLOBALS['imp_imap']->ob()->status($mbox, Horde_Imap_Client::STATUS_MESSAGES); if (empty($status['messages'])) { $notification->push(sprintf(_("The mailbox %s is already empty."), $display_mbox), 'horde.message'); continue; @@ -754,7 +754,7 @@ class IMP_Message $this->flagAllInMailbox(array('\\deleted'), array($mbox), true); $this->expungeMailbox(array($mbox => 1)); } else { - $ret = $GLOBALS['imp_imap']->ob->search($mbox); + $ret = $GLOBALS['imp_imap']->ob()->search($mbox); $indices = array($mbox => $ret['match']); $this->delete($indices); } @@ -776,7 +776,7 @@ class IMP_Message public function sizeMailbox($mbox, $formatted = true) { try { - $res = $GLOBALS['imp_imap']->ob->fetch($mbox, array(Horde_Imap_Client::FETCH_SIZE => true), array('sequence' => true)); + $res = $GLOBALS['imp_imap']->ob()->fetch($mbox, array(Horde_Imap_Client::FETCH_SIZE => true), array('sequence' => true)); $size = 0; reset($res); diff --git a/imp/lib/Notification/Listener/Status.php b/imp/lib/Notification/Listener/Status.php index ad71108d5..9cdff9d3c 100644 --- a/imp/lib/Notification/Listener/Status.php +++ b/imp/lib/Notification/Listener/Status.php @@ -76,7 +76,7 @@ class IMP_Notification_Listener_Status extends Horde_Notification_Listener_Statu /* Display IMAP alerts. */ if (isset($GLOBALS['imp_imap']->ob)) { - foreach ($GLOBALS['imp_imap']->ob->alerts() as $alert) { + foreach ($GLOBALS['imp_imap']->ob()->alerts() as $alert) { $GLOBALS['notification']->push($alert, 'horde.warning'); } } diff --git a/imp/lib/Notification/Listener/StatusMobile.php b/imp/lib/Notification/Listener/StatusMobile.php index 8c6c91b18..6432396c1 100644 --- a/imp/lib/Notification/Listener/StatusMobile.php +++ b/imp/lib/Notification/Listener/StatusMobile.php @@ -24,7 +24,7 @@ class IMP_Notification_Listener_StatusMobile extends Horde_Notification_Listener public function notify(&$messageStack, $options = array()) { /* Display IMAP alerts. */ - foreach ($GLOBALS['imp_imap']->ob->alerts() as $alert) { + foreach ($GLOBALS['imp_imap']->ob()->alerts() as $alert) { $GLOBALS['notification']->push($alert, 'horde.warning'); } diff --git a/imp/lib/Quota/Imap.php b/imp/lib/Quota/Imap.php index 55d6ba7ae..6724d13fc 100644 --- a/imp/lib/Quota/Imap.php +++ b/imp/lib/Quota/Imap.php @@ -23,7 +23,7 @@ class IMP_Quota_Imap extends IMP_Quota public function getQuota() { try { - $quota = $GLOBALS['imp_imap']->ob->getQuotaRoot($GLOBALS['imp_search']->isSearchMbox($GLOBALS['imp_mbox']['mailbox']) ? 'INBOX' : $GLOBALS['imp_mbox']['mailbox']); + $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"), 'horde.error'); } diff --git a/imp/lib/Search.php b/imp/lib/Search.php index 3c2225e15..a8b07365f 100644 --- a/imp/lib/Search.php +++ b/imp/lib/Search.php @@ -148,7 +148,7 @@ class IMP_Search } foreach ($search['folders'] as $val) { - $results = $GLOBALS['imp_imap']->ob->search($val, $query, array('reverse' => $sortpref['dir'], 'sort' => array($sortpref['by']))); + $results = $GLOBALS['imp_imap']->ob()->search($val, $query, array('reverse' => $sortpref['dir'], 'sort' => array($sortpref['by']))); foreach ($results['sort'] as $val2) { $sorted[] = $val2 . IMP::IDX_SEP . $val; } @@ -173,7 +173,7 @@ class IMP_Search $sortdir = null) { try { - $results = $GLOBALS['imp_imap']->ob->search($mailbox, $query, array('reverse' => $sortdir, 'sort' => array($sortby))); + $results = $GLOBALS['imp_imap']->ob()->search($mailbox, $query, array('reverse' => $sortdir, 'sort' => array($sortby))); return $results['sort']; } catch (Horde_Imap_Client_Exception $e) { return array(); diff --git a/imp/lib/UI/Message.php b/imp/lib/UI/Message.php index 65bdaf7af..f7fedc5f7 100644 --- a/imp/lib/UI/Message.php +++ b/imp/lib/UI/Message.php @@ -86,11 +86,11 @@ class IMP_UI_Message /* See if we have already processed this message. */ /* 1st test: $MDNSent keyword (RFC 3503 [3.1]). */ try { - $status = $GLOBALS['imp_imap']->ob->status($mailbox, Horde_Imap_Client::STATUS_PERMFLAGS); + $status = $GLOBALS['imp_imap']->ob()->status($mailbox, Horde_Imap_Client::STATUS_PERMFLAGS); if (in_array('\\*', $status['permflags']) || in_array('$mdnsent', $status['permflags'])) { $mdn_flag = true; - $res = $GLOBALS['imp_imap']->ob->fetch($mailbox, array( + $res = $GLOBALS['imp_imap']->ob()->fetch($mailbox, array( Horde_Imap_Client::FETCH_FLAGS => true ), array('ids' => array($uid))); $mdn_sent = in_array('$mdnsent', $res[$uid]['flags']); diff --git a/imp/lib/Views/ListMessages.php b/imp/lib/Views/ListMessages.php index 235cb14cd..8035420c8 100644 --- a/imp/lib/Views/ListMessages.php +++ b/imp/lib/Views/ListMessages.php @@ -161,7 +161,7 @@ class IMP_Views_ListMessages !empty($args['cache'])) { $uid_expire = false; try { - $status = $GLOBALS['imp_imap']->ob->status($mbox, Horde_Imap_Client::STATUS_UIDVALIDITY); + $status = $GLOBALS['imp_imap']->ob()->status($mbox, Horde_Imap_Client::STATUS_UIDVALIDITY); list($old_uidvalid,) = explode('|', $args['cacheid']); $uid_expire = ($old_uidvalid != $status['uidvalidity']); } catch (Horde_Imap_Cache_Exception $e) { @@ -181,7 +181,7 @@ class IMP_Views_ListMessages if (isset($md->search)) { $cached = Horde_Serialize::unserialize($args['cache'], Horde_Serialize::JSON); } else { - $cached = $GLOBALS['imp_imap']->ob->utils->fromSequenceString($args['cached']); + $cached = $GLOBALS['imp_imap']->ob()->utils->fromSequenceString($args['cached']); $cached = reset($cached); } $cached = array_flip($cached); diff --git a/imp/lib/Views/ShowMessage.php b/imp/lib/Views/ShowMessage.php index e9b9fe473..83caa2c86 100644 --- a/imp/lib/Views/ShowMessage.php +++ b/imp/lib/Views/ShowMessage.php @@ -107,7 +107,7 @@ class IMP_Views_ShowMessage /* Get envelope/header information. We don't use flags in this * view. */ try { - $fetch_ret = $GLOBALS['imp_imap']->ob->fetch($mailbox, array( + $fetch_ret = $GLOBALS['imp_imap']->ob()->fetch($mailbox, array( Horde_Imap_Client::FETCH_ENVELOPE => true, Horde_Imap_Client::FETCH_HEADERTEXT => array(array('parse' => true, 'peek' => false)) ), array('ids' => array($index))); diff --git a/imp/mailbox.php b/imp/mailbox.php index d8467c950..f818337aa 100644 --- a/imp/mailbox.php +++ b/imp/mailbox.php @@ -92,7 +92,7 @@ if ($actionID && ($actionID != 'message_missing')) { * select it on the IMAP server (saves some STATUS calls). Open R/W to clear * the RECENT flag. */ if (!$search_mbox) { - $imp_imap->ob->openMailbox($imp_mbox['mailbox'], Horde_Imap_Client::OPEN_READWRITE); + $imp_imap->ob()->openMailbox($imp_mbox['mailbox'], Horde_Imap_Client::OPEN_READWRITE); } /* Determine if mailbox is readonly. */ @@ -197,7 +197,7 @@ case 'empty_mailbox': break; case 'view_messages': - $redirect = Horde_Util::addParameter(IMP::generateIMPUrl('thread.php', $imp_mbox['mailbox'], null, null, false), array('mode' => 'msgview', 'msglist' => $GLOBALS['imp_imap']->ob->utils->toSequenceString(IMP::parseIndicesList($indices), array('mailbox' => true))), null, false); + $redirect = Horde_Util::addParameter(IMP::generateIMPUrl('thread.php', $imp_mbox['mailbox'], null, null, false), array('mode' => 'msgview', 'msglist' => $GLOBALS['imp_imap']->ob()->utils->toSequenceString(IMP::parseIndicesList($indices), array('mailbox' => true))), null, false); header('Location: ' . $redirect); exit; } @@ -396,7 +396,7 @@ if ($open_compose_window === false) { if (!empty($newmsgs)) { /* Open the mailbox R/W so we ensure the 'recent' flags are cleared from * the current mailbox. */ - $imp_imap->ob->openMailbox($imp_mbox['mailbox'], Horde_Imap_Client::OPEN_READWRITE); + $imp_imap->ob()->openMailbox($imp_mbox['mailbox'], Horde_Imap_Client::OPEN_READWRITE); if (!Horde_Util::getFormData('no_newmail_popup')) { /* Newmail audio. */ diff --git a/imp/message-mimp.php b/imp/message-mimp.php index a31245e93..4e2e5f46a 100644 --- a/imp/message-mimp.php +++ b/imp/message-mimp.php @@ -95,10 +95,10 @@ $mailbox_name = $index_array['mailbox']; try { /* Need to fetch flags before HEADERTEXT, because SEEN flag might be set * before we can grab it. */ - $flags_ret = $imp_imap->ob->fetch($mailbox_name, array( + $flags_ret = $imp_imap->ob()->fetch($mailbox_name, array( Horde_Imap_Client::FETCH_FLAGS => true, ), array('ids' => array($index))); - $fetch_ret = $imp_imap->ob->fetch($mailbox_name, array( + $fetch_ret = $imp_imap->ob()->fetch($mailbox_name, array( Horde_Imap_Client::FETCH_ENVELOPE => true, Horde_Imap_Client::FETCH_HEADERTEXT => array(array('parse' => true, 'peek' => $readonly)) ), array('ids' => array($index))); diff --git a/imp/message.php b/imp/message.php index e349b5770..d9eda6d69 100644 --- a/imp/message.php +++ b/imp/message.php @@ -33,7 +33,7 @@ new IMP_Application(array('init' => true)); * select it on the IMAP server (saves some STATUS calls). Open R/W to clear * the RECENT flag. */ if (!$imp_search->isSearchMbox($imp_mbox['mailbox'])) { - $imp_imap->ob->openMailbox($imp_mbox['mailbox'], Horde_Imap_Client::OPEN_READWRITE); + $imp_imap->ob()->openMailbox($imp_mbox['mailbox'], Horde_Imap_Client::OPEN_READWRITE); } /* Make sure we have a valid index. */ @@ -208,10 +208,10 @@ try { try { /* Need to fetch flags before HEADERTEXT, because SEEN flag might be set * before we can grab it. */ - $flags_ret = $imp_imap->ob->fetch($mailbox_name, array( + $flags_ret = $imp_imap->ob()->fetch($mailbox_name, array( Horde_Imap_Client::FETCH_FLAGS => true, ), array('ids' => array($index))); - $fetch_ret = $imp_imap->ob->fetch($mailbox_name, array( + $fetch_ret = $imp_imap->ob()->fetch($mailbox_name, array( Horde_Imap_Client::FETCH_ENVELOPE => true, Horde_Imap_Client::FETCH_HEADERTEXT => array(array('parse' => true, 'peek' => $peek)) ), array('ids' => array($index))); diff --git a/imp/thread.php b/imp/thread.php index aa9224c8a..6f5c7fb0e 100644 --- a/imp/thread.php +++ b/imp/thread.php @@ -28,7 +28,7 @@ if ($mode == 'thread') { } } else { /* MSGVIEW MODE: Make sure we have a valid list of messages. */ - $msglist = $GLOBALS['imp_imap']->ob->utils->fromSequenceString(Horde_Util::getFormData('msglist')); + $msglist = $GLOBALS['imp_imap']->ob()->utils->fromSequenceString(Horde_Util::getFormData('msglist')); if (empty($msglist)) { $error = true; } @@ -80,7 +80,7 @@ $charset = Horde_Nls::getCharset(); $imp_ui = new IMP_UI_Message(); foreach ($loop_array as $mbox => $idxlist) { - $fetch_res = $GLOBALS['imp_imap']->ob->fetch($mbox, array( + $fetch_res = $GLOBALS['imp_imap']->ob()->fetch($mbox, array( Horde_Imap_Client::FETCH_ENVELOPE => true ), array('ids' => $idxlist)); -- 2.11.0