$imp_compose = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Compose')->create($this->_vars->imp_compose);
if (!($imp_contents = $imp_compose->getContentsOb())) {
$imp_contents = $this->_vars->uid
- ? $GLOBALS['injector']->getInstance('IMP_Contents')->getOb(new IMP_Indices($this->_vars->uid))
+ ? $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Contents')->create(new IMP_Indices($this->_vars->uid))
: null;
}
/* Add IMP-specific binders. */
$binders = array(
'IMP_AuthImap' => new IMP_Injector_Binder_AuthImap(),
- 'IMP_Contents' => new IMP_Injector_Binder_Contents(),
'IMP_Crypt_Pgp' => new IMP_Injector_Binder_Pgp(),
'IMP_Crypt_Smime' => new IMP_Injector_Binder_Smime(),
'IMP_Identity' => new IMP_Injector_Binder_Identity(),
global $injector, $prefs;
try {
- $contents = $injector->getInstance('IMP_Contents')->getOb($indices);
+ $contents = $injector->getInstance('IMP_Injector_Factory_Contents')->create($indices);
} catch (IMP_Exception $e) {
throw new IMP_Compose_Exception($e);
}
// even though the server is the same. UIDVALIDITY should
// catch any true server/backend changes.
($imp_imap->checkUidvalidity($imap_url['mailbox']) == $imap_url['uidvalidity']) &&
- $injector->getInstance('IMP_Contents')->getOb(new IMP_Indices($imap_url['mailbox'], $imap_url['uid']))) {
+ $injector->getInstance('IMP_Injector_Factory_Contents')->create(new IMP_Indices($imap_url['mailbox'], $imap_url['uid']))) {
$this->_metadata['mailbox'] = $imap_url['mailbox'];
$this->_metadata['reply_type'] = $reply_type;
$this->_metadata['uid'] = $imap_url['uid'];
$attached = 0;
foreach ($indices as $mbox => $idx) {
++$attached;
- $contents = $GLOBALS['injector']->getInstance('IMP_Contents')->getOb(new IMP_Indices($mbox, $idx));
+ $contents = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Contents')->create(new IMP_Indices($mbox, $idx));
$headerob = $contents->getHeaderOb();
$part = new Horde_Mime_Part();
public function getContentsOb()
{
return $this->getMetadata('reply_type')
- ? $GLOBALS['injector']->getInstance('IMP_Contents')->getOb(new IMP_Indices($this->getMetadata('mailbox'), $this->getMetadata('uid')))
+ ? $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Contents')->create(new IMP_Indices($this->getMetadata('mailbox'), $this->getMetadata('uid')))
: null;
}
/* Get the list of from addresses. */
foreach ($indices as $mbox => $idx) {
- $contents = $GLOBALS['injector']->getInstance('IMP_Contents')->getOb(new IMP_Indices($mbox, $idx));
+ $contents = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Contents')->create(new IMP_Indices($mbox, $idx));
$hdr = $contents->getHeaderOb();
$addr[] = Horde_Mime_Address::bareAddress($hdr->getValue('from'));
}
+++ /dev/null
-<?php
-/**
- * Binder for IMP_Contents::.
- *
- * Copyright 2010 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (GPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
- *
- * @author Michael Slusarz <slusarz@horde.org>
- * @category Horde
- * @license http://www.fsf.org/copyleft/gpl.html GPL
- * @package IMP
- */
-class IMP_Injector_Binder_Contents implements Horde_Injector_Binder
-{
- /**
- */
- public function create(Horde_Injector $injector)
- {
- return new IMP_Injector_Factory_Contents($injector);
- }
-
- /**
- */
- public function equals(Horde_Injector_Binder $binder)
- {
- return false;
- }
-
-}
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_Contents:: instance.
*
* @param IMP_Indices $indices An indices object.
* @return IMP_Contents The singleton contents instance.
* @throws IMP_Exception
*/
- public function getOb($indices)
+ public function create($indices)
{
$key = strval($indices);
!in_array('\\seen', $v['flags'])))) {
if (empty($preview_info[$k])) {
try {
- $imp_contents = $GLOBALS['injector']->getInstance('IMP_Contents')->getOb(new IMP_Indices($mbox, $k));
+ $imp_contents = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Contents')->create(new IMP_Indices($mbox, $k));
$prev = $imp_contents->generatePreview();
$preview_info[$k] = array('IMPpreview' => $prev['text'], 'IMPpreviewc' => $prev['cut']);
if (!is_null($cache)) {
foreach ($indices as $folder => $index) {
/* Fetch the message contents. */
- $imp_contents = $GLOBALS['injector']->getInstance('IMP_Contents')->getOb(new IMP_Indices($folder, $index));
+ $imp_contents = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Contents')->create(new IMP_Indices($folder, $index));
/* Fetch the message headers. */
$imp_headers = $imp_contents->getHeaderOb();
$uidvalidity = $imp_imap->checkUidvalidity($mbox);
- $contents = $GLOBALS['injector']->getInstance('IMP_Contents')->getOb($indices);
+ $contents = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Contents')->create($indices);
$message = $contents->getMIMEMessage();
$boundary = trim($message->getContentTypeParameter('boundary'), '"');
if ($val == $number) {
$parts[$number] = $this->_mimepart->getContents();
} else {
- $ic = $GLOBALS['injector']->getInstance('IMP_Contents')->getOb(new IMP_Indices($mbox, $val));
+ $ic = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Contents')->create(new IMP_Indices($mbox, $val));
$parts[$ic->getMIMEMessage()->getContentTypeParameter('number')] = $ic->getBody();
}
}
/* Fetch the raw message contents (headers and complete
* body). */
try {
- $imp_contents = $GLOBALS['injector']->getInstance('IMP_Contents')->getOb(new IMP_Indices($mbox, $idx));
+ $imp_contents = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Contents')->create(new IMP_Indices($mbox, $idx));
} catch (IMP_Exception $e) {
continue;
}
if (!is_null($indices)) {
try {
- $ob = $GLOBALS['injector']->getInstance('IMP_Contents')->getOb($indices);
+ $ob = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Contents')->create($indices);
} catch (Horde_Exception $e) {}
}
/* Parse MIME info and create the body of the message. */
try {
- $imp_contents = $GLOBALS['injector']->getInstance('IMP_Contents')->getOb(new IMP_Indices($mailbox, $uid));
+ $imp_contents = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Contents')->create(new IMP_Indices($mailbox, $uid));
} catch (IMP_Exception $e) {
$result['error'] = $error_msg;
$result['errortype'] = 'horde.error';
/* Parse the message. */
try {
- $imp_contents = $injector->getInstance('IMP_Contents')->getOb(new IMP_Indices($imp_mailbox));
+ $imp_contents = $injector->getInstance('IMP_Injector_Factory_Contents')->create(new IMP_Indices($imp_mailbox));
} catch (IMP_Exception $e) {
IMP::generateIMPUrl('mailbox-mimp.php', $mailbox_name)->add('a', 'm')->redirect();
}
/* Parse the message. */
try {
- $imp_contents = $injector->getInstance('IMP_Contents')->getOb(new IMP_Indices($imp_mailbox));
+ $imp_contents = $injector->getInstance('IMP_Injector_Factory_Contents')->create(new IMP_Indices($imp_mailbox));
} catch (IMP_Exception $e) {
$imp_mailbox->removeMsgs(true);
_returnToMailbox(null, 'message_missing');
case 'save_attachment_public_key':
/* Retrieve the key from the message. */
- $contents = $injector->getInstance('IMP_Contents')->getOb(new IMP_Indices($vars->mailbox, $vars->uid));
+ $contents = $injector->getInstance('IMP_Injector_Factory_Contents')->create(new IMP_Indices($vars->mailbox, $vars->uid));
$mime_part = $contents->getMIMEPart($vars->mime_id);
if (empty($mime_part)) {
throw new IMP_Exception('Cannot retrieve public key from message.');
/* Run through the action handlers. */
switch ($vars->actionID) {
case 'save_image':
- $contents = $injector->getInstance('IMP_Contents')->getOb(new IMP_Indices($vars->mbox, $vars->uid));
+ $contents = $injector->getInstance('IMP_Injector_Factory_Contents')->create(new IMP_Indices($vars->mbox, $vars->uid));
$mime_part = $contents->getMIMEPart($vars->id);
$image_data = array(
'data' => $mime_part->getContents(),
case 'save_attachment_public_key':
/* Retrieve the key from the message. */
- $contents = $injector->getInstance('IMP_Contents')->getOb(new IMP_Indices($vars->mailbox, $vars->uid));
+ $contents = $injector->getInstance('IMP_Injector_Factory_Contents')->create(new IMP_Indices($vars->mailbox, $vars->uid));
$mime_part = $contents->getMIMEPart($vars->mime_id);
if (empty($mime_part)) {
throw new IMP_Exception('Cannot retrieve public key from message.');
/* Get the body of the message. */
$curr_msg = $curr_tree = array();
- $contents = $injector->getInstance('IMP_Contents')->getOb(new IMP_Indices($mbox, $idx));
+ $contents = $injector->getInstance('IMP_Injector_Factory_Contents')->create(new IMP_Indices($mbox, $idx));
$mime_id = $contents->findBody();
if ($contents->canDisplay($mime_id, IMP_Contents::RENDER_INLINE)) {
$ret = $contents->renderMIMEPart($mime_id, IMP_Contents::RENDER_INLINE);
if (!$vars->uid || !$vars->mailbox) {
exit;
}
- $contents = $injector->getInstance('IMP_Contents')->getOb(new IMP_Indices($vars->mailbox, $vars->uid));
+ $contents = $injector->getInstance('IMP_Injector_Factory_Contents')->create(new IMP_Indices($vars->mailbox, $vars->uid));
}
/* Run through action handlers */