* @package IMP
*/
-function _getIMPContents($uid, $mailbox)
-{
- if (empty($uid)) {
- return false;
- }
- try {
- $imp_contents = IMP_Contents::singleton($uid . IMP::IDX_SEP . $mailbox);
- return $imp_contents;
- } catch (Horde_Exception $e) {
- $GLOBALS['notification']->push(_("Could not retrieve the message from the mail server."), 'horde.error');
- return false;
- }
-}
-
require_once dirname(__FILE__) . '/lib/Application.php';
new IMP_Application(array('init' => true, 'tz' => true));
/* Determine if compose mode is disabled. */
$compose_disable = !IMP::canCompose();
-/* Initialize the IMP_Compose:: object. */
+/* Initialize objects. */
$composeCache = Horde_Util::getFormData('composeCache');
$imp_compose = IMP_Compose::singleton($composeCache);
+$imp_ui = new IMP_Ui_Compose();
foreach (array_keys($display_hdrs) as $val) {
$header[$val] = Horde_Util::getFormData($val);
case _("Expand Names"):
$action = Horde_Util::getFormData('action');
- $imp_ui = new IMP_Ui_Compose();
foreach (array_keys($display_hdrs) as $val) {
if (($val == 'to') || ($action != 'rc')) {
case 'r':
case 'ra':
case 'rl':
- if (!($imp_contents = _getIMPContents($uid, $thismailbox))) {
+ if (!($imp_contents = $imp_ui->getIMPContents($uid, $thismailbox))) {
break;
}
$actions = array('r' => 'reply', 'ra' => 'reply_all', 'rl' => 'reply_list');
// 'f' = forward
case 'f':
- if (!($imp_contents = _getIMPContents($uid, $thismailbox))) {
+ if (!($imp_contents = $imp_ui->getIMPContents($uid, $thismailbox))) {
break;
}
$fwd_msg = $imp_compose->forwardMessage($imp_contents);
break;
case _("Redirect"):
- if (!($imp_contents = _getIMPContents($uid, $thismailbox))) {
+ if (!($imp_contents = $imp_ui->getIMPContents($uid, $thismailbox))) {
break;
}
- $imp_ui = new IMP_Ui_Compose();
-
$f_to = $imp_ui->getAddressList($header['to']);
try {
$uid = $imp_compose->getMetadata('uid');
if ($ctype = $imp_compose->getMetadata('reply_type')) {
- if (!($imp_contents = _getIMPContents($uid, $thismailbox))) {
+ if (!($imp_contents = $imp_ui->getIMPContents($uid, $thismailbox))) {
break;
}
$header['replyto'] = $identity->getValue('replyto_addr');
$header['subject'] = Horde_Util::getFormData('subject');
- $imp_ui = new IMP_Ui_Compose();
-
foreach ($display_hdrs as $val) {
$header[$val] = $imp_ui->getAddressList($old_header[$val]);
}
require $GLOBALS['registry']->get('templates', 'horde') . '/common-footer.inc';
}
-function _getIMPContents($uid, $mailbox)
-{
- if (empty($uid)) {
- return false;
- }
-
- try {
- $imp_contents = IMP_Contents::singleton($uid . IMP::IDX_SEP . $mailbox);
- return $imp_contents;
- } catch (Horde_Exception $e) {
- $GLOBALS['notification']->push(_("Could not retrieve the message from the mail server."), 'horde.error');
- return false;
- }
-}
-
require_once dirname(__FILE__) . '/lib/Application.php';
new IMP_Application(array('init' => array('session_control' => 'netscape'), 'tz' => true));
$title = _("New Message");
switch ($actionID) {
case 'mailto':
- if (!($imp_contents = _getIMPContents($uid, $thismailbox))) {
+ if (!($imp_contents = $imp_ui->getIMPContents($uid, $thismailbox))) {
break;
}
$imp_headers = $imp_contents->getHeaderOb();
case 'reply_all':
case 'reply_auto':
case 'reply_list':
- if (!($imp_contents = _getIMPContents($uid, $thismailbox))) {
+ if (!($imp_contents = $imp_ui->getIMPContents($uid, $thismailbox))) {
break;
}
break;
case 'forward':
- if (!($imp_contents = _getIMPContents($uid, $thismailbox))) {
+ if (!($imp_contents = $imp_ui->getIMPContents($uid, $thismailbox))) {
break;
}
break;
case 'redirect_send':
- if (!($imp_contents = _getIMPContents($uid, $thismailbox))) {
+ if (!($imp_contents = $imp_ui->getIMPContents($uid, $thismailbox))) {
break;
}
));
}
+ /**
+ * Get the IMP_Contents:: object for a Mailbox -> UID combo.
+ *
+ * @param integer $uid Message UID.
+ * @param string $mailbox Message mailbox.
+ *
+ * @return boolean|IMP_Contents The contents object, or false on error.
+ */
+ public function getIMPContents($uid, $mailbox)
+ {
+ if (!empty($uid)) {
+ try {
+ return IMP_Contents::singleton($uid . IMP::IDX_SEP . $mailbox);
+ } catch (Horde_Exception $e) {
+ $GLOBALS['notification']->push(_("Could not retrieve the message from the mail server."), 'horde.error');
+ }
+ }
+
+ return false;
+ }
+
}