From: Michael M Slusarz Date: Tue, 2 Jun 2009 21:28:25 +0000 (-0600) Subject: Use new identifier for search mailboxes X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=87424c9ee31fc47f3a249febea60a06bd15c70e1;p=horde.git Use new identifier for search mailboxes --- diff --git a/imp/lib/IMP.php b/imp/lib/IMP.php index 94a97d8a4..7439dc4fa 100644 --- a/imp/lib/IMP.php +++ b/imp/lib/IMP.php @@ -31,9 +31,6 @@ class IMP const MAILBOX_START_FIRSTPAGE = 3; const MAILBOX_START_LASTPAGE = 4; - /* IMP mailbox labels. */ - const SEARCH_MBOX = '**search_'; - /* IMP internal indexing strings. */ // String used to separate messages. const MSG_SEP = "\0"; diff --git a/imp/lib/Search.php b/imp/lib/Search.php index 97a871e4a..4e2c18fcb 100644 --- a/imp/lib/Search.php +++ b/imp/lib/Search.php @@ -614,16 +614,13 @@ class IMP_Search /** * Is the given mailbox a search mailbox? * - * @param string $id The search query id to use (by default, will use - * the current ID set in the object). + * @param string $id The mailbox name. * * @return boolean Whether the given mailbox name is a search mailbox. */ - public function isSearchMbox($id = null) + static public function isSearchMbox($id) { - return is_null($id) - ? !empty($this->_id) - : isset($_SESSION['imp']['search']['q'][$this->_strip($id)]); + return (strpos($id, null) !== false); } /** @@ -663,9 +660,14 @@ class IMP_Search */ protected function _strip($id) { - return is_null($id) - ? $this->_id - : ((strpos($id, IMP::SEARCH_MBOX) === 0) ? substr($id, strlen(IMP::SEARCH_MBOX)) : $id); + if (is_null($id)) { + return $this->_id; + } + + $pos = strpos($id, null); + return ($pos === false) + ? $id + : substr($id, $pos); } /** @@ -677,7 +679,7 @@ class IMP_Search */ public function createSearchID($id) { - return IMP::SEARCH_MBOX . $this->_strip($id); + return 'impsearch' . "\0" . $this->_strip($id); } /** diff --git a/imp/lib/base.php b/imp/lib/base.php index 70d5be723..bdb09f424 100644 --- a/imp/lib/base.php +++ b/imp/lib/base.php @@ -10,7 +10,7 @@ * 'none' - Do not authenticate * Default - Authenticate to IMAP/POP server * $compose_page - If true, we are on IMP's compose page - * $dimp_logout - Logout and redirect to the login page. + * $dimp_logout - Logout and redirect to the login page. * $login_page - If true, we are on IMP's login page * $mimp_debug - If true, output text/plain version of page. * $no_compress - Controls whether the page should be compressed @@ -204,7 +204,7 @@ if ((IMP::loginTasksFlag() === 2) && $GLOBALS['imp_mbox'] = IMP::getCurrentMailboxInfo(); // Initialize IMP_Search object. -$GLOBALS['imp_search'] = new IMP_Search(array('id' => (isset($_SESSION['imp']) && strpos($GLOBALS['imp_mbox']['mailbox'], IMP::SEARCH_MBOX) === 0) ? $GLOBALS['imp_mbox']['mailbox'] : null)); +$GLOBALS['imp_search'] = new IMP_Search(array('id' => (isset($_SESSION['imp']) && IMP_Search::isSearchMbox($GLOBALS['imp_mbox']['mailbox'])) ? $GLOBALS['imp_mbox']['mailbox'] : null)); if ($viewmode == 'mimp') { // Mobile markup renderer.