From: Michael M Slusarz Date: Tue, 27 Apr 2010 05:46:49 +0000 (-0600) Subject: Remove imp_mbox global X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=ef7417c2a8d94f2f8660e22b860ee57f2e4b108b;p=horde.git Remove imp_mbox global --- diff --git a/imp/compose-mimp.php b/imp/compose-mimp.php index 4227787fb..297eeb0ba 100644 --- a/imp/compose-mimp.php +++ b/imp/compose-mimp.php @@ -104,7 +104,7 @@ switch ($vars->a) { // 'd' = draft case 'd': try { - $result = $imp_compose->resumeDraft($imp_mbox['thismailbox'], $imp_mbox['uid']); + $result = $imp_compose->resumeDraft(IMP::$thismailbox, IMP::$uid); $msg = $result['msg']; $header = array_merge($header, $result['header']); @@ -143,7 +143,7 @@ case _("Expand Names"): case 'r': case 'ra': case 'rl': - if (!($imp_contents = $imp_ui->getIMPContents($imp_mbox['uid'], $imp_mbox['thismailbox']))) { + if (!($imp_contents = $imp_ui->getIMPContents(IMP::$uid, IMP::$thismailbox))) { break; } $actions = array('r' => 'reply', 'ra' => 'reply_all', 'rl' => 'reply_list'); @@ -156,7 +156,7 @@ case 'rl': // 'f' = forward case 'f': - if (!($imp_contents = $imp_ui->getIMPContents($imp_mbox['uid'], $imp_mbox['thismailbox']))) { + if (!($imp_contents = $imp_ui->getIMPContents(IMP::$uid, IMP::$thismailbox))) { break; } $fwd_msg = $imp_compose->forwardMessage('forward_attach', $imp_contents, false); @@ -169,7 +169,7 @@ case 'f': // 'rc' = redirect compose case 'rc': $title = _("Redirect"); - if (!($imp_contents = $imp_ui->getIMPContents($imp_mbox['uid'], $imp_mbox['thismailbox']))) { + if (!($imp_contents = $imp_ui->getIMPContents(IMP::$uid, IMP::$thismailbox))) { // TODO: Error message break; } diff --git a/imp/compose.php b/imp/compose.php index eb3729009..737a17c23 100644 --- a/imp/compose.php +++ b/imp/compose.php @@ -725,7 +725,7 @@ if ($redirect) { 'compose_requestToken' => Horde::getRequestToken('imp.compose'), 'compose_formToken' => Horde_Token::generateId('compose'), 'composeCache' => $composeCacheID, - 'mailbox' => htmlspecialchars($imp_mbox['mailbox']), + 'mailbox' => htmlspecialchars(IMP::$mailbox), 'attachmentAction' => '', 'oldrtemode' => $rtemode, 'rtemode' => $rtemode diff --git a/imp/lib/Application.php b/imp/lib/Application.php index a2352565d..96998b7af 100644 --- a/imp/lib/Application.php +++ b/imp/lib/Application.php @@ -82,9 +82,6 @@ class IMP_Application extends Horde_Registry_Application /** * Initialization function. - * - * Global variables defined: - * $imp_mbox - Current mailbox information */ protected function _init() { @@ -114,8 +111,6 @@ class IMP_Application extends Horde_Registry_Application Horde_Mime_Headers::$defaultCharset = $def_charset; } - // Initialize global $imp_mbox array. This call also initializes the - // IMP_Search object. IMP::setCurrentMailboxInfo(); $GLOBALS['notification']->addDecorator(new IMP_Notification_Handler_Decorator_Imap()); diff --git a/imp/lib/IMP.php b/imp/lib/IMP.php index add3fb0bd..3d6694735 100644 --- a/imp/lib/IMP.php +++ b/imp/lib/IMP.php @@ -41,16 +41,53 @@ class IMP /* Sorting constants. */ const IMAP_SORT_DATE = 100; - /* Storage place for an altered version of the current URL. */ + /** + * Storage place for an altered version of the current URL. + * + * @var string + */ static public $newUrl = null; - /* displayFolder() cache. */ + /** + * The current active mailbox (may be search mailbox). + * + * @var string + */ + static public $mailbox = ''; + + /** + * The real IMAP mailbox of the current index. + * + * @var string + */ + static public $thismailbox = ''; + + /** + * The IMAP UID. + * + * @var integer + */ + static public $uid = ''; + + /** + * displayFolder() cache. + * + * @var array + */ static private $_displaycache = array(); - /* hideDeletedMsgs() cache. */ + /** + * hideDeletedMsgs() cache. + * + * @var array + */ static private $_delhide = null; - /* prepareMenu() cache. */ + /** + * prepareMenu() cache. + * + * @var array + */ static private $_menuTemplate = null; /** @@ -511,7 +548,7 @@ class IMP } if (self::canCompose()) { - $menu->add(self::composeLink(array('mailbox' => $GLOBALS['imp_mbox']['mailbox'])), _("_New Message"), 'compose.png'); + $menu->add(self::composeLink(array('mailbox' => self::$mailbox)), _("_New Message"), 'compose.png'); } if ($conf['user']['allow_folders']) { @@ -549,7 +586,7 @@ class IMP : ''; $t->set('ak', $ak); - $t->set('flist', self::flistSelect(array('selected' => $GLOBALS['imp_mbox']['mailbox'], 'inc_vfolder' => true))); + $t->set('flist', self::flistSelect(array('selected' => self::$mailbox, 'inc_vfolder' => true))); $t->set('flink', sprintf('%s%s
%s', Horde::link('#'), ($menu_view != 'text') ? Horde::img('folders/open.png', _("Open Folder"), ($menu_view == 'icon') ? array('title' => _("Open Folder")) : array()) : '', ($menu_view != 'icon') ? Horde::highlightAccessKey(_("Open Fo_lder"), $ak) : '')); } $t->set('menu_string', self::getMenu()->render()); @@ -897,7 +934,7 @@ class IMP global $prefs; if (is_null($mbox)) { - $mbox = $GLOBALS['imp_mbox']['mailbox']; + $mbox = self::$mailbox; } $search_mbox = $GLOBALS['injector']->getInstance('IMP_Search')->isSearchMbox($mbox); @@ -998,7 +1035,7 @@ class IMP $sortpref = @unserialize($GLOBALS['prefs']->getValue('sortpref')); if (is_null($mbox)) { - $mbox = $GLOBALS['imp_mbox']['mailbox']; + $mbox = self::$mailbox; } $prefmbox = $GLOBALS['injector']->getInstance('IMP_Search')->isSearchMbox($mbox) @@ -1043,15 +1080,8 @@ class IMP } /** - * Sets mailbox/index information for current page load. - * - * The global $imp_mbox objects will contain an array with the following - * elements: - *
-     * '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.
-     * 
+ * Sets mailbox/index information for current page load. This information + * is accessible via IMP::$mailbox, IMP::$thismailbox, and IMP::$uid. * * @param boolean $mbox Use this mailbox, instead of form data. */ @@ -1059,17 +1089,13 @@ class IMP { if (is_null($mbox)) { $mbox = Horde_Util::getFormData('mailbox'); - $GLOBALS['imp_mbox'] = array( - 'mailbox' => empty($mbox) ? 'INBOX' : $mbox, - 'thismailbox' => Horde_Util::getFormData('thismailbox', $mbox), - 'uid' => Horde_Util::getFormData('uid') - ); + self::$mailbox = empty($mbox) ? 'INBOX' : $mbox; + self::$thismailbox = Horde_Util::getFormData('thismailbox', $mbox); + self::$uid = Horde_Util::getFormData('uid'); } else { - $GLOBALS['imp_mbox'] = array( - 'mailbox' => $mbox, - 'thismailbox' => $mbox, - 'uid' => null - ); + self::$mailbox = $mbox; + self::$thismailbox = $mbox; + self::$uid = null; } } diff --git a/imp/lib/Injector/Binder/Search.php b/imp/lib/Injector/Binder/Search.php index e98350960..660bf6932 100644 --- a/imp/lib/Injector/Binder/Search.php +++ b/imp/lib/Injector/Binder/Search.php @@ -17,7 +17,7 @@ class IMP_Injector_Binder_Search implements Horde_Injector_Binder public function create(Horde_Injector $injector) { return new IMP_Search(array( - 'id' => (isset($_SESSION['imp']) && IMP_Search::isSearchMbox($GLOBALS['imp_mbox']['mailbox'])) ? $GLOBALS['imp_mbox']['mailbox'] : null + 'id' => (isset($_SESSION['imp']) && IMP_Search::isSearchMbox(IMP::$mailbox)) ? IMP::$mailbox : null )); } diff --git a/imp/lib/Mailbox.php b/imp/lib/Mailbox.php index dda8d4383..244acfc64 100644 --- a/imp/lib/Mailbox.php +++ b/imp/lib/Mailbox.php @@ -694,7 +694,7 @@ class IMP_Mailbox if ($this->_searchmbox) { if (is_null($mbox)) { - $mbox = $GLOBALS['imp_mbox']['thismailbox']; + $mbox = IMP::$thismailbox; } /* Need to compare both mbox name and message UID to obtain the diff --git a/imp/lib/Quota/Imap.php b/imp/lib/Quota/Imap.php index 1ebb8f04b..8dd63c382 100644 --- a/imp/lib/Quota/Imap.php +++ b/imp/lib/Quota/Imap.php @@ -26,7 +26,7 @@ class IMP_Quota_Imap extends IMP_Quota public function getQuota() { try { - $quota = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->getQuotaRoot($GLOBALS['injector']->getInstance('IMP_Search')->isSearchMbox($GLOBALS['imp_mbox']['mailbox']) ? 'INBOX' : $GLOBALS['imp_mbox']['mailbox']); + $quota = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->getQuotaRoot($GLOBALS['injector']->getInstance('IMP_Search')->isSearchMbox(IMP::$mailbox) ? 'INBOX' : IMP::$mailbox); } catch (Horde_Imap_Client_Exception $e) { throw new IMP_Exception(_("Unable to retrieve quota")); } diff --git a/imp/lib/Ui/Message.php b/imp/lib/Ui/Message.php index 7af0f1579..df9163ae8 100644 --- a/imp/lib/Ui/Message.php +++ b/imp/lib/Ui/Message.php @@ -640,7 +640,7 @@ class IMP_Ui_Message public function moveAfterAction() { return (($_SESSION['imp']['protocol'] != 'pop') && - !IMP::hideDeletedMsgs($GLOBALS['imp_mbox']['mailbox']) && + !IMP::hideDeletedMsgs(IMP::$mailbox) && !$GLOBALS['prefs']->getValue('use_trash')); } diff --git a/imp/lib/Ui/Mimp.php b/imp/lib/Ui/Mimp.php index 2591c5f81..8c9404890 100644 --- a/imp/lib/Ui/Mimp.php +++ b/imp/lib/Ui/Mimp.php @@ -25,7 +25,7 @@ class IMP_Ui_Mimp public function getMenu($page, $items = array()) { if (!in_array($page, array('mailbox', 'message')) || - ($GLOBALS['imp_mbox']['mailbox'] != 'INBOX')) { + (IMP::$mailbox != 'INBOX')) { $items[] = array(_("Inbox"), IMP::generateIMPUrl('mailbox-mimp.php', 'INBOX')); } diff --git a/imp/mailbox-mimp.php b/imp/mailbox-mimp.php index 18d3b693a..b178a1e02 100644 --- a/imp/mailbox-mimp.php +++ b/imp/mailbox-mimp.php @@ -34,10 +34,10 @@ $t = $injector->createInstance('Horde_Template'); $t->setOption('gettext', true); /* Determine if mailbox is readonly. */ -$readonly = $imp_imap->isReadOnly($imp_mbox['mailbox']); +$readonly = $imp_imap->isReadOnly(IMP::$mailbox); /* Get the base URL for this page. */ -$mailbox_url = IMP::generateIMPUrl('mailbox-mimp.php', $imp_mbox['mailbox']); +$mailbox_url = IMP::generateIMPUrl('mailbox-mimp.php', IMP::$mailbox); /* Perform message actions (via advanced UI). */ switch ($vars->checkbox) { @@ -81,7 +81,7 @@ case 'm': // 'e' = expunge mailbox case 'e': if (!$readonly) { - $injector->getInstance('IMP_Message')->expungeMailbox(array($imp_mbox['mailbox'] => 1)); + $injector->getInstance('IMP_Message')->expungeMailbox(array(IMP::$mailbox => 1)); } break; @@ -92,9 +92,9 @@ case 'c': // 's' = search case 's': - $title = sprintf(_("Search %s"), IMP::getLabel($imp_mbox['mailbox'])); + $title = sprintf(_("Search %s"), IMP::getLabel(IMP::$mailbox)); - $t->set('mailbox', $imp_mbox['mailbox']); + $t->set('mailbox', IMP::$mailbox); $t->set('menu', $imp_ui_mimp->getMenu('search')); $t->set('title', $title); $t->set('url', $mailbox_url); @@ -111,23 +111,23 @@ case 'rs': $query = new Horde_Imap_Client_Search_Query(); $query->text($vars->search, false); - /* Create the search query and reset the global $imp_mbox variable. */ - $sq = $imp_search->createSearchQuery($query, array($imp_mbox['mailbox']), array(), _("Search Results")); + /* Create the search query and reset the global mailbox variable. */ + $sq = $imp_search->createSearchQuery($query, array(IMP::$mailbox), array(), _("Search Results")); IMP::setCurrentMailboxInfo($imp_search->createSearchID($sq)); /* Need to re-calculate these values. */ - $readonly = $imp_imap->isReadOnly($imp_mbox['mailbox']); - $mailbox_url = IMP::generateIMPUrl('mailbox-mimp.php', $imp_mbox['mailbox']); + $readonly = $imp_imap->isReadOnly(IMP::$mailbox); + $mailbox_url = IMP::generateIMPUrl('mailbox-mimp.php', IMP::$mailbox); } break; } /* Build the list of messages in the mailbox. */ -$imp_mailbox = $injector->getInstance('IMP_Mailbox')->getOb($imp_mbox['mailbox']); +$imp_mailbox = $injector->getInstance('IMP_Mailbox')->getOb(IMP::$mailbox); $pageOb = $imp_mailbox->buildMailboxPage($vars->p, $vars->s); /* Generate page title. */ -$title = IMP::getLabel($imp_mbox['mailbox']); +$title = IMP::getLabel(IMP::$mailbox); /* Modify title for display on page. */ if ($pageOb['msgcount']) { @@ -145,9 +145,9 @@ $t->set('title', $title); $curr_time = time(); $curr_time -= $curr_time % 60; $msgs = array(); -$sortpref = IMP::getSort($imp_mbox['mailbox']); +$sortpref = IMP::getSort(IMP::$mailbox); -$imp_ui = new IMP_Ui_Mailbox($imp_mbox['mailbox']); +$imp_ui = new IMP_Ui_Mailbox(IMP::$mailbox); /* Build the array of message information. */ $mbox_info = $imp_mailbox->getMailboxArray(range($pageOb['begin'], $pageOb['end']), array('headers' => true)); @@ -197,8 +197,8 @@ 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'], 'uid' => $ob['uid'], 'bodypart' => 1)) - : IMP::generateIMPUrl('message-mimp.php', $imp_mbox['mailbox'], $ob['uid'], $ob['mailbox']); + ? IMP::composeLink(array(), array('a' => 'd', 'thismailbox' => IMP::$mailbox, 'uid' => $ob['uid'], 'bodypart' => 1)) + : IMP::generateIMPUrl('message-mimp.php', IMP::$mailbox, $ob['uid'], $ob['mailbox']); $msgs[] = $msg; } @@ -206,7 +206,7 @@ $t->set('msgs', $msgs); $mailbox = $mailbox_url->copy()->add('p', $pageOb['page']); $menu = array(array(_("Refresh"), $mailbox)); -$search_mbox = $imp_search->isSearchMbox($imp_mbox['mailbox']); +$search_mbox = $imp_search->isSearchMbox(IMP::$mailbox); /* Determine if we are going to show the Purge Deleted link. */ if (!$readonly && diff --git a/imp/mailbox.php b/imp/mailbox.php index b64693b96..c94086c80 100644 --- a/imp/mailbox.php +++ b/imp/mailbox.php @@ -38,7 +38,7 @@ Horde_Nls::setTimeZone(); /* Call the mailbox redirection hook, if requested. */ try { - $redirect = Horde::callHook('mbox_redirect', array($imp_mbox['mailbox']), 'imp'); + $redirect = Horde::callHook('mbox_redirect', array(IMP::$mailbox), 'imp'); if (!empty($redirect)) { $redirect = Horde::applicationUrl($redirect, true); header('Location: ' . $redirect); @@ -48,14 +48,14 @@ try { /* Is this a search mailbox? */ $imp_search = $injector->getInstance('IMP_Search'); -$search_mbox = $imp_search->isSearchMbox($imp_mbox['mailbox']); +$search_mbox = $imp_search->isSearchMbox(IMP::$mailbox); $vfolder = $imp_search->isVFolder(); /* There is a chance that this page is loaded directly via message.php. If so, * don't re-include config files, and the following variables will already be * set: $actionID, $start. */ $mailbox_url = Horde::applicationUrl('mailbox.php'); -$mailbox_imp_url = IMP::generateIMPUrl('mailbox.php', $imp_mbox['mailbox']); +$mailbox_imp_url = IMP::generateIMPUrl('mailbox.php', IMP::$mailbox); if (!Horde_Util::nonInputVar('from_message_page')) { $actionID = Horde_Util::getFormData('actionID'); $start = Horde_Util::getFormData('start'); @@ -88,14 +88,14 @@ if ($actionID && ($actionID != 'message_missing')) { * the RECENT flag. */ if (!$search_mbox) { try { - $imp_imap->openMailbox($imp_mbox['mailbox'], Horde_Imap_Client::OPEN_READWRITE); + $imp_imap->openMailbox(IMP::$mailbox, Horde_Imap_Client::OPEN_READWRITE); } catch (Horde_Imap_Client_Exception $e) { $actionID = null; } } /* Determine if mailbox is readonly. */ -$readonly = $imp_imap->isReadOnly($imp_mbox['mailbox']); +$readonly = $imp_imap->isReadOnly(IMP::$mailbox); if ($readonly && in_array($actionID, array('delete_messages', 'undelete_messages', 'move_messages', 'flag_messages', 'empty_mailbox', 'filter'))) { $actionID = null; @@ -170,11 +170,11 @@ case 'flag_messages': case 'hide_deleted': $prefs->setValue('delhide', !$prefs->getValue('delhide')); - IMP::hideDeletedMsgs($imp_mbox['mailbox'], true); + IMP::hideDeletedMsgs(IMP::$mailbox, true); break; case 'expunge_mailbox': - $injector->getInstance('IMP_Message')->expungeMailbox(array($imp_mbox['mailbox'] => 1)); + $injector->getInstance('IMP_Message')->expungeMailbox(array(IMP::$mailbox => 1)); break; case 'filter': @@ -182,11 +182,11 @@ case 'filter': break; case 'empty_mailbox': - $injector->getInstance('IMP_Message')->emptyMailbox(array($imp_mbox['mailbox'])); + $injector->getInstance('IMP_Message')->emptyMailbox(array(IMP::$mailbox)); break; case 'view_messages': - $redirect = IMP::generateIMPUrl('thread.php', $imp_mbox['mailbox'], null, null, false)->setRaw(true)->add(array('mode' => 'msgview', 'msglist' => $imp_imap->getUtils()->toSequenceString(IMP::parseIndicesList($indices), array('mailbox' => true)))); + $redirect = IMP::generateIMPUrl('thread.php', IMP::$mailbox, null, null, false)->setRaw(true)->add(array('mode' => 'msgview', 'msglist' => $imp_imap->getUtils()->toSequenceString(IMP::parseIndicesList($indices), array('mailbox' => true)))); header('Location: ' . $redirect); exit; } @@ -197,10 +197,10 @@ $mailbox_token = Horde::getRequestToken('imp.mailbox'); /* Deal with filter options. */ if (!$readonly && !empty($_SESSION['imp']['filteravail'])) { /* Only allow filter on display for INBOX. */ - if (($imp_mbox['mailbox'] == 'INBOX') && + if ((IMP::$mailbox == 'INBOX') && $prefs->getValue('filter_on_display')) { $do_filter = true; - } elseif (($imp_mbox['mailbox'] == 'INBOX') || + } elseif ((IMP::$mailbox == 'INBOX') || ($prefs->getValue('filter_any_mailbox') && !$search_mbox)) { $filter_url = $mailbox_imp_url->copy()->add(array('actionID' => 'filter', 'mailbox_token' => $mailbox_token)); } @@ -209,7 +209,7 @@ if (!$readonly && !empty($_SESSION['imp']['filteravail'])) { /* Run filters now. */ if ($do_filter) { $imp_filter = new IMP_Filter(); - $imp_filter->filter($imp_mbox['mailbox']); + $imp_filter->filter(IMP::$mailbox); } /* Generate folder options list. */ @@ -218,14 +218,14 @@ if ($conf['user']['allow_folders']) { } /* Build the list of messages in the mailbox. */ -$imp_mailbox = $injector->getInstance('IMP_Mailbox')->getOb($imp_mbox['mailbox']); +$imp_mailbox = $injector->getInstance('IMP_Mailbox')->getOb(IMP::$mailbox); $pageOb = $imp_mailbox->buildMailboxPage(Horde_Util::getFormData('page'), $start); $show_preview = $prefs->getValue('preview_enabled'); $mbox_info = $imp_mailbox->getMailboxArray(range($pageOb['begin'], $pageOb['end']), array('preview' => $show_preview, 'headers' => true, 'structure' => $prefs->getValue('atc_flag'))); /* Determine sorting preferences. */ -$sortpref = IMP::getSort($imp_mbox['mailbox']); +$sortpref = IMP::getSort(IMP::$mailbox); /* Determine if we are going to show the Hide/Purge Deleted Message links. */ if (!$prefs->getValue('use_trash') && @@ -270,16 +270,16 @@ if ($pageOb['pagecount']) { } /* Generate RSS link. */ -if ($imp_mbox['mailbox'] == 'INBOX') { +if (IMP::$mailbox == 'INBOX') { $rss_box = ''; } else { - $rss_box = $imp_mbox['mailbox']; - $ns_info = $imp_imap->getNamespace($imp_mbox['mailbox']); + $rss_box = IMP::$mailbox; + $ns_info = $imp_imap->getNamespace(IMP::$mailbox); if ($ns_info !== null) { if (!empty($ns_info['name']) && $ns_info['type'] == 'personal' && - substr($imp_mbox['mailbox'], 0, strlen($ns_info['name'])) == $ns_info['name']) { - $rss_box = substr($imp_mbox['mailbox'], strlen($ns_info['name'])); + substr(IMP::$mailbox, 0, strlen($ns_info['name'])) == $ns_info['name']) { + $rss_box = substr(IMP::$mailbox, strlen($ns_info['name'])); } $rss_box = str_replace(rawurlencode($ns_info['delimiter']), '/', rawurlencode($ns_info['delimiter'] . $rss_box)); } else { @@ -333,7 +333,7 @@ if ($prefs->getValue('nav_popup') || $prefs->getValue('nav_audio')) { $newmsgs = $imp_mailbox->newMessages(Horde_Imap_Client::SORT_RESULTS_COUNT); } -$pagetitle = $title = IMP::getLabel($imp_mbox['mailbox']); +$pagetitle = $title = IMP::getLabel(IMP::$mailbox); $refresh_title = sprintf(_("_Refresh %s"), $title); $refresh_ak = Horde::getAccessKey($refresh_title); $refresh_title = Horde::stripAccessKey($refresh_title); @@ -375,7 +375,7 @@ if ($open_compose_window === false) { if (!empty($newmsgs)) { /* Open the mailbox R/W so we ensure the 'recent' flags are cleared from * the current mailbox. */ - $imp_imap->openMailbox($imp_mbox['mailbox'], Horde_Imap_Client::OPEN_READWRITE); + $imp_imap->openMailbox(IMP::$mailbox, Horde_Imap_Client::OPEN_READWRITE); if (!Horde_Util::getFormData('no_newmail_popup')) { /* Newmail alerts. */ @@ -408,9 +408,9 @@ if ($_SESSION['imp']['protocol'] != 'pop') { $hdr_template->set('search_img', Horde::img('search.png', _("Search"))); if (!$search_mbox) { - $hdr_template->set('search_url', Horde::applicationUrl('search-basic.php')->add('search_mailbox', $imp_mbox['mailbox'])); + $hdr_template->set('search_url', Horde::applicationUrl('search-basic.php')->add('search_mailbox', IMP::$mailbox)); if (!$readonly) { - $hdr_template->set('empty', $mailbox_imp_url->copy()->add(array('actionID' => 'empty_mailbox', 'mailbox' => $imp_mbox['mailbox'], 'mailbox_token' => $mailbox_token))); + $hdr_template->set('empty', $mailbox_imp_url->copy()->add(array('actionID' => 'empty_mailbox', 'mailbox' => IMP::$mailbox, 'mailbox_token' => $mailbox_token))); $hdr_template->set('empty_img', Horde::img('empty_spam.png', _("Empty folder"))); } } else { @@ -481,7 +481,7 @@ if ($pageOb['msgcount']) { $n_template->set('use_pop', $_SESSION['imp']['protocol'] == 'pop'); if (!$n_template->get('use_pop')) { - $tmp = $imp_flags->getFlagList($search_mbox ? null : $imp_mbox['mailbox']); + $tmp = $imp_flags->getFlagList($search_mbox ? null : IMP::$mailbox); $n_template->set('flaglist_set', $tmp['set']); $n_template->set('flaglist_unset', $tmp['unset']); @@ -493,7 +493,7 @@ if ($pageOb['msgcount']) { } $n_template->set('mailbox_url', $mailbox_url); - $n_template->set('mailbox', htmlspecialchars($imp_mbox['mailbox'])); + $n_template->set('mailbox', htmlspecialchars(IMP::$mailbox)); if ($pageOb['pagecount'] > 1) { $n_template->set('multiple_page', true); $n_template->set('pages_first', $pages_first); @@ -509,7 +509,7 @@ if ($pageOb['msgcount']) { /* Prepare the actions template. */ $a_template = $injector->createInstance('Horde_Template'); if (!$readonly) { - $del_class = ($use_trash && (($imp_mbox['mailbox'] == (IMP::folderPref($prefs->getValue('trash_folder'), true))) || !is_null($vtrash))) + $del_class = ($use_trash && ((IMP::$mailbox == (IMP::folderPref($prefs->getValue('trash_folder'), true))) || !is_null($vtrash))) ? 'permdeleteAction' : 'deleteAction'; $a_template->set('delete', Horde::widget('#', _("Delete"), 'widget ' . $del_class, '', '', _("_Delete"))); @@ -558,13 +558,13 @@ if ($pageOb['msgcount']) { if ($conf['spam']['reporting'] && ($conf['spam']['spamfolder'] || - ($imp_mbox['mailbox'] != IMP::folderPref($prefs->getValue('spam_folder'), true)))) { + (IMP::$mailbox != IMP::folderPref($prefs->getValue('spam_folder'), true)))) { $a_template->set('spam', Horde::widget('#', _("Report as Spam"), 'widget spamAction', '', '', _("Report as Spam"))); } if ($conf['notspam']['reporting'] && (!$conf['notspam']['spamfolder'] || - ($imp_mbox['mailbox'] == IMP::folderPref($prefs->getValue('spam_folder'), true)))) { + (IMP::$mailbox == IMP::folderPref($prefs->getValue('spam_folder'), true)))) { $a_template->set('notspam', Horde::widget('#', _("Report as Innocent"), 'widget notspamAction', '', '', _("Report as Innocent"))); } @@ -621,14 +621,14 @@ $headers = array( ); /* If this is the Drafts or Sent-Mail Folder, sort by To instead of From. */ -if (IMP::isSpecialFolder($imp_mbox['mailbox'])) { +if (IMP::isSpecialFolder(IMP::$mailbox)) { unset($headers[Horde_Imap_Client::SORT_FROM]); } else { unset($headers[Horde_Imap_Client::SORT_TO]); } /* Determine which of Subject/Thread to emphasize. */ -if (!IMP::threadSortAvailable($imp_mbox['mailbox'])) { +if (!IMP::threadSortAvailable(IMP::$mailbox)) { unset($headers[Horde_Imap_Client::SORT_THREAD]); } else { if ($sortpref['by'] == Horde_Imap_Client::SORT_THREAD) { @@ -656,7 +656,7 @@ foreach ($headers as $key => $val) { /* Output the form start. */ $f_template = $injector->createInstance('Horde_Template'); -$f_template->set('mailbox', htmlspecialchars($imp_mbox['mailbox'])); +$f_template->set('mailbox', htmlspecialchars(IMP::$mailbox)); $f_template->set('mailbox_token', $mailbox_token); $f_template->set('mailbox_url', $mailbox_url); $f_template->set('sessiontag', Horde_Util::formInput()); @@ -676,7 +676,7 @@ if (!$search_mbox) { /* Initialize repetitively used variables. */ $fromlinkstyle = $prefs->getValue('from_link'); -$imp_ui = new IMP_Ui_Mailbox($imp_mbox['mailbox']); +$imp_ui = new IMP_Ui_Mailbox(IMP::$mailbox); /* Display message information. */ $msgs = array(); @@ -721,7 +721,7 @@ while (list(,$ob) = each($mbox_info['overview'])) { $msg['id'] = preg_replace('/[^0-9a-z\-_:\.]/i', '_', str_replace('_', '__', rawurlencode($ob['uid'] . $ob['mailbox']))); /* Generate the target link. */ - $target = IMP::generateIMPUrl('message.php', $imp_mbox['mailbox'], $ob['uid'], $ob['mailbox']); + $target = IMP::generateIMPUrl('message.php', IMP::$mailbox, $ob['uid'], $ob['mailbox']); /* Get all the flag information. */ try { @@ -790,7 +790,7 @@ while (list(,$ob) = each($mbox_info['overview'])) { break; case 1: - $from_uri = IMP::generateIMPUrl('message.php', $imp_mbox['mailbox'], $ob['uid'], $ob['mailbox']); + $from_uri = IMP::generateIMPUrl('message.php', IMP::$mailbox, $ob['uid'], $ob['mailbox']); $msg['from'] = Horde::link($from_uri, $msg['fullfrom']) . $msg['from'] . ''; break; } diff --git a/imp/message-mimp.php b/imp/message-mimp.php index 7621a58c8..b2d331473 100644 --- a/imp/message-mimp.php +++ b/imp/message-mimp.php @@ -25,13 +25,13 @@ Horde_Nls::setTimeZone(); $vars = Horde_Variables::getDefaultVariables(); /* Make sure we have a valid index. */ -$imp_mailbox = $GLOBALS['injector']->getInstance('IMP_Mailbox')->getOb($imp_mbox['mailbox'], $imp_mbox['thismailbox'], $imp_mbox['uid']); +$imp_mailbox = $GLOBALS['injector']->getInstance('IMP_Mailbox')->getOb(IMP::$mailbox, IMP::$thismailbox, IMP::$uid); if (!$imp_mailbox->isValidIndex(false)) { - header('Location: ' . IMP::generateIMPUrl('mailbox-mimp.php', $imp_mbox['mailbox'])->setRaw(true)->add('a', 'm')); + header('Location: ' . IMP::generateIMPUrl('mailbox-mimp.php', IMP::$mailbox)->setRaw(true)->add('a', 'm')); exit; } -$readonly = $imp_imap->isReadOnly($imp_mbox['mailbox']); +$readonly = $imp_imap->isReadOnly(IMP::$mailbox); $imp_mimp = $injector->getInstance('IMP_Ui_Mimp'); $imp_hdr_ui = new IMP_Ui_Headers(); @@ -87,7 +87,7 @@ if ($imp_ui->moveAfterAction()) { * case. */ if (!$imp_mailbox->isValidIndex() || ($msg_delete && $prefs->getValue('mailbox_return'))) { - header('Location: ' . IMP::generateIMPUrl('mailbox-mimp.php', $imp_mbox['mailbox'])->setRaw(true)->add('s', $msg_index)); + header('Location: ' . IMP::generateIMPUrl('mailbox-mimp.php', IMP::$mailbox)->setRaw(true)->add('s', $msg_index)); exit; } @@ -131,8 +131,8 @@ $msgindex = $imp_mailbox->getMessageIndex(); $msgcount = $imp_mailbox->getMessageCount(); /* Generate the mailbox link. */ -$mailbox_link = IMP::generateIMPUrl('mailbox-mimp.php', $imp_mbox['mailbox'])->add('s', $msgindex); -$self_link = IMP::generateIMPUrl('message-mimp.php', $imp_mbox['mailbox'], $uid, $mailbox_name); +$mailbox_link = IMP::generateIMPUrl('mailbox-mimp.php', IMP::$mailbox)->add('s', $msgindex); +$self_link = IMP::generateIMPUrl('message-mimp.php', IMP::$mailbox, $uid, $mailbox_name); /* Initialize Horde_Template. */ $t = $injector->createInstance('Horde_Template'); @@ -288,13 +288,13 @@ if (IMP::canCompose()) { /* Generate previous/next links. */ if ($prev_msg = $imp_mailbox->getIMAPIndex(-1)) { - $menu[] = array(_("Previous Message"), IMP::generateIMPUrl('message-mimp.php', $imp_mbox['mailbox'], $prev_msg['uid'], $prev_msg['mailbox'])); + $menu[] = array(_("Previous Message"), IMP::generateIMPUrl('message-mimp.php', IMP::$mailbox, $prev_msg['uid'], $prev_msg['mailbox'])); } if ($next_msg = $imp_mailbox->getIMAPIndex(1)) { - $menu[] = array(_("Next Message"), IMP::generateIMPUrl('message-mimp.php', $imp_mbox['mailbox'], $next_msg['uid'], $next_msg['mailbox'])); + $menu[] = array(_("Next Message"), IMP::generateIMPUrl('message-mimp.php', IMP::$mailbox, $next_msg['uid'], $next_msg['mailbox'])); } -$menu[] = array(sprintf(_("To %s"), IMP::getLabel($imp_mbox['mailbox'])), $mailbox_link); +$menu[] = array(sprintf(_("To %s"), IMP::getLabel(IMP::$mailbox)), $mailbox_link); if ($conf['spam']['reporting'] && ($conf['spam']['spamfolder'] || diff --git a/imp/message.php b/imp/message.php index 6fba92502..06179e099 100644 --- a/imp/message.php +++ b/imp/message.php @@ -27,12 +27,12 @@ Horde_Nls::setTimeZone(); /* We know we are going to be exclusively dealing with this mailbox, so * select it on the IMAP server (saves some STATUS calls). Open R/W to clear * the RECENT flag. */ -if (!($search_mbox = $injector->getInstance('IMP_Search')->isSearchMbox($imp_mbox['mailbox']))) { - $injector->getInstance('IMP_Imap')->getOb()->openMailbox($imp_mbox['mailbox'], Horde_Imap_Client::OPEN_READWRITE); +if (!($search_mbox = $injector->getInstance('IMP_Search')->isSearchMbox(IMP::$mailbox))) { + $injector->getInstance('IMP_Imap')->getOb()->openMailbox(IMP::$mailbox, Horde_Imap_Client::OPEN_READWRITE); } /* Make sure we have a valid index. */ -$imp_mailbox = $GLOBALS['injector']->getInstance('IMP_Mailbox')->getOb($imp_mbox['mailbox'], $imp_mbox['thismailbox'], $imp_mbox['uid']); +$imp_mailbox = $GLOBALS['injector']->getInstance('IMP_Mailbox')->getOb(IMP::$mailbox, IMP::$thismailbox, IMP::$uid); if (!$imp_mailbox->isValidIndex(false)) { _returnToMailbox(null, 'message_missing'); require IMP_BASE . '/mailbox.php'; @@ -57,7 +57,7 @@ if ($vars->actionID) { } /* Determine if mailbox is readonly. */ -$peek = $readonly = $injector->getInstance('IMP_Imap')->getOb()->isReadOnly($imp_mbox['mailbox']); +$peek = $readonly = $injector->getInstance('IMP_Imap')->getOb()->isReadOnly(IMP::$mailbox); if ($readonly && in_array($vars->actionID, array('delete_message', 'undelete_message', 'move_message', 'flag_message', 'strip_attachment', 'strip_all'))) { $vars->actionID = null; @@ -219,12 +219,12 @@ $mime_headers = reset($fetch_ret[$uid]['headertext']); $use_pop = ($_SESSION['imp']['protocol'] == 'pop'); /* Get the title/mailbox label of the mailbox page. */ -$page_label = IMP::getLabel($imp_mbox['mailbox']); +$page_label = IMP::getLabel(IMP::$mailbox); /* Generate the link to ourselves. */ $msgindex = $imp_mailbox->getMessageIndex(); $message_url = Horde::applicationUrl('message.php'); -$self_link = IMP::generateIMPUrl('message.php', $imp_mbox['mailbox'], $uid, $mailbox_name)->add(array('start' => $msgindex, 'message_token' => $message_token)); +$self_link = IMP::generateIMPUrl('message.php', IMP::$mailbox, $uid, $mailbox_name)->add(array('start' => $msgindex, 'message_token' => $message_token)); /* Develop the list of headers to display. */ $basic_headers = $imp_ui->basicHeaders(); @@ -263,7 +263,7 @@ if (!empty($from_img)) { /* Look for Face: information. */ if ($mime_headers->getValue('face')) { - $view_url = IMP::generateIMPUrl('view.php', $imp_mbox['mailbox'], $uid, $mailbox_name); + $view_url = IMP::generateIMPUrl('view.php', IMP::$mailbox, $uid, $mailbox_name); // TODO: Use Data URL $view_url->add('actionID', 'view_face'); $display_headers['from'] .= ' '; @@ -355,21 +355,21 @@ 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 'uid'. */ $selfURL = Horde::selfUrl(true); -IMP::$newUrl = $selfURL = IMP::generateIMPUrl($selfURL->remove(array('actionID', 'mailbox', 'thismailbox', 'uid')), $imp_mbox['mailbox'], $uid, $mailbox_name)->add('message_token', $message_token); +IMP::$newUrl = $selfURL = IMP::generateIMPUrl($selfURL->remove(array('actionID', 'mailbox', 'thismailbox', 'uid')), IMP::$mailbox, $uid, $mailbox_name)->add('message_token', $message_token); $headersURL = $selfURL->copy()->remove(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['uid'], $prev_msg['mailbox']); + $prev_url = IMP::generateIMPUrl('message.php', IMP::$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['uid'], $next_msg['mailbox']); + $next_url = IMP::generateIMPUrl('message.php', IMP::$mailbox, $next_msg['uid'], $next_msg['mailbox']); } /* Generate the mailbox link. */ -$mailbox_url = IMP::generateIMPUrl('mailbox.php', $imp_mbox['mailbox'])->add('start', $msgindex); +$mailbox_url = IMP::generateIMPUrl('mailbox.php', IMP::$mailbox)->add('start', $msgindex); /* Everything below here is related to preparing the output. */ @@ -409,7 +409,7 @@ if ($search_mbox) { $t_template = $injector->createInstance('Horde_Template'); $t_template->set('message_url', $message_url); $t_template->set('form_input', Horde_Util::formInput()); -$t_template->set('mailbox', htmlspecialchars($imp_mbox['mailbox'])); +$t_template->set('mailbox', htmlspecialchars(IMP::$mailbox)); $t_template->set('thismailbox', htmlspecialchars($mailbox_name)); $t_template->set('start', htmlspecialchars($msgindex)); $t_template->set('uid', htmlspecialchars($uid)); @@ -426,9 +426,9 @@ $n_template->set('usepop', $use_pop); $n_template->set('id', 1); if (!$use_pop) { - $n_template->set('mailbox', $imp_mbox['mailbox']); + $n_template->set('mailbox', IMP::$mailbox); - $tmp = $imp_flags->getFlagList($imp_mbox['mailbox']); + $tmp = $imp_flags->getFlagList(IMP::$mailbox); $n_template->set('flaglist_set', $tmp['set']); $n_template->set('flaglist_unset', $tmp['unset']); @@ -461,7 +461,7 @@ $a_template = $injector->createInstance('Horde_Template'); $a_template->setOption('gettext', true); $compose_params = array('identity' => $identity, 'thismailbox' => $mailbox_name, 'uid' => $uid); if (!$prefs->getValue('compose_popup')) { - $compose_params += array('start' => $msgindex, 'mailbox' => $imp_mbox['mailbox']); + $compose_params += array('start' => $msgindex, 'mailbox' => IMP::$mailbox); } if (!$readonly) { @@ -497,8 +497,8 @@ if (!$disable_compose) { $a_template->set('redirect', Horde::widget(IMP::composeLink(array(), array('actionID' => 'redirect_compose') + $compose_params), _("Redirect"), 'widget', '', '', _("Redirec_t"), true)); } -if (IMP::threadSortAvailable($imp_mbox['mailbox'])) { - $a_template->set('show_thread', Horde::widget(IMP::generateIMPUrl('thread.php', $imp_mbox['mailbox'], $uid, $mailbox_name)->add(array('start' => $msgindex)), _("View Thread"), 'widget', '', '', _("_View Thread"), true)); +if (IMP::threadSortAvailable(IMP::$mailbox)) { + $a_template->set('show_thread', Horde::widget(IMP::generateIMPUrl('thread.php', IMP::$mailbox, $uid, $mailbox_name)->add(array('start' => $msgindex)), _("View Thread"), 'widget', '', '', _("_View Thread"), true)); } if (!$readonly && $registry->hasMethod('mail/blacklistFrom')) { @@ -520,7 +520,7 @@ if (!$disable_compose) { } } -$imp_params = IMP::getIMPMboxParameters($imp_mbox['mailbox'], $uid, $mailbox_name); +$imp_params = IMP::getIMPMboxParameters(IMP::$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)); if ($conf['spam']['reporting'] && @@ -592,7 +592,7 @@ if (!$readonly && $strip_atc) { /* Do MDN processing now. */ $mdntext = ''; -if ($imp_ui->MDNCheck($imp_mbox['mailbox'], $uid, $mime_headers, $vars->mdn_confirm)) { +if ($imp_ui->MDNCheck(IMP::$mailbox, $uid, $mime_headers, $vars->mdn_confirm)) { $mdntext .= $imp_ui->formatStatusMsg(array(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($selfURL->copy()->add('mdn_confirm', 1))) . _("HERE") . ''))))); } diff --git a/imp/rss.php b/imp/rss.php index 08cad8290..64f1d4f1d 100644 --- a/imp/rss.php +++ b/imp/rss.php @@ -58,7 +58,7 @@ if ($new_mail) { $ids = $imp_search->runSearchQuery($query, $mailbox, Horde_Imap_Client::SORT_ARRIVAL, 1); if (!empty($ids)) { - $imp_ui = new IMP_Ui_Mailbox($imp_mbox['mailbox']); + $imp_ui = new IMP_Ui_Mailbox(IMP::$mailbox); $overview = $imp_mailbox->getMailboxArray(array_slice($ids, 0, 20), array('preview' => $prefs->getValue('preview_enabled'))); diff --git a/imp/thread.php b/imp/thread.php index 1a878937f..7fe8551b9 100644 --- a/imp/thread.php +++ b/imp/thread.php @@ -21,7 +21,7 @@ Horde_Nls::setTimeZone(); $mode = Horde_Util::getFormData('mode', 'thread'); $imp_imap = $injector->getInstance('IMP_Imap')->getOb(); -$imp_mailbox = $injector->getInstance('IMP_Mailbox')->getOb($imp_mbox['mailbox'], $imp_mbox['thismailbox'], $imp_mbox['uid']); +$imp_mailbox = $injector->getInstance('IMP_Mailbox')->getOb(IMP::$mailbox, IMP::$thismailbox, IMP::$uid); $error = false; if ($mode == 'thread') { @@ -62,7 +62,7 @@ $msgs = $tree = array(); $rowct = 0; $subject = ''; -$page_label = IMP::getLabel($imp_mbox['mailbox']); +$page_label = IMP::getLabel(IMP::$mailbox); if ($mode == 'thread') { $threadob = $imp_mailbox->getThreadOb(); @@ -71,7 +71,7 @@ if ($mode == 'thread') { $imp_thread = new IMP_Imap_Thread($threadob); $threadtree = $imp_thread->getThreadImageTree($thread, false); - $loop_array = array($imp_mbox['mailbox'] => $thread); + $loop_array = array(IMP::$mailbox => $thread); } else { $loop_array = IMP::parseIndicesList($msglist); } @@ -124,7 +124,7 @@ foreach ($loop_array as $mbox => $idxlist) { } else { $curr_msg['link'] = Horde::widget('#display', _("Back to Multiple Message View Index"), 'widget', '', '', _("Back to Multiple Message View Index"), true); } - $curr_msg['link'] .= ' | ' . Horde::widget(IMP::generateIMPUrl('message.php', $imp_mbox['mailbox'], $idx, $mbox), _("Go to Message"), 'widget', '', '', _("Go to Message"), true); + $curr_msg['link'] .= ' | ' . Horde::widget(IMP::generateIMPUrl('message.php', IMP::$mailbox, $idx, $mbox), _("Go to Message"), 'widget', '', '', _("Go to Message"), true); $curr_msg['link'] .= ' | ' . Horde::widget(IMP::generateIMPUrl('mailbox.php', $mbox)->add(array('start' => $imp_mailbox->getArrayIndex($idx))), sprintf(_("Back to %s"), $page_label), 'widget', '', '', sprintf(_("Bac_k to %s"), $page_label)); $curr_tree['subject'] = (($mode == 'thread') ? $threadtree[$idx] : null) . ' ' . Horde::link('#i' . $idx) . Horde_String::truncate($subject_header, 60) . ' (' . $addr . ')'; @@ -148,7 +148,7 @@ if ($mode == 'thread') { 'mailbox_token' => Horde::getRequestToken('imp.mailbox') )); foreach ($thread as $val) { - $delete_link->add(array('indices[]' => $val . IMP::IDX_SEP . $imp_mbox['mailbox'], 'start' => $imp_mailbox->getArrayIndex($val))); + $delete_link->add(array('indices[]' => $val . IMP::IDX_SEP . IMP::$mailbox, 'start' => $imp_mailbox->getArrayIndex($val))); } $template->set('delete', Horde::link('#', _("Delete Thread"), null, null, "if (confirm('" . addslashes(_("Are you sure you want to delete all messages in this thread?")) . "')) { window.location = '" . $delete_link . "'; } return false;") . Horde::img('delete.png', _("Delete Thread")) . ''); }