From 4e94d9e45af3231e327e6ec0718909ac80bab1e4 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Tue, 11 Nov 2008 23:52:34 -0700 Subject: [PATCH] Fix address book search and status reporting Still need to work on unblock image related activities. --- imp/lib/Mime/Viewer/html.php | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/imp/lib/Mime/Viewer/html.php b/imp/lib/Mime/Viewer/html.php index 5b1e62d30..0978f6ec1 100644 --- a/imp/lib/Mime/Viewer/html.php +++ b/imp/lib/Mime/Viewer/html.php @@ -188,7 +188,6 @@ class IMP_Horde_Mime_Viewer_html extends Horde_Mime_Viewer_html } /* Only display images if specifically allowed by user. */ - $msg = $script = ''; if (!IMP::printMode() && $GLOBALS['prefs']->getValue('html_image_replacement') && preg_match($this->_img_regex, $data)) { @@ -204,17 +203,22 @@ class IMP_Horde_Mime_Viewer_html extends Horde_Mime_Viewer_html $addr_check = ($GLOBALS['prefs']->getValue('html_image_addrbook') && $this->_inAddressBook()); if (!$view_img && !$addr_check) { - $script = Util::bufferOutput(array('Horde', 'addScriptFile'), 'prototype.js', 'horde', true) . - Util::bufferOutput(array('Horde', 'addScriptFile'), 'unblockImages.js', 'imp', true); + $data .= Util::bufferOutput(array('Horde', 'addScriptFile'), 'prototype.js', 'horde', true) . + Util::bufferOutput(array('Horde', 'addScriptFile'), 'unblockImages.js', 'imp', true); + + $cleanhtml['status'][] = array( + 'icon' => Horde::img('mime/image.png'), + 'text' => array( + String::convertCharset(_("Images have been blocked to protect your privacy."), $charset, $msg_charset), + Horde::link(Util::addParameter($url, 'view_html_images', 1), '', '', '', 'return IMP.unblockImages(' . (!$inline ? 'document.body' : '$(\'html-message\')') . ', \'block-images\');', '', '', $inline ? array() : array('style' => 'color:blue')) . String::convertCharset(_("Show Images?"), $charset, $msg_charset) . '' + ) + ); - $url = Util::addParameter($url, 'view_html_images', 1); - $attributes = $inline ? array() : array('style' => 'color:blue'); - $msg = Horde::img('mime/image.png') . ' ' . String::convertCharset(_("Images have been blocked to protect your privacy."), $charset, $msg_charset) . ' ' . Horde::link($url, '', '', '', 'return IMP.unblockImages(' . (!$inline ? 'document.body' : '$(\'html-message\')') . ', \'block-images\');', '', '', $attributes) . String::convertCharset(_("Show Images?"), $charset, $msg_charset) . ''; $data = preg_replace_callback($this->_img_regex, array($this, '_blockImages'), $data); - if (!$inline) { - $msg = '' . nl2br($msg) . '
'; - } - $msg = '' . $msg . ''; + + // TODO + //$msg = '' . nl2br($msg) . '
'; + //$msg = '' . $msg . ''; } } @@ -263,15 +267,10 @@ class IMP_Horde_Mime_Viewer_html extends Horde_Mime_Viewer_html } $params = IMP_Compose::getAddressSearchParams(); - - // TODO - // get mime_message. + $headers = $this->_params['contents']->getHeaderOb(); /* Try to get back a result from the search. */ - $result = $GLOBALS['registry']->call('contacts/getField', array($base_ob->getFromAddress(), '__key', $params['sources'], false, true)); - - return is_a($result, 'PEAR_Error') - ? false - : (count($result) > 0); + $rest = $GLOBALS['registry']->call('contacts/getField', array(Horde_Mime_Address::bareAddress($headers->getValue('from')), '__key', $params['sources'], false, true)); + return is_a($res, 'PEAR_Error') ? false : count($res); } } -- 2.11.0