From 61b66c9f90a9e5b017dcf1534fb881a481e5b285 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Mon, 5 Jan 2009 23:57:12 -0700 Subject: [PATCH] Fix mailbox page location when deleting last msg in mailbox. --- imp/lib/Mailbox.php | 14 ++------------ imp/message.php | 9 ++------- 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/imp/lib/Mailbox.php b/imp/lib/Mailbox.php index 535431c60..b3f8845d1 100644 --- a/imp/lib/Mailbox.php +++ b/imp/lib/Mailbox.php @@ -28,13 +28,6 @@ class IMP_Mailbox protected $_arrayIndex = null; /** - * The location of the last message we were at. - * - * @var integer - */ - protected $_lastArrayIndex = null; - - /** * The array of sorted indices. * * @var array @@ -365,9 +358,7 @@ class IMP_Mailbox */ public function getMessageIndex() { - return (is_null($this->_arrayIndex) && is_null($this->_lastArrayIndex)) - ? 1 - : $this->_arrayIndex + 1; + return is_null($this->_arrayIndex) ? 1 : $this->_arrayIndex + 1; } /** @@ -559,7 +550,6 @@ class IMP_Mailbox switch ($type) { case 'offset': if (!is_null($this->_arrayIndex)) { - $this->_lastArrayIndex = $this->_arrayIndex; $this->_arrayIndex += $data; if (empty($this->_sorted[$this->_arrayIndex])) { $this->_arrayIndex = null; @@ -569,7 +559,7 @@ class IMP_Mailbox break; case 'uid': - $this->_arrayIndex = $this->_lastArrayIndex = $this->getArrayIndex($data); + $this->_arrayIndex = $this->getArrayIndex($data); break; } } diff --git a/imp/message.php b/imp/message.php index 4dc448344..2d2f049e3 100644 --- a/imp/message.php +++ b/imp/message.php @@ -16,7 +16,7 @@ function _returnToMailbox($startIndex = null, $actID = null) { $GLOBALS['actionID'] = $actID; $GLOBALS['from_message_page'] = true; - $GLOBALS['startIndex'] = $startIndex; + $GLOBALS['start'] = $startIndex; } function _moveAfterAction() @@ -86,7 +86,6 @@ case 'print_message': case 'delete_message': case 'undelete_message': - $imp_message = &IMP_Message::singleton(); if ($actionID == 'undelete_message') { $imp_message->undelete($indices_array); } else { @@ -105,8 +104,6 @@ case 'undelete_message': case 'move_message': case 'copy_message': if (($targetMbox = Util::getFormData('targetMbox')) !== null) { - $imp_message = &IMP_Message::singleton(); - if (Util::getFormData('newMbox', 0) == 1) { $targetMbox = IMP::folderPref($targetMbox, true); $newMbox = true; @@ -148,7 +145,6 @@ case 'flag_message': } else { $set = true; } - $imp_message = &IMP_Message::singleton(); $imp_message->flag(array($flag), $indices_array, $set); if ($prefs->getValue('mailbox_return')) { _returnToMailbox($imp_mailbox->getMessageIndex()); @@ -169,7 +165,6 @@ case 'add_address': case 'strip_all': case 'strip_attachment': - $imp_message = &IMP_Message::singleton(); $result = $imp_message->stripPart($indices_array, ($actionID == 'strip_all') ? null : Util::getFormData('imapid')); if (is_a($result, 'PEAR_Error')) { $notification->push($result, 'horde.error'); @@ -184,7 +179,7 @@ $message_token = IMP::getRequestToken('imp.message'); * message array, so we will return to mailbox.php if that is the * case. */ if (!$imp_mailbox->isValidIndex()) { - _returnToMailbox($imp_mailbox->getMessageIndex()); + _returnToMailbox($imp_mailbox->getMessageCount()); require IMP_BASE . '/mailbox.php'; exit; } -- 2.11.0