From: Michael M Slusarz Date: Wed, 3 Nov 2010 06:46:50 +0000 (-0600) Subject: IMP: Convert to new Horde_Session API X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=fe62dea49cb7c0ffef71467d4215ae915fcd131b;p=horde.git IMP: Convert to new Horde_Session API --- diff --git a/imp/compose-dimp.php b/imp/compose-dimp.php index 0c0cd0a84..b0c6f3204 100644 --- a/imp/compose-dimp.php +++ b/imp/compose-dimp.php @@ -130,7 +130,7 @@ case 'forward_both': break; } - $rte = $show_editor = ($prefs->getValue('compose_html') && $session['imp:rteavail']); + $rte = $show_editor = ($prefs->getValue('compose_html') && $session->get('imp', 'rteavail')); } else { try { $contents = $imp_ui->getContents($vars); @@ -192,7 +192,7 @@ case 'resume': break; case 'new': - $rte = $show_editor = ($prefs->getValue('compose_html') && $session['imp:rteavail']); + $rte = $show_editor = ($prefs->getValue('compose_html') && $session->get('imp', 'rteavail')); break; } diff --git a/imp/compose-mimp.php b/imp/compose-mimp.php index 0400ba99c..5d00cf453 100644 --- a/imp/compose-mimp.php +++ b/imp/compose-mimp.php @@ -101,7 +101,7 @@ foreach (array_keys($display_hdrs) as $val) { } /* Add attachment. */ -if ($session['imp:file_upload'] && +if ($session->get('imp', 'file_upload') && !$imp_compose->addFilesFromUpload('upload_', $vars->a == _("Expand Names")) && ($vars->a != _("Expand Names"))) { $vars->a = null; @@ -378,7 +378,7 @@ $t->set('hdrs', $hdrs); $t->set('title', $title); /* Activate advanced compose attachments UI? */ -if ($session['imp:file_upload']) { +if ($session->get('imp', 'file_upload')) { try { if (Horde::callHook('mimp_advanced', array('compose_attach'), 'imp')) { $t->set('attach', true); diff --git a/imp/compose.php b/imp/compose.php index fdf8dcbd0..34462a982 100644 --- a/imp/compose.php +++ b/imp/compose.php @@ -145,7 +145,7 @@ $isPopup = ($prefs->getValue('compose_popup') || $vars->popup); /* Determine the composition type - text or HTML. $rtemode is null if browser does not support it. */ $rtemode = null; -if ($session['imp:rteavail']) { +if ($session->get('imp', 'rteavail')) { if ($prefs->isLocked('compose_html')) { $rtemode = $prefs->getValue('compose_html'); } else { @@ -160,7 +160,7 @@ if ($session['imp:rteavail']) { } /* Update the file attachment information. */ -if ($session['imp:file_upload']) { +if ($session->get('imp', 'file_upload')) { /* Only notify if we are reloading the compose screen. */ $notify = !in_array($vars->actionID, array('send_message', 'save_draft')); @@ -711,7 +711,7 @@ if ($redirect) { /* Prepare the compose template. */ $tabindex = 0; - $t->set('file_upload', $session['imp:file_upload']); + $t->set('file_upload', $session->get('imp', 'file_upload')); $t->set('forminput', Horde_Util::formInput()); $hidden = array( @@ -726,8 +726,8 @@ if ($redirect) { 'user' => $registry->getAuth() ); - if (isset($session['imp:file_upload'])) { - $hidden['MAX_FILE_SIZE'] = $session['imp:file_upload']; + if ($session->exists('imp', 'file_upload')) { + $hidden['MAX_FILE_SIZE'] = $session->get('imp', 'file_upload'); } foreach (array('page', 'start', 'popup') as $val) { $hidden[$val] = htmlspecialchars($vars->$val); @@ -869,7 +869,7 @@ if ($redirect) { 'label' => '' ); } - if ($session['imp:file_upload']) { + if ($session->get('imp', 'file_upload')) { $url = new Horde_Url('#attachments'); $compose_options[] = array( 'url' => $url->link(array('class' => 'widget')), @@ -956,7 +956,7 @@ if ($redirect) { $t->set('vcard', Horde::label('vcard', _("Attach your contact information to the message?"))); $t->set('attach_vcard', $vars->vcard); } - if ($session['imp:file_upload']) { + if ($session->get('imp', 'file_upload')) { $localeinfo = Horde_Nls::getLocaleInfo(); try { $t->set('selectlistlink', $registry->call('files/selectlistLink', array(_("Attach Files"), 'widget', 'compose', true))); diff --git a/imp/folders-mimp.php b/imp/folders-mimp.php index a33ad41c4..f6e202ab9 100644 --- a/imp/folders-mimp.php +++ b/imp/folders-mimp.php @@ -29,7 +29,7 @@ if (empty($conf['user']['allow_folders'])) { /* Decide whether or not to show all the unsubscribed folders */ $subscribe = $prefs->getValue('subscribe'); -$showAll = (!$subscribe || $session['imp:showunsub']); +$showAll = (!$subscribe || $session->get('imp', 'showunsub')); /* Initialize the IMP_Imap_Tree object. */ $imptree = $injector->getInstance('IMP_Imap_Tree'); @@ -38,7 +38,7 @@ $mask = 0; /* Toggle subscribed view, if necessary. */ if ($subscribe && Horde_Util::getFormData('ts')) { $showAll = !$showAll; - $session['imp:showunsub'] = $showAll; + $session->set('imp', 'showunsub', $showAll); $imptree->showUnsubscribed($showAll); if ($showAll) { $mask |= IMP_Imap_Tree::FLIST_UNSUB; diff --git a/imp/folders.php b/imp/folders.php index e1499f00d..78a283161 100644 --- a/imp/folders.php +++ b/imp/folders.php @@ -30,7 +30,7 @@ if (!$conf['user']['allow_folders']) { /* Decide whether or not to show all the unsubscribed folders */ $subscribe = $prefs->getValue('subscribe'); -$showAll = (!$subscribe || $session['imp:showunsub']); +$showAll = (!$subscribe || $session->get('imp', 'showunsub')); $vars = Horde_Variables::getDefaultVariables(); @@ -204,7 +204,7 @@ case 'unsubscribe_folder': case 'toggle_subscribed_view': if ($subscribe) { $showAll = !$showAll; - $session['imp:showunsub'] = $showAll; + $session->set('imp', 'showunsub', $showAll); $imaptree->showUnsubscribed($showAll); } break; @@ -331,7 +331,8 @@ $folders_token = Horde::getRequestToken('imp.folders'); $folders_url_ob = new Horde_Url($folders_url); $folders_url_ob->add('folders_token', $folders_token); -if ($session['imp:file_upload'] && ($vars->actionID == 'import_mbox')) { +if ($session->get('imp', 'file_upload') && + ($vars->actionID == 'import_mbox')) { $title = _("Folder Navigator"); $menu = IMP::menu(); require IMP_TEMPLATES . '/common-header.inc'; @@ -389,7 +390,7 @@ if ($prefs->getValue('subscribe')) { } $a_template->set('nav_poll', !$prefs->isLocked('nav_poll') && !$prefs->getValue('nav_poll_all')); $a_template->set('notrash', !$prefs->getValue('use_trash')); -$a_template->set('file_upload', $session['imp:file_upload']); +$a_template->set('file_upload', $session->get('imp', 'file_upload')); $a_template->set('expand_all', Horde::widget($folders_url_ob->copy()->add(array('actionID' => 'expand_all_folders', 'folders_token' => $folders_token)), _("Expand All Folders"), 'widget', '', '', _("Expand All"), true)); $a_template->set('collapse_all', Horde::widget($folders_url_ob->copy()->add(array('actionID' => 'collapse_all_folders', 'folders_token' => $folders_token)), _("Collapse All Folders"), 'widget', '', '', _("Collapse All"), true)); diff --git a/imp/lib/Ajax/Application.php b/imp/lib/Ajax/Application.php index cbba8a119..bd44638c8 100644 --- a/imp/lib/Ajax/Application.php +++ b/imp/lib/Ajax/Application.php @@ -1534,7 +1534,7 @@ class IMP_Ajax_Application extends Horde_Core_Ajax_Application $result->action = 'addAttachment'; $result->success = 0; - if ($GLOBALS['session']['imp:file_upload'] && + if ($GLOBALS['session']->get('imp', 'file_upload') && $imp_compose->addFilesFromUpload('file_')) { $result->atc = end(IMP_Dimp::getAttachmentInfo($imp_compose)); $result->success = 1; @@ -2060,7 +2060,7 @@ class IMP_Ajax_Application extends Horde_Core_Ajax_Application */ protected function _getQuota() { - if ($GLOBALS['session']['imp:imap_quota']) { + if ($GLOBALS['session']->get('imp', 'imap_quota')) { $quotadata = IMP::quotaData(false); if (!empty($quotadata)) { return array( diff --git a/imp/lib/Ajax/Imple/ContactAutoCompleter.php b/imp/lib/Ajax/Imple/ContactAutoCompleter.php index 79b7e3559..eb0bf3426 100644 --- a/imp/lib/Ajax/Imple/ContactAutoCompleter.php +++ b/imp/lib/Ajax/Imple/ContactAutoCompleter.php @@ -40,7 +40,7 @@ class IMP_Ajax_Imple_ContactAutoCompleter extends Horde_Core_Ajax_Imple_AutoComp ? 0 : $GLOBALS['conf']['compose']['ac_browser']; - if ($ac_browser && empty($GLOBALS['session']['imp:ac_ajax'])) { + if ($ac_browser && !$GLOBALS['session']->get('imp', 'ac_ajax')) { $success = $use_ajax = true; $sparams = IMP::getAddressbookSearchParams(); foreach ($sparams['fields'] as $val) { @@ -55,10 +55,10 @@ class IMP_Ajax_Imple_ContactAutoCompleter extends Horde_Core_Ajax_Imple_AutoComp $addrlist = IMP_Compose::getAddressList(); $use_ajax = count($addrlist) > $ac_browser; } - $GLOBALS['session']['imp:ac_ajax'] = $use_ajax; + $GLOBALS['session']->set('imp', 'ac_ajax', $use_ajax); } - if (!$ac_browser || $GLOBALS['session']['imp:ac_ajax']) { + if (!$ac_browser || $GLOBALS['session']->get('imp', 'ac_ajax')) { $ret['ajax'] = 'ContactAutoCompleter'; $ret['params']['minChars'] = intval($GLOBALS['conf']['compose']['ac_threshold'] ? $GLOBALS['conf']['compose']['ac_threshold'] : 1); } else { diff --git a/imp/lib/Api.php b/imp/lib/Api.php index 7856972c9..52ba1fe16 100644 --- a/imp/lib/Api.php +++ b/imp/lib/Api.php @@ -186,7 +186,7 @@ class IMP_Api extends Horde_Registry_Api return array( 'hostspec' => $imap_ob->ob->getParam('hostspec'), 'port' => $imap_ob->ob->getParam('port'), - 'protocol' => $GLOBALS['session']['imp:protocol'], + 'protocol' => $GLOBALS['session']->get('imp', 'protocol'), 'secure' => $imap_ob->ob->getParam('secure') ); } @@ -228,7 +228,7 @@ class IMP_Api extends Horde_Registry_Api */ public function flagList($mailbox = null) { - if ($GLOBALS['session']['imp:protocol'] == 'pop') { + if ($GLOBALS['session']->get('imp', 'protocol') == 'pop') { return array(); } diff --git a/imp/lib/Application.php b/imp/lib/Application.php index 95714ad8f..3f5373a1c 100644 --- a/imp/lib/Application.php +++ b/imp/lib/Application.php @@ -65,7 +65,7 @@ class IMP_Application extends Horde_Registry_Application { /* Methods only available if admin config is set for this * server/login. */ - if (!$GLOBALS['session']['imp:imap_admin']) { + if (!$GLOBALS['session']->get('imp', 'imap_admin')) { $this->disabled = array_merge($this->disabled, array('authAddUser', 'authRemoveUser', 'authUserList')); } } @@ -148,7 +148,7 @@ class IMP_Application extends Horde_Registry_Application public function logout() { /* Clean up dangling IMP_Compose objects. */ - foreach (array_keys($GLOBALS['session']['imp:compose_cache;array']) as $key) { + foreach (array_keys($GLOBALS['session']->get('imp', 'compose_cache', Horde_Session::TYPE_ARRAY)) as $key) { $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Compose')->create($key)->destroy('cancel'); } } @@ -233,7 +233,7 @@ class IMP_Application extends Horde_Registry_Application 'url' => IMP::generateIMPUrl($menu_mailbox_url, 'INBOX') )); - if ($GLOBALS['session']['imp:protocol'] != 'pop') { + if ($GLOBALS['session']->get('imp', 'protocol') != 'pop') { if ($prefs->getValue('use_trash') && ($trash_folder = $prefs->getValue('trash_folder')) && $prefs->getValue('empty_trash_menu')) { @@ -281,7 +281,7 @@ class IMP_Application extends Horde_Registry_Application )); } - if ($GLOBALS['session']['imp:protocol'] != 'pop') { + if ($GLOBALS['session']->get('imp', 'protocol') != 'pop') { $menu->addArray(array( 'icon' => 'search.png', 'text' =>_("_Search"), @@ -390,9 +390,13 @@ class IMP_Application extends Horde_Registry_Application )); if ($new_session) { - $GLOBALS['session']['imp:select_view'] = empty($credentials['imp_select_view']) - ? '' - : $credentials['imp_select_view']; + $GLOBALS['session']->set( + 'imp', + 'select_view', + empty($credentials['imp_select_view']) + ? '' + : $credentials['imp_select_view'] + ); } } @@ -584,7 +588,7 @@ class IMP_Application extends Horde_Registry_Application ) ); - if ($GLOBALS['session']['imp:protocol'] == 'pop') { + if ($GLOBALS['session']->get('imp', 'protocol') == 'pop') { return; } diff --git a/imp/lib/Auth.php b/imp/lib/Auth.php index 871143d53..016a95e8f 100644 --- a/imp/lib/Auth.php +++ b/imp/lib/Auth.php @@ -58,7 +58,7 @@ class IMP_Auth /* _createSession() will create the imp session variable, so there * is no concern for an infinite loop here. */ - if (!isset($GLOBALS['session']['imp:server_key'])) { + if (!$GLOBALS['session']->exists('imp', 'server_key')) { self::_createSession($credentials); return true; } @@ -162,7 +162,7 @@ class IMP_Auth empty($_SERVER['HTTP_X_FORWARDED_FOR']) ? '' : ' (forwarded for [' . $_SERVER['HTTP_X_FORWARDED_FOR'] . '])', $imap_ob ? $imap_ob->getParam('hostspec') : '', $imap_ob ? $imap_ob->getParam('port') : '', - isset($GLOBALS['session:imp']['protocol']) ? ' [' . $GLOBALS['session']['imp:protocol'] . ']' : '' + isset($GLOBALS['session:imp']['protocol']) ? ' [' . $GLOBALS['session']->get('imp', 'protocol') . ']' : '' ); Horde::logMessage($msg, $level); @@ -211,7 +211,7 @@ class IMP_Auth */ static protected function _createSession($credentials) { - $GLOBALS['session']['imp:server_key'] = $credentials['server']; + $GLOBALS['session']->set('imp', 'server_key', $credentials['server']); /* Load the server configuration. */ $ptr = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->loadServerConfig($credentials['server']); @@ -227,7 +227,7 @@ class IMP_Auth 'userId' => $credentials['userId'] )); } catch (Horde_Auth_Exception $e) { - unset($GLOBALS['session']['imp:']); + $GLOBALS['session']->remove('imp'); throw $e; } } @@ -329,7 +329,7 @@ class IMP_Auth */ static public function getInitialPage($url = false) { - switch ($GLOBALS['session']['imp:view']) { + switch ($GLOBALS['session']->get('imp', 'view')) { case 'dimp': $page = 'index-dimp.php'; break; @@ -339,7 +339,7 @@ class IMP_Auth break; default: - $init_url = ($GLOBALS['session']['imp:protocol'] == 'pop') + $init_url = ($GLOBALS['session']->get('imp', 'protocol') == 'pop') ? 'INBOX' : $GLOBALS['prefs']->getValue('initial_page'); @@ -377,27 +377,23 @@ class IMP_Auth */ static public function authenticateCallback() { - global $conf, $session; + global $browser, $conf, $injector, $prefs, $registry, $session; - $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create(); - $ptr = $imp_imap->loadServerConfig($session['imp:server_key']); + $imp_imap = $injector->getInstance('IMP_Injector_Factory_Imap')->create(); + $ptr = $imp_imap->loadServerConfig($session->get('imp', 'server_key')); if ($ptr === false) { throw new Horde_Auth_Exception('', Horde_Auth::REASON_FAILED); } /* Set the protocol. */ - $session['imp:protocol'] = isset($ptr['protocol']) - ? $ptr['protocol'] - : 'imap'; + $session->set('imp', 'protocol', isset($ptr['protocol']) ? $ptr['protocol'] : 'imap'); /* Set the maildomain. */ - $maildomain = $GLOBALS['prefs']->getValue('mail_domain'); - $session['imp:maildomain'] = $maildomain - ? $maildomain - : $ptr['maildomain']; + $maildomain = $prefs->getValue('mail_domain'); + $session->set('imp', 'maildomain', $maildomain ? $maildomain : $ptr['maildomain']); /* Store some basic IMAP server information. */ - if ($session['imp:protocol'] == 'imap') { + if ($session->get('imp', 'protocol') == 'imap') { foreach (array('acl', 'admin', 'namespace', 'quota') as $val) { if (!empty($ptr[$val])) { $tmp = $ptr[$val]; @@ -406,19 +402,23 @@ class IMP_Auth * these entries in the session if they exist. */ foreach (array('password', 'admin_password') as $key) { if (isset($ptr[$val]['params'][$key])) { - $secret = $GLOBALS['injector']->getInstance('Horde_Secret'); + $secret = $injector->getInstance('Horde_Secret'); $tmp['params'][$key] = $secret->write($secret->getKey('imp'), $ptr[$val]['params'][$key]); } } - $session['imp:imap_' . $val] = $tmp; + $session->set('imp', 'imap_' . $val, $tmp); } } /* Set the IMAP threading algorithm. */ - $session['imp:imap_thread'] = in_array(isset($ptr['thread']) ? strtoupper($ptr['thread']) : 'REFERENCES', $imp_imap->queryCapability('THREAD')) - ? 'REFERENCES' - : 'ORDEREDSUBJECT'; + $session->set( + 'imp', + 'imap_thread', + in_array(isset($ptr['thread']) ? strtoupper($ptr['thread']) : 'REFERENCES', $imp_imap->queryCapability('THREAD')) + ? 'REFERENCES' + : 'ORDEREDSUBJECT' + ); } /* Set the SMTP options, if needed. */ @@ -431,48 +431,48 @@ class IMP_Auth } if (!empty($smtp)) { - $session['imp:smtp'] = $smtp; + $session->set('imp', 'smtp', $smtp); } } /* Does the server allow file uploads? If yes, store the * value, in bytes, of the maximum file size. */ - $session['imp:file_upload'] = $GLOBALS['browser']->allowFileUploads(); + $session->set('imp', 'file_upload', $browser->allowFileUploads()); /* Is the 'mail/canApplyFilters' API call available? */ try { - if ($GLOBALS['registry']->call('mail/canApplyFilters')) { - $session['imp:filteravail'] = true; + if ($registry->call('mail/canApplyFilters')) { + $session->set('imp', 'filteravail', true); } } catch (Horde_Exception $e) {} /* Is the 'tasks/listTasklists' call available? */ if ($conf['tasklist']['use_tasklist'] && - $GLOBALS['registry']->hasMethod('tasks/listTasklists')) { - $session['imp:tasklistavail'] = true; + $registry->hasMethod('tasks/listTasklists')) { + $session->set('imp', 'tasklistavail', true); } /* Is the 'notes/listNotepads' call available? */ if ($conf['notepad']['use_notepad'] && - $GLOBALS['registry']->hasMethod('notes/listNotepads')) { - $session['imp:notepadavail'] = true; + $registry->hasMethod('notes/listNotepads')) { + $session->set('imp', 'notepadavail', true); } /* Is the HTML editor available? */ $imp_ui = new IMP_Ui_Compose(); - $session['imp:rteavail'] = $GLOBALS['injector']->getInstance('Horde_Editor')->supportedByBrowser(); + $session->set('imp', 'rteavail', $injector->getInstance('Horde_Editor')->supportedByBrowser()); /* Determine view. */ $setcookie = false; if (empty($conf['user']['force_view'])) { if (empty($conf['user']['select_view']) || - !$session['imp:select_view']) { - $view = $GLOBALS['browser']->isMobile() + !$session->get('imp', 'select_view')) { + $view = $browser->isMobile() ? 'mimp' - : ($GLOBALS['prefs']->getValue('dynamic_view') ? 'dimp' : 'imp'); + : ($prefs->getValue('dynamic_view') ? 'dimp' : 'imp'); } else { $setcookie = true; - $view = $session['imp:select_view']; + $view = $session->get('imp', 'select_view'); } } else { $view = $conf['user']['force_view']; @@ -481,30 +481,34 @@ class IMP_Auth self::setViewMode($view); if ($setcookie) { - setcookie('default_imp_view', $session['imp:view'], time() + 30 * 86400, $conf['cookie']['path'], $conf['cookie']['domain']); + setcookie('default_imp_view', $session->get('imp', 'view'), time() + 30 * 86400, $conf['cookie']['path'], $conf['cookie']['domain']); } /* Indicate that notifications should use AJAX mode. */ - if ($session['imp:view'] == 'dimp') { - $GLOBALS['session']['horde:notification_override'] = array( - IMP_BASE . '/lib/Notification/Listener/AjaxStatus.php', - 'IMP_Notification_Listener_AjaxStatus' + if ($session->get('imp', 'view') == 'dimp') { + $session->set( + 'horde', + 'notification_override', + array( + IMP_BASE . '/lib/Notification/Listener/AjaxStatus.php', + 'IMP_Notification_Listener_AjaxStatus' + ) ); } /* Set up search information for the session. Need to manually do * first init() here since there is a cyclic IMP_Imap_Tree dependency * otherwise. */ - $GLOBALS['injector']->getInstance('IMP_Search')->init(); + $injector->getInstance('IMP_Search')->init(); /* If the user wants to run filters on login, make sure they get run. */ - if ($GLOBALS['prefs']->getValue('filter_on_login')) { - $GLOBALS['injector']->getInstance('IMP_Filter')->filter('INBOX'); + if ($prefs->getValue('filter_on_login')) { + $injector->getInstance('IMP_Filter')->filter('INBOX'); } /* Check for drafts due to session timeouts. */ - $imp_compose = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Compose')->create()->recoverSessionExpireDraft(); + $imp_compose = $injector->getInstance('IMP_Injector_Factory_Compose')->create()->recoverSessionExpireDraft(); self::_logMessage(true); } @@ -522,7 +526,7 @@ class IMP_Auth $GLOBALS['notification']->push(_("Your browser is too old to display the dynamic mode. Using traditional mode instead."), 'horde.warning'); } - $GLOBALS['session']['imp:view'] = $view; + $GLOBALS['session']->set('imp', 'view', $view); } } diff --git a/imp/lib/Block/summary.php b/imp/lib/Block/summary.php index 91fd0b156..c9b6f7400 100644 --- a/imp/lib/Block/summary.php +++ b/imp/lib/Block/summary.php @@ -39,7 +39,7 @@ class Horde_Block_imp_summary extends Horde_Block protected function _content() { $imp_ui = new IMP_Ui_Block(); - list($html_out, $newmsgs) = $imp_ui->folderSummary($GLOBALS['session']['imp:view']); + list($html_out, $newmsgs) = $imp_ui->folderSummary($GLOBALS['session']->get('imp', 'view')); $html = ''; diff --git a/imp/lib/Compose.php b/imp/lib/Compose.php index 83d053912..a9d790a00 100644 --- a/imp/lib/Compose.php +++ b/imp/lib/Compose.php @@ -193,7 +193,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator $addr = $headers[$k]; if ($session) { try { - Horde_Mime::encodeAddress(self::formatAddr($addr), $charset, $GLOBALS['session']['imp:maildomain']); + Horde_Mime::encodeAddress(self::formatAddr($addr), $charset, $GLOBALS['session']->get('imp', 'maildomain')); } catch (Horde_Mime_Exception $e) { throw new IMP_Compose_Exception(sprintf(_("Saving the draft failed. The %s header contains an invalid e-mail address: %s."), $k, $e->getMessage()), $e->getCode()); } @@ -218,7 +218,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create(); try { $imap_url = $imp_imap->getUtils()->createUrl(array( - 'type' => $GLOBALS['session']['imp:protocol'], + 'type' => $GLOBALS['session']->get('imp', 'protocol'), 'username' => $imp_imap->getParam('username'), 'hostspec' => $imp_imap->getParam('hostspec'), 'mailbox' => $this->getMetadata('mailbox'), @@ -241,7 +241,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator } return $base->toString(array( - 'defserver' => $session ? $GLOBALS['session']['imp:maildomain'] : null, + 'defserver' => $session ? $GLOBALS['session']->get('imp', 'maildomain') : null, 'headers' => $draft_headers )); } @@ -332,7 +332,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator $reply_type = 'forward'; } - if ($GLOBALS['session']['imp:view'] == 'mimp') { + if ($GLOBALS['session']->get('imp', 'view') == 'mimp') { $compose_html = false; } elseif ($prefs->getValue('compose_html')) { $compose_html = true; @@ -403,7 +403,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator $imap_url = $imp_imap->getUtils()->parseUrl(rtrim(ltrim($val, '<'), '>')); try { - if (($imap_url['type'] == $GLOBALS['session']['imp:protocol']) && + if (($imap_url['type'] == $GLOBALS['session']->get('imp', 'protocol')) && ($imap_url['username'] == $imp_imap->getParam('username')) && // Ignore hostspec and port, since these can change // even though the server is the same. UIDVALIDITY should @@ -491,7 +491,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator } } - $barefrom = Horde_Mime_Address::bareAddress($header['from'], $GLOBALS['session']['imp:maildomain']); + $barefrom = Horde_Mime_Address::bareAddress($header['from'], $GLOBALS['session']->get('imp', 'maildomain')); $encrypt = empty($opts['encrypt']) ? 0 : $opts['encrypt']; $recipients = implode(', ', $recip['list']); @@ -669,7 +669,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator } /* Generate the message string. */ - $fcc = $mime_message->toString(array('defserver' => $GLOBALS['session']['imp:maildomain'], 'headers' => $headers, 'stream' => true)); + $fcc = $mime_message->toString(array('defserver' => $GLOBALS['session']->get('imp', 'maildomain'), 'headers' => $headers, 'stream' => true)); $imp_folder = $GLOBALS['injector']->getInstance('IMP_Folder'); @@ -800,11 +800,11 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator /* Properly encode the addresses we're sending to. */ try { - $email = Horde_Mime::encodeAddress($email, is_null($message) ? 'UTF-8' : $message->getHeaderCharset(), $GLOBALS['session']['imp:maildomain']); + $email = Horde_Mime::encodeAddress($email, is_null($message) ? 'UTF-8' : $message->getHeaderCharset(), $GLOBALS['session']->get('imp', 'maildomain')); /* Validate the recipient addresses. */ Horde_Mime_Address::parseAddressList($email, array( - 'defserver' => $GLOBALS['session']['imp:maildomain'], + 'defserver' => $GLOBALS['session']->get('imp', 'maildomain'), 'validate' => true )); } catch (Horde_Mime_Exception $e) { @@ -835,7 +835,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator } try { - $r_array = Horde_Mime::encodeAddress($recipients, 'UTF-8', $GLOBALS['session']['imp:maildomain']); + $r_array = Horde_Mime::encodeAddress($recipients, 'UTF-8', $GLOBALS['session']->get('imp', 'maildomain')); $r_array = Horde_Mime_Address::parseAddressList($r_array, array('validate' => true)); } catch (Horde_Mime_Exception $e) {} @@ -988,7 +988,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator // Make sure we have a valid host. $host = trim($ob['host']); if (empty($host)) { - $host = $GLOBALS['session']['imp:maildomain']; + $host = $GLOBALS['session']->get('imp', 'maildomain'); } // Convert IDN hosts to ASCII. @@ -1504,7 +1504,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator $msg_post = ''; } - if ($GLOBALS['session']['imp:view'] == 'mimp') { + if ($GLOBALS['session']->get('imp', 'view') == 'mimp') { $compose_html = false; } elseif (!empty($opts['format'])) { $compose_html = ($opts['format'] == 'html'); @@ -1660,7 +1660,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator " -----\n" . $this->_getMsgHeaders($h) . "\n"; $msg_post = "\n\n----- " . _("End forwarded message") . " -----\n"; - if ($GLOBALS['session']['imp:view'] == 'mimp') { + if ($GLOBALS['session']->get('imp', 'view') == 'mimp') { $compose_html = false; } elseif (!empty($opts['format'])) { $compose_html = ($opts['format'] == 'html'); @@ -2220,7 +2220,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator */ public function maxAttachmentSize() { - $size = $GLOBALS['session']['imp:file_upload']; + $size = $GLOBALS['session']->get('imp', 'file_upload'); if (!empty($GLOBALS['conf']['compose']['attach_size_limit'])) { return min($size, max($GLOBALS['conf']['compose']['attach_size_limit'] - $this->sizeOfAttachments(), 0)); @@ -2444,7 +2444,8 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator $body_id = null; $mode = 'text'; - if (!empty($options['html']) && $GLOBALS['session']['imp:rteavail']) { + if (!empty($options['html']) && + $GLOBALS['session']->get('imp', 'rteavail')) { $body_id = $contents->findBody('html'); if (!is_null($body_id)) { $mode = 'html'; diff --git a/imp/lib/Crypt/Pgp.php b/imp/lib/Crypt/Pgp.php index a165298bc..451d00dac 100644 --- a/imp/lib/Crypt/Pgp.php +++ b/imp/lib/Crypt/Pgp.php @@ -394,7 +394,7 @@ class IMP_Crypt_Pgp extends Horde_Crypt_Pgp $id = 'personal'; } - if (!($cache = $GLOBALS['session']['imp:pgp']) || + if (!($cache = $GLOBALS['session']->get('imp', 'pgp')) || !isset($cache[$type][$id])) { return null; } @@ -425,9 +425,9 @@ class IMP_Crypt_Pgp extends Horde_Crypt_Pgp $secret = $GLOBALS['injector']->getInstance('Horde_Secret'); - $cache = $GLOBALS['session']['imp:pgp;array']; + $cache = $GLOBALS['session']->get('imp', 'pgp', Horde_Session::TYPE_ARRAY); $cache[$type][$id] = $secret->write($secret->getKey('imp'), $passphrase); - $GLOBALS['session']['imp:pgp'] = $cache; + $GLOBALS['session']->set('imp', 'pgp', $cache); return true; } @@ -443,13 +443,13 @@ class IMP_Crypt_Pgp extends Horde_Crypt_Pgp */ public function unsetPassphrase($type, $id = null) { - if ($cache = $GLOBALS['session']['imp:pgp']) { + if ($cache = $GLOBALS['session']->get('imp', 'pgp')) { if (($type == 'symmetric') && !is_null($id)) { unset($cache['symmetric'][$id]); } else { unset($cache[$type]); } - $GLOBALS['session']['imp:pgp'] = $cache; + $GLOBALS['session']->set('imp', 'pgp', $cache); } } @@ -524,7 +524,7 @@ class IMP_Crypt_Pgp extends Horde_Crypt_Pgp $addr_list = array(); foreach ($addresses as $val) { - $addrOb = Horde_Mime_Address::bareAddress($val, $GLOBALS['session']['imp:maildomain'], true); + $addrOb = Horde_Mime_Address::bareAddress($val, $GLOBALS['session']->get('imp', 'maildomain'), true); $key_addr = array_pop($addrOb); /* Get the public key for the address. */ diff --git a/imp/lib/Crypt/Smime.php b/imp/lib/Crypt/Smime.php index 6e1d72a36..e86bdec16 100644 --- a/imp/lib/Crypt/Smime.php +++ b/imp/lib/Crypt/Smime.php @@ -134,7 +134,7 @@ class IMP_Crypt_Smime extends Horde_Crypt_Smime protected function _encryptParameters($address) { /* We can only encrypt if we are sending to a single person. */ - $addrOb = Horde_Mime_Address::bareAddress($address, $GLOBALS['session']['imp:maildomain'], true); + $addrOb = Horde_Mime_Address::bareAddress($address, $GLOBALS['session']->get('imp', 'maildomain'), true); $key_addr = array_pop($addrOb); $public_key = $this->getPublicKey($key_addr); @@ -272,16 +272,20 @@ class IMP_Crypt_Smime extends Horde_Crypt_Smime return false; } - if (isset($session['imp:smime_passphrase'])) { + if ($session->exists('imp', 'smime_passphrase')) { $secret = $GLOBALS['injector']->getInstance('Horde_Secret'); - return $secret->read($secret->getKey('imp'), $session['imp:smime_passphrase']); - } elseif (!isset($session['imp:smime_null_passphrase'])) { - $session['imp:smime_null_passphrase'] = $this->verifyPassphrase($private_key, null) - ? null - : false; + return $secret->read($secret->getKey('imp'), $session->get('imp', 'smime_passphrase')); + } elseif (!$session->exists('imp', 'smime_null_passphrase')) { + $session->set( + 'imp', + 'smime_null_passphrase', + $this->verifyPassphrase($private_key, null) + ? null + : false + ); } - return $session['imp:smime_null_passphrase']; + return $session->get('imp', 'smime_null_passphrase'); } /** @@ -298,7 +302,7 @@ class IMP_Crypt_Smime extends Horde_Crypt_Smime } $secret = $GLOBALS['injector']->getInstance('Horde_Secret'); - $GLOBALS['session']['imp:smime_passphrase'] = $secret->write($secret->getKey('imp'), $passphrase); + $GLOBALS['session']->set('imp', 'smime_passphrase', $secret->write($secret->getKey('imp'), $passphrase)); return true; } @@ -310,7 +314,8 @@ class IMP_Crypt_Smime extends Horde_Crypt_Smime { global $session; - unset($session['imp:smime_null_passphrase'], $session['imp:smime_passphrase']); + $session->remove('imp', 'smime_null_passphrase'); + $session->remove('imp', 'smime_passphrase'); } /** diff --git a/imp/lib/Filter.php b/imp/lib/Filter.php index 5ac137cd9..b9affcef9 100644 --- a/imp/lib/Filter.php +++ b/imp/lib/Filter.php @@ -33,7 +33,7 @@ class IMP_Filter */ public function filter($mbox) { - if (!$GLOBALS['session']['imp:filteravail']) { + if (!$GLOBALS['session']->get('imp', 'filteravail')) { return; } diff --git a/imp/lib/IMP.php b/imp/lib/IMP.php index f6d4e295d..257e46e3f 100644 --- a/imp/lib/IMP.php +++ b/imp/lib/IMP.php @@ -89,7 +89,7 @@ class IMP */ static public function getViewMode() { - return ($view = $GLOBALS['session']['imp:view']) + return ($view = $GLOBALS['session']->get('imp', 'view')) ? $view : 'imp'; } @@ -426,7 +426,7 @@ class IMP { $t = $GLOBALS['injector']->createInstance('Horde_Template'); $t->set('forminput', Horde_Util::formInput()); - $t->set('use_folders', ($GLOBALS['session']['imp:protocol'] != 'pop') && $GLOBALS['conf']['user']['allow_folders'], true); + $t->set('use_folders', ($GLOBALS['session']->get('imp', 'protocol') != 'pop') && $GLOBALS['conf']['user']['allow_folders'], true); if ($t->get('use_folders')) { Horde::addScriptFile('imp.js', 'imp'); $menu_view = $GLOBALS['prefs']->getValue('menu_view'); @@ -480,7 +480,7 @@ class IMP */ static public function quotaData($long = true) { - if (!$GLOBALS['session']['imp:imap_quota']) { + if (!$GLOBALS['session']->get('imp', 'imap_quota')) { return false; } @@ -518,7 +518,7 @@ class IMP $ret['percent'] = sprintf("%.2f", $ret['percent']); } else { // Hide unlimited quota message? - if ($GLOBALS['session']['imp:quota_hide_when_unlimited']) { + if ($GLOBALS['session']->get('imp', 'quota_hide_when_unlimited')) { return false; } @@ -756,7 +756,7 @@ class IMP /* Restrict POP3 sorting to sequence only. Although possible to * abstract other sorting methods, all other methods require a * download of all messages, which is too much overhead.*/ - if ($GLOBALS['session']['imp:protocol'] == 'pop') { + if ($GLOBALS['session']->get('imp', 'protocol') == 'pop') { $ob['by'] = Horde_Imap_Client::SORT_SEQUENCE; return $ob; } @@ -809,7 +809,7 @@ class IMP * Horde_Imap_Client_Socket has a built-in ORDEREDSUBJECT * implementation. We will always prefer REFERENCES, but will fallback * to ORDEREDSUBJECT if the server doesn't support THREAD sorting. */ - return (($GLOBALS['session']['imp:protocol'] == 'imap') && + return (($GLOBALS['session']->get('imp', 'protocol') == 'imap') && !$GLOBALS['injector']->getInstance('IMP_Search')->isSearchMbox($mbox)); } @@ -972,7 +972,7 @@ class IMP $t->set('folders', $folders); $imp_search = $GLOBALS['injector']->getInstance('IMP_Search'); - if (($GLOBALS['session']['imp:protocol'] != 'pop') && + if (($GLOBALS['session']->get('imp', 'protocol') != 'pop') && ($vinbox = $imp_search['vinbox']) && $vinbox->enabled) { $t->set('vinbox', self::generateIMPUrl('mailbox.php', strval($vinbox))->link()); diff --git a/imp/lib/Imap.php b/imp/lib/Imap.php index 4505122e3..abdc61e7f 100644 --- a/imp/lib/Imap.php +++ b/imp/lib/Imap.php @@ -74,7 +74,7 @@ class IMP_Imap { /* Only need to serialize object once a session. */ if ($this->ob) { - $GLOBALS['session']['imp:imap_ob/' . $this->_serverkey] = $this->ob; + $GLOBALS['session']->set('imp', 'imap_ob/' . $this->_serverkey, $this->ob); } } @@ -93,7 +93,7 @@ class IMP_Imap } try { - if (!($this->ob = $GLOBALS['session']['imp:imap_ob/' . $this->_serverkey])) { + if (!($this->ob = $session->get('imp', 'imap_ob/' . $this->_serverkey))) { return false; } } catch (Exception $e) { @@ -102,7 +102,7 @@ class IMP_Imap throw new IMP_Exception(_("Could not acquire mail server credentials from the session.")); } - $this->_postcreate($session['imp:protocol']); + $this->_postcreate($session->get('imp', 'protocol')); return true; } @@ -237,7 +237,7 @@ class IMP_Imap /* This check can only be done for regular IMAP mailboxes. */ // TODO: POP3 also? if (!$res && - ($GLOBALS['session']['imp:protocol'] == 'imap') && + ($GLOBALS['session']->get('imp', 'protocol') == 'imap') && !$GLOBALS['injector']->getInstance('IMP_Search')->isSearchMbox($mailbox)) { try { $status = $this->ob->status($mailbox, Horde_Imap_Client::STATUS_UIDNOTSTICKY); @@ -265,16 +265,14 @@ class IMP_Imap global $session; // TODO: POP3 also? - if ($session['imp:protocol'] == 'pop') { + if ($session->get('imp', 'protocol') == 'pop') { return; } if (!isset($this->_uidvalid[$mailbox])) { $status = $this->ob->status($mailbox, Horde_Imap_Client::STATUS_UIDVALIDITY); - $val = isset($session['imp:uidvalid/' . $mailbox]) - ? $session['imp:uidvalid/' . $mailbox] - : null; - $session['imp:uidvalid/' . $mailbox] = $status['uidvalidity']; + $val = $session->get('imp', 'uidvalid/' . $mailbox); + $session->set('imp', 'uidvalid/' . $mailbox, $status['uidvalidity']); $this->_uidvalid[$mailbox] = (!is_null($val) && ($status['uidvalidity'] != $val)); } @@ -283,7 +281,7 @@ class IMP_Imap throw new IMP_Exception(_("Mailbox structure on server has changed.")); } - return $session['imp:uidvalid/' . $mailbox]; + return $session->get('imp', 'uidvalid/' . $mailbox); } /** @@ -294,7 +292,7 @@ class IMP_Imap public function getNamespaceList() { try { - return $this->ob->getNamespaces($GLOBALS['session']['imp:imap_namespace;array']); + return $this->ob->getNamespaces($GLOBALS['session']->get('imp', 'imap_namespace', Horde_Session::TYPE_ARRAY)); } catch (Horde_Imap_Client_Exception $e) { // @todo Error handling return array(); @@ -313,7 +311,7 @@ class IMP_Imap */ public function getNamespace($mailbox = null, $personal = false) { - if ($GLOBALS['session']['imp:protocol'] == 'pop') { + if ($GLOBALS['session']->get('imp', 'protocol') == 'pop') { return null; } @@ -343,7 +341,7 @@ class IMP_Imap */ public function defaultNamespace() { - if ($GLOBALS['session']['imp:protocol'] == 'pop') { + if ($GLOBALS['session']->get('imp', 'protocol') == 'pop') { return null; } diff --git a/imp/lib/Imap/Acl.php b/imp/lib/Imap/Acl.php index 9664510dc..d565dadd9 100644 --- a/imp/lib/Imap/Acl.php +++ b/imp/lib/Imap/Acl.php @@ -37,11 +37,11 @@ class IMP_Imap_Acl */ public function __construct() { - if ($GLOBALS['session']['imp:protocol'] != 'imap') { + if ($GLOBALS['session']->get('imp', 'protocol') != 'imap') { throw new IMP_Exception(_("ACL requires an IMAP server.")); } - if (!$GLOBALS['session']['imp:imap_acl']) { + if (!$GLOBALS['session']->get('imp', 'imap_acl')) { throw new IMP_Exception(_("ACLs not configured for this server.")); } diff --git a/imp/lib/Imap/Flags.php b/imp/lib/Imap/Flags.php index c95756031..d81d73489 100644 --- a/imp/lib/Imap/Flags.php +++ b/imp/lib/Imap/Flags.php @@ -329,7 +329,7 @@ class IMP_Imap_Flags } } - if ($GLOBALS['session']['imp:protocol'] == 'imap') { + if ($GLOBALS['session']->get('imp', 'protocol') == 'imap') { $flaglist = empty($options['flags']) ? array() : array_map('strtolower', $options['flags']); diff --git a/imp/lib/Imap/Tree.php b/imp/lib/Imap/Tree.php index 237b2ac4b..cba4d88fc 100644 --- a/imp/lib/Imap/Tree.php +++ b/imp/lib/Imap/Tree.php @@ -164,7 +164,7 @@ class IMP_Imap_Tree implements ArrayAccess, Iterator, Serializable */ public function __construct() { - if ($GLOBALS['session']['imp:protocol'] == 'imap') { + if ($GLOBALS['session']->get('imp', 'protocol') == 'imap') { $ns = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->getNamespaceList(); $ptr = reset($ns); $this->_delimiter = $ptr['delimiter']; @@ -183,9 +183,9 @@ class IMP_Imap_Tree implements ArrayAccess, Iterator, Serializable { global $conf, $injector, $prefs, $session; - $unsubmode = (($session['imp:protocol'] == 'pop') || + $unsubmode = (($session->get('imp', 'protocol') == 'pop') || !$prefs->getValue('subscribe') || - $session['imp:showunsub']); + $session->get('imp', 'showunsub')); /* Reset class variables to the defaults. */ $this->changed = true; @@ -204,7 +204,7 @@ class IMP_Imap_Tree implements ArrayAccess, Iterator, Serializable /* Add INBOX and exit if folders aren't allowed or if we are using * POP3. */ if (empty($conf['user']['allow_folders']) || - ($session['imp:protocol'] == 'pop')) { + ($session->get('imp', 'protocol') == 'pop')) { $this->_insertElt($this->_makeElt('INBOX', self::ELT_IS_SUBSCRIBED)); return; } @@ -335,7 +335,7 @@ class IMP_Imap_Tree implements ArrayAccess, Iterator, Serializable ? $label : substr($label, $pos + 1); - if ($GLOBALS['session']['imp:protocol'] != 'pop') { + if ($GLOBALS['session']->get('imp', 'protocol') != 'pop') { try { $this->_setInvisible($elt, !Horde::callHook('display_folder', array($elt['v']), 'imp')); } catch (Horde_Exception_HookNotSet $e) {} diff --git a/imp/lib/Injector/Factory/AuthImap.php b/imp/lib/Injector/Factory/AuthImap.php index 0554cdd8a..02331606f 100644 --- a/imp/lib/Injector/Factory/AuthImap.php +++ b/imp/lib/Injector/Factory/AuthImap.php @@ -40,7 +40,7 @@ class IMP_Injector_Factory_AuthImap throw new IMP_Exception('No server parameters found.'); } - $aparams = $GLOBALS['session']['imp:imap_admin;array']; + $aparams = $GLOBALS['session']->get('imp', 'imap_admin', Horde_Session::TYPE_ARRAY); $params = array_merge( $params, diff --git a/imp/lib/Injector/Factory/Compose.php b/imp/lib/Injector/Factory/Compose.php index d9dba1972..3b19517a1 100644 --- a/imp/lib/Injector/Factory/Compose.php +++ b/imp/lib/Injector/Factory/Compose.php @@ -83,7 +83,7 @@ class IMP_Injector_Factory_Compose { global $session; - $cache = $session['imp:compose_cache:array']; + $cache = $session->get('imp', 'compose_cache', Horde_Session::TYPE_ARRAY); $changed = false; foreach ($this->_instances as $key => $val) { @@ -105,7 +105,7 @@ class IMP_Injector_Factory_Compose } if ($changed) { - $GLOBALS['session']['imp:compose_cache'] = $cache; + $session->set('imp', 'compose_cache', $cache); } } diff --git a/imp/lib/Injector/Factory/Imap.php b/imp/lib/Injector/Factory/Imap.php index 6461294ec..79e8e6033 100644 --- a/imp/lib/Injector/Factory/Imap.php +++ b/imp/lib/Injector/Factory/Imap.php @@ -44,7 +44,7 @@ class IMP_Injector_Factory_Imap */ public function create($id = null) { - if (is_null($id) && !($id = $GLOBALS['session']['imp:server_key'])) { + if (is_null($id) && !($id = $GLOBALS['session']->get('imp', 'server_key'))) { $id = 'default'; } diff --git a/imp/lib/Injector/Factory/Imaptree.php b/imp/lib/Injector/Factory/Imaptree.php index 706ffeb2e..ca5ef1491 100644 --- a/imp/lib/Injector/Factory/Imaptree.php +++ b/imp/lib/Injector/Factory/Imaptree.php @@ -40,7 +40,7 @@ class IMP_Injector_Factory_Imaptree /* If an IMP_Imap_Tree object is currently stored in the cache, * re-create that object. Else, create a new instance. */ - if (isset($session['imp:treeob'])) { + if ($session->exists('imp', 'treeob')) { /* Since IMAP tree generation is so expensive/time-consuming, * fallback to storing in the session even if no permanent cache * backend is setup. */ @@ -49,13 +49,13 @@ class IMP_Injector_Factory_Imaptree $instance = $session[Horde_Session::DATA . ':imp_imaptree']; } else { try { - $instance = @unserialize($cache->get($session['imp:treeob'], 86400)); + $instance = @unserialize($cache->get($session->get('imp', 'treeob'), 86400)); } catch (Exception $e) { Horde::logMessage('Could not unserialize stored IMP_Imap_Tree object.', 'DEBUG'); } } } else { - $session['imp:treeob'] = strval(new Horde_Support_Randomid()); + $session->set('imp', 'treeob', strval(new Horde_Support_Randomid())); } if (!($instance instanceof IMP_Imap_Tree)) { @@ -83,7 +83,7 @@ class IMP_Injector_Factory_Imaptree if ($cache instanceof Horde_Cache_Null) { $session->store($instance, true, 'imp_imaptree'); } else { - $cache->set($GLOBALS['session']['imp:treeob'], serialize($instance), 86400); + $cache->set($GLOBALS['session']->get('imp', 'treeob'), serialize($instance), 86400); } } } diff --git a/imp/lib/Injector/Factory/Mail.php b/imp/lib/Injector/Factory/Mail.php index 96fd7ff0c..39ab5a52b 100644 --- a/imp/lib/Injector/Factory/Mail.php +++ b/imp/lib/Injector/Factory/Mail.php @@ -42,7 +42,7 @@ class IMP_Injector_Factory_Mail /* Force the SMTP host and port value to the current SMTP server if * one has been selected for this connection. */ - $params = array_merge($params, $GLOBALS['session']['imp:smtp;array']); + $params = array_merge($params, $GLOBALS['session']->get('imp', 'smtp', Horde_Session::TYPE_ARRAY)); /* If SMTP authentication has been requested, use either the username * and password provided in the configuration or populate the username diff --git a/imp/lib/Injector/Factory/MailboxList.php b/imp/lib/Injector/Factory/MailboxList.php index c0d7b0f9a..1c10969fc 100644 --- a/imp/lib/Injector/Factory/MailboxList.php +++ b/imp/lib/Injector/Factory/MailboxList.php @@ -68,7 +68,7 @@ class IMP_Injector_Factory_MailboxList case 'imp': case 'mimp': try { - $ob = $GLOBALS['session']['imp:imp_mailbox/' . $mailbox]; + $ob = $GLOBALS['session']->get('imp', 'imp_mailbox/' . $mailbox); } catch (Exception $e) { $ob = null; } @@ -107,7 +107,7 @@ class IMP_Injector_Factory_MailboxList * unseen flag). */ foreach ($this->_instances as $key => $val) { if ($val->changed) { - $GLOBALS['session']['imp:imp_mailbox/' . $key] = $val; + $GLOBALS['session']->set('imp', 'imp_mailbox/' . $key, $val); } } } diff --git a/imp/lib/Injector/Factory/Quota.php b/imp/lib/Injector/Factory/Quota.php index bdd8a69a3..f5f6c264f 100644 --- a/imp/lib/Injector/Factory/Quota.php +++ b/imp/lib/Injector/Factory/Quota.php @@ -35,7 +35,7 @@ class IMP_Injector_Factory_Quota */ public function create(Horde_Injector $injector) { - $qparams = $GLOBALS['session']['imp:imap_quota']; + $qparams = $GLOBALS['session']->get('imp', 'imap_quota'); if (!isset($qparams['driver'])) { throw new IMP_Exception('Quota config missing driver parameter.'); diff --git a/imp/lib/Injector/Factory/Search.php b/imp/lib/Injector/Factory/Search.php index 363ea9b03..17bcaea8f 100644 --- a/imp/lib/Injector/Factory/Search.php +++ b/imp/lib/Injector/Factory/Search.php @@ -35,7 +35,7 @@ class IMP_Injector_Factory_Search public function create(Horde_Injector $injector) { try { - $instance = $GLOBALS['session']['imp:search']; + $instance = $GLOBALS['session']->get('imp', 'search'); } catch (Exception $e) { Horde::logMessage('Could not unserialize stored IMP_Search object.', 'DEBUG'); $instance = null; @@ -59,7 +59,7 @@ class IMP_Injector_Factory_Search { /* Only need to store the object if the object has changed. */ if ($instance->changed) { - $GLOBALS['session']['imp:search'] = $instance; + $GLOBALS['session']->set('imp', 'search', $instance); } } diff --git a/imp/lib/Mailbox/List.php b/imp/lib/Mailbox/List.php index 85202580f..b4062d780 100644 --- a/imp/lib/Mailbox/List.php +++ b/imp/lib/Mailbox/List.php @@ -271,7 +271,7 @@ class IMP_Mailbox_List implements Countable, Serializable $threadob = $this->getThreadOb(); $this->_sorted = $threadob->messageList((bool)$sortpref['dir']); } else { - if (($GLOBALS['session']['imp:protocol'] != 'pop') && + if (($GLOBALS['session']->get('imp', 'protocol') != 'pop') && IMP::hideDeletedMsgs($this->_mailbox)) { $query = new Horde_Imap_Client_Search_Query(); $query->flag('\\deleted', false); @@ -410,8 +410,8 @@ class IMP_Mailbox_List implements Countable, Serializable $page = ceil($start / $page_size); } else { /* Search for the last visited page first. */ - if (isset($GLOBALS['session']['imp:mbox_page/' . $this->_mailbox])) { - $page = $GLOBALS['session']['imp:mbox_page/' . $this->_mailbox]; + if ($GLOBALS['session']->exists('imp', 'mbox_page/' . $this->_mailbox)) { + $page = $GLOBALS['session']->get('imp', 'mbox_page/' . $this->_mailbox); } elseif ($this->_searchmbox) { $page = 1; } else { @@ -456,7 +456,7 @@ class IMP_Mailbox_List implements Countable, Serializable } /* Store the page value now. */ - $GLOBALS['session']['imp:mbox_page/' . $this->_mailbox] = $ret['page']; + $GLOBALS['session']->set('imp', 'mbox_page/' . $this->_mailbox, $ret['page']); return $ret; } @@ -521,7 +521,7 @@ class IMP_Mailbox_List implements Countable, Serializable { if (is_null($this->_threadob)) { try { - $this->_threadob = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->thread($this->_mailbox, array('criteria' => $GLOBALS['session']['imp:imap_thread'])); + $this->_threadob = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->thread($this->_mailbox, array('criteria' => $GLOBALS['session']->get('imp', 'imap_thread'))); } catch (Horde_Imap_Client_Exception $e) { $GLOBALS['notification']->push($e); return new Horde_Imap_Client_Thread(array(), 'uid'); diff --git a/imp/lib/Message.php b/imp/lib/Message.php index 6569775e1..e7701fd87 100644 --- a/imp/lib/Message.php +++ b/imp/lib/Message.php @@ -32,7 +32,7 @@ class IMP_Message */ public function __construct() { - if ($GLOBALS['session']['imp:protocol'] == 'pop') { + if ($GLOBALS['session']->get('imp', 'protocol') == 'pop') { $this->_usepop = true; } } diff --git a/imp/lib/Mime/Viewer/Html.php b/imp/lib/Mime/Viewer/Html.php index 9be8de091..4e9ad6d03 100644 --- a/imp/lib/Mime/Viewer/Html.php +++ b/imp/lib/Mime/Viewer/Html.php @@ -78,7 +78,7 @@ class IMP_Mime_Viewer_Html extends Horde_Mime_Viewer_Html $data = $this->_IMPrender(true); /* Catch case where using mimp on a javascript browser. */ - if ($GLOBALS['session']['imp:view'] != 'mimp') { + if ($GLOBALS['session']->get('imp', 'view') != 'mimp') { $uid = strval(new Horde_Support_Randomid()); Horde::addScriptFile('imp.js', 'imp'); @@ -136,7 +136,7 @@ class IMP_Mime_Viewer_Html extends Horde_Mime_Viewer_Html /* Don't do IMP DOM processing if in mimp mode or converting to * text. */ - if (($GLOBALS['session']['imp:view'] == 'mimp') || + if (($GLOBALS['session']->get('imp', 'view') == 'mimp') || (!$inline && Horde_Util::getFormData('convert_text'))) { $this->_imptmp = null; } else { @@ -173,7 +173,7 @@ class IMP_Mime_Viewer_Html extends Horde_Mime_Viewer_Html /* Sanitize the HTML. */ $data = $this->_cleanHTML($data, array( - 'noprefetch' => ($inline && ($GLOBALS['session']['imp:view'] != 'mimp')), + 'noprefetch' => ($inline && ($GLOBALS['session']->get('imp', 'view') != 'mimp')), 'phishing' => $inline )); diff --git a/imp/lib/Mime/Viewer/Itip.php b/imp/lib/Mime/Viewer/Itip.php index 13902aa83..1802a3af8 100644 --- a/imp/lib/Mime/Viewer/Itip.php +++ b/imp/lib/Mime/Viewer/Itip.php @@ -419,7 +419,7 @@ class IMP_Mime_Viewer_Itip extends Horde_Mime_Viewer_Base } // Create the HTML to display the iCal file. - if (!$full && ($GLOBALS['session']['imp:view'] != 'imp')) { + if (!$full && ($GLOBALS['session']->get('imp', 'view') != 'imp')) { $url = $this->getConfigParam('imp_contents')->urlView($this->_mimepart, 'view_attach', array('params' => array('ajax' => 1, 'mode' => IMP_Contents::RENDER_INLINE))); $onsubmit = ' onsubmit="DimpCore.submitForm(\'impMimeViewerItip\');return false"'; } else { diff --git a/imp/lib/Mime/Viewer/Pgp.php b/imp/lib/Mime/Viewer/Pgp.php index a459cd427..c9bc780ee 100644 --- a/imp/lib/Mime/Viewer/Pgp.php +++ b/imp/lib/Mime/Viewer/Pgp.php @@ -394,7 +394,7 @@ class IMP_Mime_Viewer_Pgp extends Horde_Mime_Viewer_Base ? 'mimePartWrapValid' : 'mimePartWrapInvalid'; } else { - switch ($GLOBALS['session']['imp:view']) { + switch ($GLOBALS['session']->get('imp', 'view')) { case 'imp': $status[] = Horde::link(IMP::selfUrl()->add(array('pgp_verify_msg' => 1))) . _("Click HERE to verify the message.") . ''; break; diff --git a/imp/lib/Mime/Viewer/Plain.php b/imp/lib/Mime/Viewer/Plain.php index a10586950..02c2c8c91 100644 --- a/imp/lib/Mime/Viewer/Plain.php +++ b/imp/lib/Mime/Viewer/Plain.php @@ -98,7 +98,7 @@ class IMP_Mime_Viewer_Plain extends Horde_Mime_Viewer_Plain $text = IMP::filterText($text); /* Done processing if in mimp mode. */ - if ($GLOBALS['session']['imp:view'] == 'mimp') { + if ($GLOBALS['session']->get('imp', 'view') == 'mimp') { return array( $mime_id => array( 'data' => $text, diff --git a/imp/lib/Mime/Viewer/Smime.php b/imp/lib/Mime/Viewer/Smime.php index b63310e85..75a2bfc50 100644 --- a/imp/lib/Mime/Viewer/Smime.php +++ b/imp/lib/Mime/Viewer/Smime.php @@ -310,7 +310,7 @@ class IMP_Mime_Viewer_Smime extends Horde_Mime_Viewer_Base $status[] = $e->getMessage(); } } else { - switch ($GLOBALS['session']['imp:view']) { + switch ($GLOBALS['session']->get('imp', 'view')) { case 'imp': $status[] = Horde::link(IMP::selfUrl()->add('smime_verify_msg', 1)) . _("Click HERE to verify the data.") . ''; break; diff --git a/imp/lib/Prefs/Identity.php b/imp/lib/Prefs/Identity.php index 212bb6889..ed05c56bc 100644 --- a/imp/lib/Prefs/Identity.php +++ b/imp/lib/Prefs/Identity.php @@ -127,7 +127,7 @@ class Imp_Prefs_Identity extends Horde_Core_Prefs_Identity } try { - $ob = Horde_Mime_Address::parseAddressList($address, array('defserver' => $GLOBALS['session']['imp:maildomain'])); + $ob = Horde_Mime_Address::parseAddressList($address, array('defserver' => $GLOBALS['session']->get('imp', 'maildomain'))); } catch (Horde_Mime_Exception $e) { throw new Horde_Exception (_("Your From address is not a valid email address. This can be fixed in your Personal Information preferences page.")); } @@ -207,7 +207,7 @@ class Imp_Prefs_Identity extends Horde_Core_Prefs_Identity } if (!strstr($val, '@')) { - $val .= '@' . $GLOBALS['session']['imp:maildomain']; + $val .= '@' . $GLOBALS['session']->get('imp', 'maildomain'); } $this->_cached['fromList'][$ident] = $val; diff --git a/imp/lib/Prefs/Ui.php b/imp/lib/Prefs/Ui.php index 630792567..2b2bb0f9f 100644 --- a/imp/lib/Prefs/Ui.php +++ b/imp/lib/Prefs/Ui.php @@ -51,7 +51,7 @@ class IMP_Prefs_Ui break; case 'delmove': - if ($GLOBALS['session']['imp:protocol'] == 'pop') { + if ($GLOBALS['session']->get('imp', 'protocol') == 'pop') { $tmp = $ui->prefs['delete_spam_after_report']['enum']; unset($tmp[2]); $ui->override['delete_spam_after_report'] = $tmp; @@ -69,7 +69,7 @@ class IMP_Prefs_Ui { global $conf, $prefs, $registry, $session; - $pop3 = ($session['imp:protocol'] == 'pop'); + $pop3 = ($session->get('imp', 'protocol') == 'pop'); switch ($ui->group) { case 'accounts': @@ -147,7 +147,7 @@ class IMP_Prefs_Ui break; case 'filters': - if (!$session['imp:filteravail']) { + if (!$session->get('imp', 'filteravail')) { $ui->suppress[] = 'filter_on_login'; $ui->suppress[] = 'filter_on_display'; $ui->suppress[] = 'filter_any_mailbox'; @@ -181,7 +181,7 @@ class IMP_Prefs_Ui } if ($prefs->isLocked('signature_html') || - !$session['imp:rteavail']) { + !$session->get('imp', 'rteavail')) { $ui->suppress[] = 'signature_html_select'; } else { Horde::addScriptFile('signaturehtml.js', 'imp'); @@ -542,7 +542,7 @@ class IMP_Prefs_Ui $maildomain = preg_replace('/[^-\.a-z0-9]/i', '', $prefs->getValue('mail_domain')); $prefs->setValue('maildomain', $maildomain); if (!empty($maildomain)) { - $session['imp:maildomain'] = $maildomain; + $session->set('imp', 'maildomain', $maildomain); } } break; @@ -555,9 +555,13 @@ class IMP_Prefs_Ui case 'dimp': if ($prefs->isDirty('dynamic_view')) { - $session['imp:view'] = $prefs->getValue('dynamic_view') - ? 'dimp' - : ($GLOBALS['browser']->isMobile() ? 'mimp' : 'imp'); + $session->set( + 'imp', + 'view', + $prefs->getValue('dynamic_view') + ? 'dimp' + : ($GLOBALS['browser']->isMobile() ? 'mimp' : 'imp') + ); } break; @@ -752,7 +756,7 @@ class IMP_Prefs_Ui $t->set('canedit', $canEdit); - if ($GLOBALS['session']['imp:imap_admin']) { + if ($GLOBALS['session']->get('imp', 'imap_admin')) { $current_users = array_keys($curr_acl); $new_user = array(); @@ -1147,7 +1151,7 @@ class IMP_Prefs_Ui '$("create_pgp_key").observe("click", function(e) { if (!window.confirm(' . Horde_Serialize::serialize(_("Key generation may take a long time to complete. Continue with key generation?"), Horde_Serialize::JSON, 'UTF-8') . ')) { e.stop(); } })' ), 'dom'); - if ($GLOBALS['session']['imp:file_upload']) { + if ($GLOBALS['session']->get('imp', 'file_upload')) { Horde::addInlineScript(array( '$("import_pgp_personal").observe("click", function(e) { ' . Horde::popupJs($pgp_url, array('params' => array('actionID' => 'import_personal_public_key', 'reload' => $GLOBALS['session']->store($ui->selfUrl()->setRaw(true), false)), 'height' => 275, 'width' => 750, 'urlencode' => true)) . '; e.stop(); })' ), 'dom'); @@ -1246,7 +1250,7 @@ class IMP_Prefs_Ui $t->set('pubkey_list', $plist); } - if ($GLOBALS['session']['imp:file_upload']) { + if ($GLOBALS['session']->get('imp', 'file_upload')) { $t->set('can_import', true); $t->set('no_source', !$GLOBALS['prefs']->getValue('add_source')); if (!$t->get('no_source')) { @@ -1527,7 +1531,7 @@ class IMP_Prefs_Ui Horde::addInlineScript(array( '$("delete_smime_personal").observe("click", function(e) { if (!window.confirm(' . Horde_Serialize::serialize(_("Are you sure you want to delete your keypair? (This is NOT recommended!)"), Horde_Serialize::JSON, 'UTF-8') . ')) { e.stop(); } })' ), 'dom'); - } elseif ($GLOBALS['session']['imp:file_upload']) { + } elseif ($GLOBALS['session']->get('imp', 'file_upload')) { $t->set('import-cert-help', Horde_Help::link('imp', 'smime-import-personal-certs')); Horde::addInlineScript(array( @@ -1598,7 +1602,7 @@ class IMP_Prefs_Ui $t->set('pubkey_list', $plist); } - if ($GLOBALS['session']['imp:file_upload']) { + if ($GLOBALS['session']->get('imp', 'file_upload')) { $t->set('can_import', true); $t->set('no_source', !$GLOBALS['prefs']->getValue('add_source')); if (!$t->get('no_source')) { @@ -1704,7 +1708,7 @@ class IMP_Prefs_Ui if (isset($data['sources'])) { $prefs->setValue('search_sources', $data['sources']); - unset($GLOBALS['session']['imp:ac_ajax']); + $GLOBALS['session']->remove('imp', 'ac_ajax'); $updated = true; } diff --git a/imp/lib/Quota/Mdaemon.php b/imp/lib/Quota/Mdaemon.php index b8e6f2a80..fb7721df2 100644 --- a/imp/lib/Quota/Mdaemon.php +++ b/imp/lib/Quota/Mdaemon.php @@ -46,7 +46,7 @@ class IMP_Quota_Mdaemon extends IMP_Quota_Base $imap_ob = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create(); $userDetails = $this->_getUserDetails( $this->_params['username'], - $GLOBALS['session']['imp:maildomain'] + $GLOBALS['session']->get('imp', 'maildomain') ); if ($userDetails !== false) { diff --git a/imp/lib/Search.php b/imp/lib/Search.php index 9de1b5ddd..71f4db923 100644 --- a/imp/lib/Search.php +++ b/imp/lib/Search.php @@ -163,7 +163,7 @@ class IMP_Search implements ArrayAccess, Iterator, Serializable * Although there is a fallback to a PHP-based display sort, for * performance reasons only do a display sort if it is supported * on the server. */ - if (($GLOBALS['session']['imp:protocol'] == 'imap') && + if (($GLOBALS['session']->get('imp', 'protocol') == 'imap') && !empty($opts['sort'])) { $sort_cap = $imp_imap->queryCapability('SORT'); diff --git a/imp/lib/Sentmail/Base.php b/imp/lib/Sentmail/Base.php index 3722950cd..51651e9dc 100644 --- a/imp/lib/Sentmail/Base.php +++ b/imp/lib/Sentmail/Base.php @@ -48,7 +48,7 @@ abstract class IMP_Sentmail_Base } foreach ($recipients as $addresses) { - $addresses = Horde_Mime_Address::bareAddress($addresses, $GLOBALS['session']['imp:maildomain'], true); + $addresses = Horde_Mime_Address::bareAddress($addresses, $GLOBALS['session']->get('imp', 'maildomain'), true); foreach ($addresses as $recipient) { $this->_log($action, $message_id, $recipient, $success); } diff --git a/imp/lib/Tree/Flist.php b/imp/lib/Tree/Flist.php index f21a95bea..9cfffa98d 100644 --- a/imp/lib/Tree/Flist.php +++ b/imp/lib/Tree/Flist.php @@ -119,7 +119,7 @@ class IMP_Tree_Flist extends Horde_Tree_Select /* Add the list of editable tasklists to the list. */ if ($this->getOption('inc_tasklists') && - $GLOBALS['session']['imp:tasklistavail']) { + $GLOBALS['session']->get('imp', 'tasklistavail')) { try { $tasklists = $registry->call('tasks/listTasklists', array(false, Horde_Perms::EDIT)); @@ -138,7 +138,7 @@ class IMP_Tree_Flist extends Horde_Tree_Select /* Add the list of editable notepads to the list. */ if ($this->getOption('inc_notepads') && - $GLOBALS['session']['imp:notepadavail']) { + $GLOBALS['session']->get('imp', 'notepadavail')) { try { $notepads = $registry->call('notes/listNotepads', array(false, Horde_Perms::EDIT)); diff --git a/imp/lib/Ui/Block.php b/imp/lib/Ui/Block.php index db5d01d44..6342a6a05 100644 --- a/imp/lib/Ui/Block.php +++ b/imp/lib/Ui/Block.php @@ -49,7 +49,7 @@ class IMP_Ui_Block foreach ($poll as $folder) { if (isset($status[$folder]) && (($folder == 'INBOX') || - ($GLOBALS['session']['imp:protocol'] != 'pop')) && + ($GLOBALS['session']->get('imp', 'protocol') != 'pop')) && (empty($this->_params['show_unread']) || !empty($status[$folder]['unseen']))) { if (!empty($status[$folder]['recent'])) { diff --git a/imp/lib/Ui/Message.php b/imp/lib/Ui/Message.php index 66ce235f9..19573d137 100644 --- a/imp/lib/Ui/Message.php +++ b/imp/lib/Ui/Message.php @@ -320,7 +320,7 @@ class IMP_Ui_Message $add_link = null; $addr_array = array(); - $mimp_view = ($GLOBALS['session']['imp:view'] == 'mimp'); + $mimp_view = ($GLOBALS['session']->get('imp', 'view') == 'mimp'); /* Set up the add address icon link if contact manager is * available. */ @@ -389,7 +389,7 @@ class IMP_Ui_Message } } - if ($GLOBALS['session']['imp:view'] == 'mimp') { + if ($GLOBALS['session']->get('imp', 'view') == 'mimp') { return implode(', ', $addr_array); } @@ -653,7 +653,7 @@ class IMP_Ui_Message */ public function moveAfterAction() { - return (($GLOBALS['session']['imp:protocol'] != 'pop') && + return (($GLOBALS['session']->get('imp', 'protocol') != 'pop') && !IMP::hideDeletedMsgs(IMP::$mailbox) && !$GLOBALS['prefs']->getValue('use_trash')); } diff --git a/imp/lib/Views/Compose.php b/imp/lib/Views/Compose.php index fb8b1ca6f..3919e01b8 100644 --- a/imp/lib/Views/Compose.php +++ b/imp/lib/Views/Compose.php @@ -75,7 +75,7 @@ class IMP_Views_Compose $result['js'][] = 'DIMP.conf_compose.qreply = 1'; } - if ($GLOBALS['session']['imp:rteavail']) { + if ($GLOBALS['session']->get('imp', 'rteavail')) { $t->set('compose_html', $prefs->getValue('compose_html')); $t->set('rte', true); diff --git a/imp/lib/Views/ListMessages.php b/imp/lib/Views/ListMessages.php index 46f685be1..8d1659389 100644 --- a/imp/lib/Views/ListMessages.php +++ b/imp/lib/Views/ListMessages.php @@ -100,7 +100,7 @@ class IMP_Views_ListMessages /* Run filters now. */ if (!$is_search && - $GLOBALS['session']['imp:filteravail'] && + $GLOBALS['session']->get('imp', 'filteravail') && !empty($args['applyfilter']) || (($mbox == 'INBOX') && $GLOBALS['prefs']->getValue('filter_on_display'))) { @@ -409,7 +409,7 @@ class IMP_Views_ListMessages while (list(,$ob) = each($overview['overview'])) { /* Initialize the header fields. */ $msg = array( - 'imapuid' => (($GLOBALS['session']['imp:protocol'] == 'pop') ? $ob['uid'] : intval($ob['uid'])), + 'imapuid' => (($GLOBALS['session']->get('imp', 'protocol') == 'pop') ? $ob['uid'] : intval($ob['uid'])), 'view' => $ob['mailbox'], ); diff --git a/imp/mailbox-mimp.php b/imp/mailbox-mimp.php index 8af14ccdc..11d2780a9 100644 --- a/imp/mailbox-mimp.php +++ b/imp/mailbox-mimp.php @@ -110,7 +110,7 @@ case 's': // 'rs' = run search case 'rs': - if (!empty($vars->search) && ($session['imp:protocol'] == 'imap')) { + if (!empty($vars->search) && ($session->get('imp', 'protocol') == 'imap')) { /* Create the search query and reset the global mailbox variable. */ $q_ob = $imp_search->createQuery( array(new IMP_Search_Element_Text($vars->search, false)), @@ -244,7 +244,7 @@ if (!$search_mbox && IMP::threadSortAvailable(IMP::$mailbox)) { } /* Add search link. */ -if ($session['imp:protocol'] == 'imap') { +if ($session->get('imp', 'protocol') == 'imap') { if ($search_mbox) { $orig_mbox = reset($imp_search[IMP::$mailbox]->mboxes); $menu[] = array(sprintf(_("New Search in %s"), IMP::getLabel($orig_mbox)), IMP::generateIMPUrl('mailbox-mimp.php', $orig_mbox)->add('a', 's')); diff --git a/imp/mailbox.php b/imp/mailbox.php index 8667a640e..65d092cd4 100644 --- a/imp/mailbox.php +++ b/imp/mailbox.php @@ -202,7 +202,7 @@ case 'view_messages': $mailbox_token = Horde::getRequestToken('imp.mailbox'); /* Deal with filter options. */ -if (!$readonly && $session['imp:filteravail']) { +if (!$readonly && $session->get('imp', 'filteravail')) { /* Only allow filter on display for INBOX. */ if ((IMP::$mailbox == 'INBOX') && $prefs->getValue('filter_on_display')) { @@ -391,7 +391,7 @@ if (isset($filter_url)) { $hdr_template->set('filter_img', Horde::img('filters.png', _("Apply Filters"))); } $hdr_template->set('search', false); -if ($session['imp:protocol'] != 'pop') { +if ($session->get('imp', 'protocol') != 'pop') { $hdr_template->set('search_img', Horde::img('search.png', _("Search"))); if (!$search_mbox) { @@ -470,7 +470,7 @@ if ($pageOb['msgcount']) { $n_template->set('sessiontag', Horde_Util::formInput()); $n_template->set('use_folders', $conf['user']['allow_folders']); $n_template->set('readonly', $readonly); - $n_template->set('use_pop', $session['imp:protocol'] == 'pop'); + $n_template->set('use_pop', $session->get('imp', 'protocol') == 'pop'); if (!$n_template->get('use_pop')) { $tmp = $imp_flags->getFlagList($search_mbox ? null : IMP::$mailbox); diff --git a/imp/message-mimp.php b/imp/message-mimp.php index 43dc51ba4..4f2d433fb 100644 --- a/imp/message-mimp.php +++ b/imp/message-mimp.php @@ -114,7 +114,7 @@ try { $envelope = $fetch_ret[$uid]['envelope']; $flags = $flags_ret[$uid]['flags']; $mime_headers = reset($fetch_ret[$uid]['headertext']); -$use_pop = ($session['imp:protocol'] == 'pop'); +$use_pop = ($session->get('imp', 'protocol') == 'pop'); /* Parse the message. */ try { diff --git a/imp/message.php b/imp/message.php index bf80b7e0f..6ab8b38ce 100644 --- a/imp/message.php +++ b/imp/message.php @@ -241,7 +241,7 @@ if (is_null($fetch_ret) || !isset($fetch_ret[$uid]['headertext'])) { $envelope = $fetch_ret[$uid]['envelope']; $flags = $flags_ret[$uid]['flags']; $mime_headers = reset($fetch_ret[$uid]['headertext']); -$use_pop = ($session['imp:protocol'] == 'pop'); +$use_pop = ($session->get('imp', 'protocol') == 'pop'); /* Get the title/mailbox label of the mailbox page. */ $page_label = IMP::getLabel(IMP::$mailbox); diff --git a/imp/search-basic.php b/imp/search-basic.php index 61326cb37..c2af2bcfe 100644 --- a/imp/search-basic.php +++ b/imp/search-basic.php @@ -19,11 +19,11 @@ Horde_Registry::appInit('imp', array( )); /* This is an IMP-only script. */ -if ($session['imp:view'] != 'imp') { +if ($session->get('imp', 'view') != 'imp') { exit; } -if ($session['imp:protocol'] == 'pop') { +if ($session->get('imp', 'protocol') == 'pop') { $notification->push(_("Searching is not available with a POP3 server."), 'horde.error'); $from_message_page = true; $actionID = $start = null; diff --git a/imp/search.php b/imp/search.php index 5851992c3..397328376 100644 --- a/imp/search.php +++ b/imp/search.php @@ -135,7 +135,7 @@ $constants = array( /* Load basic search if javascript is not enabled or searching is not allowed * (basic page will do the required redirection in the latter case). */ if (!$browser->hasFeature('javascript') || - ($session['imp:protocol'] == 'pop')) { + ($session->get('imp', 'protocol') == 'pop')) { require IMP_BASE . '/search-basic.php'; exit; } @@ -144,7 +144,7 @@ $imp_flags = $injector->getInstance('IMP_Imap_Flags'); $imp_search = $injector->getInstance('IMP_Search'); $vars = Horde_Variables::getDefaultVariables(); -$dimp_view = ($session['imp:view'] == 'dimp'); +$dimp_view = ($session->get('imp', 'view') == 'dimp'); $js_vars = array(); $search_mailbox = isset($vars->search_mailbox) ? $vars->search_mailbox @@ -332,7 +332,7 @@ $js_vars['ImpSearch.selected'] = array($search_mailbox); $t = $injector->createInstance('Horde_Template'); $t->setOption('gettext', true); $t->set('action', Horde::url('search.php')); -$t->set('virtualfolder', $session['imp:protocol'] != 'pop'); +$t->set('virtualfolder', $session->get('imp', 'protocol') != 'pop'); /* Determine if we are editing a search query. */ if ($vars->edit_query && $imp_search->isSearchMbox($vars->edit_query)) { diff --git a/imp/templates/dimp/index.inc b/imp/templates/dimp/index.inc index f342fc7b4..5fe023880 100644 --- a/imp/templates/dimp/index.inc +++ b/imp/templates/dimp/index.inc @@ -15,7 +15,7 @@ $has_blacklist = $registry->hasMethod('mail/blacklistFrom'); $has_whitelist = $registry->hasMethod('mail/whitelistFrom'); // Quota information -$show_quota = $session['imp:imap_quota']; +$show_quota = $session->get('imp', 'imap_quota'); // Get application folders list. $application_folders = array(); @@ -60,7 +60,7 @@ function _simpleButton($id, $text, $image, $nodisplay = false) - +get('imp', 'filteravail')): ?> @@ -110,7 +110,7 @@ function _simpleButton($id, $text, $image, $nodisplay = false) - +get('imp', 'protocol') != 'pop'): ?>