exit;
}
-if (!($cache = &IMP::getCacheOb())) {
+if (!($cache = IMP::getCache())) {
Horde::fatal('No cache backend available.', __FILE__, __LINE__);
}
{
/* If there is a cache driver configured, try to get the public key
* from the cache. */
- if (($cache = &IMP::getCacheOb())) {
+ if (($cache = IMP::getCache())) {
$result = $cache->get("PGPpublicKey_" . $address . $fingerprint, 3600);
if ($result) {
Horde::logMessage('PGPpublicKey: ' . serialize($result), __FILE__, __LINE__, PEAR_LOG_DEBUG);
/* See if the address points to the user's public key. */
if (is_a($result, 'PEAR_Error')) {
require_once 'Horde/Identity.php';
- $identity = &Identity::singleton(array('imp', 'imp'));
+ $identity = Identity::singleton(array('imp', 'imp'));
$personal_pubkey = $this->getPersonalPublicKey();
if (!empty($personal_pubkey) && $identity->hasAddress($address)) {
$result = $personal_pubkey;
* if it doesn't already exist. This ensures that only one IMP_Folder
* instance is instantiated for any given session.
*
- * This method must be invoked as:<code>
- * $imp_folder = &IMP_Folder::singleton();
- * </code>
- *
* @return IMP_Folder The IMP_Folder instance.
*/
- static public function &singleton()
+ static public function singleton()
{
static $folder;
/**
* Constructor.
*/
- function __construct()
+ protected function __construct()
{
if (!empty($GLOBALS['conf']['server']['cache_folders'])) {
$this->_cacheid = 'imp_folder_cache|' . Auth::getAuth();
obtain it. */
$cache = null;
if (is_null($this->_listCache)) {
- if (!is_null($this->_cacheid) && ($cache = &IMP::getCacheOb())) {
+ if (!is_null($this->_cacheid) && ($cache = IMP::getCache())) {
$ret = $cache->get($this->_cacheid, 3600);
if (!empty($ret)) {
$this->_listCache = unserialize($ret);
return $this->_listCache[$sig];
}
- $imaptree = &IMP_IMAP_Tree::singleton();
+ $imaptree = IMP_IMAP_Tree::singleton();
$list_mask = IMP_IMAP_Tree::FLIST_CONTAINER | IMP_IMAP_Tree::FLIST_OB;
if (!$sub) {
*/
public function clearFlistCache()
{
- if (!is_null($this->_cacheid) && ($cache = &IMP::getCacheOb())) {
+ if (!is_null($this->_cacheid) && ($cache = IMP::getCache())) {
$cache->expire($this->_cacheid);
}
$this->_listCache = array();
if (!empty($deleted)) {
/* Update the IMAP_Tree cache. */
- $imaptree = &IMP_IMAP_Tree::singleton();
+ $imaptree = IMP_IMAP_Tree::singleton();
$imaptree->delete($deleted);
$this->_onDelete($deleted);
$this->clearFlistCache();
/* Update the IMAP_Tree object. */
- $imaptree = &IMP_IMAP_Tree::singleton();
+ $imaptree = IMP_IMAP_Tree::singleton();
$imaptree->insert($folder);
/* Recreate Virtual Folders. */
*/
public function exists($folder)
{
- $imaptree = &IMP_IMAP_Tree::singleton();
+ $imaptree = IMP_IMAP_Tree::singleton();
$elt = $imaptree->get($folder);
if ($elt) {
return !$imaptree->isContainer($elt);
$deleted = array($old);
$inserted = array($new);
- $imaptree = &IMP_IMAP_Tree::singleton();
+ $imaptree = IMP_IMAP_Tree::singleton();
/* Get list of any folders that are underneath this one. */
$all_folders = array_merge(array($old), $imaptree->folderList(IMP_IMAP_Tree::FLIST_UNSUB, $old));
if (!empty($subscribed)) {
/* Initialize the IMAP_Tree object. */
- $imaptree = &IMP_IMAP_Tree::singleton();
+ $imaptree = IMP_IMAP_Tree::singleton();
$imaptree->subscribe($subscribed);
/* Reset the folder cache. */
if (!empty($unsubscribed)) {
/* Initialize the IMAP_Tree object. */
- $imaptree = &IMP_IMAP_Tree::singleton();
+ $imaptree = IMP_IMAP_Tree::singleton();
$imaptree->unsubscribe($unsubscribed);
/* Reset the folder cache. */
* that object. Else, create a new instance. Ensures that only one
* instance is available at any time.
*
- * This method must be invoked as:<pre>
- * $imp_imap_tree = &IMP_IMAP_Tree::singleton();
- * </pre>
- *
* @return IMP_IMAP_Tree The object or null.
*/
- static public function &singleton()
+ static public function singleton()
{
static $instance;
if (!isset($instance)) {
if (!empty($_SESSION['imp']['cache']['tree'])) {
- $imp_cache = &IMP::getCacheOb();
+ $imp_cache = IMP::getCache();
$instance = unserialize($imp_cache->get($_SESSION['imp']['cache']['tree'], 86400));
}
if (empty($instance)) {
/**
* Constructor.
*/
- function __construct()
+ protected function __construct()
{
if ($_SESSION['imp']['protocol'] == 'imap') {
$ns = $GLOBALS['imp_imap']->getNamespaceList();
}
if (!isset($_SESSION['imp']['cache']['tree'])) {
- $imp_cache = &IMP::getCacheOb();
+ $imp_cache = IMP::getCache();
$_SESSION['imp']['cache']['tree'] = $imp_cache
? uniqid(mt_rand() . Auth::getAuth())
: null;
return;
}
- $imp_cache = &IMP::getCacheOb();
+ $imp_cache = IMP::getCache();
$imp_cache->set($_SESSION['imp']['cache']['tree'], serialize($this), 86400);
}
}
if (!empty($id) && !$GLOBALS['prefs']->isLocked('nav_poll')) {
- $imp_folder = &IMP_Folder::singleton();
+ $imp_folder = IMP_Folder::singleton();
$this->getPollList();
foreach ($id as $val) {
if (!$this->isSubscribed($this->_tree[$val])) {
/* Initialize the user's identities. */
require_once 'Horde/Identity.php';
- $identity = &Identity::singleton(array('imp', 'imp'));
+ $identity = Identity::singleton(array('imp', 'imp'));
return array(
'trash' => IMP::folderPref($prefs->getValue('trash_folder'), true),
break;
}
- $imp_imap = &$GLOBALS['imp_imap']->ob;
+ $imp_imap = $GLOBALS['imp_imap']->ob;
$msg = sprintf(
$status_msg . ' for %s [%s]%s to {%s:%s [%s]}',
if (empty($cache_type) ||
$cache_type == 'none' ||
(($cache_type == 'horde_cache') &&
- !($cache = self::getCacheOb()))) {
+ !($cache = self::getCache()))) {
Horde::includeScriptFiles();
return;
}
if (empty($cache_type) ||
$cache_type == 'none' ||
(($cache_type == 'horde_cache') &&
- !($cache = self::getCacheOb()))) {
+ !($cache = self::getCache()))) {
$css_out = array_merge($css, $css_out);
} else {
$mtime = array(0);
*
* @return Horde_Cache A pointer to a Horde_Cache object.
*/
- public static function getCacheOb()
+ public static function getCache()
{
global $conf;
* It will only create a new instance if no IMP_Mailbox instance with
* the same parameters currently exists.
*
- * This method must be invoked as:
- * $var = &IMP_Mailbox::singleton($mailbox[, $index]);
- *
* @param string $mailbox See IMP_Mailbox constructor.
* @param integer $index See IMP_Mailbox constructor.
*
$fetch_criteria[Horde_Imap_Client::FETCH_HEADERS] = array(array('headers' => $headers, 'label' => 'imp', 'parse' => true, 'peek' => true));
}
- $cacheob = $preview ? $GLOBALS['imp_imap']->ob->getCacheOb() : null;
+ $cache = $preview ? $GLOBALS['imp_imap']->ob->getCache() : null;
/* Retrieve information from each mailbox. */
foreach ($to_process as $mbox => $ids) {
if ($preview) {
$preview_info = $tostore = array();
- if ($cacheob) {
+ if ($cache) {
try {
- $preview_info = $cacheob->get($mbox, array_keys($ids), array('IMPpreview', 'IMPpreviewc'));
+ $preview_info = $cache->get($mbox, array_keys($ids), array('IMPpreview', 'IMPpreviewc'));
} catch (Horde_Imap_Client_Exception $e) {}
}
}
!$GLOBALS['prefs']->getValue('preview_show_unread') ||
!in_array('\\seen', $v['flags']))) {
if (!isset($preview_info[$k])) {
- $imp_contents = &IMP_Contents::singleton($k . IMP::IDX_SEP . $mbox);
+ $imp_contents = IMP_Contents::singleton($k . IMP::IDX_SEP . $mbox);
if (is_a($imp_contents, 'PEAR_Error')) {
$preview_info[$k] = array('IMPpreview' => '', 'IMPpreviewc' => false);
} else {
$prev = $imp_contents->generatePreview();
$preview_info[$k] = array('IMPpreview' => $prev['text'], 'IMPpreviewc' => $prev['cut']);
- if (!is_null($cacheob)) {
+ if (!is_null($cache)) {
$tostore[$k] = $preview_info[$k];
}
}
$uids[$mbox] = array_keys($fetch_res);
- if (!is_null($cacheob) && !empty($tostore)) {
- $cacheob->set($mbox, $tostore);
+ if (!is_null($cache) && !empty($tostore)) {
+ $cache->set($mbox, $tostore);
}
} catch (Horde_Imap_Client_Exception $e) {}
}
}
- $this->_cache = &IMP::getCacheOb();
+ $this->_cache = IMP::getCache();
}
/**