// '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']);
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');
// '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);
// '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;
}
'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
/**
* Initialization function.
- *
- * Global variables defined:
- * $imp_mbox - Current mailbox information
*/
protected function _init()
{
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());
/* 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;
/**
}
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']) {
: '';
$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<br />%s</a>', 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());
global $prefs;
if (is_null($mbox)) {
- $mbox = $GLOBALS['imp_mbox']['mailbox'];
+ $mbox = self::$mailbox;
}
$search_mbox = $GLOBALS['injector']->getInstance('IMP_Search')->isSearchMbox($mbox);
$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)
}
/**
- * Sets mailbox/index information for current page load.
- *
- * The global $imp_mbox objects will contain an array with the following
- * elements:
- * <pre>
- * '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>
+ * 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.
*/
{
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;
}
}
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
));
}
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
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"));
}
public function moveAfterAction()
{
return (($_SESSION['imp']['protocol'] != 'pop') &&
- !IMP::hideDeletedMsgs($GLOBALS['imp_mbox']['mailbox']) &&
+ !IMP::hideDeletedMsgs(IMP::$mailbox) &&
!$GLOBALS['prefs']->getValue('use_trash'));
}
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'));
}
$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) {
// '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;
// '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);
$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']) {
$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));
/* 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;
}
$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 &&
/* 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);
/* 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');
* 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;
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':
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;
}
/* 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));
}
/* 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. */
}
/* 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') &&
}
/* 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 {
$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);
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. */
$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 {
$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']);
}
$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);
/* 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")));
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")));
}
);
/* 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) {
/* 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());
/* 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();
$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 {
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'] . '</a>';
break;
}
$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();
* 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;
}
$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');
/* 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'] ||
/* 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';
}
/* 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;
$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();
/* 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'] .= ' <img src="' . $view_url . '">';
* 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. */
$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));
$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']);
$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) {
$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')) {
}
}
-$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'] &&
/* 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") . '</a>')))));
}
$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')));
$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') {
$rowct = 0;
$subject = '';
-$page_label = IMP::getLabel($imp_mbox['mailbox']);
+$page_label = IMP::getLabel(IMP::$mailbox);
if ($mode == 'thread') {
$threadob = $imp_mailbox->getThreadOb();
$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);
}
} 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) . '</a> (' . $addr . ')';
'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")) . '</a>');
}