try {
$imp_contents = IMP_Contents::singleton($idx_string);
$imp_compose = IMP_Compose::singleton(Horde_Util::getPost('imp_compose'));
- $imp_ui = new IMP_UI_Compose();
+ $imp_ui = new IMP_Ui_Compose();
$fwd_msg = $imp_ui->getForwardData($imp_compose, $imp_contents, $idx_string);
$header = $fwd_msg['headers'];
$header['replytype'] = 'forward';
break;
}
- $imp_ui = new IMP_UI_Message();
+ $imp_ui = new IMP_Ui_Message();
$imp_ui->MDNCheck($mbox, $uid, $reset($fetch_ret[$uid]['headertext']), true);
break;
/* Initialize the IMP_Compose:: object. */
$imp_compose = IMP_Compose::singleton(Horde_Util::getFormData('composeCache'));
-/* Init IMP_UI_Compose:: object. */
-$imp_ui = new IMP_UI_Compose();
+/* Init IMP_Ui_Compose:: object. */
+$imp_ui = new IMP_Ui_Compose();
if (count($_POST)) {
$result = new stdClass;
case _("Expand Names"):
$action = Horde_Util::getFormData('action');
- $imp_ui = new IMP_UI_Compose();
+ $imp_ui = new IMP_Ui_Compose();
$header['to'] = $imp_ui->expandAddresses(Horde_Util::getFormData('to'), $imp_compose);
if ($action !== 'rc') {
if ($prefs->getValue('compose_cc')) {
break;
}
- $imp_ui = new IMP_UI_Compose();
+ $imp_ui = new IMP_Ui_Compose();
$f_to = $imp_ui->getAddressList(Horde_Util::getFormData('to'));
$header['replyto'] = $identity->getValue('replyto_addr');
$header['subject'] = Horde_Util::getFormData('subject');
- $imp_ui = new IMP_UI_Compose();
+ $imp_ui = new IMP_Ui_Compose();
$header['to'] = $imp_ui->getAddressList(Horde_Util::getFormData('to'));
if ($prefs->getValue('compose_cc')) {
$notification->push($e);
}
-/* Init IMP_UI_Compose:: object. */
-$imp_ui = new IMP_UI_Compose();
+/* Init IMP_Ui_Compose:: object. */
+$imp_ui = new IMP_Ui_Compose();
/* Set the default charset & encoding.
* $charset - charset to use when sending messages
}
/* Get the tree images. */
-$imp_ui_folder = new IMP_UI_Folder();
+$imp_ui_folder = new IMP_Ui_Folder();
$tree_imgs = $imp_ui_folder->getTreeImages($raw_rows, array('expand_url' => $folders_url));
/* Add some further information to the $raw_rows array. */
}
/* Is the HTML editor available? */
- $imp_ui = new IMP_UI_Compose();
+ $imp_ui = new IMP_Ui_Compose();
$editor = Horde_Editor::singleton('Ckeditor', array('no_notify' => true));
$sess['rteavail'] = $editor->supportedByBrowser();
$html .= '<tr><td><em>' . _("No unread messages") . '</em></td></tr>';
} else {
$charset = Horde_Nls::getCharset();
- $imp_ui = new IMP_UI_Mailbox('INBOX');
+ $imp_ui = new IMP_Ui_Mailbox('INBOX');
$shown = empty($this->_params['msgs_shown']) ? 3 : $this->_params['msgs_shown'];
try {
}
if (in_array($type, array('reply_auto', 'reply_list', '*'))) {
- $imp_ui = new IMP_UI_Message();
+ $imp_ui = new IMP_Ui_Message();
$list_info = $imp_ui->getListInformation($h);
if ($list_info['exists']) {
$header['to'] = $list_info['reply_list'];
return;
}
- $imp_ui = new IMP_UI_Compose();
+ $imp_ui = new IMP_Ui_Compose();
$headers = array();
foreach (array('to', 'cc', 'bcc', 'subject') as $val) {
}
if (!empty($options['priority'])) {
- $imp_msg_ui = new IMP_UI_Message();
+ $imp_msg_ui = new IMP_Ui_Message();
switch ($imp_msg_ui->getXpriority($options['priority'])) {
case 'high':
$process['highpri'] = $f['highpri'];
}
if (!empty($options['atc'])) {
- $imp_mbox_ui = new IMP_UI_Mailbox();
+ $imp_mbox_ui = new IMP_Ui_Mailbox();
if ($type = $imp_mbox_ui->getAttachmentType($options['atc']->getType())) {
$process[$type] = $f[$type];
}
return;
}
- $imp_ui_search = new IMP_UI_Search();
+ $imp_ui_search = new IMP_Ui_Search();
foreach ($vfolders as $id => $vfolder) {
/* If this is already a stdClass object, we have already
(($show == 'thread') && (basename(Horde::selfUrl()) == 'thread.php'));
if (!$hideBlocks && in_array($show, array('list', 'listthread'))) {
$header = $this->_params['contents']->getHeaderOb();
- $imp_ui = new IMP_UI_Message();
+ $imp_ui = new IMP_Ui_Message();
$list_info = $imp_ui->getListInformation($header);
$hideBlocks = $list_info['exists'];
}
+++ /dev/null
-<?php
-/**
- * The IMP_UI_Compose:: class is designed to provide a place to store common
- * code shared among IMP's various UI views for the compose page.
- *
- * Copyright 2006-2009 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>
- * @package IMP
- */
-class IMP_UI_Compose
-{
- /**
- */
- public function expandAddresses($input, $imp_compose)
- {
- $addr_list = $this->getAddressList($input);
- if (empty($addr_list)) {
- return '';
- }
-
- $res = $imp_compose->expandAddresses($addr_list);
-
- if (is_array($res)) {
- $GLOBALS['notification']->push(_("Please resolve ambiguous or invalid addresses."), 'horde.warning');
- }
-
- return $res;
- }
-
- /**
- * $encoding = DEPRECATED
- *
- * @throws Horde_Exception
- */
- public function redirectMessage($to, $imp_compose, $contents, $encoding)
- {
- try {
- $recip = $imp_compose->recipientList(array('to' => $to));
- } catch (IMP_Compose_Exception $e) {
- throw new Horde_Exception($recip);
- }
- $recipients = implode(', ', $recip['list']);
-
- $identity = Horde_Preffs_Identity::singleton(array('imp', 'imp'));
- $from_addr = $identity->getFromAddress();
-
- $headers = $contents->getHeaderOb();
- $headers->addResentHeaders($from_addr, $recip['header']['to']);
-
- $mime_message = $contents->getMIMEMessage();
- $charset = $mime_message->getCharset();
- if (is_null($charset)) {
- $charset = $encoding;
- }
-
- /* We need to set the Return-Path header to the current user - see
- RFC 2821 [4.4]. */
- $headers->removeHeader('return-path');
- $headers->addHeader('Return-Path', $from_addr);
-
- /* Store history information. */
- if (!empty($GLOBALS['conf']['maillog']['use_maillog'])) {
- IMP_Maillog::log('redirect', $headers->getValue('message-id'), $recipients);
- }
-
- try {
- $imp_compose->sendMessage($recipients, $headers, $mime_message, $charset);
- } catch (IMP_Compose_Exception $e) {
- throw new Horde_Exception($e);
- }
-
- $entry = sprintf("%s Redirected message sent to %s from %s",
- $_SERVER['REMOTE_ADDR'], $recipients, Horde_Auth::getAuth());
- Horde::logMessage($entry, __FILE__, __LINE__, PEAR_LOG_INFO);
-
- if ($GLOBALS['conf']['sentmail']['driver'] != 'none') {
- $sentmail = IMP_Sentmail::factory();
- $sentmail->log('redirect', $headers->getValue('message-id'), $recipients);
- }
- }
-
- /**
- */
- public function getForwardData(&$imp_compose, &$imp_contents, $index)
- {
- $fwd_msg = $imp_compose->forwardMessage($imp_contents);
- $subject_header = $imp_compose->attachIMAPMessage(array($index), $fwd_msg['headers']);
- if ($subject_header !== false) {
- $fwd_msg['headers']['subject'] = $subject_header;
- }
-
- return $fwd_msg;
- }
-
- /**
- */
- public function attachAutoCompleter($fields)
- {
- /* Attach autocompleters to the compose form elements. */
- foreach ($fields as $val) {
- $imple = Horde_Ajax_Imple::factory(array('imp', 'ContactAutoCompleter'), array('triggerId' => $val));
- $imple->attach();
- }
- }
-
- /**
- */
- public function attachSpellChecker($mode, $add_br = false)
- {
- $menu_view = $GLOBALS['prefs']->getValue('menu_view');
- $show_text = ($menu_view == 'text' || $menu_view == 'both');
- $br = ($add_br) ? '<br />' : '';
- $spell_img = Horde::img('spellcheck.png');
- $args = array(
- 'id' => ($mode == 'dimp' ? 'DIMP.' : 'IMP.') . 'SpellCheckerObject',
- 'targetId' => 'composeMessage',
- 'triggerId' => 'spellcheck',
- 'states' => array(
- 'CheckSpelling' => $spell_img . ($show_text ? $br . _("Check Spelling") : ''),
- 'Checking' => $spell_img . $br . _("Checking ..."),
- 'ResumeEdit' => $spell_img . $br . _("Resume Editing"),
- 'Error' => $spell_img . $br . _("Spell Check Failed")
- )
- );
-
- $imple = Horde_Ajax_Imple::factory('SpellChecker', $args);
- $imple->attach();
- }
-
- /**
- */
- public function getAddressList($to, $to_list = array(), $to_field = array(),
- $to_new = '', $expand = false)
- {
- $to = rtrim(trim($to), ',');
- if (!empty($to)) {
- // Although we allow ';' to delimit addresses in the UI, need to
- // convert to RFC-compliant ',' delimiter for processing.
- $clean_to = '';
- foreach (Horde_Mime_Address::explode($to, ',;') as $val) {
- $val = trim($val);
- $clean_to .= $val . (($val[Horde_String::length($val) - 1] == ';') ? ' ' : ', ');
- }
- if ($expand) {
- return $clean_to;
- } else {
- return IMP_Compose::formatAddr($clean_to);
- }
- }
-
- $tmp = array();
- if (is_array($to_field)) {
- foreach ($to_field as $key => $address) {
- $tmp[$key] = $address;
- }
- }
- if (is_array($to_list)) {
- foreach ($to_list as $key => $address) {
- if ($address != '') {
- $tmp[$key] = $address;
- }
- }
- }
-
- $to_new = rtrim(trim($to_new), ',');
- if (!empty($to_new)) {
- $tmp[] = $to_new;
- }
- return implode(', ', $tmp);
- }
-
- /**
- * Initialize the Rich Text Editor (RTE).
- *
- * @param boolean $mini Load the basic ckeditor stub?
- */
- public function initRTE($basic = false)
- {
- $editor = Horde_Editor::singleton('Ckeditor', array('basic' => $basic));
-
- $config = array(
- /* To more closely match "normal" textarea behavior, send <BR> on
- * enter instead of <P>. */
- // CKEDITOR.ENTER_BR
- 'enterMode: 2',
- // CKEDITOR.ENTER_P
- 'shiftEnterMode: 1',
-
- /* Don't load the config.js file. */
- 'customConfig: ""',
-
- /* Disable resize of the textarea. */
- 'resize_enabled: false',
-
- /* Use the old skin for now. */
- 'skin: "v2"'
- );
-
- $buttons = $GLOBALS['prefs']->getValue('ckeditor_buttons');
- if (!empty($buttons)) {
- $config[] = 'toolbar: ' . $GLOBALS['prefs']->getValue('ckeditor_buttons');
- }
-
- Horde::addInlineScript(array(
- 'if (!window.IMP) { window.IMP = {}; }',
- 'IMP.ckeditor_config = {' . implode(',', $config) . '}'
- ));
- }
-
-}
+++ /dev/null
-<?php
-/**
- * The IMP_UI_Folder:: class is designed to provide a place to store common
- * code shared among IMP's various UI views for folders.
- *
- * Copyright 2009 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>
- * @package IMP
- */
-class IMP_UI_Folder
-{
- /**
- * Temporary array used to determine tree levels.
- *
- * @var array
- */
- var $_moreMbox = array();
-
- /**
- * Create the tree images for a list of folder elements.
- *
- * @var array $rows Folder rows returned from IMP_Imap_Tree::build().
- * @var array $options Additional options:
- * <pre>
- * 'expand_url' - (string) The URL to use for expand/collapse links.
- * </pre>
- *
- * @return array An array of tree image strings.
- */
- public function getTreeImages($rows, $options = array())
- {
- $this->_moreMbox = array();
- $out = array();
-
- reset($rows);
- while (list($key, $elt) = each($rows)) {
- $out[$key] = $this->_getTreeImage($elt, $options);
- }
-
- return $out;
- }
-
- /**
- * Create a tree image from a folder element entry.
- *
- * @var array $elt An entry returned from IMP_Imap_Tree::element().
- * @var array $options See self::getTreeImages().
- *
- * @return string The image string.
- */
- protected function _getTreeImage($elt, $options = array())
- {
- $alt = $dir = null;
- $dir2 = $elt['user_icon']
- ? Horde::img($elt['icon'], $elt['alt'], null, $elt['icondir'])
- : '<span class="foldersImg ' . $elt['class'] . '"></span>';
- $imaptree = IMP_Imap_Tree::singleton();
-
- if ($elt['children'] && isset($options['expand_url'])) {
- $dir = Horde_Util::addParameter($options['expand_url'], 'folder', $elt['value']);
-
- if ($imaptree->isOpen($elt['base_elt'])) {
- if (!is_null($dir)) {
- $dir = Horde_Util::addParameter($dir, 'actionID', 'collapse_folder');
- $alt = _("Collapse Folder");
- }
-
- if (empty($GLOBALS['nls']['rtl'][$GLOBALS['language']])) {
- $tree_img = ($elt['value'] == 'INBOX')
- ? 9
- : ($elt['peek'] ? 10 : 11);
- } else {
- $tree_img = ($elt['value'] == 'INBOX')
- ? 12
- : ($elt['peek'] ? 13 : 14);
- }
- } else {
- if (!is_null($dir)) {
- $dir = Horde_Util::addParameter($dir, 'actionID', 'expand_folder');
- $alt = _("Expand Folder");
- }
-
- if (empty($GLOBALS['nls']['rtl'][$GLOBALS['language']])) {
- $tree_img = ($elt['value'] == 'INBOX')
- ? 15
- : ($elt['peek'] ? 16 : 17);
- } else {
- $tree_img = ($elt['value'] == 'INBOX')
- ? 18
- : ($elt['peek'] ? 19 : 20);
- }
- }
-
- if (!is_null($dir)) {
- $dir = Horde::link($dir, $alt) . '<span class="treeImg treeImg' . $tree_img . '"></span></a>' . $dir2;
- }
- } else {
- if (($elt['value'] == 'INBOX') && !$elt['peek']) {
- $dir = '<span class="treeImg"></span>' . $dir2;
- } else {
- if (empty($GLOBALS['nls']['rtl'][$GLOBALS['language']])) {
- $tree_img = ($elt['value'] == 'INBOX')
- ? 3
- : ($elt['peek'] ? 2 : 4);
- } else {
- $tree_img = ($elt['value'] == 'INBOX')
- ? 7
- : ($elt['peek'] ? 6 : 8);
- }
- $dir = '<span class="treeImg treeImg' . $tree_img . '"></span>' . $dir2;
- }
- }
-
- $line = '';
- $this->_moreMbox[$elt['level']] = $elt['peek'];
- for ($i = 0; $i < $elt['level']; $i++) {
- if ($this->_moreMbox[$i]) {
- $line .= '<span class="treeImg treeImg' . (empty($GLOBALS['nls']['rtl'][$GLOBALS['language']]) ? 1 : 5) . '"></span>';
- } else {
- $line .= '<span class="treeImg"></span>';
- }
- }
-
- return $line . $dir;
- }
-
-}
+++ /dev/null
-<?php
-/**
- * The IMP_UI_Mailbox:: class is designed to provide a place to store common
- * code shared among IMP's various UI views for the mailbox page.
- *
- * Copyright 2006-2009 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>
- * @package IMP
- */
-class IMP_UI_Mailbox
-{
- /**
- * The current mailbox.
- *
- * @var string
- */
- private $_mailbox;
-
- /**
- * Cached data.
- *
- * @var array
- */
- private $_cache = array();
-
- /**
- * Constructor.
- *
- * @param string $mailbox The current mailbox.
- */
- public function __construct($mailbox = null)
- {
- $this->_mailbox = $mailbox;
- }
-
- /**
- * Get From address information for display on mailbox page.
- *
- * @param array $ob An array of envelope information.
- * @param array $options Additional options:
- * <pre>
- * 'fullfrom' - (boolean) If true, returns 'fullfrom' information.
- * DEFAULT: false
- * 'specialchars' - (string) If set, run 'from' return through
- * htmlspecialchars() using the given charset.
- * </pre>
- *
- * @return array An array of information:
- * <pre>
- * 'error' - (boolean)
- * 'from' - (string)
- * 'fullfrom' - (string)
- * 'to' - (boolean)
- * </pre>
- */
- public function getFrom($ob, $options = array())
- {
- $ret = array('error' => false, 'to' => false);
-
- if (empty($ob['from'])) {
- $ret['from'] = $ret['fullfrom'] = _("Invalid Address");
- $ret['error'] = true;
- return $ret;
- }
-
- if (!isset($this->_cache['drafts_sm_folder'])) {
- $this->_cache['drafts_sm_folder'] = IMP::isSpecialFolder($this->_mailbox);
- }
-
- $from = Horde_Mime_Address::getAddressesFromObject($ob['from']);
- $from = reset($from);
-
- if (empty($from)) {
- $ret['from'] = _("Invalid Address");
- $ret['error'] = true;
- } else {
- $identity = Horde_Prefs_Identity::singleton(array('imp', 'imp'));
- if ($identity->hasAddress($from['inner'])) {
- /* This message was sent by one of the user's identity
- * addresses - show To: information instead. */
- if (empty($ob['to'])) {
- $ret['from'] = _("Undisclosed Recipients");
- $ret['error'] = true;
- } else {
- $to = Horde_Mime_Address::getAddressesFromObject($ob['to']);
- $first_to = reset($to);
- if (empty($first_to)) {
- $ret['from'] = _("Undisclosed Recipients");
- $ret['error'] = true;
- } else {
- $ret['from'] = empty($first_to['personal'])
- ? $first_to['inner']
- : $first_to['personal'];
- if (!empty($options['fullfrom'])) {
- $ret['fullfrom'] = $first_to['display'];
- }
- }
- }
- if (!$this->_cache['drafts_sm_folder']) {
- $ret['from'] = _("To") . ': ' . $ret['from'];
- }
- $ret['to'] = true;
- } else {
- $ret['from'] = empty($from['personal'])
- ? $from['inner']
- : $from['personal'];
- if ($this->_cache['drafts_sm_folder']) {
- $ret['from'] = _("From") . ': ' . $ret['from'];
- }
- if (!empty($options['fullfrom'])) {
- $ret['fullfrom'] = $from['display'];
- }
- }
- }
-
- if (!empty($options['fullfrom']) && !isset($ret['fullfrom'])) {
- $ret['fullfrom'] = $ret['from'];
- }
-
- if (!empty($ret['from']) && !empty($options['specialchars'])) {
- $old_error = error_reporting(0);
- $res = htmlspecialchars($ret['from'], ENT_QUOTES, $options['specialchars']);
- if (empty($res)) {
- $res = htmlspecialchars($ret['from']);
- }
- $ret['from'] = $res;
- error_reporting($old_error);
- }
-
- return $ret;
- }
-
- /**
- * Get size display information.
- *
- * @param integer $size The size of the message, in bytes.
- *
- * @return string A formatted size string.
- */
- public function getSize($size)
- {
- if ($size < 1024) {
- return $size;
- }
-
- if (!isset($this->_cache['localeinfo'])) {
- $this->_cache['localeinfo'] = Horde_Nls::getLocaleInfo();
- }
-
- $size = $size / 1024;
-
- return ($size > 1024)
- ? sprintf(_("%s MB"), number_format($size / 1024, 1, $this->_cache['localeinfo']['decimal_point'], $this->_cache['localeinfo']['thousands_sep']))
- : sprintf(_("%s KB"), number_format($size, 0, $this->_cache['localeinfo']['decimal_point'], $this->_cache['localeinfo']['thousands_sep']));
- }
-
- /**
- * Return the icon to use for a given attachment.
- *
- * @return string The mailbox display icon type (attach, encrypt,
- * signed).
- */
- public function getAttachmentType($type)
- {
- list($primary, $sub) = explode('/', $type, 2);
- if ($primary == 'multipart') {
- switch ($sub) {
- case 'signed':
- return 'signed';
-
- case 'encrypted':
- return 'encrypt';
-
- case 'alternative':
- case 'related':
- /* Treat this as no attachments. */
- break;
-
- default:
- return 'attach';
- }
- } elseif ($type == 'application/pkcs7-mime') {
- return 'encrypt';
- }
-
- return '';
- }
-
- /**
- * Formats the date header.
- *
- * @param integer $date The UNIX timestamp.
- *
- * @return string The formatted date header.
- */
- public function getDate($date)
- {
- if (!isset($this->_cache['today_start'])) {
- $this->_cache['today_start'] = strtotime('today');
- $this->_cache['today_end'] = strtotime('today + 1 day');
- }
-
- try {
- $d = new DateTime($date);
- } catch (Exception $e) {
- /* Bug #5717 - Check for UT vs. UTC. */
- if (substr(rtrim($date), -3) != ' UT') {
- return _("Unknown Date");
- }
- try {
- $d = new DateTime($date . 'C');
- } catch (Exception $e) {
- return _("Unknown Date");
- }
- }
- $udate = $d->format('U');
-
- if (($udate < $this->_cache['today_start']) ||
- ($udate > $this->_cache['today_end'])) {
- /* Not today, use the date. */
- return strftime($GLOBALS['prefs']->getValue('date_format'), $udate);
- }
-
- /* Else, it's today, use the time. */
- return strftime($GLOBALS['prefs']->getValue('time_format'), $udate);
- }
-
- /**
- * Formats the subject header.
- *
- * @param string $subject The MIME encoded subject header.
- * @param string $htmlspaces HTML-ize spaces?
- *
- * @return string The formatted subject header.
- */
- public function getSubject($subject, $htmlspaces = false)
- {
- $subject = Horde_Mime::decode($subject);
- if (empty($subject)) {
- return _("[No Subject]");
- }
-
- $new_subject = $subject = IMP::filterText(preg_replace("/\s+/", ' ', $subject));
-
- if ($htmlspaces) {
- $new_subject = Horde_Text_Filter::filter($subject, 'space2html', array('charset' => Horde_Nls::getCharset(), 'encode' => true));
- if (empty($new_subject)) {
- $new_subject = htmlspecialchars($subject);
- }
- }
-
- return empty($new_subject) ? $subject : $new_subject;
- }
-
-}
+++ /dev/null
-<?php
-/**
- * The IMP_UI_Message:: class is designed to provide a place to store common
- * code shared among IMP's various UI views for the message page.
- *
- * Copyright 2006-2009 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>
- * @package IMP
- */
-class IMP_UI_Message
-{
- /**
- * Return a list of "basic" headers w/gettext translations.
- *
- * @return array Header name -> gettext translation mapping.
- */
- public function basicHeaders()
- {
- return array(
- 'date' => _("Date"),
- 'from' => _("From"),
- 'to' => _("To"),
- 'cc' => _("Cc"),
- 'bcc' => _("Bcc"),
- 'reply-to' => _("Reply-To"),
- 'subject' => _("Subject")
- );
- }
-
- /**
- * Get the list of user-defined headers to display.
- *
- * @return array The list of user-defined headers.
- */
- public function getUserHeaders()
- {
- $user_hdrs = $GLOBALS['prefs']->getValue('mail_hdr');
-
- /* Split the list of headers by new lines and sort the list of headers
- * to make sure there are no duplicates. */
- if (is_array($user_hdrs)) {
- $user_hdrs = implode("\n", $user_hdrs);
- }
- $user_hdrs = trim($user_hdrs);
- if (empty($user_hdrs)) {
- return array();
- }
-
- $user_hdrs = array_filter(array_keys(array_flip(array_map('trim', preg_split("/[\n\r]+/", str_replace(':', '', $user_hdrs))))));
- natcasesort($user_hdrs);
-
- return $user_hdrs;
- }
-
- /**
- * Check if we need to send a MDN, and send if needed.
- *
- * @param string $mailbox The mailbox of the message.
- * @param integer $uid The UID of the message.
- * @param array $headers The headers of the message.
- * @param boolean $confirmed Has the MDN request been confirmed?
- *
- * @return boolean True if the MDN request needs to be confirmed.
- */
- public function MDNCheck($mailbox, $uid, $headers, $confirmed = false)
- {
- if (!$GLOBALS['prefs']->getValue('disposition_send_mdn') ||
- $GLOBALS['imp_imap']->isReadOnly($mailbox)) {
- return false;
- }
-
- /* Check to see if an MDN has been requested. */
- $mdn = new Horde_Mime_Mdn($headers);
- $return_addr = $mdn->getMDNReturnAddr();
- if (!$return_addr) {
- return false;
- }
-
- $msg_id = $headers->getValue('message-id');
- $mdn_flag = $mdn_sent = false;
-
- /* 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);
- if (in_array('\\*', $status['permflags']) ||
- in_array('$mdnsent', $status['permflags'])) {
- $mdn_flag = true;
- $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']);
- }
- } catch (Horde_Imap_Client_Exception $e) {}
-
- if (!$mdn_flag) {
- /* 2nd test: Use Maillog as a fallback. */
- $mdn_sent = IMP_Maillog::sentMDN($msg_id, 'displayed');
- }
-
- if ($mdn_sent) {
- return false;
- }
-
- /* See if we need to query the user. */
- if ($mdn->userConfirmationNeeded() && !$confirmed) {
- return true;
- }
-
- /* Send out the MDN now. */
- try {
- $mail_driver = IMP_Compose::getMailDriver();
- $mdn->generate(false, $confirmed, 'displayed', $mail_driver['driver'], $mail_driver['params']);
- IMP_Maillog::log('mdn', $msg_id, 'displayed');
- $success = true;
-
- if ($mdn_flag) {
- $imp_message = IMP_Message::singleton();
- $imp_message->flag(array('$MDNSent'), $uid . IMP::IDX_SEP . $mailbox, true);
- }
- } catch (Horde_Mime_Exception $e) {
- $success = false;
- }
-
- if ($GLOBALS['conf']['sentmail']['driver'] != 'none') {
- $sentmail = IMP_Sentmail::factory();
- $sentmail->log('mdn', '', $return_addr, $success);
- }
-
- return false;
- }
-
- /**
- * Adds the local time string to the date header.
- *
- * @param string $date The date string.
- *
- * @return string The local formatted time string.
- */
- public function getLocalTime($date)
- {
- if (empty($date)) {
- $ltime = false;
- } else {
- $date = preg_replace('/\s+\(\w+\)$/', '', $date);
- $ltime = strtotime($date);
- }
-
- if (($ltime === false) || ($ltime === -1)) {
- return '';
- }
-
- $time_str = strftime($GLOBALS['prefs']->getValue('time_format'), $ltime);
- $tz = strftime('%Z');
-
- if ((date('Y') != @date('Y', $ltime)) ||
- (date('M') != @date('M', $ltime)) ||
- (date('d') != @date('d', $ltime))) {
- /* Not today, use the date. */
- $date_str = strftime($GLOBALS['prefs']->getValue('date_format'), $ltime);
- return sprintf('%s %s %s', $date_str, $time_str, $tz);
- }
-
- /* Else, it's today, use the time only. */
- return sprintf(_("Today, %s %s"), $time_str, $tz);
- }
-
- /**
- * Parses all of the available mailing list headers.
- *
- * @param Horde_Mime_Headers $headers A Horde_Mime_Headers object.
- *
- * @return array TODO
- */
- public function parseAllListHeaders($headers)
- {
- $ret = array();
-
- foreach (array_keys($headers->listHeaders()) as $val) {
- if (($data = $headers->getValue($val))) {
- $ret[$val] = $this->parseListHeaders($data);
- }
- }
-
- return $ret;
- }
-
- /**
- * Parse the information in mailing list headers.
- *
- * @param string $data The header text to process.
- * @param array $opts Additional options:
- * <pre>
- * 'email' - (boolean) Only return e-mail values.
- * DEFAULT: false
- * 'raw' - (boolean) Should the raw URL be returned instead of linking
- * the header value?
- * DEFAULT: false
- * </pre>
- *
- * @return string The header value.
- */
- public function parseListHeaders($data, $opts = array())
- {
- $output = '';
-
- /* Split the incoming data by the ',' character. */
- foreach (preg_split("/,/", $data) as $entry) {
- /* Get the data inside of the brackets. If there is no brackets,
- * then return the raw text. */
- if (!preg_match("/\<([^\>]+)\>/", $entry, $matches)) {
- return trim($entry);
- }
-
- /* Remove all whitespace from between brackets (RFC 2369 [2]). */
- $match = preg_replace("/\s+/", '', $matches[1]);
-
- /* Determine if there are any comments. */
- preg_match("/(\(.+\))/", $entry, $comments);
-
- /* RFC 2369 [2] states that we should only show the *FIRST* URL
- * that appears in a header that we can adequately handle. */
- if (stristr($match, 'mailto:') !== false) {
- $match = substr($match, strpos($match, ':') + 1);
- if (!empty($opts['raw'])) {
- return $match;
- }
- $output = Horde::link(IMP::composeLink($match)) . $match . '</a>';
- if (!empty($comments[1])) {
- $output .= ' ' . $comments[1];
- }
- break;
- } elseif (empty($data['email'])) {
- if ($url = Horde_Text_Filter::filter($match, 'linkurls', array('callback' => 'Horde::externalUrl'))) {
- if (!empty($opts['raw'])) {
- return $match;
- }
- $output = $url;
- if (!empty($comments[1])) {
- $output .= ' ' . $comments[1];
- }
- break;
- } else {
- /* Use this entry unless we can find a better one. */
- $output = $match;
- }
- }
- }
-
- return $output;
- }
-
- /**
- * Determines the X-Priority of the message based on the headers.
- *
- * @param string $header The X-Priority header.
- *
- * @return string 'high', 'low', or 'normal'.
- */
- public function getXpriority($header)
- {
- if ($header && preg_match('/\s*(\d+)\s*/', $header, $matches)) {
- if (in_array($matches[1], array(1, 2))) {
- return 'high';
- } elseif (in_array($matches[1], array(4, 5))) {
- return 'low';
- }
- }
-
- return 'normal';
- }
-
- /**
- * Returns e-mail information for a mailing list.
- *
- * @param Horde_Mime_Headers $headers A Horde_Mime_Headers object.
- *
- * @return array An array with 2 elements: 'exists' and 'reply_list'.
- */
- public function getListInformation($headers)
- {
- $ret = array('exists' => false, 'reply_list' => null);
-
- if ($headers->listHeadersExist()) {
- $ret['exists'] = true;
-
- /* See if the List-Post header provides an e-mail address for the
- * list. */
- if (($val = $headers->getValue('list-post')) &&
- ($val != 'NO')) {
- $ret['reply_list'] = $this->parseListHeaders($val, array('email' => true, 'raw' => true));
- }
- }
-
- return $ret;
- }
-
- /**
- * Builds a string containing a list of addresses.
- *
- * @param array $addrlist The list of addresses from
- * Horde_Mime_Address::parseAddressList().
- * @param integer $addURL The self URL.
- * @param boolean $link Link each address to the compose screen?
- *
- * @return string String containing the formatted address list.
- */
- public function buildAddressLinks($addrlist, $addURL = null, $link = true)
- {
- global $prefs, $registry;
-
- /* Make sure this is a valid object address field. */
- if (empty($addrlist) || !is_array($addrlist)) {
- return null;
- }
-
- $add_link = null;
- $addr_array = array();
- $mimp_view = ($_SESSION['imp']['view'] == 'mimp');
-
- /* Set up the add address icon link if contact manager is
- * available. */
- if (!is_null($addURL) && $link && $prefs->getValue('add_source')) {
- try {
- $add_link = $registry->hasMethod('contacts/import')
- ? Horde_Util::addParameter($addURL, 'actionID', 'add_address')
- : null;
- } catch (Horde_Exception $e) {}
- }
-
- foreach (Horde_Mime_Address::getAddressesFromObject($addrlist) as $ob) {
- if (isset($ob['groupname'])) {
- $group_array = array();
- foreach ($ob['addresses'] as $ad) {
- if (empty($ad['address']) || empty($ad['inner'])) {
- continue;
- }
-
- $ret = $mimp_view
- ? $ad['display']
- : htmlspecialchars($ad['display']);
-
- if ($link) {
- $ret = Horde::link(IMP::composeLink(array('to' => $ad['address'])), sprintf(_("New Message to %s"), $ad['inner'])) . htmlspecialchars($ad['display']) . '</a>';
- }
-
- /* Append the add address icon to every address if contact
- * manager is available. */
- if ($add_link) {
- $curr_link = Horde_Util::addParameter($add_link, array('name' => $ad['personal'], 'address' => $ad['inner']));
- $ret .= Horde::link($curr_link, sprintf(_("Add %s to my Address Book"), $ad['inner'])) .
- Horde::img('addressbook_add.png', sprintf(_("Add %s to my Address Book"), $ad['inner'])) . '</a>';
- }
-
- $group_array[] = $ret;
- }
-
- if (!$mimp_view) {
- $ob['groupname'] = htmlspecialchars($ob['groupname']);
- }
-
- $addr_array[] = $ob['groupname'] . ':' . (count($group_array) ? ' ' . implode(', ', $group_array) : '');
- } elseif (!empty($ob['address']) && !empty($ob['inner'])) {
- $ret = $mimp_view
- ? $ob['display']
- : htmlspecialchars($ob['display']);
-
- /* If this is an incomplete e-mail address, don't link to
- * anything. */
- if (stristr($ob['host'], 'UNKNOWN') === false) {
- if ($link) {
- $ret = Horde::link(IMP::composeLink(array('to' => $ob['address'])), sprintf(_("New Message to %s"), $ob['inner'])) . htmlspecialchars($ob['display']) . '</a>';
- }
-
- /* Append the add address icon to every address if contact
- * manager is available. */
- if ($add_link) {
- $curr_link = Horde_Util::addParameter($add_link, array('name' => $ob['personal'], 'address' => $ob['inner']));
- $ret .= Horde::link($curr_link, sprintf(_("Add %s to my Address Book"), $ob['inner'])) .
- Horde::img('addressbook_add.png', sprintf(_("Add %s to my Address Book"), $ob['inner'])) . '</a>';
- }
- }
-
- $addr_array[] = $ret;
- }
- }
-
- if ($_SESSION['imp']['view'] == 'mimp') {
- return implode(', ', $addr_array);
- }
-
- /* If left with an empty address list ($ret), inform the user that the
- * recipient list is purposely "undisclosed". */
- if (empty($addr_array)) {
- $ret = _("Undisclosed Recipients");
- } else {
- /* Build the address line. */
- $addr_count = count($addr_array);
- $ret = '<span class="nowrap">' . implode(',</span> <span class="nowrap">', $addr_array) . '</span>';
- if ($link && $addr_count > 15) {
- $ret = '<span>' .
- '<span onclick="[ this, this.next(), this.next(1) ].invoke(\'toggle\')" class="widget largeaddrlist">' . sprintf(_("[Show Addresses - %d recipients]"), $addr_count) . '</span>' .
- '<span onclick="[ this, this.previous(), this.next() ].invoke(\'toggle\')" class="widget largeaddrlist" style="display:none">' . _("[Hide Addresses]") . '</span>' .
- '<span style="display:none">' .
- $ret . '</span></span>';
- }
- }
-
- return $ret;
- }
-
- /**
- * Prints out a MIME summary (in HTML).
- *
- * @param array $summary Summary information from
- * IMP_Summary::getSummary().
- * @param array $display The fields to display (in this order).
- * @param boolean $atc Is this an attachment?
- *
- * @return string The formatted summary string.
- */
- public function formatSummary($summary, $display, $atc = false)
- {
- $tmp_summary = array();
- foreach ($display as $val) {
- $tmp_summary[] = $summary[$val];
- }
- return '<div class="mimePartInfo' . ($atc ? ' mimePartInfoAtc' : '') . '"><div>' . implode(' ', $tmp_summary) . '</div></div>';
- }
-
- /**
- * Prints out a MIME status message (in HTML).
- *
- * @param array $data An array of information (as returned from
- Horde_Mime_Viewer::render()).
- *
- * @return string The formatted status message string.
- */
- public function formatStatusMsg($data)
- {
- $out = '';
-
- foreach ($data as $val) {
- if (empty($val)) {
- continue;
- }
-
- $out .= '<div><table class="mimeStatusMessageTable"' . (isset($val['id']) ? (' id="' . $val['id'] . '" ') : '') . '>';
-
- /* If no image, simply print out the message. */
- if (empty($val['icon'])) {
- foreach ($val['text'] as $val) {
- $out .= '<tr><td>' . $val . '</td></tr>';
- }
- } else {
- $out .= '<tr><td class="mimeStatusIcon">' . $val['icon'] . '</td><td><table>';
- foreach ($val['text'] as $val) {
- $out .= '<tr><td>' . $val . '</td></tr>';
- }
- $out .= '</table></td></tr>';
- }
-
- $out .= '</table></div>';
- }
-
- return $out
- ? '<div class="mimeStatusMessage">' . $out . '</div>'
- : '';
- }
-
- /**
- * Output inline message display for the imp and dimp views.
- *
- * @param object $imp_contents The IMP_Contents object containing the
- * message data.
- * @param integer $contents_mask The mask needed for a
- * IMP_Contents::getSummary() call.
- * @param array $part_info_display The list of summary fields to display.
- * @param string $show_parts The value of the 'show_parts' pref.
- *
- * @return array An array with the following keys:
- * <pre>
- * 'atc_parts' - (array) The list of attachment MIME IDs.
- * 'display_ids' - (array) The list of display MIME IDs.
- * 'js_onload' - (array) A list of javascript code to run onload.
- * 'msgtext' - (string) The rendered HTML code.
- * </pre>
- */
- public function getInlineOutput($imp_contents, $contents_mask,
- $part_info_display, $show_parts)
- {
- $atc_parts = $display_ids = $js_onload = $wrap_ids = array();
- $msgtext = '';
- $parts_list = $imp_contents->getContentTypeMap();
-
- if ($show_parts == 'all') {
- $atc_parts = array_keys($parts_list);
- }
-
- foreach ($parts_list as $mime_id => $mime_type) {
- if (in_array($mime_id, $display_ids, true)) {
- continue;
- }
-
- if (!($render_mode = $imp_contents->canDisplay($mime_id, IMP_Contents::RENDER_INLINE | IMP_Contents::RENDER_INFO))) {
- if ($imp_contents->isAttachment($mime_type)) {
- if ($show_parts == 'atc') {
- $atc_parts[] = $mime_id;
- }
-
- if ($GLOBALS['prefs']->getValue('atc_display')) {
- $msgtext .= $this->formatSummary($imp_contents->getSummary($mime_id, $contents_mask), $part_info_display, true);
- }
- }
- continue;
- }
-
- $render_part = $imp_contents->renderMIMEPart($mime_id, $render_mode);
- if (($render_mode & IMP_Contents::RENDER_INLINE) &&
- empty($render_part)) {
- /* This meant that nothing was rendered - allow this part to
- * appear in the attachment list instead. */
- if ($show_parts == 'atc') {
- $atc_parts[] = $mime_id;
- }
- continue;
- }
-
- reset($render_part);
- while (list($id, $info) = each($render_part)) {
- $display_ids[] = $id;
-
- if (empty($info)) {
- continue;
- }
-
- while (count($wrap_ids) &&
- !Horde_Mime::isChild(end($wrap_ids), $id)) {
- array_pop($wrap_ids);
- $msgtext .= '</div>';
- }
-
- if (!empty($info['wrap'])) {
- $msgtext .= '<div class="' . $info['wrap'] . '">';
- $wrap_ids[] = $mime_id;
- }
-
- if (empty($info['attach'])) {
- $msgtext .= $this->formatSummary($imp_contents->getSummary($id, $contents_mask), $part_info_display) .
- $this->formatStatusMsg($info['status']) .
- '<div class="mimePartData">' . $info['data'] . '</div>';
- } else {
- if ($show_parts == 'atc') {
- $atc_parts[] = $id;
- }
-
- if ($GLOBALS['prefs']->getValue('atc_display')) {
- $msgtext .= $this->formatSummary($imp_contents->getSummary($id, $contents_mask), $part_info_display, true);
- }
- }
-
- if (isset($info['js'])) {
- $js_onload = array_merge($js_onload, $info['js']);
- }
- }
- }
-
- while (count($wrap_ids)) {
- $msgtext .= '</div>';
- array_pop($wrap_ids);
- }
-
- if (!strlen($msgtext)) {
- $msgtext = $this->formatStatusMsg(array(array('text' => array(_("There are no parts that can be shown inline.")))));
- }
-
- return array(
- 'atc_parts' => $atc_parts,
- 'display_ids' => $display_ids,
- 'js_onload' => $js_onload,
- 'msgtext' => $msgtext
- );
- }
-
- /**
- * Get the display subject (filtered, formatted, and linked).
- *
- * @param string $subject The subject text.
- *
- * @return string The display subject string.
- */
- public function getDisplaySubject($subject)
- {
- return Horde_Text_Filter::filter(IMP::filterText($subject), 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'class' => null, 'callback' => null));
- }
-
- /**
- * Redirect to mailbox after deleting a message?
- *
- * @return boolean Return to mailbox?
- */
- public function moveAfterAction()
- {
- return (($_SESSION['imp']['protocol'] != 'pop') &&
- !IMP::hideDeletedMsgs($GLOBALS['imp_mbox']['mailbox']) &&
- !$GLOBALS['prefs']->getValue('use_trash'));
- }
-
-}
+++ /dev/null
-<?php
-/**
- * The IMP_UI_Search:: class is designed to provide a place to store common
- * code shared among IMP's various UI views for the search page.
- *
- * Copyright 2009 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>
- * @package IMP
- */
-class IMP_UI_Search
-{
- /**
- * Creates a search query.
- *
- * @param array $search The list of search criteria.
- *
- * @return object A search object (Horde_Imap_Client_Search_Query).
- */
- public function createQuery($search)
- {
- $query = new Horde_Imap_Client_Search_Query();
-
- $search_array = array();
- $search_fields = $GLOBALS['imp_search']->searchFields();
- $flag_fields = $GLOBALS['imp_search']->flagFields();
- $imp_flags = IMP_Imap_Flags::singleton();
- $or_search = false;
-
- foreach ($search as $rule) {
- $ob = new Horde_Imap_Client_Search_Query();
-
- $type = isset($search_fields[$rule->t]['type'])
- ? $search_fields[$rule->t]['type']
- : $rule->t;
-
- switch ($type) {
- case 'or':
- $query->orSearch($search_array);
- $search_array = array();
- $or_search = true;
- break;
-
- case 'flag':
- if (isset($flag_fields[$rule->v])) {
- $val = $imp_flags->parseFormId($rule->t);
- $ob->flag($val['flag'], $val['set']);
- $search_array[] = $ob;
- }
- break;
-
- case 'header':
- if (!empty($rule->v)) {
- $ob->headerText($rule->t, $rule->v, !empty($rule->n));
- $search_array[] = $ob;
- }
- break;
-
- case 'customhdr':
- if (!empty($rule->v)) {
- $ob->headerText($rule->v->h, $rule->v->s, !empty($rule->n));
- $search_array[] = $ob;
- }
- break;
-
- case 'body':
- case 'text':
- if (!empty($rule->v)) {
- $ob->text($rule->c, $search_fields[$rule->t]['type'] == 'body', !empty($rule->n));
- $search_array[] = $ob;
- }
- break;
-
- case 'date':
- if (!empty($rule->v)) {
- $date = new Horde_Date(array('year' => $rule->v->y, 'month' => $rule->v->m + 1, 'mday' => $rule->v->d));
- $ob->dateSearch($date, ($rule->t == 'date_on') ? Horde_Imap_Client_Search_Query::DATE_ON : (($rule->t == 'date_until') ? Horde_Imap_Client_Search_Query::DATE_BEFORE : Horde_Imap_Client_Search_Query::DATE_SINCE));
- $search_array[] = $ob;
- }
- break;
-
- case 'within':
- /* Limited to day granularity because that is the technical
- * limit for IMAP servers without 'WITHIN' extension. */
- if (!empty($rule->v)) {
- $secs = $rule->v->v * 60 * 60 * 24;
-
- switch ($rule->v->l) {
- case 'y':
- $secs *= 365;
- break;
-
- case 'm':
- $secs *= 30;
- break;
- }
-
- $ob->intervalSearch($secs, $rule->t == 'older' ? Horde_Imap_Client_Search_Query::INTERVAL_OLDER : Horde_Imap_Client_Search_Query::INTERVAL_YOUNGER);
- $search_array[] = $ob;
- }
- break;
-
- case 'size':
- if (!empty($rule->v)) {
- $ob->size(intval($rule->v), $rule->t == 'size_larger');
- $search_array[] = $ob;
- }
- break;
- }
- }
-
- if ($or_search) {
- $query->orSearch($search_array);
- } else {
- $query->andSearch($search_array);
- }
-
- return $query;
- }
-
- /**
- * Create a search query from input gathered from the basic search script
- * (imp/search-basic.php).
- *
- * @param string $mbox The mailbox to search.
- * @param string $criteria The criteria to search.
- * @param string $text The criteria text.
- * @param boolean $not Should the criteria search be a not search?
- * @param string $flag A flag to search for.
- *
- * @return string The search query ID.
- */
- public function processBasicSearch($mbox, $criteria, $text, $not, $flag)
- {
- $c_list = array();
-
- if ($criteria) {
- $search_fields = $GLOBALS['imp_search']->searchFields();
- $tmp = new stdClass;
- $tmp->t = $criteria;
- $tmp->v = ($search_fields[$criteria]['type'] == 'size')
- ? floatval($text) * 1024
- : $text;
- if ($search_fields[$criteria]['not']) {
- $tmp->n = (bool)$not;
- }
- $c_list[] = $tmp;
- }
-
- if ($flag) {
- $tmp = new stdClass;
- $tmp->t = 'flag';
- $tmp->v = $flag;
- $c_list[] = $tmp;
- }
-
- /* Set the search in the IMP session. */
- return $GLOBALS['imp_search']->createSearchQuery($this->createQuery($c_list), array($mbox), $c_list, _("Search Results"), IMP_Search::MBOX_PREFIX . IMP_Search::BASIC_SEARCH);
- }
-
-}
--- /dev/null
+<?php
+/**
+ * The IMP_Ui_Compose:: class is designed to provide a place to store common
+ * code shared among IMP's various UI views for the compose page.
+ *
+ * Copyright 2006-2009 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>
+ * @package IMP
+ */
+class IMP_Ui_Compose
+{
+ /**
+ */
+ public function expandAddresses($input, $imp_compose)
+ {
+ $addr_list = $this->getAddressList($input);
+ if (empty($addr_list)) {
+ return '';
+ }
+
+ $res = $imp_compose->expandAddresses($addr_list);
+
+ if (is_array($res)) {
+ $GLOBALS['notification']->push(_("Please resolve ambiguous or invalid addresses."), 'horde.warning');
+ }
+
+ return $res;
+ }
+
+ /**
+ * $encoding = DEPRECATED
+ *
+ * @throws Horde_Exception
+ */
+ public function redirectMessage($to, $imp_compose, $contents, $encoding)
+ {
+ try {
+ $recip = $imp_compose->recipientList(array('to' => $to));
+ } catch (IMP_Compose_Exception $e) {
+ throw new Horde_Exception($recip);
+ }
+ $recipients = implode(', ', $recip['list']);
+
+ $identity = Horde_Preffs_Identity::singleton(array('imp', 'imp'));
+ $from_addr = $identity->getFromAddress();
+
+ $headers = $contents->getHeaderOb();
+ $headers->addResentHeaders($from_addr, $recip['header']['to']);
+
+ $mime_message = $contents->getMIMEMessage();
+ $charset = $mime_message->getCharset();
+ if (is_null($charset)) {
+ $charset = $encoding;
+ }
+
+ /* We need to set the Return-Path header to the current user - see
+ RFC 2821 [4.4]. */
+ $headers->removeHeader('return-path');
+ $headers->addHeader('Return-Path', $from_addr);
+
+ /* Store history information. */
+ if (!empty($GLOBALS['conf']['maillog']['use_maillog'])) {
+ IMP_Maillog::log('redirect', $headers->getValue('message-id'), $recipients);
+ }
+
+ try {
+ $imp_compose->sendMessage($recipients, $headers, $mime_message, $charset);
+ } catch (IMP_Compose_Exception $e) {
+ throw new Horde_Exception($e);
+ }
+
+ $entry = sprintf("%s Redirected message sent to %s from %s",
+ $_SERVER['REMOTE_ADDR'], $recipients, Horde_Auth::getAuth());
+ Horde::logMessage($entry, __FILE__, __LINE__, PEAR_LOG_INFO);
+
+ if ($GLOBALS['conf']['sentmail']['driver'] != 'none') {
+ $sentmail = IMP_Sentmail::factory();
+ $sentmail->log('redirect', $headers->getValue('message-id'), $recipients);
+ }
+ }
+
+ /**
+ */
+ public function getForwardData(&$imp_compose, &$imp_contents, $index)
+ {
+ $fwd_msg = $imp_compose->forwardMessage($imp_contents);
+ $subject_header = $imp_compose->attachIMAPMessage(array($index), $fwd_msg['headers']);
+ if ($subject_header !== false) {
+ $fwd_msg['headers']['subject'] = $subject_header;
+ }
+
+ return $fwd_msg;
+ }
+
+ /**
+ */
+ public function attachAutoCompleter($fields)
+ {
+ /* Attach autocompleters to the compose form elements. */
+ foreach ($fields as $val) {
+ $imple = Horde_Ajax_Imple::factory(array('imp', 'ContactAutoCompleter'), array('triggerId' => $val));
+ $imple->attach();
+ }
+ }
+
+ /**
+ */
+ public function attachSpellChecker($mode, $add_br = false)
+ {
+ $menu_view = $GLOBALS['prefs']->getValue('menu_view');
+ $show_text = ($menu_view == 'text' || $menu_view == 'both');
+ $br = ($add_br) ? '<br />' : '';
+ $spell_img = Horde::img('spellcheck.png');
+ $args = array(
+ 'id' => ($mode == 'dimp' ? 'DIMP.' : 'IMP.') . 'SpellCheckerObject',
+ 'targetId' => 'composeMessage',
+ 'triggerId' => 'spellcheck',
+ 'states' => array(
+ 'CheckSpelling' => $spell_img . ($show_text ? $br . _("Check Spelling") : ''),
+ 'Checking' => $spell_img . $br . _("Checking ..."),
+ 'ResumeEdit' => $spell_img . $br . _("Resume Editing"),
+ 'Error' => $spell_img . $br . _("Spell Check Failed")
+ )
+ );
+
+ $imple = Horde_Ajax_Imple::factory('SpellChecker', $args);
+ $imple->attach();
+ }
+
+ /**
+ */
+ public function getAddressList($to, $to_list = array(), $to_field = array(),
+ $to_new = '', $expand = false)
+ {
+ $to = rtrim(trim($to), ',');
+ if (!empty($to)) {
+ // Although we allow ';' to delimit addresses in the UI, need to
+ // convert to RFC-compliant ',' delimiter for processing.
+ $clean_to = '';
+ foreach (Horde_Mime_Address::explode($to, ',;') as $val) {
+ $val = trim($val);
+ $clean_to .= $val . (($val[Horde_String::length($val) - 1] == ';') ? ' ' : ', ');
+ }
+ if ($expand) {
+ return $clean_to;
+ } else {
+ return IMP_Compose::formatAddr($clean_to);
+ }
+ }
+
+ $tmp = array();
+ if (is_array($to_field)) {
+ foreach ($to_field as $key => $address) {
+ $tmp[$key] = $address;
+ }
+ }
+ if (is_array($to_list)) {
+ foreach ($to_list as $key => $address) {
+ if ($address != '') {
+ $tmp[$key] = $address;
+ }
+ }
+ }
+
+ $to_new = rtrim(trim($to_new), ',');
+ if (!empty($to_new)) {
+ $tmp[] = $to_new;
+ }
+ return implode(', ', $tmp);
+ }
+
+ /**
+ * Initialize the Rich Text Editor (RTE).
+ *
+ * @param boolean $mini Load the basic ckeditor stub?
+ */
+ public function initRTE($basic = false)
+ {
+ $editor = Horde_Editor::singleton('Ckeditor', array('basic' => $basic));
+
+ $config = array(
+ /* To more closely match "normal" textarea behavior, send <BR> on
+ * enter instead of <P>. */
+ // CKEDITOR.ENTER_BR
+ 'enterMode: 2',
+ // CKEDITOR.ENTER_P
+ 'shiftEnterMode: 1',
+
+ /* Don't load the config.js file. */
+ 'customConfig: ""',
+
+ /* Disable resize of the textarea. */
+ 'resize_enabled: false',
+
+ /* Use the old skin for now. */
+ 'skin: "v2"'
+ );
+
+ $buttons = $GLOBALS['prefs']->getValue('ckeditor_buttons');
+ if (!empty($buttons)) {
+ $config[] = 'toolbar: ' . $GLOBALS['prefs']->getValue('ckeditor_buttons');
+ }
+
+ Horde::addInlineScript(array(
+ 'if (!window.IMP) { window.IMP = {}; }',
+ 'IMP.ckeditor_config = {' . implode(',', $config) . '}'
+ ));
+ }
+
+}
--- /dev/null
+<?php
+/**
+ * The IMP_Ui_Folder:: class is designed to provide a place to store common
+ * code shared among IMP's various UI views for folders.
+ *
+ * Copyright 2009 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>
+ * @package IMP
+ */
+class IMP_Ui_Folder
+{
+ /**
+ * Temporary array used to determine tree levels.
+ *
+ * @var array
+ */
+ var $_moreMbox = array();
+
+ /**
+ * Create the tree images for a list of folder elements.
+ *
+ * @var array $rows Folder rows returned from IMP_Imap_Tree::build().
+ * @var array $options Additional options:
+ * <pre>
+ * 'expand_url' - (string) The URL to use for expand/collapse links.
+ * </pre>
+ *
+ * @return array An array of tree image strings.
+ */
+ public function getTreeImages($rows, $options = array())
+ {
+ $this->_moreMbox = array();
+ $out = array();
+
+ reset($rows);
+ while (list($key, $elt) = each($rows)) {
+ $out[$key] = $this->_getTreeImage($elt, $options);
+ }
+
+ return $out;
+ }
+
+ /**
+ * Create a tree image from a folder element entry.
+ *
+ * @var array $elt An entry returned from IMP_Imap_Tree::element().
+ * @var array $options See self::getTreeImages().
+ *
+ * @return string The image string.
+ */
+ protected function _getTreeImage($elt, $options = array())
+ {
+ $alt = $dir = null;
+ $dir2 = $elt['user_icon']
+ ? Horde::img($elt['icon'], $elt['alt'], null, $elt['icondir'])
+ : '<span class="foldersImg ' . $elt['class'] . '"></span>';
+ $imaptree = IMP_Imap_Tree::singleton();
+
+ if ($elt['children'] && isset($options['expand_url'])) {
+ $dir = Horde_Util::addParameter($options['expand_url'], 'folder', $elt['value']);
+
+ if ($imaptree->isOpen($elt['base_elt'])) {
+ if (!is_null($dir)) {
+ $dir = Horde_Util::addParameter($dir, 'actionID', 'collapse_folder');
+ $alt = _("Collapse Folder");
+ }
+
+ if (empty($GLOBALS['nls']['rtl'][$GLOBALS['language']])) {
+ $tree_img = ($elt['value'] == 'INBOX')
+ ? 9
+ : ($elt['peek'] ? 10 : 11);
+ } else {
+ $tree_img = ($elt['value'] == 'INBOX')
+ ? 12
+ : ($elt['peek'] ? 13 : 14);
+ }
+ } else {
+ if (!is_null($dir)) {
+ $dir = Horde_Util::addParameter($dir, 'actionID', 'expand_folder');
+ $alt = _("Expand Folder");
+ }
+
+ if (empty($GLOBALS['nls']['rtl'][$GLOBALS['language']])) {
+ $tree_img = ($elt['value'] == 'INBOX')
+ ? 15
+ : ($elt['peek'] ? 16 : 17);
+ } else {
+ $tree_img = ($elt['value'] == 'INBOX')
+ ? 18
+ : ($elt['peek'] ? 19 : 20);
+ }
+ }
+
+ if (!is_null($dir)) {
+ $dir = Horde::link($dir, $alt) . '<span class="treeImg treeImg' . $tree_img . '"></span></a>' . $dir2;
+ }
+ } else {
+ if (($elt['value'] == 'INBOX') && !$elt['peek']) {
+ $dir = '<span class="treeImg"></span>' . $dir2;
+ } else {
+ if (empty($GLOBALS['nls']['rtl'][$GLOBALS['language']])) {
+ $tree_img = ($elt['value'] == 'INBOX')
+ ? 3
+ : ($elt['peek'] ? 2 : 4);
+ } else {
+ $tree_img = ($elt['value'] == 'INBOX')
+ ? 7
+ : ($elt['peek'] ? 6 : 8);
+ }
+ $dir = '<span class="treeImg treeImg' . $tree_img . '"></span>' . $dir2;
+ }
+ }
+
+ $line = '';
+ $this->_moreMbox[$elt['level']] = $elt['peek'];
+ for ($i = 0; $i < $elt['level']; $i++) {
+ if ($this->_moreMbox[$i]) {
+ $line .= '<span class="treeImg treeImg' . (empty($GLOBALS['nls']['rtl'][$GLOBALS['language']]) ? 1 : 5) . '"></span>';
+ } else {
+ $line .= '<span class="treeImg"></span>';
+ }
+ }
+
+ return $line . $dir;
+ }
+
+}
--- /dev/null
+<?php
+/**
+ * The IMP_Ui_Mailbox:: class is designed to provide a place to store common
+ * code shared among IMP's various UI views for the mailbox page.
+ *
+ * Copyright 2006-2009 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>
+ * @package IMP
+ */
+class IMP_Ui_Mailbox
+{
+ /**
+ * The current mailbox.
+ *
+ * @var string
+ */
+ private $_mailbox;
+
+ /**
+ * Cached data.
+ *
+ * @var array
+ */
+ private $_cache = array();
+
+ /**
+ * Constructor.
+ *
+ * @param string $mailbox The current mailbox.
+ */
+ public function __construct($mailbox = null)
+ {
+ $this->_mailbox = $mailbox;
+ }
+
+ /**
+ * Get From address information for display on mailbox page.
+ *
+ * @param array $ob An array of envelope information.
+ * @param array $options Additional options:
+ * <pre>
+ * 'fullfrom' - (boolean) If true, returns 'fullfrom' information.
+ * DEFAULT: false
+ * 'specialchars' - (string) If set, run 'from' return through
+ * htmlspecialchars() using the given charset.
+ * </pre>
+ *
+ * @return array An array of information:
+ * <pre>
+ * 'error' - (boolean)
+ * 'from' - (string)
+ * 'fullfrom' - (string)
+ * 'to' - (boolean)
+ * </pre>
+ */
+ public function getFrom($ob, $options = array())
+ {
+ $ret = array('error' => false, 'to' => false);
+
+ if (empty($ob['from'])) {
+ $ret['from'] = $ret['fullfrom'] = _("Invalid Address");
+ $ret['error'] = true;
+ return $ret;
+ }
+
+ if (!isset($this->_cache['drafts_sm_folder'])) {
+ $this->_cache['drafts_sm_folder'] = IMP::isSpecialFolder($this->_mailbox);
+ }
+
+ $from = Horde_Mime_Address::getAddressesFromObject($ob['from']);
+ $from = reset($from);
+
+ if (empty($from)) {
+ $ret['from'] = _("Invalid Address");
+ $ret['error'] = true;
+ } else {
+ $identity = Horde_Prefs_Identity::singleton(array('imp', 'imp'));
+ if ($identity->hasAddress($from['inner'])) {
+ /* This message was sent by one of the user's identity
+ * addresses - show To: information instead. */
+ if (empty($ob['to'])) {
+ $ret['from'] = _("Undisclosed Recipients");
+ $ret['error'] = true;
+ } else {
+ $to = Horde_Mime_Address::getAddressesFromObject($ob['to']);
+ $first_to = reset($to);
+ if (empty($first_to)) {
+ $ret['from'] = _("Undisclosed Recipients");
+ $ret['error'] = true;
+ } else {
+ $ret['from'] = empty($first_to['personal'])
+ ? $first_to['inner']
+ : $first_to['personal'];
+ if (!empty($options['fullfrom'])) {
+ $ret['fullfrom'] = $first_to['display'];
+ }
+ }
+ }
+ if (!$this->_cache['drafts_sm_folder']) {
+ $ret['from'] = _("To") . ': ' . $ret['from'];
+ }
+ $ret['to'] = true;
+ } else {
+ $ret['from'] = empty($from['personal'])
+ ? $from['inner']
+ : $from['personal'];
+ if ($this->_cache['drafts_sm_folder']) {
+ $ret['from'] = _("From") . ': ' . $ret['from'];
+ }
+ if (!empty($options['fullfrom'])) {
+ $ret['fullfrom'] = $from['display'];
+ }
+ }
+ }
+
+ if (!empty($options['fullfrom']) && !isset($ret['fullfrom'])) {
+ $ret['fullfrom'] = $ret['from'];
+ }
+
+ if (!empty($ret['from']) && !empty($options['specialchars'])) {
+ $old_error = error_reporting(0);
+ $res = htmlspecialchars($ret['from'], ENT_QUOTES, $options['specialchars']);
+ if (empty($res)) {
+ $res = htmlspecialchars($ret['from']);
+ }
+ $ret['from'] = $res;
+ error_reporting($old_error);
+ }
+
+ return $ret;
+ }
+
+ /**
+ * Get size display information.
+ *
+ * @param integer $size The size of the message, in bytes.
+ *
+ * @return string A formatted size string.
+ */
+ public function getSize($size)
+ {
+ if ($size < 1024) {
+ return $size;
+ }
+
+ if (!isset($this->_cache['localeinfo'])) {
+ $this->_cache['localeinfo'] = Horde_Nls::getLocaleInfo();
+ }
+
+ $size = $size / 1024;
+
+ return ($size > 1024)
+ ? sprintf(_("%s MB"), number_format($size / 1024, 1, $this->_cache['localeinfo']['decimal_point'], $this->_cache['localeinfo']['thousands_sep']))
+ : sprintf(_("%s KB"), number_format($size, 0, $this->_cache['localeinfo']['decimal_point'], $this->_cache['localeinfo']['thousands_sep']));
+ }
+
+ /**
+ * Return the icon to use for a given attachment.
+ *
+ * @return string The mailbox display icon type (attach, encrypt,
+ * signed).
+ */
+ public function getAttachmentType($type)
+ {
+ list($primary, $sub) = explode('/', $type, 2);
+ if ($primary == 'multipart') {
+ switch ($sub) {
+ case 'signed':
+ return 'signed';
+
+ case 'encrypted':
+ return 'encrypt';
+
+ case 'alternative':
+ case 'related':
+ /* Treat this as no attachments. */
+ break;
+
+ default:
+ return 'attach';
+ }
+ } elseif ($type == 'application/pkcs7-mime') {
+ return 'encrypt';
+ }
+
+ return '';
+ }
+
+ /**
+ * Formats the date header.
+ *
+ * @param integer $date The UNIX timestamp.
+ *
+ * @return string The formatted date header.
+ */
+ public function getDate($date)
+ {
+ if (!isset($this->_cache['today_start'])) {
+ $this->_cache['today_start'] = strtotime('today');
+ $this->_cache['today_end'] = strtotime('today + 1 day');
+ }
+
+ try {
+ $d = new DateTime($date);
+ } catch (Exception $e) {
+ /* Bug #5717 - Check for UT vs. UTC. */
+ if (substr(rtrim($date), -3) != ' UT') {
+ return _("Unknown Date");
+ }
+ try {
+ $d = new DateTime($date . 'C');
+ } catch (Exception $e) {
+ return _("Unknown Date");
+ }
+ }
+ $udate = $d->format('U');
+
+ if (($udate < $this->_cache['today_start']) ||
+ ($udate > $this->_cache['today_end'])) {
+ /* Not today, use the date. */
+ return strftime($GLOBALS['prefs']->getValue('date_format'), $udate);
+ }
+
+ /* Else, it's today, use the time. */
+ return strftime($GLOBALS['prefs']->getValue('time_format'), $udate);
+ }
+
+ /**
+ * Formats the subject header.
+ *
+ * @param string $subject The MIME encoded subject header.
+ * @param string $htmlspaces HTML-ize spaces?
+ *
+ * @return string The formatted subject header.
+ */
+ public function getSubject($subject, $htmlspaces = false)
+ {
+ $subject = Horde_Mime::decode($subject);
+ if (empty($subject)) {
+ return _("[No Subject]");
+ }
+
+ $new_subject = $subject = IMP::filterText(preg_replace("/\s+/", ' ', $subject));
+
+ if ($htmlspaces) {
+ $new_subject = Horde_Text_Filter::filter($subject, 'space2html', array('charset' => Horde_Nls::getCharset(), 'encode' => true));
+ if (empty($new_subject)) {
+ $new_subject = htmlspecialchars($subject);
+ }
+ }
+
+ return empty($new_subject) ? $subject : $new_subject;
+ }
+
+}
--- /dev/null
+<?php
+/**
+ * The IMP_Ui_Message:: class is designed to provide a place to store common
+ * code shared among IMP's various UI views for the message page.
+ *
+ * Copyright 2006-2009 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>
+ * @package IMP
+ */
+class IMP_Ui_Message
+{
+ /**
+ * Return a list of "basic" headers w/gettext translations.
+ *
+ * @return array Header name -> gettext translation mapping.
+ */
+ public function basicHeaders()
+ {
+ return array(
+ 'date' => _("Date"),
+ 'from' => _("From"),
+ 'to' => _("To"),
+ 'cc' => _("Cc"),
+ 'bcc' => _("Bcc"),
+ 'reply-to' => _("Reply-To"),
+ 'subject' => _("Subject")
+ );
+ }
+
+ /**
+ * Get the list of user-defined headers to display.
+ *
+ * @return array The list of user-defined headers.
+ */
+ public function getUserHeaders()
+ {
+ $user_hdrs = $GLOBALS['prefs']->getValue('mail_hdr');
+
+ /* Split the list of headers by new lines and sort the list of headers
+ * to make sure there are no duplicates. */
+ if (is_array($user_hdrs)) {
+ $user_hdrs = implode("\n", $user_hdrs);
+ }
+ $user_hdrs = trim($user_hdrs);
+ if (empty($user_hdrs)) {
+ return array();
+ }
+
+ $user_hdrs = array_filter(array_keys(array_flip(array_map('trim', preg_split("/[\n\r]+/", str_replace(':', '', $user_hdrs))))));
+ natcasesort($user_hdrs);
+
+ return $user_hdrs;
+ }
+
+ /**
+ * Check if we need to send a MDN, and send if needed.
+ *
+ * @param string $mailbox The mailbox of the message.
+ * @param integer $uid The UID of the message.
+ * @param array $headers The headers of the message.
+ * @param boolean $confirmed Has the MDN request been confirmed?
+ *
+ * @return boolean True if the MDN request needs to be confirmed.
+ */
+ public function MDNCheck($mailbox, $uid, $headers, $confirmed = false)
+ {
+ if (!$GLOBALS['prefs']->getValue('disposition_send_mdn') ||
+ $GLOBALS['imp_imap']->isReadOnly($mailbox)) {
+ return false;
+ }
+
+ /* Check to see if an MDN has been requested. */
+ $mdn = new Horde_Mime_Mdn($headers);
+ $return_addr = $mdn->getMDNReturnAddr();
+ if (!$return_addr) {
+ return false;
+ }
+
+ $msg_id = $headers->getValue('message-id');
+ $mdn_flag = $mdn_sent = false;
+
+ /* 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);
+ if (in_array('\\*', $status['permflags']) ||
+ in_array('$mdnsent', $status['permflags'])) {
+ $mdn_flag = true;
+ $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']);
+ }
+ } catch (Horde_Imap_Client_Exception $e) {}
+
+ if (!$mdn_flag) {
+ /* 2nd test: Use Maillog as a fallback. */
+ $mdn_sent = IMP_Maillog::sentMDN($msg_id, 'displayed');
+ }
+
+ if ($mdn_sent) {
+ return false;
+ }
+
+ /* See if we need to query the user. */
+ if ($mdn->userConfirmationNeeded() && !$confirmed) {
+ return true;
+ }
+
+ /* Send out the MDN now. */
+ try {
+ $mail_driver = IMP_Compose::getMailDriver();
+ $mdn->generate(false, $confirmed, 'displayed', $mail_driver['driver'], $mail_driver['params']);
+ IMP_Maillog::log('mdn', $msg_id, 'displayed');
+ $success = true;
+
+ if ($mdn_flag) {
+ $imp_message = IMP_Message::singleton();
+ $imp_message->flag(array('$MDNSent'), $uid . IMP::IDX_SEP . $mailbox, true);
+ }
+ } catch (Horde_Mime_Exception $e) {
+ $success = false;
+ }
+
+ if ($GLOBALS['conf']['sentmail']['driver'] != 'none') {
+ $sentmail = IMP_Sentmail::factory();
+ $sentmail->log('mdn', '', $return_addr, $success);
+ }
+
+ return false;
+ }
+
+ /**
+ * Adds the local time string to the date header.
+ *
+ * @param string $date The date string.
+ *
+ * @return string The local formatted time string.
+ */
+ public function getLocalTime($date)
+ {
+ if (empty($date)) {
+ $ltime = false;
+ } else {
+ $date = preg_replace('/\s+\(\w+\)$/', '', $date);
+ $ltime = strtotime($date);
+ }
+
+ if (($ltime === false) || ($ltime === -1)) {
+ return '';
+ }
+
+ $time_str = strftime($GLOBALS['prefs']->getValue('time_format'), $ltime);
+ $tz = strftime('%Z');
+
+ if ((date('Y') != @date('Y', $ltime)) ||
+ (date('M') != @date('M', $ltime)) ||
+ (date('d') != @date('d', $ltime))) {
+ /* Not today, use the date. */
+ $date_str = strftime($GLOBALS['prefs']->getValue('date_format'), $ltime);
+ return sprintf('%s %s %s', $date_str, $time_str, $tz);
+ }
+
+ /* Else, it's today, use the time only. */
+ return sprintf(_("Today, %s %s"), $time_str, $tz);
+ }
+
+ /**
+ * Parses all of the available mailing list headers.
+ *
+ * @param Horde_Mime_Headers $headers A Horde_Mime_Headers object.
+ *
+ * @return array TODO
+ */
+ public function parseAllListHeaders($headers)
+ {
+ $ret = array();
+
+ foreach (array_keys($headers->listHeaders()) as $val) {
+ if (($data = $headers->getValue($val))) {
+ $ret[$val] = $this->parseListHeaders($data);
+ }
+ }
+
+ return $ret;
+ }
+
+ /**
+ * Parse the information in mailing list headers.
+ *
+ * @param string $data The header text to process.
+ * @param array $opts Additional options:
+ * <pre>
+ * 'email' - (boolean) Only return e-mail values.
+ * DEFAULT: false
+ * 'raw' - (boolean) Should the raw URL be returned instead of linking
+ * the header value?
+ * DEFAULT: false
+ * </pre>
+ *
+ * @return string The header value.
+ */
+ public function parseListHeaders($data, $opts = array())
+ {
+ $output = '';
+
+ /* Split the incoming data by the ',' character. */
+ foreach (preg_split("/,/", $data) as $entry) {
+ /* Get the data inside of the brackets. If there is no brackets,
+ * then return the raw text. */
+ if (!preg_match("/\<([^\>]+)\>/", $entry, $matches)) {
+ return trim($entry);
+ }
+
+ /* Remove all whitespace from between brackets (RFC 2369 [2]). */
+ $match = preg_replace("/\s+/", '', $matches[1]);
+
+ /* Determine if there are any comments. */
+ preg_match("/(\(.+\))/", $entry, $comments);
+
+ /* RFC 2369 [2] states that we should only show the *FIRST* URL
+ * that appears in a header that we can adequately handle. */
+ if (stristr($match, 'mailto:') !== false) {
+ $match = substr($match, strpos($match, ':') + 1);
+ if (!empty($opts['raw'])) {
+ return $match;
+ }
+ $output = Horde::link(IMP::composeLink($match)) . $match . '</a>';
+ if (!empty($comments[1])) {
+ $output .= ' ' . $comments[1];
+ }
+ break;
+ } elseif (empty($data['email'])) {
+ if ($url = Horde_Text_Filter::filter($match, 'linkurls', array('callback' => 'Horde::externalUrl'))) {
+ if (!empty($opts['raw'])) {
+ return $match;
+ }
+ $output = $url;
+ if (!empty($comments[1])) {
+ $output .= ' ' . $comments[1];
+ }
+ break;
+ } else {
+ /* Use this entry unless we can find a better one. */
+ $output = $match;
+ }
+ }
+ }
+
+ return $output;
+ }
+
+ /**
+ * Determines the X-Priority of the message based on the headers.
+ *
+ * @param string $header The X-Priority header.
+ *
+ * @return string 'high', 'low', or 'normal'.
+ */
+ public function getXpriority($header)
+ {
+ if ($header && preg_match('/\s*(\d+)\s*/', $header, $matches)) {
+ if (in_array($matches[1], array(1, 2))) {
+ return 'high';
+ } elseif (in_array($matches[1], array(4, 5))) {
+ return 'low';
+ }
+ }
+
+ return 'normal';
+ }
+
+ /**
+ * Returns e-mail information for a mailing list.
+ *
+ * @param Horde_Mime_Headers $headers A Horde_Mime_Headers object.
+ *
+ * @return array An array with 2 elements: 'exists' and 'reply_list'.
+ */
+ public function getListInformation($headers)
+ {
+ $ret = array('exists' => false, 'reply_list' => null);
+
+ if ($headers->listHeadersExist()) {
+ $ret['exists'] = true;
+
+ /* See if the List-Post header provides an e-mail address for the
+ * list. */
+ if (($val = $headers->getValue('list-post')) &&
+ ($val != 'NO')) {
+ $ret['reply_list'] = $this->parseListHeaders($val, array('email' => true, 'raw' => true));
+ }
+ }
+
+ return $ret;
+ }
+
+ /**
+ * Builds a string containing a list of addresses.
+ *
+ * @param array $addrlist The list of addresses from
+ * Horde_Mime_Address::parseAddressList().
+ * @param integer $addURL The self URL.
+ * @param boolean $link Link each address to the compose screen?
+ *
+ * @return string String containing the formatted address list.
+ */
+ public function buildAddressLinks($addrlist, $addURL = null, $link = true)
+ {
+ global $prefs, $registry;
+
+ /* Make sure this is a valid object address field. */
+ if (empty($addrlist) || !is_array($addrlist)) {
+ return null;
+ }
+
+ $add_link = null;
+ $addr_array = array();
+ $mimp_view = ($_SESSION['imp']['view'] == 'mimp');
+
+ /* Set up the add address icon link if contact manager is
+ * available. */
+ if (!is_null($addURL) && $link && $prefs->getValue('add_source')) {
+ try {
+ $add_link = $registry->hasMethod('contacts/import')
+ ? Horde_Util::addParameter($addURL, 'actionID', 'add_address')
+ : null;
+ } catch (Horde_Exception $e) {}
+ }
+
+ foreach (Horde_Mime_Address::getAddressesFromObject($addrlist) as $ob) {
+ if (isset($ob['groupname'])) {
+ $group_array = array();
+ foreach ($ob['addresses'] as $ad) {
+ if (empty($ad['address']) || empty($ad['inner'])) {
+ continue;
+ }
+
+ $ret = $mimp_view
+ ? $ad['display']
+ : htmlspecialchars($ad['display']);
+
+ if ($link) {
+ $ret = Horde::link(IMP::composeLink(array('to' => $ad['address'])), sprintf(_("New Message to %s"), $ad['inner'])) . htmlspecialchars($ad['display']) . '</a>';
+ }
+
+ /* Append the add address icon to every address if contact
+ * manager is available. */
+ if ($add_link) {
+ $curr_link = Horde_Util::addParameter($add_link, array('name' => $ad['personal'], 'address' => $ad['inner']));
+ $ret .= Horde::link($curr_link, sprintf(_("Add %s to my Address Book"), $ad['inner'])) .
+ Horde::img('addressbook_add.png', sprintf(_("Add %s to my Address Book"), $ad['inner'])) . '</a>';
+ }
+
+ $group_array[] = $ret;
+ }
+
+ if (!$mimp_view) {
+ $ob['groupname'] = htmlspecialchars($ob['groupname']);
+ }
+
+ $addr_array[] = $ob['groupname'] . ':' . (count($group_array) ? ' ' . implode(', ', $group_array) : '');
+ } elseif (!empty($ob['address']) && !empty($ob['inner'])) {
+ $ret = $mimp_view
+ ? $ob['display']
+ : htmlspecialchars($ob['display']);
+
+ /* If this is an incomplete e-mail address, don't link to
+ * anything. */
+ if (stristr($ob['host'], 'UNKNOWN') === false) {
+ if ($link) {
+ $ret = Horde::link(IMP::composeLink(array('to' => $ob['address'])), sprintf(_("New Message to %s"), $ob['inner'])) . htmlspecialchars($ob['display']) . '</a>';
+ }
+
+ /* Append the add address icon to every address if contact
+ * manager is available. */
+ if ($add_link) {
+ $curr_link = Horde_Util::addParameter($add_link, array('name' => $ob['personal'], 'address' => $ob['inner']));
+ $ret .= Horde::link($curr_link, sprintf(_("Add %s to my Address Book"), $ob['inner'])) .
+ Horde::img('addressbook_add.png', sprintf(_("Add %s to my Address Book"), $ob['inner'])) . '</a>';
+ }
+ }
+
+ $addr_array[] = $ret;
+ }
+ }
+
+ if ($_SESSION['imp']['view'] == 'mimp') {
+ return implode(', ', $addr_array);
+ }
+
+ /* If left with an empty address list ($ret), inform the user that the
+ * recipient list is purposely "undisclosed". */
+ if (empty($addr_array)) {
+ $ret = _("Undisclosed Recipients");
+ } else {
+ /* Build the address line. */
+ $addr_count = count($addr_array);
+ $ret = '<span class="nowrap">' . implode(',</span> <span class="nowrap">', $addr_array) . '</span>';
+ if ($link && $addr_count > 15) {
+ $ret = '<span>' .
+ '<span onclick="[ this, this.next(), this.next(1) ].invoke(\'toggle\')" class="widget largeaddrlist">' . sprintf(_("[Show Addresses - %d recipients]"), $addr_count) . '</span>' .
+ '<span onclick="[ this, this.previous(), this.next() ].invoke(\'toggle\')" class="widget largeaddrlist" style="display:none">' . _("[Hide Addresses]") . '</span>' .
+ '<span style="display:none">' .
+ $ret . '</span></span>';
+ }
+ }
+
+ return $ret;
+ }
+
+ /**
+ * Prints out a MIME summary (in HTML).
+ *
+ * @param array $summary Summary information from
+ * IMP_Summary::getSummary().
+ * @param array $display The fields to display (in this order).
+ * @param boolean $atc Is this an attachment?
+ *
+ * @return string The formatted summary string.
+ */
+ public function formatSummary($summary, $display, $atc = false)
+ {
+ $tmp_summary = array();
+ foreach ($display as $val) {
+ $tmp_summary[] = $summary[$val];
+ }
+ return '<div class="mimePartInfo' . ($atc ? ' mimePartInfoAtc' : '') . '"><div>' . implode(' ', $tmp_summary) . '</div></div>';
+ }
+
+ /**
+ * Prints out a MIME status message (in HTML).
+ *
+ * @param array $data An array of information (as returned from
+ Horde_Mime_Viewer::render()).
+ *
+ * @return string The formatted status message string.
+ */
+ public function formatStatusMsg($data)
+ {
+ $out = '';
+
+ foreach ($data as $val) {
+ if (empty($val)) {
+ continue;
+ }
+
+ $out .= '<div><table class="mimeStatusMessageTable"' . (isset($val['id']) ? (' id="' . $val['id'] . '" ') : '') . '>';
+
+ /* If no image, simply print out the message. */
+ if (empty($val['icon'])) {
+ foreach ($val['text'] as $val) {
+ $out .= '<tr><td>' . $val . '</td></tr>';
+ }
+ } else {
+ $out .= '<tr><td class="mimeStatusIcon">' . $val['icon'] . '</td><td><table>';
+ foreach ($val['text'] as $val) {
+ $out .= '<tr><td>' . $val . '</td></tr>';
+ }
+ $out .= '</table></td></tr>';
+ }
+
+ $out .= '</table></div>';
+ }
+
+ return $out
+ ? '<div class="mimeStatusMessage">' . $out . '</div>'
+ : '';
+ }
+
+ /**
+ * Output inline message display for the imp and dimp views.
+ *
+ * @param object $imp_contents The IMP_Contents object containing the
+ * message data.
+ * @param integer $contents_mask The mask needed for a
+ * IMP_Contents::getSummary() call.
+ * @param array $part_info_display The list of summary fields to display.
+ * @param string $show_parts The value of the 'show_parts' pref.
+ *
+ * @return array An array with the following keys:
+ * <pre>
+ * 'atc_parts' - (array) The list of attachment MIME IDs.
+ * 'display_ids' - (array) The list of display MIME IDs.
+ * 'js_onload' - (array) A list of javascript code to run onload.
+ * 'msgtext' - (string) The rendered HTML code.
+ * </pre>
+ */
+ public function getInlineOutput($imp_contents, $contents_mask,
+ $part_info_display, $show_parts)
+ {
+ $atc_parts = $display_ids = $js_onload = $wrap_ids = array();
+ $msgtext = '';
+ $parts_list = $imp_contents->getContentTypeMap();
+
+ if ($show_parts == 'all') {
+ $atc_parts = array_keys($parts_list);
+ }
+
+ foreach ($parts_list as $mime_id => $mime_type) {
+ if (in_array($mime_id, $display_ids, true)) {
+ continue;
+ }
+
+ if (!($render_mode = $imp_contents->canDisplay($mime_id, IMP_Contents::RENDER_INLINE | IMP_Contents::RENDER_INFO))) {
+ if ($imp_contents->isAttachment($mime_type)) {
+ if ($show_parts == 'atc') {
+ $atc_parts[] = $mime_id;
+ }
+
+ if ($GLOBALS['prefs']->getValue('atc_display')) {
+ $msgtext .= $this->formatSummary($imp_contents->getSummary($mime_id, $contents_mask), $part_info_display, true);
+ }
+ }
+ continue;
+ }
+
+ $render_part = $imp_contents->renderMIMEPart($mime_id, $render_mode);
+ if (($render_mode & IMP_Contents::RENDER_INLINE) &&
+ empty($render_part)) {
+ /* This meant that nothing was rendered - allow this part to
+ * appear in the attachment list instead. */
+ if ($show_parts == 'atc') {
+ $atc_parts[] = $mime_id;
+ }
+ continue;
+ }
+
+ reset($render_part);
+ while (list($id, $info) = each($render_part)) {
+ $display_ids[] = $id;
+
+ if (empty($info)) {
+ continue;
+ }
+
+ while (count($wrap_ids) &&
+ !Horde_Mime::isChild(end($wrap_ids), $id)) {
+ array_pop($wrap_ids);
+ $msgtext .= '</div>';
+ }
+
+ if (!empty($info['wrap'])) {
+ $msgtext .= '<div class="' . $info['wrap'] . '">';
+ $wrap_ids[] = $mime_id;
+ }
+
+ if (empty($info['attach'])) {
+ $msgtext .= $this->formatSummary($imp_contents->getSummary($id, $contents_mask), $part_info_display) .
+ $this->formatStatusMsg($info['status']) .
+ '<div class="mimePartData">' . $info['data'] . '</div>';
+ } else {
+ if ($show_parts == 'atc') {
+ $atc_parts[] = $id;
+ }
+
+ if ($GLOBALS['prefs']->getValue('atc_display')) {
+ $msgtext .= $this->formatSummary($imp_contents->getSummary($id, $contents_mask), $part_info_display, true);
+ }
+ }
+
+ if (isset($info['js'])) {
+ $js_onload = array_merge($js_onload, $info['js']);
+ }
+ }
+ }
+
+ while (count($wrap_ids)) {
+ $msgtext .= '</div>';
+ array_pop($wrap_ids);
+ }
+
+ if (!strlen($msgtext)) {
+ $msgtext = $this->formatStatusMsg(array(array('text' => array(_("There are no parts that can be shown inline.")))));
+ }
+
+ return array(
+ 'atc_parts' => $atc_parts,
+ 'display_ids' => $display_ids,
+ 'js_onload' => $js_onload,
+ 'msgtext' => $msgtext
+ );
+ }
+
+ /**
+ * Get the display subject (filtered, formatted, and linked).
+ *
+ * @param string $subject The subject text.
+ *
+ * @return string The display subject string.
+ */
+ public function getDisplaySubject($subject)
+ {
+ return Horde_Text_Filter::filter(IMP::filterText($subject), 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'class' => null, 'callback' => null));
+ }
+
+ /**
+ * Redirect to mailbox after deleting a message?
+ *
+ * @return boolean Return to mailbox?
+ */
+ public function moveAfterAction()
+ {
+ return (($_SESSION['imp']['protocol'] != 'pop') &&
+ !IMP::hideDeletedMsgs($GLOBALS['imp_mbox']['mailbox']) &&
+ !$GLOBALS['prefs']->getValue('use_trash'));
+ }
+
+}
--- /dev/null
+<?php
+/**
+ * The IMP_Ui_Search:: class is designed to provide a place to store common
+ * code shared among IMP's various UI views for the search page.
+ *
+ * Copyright 2009 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>
+ * @package IMP
+ */
+class IMP_Ui_Search
+{
+ /**
+ * Creates a search query.
+ *
+ * @param array $search The list of search criteria.
+ *
+ * @return object A search object (Horde_Imap_Client_Search_Query).
+ */
+ public function createQuery($search)
+ {
+ $query = new Horde_Imap_Client_Search_Query();
+
+ $search_array = array();
+ $search_fields = $GLOBALS['imp_search']->searchFields();
+ $flag_fields = $GLOBALS['imp_search']->flagFields();
+ $imp_flags = IMP_Imap_Flags::singleton();
+ $or_search = false;
+
+ foreach ($search as $rule) {
+ $ob = new Horde_Imap_Client_Search_Query();
+
+ $type = isset($search_fields[$rule->t]['type'])
+ ? $search_fields[$rule->t]['type']
+ : $rule->t;
+
+ switch ($type) {
+ case 'or':
+ $query->orSearch($search_array);
+ $search_array = array();
+ $or_search = true;
+ break;
+
+ case 'flag':
+ if (isset($flag_fields[$rule->v])) {
+ $val = $imp_flags->parseFormId($rule->t);
+ $ob->flag($val['flag'], $val['set']);
+ $search_array[] = $ob;
+ }
+ break;
+
+ case 'header':
+ if (!empty($rule->v)) {
+ $ob->headerText($rule->t, $rule->v, !empty($rule->n));
+ $search_array[] = $ob;
+ }
+ break;
+
+ case 'customhdr':
+ if (!empty($rule->v)) {
+ $ob->headerText($rule->v->h, $rule->v->s, !empty($rule->n));
+ $search_array[] = $ob;
+ }
+ break;
+
+ case 'body':
+ case 'text':
+ if (!empty($rule->v)) {
+ $ob->text($rule->c, $search_fields[$rule->t]['type'] == 'body', !empty($rule->n));
+ $search_array[] = $ob;
+ }
+ break;
+
+ case 'date':
+ if (!empty($rule->v)) {
+ $date = new Horde_Date(array('year' => $rule->v->y, 'month' => $rule->v->m + 1, 'mday' => $rule->v->d));
+ $ob->dateSearch($date, ($rule->t == 'date_on') ? Horde_Imap_Client_Search_Query::DATE_ON : (($rule->t == 'date_until') ? Horde_Imap_Client_Search_Query::DATE_BEFORE : Horde_Imap_Client_Search_Query::DATE_SINCE));
+ $search_array[] = $ob;
+ }
+ break;
+
+ case 'within':
+ /* Limited to day granularity because that is the technical
+ * limit for IMAP servers without 'WITHIN' extension. */
+ if (!empty($rule->v)) {
+ $secs = $rule->v->v * 60 * 60 * 24;
+
+ switch ($rule->v->l) {
+ case 'y':
+ $secs *= 365;
+ break;
+
+ case 'm':
+ $secs *= 30;
+ break;
+ }
+
+ $ob->intervalSearch($secs, $rule->t == 'older' ? Horde_Imap_Client_Search_Query::INTERVAL_OLDER : Horde_Imap_Client_Search_Query::INTERVAL_YOUNGER);
+ $search_array[] = $ob;
+ }
+ break;
+
+ case 'size':
+ if (!empty($rule->v)) {
+ $ob->size(intval($rule->v), $rule->t == 'size_larger');
+ $search_array[] = $ob;
+ }
+ break;
+ }
+ }
+
+ if ($or_search) {
+ $query->orSearch($search_array);
+ } else {
+ $query->andSearch($search_array);
+ }
+
+ return $query;
+ }
+
+ /**
+ * Create a search query from input gathered from the basic search script
+ * (imp/search-basic.php).
+ *
+ * @param string $mbox The mailbox to search.
+ * @param string $criteria The criteria to search.
+ * @param string $text The criteria text.
+ * @param boolean $not Should the criteria search be a not search?
+ * @param string $flag A flag to search for.
+ *
+ * @return string The search query ID.
+ */
+ public function processBasicSearch($mbox, $criteria, $text, $not, $flag)
+ {
+ $c_list = array();
+
+ if ($criteria) {
+ $search_fields = $GLOBALS['imp_search']->searchFields();
+ $tmp = new stdClass;
+ $tmp->t = $criteria;
+ $tmp->v = ($search_fields[$criteria]['type'] == 'size')
+ ? floatval($text) * 1024
+ : $text;
+ if ($search_fields[$criteria]['not']) {
+ $tmp->n = (bool)$not;
+ }
+ $c_list[] = $tmp;
+ }
+
+ if ($flag) {
+ $tmp = new stdClass;
+ $tmp->t = 'flag';
+ $tmp->v = $flag;
+ $c_list[] = $tmp;
+ }
+
+ /* Set the search in the IMP session. */
+ return $GLOBALS['imp_search']->createSearchQuery($this->createQuery($c_list), array($mbox), $c_list, _("Search Results"), IMP_Search::MBOX_PREFIX . IMP_Search::BASIC_SEARCH);
+ }
+
+}
$compose_html = $GLOBALS['prefs']->getValue('compose_html');
$rte = true;
- $imp_ui = new IMP_UI_Compose();
+ $imp_ui = new IMP_Ui_Compose();
$imp_ui->initRTE(!$compose_html);
}
/* Get mailbox information. */
$overview = $imp_mailbox->getMailboxArray($msglist, array('headers' => array('list-post', 'x-priority'), 'structure' => $GLOBALS['prefs']->getValue('atc_flag')));
$charset = Horde_Nls::getCharset();
- $imp_ui = new IMP_UI_Mailbox($folder);
+ $imp_ui = new IMP_Ui_Mailbox($folder);
$no_flags_hook = false;
/* Display message information. */
$envelope = $fetch_ret[$uid]['envelope'];
$mime_headers = reset($fetch_ret[$uid]['headertext']);
- /* Get the IMP_UI_Message:: object. */
- $imp_ui = new IMP_UI_Message();
+ /* Get the IMP_Ui_Message:: object. */
+ $imp_ui = new IMP_Ui_Message();
/* Develop the list of Headers to display now. Deal with the 'basic'
* header information first since there are various manipulations
if ($preview) {
/* Get minidate. */
- $imp_mailbox_ui = new IMP_UI_Mailbox();
+ $imp_mailbox_ui = new IMP_Ui_Mailbox();
$minidate = $imp_mailbox_ui->getDate($envelope['date']);
if (empty($minidate)) {
$minidate = _("Unknown Date");
$msgs = array();
$sortpref = IMP::getSort($imp_mbox['mailbox']);
-$imp_ui = new IMP_UI_Mailbox($imp_mbox['mailbox']);
+$imp_ui = new IMP_Ui_Mailbox($imp_mbox['mailbox']);
/* Build the array of message information. */
$mbox_info = $imp_mailbox->getMailboxArray(range($pageOb['begin'], $pageOb['end']), array('headers' => array('x-priority')));
/* Initialize repetitively used variables. */
$fromlinkstyle = $prefs->getValue('from_link');
-$imp_ui = new IMP_UI_Mailbox($imp_mbox['mailbox']);
+$imp_ui = new IMP_Ui_Mailbox($imp_mbox['mailbox']);
/* Display message information. */
$msgs = array();
exit;
}
-$imp_ui = new IMP_UI_Message();
+$imp_ui = new IMP_Ui_Message();
$readonly = $imp_imap->isReadOnly($folder);
$args = array(
);
$compose_result = IMP_Views_Compose::showCompose($compose_args);
- /* Init IMP_UI_Compose:: object. */
- $imp_ui = new IMP_UI_Compose();
+ /* Init IMP_Ui_Compose:: object. */
+ $imp_ui = new IMP_Ui_Compose();
/* Attach spellchecker & auto completer. */
$imp_ui->attachAutoCompleter(array('to', 'cc', 'bcc'));
}
$imp_message = IMP_Message::singleton();
-$imp_ui = new IMP_UI_Message();
+$imp_ui = new IMP_Ui_Message();
/* Determine if mailbox is readonly. */
$readonly = $imp_imap->isReadOnly($imp_mbox['mailbox']);
$indices_array = array($mailbox_name => array($uid));
$imp_flags = IMP_Imap_Flags::singleton();
-$imp_ui = new IMP_UI_Message();
+$imp_ui = new IMP_Ui_Message();
switch ($actionID) {
case 'blacklist':
$ids = $imp_search->runSearchQuery($query, $mailbox, Horde_Imap_Client::SORT_DATE, 1);
if (!empty($ids)) {
- $imp_ui = new IMP_UI_Mailbox($imp_mbox['mailbox']);
+ $imp_ui = new IMP_Ui_Mailbox($imp_mbox['mailbox']);
$overview = $imp_mailbox->getMailboxArray(array_slice($ids, 0, 20), array('preview' => $prefs->getValue('preview_enabled')));
/* If search_basic_mbox is set, we are processing the search query. */
$search_mailbox = Horde_Util::getFormData('search_basic_mbox');
if ($search_mailbox) {
- $imp_ui_search = new IMP_UI_Search();
+ $imp_ui_search = new IMP_Ui_Search();
$id = $imp_ui_search->processBasicSearch($search_mailbox, Horde_Util::getFormData('search_criteria'), Horde_Util::getFormData('search_criteria_text'), Horde_Util::getFormData('search_criteria_not'), Horde_Util::getFormData('search_flags'));
/* Redirect to the mailbox screen. */
$folders = Horde_Util::getFormData('search_folders_form');
/* Create the search query. */
- $imp_ui_search = new IMP_UI_Search();
+ $imp_ui_search = new IMP_Ui_Search();
$query = $imp_ui_search->createQuery($criteria);
/* Save the search if requested. */
list($raw_rows,) = $imp_imap_tree->build($mask);
-$imp_ui_folder = new IMP_UI_Folder();
+$imp_ui_folder = new IMP_Ui_Folder();
$tree_imgs = $imp_ui_folder->getTreeImages($raw_rows);
$folders = array();
}
$charset = Horde_Nls::getCharset();
-$imp_ui = new IMP_UI_Message();
+$imp_ui = new IMP_Ui_Message();
foreach ($loop_array as $mbox => $idxlist) {
$fetch_res = $GLOBALS['imp_imap']->ob()->fetch($mbox, array(