$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
$result = new stdClass;
$result->error = $e->getMessage();
$result->errortype = 'horde.error';
- $result->index = $args['index'];
$result->mailbox = $args['mailbox'];
+ $result->uid = $args['uid'];
}
break;
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;
break;
case 'SendMDN':
- $index = Horde_Util::getPost('index');
- if (empty($mbox) || empty($index)) {
+ $uid = Horde_Util::getPost('uid');
+ if (empty($mbox) || empty($uid)) {
break;
}
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':
* @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));
}
}
/* 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');
$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');
/* 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;
}
$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';
}
}
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';
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;
$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']);
* @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');
$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. */
// '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']);
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');
// 'f' = forward
case 'f':
- if (!($imp_contents = _getIMPContents($index, $thismailbox))) {
+ if (!($imp_contents = _getIMPContents($uid, $thismailbox))) {
break;
}
$fwd_msg = $imp_compose->forwardMessage($imp_contents);
break;
case _("Redirect"):
- if (!($imp_contents = _getIMPContents($index, $thismailbox))) {
+ if (!($imp_contents = _getIMPContents($uid, $thismailbox))) {
break;
}
$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;
}
$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;
}
}
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));
}
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');
$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')) {
$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();
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');
case 'reply':
case 'reply_all':
case 'reply_list':
- if (!($imp_contents = _getIMPContents($index, $thismailbox))) {
+ if (!($imp_contents = _getIMPContents($uid, $thismailbox))) {
break;
}
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'];
break;
case 'redirect_send':
- if (!($imp_contents = _getIMPContents($index, $thismailbox))) {
+ if (!($imp_contents = _getIMPContents($uid, $thismailbox))) {
break;
}
$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');
}
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'));
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);
}
if (this.pp &&
- (this.pp.imapuid != r.index ||
+ (this.pp.imapuid != r.uid ||
this.pp.view != r.mailbox)) {
return;
}
}
// 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);
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();
}
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;
}
}
},
- _getPPId: function(index, mailbox)
+ _getPPId: function(uid, mailbox)
{
- return index + '|' + mailbox;
+ return uid + '|' + mailbox;
},
// Labeling functions
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':
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();
// 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;
}
},
// spam = (boolean) True for spam, false for innocent
- // opts = 'index', 'mailbox'
+ // opts = 'mailbox', 'uid'
reportSpam: function(spam, opts)
{
opts = opts || {};
},
// 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 || {};
// 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 || {};
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?
}
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) {
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();
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();
}
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':
'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'])
));
/* 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.");
}
/**
* 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:
* <pre>
* </pre>
* @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);
}
// 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(
}
$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;
}
}
$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. */
$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. */
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.
* 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.
/**
* 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
*/
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;
}
/**
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 '';
}
}
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) {
$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'])
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();
}
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;') . '</a>';
+ $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;') . '</a>';
}
/* Strip Attachment? Allow stripping of base parts other than the
($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?")) . "');") . '</a>';
}
));
if (!is_null($this->_mailbox)) {
- $params['uid'] = $this->_index;
+ $params['uid'] = $this->_uid;
$params['mailbox'] = $this->_mailbox;
}
'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 . '</a>';
+ 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 . '</a>';
}
/**
* 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.
*
{
$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;
}
* The global $imp_mbox objects will contain an array with the following
* elements:
* <pre>
- * '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.
* </pre>
*
* @param boolean $mbox Use this mailbox, instead of form data.
$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
);
}
*
* @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:
+ * <pre>
+ * 'mailbox' - (string) The mailbox.
+ * 'uid' - (integer) The message UID.
+ * </pre>
*/
public function getIMAPIndex($offset = 0)
{
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();
}
* @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')
/* 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]);
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.") . '</a>';
+ $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.") . '</a>';
}
$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)));
*/
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());
}
}
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") . '</a>';
+ $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") . '</a>';
}
}
*
* @param array $args Configuration parameters.
* <pre>
- * '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
* </pre>
*
* @return array Array with the following keys:
* '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
{
$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. */
$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';
/* 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();
}
/* 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") . '</a>'))));
+ 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") . '</a>'))));
}
/* Build body text. This needs to be done before we build the
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'])) {
/* 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;
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'] . '</a>';
+ $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'] . '</a>';
}
break;
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;
}
$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();
);
$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);
}
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);
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;
/* 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);
// '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;
}
/* 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 {
* 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;
/* 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();
/* 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. */
}
$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). */
$GLOBALS['start'] = $startIndex;
}
-
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)) {
_returnToMailbox(null, 'message_missing');
require IMP_BASE . '/mailbox.php';
/* 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();
/* 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');
* 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. */
/* 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();
* 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. */
$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);
$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']);
}
}
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')) {
$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));
$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") . '</a>'))));
}
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),
$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. */
$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: ")));
*/
$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') {
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);