From 6466012b0d2379a8f6b6083865d4e467422cf669 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Wed, 28 Oct 2009 15:39:55 -0600 Subject: [PATCH] index -> UID When dealing with IMAP UIDs, universally refer to this value as 'uid' rather than 'index' to avoid confusion with IMAP mailbox sequence numbers. --- imp/ajax.php | 18 +++++----- imp/compose-dimp.php | 30 ++++++++-------- imp/compose-mimp.php | 24 ++++++------- imp/compose.php | 24 ++++++------- imp/js/DimpBase.js | 36 +++++++++---------- imp/js/compose-dimp.js | 4 +-- imp/js/fullmessage-dimp.js | 11 +++--- imp/lib/Compose.php | 30 ++++++++-------- imp/lib/Contents.php | 62 ++++++++++++++++----------------- imp/lib/IMP.php | 15 ++++---- imp/lib/Mailbox.php | 17 +++++---- imp/lib/Mime/Viewer/Pgp.php | 4 +-- imp/lib/Mime/Viewer/Smime.php | 2 +- imp/lib/Views/ShowMessage.php | 32 ++++++++--------- imp/mailbox-mimp.php | 2 +- imp/mailbox.php | 2 +- imp/message-dimp.php | 10 +++--- imp/message-mimp.php | 30 ++++++++-------- imp/message.php | 41 +++++++++++----------- imp/saveimage.php | 6 ++-- imp/templates/compose/redirect-mimp.inc | 5 ++- imp/thread.php | 4 +-- 22 files changed, 204 insertions(+), 205 deletions(-) diff --git a/imp/ajax.php b/imp/ajax.php index 080a37099..3671a2fe8 100644 --- a/imp/ajax.php +++ b/imp/ajax.php @@ -532,9 +532,9 @@ case 'ShowPreview': $ptr = each($indices); $args = array( - 'index' => intval(reset($ptr['value'])), 'mailbox' => $ptr['key'], 'preview' => true, + 'uid' => intval(reset($ptr['value'])) ); /* We know we are going to be exclusively dealing with this mailbox, so @@ -551,8 +551,8 @@ case 'ShowPreview': $result = new stdClass; $result->error = $e->getMessage(); $result->errortype = 'horde.error'; - $result->index = $args['index']; $result->mailbox = $args['mailbox']; + $result->uid = $args['uid']; } break; @@ -619,10 +619,10 @@ case 'CancelCompose': case 'DeleteDraft': $imp_compose = IMP_Compose::singleton(Horde_Util::getPost('imp_compose')); $imp_compose->destroy(); - $draft_index = $imp_compose->getMetadata('draft_index'); - if ($draft_index && ($action == 'DeleteDraft')) { + $draft_uid = $imp_compose->getMetadata('draft_uid'); + if ($draft_uid && ($action == 'DeleteDraft')) { $imp_message = IMP_Message::singleton(); - $idx_array = array($draft_index . IMP::IDX_SEP . IMP::folderPref($prefs->getValue('drafts_folder'), true)); + $idx_array = array($draft_uid . IMP::IDX_SEP . IMP::folderPref($prefs->getValue('drafts_folder'), true)); $imp_message->delete($idx_array, array('nuke' => true)); } $result = true; @@ -759,8 +759,8 @@ case 'ModifyPollFolder': break; case 'SendMDN': - $index = Horde_Util::getPost('index'); - if (empty($mbox) || empty($index)) { + $uid = Horde_Util::getPost('uid'); + if (empty($mbox) || empty($uid)) { break; } @@ -768,13 +768,13 @@ case 'SendMDN': try { $fetch_ret = $imp_imap->ob()->fetch($mbox, array( Horde_Imap_Client::FETCH_HEADERTEXT => array(array('parse' => true, 'peek' => false)) - ), array('ids' => array($index))); + ), array('ids' => array($uid))); } catch (Horde_Imap_Client_Exception $e) { break; } $imp_ui = new IMP_UI_Message(); - $imp_ui->MDNCheck($mbox, $index, $reset($fetch_ret[$index]['headertext']), true); + $imp_ui->MDNCheck($mbox, $uid, $reset($fetch_ret[$uid]['headertext']), true); break; case 'PGPSymmetric': diff --git a/imp/compose-dimp.php b/imp/compose-dimp.php index 2f072cca0..84fa93e42 100644 --- a/imp/compose-dimp.php +++ b/imp/compose-dimp.php @@ -17,11 +17,11 @@ * @package IMP */ -function _removeAutoSaveDraft($index) +function _removeAutoSaveDraft($uid) { - if (!empty($index)) { + if (!empty($uid)) { $imp_message = IMP_Message::singleton(); - $imp_message->delete(array($index . IMP::IDX_SEP . IMP::folderPref($GLOBALS['prefs']->getValue('drafts_folder'), true)), array('nuke' => true)); + $imp_message->delete(array($uid . IMP::IDX_SEP . IMP::folderPref($GLOBALS['prefs']->getValue('drafts_folder'), true)), array('nuke' => true)); } } @@ -96,13 +96,13 @@ if (count($_POST)) { /* Save the draft. */ try { - $old_index = $imp_compose->getMetadata('draft_index'); + $old_uid = $imp_compose->getMetadata('draft_uid'); $res = $imp_compose->saveDraft($header, Horde_Util::getFormData('message', ''), Horde_Nls::getCharset(), Horde_Util::getFormData('html')); $result->success = 1; /* Delete existing draft. */ - _removeAutoSaveDraft($old_index); + _removeAutoSaveDraft($old_uid); if ($action == 'auto_save_draft') { $notification->push(_("Draft automatically saved."), 'horde.message'); @@ -139,7 +139,7 @@ if (count($_POST)) { $message = Horde_Util::getFormData('message'); $html = Horde_Util::getFormData('html'); - $result->index = $imp_compose->getMetadata('index'); + $result->uid = $imp_compose->getMetadata('uid'); if ($reply_type = $imp_compose->getMetadata('reply_type')) { $result->reply_folder = $imp_compose->getMetadata('mailbox'); @@ -173,7 +173,7 @@ if (count($_POST)) { /* Remove any auto-saved drafts. */ if ($prefs->getValue('auto_save_drafts') || $prefs->getValue('auto_delete_drafts')) { - _removeAutoSaveDraft($imp_compose->getMetadata('draft_index')); + _removeAutoSaveDraft($imp_compose->getMetadata('draft_uid')); $result->draft_delete = 1; } @@ -205,21 +205,21 @@ $imp_ui->attachAutoCompleter(array('to', 'cc', 'bcc')); $imp_ui->attachSpellChecker('dimp'); $type = Horde_Util::getFormData('type'); -$index = Horde_Util::getFormData('uid'); +$uid = Horde_Util::getFormData('uid'); $folder = Horde_Util::getFormData('folder'); $show_editor = false; $title = _("New Message"); if (in_array($type, array('reply', 'reply_all', 'reply_list', 'forward', 'resume'))) { - if (!$index || !$folder) { + if (!$uid || !$folder) { $type = 'new'; } try { - $imp_contents = IMP_Contents::singleton($index . IMP::IDX_SEP . $folder); + $imp_contents = IMP_Contents::singleton($uid . IMP::IDX_SEP . $folder); } catch (Horde_Exception $e) { $notification->push(_("Requested message not found."), 'horde.error'); - $index = $folder = null; + $uid = $folder = null; $type = 'new'; } } @@ -252,7 +252,7 @@ case 'reply_list': break; case 'forward': - $fwd_msg = $imp_ui->getForwardData($imp_compose, $imp_contents, $index . IMP::IDX_SEP . $folder); + $fwd_msg = $imp_ui->getForwardData($imp_compose, $imp_contents, $uid . IMP::IDX_SEP . $folder); $msg = $fwd_msg['body']; $header = $fwd_msg['headers']; $header['replytype'] = 'forward'; @@ -270,7 +270,7 @@ case 'forward': case 'resume': try { - $result = $imp_compose->resumeDraft($index . IMP::IDX_SEP . $folder); + $result = $imp_compose->resumeDraft($uid . IMP::IDX_SEP . $folder); if ($result['mode'] == 'html') { $show_editor = true; @@ -308,10 +308,10 @@ $t->setOption('gettext', true); $t->set('title', $title); $compose_result = IMP_Views_Compose::showCompose(array( - 'folder' => $folder, - 'index' => $index, 'composeCache' => $imp_compose->getCacheId(), + 'folder' => $folder, 'qreply' => false, + 'uid' => $uid )); $t->set('compose_html', $compose_result['html']); diff --git a/imp/compose-mimp.php b/imp/compose-mimp.php index f91c935f2..1580712ba 100644 --- a/imp/compose-mimp.php +++ b/imp/compose-mimp.php @@ -12,13 +12,13 @@ * @package IMP */ -function _getIMPContents($index, $mailbox) +function _getIMPContents($uid, $mailbox) { - if (empty($index)) { + if (empty($uid)) { return false; } try { - $imp_contents = IMP_Contents::singleton($index . IMP::IDX_SEP . $mailbox); + $imp_contents = IMP_Contents::singleton($uid . IMP::IDX_SEP . $mailbox); return $imp_contents; } catch (Horde_Exception $e) { $GLOBALS['notification']->push(_("Could not retrieve the message from the mail server."), 'horde.error'); @@ -44,8 +44,8 @@ if (!$prefs->isLocked('default_identity')) { $save_sent_mail = $prefs->getValue('save_sent_mail'); $sent_mail_folder = $identity->getValue('sent_mail_folder'); -$index = Horde_Util::getFormData('index'); $thismailbox = Horde_Util::getFormData('thismailbox'); +$uid = Horde_Util::getFormData('uid'); $resume_draft = false; /* Determine if mailboxes are readonly. */ @@ -70,7 +70,7 @@ switch ($actionID) { // 'd' = draft case 'd': try { - $result = $imp_compose->resumeDraft($index . IMP::IDX_SEP . $thismailbox); + $result = $imp_compose->resumeDraft($uid . IMP::IDX_SEP . $thismailbox); $msg = $result['msg']; $header = array_merge($header, $result['header']); @@ -109,7 +109,7 @@ case _("Expand Names"): case 'r': case 'ra': case 'rl': - if (!($imp_contents = _getIMPContents($index, $thismailbox))) { + if (!($imp_contents = _getIMPContents($uid, $thismailbox))) { break; } $actions = array('r' => 'reply', 'ra' => 'reply_all', 'rl' => 'reply_list'); @@ -121,7 +121,7 @@ case 'rl': // 'f' = forward case 'f': - if (!($imp_contents = _getIMPContents($index, $thismailbox))) { + if (!($imp_contents = _getIMPContents($uid, $thismailbox))) { break; } $fwd_msg = $imp_compose->forwardMessage($imp_contents); @@ -131,7 +131,7 @@ case 'f': break; case _("Redirect"): - if (!($imp_contents = _getIMPContents($index, $thismailbox))) { + if (!($imp_contents = _getIMPContents($uid, $thismailbox))) { break; } @@ -173,11 +173,11 @@ case _("Send"): $f_cc = $f_bcc = null; $header = array(); - $index = $imp_compose->getMetadata('index'); $thismailbox = $imp_compose->getMetadata('mailbox'); + $uid = $imp_compose->getMetadata('uid'); if ($ctype = $imp_compose->getMetadata('reply_type')) { - if (!($imp_contents = _getIMPContents($index, $thismailbox))) { + if (!($imp_contents = _getIMPContents($uid, $thismailbox))) { break; } @@ -192,7 +192,7 @@ case _("Send"): $fwd_msg = $imp_compose->forwardMessage($imp_contents); $msg = $fwd_msg['body']; $message .= "\n" . $msg; - $imp_compose->attachIMAPMessage(array($index . IMP::IDX_SEP . $thismailbox), $header); + $imp_compose->attachIMAPMessage(array($uid . IMP::IDX_SEP . $thismailbox), $header); break; } } @@ -246,7 +246,7 @@ case _("Send"): if (Horde_Util::getFormData('resume_draft') && $prefs->getValue('auto_delete_drafts')) { $imp_message = IMP_Message::singleton(); - $idx_array = array($index . IMP::IDX_SEP . $thismailbox); + $idx_array = array($uid . IMP::IDX_SEP . $thismailbox); $delete_draft = $imp_message->delete($idx_array, array('nuke' => true)); } diff --git a/imp/compose.php b/imp/compose.php index b29a21f4f..a54a9bdcb 100644 --- a/imp/compose.php +++ b/imp/compose.php @@ -40,14 +40,14 @@ function _popupSuccess() require $GLOBALS['registry']->get('templates', 'horde') . '/common-footer.inc'; } -function _getIMPContents($index, $mailbox) +function _getIMPContents($uid, $mailbox) { - if (empty($index)) { + if (empty($uid)) { return false; } try { - $imp_contents = IMP_Contents::singleton($index . IMP::IDX_SEP . $mailbox); + $imp_contents = IMP_Contents::singleton($uid . IMP::IDX_SEP . $mailbox); return $imp_contents; } catch (Horde_Exception $e) { $GLOBALS['notification']->push(_("Could not retrieve the message from the mail server."), 'horde.error'); @@ -112,8 +112,8 @@ if ($actionID) { $save_sent_mail = Horde_Util::getFormData('save_sent_mail'); $sent_mail_folder = $identity->getValue('sent_mail_folder'); -$index = Horde_Util::getFormData('index'); $thismailbox = Horde_Util::getFormData('thismailbox'); +$uid = Horde_Util::getFormData('uid'); /* Check for duplicate submits. */ if ($token = Horde_Util::getFormData('compose_formToken')) { @@ -245,7 +245,7 @@ if ($_SESSION['imp']['file_upload']) { $title = _("New Message"); switch ($actionID) { case 'mailto': - if (!($imp_contents = _getIMPContents($index, $thismailbox))) { + if (!($imp_contents = _getIMPContents($uid, $thismailbox))) { break; } $imp_headers = $imp_contents->getHeaderOb(); @@ -273,7 +273,7 @@ case 'mailto_link': case 'draft': try { - $result = $imp_compose->resumeDraft($index . IMP::IDX_SEP . $thismailbox); + $result = $imp_compose->resumeDraft($uid . IMP::IDX_SEP . $thismailbox); if (!is_null($rtemode)) { $rtemode = ($result['mode'] == 'html'); @@ -306,7 +306,7 @@ case 'redirect_expand_addr': case 'reply': case 'reply_all': case 'reply_list': - if (!($imp_contents = _getIMPContents($index, $thismailbox))) { + if (!($imp_contents = _getIMPContents($uid, $thismailbox))) { break; } @@ -332,11 +332,11 @@ case 'reply_list': break; case 'forward': - if (!($imp_contents = _getIMPContents($index, $thismailbox))) { + if (!($imp_contents = _getIMPContents($uid, $thismailbox))) { break; } - $fwd_msg = $imp_ui->getForwardData($imp_compose, $imp_contents, $index . IMP::IDX_SEP . $thismailbox); + $fwd_msg = $imp_ui->getForwardData($imp_compose, $imp_contents, $uid . IMP::IDX_SEP . $thismailbox); $msg = $fwd_msg['body']; $header = $fwd_msg['headers']; $format = $fwd_msg['format']; @@ -350,7 +350,7 @@ case 'redirect_compose': break; case 'redirect_send': - if (!($imp_contents = _getIMPContents($index, $thismailbox))) { + if (!($imp_contents = _getIMPContents($uid, $thismailbox))) { break; } @@ -447,7 +447,7 @@ case 'send_message': $prefs->getValue('auto_delete_drafts') && ($thismailbox == IMP::folderPref($prefs->getValue('drafts_folder'), true))) { $imp_message = IMP_Message::singleton(); - $idx_array = array($index . IMP::IDX_SEP . $thismailbox); + $idx_array = array($uid . IMP::IDX_SEP . $thismailbox); if ($imp_message->delete($idx_array)) { $notification->push(_("The draft message was automatically deleted because it was successfully completed and sent."), 'horde.success'); } @@ -818,7 +818,7 @@ $t->set('allow_compose', !$compose_disable); if ($redirect) { /* Prepare the redirect template. */ $t->set('mailbox', htmlspecialchars($thismailbox)); - $t->set('index', htmlspecialchars($index)); + $t->set('uid', htmlspecialchars($uid)); $t->set('status', Horde_Util::bufferOutput(array('IMP', 'status'))); $t->set('title', htmlspecialchars($title)); $t->set('token', Horde::getRequestToken('imp.compose')); diff --git a/imp/js/DimpBase.js b/imp/js/DimpBase.js index 54253f0c7..93763a6da 100644 --- a/imp/js/DimpBase.js +++ b/imp/js/DimpBase.js @@ -1049,7 +1049,7 @@ var DimpBase = { t = $('msgHeadersContent').down('THEAD'); if (!r.error) { - search = this.viewport.getSelection().search({ imapuid: { equal: [ r.index ] }, view: { equal: [ r.mailbox ] } }); + search = this.viewport.getSelection().search({ imapuid: { equal: [ r.uid ] }, view: { equal: [ r.mailbox ] } }); if (search.size()) { row = search.get('dataob').first(); this.updateSeenUID(row, 1); @@ -1057,7 +1057,7 @@ var DimpBase = { } if (this.pp && - (this.pp.imapuid != r.index || + (this.pp.imapuid != r.uid || this.pp.view != r.mailbox)) { return; } @@ -1071,7 +1071,7 @@ var DimpBase = { } // Store in cache. - ppuid = this._getPPId(r.index, r.mailbox); + ppuid = this._getPPId(r.uid, r.mailbox); this._expirePPCache([ ppuid ]); this.ppcache[ppuid] = resp; this.ppfifo.push(ppuid); @@ -1130,14 +1130,14 @@ var DimpBase = { this._addHistory('msg:' + row.view + ':' + row.imapuid); }, - // opts = index, mailbox + // opts = mailbox, uid updateMsgLog: function(log, opts) { var tmp; if (!opts || (this.pp && - this.pp.imapuid == opts.index && + this.pp.imapuid == opts.uid && this.pp.view == opts.mailbox)) { $('msgLogInfo').show(); @@ -1150,7 +1150,7 @@ var DimpBase = { } if (opts) { - tmp = this._getPPId(opts.index, opts.mailbox); + tmp = this._getPPId(opts.uid, opts.mailbox); if (this.ppcache[tmp]) { this.ppcache[tmp].response.log = log; } @@ -1197,9 +1197,9 @@ var DimpBase = { } }, - _getPPId: function(index, mailbox) + _getPPId: function(uid, mailbox) { - return index + '|' + mailbox; + return uid + '|' + mailbox; }, // Labeling functions @@ -1751,7 +1751,7 @@ var DimpBase = { return; case 'msg_view_source': - DimpCore.popupWindow(DimpCore.addURLParam(DIMP.conf.URI_VIEW, { uid: this.pp.imapuid, mailbox: this.pp.view, actionID: 'view_source', id: 0 }, true), DIMP.conf.msg_index + '|' + DIMP.conf.msg_folder); + DimpCore.popupWindow(DimpCore.addURLParam(DIMP.conf.URI_VIEW, { uid: this.pp.imapuid, mailbox: this.pp.view, actionID: 'view_source', id: 0 }, true), this.pp.imapuid + '|' + this.pp.view); break; case 'applicationfolders': @@ -2320,14 +2320,14 @@ var DimpBase = { if (opts.vs) { vs = opts.vs; - } else if (opts.index) { + } else if (opts.uid) { if (opts.mailbox) { - vs = this.viewport.getSelection().search({ imapuid: { equal: [ opts.index ] }, view: { equal: [ opts.mailbox ] } }); + vs = this.viewport.getSelection().search({ imapuid: { equal: [ opts.uid ] }, view: { equal: [ opts.mailbox ] } }); if (!vs.size() && opts.mailbox != this.folder) { - vs = this.viewport.getSelection(opts.mailbox).search({ imapuid: { equal: [ opts.index ] } }); + vs = this.viewport.getSelection(opts.mailbox).search({ imapuid: { equal: [ opts.uid ] } }); } } else { - vs = this.viewport.createSelection('dataob', opts.index); + vs = this.viewport.createSelection('dataob', opts.uid); } } else { vs = this.viewport.getSelected(); @@ -2344,7 +2344,7 @@ var DimpBase = { // This needs to be synchronous Ajax if we are calling from a // popup window because Mozilla will not correctly call the // callback function if the calling window has been closed. - DimpCore.doAction(type, this.viewport.addRequestParams(args), vs, this._deleteCallback.bind(this), { asynchronous: !(opts.index && opts.mailbox) }); + DimpCore.doAction(type, this.viewport.addRequestParams(args), vs, this._deleteCallback.bind(this), { asynchronous: !(opts.uid && opts.mailbox) }); return vs; } @@ -2352,7 +2352,7 @@ var DimpBase = { }, // spam = (boolean) True for spam, false for innocent - // opts = 'index', 'mailbox' + // opts = 'mailbox', 'uid' reportSpam: function(spam, opts) { opts = opts || {}; @@ -2364,14 +2364,14 @@ var DimpBase = { }, // blacklist = (boolean) True for blacklist, false for whitelist - // opts = 'index', 'mailbox' + // opts = 'mailbox', 'uid' blacklist: function(blacklist, opts) { opts = opts || {}; this._doMsgAction('Blacklist', opts, { blacklist: blacklist }); }, - // opts = 'index', 'mailbox' + // opts = 'mailbox', 'uid' deleteMsg: function(opts) { opts = opts || {}; @@ -2394,7 +2394,7 @@ var DimpBase = { // flag = (string) IMAP flag name // set = (boolean) True to set flag - // opts = (Object) 'index', 'mailbox', 'noserver' + // opts = (Object) 'mailbox', 'noserver', 'uid' flag: function(flag, set, opts) { opts = opts || {}; diff --git a/imp/js/compose-dimp.js b/imp/js/compose-dimp.js index 0a154b351..2fa910842 100644 --- a/imp/js/compose-dimp.js +++ b/imp/js/compose-dimp.js @@ -260,7 +260,7 @@ var DimpCompose = { this.button_pressed = false; if (this.is_popup) { if (d.reply_type) { - DIMP.baseWindow.DimpBase.flag(d.reply_type == 'reply' ? '\\answered' : '$forwarded', true, { index: d.index, mailbox: d.reply_folder, noserver: true }); + DIMP.baseWindow.DimpBase.flag(d.reply_type == 'reply' ? '\\answered' : '$forwarded', true, { uid: d.uid, mailbox: d.reply_folder, noserver: true }); } // @TODO: Needed? @@ -273,7 +273,7 @@ var DimpCompose = { } if (d.log) { - DIMP.baseWindow.DimpBase.updateMsgLog(d.log, { index: d.index, mailbox: d.reply_folder }); + DIMP.baseWindow.DimpBase.updateMsgLog(d.log, { uid: d.uid, mailbox: d.reply_folder }); } if (!DIMP.conf_compose.qreply) { diff --git a/imp/js/fullmessage-dimp.js b/imp/js/fullmessage-dimp.js index e7e7814b6..a674d88bf 100644 --- a/imp/js/fullmessage-dimp.js +++ b/imp/js/fullmessage-dimp.js @@ -7,12 +7,11 @@ var DimpFullmessage = { - // Variables defaulting to empty/false: - // index, mailbox + // Variables defaulting to empty/false: mailbox, uid quickreply: function(type) { var func, ob = {}; - ob[this.mailbox] = [ this.index ]; + ob[this.mailbox] = [ this.uid ]; $('msgData').hide(); $('qreply').show(); @@ -95,9 +94,9 @@ var DimpFullmessage = { case 'button_spam': if (id == 'button_deleted') { if (DIMP.baseWindow && DIMP.baseWindow.DimpBase) { - DIMP.baseWindow.DimpBase.deleteMsg({ index: this.index, mailbox: this.mailbox }); + DIMP.baseWindow.DimpBase.deleteMsg({ uid: this.uid, mailbox: this.mailbox }); } else { - DIMP.baseWindow.DimpBase.reportSpam(id == 'button_spam', { index: this.index, mailbox: this.mailbox }); + DIMP.baseWindow.DimpBase.reportSpam(id == 'button_spam', { uid: this.uid, mailbox: this.mailbox }); } window.close(); } @@ -126,7 +125,7 @@ var DimpFullmessage = { break; case 'msg_view_source': - DimpCore.popupWindow(DimpCore.addURLParam(DIMP.conf.URI_VIEW, { uid: this.index, mailbox: this.mailbox, actionID: 'view_source', id: 0 }, true), DIMP.conf.msg_index + '|' + DIMP.conf.msg_folder); + DimpCore.popupWindow(DimpCore.addURLParam(DIMP.conf.URI_VIEW, { uid: this.uid, mailbox: this.mailbox, actionID: 'view_source', id: 0 }, true), this.uid + '|' + this.mailbox); break; case 'qreply': diff --git a/imp/lib/Compose.php b/imp/lib/Compose.php index f86fada9b..be7d50252 100644 --- a/imp/lib/Compose.php +++ b/imp/lib/Compose.php @@ -247,7 +247,7 @@ class IMP_Compose 'username' => $GLOBALS['imp_imap']->ob()->getParam('username'), 'hostspec' => $GLOBALS['imp_imap']->ob()->getParam('hostspec'), 'mailbox' => $this->_metadata['mailbox'], - 'uid' => $this->_metadata['index'], + 'uid' => $this->_metadata['uid'], 'uidvalidity' => $GLOBALS['imp_imap']->checkUidvalidity($this->_metadata['mailbox']) )); @@ -299,11 +299,11 @@ class IMP_Compose /* Add the message to the mailbox. */ try { $ids = $GLOBALS['imp_imap']->ob()->append($drafts_mbox, array(array('data' => $data, 'flags' => $append_flags, 'messageid' => $headers->getValue('message-id')))); - $this->_metadata['draft_index'] = reset($ids); + $this->_metadata['draft_uid'] = reset($ids); $this->_modified = true; return sprintf(_("The draft has been saved to the \"%s\" folder."), IMP::displayFolder($drafts_mbox)); } catch (Horde_Imap_Client_Exception $e) { - unset($this->_metadata['draft_index']); + unset($this->_metadata['draft_uid']); $this->_modified = true; return _("The draft was not successfully saved."); } @@ -312,8 +312,8 @@ class IMP_Compose /** * Resumes a previously saved draft message. * - * @param string $index The IMAP message mailbox/index. The index should - * be in IMP::parseIndicesList() format #1. + * @param string $uid The IMAP message mailbox/index. The uid should + * be in IMP::parseIndicesList() format #1. * * @return mixed An array with the following keys: *
@@ -324,10 +324,10 @@ class IMP_Compose
      * 
* @throws IMP_Compose_Exception */ - public function resumeDraft($index) + public function resumeDraft($uid) { try { - $contents = IMP_Contents::singleton($index); + $contents = IMP_Contents::singleton($uid); } catch (Horde_Exception $e) { throw new IMP_Compose_Exception($e); } @@ -391,14 +391,14 @@ class IMP_Compose // catch any true server/backend changes. ($GLOBALS['imp_imap']->checkUidvalidity($imap_url['mailbox']) == $imap_url['uidvalidity']) && IMP_Contents::singleton($imap_url['uid'] . IMP::IDX_SEP . $imap_url['mailbox'])) { - $this->_metadata['index'] = $imap_url['uid']; $this->_metadata['mailbox'] = $imap_url['mailbox']; $this->_metadata['reply_type'] = $reply_type; + $this->_metadata['uid'] = $imap_url['uid']; } } catch (Horde_Exception $e) {} } - list($this->_metadata['draft_index'],) = explode(IMP::IDX_SEP, $index); + list($this->_metadata['draft_uid'],) = explode(IMP::IDX_SEP, $uid); $this->_modified = true; return array( @@ -591,20 +591,20 @@ class IMP_Compose } $imp_message = IMP_Message::singleton(); - $reply_index = array($this->_metadata['index'] . IMP::IDX_SEP . $this->_metadata['mailbox']); + $reply_uid = array($this->_metadata['uid'] . IMP::IDX_SEP . $this->_metadata['mailbox']); switch ($this->_metadata['reply_type']) { case 'reply': /* Make sure to set the IMAP reply flag and unset any * 'flagged' flag. */ - $imp_message->flag(array('\\answered'), $reply_index); - $imp_message->flag(array('\\flagged'), $reply_index, false); + $imp_message->flag(array('\\answered'), $reply_uid); + $imp_message->flag(array('\\flagged'), $reply_uid, false); break; case 'forward': /* Set the '$Forwarded' flag, if possible, in the mailbox. * See RFC 5550 [5.9] */ - $imp_message->flag(array('$Forwarded'), $reply_index); + $imp_message->flag(array('$Forwarded'), $reply_uid); break; } } @@ -1261,9 +1261,9 @@ class IMP_Compose $h = $contents->getHeaderOb(); $match_identity = $this->_getMatchingIdentity($h); - $this->_metadata['index'] = $contents->getIndex(); $this->_metadata['mailbox'] = $contents->getMailbox(); $this->_metadata['reply_type'] = 'reply'; + $this->_metadata['uid'] = $contents->getUid(); $this->_modified = true; /* Set the message-id related headers. */ @@ -1445,8 +1445,8 @@ class IMP_Compose $format = 'text'; $msg = ''; - $this->_metadata['index'] = $contents->getIndex(); $this->_metadata['mailbox'] = $contents->getMailbox(); + $this->_metadata['uid'] = $contents->getUid(); /* We need the Message-Id so we can log this event. This header is not * added to the outgoing messages. */ diff --git a/imp/lib/Contents.php b/imp/lib/Contents.php index 95d4eeeb3..64d49b2c8 100644 --- a/imp/lib/Contents.php +++ b/imp/lib/Contents.php @@ -57,11 +57,11 @@ class IMP_Contents static protected $_mimepartid = 1; /** - * The IMAP index of the message. + * The IMAP UID of the message. * * @var integer */ - protected $_index = null; + protected $_uid = null; /** * The mailbox of the current message. @@ -91,7 +91,7 @@ class IMP_Contents * Ensures that only one IMP_Contents instance for any given message is * available at any one time. * - * @param mixed $in Either an index string (see IMP_Contents::singleton() + * @param mixed $in Either a uid string (see IMP_Contents::singleton() * for the format) or a Horde_Mime_Part object. * * @return IMP_Contents The IMP_Contents object. @@ -113,7 +113,7 @@ class IMP_Contents /** * Constructor. * - * @param mixed $in Either an index string (see IMP_Contents::singleton() + * @param mixed $in Either a uid string (see IMP_Contents::singleton() * for the format) or a Horde_Mime_Part object. * @throws Horde_Exception */ @@ -122,33 +122,33 @@ class IMP_Contents if ($in instanceof Horde_Mime_Part) { $this->_message = $in; } else { - list($this->_index, $this->_mailbox) = explode(IMP::IDX_SEP, $in); + list($this->_uid, $this->_mailbox) = explode(IMP::IDX_SEP, $in); - /* Get the Horde_Mime_Part object for the given index. */ + /* Get the Horde_Mime_Part object for the given UID. */ try { $ret = $GLOBALS['imp_imap']->ob()->fetch($this->_mailbox, array( Horde_Imap_Client::FETCH_STRUCTURE => array('parse' => true) - ), array('ids' => array($this->_index))); + ), array('ids' => array($this->_uid))); } catch (Horde_Imap_Client_Exception $e) { throw new Horde_Exception('Error displaying message.'); } - if (!isset($ret[$this->_index]['structure'])) { + if (!isset($ret[$this->_uid]['structure'])) { throw new Horde_Exception('Error displaying message.'); } - $this->_message = $ret[$this->_index]['structure']; + $this->_message = $ret[$this->_uid]['structure']; } } /** - * Returns the IMAP index for the current message. + * Returns the IMAP UID for the current message. * - * @return integer The message index. + * @return integer The message UID. */ - public function getIndex() + public function getUid() { - return $this->_index; + return $this->_uid; } /** @@ -182,8 +182,8 @@ class IMP_Contents try { $res = $GLOBALS['imp_imap']->ob()->fetch($this->_mailbox, array( Horde_Imap_Client::FETCH_BODYTEXT => array(array('peek' => true, 'stream' => !empty($options['stream']))) - ), array('ids' => array($this->_index))); - return $res[$this->_index]['bodytext'][0]; + ), array('ids' => array($this->_uid))); + return $res[$this->_uid]['bodytext'][0]; } catch (Horde_Imap_Client_Exception $e) { return ''; } @@ -239,16 +239,16 @@ class IMP_Contents } try { - $res = $GLOBALS['imp_imap']->ob()->fetch($this->_mailbox, $query, array('ids' => array($this->_index))); + $res = $GLOBALS['imp_imap']->ob()->fetch($this->_mailbox, $query, array('ids' => array($this->_uid))); if (empty($options['mimeheaders'])) { - if (!empty($res[$this->_index]['bodypartdecode'][$id])) { - $this->lastBodyPartDecode = $res[$this->_index]['bodypartdecode'][$id]; + if (!empty($res[$this->_uid]['bodypartdecode'][$id])) { + $this->lastBodyPartDecode = $res[$this->_uid]['bodypartdecode'][$id]; } - return $res[$this->_index]['bodypart'][$id]; + return $res[$this->_uid]['bodypart'][$id]; } elseif (empty($options['stream'])) { - return $res[$this->_index]['mimeheader'][$id] . $res[$this->_index]['bodypart'][$id]; + return $res[$this->_uid]['mimeheader'][$id] . $res[$this->_uid]['bodypart'][$id]; } else { - $swrapper = new Horde_Support_CombineStream(array($res[$this->_index]['mimeheader'][$id], $res[$this->_index]['bodypart'][$id])); + $swrapper = new Horde_Support_CombineStream(array($res[$this->_uid]['mimeheader'][$id], $res[$this->_uid]['bodypart'][$id])); return $swrapper->fopen(); } } catch (Horde_Imap_Client_Exception $e) { @@ -280,13 +280,13 @@ class IMP_Contents $res = $GLOBALS['imp_imap']->ob()->fetch($this->_mailbox, array( Horde_Imap_Client::FETCH_HEADERTEXT => array(array('peek' => true)), Horde_Imap_Client::FETCH_BODYTEXT => array(array('peek' => true, 'stream' => !empty($options['stream']))) - ), array('ids' => array($this->_index))); + ), array('ids' => array($this->_uid))); if (empty($options['stream'])) { - return $res[$this->_index]['headertext'][0] . $res[$this->_index]['bodytext'][0]; + return $res[$this->_uid]['headertext'][0] . $res[$this->_uid]['bodytext'][0]; } - $swrapper = new Horde_Support_CombineStream(array($res[$this->_index]['headertext'][0], $res[$this->_index]['bodytext'][0])); + $swrapper = new Horde_Support_CombineStream(array($res[$this->_uid]['headertext'][0], $res[$this->_uid]['bodytext'][0])); return $swrapper->fopen(); } catch (Horde_Imap_Client_Exception $e) { return empty($options['stream']) @@ -309,8 +309,8 @@ class IMP_Contents try { $res = $GLOBALS['imp_imap']->ob()->fetch($this->_mailbox, array( Horde_Imap_Client::FETCH_HEADERTEXT => array(array('parse' => true, 'peek' => true)) - ), array('ids' => array($this->_index))); - return $res[$this->_index]['headertext'][0]; + ), array('ids' => array($this->_uid))); + return $res[$this->_uid]['headertext'][0]; } catch (Horde_Imap_Client_Exception $e) { return new Horde_Mime_Headers(); } @@ -646,7 +646,7 @@ class IMP_Contents if (($mask && self::SUMMARY_IMAGE_SAVE) && $GLOBALS['registry']->hasMethod('images/selectGalleries') && ($mime_part->getPrimaryType() == 'image')) { - $part['img_save'] = Horde::link('#', _("Save Image in Gallery"), 'saveImgAtc', null, Horde::popupJs(Horde::applicationUrl('saveimage.php'), array('params' => array('index' => ($this->_index . IMP::IDX_SEP . $this->_mailbox), 'id' => $id), 'height' => 200, 'width' => 450)) . 'return false;') . ''; + $part['img_save'] = Horde::link('#', _("Save Image in Gallery"), 'saveImgAtc', null, Horde::popupJs(Horde::applicationUrl('saveimage.php'), array('params' => array('muid' => ($this->_uid . IMP::IDX_SEP . $this->_mailbox), 'id' => $id), 'height' => 200, 'width' => 450)) . 'return false;') . ''; } /* Strip Attachment? Allow stripping of base parts other than the @@ -655,8 +655,8 @@ class IMP_Contents ($id != 0) && (intval($id) != 1) && (strpos($id, '.') === false)) { - $url = Horde_Util::removeParameter(Horde::selfUrl(true), array('actionID', 'imapid', 'index')); - $url = Horde_Util::addParameter($url, array('actionID' => 'strip_attachment', 'imapid' => $id, 'index' => $this->_index, 'message_token' => Horde::getRequestToken('imp.impcontents'))); + $url = Horde_Util::removeParameter(Horde::selfUrl(true), array('actionID', 'imapid', 'uid')); + $url = Horde_Util::addParameter($url, array('actionID' => 'strip_attachment', 'imapid' => $id, 'uid' => $this->_uid, 'message_token' => Horde::getRequestToken('imp.impcontents'))); $part['strip'] = Horde::link($url, _("Strip Attachment"), 'deleteImg', null, "return window.confirm('" . addslashes(_("Are you sure you wish to PERMANENTLY delete this attachment?")) . "');") . ''; } @@ -704,7 +704,7 @@ class IMP_Contents )); if (!is_null($this->_mailbox)) { - $params['uid'] = $this->_index; + $params['uid'] = $this->_uid; $params['mailbox'] = $this->_mailbox; } @@ -736,7 +736,7 @@ class IMP_Contents 'params' => array() ), $options); - return Horde::link($this->urlView($mime_part, $actionID, $options), $options['jstext'], $options['class'], empty($options['dload']) ? null : 'view_' . hash('md5', $mime_part->getMIMEId() . $this->_mailbox . $this->_index)) . $text . ''; + return Horde::link($this->urlView($mime_part, $actionID, $options), $options['jstext'], $options['class'], empty($options['dload']) ? null : 'view_' . hash('md5', $mime_part->getMIMEId() . $this->_mailbox . $this->_uid)) . $text . ''; } /** diff --git a/imp/lib/IMP.php b/imp/lib/IMP.php index 470dfa4b3..01b1ed12c 100644 --- a/imp/lib/IMP.php +++ b/imp/lib/IMP.php @@ -892,7 +892,7 @@ class IMP * status. * * @param string $mailbox The mailbox to use on the linked page. - * @param string $uid The uid to use on the linked page. + * @param string $uid The UID to use on the linked page. * @param string $tmailbox The mailbox associated with $uid to use on * the linked page. * @@ -904,8 +904,7 @@ class IMP { $params = array('mailbox' => $mailbox); if (!is_null($uid)) { - // TODO: Remove 'index' for 'uid' instead - $params['index'] = $params['uid'] = $uid; + $params['uid'] = $uid; if ($mailbox != $tmailbox) { $params['thismailbox'] = $tmailbox; } @@ -1151,9 +1150,9 @@ class IMP * The global $imp_mbox objects will contain an array with the following * elements: *
-     * 'mailbox' - The current active mailbox (may be search mailbox).
-     * 'thismailbox' - The real IMAP mailbox of the current index.
-     * 'index' - The IMAP message index.
+     * 'mailbox' - (string) The current active mailbox (may be search mailbox).
+     * 'thismailbox' -(string) The real IMAP mailbox of the current index.
+     * 'uid' - (integer) The IMAP UID.
      * 
* * @param boolean $mbox Use this mailbox, instead of form data. @@ -1165,13 +1164,13 @@ class IMP $GLOBALS['imp_mbox'] = array( 'mailbox' => empty($mbox) ? 'INBOX' : $mbox, 'thismailbox' => Horde_Util::getFormData('thismailbox', $mbox), - 'index' => Horde_Util::getFormData('index') + 'uid' => Horde_Util::getFormData('uid') ); } else { $GLOBALS['imp_mbox'] = array( 'mailbox' => $mbox, 'thismailbox' => $mbox, - 'index' => null + 'uid' => null ); } diff --git a/imp/lib/Mailbox.php b/imp/lib/Mailbox.php index 43017d1fb..b5738d84b 100644 --- a/imp/lib/Mailbox.php +++ b/imp/lib/Mailbox.php @@ -468,8 +468,11 @@ class IMP_Mailbox * * @param integer $offset The offset from the current message. * - * @return array 'index' -- The message index. - * 'mailbox' -- The mailbox. + * @return array Array with the following entries: + *
+     * 'mailbox' - (string) The mailbox.
+     * 'uid' - (integer) The message UID.
+     * 
*/ public function getIMAPIndex($offset = 0) { @@ -477,8 +480,8 @@ class IMP_Mailbox return isset($this->_sorted[$index]) ? array( - 'index' => $this->_sorted[$index], - 'mailbox' => $this->_searchmbox ? $this->_sortedMbox[$index] : $this->_mailbox + 'mailbox' => ($this->_searchmbox ? $this->_sortedMbox[$index] : $this->_mailbox), + 'uid' => $this->_sorted[$index] ) : array(); } @@ -632,7 +635,7 @@ class IMP_Mailbox * @param integer $data If $type is 'offset', the number of messages to * increase array index by. If type is 'uid', * sets array index to the value of the given - * message index. + * message UID. * @param string $type Either 'offset' or 'uid'. */ public function setIndex($data, $type = 'uid') @@ -789,8 +792,8 @@ class IMP_Mailbox /* Remove the current entry and recalculate the range. */ foreach (IMP::parseIndicesList($msgs) as $key => $val) { - foreach ($val as $index) { - $val = $this->getArrayIndex($index, $key); + foreach ($val as $uid) { + $val = $this->getArrayIndex($uid, $key); unset($this->_sorted[$val]); if ($this->_searchmbox) { unset($this->_sortedMbox[$val]); diff --git a/imp/lib/Mime/Viewer/Pgp.php b/imp/lib/Mime/Viewer/Pgp.php index fdda41ecd..e225295ae 100644 --- a/imp/lib/Mime/Viewer/Pgp.php +++ b/imp/lib/Mime/Viewer/Pgp.php @@ -289,7 +289,7 @@ class IMP_Horde_Mime_Viewer_Pgp extends Horde_Mime_Viewer_Driver if ($GLOBALS['prefs']->getValue('use_pgp') && $GLOBALS['prefs']->getValue('add_source') && $GLOBALS['registry']->hasMethod('contacts/addField')) { - $status['text'][] = Horde::link('#', '', '', '', $this->_imppgp->savePublicKeyURL($this->_params['contents']->getMailbox(), $this->_params['contents']->getIndex(), $mime_id) . 'return false;') . _("Save the key to your Address book.") . ''; + $status['text'][] = Horde::link('#', '', '', '', $this->_imppgp->savePublicKeyURL($this->_params['contents']->getMailbox(), $this->_params['contents']->getUid(), $mime_id) . 'return false;') . _("Save the key to your Address book.") . ''; } $status['text'][] = $this->_params['contents']->linkViewJS($this->_mimepart, 'view_attach', _("View the raw text of the Public Key."), array('jstext' => _("View Public Key"), 'params' => array('mode' => IMP_Contents::RENDER_INLINE, 'rawpgpkey' => 1))); @@ -414,7 +414,7 @@ class IMP_Horde_Mime_Viewer_Pgp extends Horde_Mime_Viewer_Driver */ protected function _getSymmetricID() { - return $this->_imppgp->getSymmetricID($this->_params['contents']->getMailbox(), $this->_params['contents']->getIndex(), $this->_mimepart->getMimeId()); + return $this->_imppgp->getSymmetricID($this->_params['contents']->getMailbox(), $this->_params['contents']->getUid(), $this->_mimepart->getMimeId()); } } diff --git a/imp/lib/Mime/Viewer/Smime.php b/imp/lib/Mime/Viewer/Smime.php index 27e8f406b..d60e4b791 100644 --- a/imp/lib/Mime/Viewer/Smime.php +++ b/imp/lib/Mime/Viewer/Smime.php @@ -314,7 +314,7 @@ class IMP_Horde_Mime_Viewer_Smime extends Horde_Mime_Viewer_Driver if (!empty($subject) && $GLOBALS['registry']->hasMethod('contacts/addField') && $GLOBALS['prefs']->getValue('add_source')) { - $status[] = sprintf(_("The S/MIME certificate of %s: "), @htmlspecialchars($subject, ENT_COMPAT, Horde_Nls::getCharset())) . $this->_params['contents']->linkViewJS($this->_mimepart, 'view_attach', _("View"), array('params' => array('mode' => IMP_Contents::RENDER_INLINE, 'view_smime_key' => 1))) . '/' . Horde::link('#', '', null, null, $this->_impsmime->savePublicKeyURL($sig_result->cert, $this->_params['contents']->getIndex(), $sig_id) . ' return false;') . _("Save in your Address Book") . ''; + $status[] = sprintf(_("The S/MIME certificate of %s: "), @htmlspecialchars($subject, ENT_COMPAT, Horde_Nls::getCharset())) . $this->_params['contents']->linkViewJS($this->_mimepart, 'view_attach', _("View"), array('params' => array('mode' => IMP_Contents::RENDER_INLINE, 'view_smime_key' => 1))) . '/' . Horde::link('#', '', null, null, $this->_impsmime->savePublicKeyURL($sig_result->cert, $this->_params['contents']->getUid(), $sig_id) . ' return false;') . _("Save in your Address Book") . ''; } } diff --git a/imp/lib/Views/ShowMessage.php b/imp/lib/Views/ShowMessage.php index 798e39ef7..e8e2266c3 100644 --- a/imp/lib/Views/ShowMessage.php +++ b/imp/lib/Views/ShowMessage.php @@ -50,11 +50,11 @@ class IMP_Views_ShowMessage * * @param array $args Configuration parameters. *
-     * 'headers' - The headers desired in the returned headers array (only used
-     *             with non-preview view)
-     * 'index' - The UID of the message
-     * 'mailbox' - The mailbox name
-     * 'preview' - Is this the preview view?
+     * 'headers' - (array) The headers desired in the returned headers array
+     *             (only used with non-preview view)
+     * 'mailbox' - (string) The mailbox name
+     * 'preview' - (boolean) Is this the preview view?
+     * 'uid' - (integer) The UID of the message
      * 
* * @return array Array with the following keys: @@ -67,13 +67,13 @@ class IMP_Views_ShowMessage * 'error' - Contains an error message (only on error) * 'errortype' - Contains the error type (only on error) * 'from' - The From addresses - * 'index' - The IMAP UID * 'js' - Javascript code to run on display * 'log' - Log information * 'mailbox' - The IMAP mailbox * 'msgtext' - The text of the message * 'subject' - The subject * 'to' - The To addresses + * 'uid' - The IMAP UID * * FOR PREVIEW MODE: * 'fulldate' - The fully formatted date @@ -94,13 +94,13 @@ class IMP_Views_ShowMessage { $preview = !empty($args['preview']); $mailbox = $args['mailbox']; - $index = $args['index']; + $uid = $args['uid']; $error_msg = _("Requested message not found."); $result = array( - 'index' => $index, 'js' => array(), - 'mailbox' => $mailbox + 'mailbox' => $mailbox, + 'uid' => $uid ); /* Set the current time zone. */ @@ -112,7 +112,7 @@ class IMP_Views_ShowMessage $fetch_ret = $GLOBALS['imp_imap']->ob()->fetch($mailbox, array( Horde_Imap_Client::FETCH_ENVELOPE => true, Horde_Imap_Client::FETCH_HEADERTEXT => array(array('parse' => true, 'peek' => false)) - ), array('ids' => array($index))); + ), array('ids' => array($uid))); } catch (Horde_Imap_Client_Exception $e) { $result['error'] = $error_msg; $result['errortype'] = 'horde.error'; @@ -121,15 +121,15 @@ class IMP_Views_ShowMessage /* Parse MIME info and create the body of the message. */ try { - $imp_contents = IMP_Contents::singleton($index . IMP::IDX_SEP . $mailbox); + $imp_contents = IMP_Contents::singleton($uid . IMP::IDX_SEP . $mailbox); } catch (Horde_Exception $e) { $result['error'] = $error_msg; $result['errortype'] = 'horde.error'; return $result; } - $envelope = $fetch_ret[$index]['envelope']; - $mime_headers = reset($fetch_ret[$index]['headertext']); + $envelope = $fetch_ret[$uid]['envelope']; + $mime_headers = reset($fetch_ret[$uid]['headertext']); /* Get the IMP_UI_Message:: object. */ $imp_ui = new IMP_UI_Message(); @@ -259,8 +259,8 @@ class IMP_Views_ShowMessage } /* Do MDN processing now. */ - if ($imp_ui->MDNCheck($mailbox, $index, $mime_headers)) { - $result['msgtext'] .= $imp_ui->formatStatusMsg(array('text' => array(_("The sender of this message is requesting a Message Disposition Notification from you when you have read this message."), sprintf(_("Click %s to send the notification message."), Horde::link('', '', '', '', 'DimpCore.doAction(\'SendMDN\',{folder:\'' . $mailbox . '\',index:' . $index . '}); return false;', '', '') . _("HERE") . '')))); + if ($imp_ui->MDNCheck($mailbox, $uid, $mime_headers)) { + $result['msgtext'] .= $imp_ui->formatStatusMsg(array('text' => array(_("The sender of this message is requesting a Message Disposition Notification from you when you have read this message."), sprintf(_("Click %s to send the notification message."), Horde::link('', '', '', '', 'DimpCore.doAction(\'SendMDN\',{folder:\'' . $mailbox . '\',uid:' . $uid . '}); return false;', '', '') . _("HERE") . '')))); } /* Build body text. This needs to be done before we build the @@ -365,7 +365,7 @@ class IMP_Views_ShowMessage if (!$preview) { $result['list_info'] = $imp_ui->getListInformation($mime_headers); - $result['save_as'] = Horde::downloadUrl(htmlspecialchars_decode($result['subject']), array_merge(array('actionID' => 'save_message'), IMP::getIMPMboxParameters($mailbox, $index, $mailbox))); + $result['save_as'] = Horde::downloadUrl(htmlspecialchars_decode($result['subject']), array_merge(array('actionID' => 'save_message'), IMP::getIMPMboxParameters($mailbox, $uid, $mailbox))); } if (empty($result['js'])) { diff --git a/imp/mailbox-mimp.php b/imp/mailbox-mimp.php index 38a4fea9f..b7a9f869f 100644 --- a/imp/mailbox-mimp.php +++ b/imp/mailbox-mimp.php @@ -171,7 +171,7 @@ while (list(,$ob) = each($mbox_info['overview'])) { /* Generate the target link. */ $msg['target'] = in_array('\\draft', $ob['flags']) - ? IMP::composeLink(array(), array('a' => 'd', 'thismailbox' => $imp_mbox['mailbox'], 'index' => $ob['uid'], 'bodypart' => 1)) + ? IMP::composeLink(array(), array('a' => 'd', 'thismailbox' => $imp_mbox['mailbox'], 'uid' => $ob['uid'], 'bodypart' => 1)) : IMP::generateIMPUrl('message-mimp.php', $imp_mbox['mailbox'], $ob['uid'], $ob['mailbox']); $msgs[] = $msg; diff --git a/imp/mailbox.php b/imp/mailbox.php index 76d511fea..8d9892e52 100644 --- a/imp/mailbox.php +++ b/imp/mailbox.php @@ -788,7 +788,7 @@ while (list(,$ob) = each($mbox_info['overview'])) { switch ($fromlinkstyle) { case 0: if (!$getfrom['error']) { - $msg['from'] = Horde::link(IMP::composeLink(array(), array('actionID' => 'mailto', 'thismailbox' => $ob['mailbox'], 'index' => $ob['uid'], 'mailto' => $getfrom['to'])), sprintf(_("New Message to %s"), $msg['fullfrom'])) . $msg['from'] . ''; + $msg['from'] = Horde::link(IMP::composeLink(array(), array('actionID' => 'mailto', 'thismailbox' => $ob['mailbox'], 'uid' => $ob['uid'], 'mailto' => $getfrom['to'])), sprintf(_("New Message to %s"), $msg['fullfrom'])) . $msg['from'] . ''; } break; diff --git a/imp/message-dimp.php b/imp/message-dimp.php index b9cba5ffb..fac7d31ad 100644 --- a/imp/message-dimp.php +++ b/imp/message-dimp.php @@ -14,8 +14,8 @@ require_once dirname(__FILE__) . '/lib/Application.php'; new IMP_Application(array('init' => true)); $folder = Horde_Util::getFormData('folder'); -$index = Horde_Util::getFormData('uid'); -if (!$index || !$folder) { +$uid = Horde_Util::getFormData('uid'); +if (!$uid || !$folder) { exit; } @@ -24,9 +24,9 @@ $readonly = $imp_imap->isReadOnly($folder); $args = array( 'headers' => array_diff(array_keys($imp_ui->basicHeaders()), array('subject')), - 'index' => $index, 'mailbox' => $folder, 'preview' => false, + 'uid' => $uid ); $show_msg = new IMP_Views_ShowMessage(); @@ -45,7 +45,7 @@ $scripts = array( ); $js_onload = $js_out = array(); -foreach (array('from', 'to', 'cc', 'bcc', 'replyTo', 'log', 'index', 'mailbox') as $val) { +foreach (array('from', 'to', 'cc', 'bcc', 'replyTo', 'log', 'uid', 'mailbox') as $val) { if (!empty($show_msg_result[$val])) { $js_out[] = 'DimpFullmessage.' . $val . ' = ' . Horde_Serialize::serialize($show_msg_result[$val], Horde_Serialize::JSON); } @@ -57,10 +57,10 @@ $disable_compose = !IMP::canCompose(); if (!$disable_compose) { $compose_args = array( 'folder' => $folder, - 'index' => $index, 'messageCache' => '', 'popup' => false, 'qreply' => true, + 'uid' => $uid, ); $compose_result = IMP_Views_Compose::showCompose($compose_args); diff --git a/imp/message-mimp.php b/imp/message-mimp.php index f480bd5fa..cd528b6fe 100644 --- a/imp/message-mimp.php +++ b/imp/message-mimp.php @@ -22,7 +22,7 @@ require_once dirname(__FILE__) . '/lib/Application.php'; new IMP_Application(array('init' => true)); /* Make sure we have a valid index. */ -$imp_mailbox = IMP_Mailbox::singleton($imp_mbox['mailbox'], $imp_mbox['index']); +$imp_mailbox = IMP_Mailbox::singleton($imp_mbox['mailbox'], $imp_mbox['uid']); if (!$imp_mailbox->isValidIndex(false)) { header('Location: ' . Horde_Util::addParameter(IMP::generateIMPUrl('mailbox-mimp.php', $imp_mbox['mailbox']), array('a' => 'm'), null, false)); exit; @@ -51,7 +51,7 @@ case 'u': /* Get mailbox/UID of message. */ $index_array = $imp_mailbox->getIMAPIndex(); - $indices_array = array($index_array['mailbox'] => array($index_array['index'])); + $indices_array = array($index_array['mailbox'] => array($index_array['uid'])); if ($actionID == 'u') { $imp_message->undelete($indices_array); @@ -70,7 +70,7 @@ case 'u': // 'ri' = report innocent case 'rs': case 'ri': - if (IMP_Spam::reportSpam(array($index_array['mailbox'] => array($index_array['index'])), $actionID == 'rs' ? 'spam' : 'innocent') === 1) { + if (IMP_Spam::reportSpam(array($index_array['mailbox'] => array($index_array['uid'])), $actionID == 'rs' ? 'spam' : 'innocent') === 1) { $delete_msg = true; break; } @@ -96,8 +96,8 @@ if (!$imp_mailbox->isValidIndex() || /* Now that we are done processing the messages, get the index and * array index of the current message. */ $index_array = $imp_mailbox->getIMAPIndex(); -$index = $index_array['index']; $mailbox_name = $index_array['mailbox']; +$uid = $index_array['uid']; /* Get envelope/flag/header information. */ try { @@ -105,24 +105,24 @@ try { * before we can grab it. */ $flags_ret = $imp_imap->ob()->fetch($mailbox_name, array( Horde_Imap_Client::FETCH_FLAGS => true, - ), array('ids' => array($index))); + ), array('ids' => array($uid))); $fetch_ret = $imp_imap->ob()->fetch($mailbox_name, array( Horde_Imap_Client::FETCH_ENVELOPE => true, Horde_Imap_Client::FETCH_HEADERTEXT => array(array('parse' => true, 'peek' => $readonly)) - ), array('ids' => array($index))); + ), array('ids' => array($uid))); } catch (Horde_Imap_Client_Exception $e) { header('Location: ' . Horde_Util::addParameter(IMP::generateIMPUrl('mailbox-mimp.php', $mailbox_name), array('a' => 'm'), null, false)); exit; } -$envelope = $fetch_ret[$index]['envelope']; -$flags = $flags_ret[$index]['flags']; -$mime_headers = reset($fetch_ret[$index]['headertext']); +$envelope = $fetch_ret[$uid]['envelope']; +$flags = $flags_ret[$uid]['flags']; +$mime_headers = reset($fetch_ret[$uid]['headertext']); $use_pop = ($_SESSION['imp']['protocol'] == 'pop'); /* Parse the message. */ try { - $imp_contents = IMP_Contents::singleton($index . IMP::IDX_SEP . $mailbox_name); + $imp_contents = IMP_Contents::singleton($uid . IMP::IDX_SEP . $mailbox_name); } catch (Horde_Exception $e) { header('Location: ' . Horde_Util::addParameter(IMP::generateIMPUrl('mailbox-mimp.php', $mailbox_name), array('a' => 'm'), null, false)); exit; @@ -134,7 +134,7 @@ $msgcount = $imp_mailbox->getMessageCount(); /* Generate the mailbox link. */ $mailbox_link = Horde_Util::addParameter(IMP::generateIMPUrl('mailbox-mimp.php', $imp_mbox['mailbox']), array('s' => $msgindex)); -$self_link = IMP::generateIMPUrl('message-mimp.php', $imp_mbox['mailbox'], $index, $mailbox_name); +$self_link = IMP::generateIMPUrl('message-mimp.php', $imp_mbox['mailbox'], $uid, $mailbox_name); /* Init render object. */ $mimp_render = new Horde_Mobile(); @@ -244,11 +244,11 @@ foreach ($flag_parse as $val) { /* Generate previous/next links. */ $prev_msg = $imp_mailbox->getIMAPIndex(-1); if ($prev_msg) { - $prev_link = IMP::generateIMPUrl('message-mimp.php', $imp_mbox['mailbox'], $prev_msg['index'], $prev_msg['mailbox']); + $prev_link = IMP::generateIMPUrl('message-mimp.php', $imp_mbox['mailbox'], $prev_msg['uid'], $prev_msg['mailbox']); } $next_msg = $imp_mailbox->getIMAPIndex(1); if ($next_msg) { - $next_link = IMP::generateIMPUrl('message-mimp.php', $imp_mbox['mailbox'], $next_msg['index'], $next_msg['mailbox']); + $next_link = IMP::generateIMPUrl('message-mimp.php', $imp_mbox['mailbox'], $next_msg['uid'], $next_msg['mailbox']); } /* Create the body of the message. */ @@ -316,9 +316,9 @@ if (!$readonly) { } $compose_params = array( - 'index' => $index, 'identity' => $identity, - 'thismailbox' => $mailbox_name + 'thismailbox' => $mailbox_name, + 'uid' => $uid, ); /* Add compose actions (Reply, Reply List, Reply All, Forward, Redirect). */ diff --git a/imp/message.php b/imp/message.php index 38572e32f..4e64dc785 100644 --- a/imp/message.php +++ b/imp/message.php @@ -19,7 +19,6 @@ function _returnToMailbox($startIndex = null, $actID = null) $GLOBALS['start'] = $startIndex; } - require_once dirname(__FILE__) . '/lib/Application.php'; new IMP_Application(array('init' => true)); @@ -31,7 +30,7 @@ if (!$imp_search->isSearchMbox($imp_mbox['mailbox'])) { } /* Make sure we have a valid index. */ -$imp_mailbox = IMP_Mailbox::singleton($imp_mbox['mailbox'], $imp_mbox['index']); +$imp_mailbox = IMP_Mailbox::singleton($imp_mbox['mailbox'], $imp_mbox['uid']); if (!$imp_mailbox->isValidIndex(false)) { _returnToMailbox(null, 'message_missing'); require IMP_BASE . '/mailbox.php'; @@ -67,9 +66,9 @@ if ($readonly && /* Get mailbox/UID of message. */ $index_array = $imp_mailbox->getIMAPIndex(); -$index = $index_array['index']; $mailbox_name = $index_array['mailbox']; -$indices_array = array($mailbox_name => array($index)); +$uid = $index_array['uid']; +$indices_array = array($mailbox_name => array($uid)); $imp_flags = IMP_Imap_Flags::singleton(); $imp_ui = new IMP_UI_Message(); @@ -185,12 +184,12 @@ if (!$imp_mailbox->isValidIndex()) { /* Now that we are done processing, get the index and array index of * the current message. */ $index_array = $imp_mailbox->getIMAPIndex(); -$index = $index_array['index']; $mailbox_name = $index_array['mailbox']; +$uid = $index_array['uid']; /* Parse the message. */ try { - $imp_contents = IMP_Contents::singleton($index . IMP::IDX_SEP . $mailbox_name); + $imp_contents = IMP_Contents::singleton($uid . IMP::IDX_SEP . $mailbox_name); } catch (Horde_Exception $e) { $imp_mailbox->removeMsgs(true); _returnToMailbox(null, 'message_missing'); @@ -204,19 +203,19 @@ try { * before we can grab it. */ $flags_ret = $imp_imap->ob()->fetch($mailbox_name, array( Horde_Imap_Client::FETCH_FLAGS => true, - ), array('ids' => array($index))); + ), array('ids' => array($uid))); $fetch_ret = $imp_imap->ob()->fetch($mailbox_name, array( Horde_Imap_Client::FETCH_ENVELOPE => true, Horde_Imap_Client::FETCH_HEADERTEXT => array(array('parse' => true, 'peek' => $peek)) - ), array('ids' => array($index))); + ), array('ids' => array($uid))); } catch (Horde_Imap_Client_Exception $e) { require IMP_BASE . '/mailbox.php'; exit; } -$envelope = $fetch_ret[$index]['envelope']; -$flags = $flags_ret[$index]['flags']; -$mime_headers = reset($fetch_ret[$index]['headertext']); +$envelope = $fetch_ret[$uid]['envelope']; +$flags = $flags_ret[$uid]['flags']; +$mime_headers = reset($fetch_ret[$uid]['headertext']); $use_pop = ($_SESSION['imp']['protocol'] == 'pop'); /* Get the title/mailbox label of the mailbox page. */ @@ -225,7 +224,7 @@ $page_label = IMP::getLabel($imp_mbox['mailbox']); /* Generate the link to ourselves. */ $msgindex = $imp_mailbox->getMessageIndex(); $message_url = Horde::applicationUrl('message.php'); -$self_link = Horde_Util::addParameter(IMP::generateIMPUrl('message.php', $imp_mbox['mailbox'], $index, $mailbox_name), array('start' => $msgindex, 'message_token' => $message_token)); +$self_link = Horde_Util::addParameter(IMP::generateIMPUrl('message.php', $imp_mbox['mailbox'], $uid, $mailbox_name), array('start' => $msgindex, 'message_token' => $message_token)); /* Develop the list of headers to display. */ $basic_headers = $imp_ui->basicHeaders(); @@ -350,25 +349,25 @@ ksort($full_headers); * may have changed if we deleted/copied/moved messages. We may need other * stuff in the query string, so we need to do an add/remove of 'index'. */ $selfURL = Horde_Util::removeParameter(Horde::selfUrl(true), array('index', 'actionID', 'mailbox', 'thismailbox')); -$selfURL = IMP::generateIMPUrl($selfURL, $imp_mbox['mailbox'], $index, $mailbox_name); +$selfURL = IMP::generateIMPUrl($selfURL, $imp_mbox['mailbox'], $uid, $mailbox_name); IMP::$newUrl = $selfURL = html_entity_decode(Horde_Util::addParameter($selfURL, 'message_token', $message_token)); $headersURL = htmlspecialchars(Horde_Util::removeParameter($selfURL, array('show_all_headers', 'show_list_headers'))); /* Generate previous/next links. */ $prev_msg = $imp_mailbox->getIMAPIndex(-1); if ($prev_msg) { - $prev_url = IMP::generateIMPUrl('message.php', $imp_mbox['mailbox'], $prev_msg['index'], $prev_msg['mailbox']); + $prev_url = IMP::generateIMPUrl('message.php', $imp_mbox['mailbox'], $prev_msg['uid'], $prev_msg['mailbox']); } $next_msg = $imp_mailbox->getIMAPIndex(1); if ($next_msg) { - $next_url = IMP::generateIMPUrl('message.php', $imp_mbox['mailbox'], $next_msg['index'], $next_msg['mailbox']); + $next_url = IMP::generateIMPUrl('message.php', $imp_mbox['mailbox'], $next_msg['uid'], $next_msg['mailbox']); } /* Generate the mailbox link. */ $mailbox_url = Horde_Util::addParameter(IMP::generateIMPUrl('mailbox.php', $imp_mbox['mailbox']), 'start', $msgindex); /* Generate the view link. */ -$view_link = IMP::generateIMPUrl('view.php', $imp_mbox['mailbox'], $index, $mailbox_name); +$view_link = IMP::generateIMPUrl('view.php', $imp_mbox['mailbox'], $uid, $mailbox_name); /* Everything below here is related to preparing the output. */ @@ -411,7 +410,7 @@ $t_template->set('form_input', Horde_Util::formInput()); $t_template->set('mailbox', htmlspecialchars($imp_mbox['mailbox'])); $t_template->set('thismailbox', htmlspecialchars($mailbox_name)); $t_template->set('start', htmlspecialchars($msgindex)); -$t_template->set('index', htmlspecialchars($index)); +$t_template->set('uid', htmlspecialchars($uid)); $t_template->set('label', sprintf(_("%s: %s"), $header_label, $shortsub)); $t_template->set('msg_count', sprintf(_("(%d of %d)"), $msgindex, $imp_mailbox->getMessageCount())); $t_template->set('status', $status); @@ -459,7 +458,7 @@ if (Horde_Util::nonInputVar('next_url')) { $a_template = new Horde_Template(); $a_template->setOption('gettext', true); $a_template->set('readonly', $readonly); -$compose_params = array('index' => $index, 'identity' => $identity, 'thismailbox' => $mailbox_name); +$compose_params = array('identity' => $identity, 'thismailbox' => $mailbox_name, 'uid' => $uid); if (!$prefs->getValue('compose_popup')) { $compose_params += array('start' => $msgindex, 'mailbox' => $imp_mbox['mailbox']); } @@ -492,7 +491,7 @@ if (!$disable_compose) { } if (IMP::threadSortAvailable($imp_mbox['mailbox'])) { - $a_template->set('show_thread', Horde::widget(Horde_Util::addParameter(IMP::generateIMPUrl('thread.php', $imp_mbox['mailbox'], $index, $mailbox_name), array('start' => $msgindex)), _("View Thread"), 'widget', '', '', _("_View Thread"), true)); + $a_template->set('show_thread', Horde::widget(Horde_Util::addParameter(IMP::generateIMPUrl('thread.php', $imp_mbox['mailbox'], $uid, $mailbox_name), array('start' => $msgindex)), _("View Thread"), 'widget', '', '', _("_View Thread"), true)); } if ($registry->hasMethod('mail/blacklistFrom')) { @@ -515,7 +514,7 @@ if (!$disable_compose && $a_template->set('resume', Horde::widget(IMP::composeLink(array(), array('actionID' => 'draft') + $compose_params), _("Resume"), 'widget', '', '', _("Resume"), true)); } -$imp_params = IMP::getIMPMboxParameters($imp_mbox['mailbox'], $index, $mailbox_name); +$imp_params = IMP::getIMPMboxParameters($imp_mbox['mailbox'], $uid, $mailbox_name); $a_template->set('save_as', Horde::widget(Horde::downloadUrl($subject, array_merge(array('actionID' => 'save_message'), $imp_params)), _("Save as"), 'widget', '', '', _("Sa_ve as"), 2)); $a_template->set('print', Horde::widget('#', _("Print"), 'widget printAction', '', '', _("_Print"), true)); @@ -575,7 +574,7 @@ $js_onload = array(); $msgtext = ''; /* Do MDN processing now. */ -if ($imp_ui->MDNCheck($imp_mbox['mailbox'], $index, $mime_headers, Horde_Util::getFormData('mdn_confirm'))) { +if ($imp_ui->MDNCheck($imp_mbox['mailbox'], $uid, $mime_headers, Horde_Util::getFormData('mdn_confirm'))) { $msgtext .= $imp_ui->formatStatusMsg(array('text' => array(_("The sender of this message is requesting a Message Disposition Notification from you when you have read this message."), sprintf(_("Click %s to send the notification message."), Horde::link(htmlspecialchars(Horde_Util::addParameter($selfURL, 'mdn_confirm', 1))) . _("HERE") . '')))); } diff --git a/imp/saveimage.php b/imp/saveimage.php index 8d2c6a162..12189b7b2 100644 --- a/imp/saveimage.php +++ b/imp/saveimage.php @@ -13,13 +13,13 @@ require_once dirname(__FILE__) . '/lib/Application.php'; new IMP_Application(array('init' => true)); $id = Horde_Util::getFormData('id'); -$index = Horde_Util::getFormData('index'); +$muid = Horde_Util::getFormData('muid'); /* Run through the action handlers. */ $actionID = Horde_Util::getFormData('actionID'); switch ($actionID) { case 'save_image': - $contents = IMP_Contents::singleton($index); + $contents = IMP_Contents::singleton($muid); $mime_part = $contents->getMIMEPart($id); $image_data = array( 'filename' => $mime_part->getName(true), @@ -42,7 +42,7 @@ $t = new Horde_Template(); $t->setOption('gettext', true); $t->set('action', Horde::applicationUrl('saveimage.php')); $t->set('id', htmlspecialchars($id)); -$t->set('index', htmlspecialchars($index)); +$t->set('muid', htmlspecialchars($muid)); $t->set('image_img', Horde::img('mime/image.png', _("Image"), null, $registry->getImageDir('horde'))); /* Build the list of galleries. */ diff --git a/imp/templates/compose/redirect-mimp.inc b/imp/templates/compose/redirect-mimp.inc index a18880019..0d7ee6889 100644 --- a/imp/templates/compose/redirect-mimp.inc +++ b/imp/templates/compose/redirect-mimp.inc @@ -8,10 +8,9 @@ $notification->notify(array('listeners' => 'status')); $f = &$c->add(new Horde_Mobile_form('compose.php')); -$f->add(new Horde_Mobile_hidden('thismailbox', $thismailbox)); -$f->add(new Horde_Mobile_hidden('index', $index)); $f->add(new Horde_Mobile_hidden('action', 'rc')); -$f->add(new Horde_Mobile_hidden('array_index', Horde_Util::getFormData('array_index'))); +$f->add(new Horde_Mobile_hidden('thismailbox', $thismailbox)); +$f->add(new Horde_Mobile_hidden('uid', $uid)); $f->add(new Horde_Mobile_input('to', $header['to'], _("To: "))); diff --git a/imp/thread.php b/imp/thread.php index 6f5c7fb0e..3854c079f 100644 --- a/imp/thread.php +++ b/imp/thread.php @@ -18,7 +18,7 @@ new IMP_Application(array('init' => true)); */ $mode = Horde_Util::getFormData('mode', 'thread'); -$imp_mailbox = IMP_Mailbox::singleton($imp_mbox['mailbox'], $imp_mbox['index']); +$imp_mailbox = IMP_Mailbox::singleton($imp_mbox['mailbox'], $imp_mbox['uid']); $error = false; if ($mode == 'thread') { @@ -67,7 +67,7 @@ $page_label = IMP::getLabel($imp_mbox['mailbox']); if ($mode == 'thread') { $threadob = $imp_mailbox->getThreadOb(); $index_array = $imp_mailbox->getIMAPIndex(); - $thread = $threadob->getThread($index_array['index']); + $thread = $threadob->getThread($index_array['uid']); $imp_thread = new IMP_Imap_Thread($threadob); $threadtree = $imp_thread->getThreadImageTree($thread, false); -- 2.11.0