From: Michael M Slusarz Date: Mon, 4 Oct 2010 19:45:45 +0000 (-0600) Subject: Remove unneeded IMP_Imap binder X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=1121fb4fdde21774156cca072cbce4f6aac49313;p=horde.git Remove unneeded IMP_Imap binder --- diff --git a/imp/compose-mimp.php b/imp/compose-mimp.php index a7005445d..d974fe920 100644 --- a/imp/compose-mimp.php +++ b/imp/compose-mimp.php @@ -64,7 +64,7 @@ $sent_mail_folder = $identity->getValue('sent_mail_folder'); /* Determine if mailboxes are readonly. */ $readonly_drafts = false; -$imp_imap = $injector->getInstance('IMP_Imap')->getOb(); +$imp_imap = $injector->getInstance('IMP_Injector_Factory_Imap')->create(); if (!empty($draft)) { $draft = IMP::folderPref($draft, true); $readonly_drafts = $imp_folder->exists($draft) && diff --git a/imp/compose.php b/imp/compose.php index a8e71c2ad..5cefdfbaa 100644 --- a/imp/compose.php +++ b/imp/compose.php @@ -98,7 +98,7 @@ $compose_disable = !IMP::canCompose(); $imp_folder = $injector->getInstance('IMP_Folder'); $readonly_drafts = $readonly_sentmail = false; $draft = $prefs->getValue('drafts_folder'); -$imp_imap = $injector->getInstance('IMP_Imap')->getOb(); +$imp_imap = $injector->getInstance('IMP_Injector_Factory_Imap')->create(); if (!empty($draft)) { $draft = IMP::folderPref($draft, true); $readonly_drafts = $imp_folder->exists($draft) && diff --git a/imp/folders.php b/imp/folders.php index fe0237635..b71398a1b 100644 --- a/imp/folders.php +++ b/imp/folders.php @@ -166,7 +166,7 @@ case 'rename_folder': if (!empty($new_names) && !empty($old_names) && ($iMax == count($old_names))) { - $imp_imap = $injector->getInstance('IMP_Imap')->getOb(); + $imp_imap = $injector->getInstance('IMP_Injector_Factory_Imap')->create(); for ($i = 0; $i < $iMax; ++$i) { $old_name = IMP::formMbox($old_names[$i], false); $old_ns = $imp_imap->getNamespace($old_name); @@ -246,7 +246,7 @@ case 'folders_empty_mailbox_confirm': } try { - $elt_info = $injector->getInstance('IMP_Imap')->getOb()->status($val, Horde_Imap_Client::STATUS_MESSAGES); + $elt_info = $injector->getInstance('IMP_Injector_Factory_Imap')->create()->status($val, Horde_Imap_Client::STATUS_MESSAGES); } catch (Horde_Imap_Client_Exception $e) { $elt_info = null; } @@ -415,7 +415,7 @@ if (!empty($imaptree->recent)) { /* Open the mailbox R/W so we ensure the 'recent' flags are cleared from * the current mailbox. */ foreach ($imaptree->recent as $mbox => $nm) { - $injector->getInstance('IMP_Imap')->getOb()->openMailbox($mbox, Horde_Imap_Client::OPEN_READWRITE); + $injector->getInstance('IMP_Injector_Factory_Imap')->create()->openMailbox($mbox, Horde_Imap_Client::OPEN_READWRITE); } IMP::newmailAlerts($imaptree->recent); diff --git a/imp/lib/Ajax/Application.php b/imp/lib/Ajax/Application.php index 2e756c36f..c07533cd6 100644 --- a/imp/lib/Ajax/Application.php +++ b/imp/lib/Ajax/Application.php @@ -452,7 +452,7 @@ class IMP_Ajax_Application extends Horde_Core_Ajax_Application $result = new stdClass; $result->poll = array(); - foreach ($GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->statusMultiple($GLOBALS['injector']->getInstance('IMP_Imap_Tree')->getPollList(), Horde_Imap_Client::STATUS_UNSEEN) as $key => $val) { + foreach ($GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->statusMultiple($GLOBALS['injector']->getInstance('IMP_Imap_Tree')->getPollList(), Horde_Imap_Client::STATUS_UNSEEN) as $key => $val) { $result->poll[$key] = intval($val['unseen']); } @@ -506,7 +506,7 @@ class IMP_Ajax_Application extends Horde_Core_Ajax_Application if ($this->_vars->add) { $imptree->addPollList($this->_vars->mbox); try { - if ($info = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->status($this->_vars->mbox, Horde_Imap_Client::STATUS_UNSEEN)) { + if ($info = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->status($this->_vars->mbox, Horde_Imap_Client::STATUS_UNSEEN)) { $result->poll = array($this->_vars->mbox => intval($info['unseen'])); } } catch (Horde_Imap_Client_Exception $e) {} @@ -1444,7 +1444,7 @@ class IMP_Ajax_Application extends Horde_Core_Ajax_Application } try { - $fetch_ret = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->fetch($this->_vars->view, array( + $fetch_ret = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->fetch($this->_vars->view, array( Horde_Imap_Client::FETCH_HEADERTEXT => array(array('parse' => true, 'peek' => false)) ), array('ids' => array($this->_vars->uid))); } catch (Horde_Imap_Client_Exception $e) { @@ -1875,7 +1875,7 @@ class IMP_Ajax_Application extends Horde_Core_Ajax_Application protected function _checkUidvalidity($result = false) { try { - $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->checkUidvalidity($this->_vars->view); + $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->checkUidvalidity($this->_vars->view); } catch (IMP_Exception $e) { if (!is_object($result)) { $result = new stdClass; @@ -1967,7 +1967,7 @@ class IMP_Ajax_Application extends Horde_Core_Ajax_Application * on the IMAP server (saves some STATUS calls). */ if (!is_null($rw)) { try { - $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->openMailbox($this->_vars->view, $rw ? Horde_Imap_Client::OPEN_READWRITE : Horde_Imap_Client::OPEN_AUTO); + $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->openMailbox($this->_vars->view, $rw ? Horde_Imap_Client::OPEN_READWRITE : Horde_Imap_Client::OPEN_AUTO); } catch (Horde_Imap_Client_Exception $e) { if ($e->getCode() == Horde_Imap_Client_Exception::MAILBOX_NOOPEN) { $GLOBALS['notification']->push(sprintf(_("Could not open mailbox \"%s\"."), $this->_vars->view), 'horde.error'); diff --git a/imp/lib/Api.php b/imp/lib/Api.php index 908cfa0e9..234694afd 100644 --- a/imp/lib/Api.php +++ b/imp/lib/Api.php @@ -88,7 +88,7 @@ class IMP_Api extends Horde_Registry_Api */ public function createFolder($folder) { - $fname = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->appendNamespace($folder); + $fname = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->appendNamespace($folder); return $GLOBALS['injector']->getInstance('IMP_Folder')->create($fname, $GLOBALS['prefs']->getValue('subscribe')) ? $fname : false; @@ -213,7 +213,7 @@ class IMP_Api extends Horde_Registry_Api */ public function imapOb() { - return $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->ob; + return $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->ob; } /** diff --git a/imp/lib/Application.php b/imp/lib/Application.php index 10c333d52..7f27a6d43 100644 --- a/imp/lib/Application.php +++ b/imp/lib/Application.php @@ -94,7 +94,6 @@ class IMP_Application extends Horde_Registry_Application 'IMP_Crypt_Pgp' => new IMP_Injector_Binder_Pgp(), 'IMP_Crypt_Smime' => new IMP_Injector_Binder_Smime(), 'IMP_Identity' => new IMP_Injector_Binder_Identity(), - 'IMP_Imap' => new IMP_Injector_Binder_Imap(), 'IMP_Imap_Tree' => new IMP_Injector_Binder_Imaptree(), 'IMP_Mail' => new IMP_Injector_Binder_Mail(), 'IMP_Mailbox_List' => new IMP_Injector_Binder_MailboxList(), @@ -244,7 +243,7 @@ class IMP_Application extends Horde_Registry_Application $trash_folder = IMP::folderPref($trash_folder, true); if ($injector->getInstance('IMP_Search')->isVTrash($trash_folder) || - !$injector->getInstance('IMP_Imap')->getOb()->isReadOnly($trash_folder)) { + !$injector->getInstance('IMP_Injector_Factory_Imap')->create()->isReadOnly($trash_folder)) { $menu->addArray(array( 'class' => '__noselection', 'icon' => 'empty_trash.png', diff --git a/imp/lib/Auth.php b/imp/lib/Auth.php index 9970aecbd..74ea49a05 100644 --- a/imp/lib/Auth.php +++ b/imp/lib/Auth.php @@ -43,7 +43,7 @@ class IMP_Auth throw new Horde_Auth_Exception('', Horde_Auth::REASON_FAILED); } - $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb(); + $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create(); // Check for valid IMAP Client object. if (!$imp_imap->ob) { @@ -153,7 +153,7 @@ class IMP_Auth } $auth_id = $GLOBALS['registry']->getAuth(); - $imap_ob = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb(); + $imap_ob = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create(); $msg = sprintf( $msg . ' %s [%s]%s to {%s:%s%s}', @@ -218,7 +218,7 @@ class IMP_Auth ); /* Load the server configuration. */ - $ptr = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->loadServerConfig($credentials['server']); + $ptr = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->loadServerConfig($credentials['server']); if ($ptr === false) { throw new Horde_Auth_Exception('', Horde_Auth::REASON_FAILED); } @@ -300,7 +300,7 @@ class IMP_Auth */ static protected function _canAutoLogin($server_key = null, $force = false) { - if (($servers = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->loadServerConfig()) === false) { + if (($servers = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->loadServerConfig()) === false) { return false; } @@ -385,7 +385,7 @@ class IMP_Auth $sess = &$_SESSION['imp']; - $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb(); + $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create(); $ptr = $imp_imap->loadServerConfig($sess['server_key']); if ($ptr === false) { throw new Horde_Auth_Exception('', Horde_Auth::REASON_FAILED); diff --git a/imp/lib/Block/Newmail.php b/imp/lib/Block/Newmail.php index 83a209838..2375edaab 100644 --- a/imp/lib/Block/Newmail.php +++ b/imp/lib/Block/Newmail.php @@ -39,7 +39,7 @@ class IMP_Block_Newmail extends Horde_Block : $this->_params['msgs_shown']; try { - $fetch_ret = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->fetch('INBOX', array( + $fetch_ret = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->fetch('INBOX', array( Horde_Imap_Client::FETCH_ENVELOPE => true ), array('ids' => array_slice($indices, 0, $shown))); reset($fetch_ret); diff --git a/imp/lib/Compose.php b/imp/lib/Compose.php index cffb59096..c18c6ce2b 100644 --- a/imp/lib/Compose.php +++ b/imp/lib/Compose.php @@ -215,7 +215,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator /* Add information necessary to log replies/forwards when finally * sent. */ if ($this->getMetadata('reply_type')) { - $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb(); + $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create(); try { $imap_url = $imp_imap->getUtils()->createUrl(array( 'type' => $_SESSION['imp']['protocol'], @@ -283,7 +283,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator /* Add the message to the mailbox. */ try { - $ids = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->append($drafts_mbox, array(array('data' => $data, 'flags' => $append_flags))); + $ids = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->append($drafts_mbox, array(array('data' => $data, 'flags' => $append_flags))); if ($old_uid) { $GLOBALS['injector']->getInstance('IMP_Message')->delete($old_uid, array('nuke' => true)); @@ -399,7 +399,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator } if ($val) { - $imp_imap = $injector->getInstance('IMP_Imap')->getOb(); + $imp_imap = $injector->getInstance('IMP_Injector_Factory_Imap')->crerate(); $imap_url = $imp_imap->getUtils()->parseUrl(rtrim(ltrim($val, '<'), '>')); try { @@ -685,7 +685,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator } try { - $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->append($opts['sent_folder'], array(array('data' => $fcc, 'flags' => $flags))); + $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->append($opts['sent_folder'], 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; @@ -1316,7 +1316,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator $subject = $h->getValue('subject'); $header['subject'] = empty($subject) ? 'Re: ' - : 'Re: ' . $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->getUtils()->getBaseSubject($subject, array('keepblob' => true)); + : 'Re: ' . $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->getUtils()->getBaseSubject($subject, array('keepblob' => true)); $force = false; if (in_array($type, array('reply', 'reply_auto', '*'))) { @@ -1595,7 +1595,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator $header['subject'] = $h->getValue('subject'); if (!empty($header['subject'])) { - $subject = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->getUtils()->getBaseSubject($header['subject'], array('keepblob' => true)); + $subject = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->getUtils()->getBaseSubject($header['subject'], array('keepblob' => true)); $header['title'] = _("Forward") . ': ' . $subject; $header['subject'] = 'Fwd: ' . $subject; } else { @@ -1812,7 +1812,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator } else { $name = Horde_String::truncate($name, 80); } - return 'Fwd: ' . $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->getUtils()->getBaseSubject($name, array('keepblob' => true)); + return 'Fwd: ' . $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->getUtils()->getBaseSubject($name, array('keepblob' => true)); } return 'Fwd: ' . sprintf(_("%u Forwarded Messages"), $attached); diff --git a/imp/lib/Contents.php b/imp/lib/Contents.php index 3c7a7cd85..6a4ada1d1 100644 --- a/imp/lib/Contents.php +++ b/imp/lib/Contents.php @@ -99,7 +99,7 @@ class IMP_Contents /* Get the Horde_Mime_Part object for the given UID. */ try { - $ret = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->fetch($this->_mailbox, array( + $ret = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->fetch($this->_mailbox, array( Horde_Imap_Client::FETCH_STRUCTURE => array('parse' => true) ), array('ids' => array($this->_uid))); } catch (Horde_Imap_Client_Exception $e) { @@ -153,7 +153,7 @@ class IMP_Contents } try { - $res = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->fetch($this->_mailbox, array( + $res = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->fetch($this->_mailbox, array( Horde_Imap_Client::FETCH_BODYTEXT => array(array('peek' => true, 'stream' => !empty($options['stream']))) ), array('ids' => array($this->_uid))); return $res[$this->_uid]['bodytext'][0]; @@ -212,7 +212,7 @@ class IMP_Contents } try { - $res = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->fetch($this->_mailbox, $query, array('ids' => array($this->_uid))); + $res = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->fetch($this->_mailbox, $query, array('ids' => array($this->_uid))); if (empty($options['mimeheaders'])) { if (!empty($res[$this->_uid]['bodypartdecode'][$id])) { $this->lastBodyPartDecode = $res[$this->_uid]['bodypartdecode'][$id]; @@ -250,7 +250,7 @@ class IMP_Contents } try { - $res = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->fetch($this->_mailbox, array( + $res = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->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->_uid))); @@ -284,7 +284,7 @@ class IMP_Contents } try { - $res = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->fetch($this->_mailbox, array( + $res = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->fetch($this->_mailbox, array( Horde_Imap_Client::FETCH_HEADERTEXT => array(array('parse' => $parse, 'peek' => true)) ), array('ids' => array($this->_uid))); return $res[$this->_uid]['headertext'][0]; diff --git a/imp/lib/Filter.php b/imp/lib/Filter.php index 3d74d773f..2e062064c 100644 --- a/imp/lib/Filter.php +++ b/imp/lib/Filter.php @@ -111,7 +111,7 @@ class IMP_Filter } $addr = array(); - $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb(); + $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create(); foreach (array_keys($indices) as $mbox) { $imp_imap->checkUidvalidity($mbox); diff --git a/imp/lib/Folder.php b/imp/lib/Folder.php index 9ca405068..10b947ebb 100644 --- a/imp/lib/Folder.php +++ b/imp/lib/Folder.php @@ -55,7 +55,7 @@ class IMP_Folder } try { - $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->deleteMailbox($folder); + $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->deleteMailbox($folder); $notification->push(sprintf(_("The folder \"%s\" was successfully deleted."), IMP::displayFolder($folder)), 'horde.success'); $deleted[] = $folder; } catch (Horde_Imap_Client_Exception $e) { @@ -144,7 +144,7 @@ class IMP_Folder /* Attempt to create the mailbox. */ try { - $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->createMailbox($folder, array('special_use' => $special_use)); + $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->createMailbox($folder, array('special_use' => $special_use)); } 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; @@ -178,7 +178,7 @@ class IMP_Folder } try { - $ret = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->listMailboxes($folder, array('flat' => true)); + $ret = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->listMailboxes($folder, array('flat' => true)); return !empty($ret); } catch (Horde_Imap_Client_Exception $e) { return false; @@ -219,7 +219,7 @@ class IMP_Folder $all_folders = array_merge(array($old), array_keys(iterator_to_array($imaptree))); try { - $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->renameMailbox($old, $new); + $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->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; @@ -263,7 +263,7 @@ class IMP_Folder foreach (array_filter($folders) as $folder) { try { - $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->subscribeMailbox($folder, true); + $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->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) { @@ -303,7 +303,7 @@ class IMP_Folder $notification->push(sprintf(_("You cannot unsubscribe from \"%s\"."), IMP::displayFolder($folder)), 'horde.error'); } else { try { - $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->subscribeMailbox($folder, false); + $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->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) { @@ -344,7 +344,7 @@ class IMP_Folder foreach ($folder_list as $folder) { try { - $status = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->status($folder, Horde_Imap_Client::STATUS_MESSAGES); + $status = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->status($folder, Horde_Imap_Client::STATUS_MESSAGES); } catch (Horde_Imap_Client_Exception $e) { continue; } @@ -352,7 +352,7 @@ class IMP_Folder /* Download one message at a time to save on memory * overhead. */ try { - $res = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->fetch($folder, array( + $res = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->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, @@ -397,7 +397,7 @@ class IMP_Folder { $message = ''; $msgcount = 0; - $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb(); + $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create(); $fd = fopen($mbox, 'r'); while (!feof($fd)) { diff --git a/imp/lib/IMP.php b/imp/lib/IMP.php index 97f54ffff..b946aad41 100644 --- a/imp/lib/IMP.php +++ b/imp/lib/IMP.php @@ -356,7 +356,7 @@ class IMP return $cache[$folder]; } - $ns_info = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->getNamespace($folder); + $ns_info = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->getNamespace($folder); $delimiter = is_null($ns_info) ? '' : $ns_info['delimiter']; /* Substitute any translated prefix text. */ @@ -556,7 +556,7 @@ class IMP */ static public function folderPref($folder, $append) { - $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb(); + $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create(); $def_ns = $imp_imap->defaultNamespace(); $empty_ns = $imp_imap->getNamespace(''); diff --git a/imp/lib/Imap/Acl.php b/imp/lib/Imap/Acl.php index bdc4d3075..8a3da2ff6 100644 --- a/imp/lib/Imap/Acl.php +++ b/imp/lib/Imap/Acl.php @@ -45,7 +45,7 @@ class IMP_Imap_Acl throw new IMP_Exception(_("ACLs not configured for this server.")); } - $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb(); + $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create(); if (!$imp_imap->queryCapability('ACL')) { throw new IMP_Exception(_("IMAP server does not support ACLs.")); } @@ -129,7 +129,7 @@ class IMP_Imap_Acl public function getACL($mbox) { try { - return $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->getACL($mbox); + return $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->getACL($mbox); } catch (Horde_Imap_Client_Exception $e) { throw new IMP_Exception(_("Could not retrieve ACL")); } @@ -147,7 +147,7 @@ class IMP_Imap_Acl public function editACL($mbox, $user, $acl) { try { - $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->setACL($mbox, $user, array('remove' => empty($acl), 'rights' => implode('', $acl))); + $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->setACL($mbox, $user, array('remove' => empty($acl), 'rights' => implode('', $acl))); } catch (Horde_Imap_Client_Exception $e) { throw new IMP_Exception(sprintf(_("Couldn't give user \"%s\" the following rights for the folder \"%s\": %s"), $user, $mbox, implode('', $acl))); } @@ -164,7 +164,7 @@ class IMP_Imap_Acl public function canEdit($mbox, $user) { try { - $rights = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->listACLRights($mbox, $user); + $rights = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->listACLRights($mbox, $user); $rights = array_merge($rights['required'], $rights['optional']); foreach ($rights as $val) { if (strpos($val, 'a') !== false) { diff --git a/imp/lib/Imap/Flags.php b/imp/lib/Imap/Flags.php index c6eacb42e..d80fe4244 100644 --- a/imp/lib/Imap/Flags.php +++ b/imp/lib/Imap/Flags.php @@ -97,7 +97,7 @@ class IMP_Imap_Flags try { /* Make sure we are in R/W mailbox mode (SELECT). No flags are * allowed in EXAMINE mode. */ - $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb(); + $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create(); $imp_imap->openMailbox($options['mailbox'], Horde_Imap_Client::OPEN_READWRITE); $status = $imp_imap->status($options['mailbox'], Horde_Imap_Client::STATUS_PERMFLAGS); @@ -181,7 +181,7 @@ class IMP_Imap_Flags /* IMAP keywords must conform to RFC 3501 [9] (flag-keyword). Convert * whitespace to underscore. */ - $key = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->getUtils()->stripNonAtomChars(Horde_String::convertCharset(strtr($label, ' ', '_'), 'UTF-8', 'UTF7-IMAP')); + $key = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->getUtils()->stripNonAtomChars(Horde_String::convertCharset(strtr($label, ' ', '_'), 'UTF-8', 'UTF7-IMAP')); if (!isset($this->_flags[$key])) { $entry = $this->_createEntry($label); diff --git a/imp/lib/Imap/Tree.php b/imp/lib/Imap/Tree.php index 541394897..b9318b2da 100644 --- a/imp/lib/Imap/Tree.php +++ b/imp/lib/Imap/Tree.php @@ -165,7 +165,7 @@ class IMP_Imap_Tree implements ArrayAccess, Iterator, Serializable public function __construct() { if ($_SESSION['imp']['protocol'] == 'imap') { - $ns = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->getNamespaceList(); + $ns = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->getNamespaceList(); $ptr = reset($ns); $this->_delimiter = $ptr['delimiter']; $this->_namespaces = empty($GLOBALS['conf']['user']['allow_folders']) @@ -261,7 +261,7 @@ class IMP_Imap_Tree implements ArrayAccess, Iterator, Serializable } try { - $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb(); + $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create(); $result = $imp_imap->listMailboxes($searches, $showunsub ? Horde_Imap_Client::MBOX_ALL : Horde_Imap_Client::MBOX_SUBSCRIBED_EXISTS, array('attributes' => true, 'delimiter' => true, 'sort' => true)); /* INBOX must always appear. */ @@ -467,7 +467,7 @@ class IMP_Imap_Tree implements ArrayAccess, Iterator, Serializable if (!empty($id)) { try { - $this->_insert($GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->listMailboxes($id, Horde_Imap_Client::MBOX_ALL, array('attributes' => true, 'delimiter' => true, 'sort' => true))); + $this->_insert($GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->listMailboxes($id, Horde_Imap_Client::MBOX_ALL, array('attributes' => true, 'delimiter' => true, 'sort' => true))); } catch (Horde_Imap_Client_Exception $e) {} } } @@ -1259,7 +1259,7 @@ class IMP_Imap_Tree implements ArrayAccess, Iterator, Serializable { if (!in_array($mailbox, array(self::OTHER_KEY, self::SHARED_KEY, self::VFOLDER_KEY)) && (strpos($mailbox, self::VFOLDER_KEY . $this->_delimiter) !== 0)) { - return $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->getNamespace($mailbox); + return $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->getNamespace($mailbox); } return null; } @@ -1426,7 +1426,7 @@ class IMP_Imap_Tree implements ArrayAccess, Iterator, Serializable public function createMailboxName($parent, $new) { $ns_info = empty($parent) - ? $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->defaultNamespace() + ? $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->defaultNamespace() : $this->_getNamespace($parent); if (is_null($ns_info)) { diff --git a/imp/lib/Imap/Tree/Element.php b/imp/lib/Imap/Tree/Element.php index f4b928495..e1cbff364 100644 --- a/imp/lib/Imap/Tree/Element.php +++ b/imp/lib/Imap/Tree/Element.php @@ -155,7 +155,7 @@ class IMP_Imap_Tree_Element $info->unseen = 0; try { - if ($msgs_info = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->status($this->value, Horde_Imap_Client::STATUS_RECENT | Horde_Imap_Client::STATUS_UNSEEN | Horde_Imap_Client::STATUS_MESSAGES)) { + if ($msgs_info = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->status($this->value, Horde_Imap_Client::STATUS_RECENT | Horde_Imap_Client::STATUS_UNSEEN | Horde_Imap_Client::STATUS_MESSAGES)) { if (!empty($msgs_info['recent'])) { $info->recent = intval($msgs_info['recent']); } diff --git a/imp/lib/Indices.php b/imp/lib/Indices.php index c62049835..9179c81e8 100644 --- a/imp/lib/Indices.php +++ b/imp/lib/Indices.php @@ -81,7 +81,7 @@ class IMP_Indices implements Countable, Iterator } } } elseif (is_string($data)) { - $indices = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->getUtils()->fromSequenceString($data); + $indices = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->getUtils()->fromSequenceString($data); } elseif ($data instanceof IMP_Compose) { $indices = array( $data->getMetadata('mailbox') => array($data->getMetadata('uid')) @@ -178,7 +178,7 @@ class IMP_Indices implements Countable, Iterator */ public function __toString() { - return $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->getUtils()->toSequenceString($this->_indices, array('mailbox' => true)); + return $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->getUtils()->toSequenceString($this->_indices, array('mailbox' => true)); } /* Iterator methods. */ diff --git a/imp/lib/Injector/Binder/Imap.php b/imp/lib/Injector/Binder/Imap.php deleted file mode 100644 index ab9fa5d05..000000000 --- a/imp/lib/Injector/Binder/Imap.php +++ /dev/null @@ -1,31 +0,0 @@ - - * @category Horde - * @license http://www.fsf.org/copyleft/gpl.html GPL - * @package IMP - */ -class IMP_Injector_Binder_Imap implements Horde_Injector_Binder -{ - /** - */ - public function create(Horde_Injector $injector) - { - return new IMP_Injector_Factory_Imap($injector); - } - - /** - */ - public function equals(Horde_Injector_Binder $binder) - { - return false; - } - -} diff --git a/imp/lib/Injector/Binder/Mail.php b/imp/lib/Injector/Binder/Mail.php index 265b38b6e..b8d104b26 100644 --- a/imp/lib/Injector/Binder/Mail.php +++ b/imp/lib/Injector/Binder/Mail.php @@ -36,7 +36,7 @@ class IMP_Injector_Binder_Mail implements Horde_Injector_Binder * current IMAP / POP3 connection are valid for SMTP authentication as * well. */ if (!empty($params['auth']) && empty($params['username'])) { - $imap_ob = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb(); + $imap_ob = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create(); $params['username'] = $imap_ob->getParam('username'); $params['password'] = $imap_ob->getParam('password'); } diff --git a/imp/lib/Injector/Binder/Quota.php b/imp/lib/Injector/Binder/Quota.php index e28c16afc..af776952d 100644 --- a/imp/lib/Injector/Binder/Quota.php +++ b/imp/lib/Injector/Binder/Quota.php @@ -32,14 +32,14 @@ class IMP_Injector_Binder_Quota implements Horde_Injector_Binder switch (Horde_String::lower($driver)) { case 'imap': - $params['imap_ob'] = $injector->getInstance('IMP_Imap')->getOb(); + $params['imap_ob'] = $injector->getInstance('IMP_Injector_Factory_Imap')->create(); $params['mbox'] = $injector->getInstance('IMP_Search')->isSearchMbox(IMP::$mailbox) ? 'INBOX' : IMP::$mailbox; break; case 'maildir': - $params['username'] = $injector->getInstance('IMP_Imap')->getOb()->getParam('username'); + $params['username'] = $injector->getInstance('IMP_Injector_Factory_Imap')->create()->getParam('username'); break; case 'sql': diff --git a/imp/lib/Injector/Factory/Imap.php b/imp/lib/Injector/Factory/Imap.php index f9115bb71..a8b9de9ee 100644 --- a/imp/lib/Injector/Factory/Imap.php +++ b/imp/lib/Injector/Factory/Imap.php @@ -35,31 +35,14 @@ class IMP_Injector_Factory_Imap private $_instances = array(); /** - * The injector. - * - * @var Horde_Injector - */ - private $_injector; - - /** - * Constructor. - * - * @param Horde_Injector $injector The injector to use. - */ - public function __construct(Horde_Injector $injector) - { - $this->_injector = $injector; - } - - /** * Return the IMP_Imap:: instance. * * @param string $id The server ID. * - * @return IMP_Imap The singleton contents instance. + * @return IMP_Imap The singleton instance. * @throws IMP_Exception */ - public function getOb($id = null) + public function create($id = null) { if (is_null($id)) { $id = isset($_SESSION['imp']) diff --git a/imp/lib/LoginTasks/SystemTask/UpgradeFromImp4.php b/imp/lib/LoginTasks/SystemTask/UpgradeFromImp4.php index 5e8748d84..fdf02c0fb 100644 --- a/imp/lib/LoginTasks/SystemTask/UpgradeFromImp4.php +++ b/imp/lib/LoginTasks/SystemTask/UpgradeFromImp4.php @@ -73,7 +73,7 @@ class IMP_LoginTasks_SystemTask_UpgradeFromImp4 extends Horde_LoginTasks_SystemT protected function _upgradeExpireImapCache() { try { - $ob = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->ob; + $ob = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->ob; $ob->login(); $mboxes = $ob->listMailboxes('*', Horde_Imap_Client::MBOX_ALL, array('flat' => true)); diff --git a/imp/lib/Mailbox/List.php b/imp/lib/Mailbox/List.php index d2a9b2b4c..f93ff2948 100644 --- a/imp/lib/Mailbox/List.php +++ b/imp/lib/Mailbox/List.php @@ -157,7 +157,7 @@ class IMP_Mailbox_List implements Countable, Serializable $fetch_criteria[Horde_Imap_Client::FETCH_STRUCTURE] = array('parse' => true); } - $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb(); + $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create(); if (empty($options['preview'])) { $cache = null; @@ -345,7 +345,7 @@ class IMP_Mailbox_List implements Countable, Serializable } $criteria = new Horde_Imap_Client_Search_Query(); - $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb(); + $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create(); if (IMP::hideDeletedMsgs($this->_mailbox)) { $criteria->flag('\\deleted', false); @@ -448,7 +448,7 @@ class IMP_Mailbox_List implements Countable, Serializable $ret['anymsg'] = true; if (!$ret['msgcount'] && !$this->_searchmbox) { try { - $status = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->status($this->_mailbox, Horde_Imap_Client::STATUS_MESSAGES); + $status = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->status($this->_mailbox, Horde_Imap_Client::STATUS_MESSAGES); $ret['anymsg'] = (bool)$status['messages']; } catch (Horde_Imap_Client_Exception $e) { $ret['anymsg'] = false; @@ -489,7 +489,7 @@ class IMP_Mailbox_List implements Countable, Serializable * information is returned via a SELECT/EXAMINE call. */ if ($sortpref['by'] == Horde_Imap_Client::SORT_SEQUENCE) { try { - $res = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->status($this->_mailbox, Horde_Imap_Client::STATUS_FIRSTUNSEEN); + $res = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->status($this->_mailbox, Horde_Imap_Client::STATUS_FIRSTUNSEEN); if (!is_null($res['firstunseen'])) { return $res['firstunseen']; } @@ -521,7 +521,7 @@ class IMP_Mailbox_List implements Countable, Serializable { if (is_null($this->_threadob)) { try { - $this->_threadob = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->thread($this->_mailbox, array('criteria' => $_SESSION['imp']['imap']['thread'])); + $this->_threadob = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->thread($this->_mailbox, array('criteria' => $_SESSION['imp']['imap']['thread'])); } catch (Horde_Imap_Client_Exception $e) { $GLOBALS['notification']->push($e); return new Horde_Imap_Client_Thread(array(), 'uid'); @@ -658,7 +658,7 @@ class IMP_Mailbox_List implements Countable, Serializable if (!$this->_searchmbox) { $sortpref = IMP::getSort($this->_mailbox, true); try { - return $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->getCacheId($this->_mailbox, array($sortpref['by'], $sortpref['dir'])); + return $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->getCacheId($this->_mailbox, array($sortpref['by'], $sortpref['dir'])); } catch (Horde_Imap_Client_Exception $e) {} } diff --git a/imp/lib/Message.php b/imp/lib/Message.php index f86d7e8b3..73ead0659 100644 --- a/imp/lib/Message.php +++ b/imp/lib/Message.php @@ -105,7 +105,7 @@ class IMP_Message break; } - $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb(); + $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create(); foreach ($indices->indices() as $mbox => $msgIndices) { $error = null; @@ -211,7 +211,7 @@ class IMP_Message } } - $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb(); + $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create(); foreach ($indices->indices() as $mbox => $msgIndices) { $error = null; @@ -486,7 +486,7 @@ class IMP_Message return; } - $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb(); + $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create(); if ($imp_imap->isReadOnly($mbox)) { throw new IMP_Exception(_("Cannot strip the MIME part as the mailbox is read-only.")); @@ -624,7 +624,7 @@ class IMP_Message $action_array = $action ? array('add' => $flags) : array('remove' => $flags); - $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb(); + $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create(); foreach ($indices->indices() as $mbox => $msgIndices) { $error = null; @@ -679,7 +679,7 @@ class IMP_Message $action_array = $action ? array('add' => $flags) : array('remove' => $flags); - $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb(); + $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create(); foreach ($mboxes as $val) { try { @@ -719,7 +719,7 @@ class IMP_Message return $msg_list ? new IMP_Indices() : null; } - $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb(); + $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create(); $imp_search = $GLOBALS['injector']->getInstance('IMP_Search'); $process_list = $update_list = array(); @@ -770,7 +770,7 @@ class IMP_Message { global $notification, $prefs; - $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb(); + $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create(); $imp_search = $GLOBALS['injector']->getInstance('IMP_Search'); $trash_folder = ($prefs->getValue('use_trash')) ? IMP::folderPref($prefs->getValue('trash_folder'), true) @@ -824,7 +824,7 @@ class IMP_Message public function sizeMailbox($mbox, $formatted = true) { try { - $res = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->fetch($mbox, array(Horde_Imap_Client::FETCH_SIZE => true), array('sequence' => true)); + $res = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->fetch($mbox, array(Horde_Imap_Client::FETCH_SIZE => true), array('sequence' => true)); $size = 0; reset($res); diff --git a/imp/lib/Notification/Handler/Decorator/Imap.php b/imp/lib/Notification/Handler/Decorator/Imap.php index 36d9e3414..bc090ccb8 100644 --- a/imp/lib/Notification/Handler/Decorator/Imap.php +++ b/imp/lib/Notification/Handler/Decorator/Imap.php @@ -25,7 +25,7 @@ extends Horde_Notification_Handler_Decorator_Base public function notify($options) { if (in_array('status', $options['listeners']) && - ($ob = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()) && + ($ob = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()) && $ob->ob) { /* Display IMAP alerts. */ foreach ($ob->alerts() as $alert) { diff --git a/imp/lib/Prefs/Ui.php b/imp/lib/Prefs/Ui.php index f86c855ee..611074d05 100644 --- a/imp/lib/Prefs/Ui.php +++ b/imp/lib/Prefs/Ui.php @@ -1473,7 +1473,7 @@ class IMP_Prefs_Ui $sent_mail_folder = $sm_default; } - $sent_mail_folder = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->appendNamespace($sent_mail_folder); + $sent_mail_folder = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->appendNamespace($sent_mail_folder); if ($sent_mail_folder) { $imp_folder = $GLOBALS['injector']->getInstance('IMP_Folder'); @@ -1962,7 +1962,7 @@ class IMP_Prefs_Ui $folder = substr($folder, strlen(self::PREF_SPECIALUSE)); } elseif (!empty($new)) { $new = Horde_String::convertCharset($new, 'UTF-8', 'UTF7-IMAP'); - $folder = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->appendNamespace($new); + $folder = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->appendNamespace($new); if (!$GLOBALS['injector']->getInstance('IMP_Folder')->create($folder, $prefs->getValue('subscribe'), array($type => true))) { $folder = null; } @@ -1983,7 +1983,7 @@ class IMP_Prefs_Ui protected function _getSpecialUse($use) { if (is_null($this->_cache)) { - $this->_cache = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->listMailboxes('*', Horde_Imap_Client::MBOX_ALL, array( + $this->_cache = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->listMailboxes('*', Horde_Imap_Client::MBOX_ALL, array( 'attributes' => true, 'special_use' => true, 'sort' => true diff --git a/imp/lib/Search.php b/imp/lib/Search.php index b2cf48825..7ab1feaf4 100644 --- a/imp/lib/Search.php +++ b/imp/lib/Search.php @@ -157,7 +157,7 @@ class IMP_Search implements ArrayAccess, Iterator, Serializable */ public function imapSearch($mailbox, $query, $opts = array()) { - $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb(); + $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create(); /* If doing a from/to search, use display sorting if possible. * Although there is a fallback to a PHP-based display sort, for diff --git a/imp/lib/Spam.php b/imp/lib/Spam.php index 0436b3749..11af755bd 100644 --- a/imp/lib/Spam.php +++ b/imp/lib/Spam.php @@ -43,7 +43,7 @@ class IMP_Spam return 0; } - $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb(); + $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create(); $report_count = $result = 0; foreach ($indices->indices() as $mbox => $msgIndices) { diff --git a/imp/lib/Ui/Block.php b/imp/lib/Ui/Block.php index 0942ebd36..5c7c64b38 100644 --- a/imp/lib/Ui/Block.php +++ b/imp/lib/Ui/Block.php @@ -32,7 +32,7 @@ class IMP_Ui_Block $GLOBALS['injector']->getInstance('IMP_Filter')->filter('INBOX'); } - $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb(); + $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create(); /* Get list of mailboxes to poll. */ $poll = $GLOBALS['injector']->getInstance('IMP_Imap_Tree')->getPollList(true); diff --git a/imp/lib/Ui/Message.php b/imp/lib/Ui/Message.php index a2be22aea..ac5108071 100644 --- a/imp/lib/Ui/Message.php +++ b/imp/lib/Ui/Message.php @@ -70,7 +70,7 @@ class IMP_Ui_Message */ public function MDNCheck($mailbox, $uid, $headers, $confirmed = false) { - $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb(); + $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create(); $pref_val = $GLOBALS['prefs']->getValue('disposition_send_mdn'); if (!$pref_val || $imp_imap->isReadOnly($mailbox)) { diff --git a/imp/lib/Views/ListMessages.php b/imp/lib/Views/ListMessages.php index 53b0f9abe..92cc980f7 100644 --- a/imp/lib/Views/ListMessages.php +++ b/imp/lib/Views/ListMessages.php @@ -167,7 +167,7 @@ class IMP_Views_ListMessages } } - $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb(); + $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create(); /* These entries may change during a session, so always need to * update them. */ diff --git a/imp/lib/Views/ShowMessage.php b/imp/lib/Views/ShowMessage.php index 41f873500..a28e333d3 100644 --- a/imp/lib/Views/ShowMessage.php +++ b/imp/lib/Views/ShowMessage.php @@ -109,7 +109,7 @@ class IMP_Views_ShowMessage /* Get envelope/header information. We don't use flags in this * view. */ try { - $fetch_ret = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->fetch($mailbox, array( + $fetch_ret = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->fetch($mailbox, array( Horde_Imap_Client::FETCH_ENVELOPE => true, Horde_Imap_Client::FETCH_HEADERTEXT => array(array('parse' => true, 'peek' => false)) ), array('ids' => array($uid))); diff --git a/imp/mailbox-mimp.php b/imp/mailbox-mimp.php index 3027c5fec..ce742e9a1 100644 --- a/imp/mailbox-mimp.php +++ b/imp/mailbox-mimp.php @@ -37,7 +37,7 @@ $t = $injector->createInstance('Horde_Template'); $t->setOption('gettext', true); /* Determine if mailbox is readonly. */ -$imp_imap = $injector->getInstance('IMP_Imap')->getOb(); +$imp_imap = $injector->getInstance('IMP_Injector_Factory_Imap')->create(); $readonly = $imp_imap->isReadOnly(IMP::$mailbox); /* Get the base URL for this page. */ diff --git a/imp/mailbox.php b/imp/mailbox.php index 10ad07f17..a2bbbfd10 100644 --- a/imp/mailbox.php +++ b/imp/mailbox.php @@ -63,7 +63,7 @@ if (!Horde_Util::nonInputVar('from_message_page')) { $do_filter = false; $imp_flags = $injector->getInstance('IMP_Imap_Flags'); -$imp_imap = $injector->getInstance('IMP_Imap')->getOb(); +$imp_imap = $injector->getInstance('IMP_Injector_Factory_Imap')->create(); $indices = new IMP_Indices($vars->indices); /* Run through the action handlers */ diff --git a/imp/message-dimp.php b/imp/message-dimp.php index 7f11c2cd7..1c32a13d0 100644 --- a/imp/message-dimp.php +++ b/imp/message-dimp.php @@ -23,7 +23,7 @@ if (!$vars->uid || !$vars->folder) { $imp_ui = new IMP_Ui_Message(); $js_onload = $js_vars = array(); -$readonly = $injector->getInstance('IMP_Imap')->getOb()->isReadOnly($vars->folder); +$readonly = $injector->getInstance('IMP_Injector_Factory_Imap')->create()->isReadOnly($vars->folder); switch ($vars->actionID) { case 'strip_attachment': diff --git a/imp/message-mimp.php b/imp/message-mimp.php index 3be720e1d..0f317b92b 100644 --- a/imp/message-mimp.php +++ b/imp/message-mimp.php @@ -34,7 +34,7 @@ if (!$imp_mailbox->isValidIndex()) { IMP::generateIMPUrl('mailbox-mimp.php', IMP::$mailbox)->add('a', 'm')->redirect(); } -$readonly = $injector->getInstance('IMP_Imap')->getOb()->isReadOnly(IMP::$mailbox); +$readonly = $injector->getInstance('IMP_Injector_Factory_Imap')->create()->isReadOnly(IMP::$mailbox); $imp_ui_mimp = $injector->getInstance('IMP_Ui_Mimp'); $imp_hdr_ui = new IMP_Ui_Headers(); @@ -100,10 +100,10 @@ $uid = $index_ob['uid']; try { /* Need to fetch flags before HEADERTEXT, because SEEN flag might be set * before we can grab it. */ - $flags_ret = $injector->getInstance('IMP_Imap')->getOb()->fetch($mailbox_name, array( + $flags_ret = $injector->getInstance('IMP_Injector_Factory_Imap')->create()->fetch($mailbox_name, array( Horde_Imap_Client::FETCH_FLAGS => true, ), array('ids' => array($uid))); - $fetch_ret = $injector->getInstance('IMP_Imap')->getOb()->fetch($mailbox_name, array( + $fetch_ret = $injector->getInstance('IMP_Injector_Factory_Imap')->create()->fetch($mailbox_name, array( Horde_Imap_Client::FETCH_ENVELOPE => true, Horde_Imap_Client::FETCH_HEADERTEXT => array(array('parse' => true, 'peek' => $readonly)) ), array('ids' => array($uid))); diff --git a/imp/message.php b/imp/message.php index a7086e20f..6dd13f6b5 100644 --- a/imp/message.php +++ b/imp/message.php @@ -30,7 +30,7 @@ $registry->setTimeZone(); * select it on the IMAP server (saves some STATUS calls). Open R/W to clear * the RECENT flag. */ if (!($search_mbox = $injector->getInstance('IMP_Search')->isSearchMbox(IMP::$mailbox))) { - $injector->getInstance('IMP_Imap')->getOb()->openMailbox(IMP::$mailbox, Horde_Imap_Client::OPEN_READWRITE); + $injector->getInstance('IMP_Injector_Factory_Imap')->create()->openMailbox(IMP::$mailbox, Horde_Imap_Client::OPEN_READWRITE); } /* Make sure we have a valid index. */ @@ -59,7 +59,7 @@ if ($vars->actionID) { } /* Determine if mailbox is readonly. */ -$peek = $readonly = $injector->getInstance('IMP_Imap')->getOb()->isReadOnly(IMP::$mailbox); +$peek = $readonly = $injector->getInstance('IMP_Injector_Factory_Imap')->create()->isReadOnly(IMP::$mailbox); if ($readonly && in_array($vars->actionID, array('delete_message', 'undelete_message', 'move_message', 'flag_message', 'strip_attachment', 'strip_all'))) { $vars->actionID = null; @@ -219,10 +219,10 @@ try { try { /* Need to fetch flags before HEADERTEXT, because SEEN flag might be set * before we can grab it. */ - $flags_ret = $injector->getInstance('IMP_Imap')->getOb()->fetch($mailbox_name, array( + $flags_ret = $injector->getInstance('IMP_Injector_Factory_Imap')->create()->fetch($mailbox_name, array( Horde_Imap_Client::FETCH_FLAGS => true, ), array('ids' => array($uid))); - $fetch_ret = $injector->getInstance('IMP_Imap')->getOb()->fetch($mailbox_name, array( + $fetch_ret = $injector->getInstance('IMP_Injector_Factory_Imap')->create()->fetch($mailbox_name, array( Horde_Imap_Client::FETCH_ENVELOPE => true, Horde_Imap_Client::FETCH_HEADERTEXT => array(array('parse' => true, 'peek' => $peek)) ), array('ids' => array($uid))); diff --git a/imp/scripts/query-imap-cache.php b/imp/scripts/query-imap-cache.php index 32b144010..cacf1bc4c 100755 --- a/imp/scripts/query-imap-cache.php +++ b/imp/scripts/query-imap-cache.php @@ -42,7 +42,7 @@ foreach ($options[0] as $val) { } } -$imp_imap = $injector->getInstance('IMP_Imap')->getOb(); +$imp_imap = $injector->getInstance('IMP_Injector_Factory_Imap')->create(); if (is_null($server)) { /* Set first entry to 1, not 0. */ diff --git a/imp/thread.php b/imp/thread.php index 039d657c4..01b40bc64 100644 --- a/imp/thread.php +++ b/imp/thread.php @@ -27,7 +27,7 @@ $mode = $vars->mode ? $vars->mode : 'thread'; -$imp_imap = $injector->getInstance('IMP_Imap')->getOb(); +$imp_imap = $injector->getInstance('IMP_Injector_Factory_Imap')->create(); $imp_mailbox = $injector->getInstance('IMP_Mailbox_List')->getListTrack(IMP::$mailbox, new IMP_Indices(IMP::$thismailbox, IMP::$uid)); $error = false;