More DIMP -> IMP fixes.
authorMichael M Slusarz <slusarz@curecanti.org>
Mon, 1 Dec 2008 10:32:01 +0000 (03:32 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Mon, 1 Dec 2008 22:28:06 +0000 (15:28 -0700)
imp/compose-dimp.php
imp/config/portal.php.dist
imp/imp-dimp.php
imp/lib/Block/newmail.php
imp/lib/UI/Mailbox.php
imp/lib/Views/ListMessages.php
imp/lib/Views/ShowMessage.php
imp/message.php
imp/templates/chunks/compose.php
imp/templates/chunks/message.php
imp/templates/index/index.inc

index 236cc5a..de042bc 100644 (file)
 
 function _removeAutoSaveDraft($index)
 {
-    if (empty($index)) {
-        return;
+    if (!empty($index)) {
+        $imp_message = &IMP_Message::singleton();
+        $imp_message->delete(array($index . IMP::IDX_SEP . IMP::folderPref($GLOBALS['prefs']->getValue('drafts_folder'), true)), true);
     }
-    $imp_message = &IMP_Message::singleton();
-    $idx_array = array($index . IMP_IDX_SEP . IMP::folderPref($GLOBALS['prefs']->getValue('drafts_folder'), true));
-    $imp_message->delete($idx_array, true);
 }
 
 require_once dirname(__FILE__) . '/lib/base.php';
@@ -42,7 +40,7 @@ require_once 'Horde/Identity.php';
 $identity = &Identity::singleton(array('imp', 'imp'));
 if (!$prefs->isLocked('default_identity')) {
     $identity_id = Util::getFormData('identity');
-    if ($identity_id !== null) {
+    if (!is_null($identity_id)) {
         $identity->setDefault($identity_id);
     }
 }
@@ -147,7 +145,7 @@ if (count($_POST)) {
             'sent_folder' => $identity->getValue('sent_mail_folder'),
             'save_attachments' => Util::getFormData('save_attachments_select'),
             'reply_type' => $result->reply_type,
-            'reply_index' => $result->index . IMP_IDX_SEP . $result->reply_folder,
+            'reply_index' => $result->index . IMP::IDX_SEP . $result->reply_folder,
             'readreceipt' => Util::getFormData('request_read_receipt')
         );
         $sent = $imp_compose->buildAndSendMessage($message, $header, $charset, $html, $options);
@@ -194,7 +192,7 @@ if (in_array($type, array('reply', 'reply_all', 'reply_list', 'forward_all', 'fo
         $type = 'new';
     }
 
-    $imp_contents = &IMP_Contents::singleton($index . IMP_IDX_SEP . $folder);
+    $imp_contents = &IMP_Contents::singleton($index . IMP::IDX_SEP . $folder);
     if (is_a($imp_contents, 'PEAR_Error')) {
         $notification->push(_("Requested message not found."), 'horde.error');
         $index = $folder = null;
@@ -232,7 +230,7 @@ case 'reply_list':
 case 'forward_all':
 case 'forward_body':
 case 'forward_attachments':
-    $fwd_msg = $imp_ui->getForwardData($imp_compose, $imp_contents, $type, $index . IMP_IDX_SEP . $folder);
+    $fwd_msg = $imp_ui->getForwardData($imp_compose, $imp_contents, $type, $index . IMP::IDX_SEP . $folder);
     if ($type == 'forward_all') {
         $msg = '';
     } else {
@@ -252,7 +250,7 @@ case 'forward_attachments':
     break;
 
 case 'resume':
-    $result = $imp_compose->resumeDraft($index . IMP_IDX_SEP . $folder);
+    $result = $imp_compose->resumeDraft($index . IMP::IDX_SEP . $folder);
     if (is_a($result, 'PEAR_Error')) {
         $notification->push($result->getMessage(), 'horde.error');
     } else {
@@ -319,7 +317,7 @@ $compose_result['js_onload'][] = 'DimpCompose.fillForm(' . Horde_Serialize::seri
 IMP::addInlineScript($compose_result['js_onload'], 'load');
 
 $scripts = array(
-    array('compose.js', 'dimp', true)
+    array('compose-dimp.js', 'imp', true)
 );
 
 DIMP::header(_("Message Composition"), $scripts);
index ab5d291..b65348c 100644 (file)
  *                'domid' => A DOM ID to assign to the containing block
  *                'tag' => A tag name to add to the template array. Allows
  *                         the use of <if:block.tag> in custom template files.
- *
- * $Horde: dimp/config/portal.php.dist,v 1.7 2008/08/22 04:19:29 slusarz Exp $
  */
 
-require_once 'Horde/Block.php';
-require_once 'Horde/Block/Collection.php';
 $collection = new Horde_Block_Collection();
 $dimp_block_list = array();
 
index 3b5ae37..bd18d53 100644 (file)
@@ -7,6 +7,8 @@
  *
  * 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>
  */
 
 function _generateDeleteResult($folder, $indices, $change)
@@ -50,7 +52,7 @@ function _changed($folder, $compare, $indices = array(), $nothread = false)
 function _threadUidChanged($folder, $indices)
 {
     $sort = IMP::getSort($folder);
-    if ($sort['by'] == SORTTHREAD) {
+    if ($sort['by'] == Horde_Imap_Client::SORT_THREAD) {
         foreach ($indices as $mbox => $mbox_array) {
             $imp_mailbox = &IMP_Mailbox::singleton($mbox);
             $threadob = $imp_mailbox->getThreadOb();
@@ -105,7 +107,7 @@ function _getListMessages($folder, $change)
 function _getIdxString($indices)
 {
     $i = each($indices);
-    return reset($i['value']) . IMP_IDX_SEP . $i['key'];
+    return reset($i['value']) . IMP::IDX_SEP . $i['key'];
 }
 
 function _getPollInformation($mbox)
@@ -523,7 +525,7 @@ case 'DeleteDraft':
         break;
     }
     $imp_message = &IMP_Message::singleton();
-    $idx_array = array($index . IMP_IDX_SEP . IMP::folderPref($prefs->getValue('drafts_folder'), true));
+    $idx_array = array($index . IMP::IDX_SEP . IMP::folderPref($prefs->getValue('drafts_folder'), true));
     $imp_message->delete($idx_array, true);
     break;
 
@@ -656,16 +658,16 @@ case 'SendMDN':
     }
 
     /* Get the IMP_Headers:: object. */
-    // TODO
-    $msg_cache = &IMP_MessageCache::singleton();
-    $cache_entry = $msg_cache->retrieve($folder, array($index), 32);
-    $ob = reset($cache_entry);
-    if ($ob === false) {
+    try {
+        $fetch_ret = $imp_imap->ob->fetch($folder, array(
+            Horde_Imap_Client::FETCH_HEADERTEXT => array(array('parse' => true, 'peek' => false))
+        ), array('ids' => array($index)));
+    } catch (Horde_Imap_Client_Exception $e) {
         break;
     }
 
     $imp_ui = new IMP_UI_Message();
-    $imp_ui->MDNCheck($ob->header, true);
+    $imp_ui->MDNCheck(reset($fetch_ret[$index]['headertext']), true);
     break;
 }
 
index 11c4d54..3badbad 100644 (file)
@@ -36,7 +36,6 @@ class Horde_Block_dimp_newmail extends Horde_Block
             $html .= '<tr><td><em>' . _("No unread messages") . '</em></td></tr>';
         } else {
             require_once 'Horde/Identity.php';
-            require_once 'Horde/Text.php';
 
             $charset = NLS::getCharset();
             $identity = &Identity::singleton(array('imp', 'imp'));
@@ -53,7 +52,7 @@ class Horde_Block_dimp_newmail extends Horde_Block
 
                 $html .= '<tr style="cursor:pointer" class="text" onclick="DimpBase.go(\'msg:INBOX:' . $ob->uid . '\');return false;"><td>' .
                     '<strong>' . htmlspecialchars($from_res['from'], ENT_QUOTES, $charset) . '</strong><br />' .
-                    str_replace('&nbsp;', '&#160;', Text::htmlSpaces($subject)) . '</td>' .
+                    $subject . '</td>' .
                     '<td>' . htmlspecialchars($date, ENT_QUOTES, $charset) . '</td></tr>';
             }
 
index 504f86b..d4f48ca 100644 (file)
@@ -202,9 +202,14 @@ class IMP_UI_Mailbox {
     function getSubject($subject)
     {
         $subject = Horde_Mime::decode($subject, $this->_charset);
-        return empty($subject)
+        $subject = empty($subject)
             ? _("[No Subject]")
             : IMP::filterText(preg_replace("/\s+/", ' ', $subject));
+        if ($_SESSION['imp']['view'] == 'dimp') {
+            require_once 'Horde/Text.php';
+            $subject = str_replace('&nbsp;', '&#160;', Text::htmlSpaces($subject));
+        }
+        return $subject;
     }
 
 }
index e197c9a..570847d 100644 (file)
@@ -188,9 +188,10 @@ class IMP_Views_ListMessages
                 $md->unseen = $info['unseen'];
             }
 
-            if ($sortpref['by'] == SORTTHREAD) {
+            if ($sortpref['by'] == Horde_Imap_Client::SORT_THREAD) {
                 $threadob = $imp_mailbox->getThreadOb();
-                $md->thread = array_filter($threadob->getThreadTreeOb($msglist, $sortpref['dir']));
+                $imp_thread = new IMP_IMAP_Thread($threadob);
+                $md->thread = array_filter($imp_thread->getThreadTreeOb($msglist, $sortpref['dir']));
             }
         } else {
             $result->search = true;
@@ -236,10 +237,10 @@ class IMP_Views_ListMessages
     /**
      * Obtains IMAP overview data for a given set of message UIDs.
      *
-     * @var object IMP_Mailbox $imp_mailbox  An IMP_Mailbox:: object.
-     * @var string $folder                   The current folder.
-     * @var array $msglist                   The list of message sequence
-     *                                       numbers to process.
+     * @param object IMP_Mailbox $imp_mailbox  An IMP_Mailbox:: object.
+     * @param string $folder                   The current folder.
+     * @param array $msglist                   The list of message sequence
+     *                                         numbers to process.
      *
      * @return array TODO
      */
@@ -252,7 +253,6 @@ class IMP_Views_ListMessages
         }
 
         require_once 'Horde/Identity.php';
-        require_once 'Horde/Text.php';
 
         /* Get mailbox information. */
         $overview = $imp_mailbox->getMailboxArray($msglist, false, array('list-post'));
@@ -325,7 +325,7 @@ class IMP_Views_ListMessages
             $msg['from'] = htmlspecialchars($getfrom['from'], ENT_QUOTES, $charset);
 
             /* Format the Subject: Header. */
-            $msg['subject'] = str_replace('&nbsp;', '&#160;', Text::htmlSpaces($imp_ui->getSubject($ob['envelope']['subject'])));
+            $msg['subject'] = $imp_ui->getSubject($ob['envelope']['subject']);
 
             if (!empty($GLOBALS['conf']['hooks']['mailboxarray'])) {
                 $result = Horde::callHook('_dimp_hook_mailboxarray', array($msg, $ob), 'dimp');
index c7da4d7..902c8bd 100644 (file)
@@ -125,10 +125,12 @@ class IMP_Views_ShowMessage
 
         /* Get envelope/flag/header information. */
         try {
+            $flags_ret = $GLOBALS['imp_imap']->ob->fetch($folder, array(
+                Horde_Imap_Client::FETCH_FLAGS => true,
+            ), array('ids' => array($index)));
             $fetch_ret = $GLOBALS['imp_imap']->ob->fetch($folder, array(
                 Horde_Imap_Client::FETCH_ENVELOPE => true,
-                Horde_Imap_Client::FETCH_FLAGS => true,
-                Horde_Imap_Client::FETCH_HEADERTEXT => array(array('parse' => true, 'peek' => true))
+                Horde_Imap_Client::FETCH_HEADERTEXT => array(array('parse' => true, 'peek' => false))
             ), array('ids' => array($index)));
             $ob = $fetch_ret[$index];
         } catch (Horde_Imap_Client_Exception $e) {
@@ -138,9 +140,8 @@ class IMP_Views_ShowMessage
         }
 
         /* Parse MIME info and create the body of the message. */
-        $imp_contents = &IMP_Contents::singleton($index . IMP_IDX_SEP . $folder);
-        if (is_a($imp_contents, 'PEAR_Error') ||
-            !$imp_contents->buildMessage()) {
+        $imp_contents = &IMP_Contents::singleton($index . IMP::IDX_SEP . $folder);
+        if (is_a($imp_contents, 'PEAR_Error')) {
             $result['error'] = $error_msg;
             $result['errortype'] = 'horde.error';
             return $result;
@@ -149,25 +150,8 @@ class IMP_Views_ShowMessage
         /* Get the IMP_UI_Message:: object. */
         $imp_ui = new IMP_UI_Message();
 
-        /* Update the message flag, if necessary. */
-        if (($_SESSION['imp']['protocol'] == 'imap') &&
-            !in_array('\\seen', $ob['flags'])) {
-            $imp_mailbox = &IMP_Mailbox::singleton($folder, $index);
-            $imp_message = &IMP_Message::singleton();
-            $imp_message->flag(array('\\seen'), array($folder => array($index)), true);
-        }
-
-        /* Determine if we should generate the attachment strip links or
-         * not. */
-        if ($GLOBALS['prefs']->getValue('strip_attachments')) {
-            $imp_contents->setStripLink(true);
-        }
-
-        /* Show summary links. */
-        $imp_contents->showSummaryLinks(true);
-
-        $attachments = $imp_contents->getAttachments();
-        $result['msgtext'] = $imp_contents->getMessage();
+        // TODO - Create message text and attachments.
+        //$result['msgtext'] = $imp_contents->getMessage();
 
         /* Develop the list of Headers to display now. Deal with the 'basic'
          * header information first since there are various manipulations
@@ -254,7 +238,6 @@ class IMP_Views_ShowMessage
         /* Get X-Priority/ */
         $result['priority'] = $imp_headers->getXpriority();
 
-
         /* Add attachment info. */
         $atc_display = $GLOBALS['prefs']->getValue('attachment_display');
         $show_parts = (!empty($attachments) && (($atc_display == 'list') || ($atc_display == 'both')));
index 870acda..234b74e 100644 (file)
@@ -234,7 +234,7 @@ try {
 
 $envelope = $fetch_ret[$index]['envelope'];
 $flags = $flags_ret[$index]['flags'];
-$mime_headers = $fetch_ret[$index]['headertext'][0];
+$mime_headers = reset($fetch_ret[$index]['headertext']);
 $use_pop = ($_SESSION['imp']['protocol'] == 'pop');
 
 /* Parse the message. */
index 83bdbe3..e87679e 100644 (file)
@@ -15,7 +15,7 @@
 $d_read = $GLOBALS['prefs']->getValue('disposition_request_read');
 $save_attach = $GLOBALS['prefs']->getValue('save_attachments');
 
-$loading_img = Horde::img('loading.gif', _("Loading..."), array(), $GLOBALS['registry']->getImageDir('dimp'));
+$loading_img = Horde::img('loading.gif', _("Loading..."));
 
 // Small utility function to simplify creating dimpactions buttons.
 // As of right now, we don't show text only links.
@@ -132,7 +132,7 @@ function _createDAcompose($text, $image, $id)
   <table cellspacing="0">
    <thead>
     <tr class="atcrow">
-     <td class="label"><?php echo Horde::img('attachment.png', '', '', $GLOBALS['registry']->getImageDir('imp')) . ': ' ?></td>
+     <td class="label"><?php echo Horde::img('attachment.png') . ': ' ?></td>
      <td id="attach_cell">
       <input type="file" id="upload" name="file_1" />
 <?php if (strpos($save_attach, 'prompt') !== false): ?>
index 057755a..5af8088 100644 (file)
@@ -1,19 +1,16 @@
 <?php
 /**
- * $Horde: dimp/templates/chunks/message.php,v 1.12 2008/10/22 22:59:38 slusarz Exp $
- *
  * Copyright 2005-2008 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.
  */
 
-$dimp_img = $registry->getImageDir('dimp');
 $horde_img = $registry->getImageDir('horde');
 $menu_view = $prefs->getValue('menu_view');
 $show_text = ($menu_view == 'text' || $menu_view == 'both');
 
-$attachment = Horde::img('attachment.png', '', array('class' => 'attachmentImage'), $dimp_img);
+$attachment = Horde::img('attachment.png', '', array('class' => 'attachmentImage'));
 
 // Small utility function to simplify creating dimpactions buttons.
 // As of right now, we don't show text only links.
@@ -56,7 +53,7 @@ function _createDAfmsg($text, $image, $id, $class = '', $show_text = true)
      <div class="dimpOptions noprint">
       <div id="msg_print"><?php echo Horde::img('print.png', '', '', $horde_img) ?><a><?php echo _("Print") ?></a></div>
 <?php if (!empty($conf['user']['allow_view_source'])): ?>
-      <div id="msg_view_source"><?php echo Horde::img('message_source.png', '', '', $dimp_img) ?><a><?php echo _("View Message Source") ?></a></div>
+      <div id="msg_view_source"><?php echo Horde::img('message_source.png') ?><a><?php echo _("View Message Source") ?></a></div>
 <?php endif; ?>
      </div>
      <div id="msgHeadersContent">
@@ -74,7 +71,7 @@ function _createDAfmsg($text, $image, $id, $class = '', $show_text = true)
 <?php endforeach; ?>
 <?php if (isset($show_msg_result['atc_label'])): ?>
         <tr id="msgAtc">
-         <td class="label"><?php if ($show_msg_result['atc_list']): ?><?php echo Horde::link('') . Horde::img('arrow_collapsed.png', '', array('id' => 'partlist_col'), $dimp_img) . Horde::img('arrow_expanded.png', '', array('id' => 'partlist_exp', 'style' => 'display:none'), $dimp_img) . ' ' . $attachment ?></a><?php else: echo $attachment; endif; ?></td>
+         <td class="label"><?php if ($show_msg_result['atc_list']): ?><?php echo Horde::link('') . Horde::img('arrow_collapsed.png', '', array('id' => 'partlist_col')) . Horde::img('arrow_expanded.png', '', array('id' => 'partlist_exp', 'style' => 'display:none')) . ' ' . $attachment ?></a><?php else: echo $attachment; endif; ?></td>
          <td>
           <?php echo $show_msg_result['atc_label'] . ' ' . $show_msg_result['atc_download'] ?>
 <?php if (isset($show_msg_result['atc_list'])): ?>
@@ -126,4 +123,4 @@ function _createDAfmsg($text, $image, $id, $class = '', $show_text = true)
  <div><?php _createDAfmsg(_("Add to Address Book"), 'add_contact.png', 'ctx_contacts_add') ?></div>
 </div>
 
-<?php echo Horde::img('popdown.png', 'v', array('class' => 'popdown', 'id' => 'popdown_img', 'style' => 'display:none'), $dimp_img) ?>
+<?php echo Horde::img('popdown.png', 'v', array('class' => 'popdown', 'id' => 'popdown_img', 'style' => 'display:none')) ?>
index 9a9326e..efea5e4 100644 (file)
@@ -1,28 +1,23 @@
 <?php
-// $Horde: dimp/templates/index/index.inc,v 1.238 2008/10/09 18:49:09 chuck Exp $
-
 // Generate various dimp graphics used in multiple locations
-$imagedir = $registry->getImageDir('dimp');
 $hordeimg = $registry->getImageDir('horde');
 $mailseen = Horde::img('mail_seen.png');
 $mailunseen = Horde::img('mail_unseen.png');
-$delete = Horde::img('delete.png', '', '', $imagedir);
+$delete = Horde::img('delete.png');
 $folder_create = Horde::img('folders/folder_create.png');
 $folder_edit = Horde::img('folders/folder_edit.png');
-$forward = Horde::img('forward.png', '', '', $imagedir);
+$forward = Horde::img('forward.png');
 $flagged = Horde::img('mail_flagged.png');
 $clearflag = Horde::img('mail_clearflag.png');
-$preview = Horde::img('preview.png', '', '', $imagedir);
-$tick = Horde::img('tick.png', '', '', $imagedir);
-$newwin = Horde::img('newwin.png', _("Open in new window"), '', $imagedir);
+$preview = Horde::img('preview.png');
+$tick = Horde::img('tick.png');
+$newwin = Horde::img('newwin.png', _("Open in new window"));
 $attachment = Horde::img('attachment.png', '', array('class' => 'attachmentImage'));
 
 // Thread images
-require_once IMP_BASE . '/lib/IMAP/Thread.php';
 $thread_imgs = IMP_Thread::getImageUrls();
 
 // Attachment images
-require_once IMP_BASE . '/lib/UI/Mailbox.php';
 $imp_ui = new IMP_UI_Mailbox();
 $atc_imgs = array();
 foreach ($imp_ui->getAttachmentAltList() as $k => $v) {
@@ -44,7 +39,7 @@ $sidebar_width = max((int)$prefs->getValue('sidebar_width') - 50, 150) . 'px';
 if (isset($_SESSION['imp']['quota']) && is_array($_SESSION['imp']['quota'])) {
     $quotadata = IMP::quotaData(false);
     if (!empty($quotadata)) {
-        $quota_img = Horde::img('quotauncover.gif', '', array('width' => round(99 - $quotadata['percent']), 'height' => 10), $imagedir);
+        $quota_img = Horde::img('quotauncover.gif', '', array('width' => round(99 - $quotadata['percent']), 'height' => 10));
     }
 }
 
@@ -82,7 +77,7 @@ function _simpleButton($id, $text, $image, $imagedir = null)
    <div id="logo"><h1><a><?php echo _("Horde") ?></a></h1></div>
    <ul id="dimpbarActions">
     <?php echo _simpleButton('composelink', _("_New Message"), 'compose.png') ?>
-    <?php echo _simpleButton('checkmaillink', _("_Get Mail"), 'checkmail.png', $imagedir) ?>
+    <?php echo _simpleButton('checkmaillink', _("_Get Mail"), 'checkmail.png') ?>
 <?php if (!$is_ie6): ?>
     <?php echo _simpleButton('alertsloglink', _("Alerts _Log"), 'info_icon.png', $hordeimg) ?>
 <?php endif; ?>
@@ -188,7 +183,7 @@ function _simpleButton($id, $text, $image, $imagedir = null)
      <div id="mailboxHeader" class="header">
       <div>
        <span class="rightFloat" id="msgHeader"></span>
-       <?php echo Horde::img('loading.gif', $loading_text, array('id' => 'folderLoading', 'style' => 'display:none'), $imagedir) ?>
+       <?php echo Horde::img('loading.gif', $loading_text, array('id' => 'folderLoading', 'style' => 'display:none')) ?>
        <span id="folderName"></span>
       </div>
      </div>
@@ -247,26 +242,26 @@ function _simpleButton($id, $text, $image, $imagedir = null)
      <div id="msglistHeader" class="item">
       <div class="msgStatus">&nbsp;</div>
       <div class="msgFrom">
-       <a class="widget" sortby="<?php echo SORTFROM ?>"><?php echo _("From") ?></a>
-       <a class="widget" style="display:none" sortby="<?php echo SORTTO ?>"><?php echo _("To") ?></a>
+       <a class="widget" sortby="<?php echo Horde_Imap_Client::SORT_FROM ?>"><?php echo _("From") ?></a>
+       <a class="widget" style="display:none" sortby="<?php echo Horde_Imap_Client::SORT_TO ?>"><?php echo _("To") ?></a>
       </div>
       <div class="msgSubject">
-       <a class="widget" sortby="<?php echo SORTSUBJECT ?>"><?php echo _("Subject") ?>
-        <small sortby="<?php echo SORTTHREAD ?>">[<?php echo _("Thread") ?>]</small>
+       <a class="widget" sortby="<?php echo Horde_Imap_Client::SORT_SUBJECT ?>"><?php echo _("Subject") ?>
+        <small sortby="<?php echo Horde_Imap_Client::SORT_THREAD ?>">[<?php echo _("Thread") ?>]</small>
        </a>
-       <a class="widget" style="display:none" sortby="<?php echo SORTTHREAD ?>"><?php echo _("Thread") ?>
-        <small sortby="<?php echo SORTSUBJECT ?>">[<?php echo _("Subject") ?>]</small>
+       <a class="widget" style="display:none" sortby="<?php echo Horde_Imap_Client::SORT_THREAD ?>"><?php echo _("Thread") ?>
+        <small sortby="<?php echo Horde_Imap_Client::SORT_SUBJECT ?>">[<?php echo _("Subject") ?>]</small>
        </a>
       </div>
       <div class="msgDate">
-       <a class="widget" sortby="<?php echo SORTDATE ?>"><?php echo _("Date") ?>
-        <small sortby="<?php echo SORTARRIVAL ?>">[<?php echo _("Arrival") ?>]</small>
+       <a class="widget" sortby="<?php echo Horde_Imap_Client::SORT_DATE ?>"><?php echo _("Date") ?>
+        <small sortby="<?php echo Horde_Imap_Client::SORT_ARRIVAL ?>">[<?php echo _("Arrival") ?>]</small>
        </a>
-       <a class="widget" style="display:none" sortby="<?php echo SORTARRIVAL ?>"><?php echo _("Arrival") ?>
-        <small sortby="<?php echo SORTDATE ?>">[<?php echo _("Date") ?>]</small>
+       <a class="widget" style="display:none" sortby="<?php echo Horde_Imap_Client::SORT_ARRIVAL ?>"><?php echo _("Arrival") ?>
+        <small sortby="<?php echo Horde_Imap_Client::SORT_DATE ?>">[<?php echo _("Date") ?>]</small>
        </a>
       </div>
-      <div class="msgSize"><a class="widget" sortby="<?php echo SORTSIZE ?>"><?php echo _("Size") ?></a></div>
+      <div class="msgSize"><a class="widget" sortby="<?php echo Horde_Imap_Client::SORT_SIZE ?>"><?php echo _("Size") ?></a></div>
      </div>
      <div class="clear" id="mlistHeaderClear">&nbsp;</div>
     </div>
@@ -279,12 +274,12 @@ function _simpleButton($id, $text, $image, $imagedir = null)
      </div>
      <div id="splitBar" style="display:none" class="splitBar noprint"></div>
      <div id="previewPane" style="display:none">
-      <?php echo Horde::img('loading.gif', $loading_text, array('id' => 'msgLoading', 'style' => 'display:none'), $imagedir) ?>
+      <?php echo Horde::img('loading.gif', $loading_text, array('id' => 'msgLoading', 'style' => 'display:none')) ?>
       <div id="previewInfo" style="display:none">
        <?php echo _("To preview a message, select it from the list above. A right-click on the messages will display available actions.") ?><br />
        <?php printf(_("Click on a message while holding down the %s key to select multiple messages.  To select a range of messages, click the first message of the range, navigate to the last message of the range, and then click on the last message while holding down the %s key."), '<span class="kbd">' . _("Ctrl") . '</span>', '<span class="kbd">' . _("Shift") . '</span>') ?><br /><br />
        <?php echo _("The following keyboard shortcuts are available:") ?><br />
-       <?php echo Horde::img('key_up.png', '', '', $imagedir) ?> / <?php echo Horde::img('key_down.png', '', '', $imagedir) . ' : ' . _("Move up/down through the message list.") ?><br />
+       <?php echo Horde::img('key_up.png') ?> / <?php echo Horde::img('key_down.png') . ' : ' . _("Move up/down through the message list.") ?><br />
        <span class="kbd"><?php echo _("PgUp") ?></span> / <span class="kbd"><?php echo _("PgDown") ?></span> : <?php echo _("Move one page up/down through the message list.") ?><br />
        <span class="kbd"><?php echo _("Home") ?></span> / <span class="kbd"><?php echo _("End") ?></span> : <?php echo  _("Move to the beginning/end of the message list.") ?><br />
        <span class="kbd"><?php echo _("Del") ?></span> : <?php echo _("Delete the currently selected message(s).") ?> <?php printf(_("%s will delete the current message and move to the next message if a single message is selected."), '<span class="kbd">' . _("Shift") . '</span> + <span class="kbd">' . _("Del") . '</span>') ?><br />
@@ -294,8 +289,8 @@ function _simpleButton($id, $text, $image, $imagedir = null)
       <div id="previewMsg" style="display:none">
        <div class="msgHeaders">
         <div id="toggleHeaders" class="noprint">
-         <a><?php echo Horde::img('arrow_collapsed.png', '>', array('title' => _("Expand Headers")), $imagedir) ?></a>
-         <a style="display:none"><?php echo Horde::img('arrow_expanded.png', 'v', array('title' => _("Collapse Headers")), $imagedir) ?></a>
+         <a><?php echo Horde::img('arrow_collapsed.png', '>', array('title' => _("Expand Headers"))) ?></a>
+         <a style="display:none"><?php echo Horde::img('arrow_expanded.png', 'v', array('title' => _("Collapse Headers"))) ?></a>
          <?php echo Horde::img('attachment.png', '', array('class' => 'attachmentImage', 'style' => 'display:none')) ?>
         </div>
         <div id="msgHeadersColl">
@@ -309,7 +304,7 @@ function _simpleButton($id, $text, $image, $imagedir = null)
           <div id="msg_newwin_options"><?php echo $newwin ?><a><?php echo _("Open in new window") ?></a></div>
           <div id="msg_print"><?php echo Horde::img('print.png', '', '', $hordeimg) ?><a><?php echo _("Print") ?></a></div>
 <?php if (!empty($conf['user']['allow_view_source'])): ?>
-          <div id="msg_view_source"><?php echo Horde::img('message_source.png', '', '', $imagedir) ?><a><?php echo _("View Message Source") ?></a></div>
+          <div id="msg_view_source"><?php echo Horde::img('message_source.png') ?><a><?php echo _("View Message Source") ?></a></div>
 <?php endif; ?>
          </div>
          <div id="msgHeadersContent">
@@ -336,7 +331,7 @@ function _simpleButton($id, $text, $image, $imagedir = null)
              <td class="cc"></td>
             </tr>
             <tr id="msgAtc" style="display:none">
-             <td class="label"><?php echo $attachment ?><?php echo Horde::link('') . Horde::img('arrow_collapsed.png', '', array('id' => 'partlist_col'), $imagedir) . Horde::img('arrow_expanded.png', '', array('id' => 'partlist_exp', 'style' => 'display:none'), $imagedir) . ' ' . $attachment ?></a></td>
+             <td class="label"><?php echo $attachment ?><?php echo Horde::link('') . Horde::img('arrow_collapsed.png', '', array('id' => 'partlist_col')) . Horde::img('arrow_expanded.png', '', array('id' => 'partlist_exp', 'style' => 'display:none')) . ' ' . $attachment ?></a></td>
              <td>
               <div></div>
               <table id="partlist" style="display:none" cellspacing="2">
@@ -379,9 +374,9 @@ function _simpleButton($id, $text, $image, $imagedir = null)
 </div>
 
 <div class="context" id="ctx_message" style="display:none">
- <a id="ctx_message_reply"><?php echo Horde::img('reply.png', '', '', $imagedir) . _("Reply to Sender") ?></a>
- <a id="ctx_message_reply_all"><?php echo Horde::img('replyall.png', '', '', $imagedir) . _("Reply to All") ?></a>
- <a id="ctx_message_reply_list"><?php echo Horde::img('replyall.png', '', '', $imagedir) . _("Reply to List") ?></a>
+ <a id="ctx_message_reply"><?php echo Horde::img('reply.png') . _("Reply to Sender") ?></a>
+ <a id="ctx_message_reply_all"><?php echo Horde::img('replyall.png') . _("Reply to All") ?></a>
+ <a id="ctx_message_reply_list"><?php echo Horde::img('replyall.png') . _("Reply to List") ?></a>
  <div class="sep"></div>
  <a id="ctx_message_forward_all"><?php echo $forward . _("Forward Entire Message") ?></a>
  <a id="ctx_message_forward_body"><?php echo $forward . _("Forward Body Text Only") ?></a>
@@ -393,16 +388,16 @@ function _simpleButton($id, $text, $image, $imagedir = null)
  <a id="ctx_message_clear"><?php echo $clearflag . _("Clear Flag") ?></a>
  <div class="sep"></div>
 <?php if (!empty($conf['spam']['reporting'])): ?>
- <a id="ctx_message_spam"><?php echo Horde::img('spam.png', '', '', $imagedir) . _("Mark as Spam") ?></a>
+ <a id="ctx_message_spam"><?php echo Horde::img('spam.png') . _("Mark as Spam") ?></a>
 <?php endif; ?>
 <?php if (!empty($conf['notspam']['reporting'])): ?>
- <a id="ctx_message_ham"><?php echo Horde::img('ham.png', '', '', $imagedir) . _("Mark as Innocent") ?></a>
+ <a id="ctx_message_ham"><?php echo Horde::img('ham.png') . _("Mark as Innocent") ?></a>
 <?php endif; ?>
 <?php if ($has_blacklist): ?>
- <a id="ctx_message_blacklist"><?php echo Horde::img('blacklist.png', '', '', $imagedir) . _("Blacklist") ?></a>
+ <a id="ctx_message_blacklist"><?php echo Horde::img('blacklist.png') . _("Blacklist") ?></a>
 <?php endif; ?>
 <?php if ($has_whitelist): ?>
- <a id="ctx_message_whitelist"><?php echo Horde::img('whitelist.png', '', '', $imagedir) . _("Whitelist") ?></a>
+ <a id="ctx_message_whitelist"><?php echo Horde::img('whitelist.png') . _("Whitelist") ?></a>
 <?php endif; ?>
  <a id="ctx_message_deleted"><?php echo $delete . _("Delete") ?></a>
 <?php if (!$usetrash): ?>
@@ -411,7 +406,7 @@ function _simpleButton($id, $text, $image, $imagedir = null)
 </div>
 
 <div class="context" id="ctx_draft" style="display:none">
- <a id="ctx_draft_resume"><?php echo Horde::img('mail_draft.png', '', '', $imagedir) . _("Resume Draft") ?></a>
+ <a id="ctx_draft_resume"><?php echo Horde::img('mail_draft.png') . _("Resume Draft") ?></a>
  <div class="sep"></div>
  <a id="ctx_draft_flagged"><?php echo $flagged . _("Flag Message") ?></a>
  <a id="ctx_draft_clear"><?php echo $clearflag . _("Clear Flag") ?></a>
@@ -423,9 +418,9 @@ function _simpleButton($id, $text, $image, $imagedir = null)
 </div>
 
 <div class="context" id="ctx_reply" style="display:none;">
- <a id="ctx_reply_reply"><?php echo Horde::img('replyall.png', '', '', $imagedir) . _("To Sender") ?></a>
- <a id="ctx_reply_reply_all"><?php echo Horde::img('replyall.png', '', '', $imagedir) . _("To All") ?></a>
- <a id="ctx_reply_reply_list"><?php echo Horde::img('replyall.png', '', '', $imagedir) . _("To List") ?></a>
+ <a id="ctx_reply_reply"><?php echo Horde::img('replyall.png') . _("To Sender") ?></a>
+ <a id="ctx_reply_reply_all"><?php echo Horde::img('replyall.png') . _("To All") ?></a>
+ <a id="ctx_reply_reply_list"><?php echo Horde::img('replyall.png') . _("To List") ?></a>
 </div>
 
 <div class="context" id="ctx_forward" style="display:none">
@@ -444,10 +439,10 @@ function _simpleButton($id, $text, $image, $imagedir = null)
  <div class="sep" id="oa_sep1"></div>
 <?php if ($has_blacklist || $has_whitelist): ?>
 <?php if ($has_blacklist): ?>
- <a id="oa_blacklist"><?php echo Horde::img('blacklist.png', '', '', $imagedir) . _("Blacklist") ?></a>
+ <a id="oa_blacklist"><?php echo Horde::img('blacklist.png') . _("Blacklist") ?></a>
 <?php endif; ?>
 <?php if ($has_whitelist): ?>
- <a id="oa_whitelist"><?php echo Horde::img('whitelist.png', '', '', $imagedir) . _("Whitelist") ?></a>
+ <a id="oa_whitelist"><?php echo Horde::img('whitelist.png') . _("Whitelist") ?></a>
 <?php endif; ?>
  <div class="sep" id="oa_sep2"></div>
 <?php endif; ?>
@@ -464,7 +459,7 @@ function _simpleButton($id, $text, $image, $imagedir = null)
 </div>
 
 <div style="display:none">
- <?php echo Horde::img('popdown.png', 'v', array('class' => 'popdown', 'id' => 'popdown_img'), $imagedir) ?>
+ <?php echo Horde::img('popdown.png', 'v', array('class' => 'popdown', 'id' => 'popdown_img')) ?>
  <?php echo Horde::img('mail_priority_high.png', _("High Priority"), array('id' => 'high_priority_img')) ?>
  <?php echo Horde::img('mail_priority_low.png', _("Low Priority"), array('id' => 'low_priority_img')) ?>
  <?php foreach ($thread_imgs as $val) { echo $val; } ?>