Location: PHPKode > projects > CsWebmail > cswebmail-3.10/cswebmail-3.10/include/cache.php
<?
if(VALID_DOCUMENT != 1) die('what?');

class Cache{
  function initReadMail($mailbox,$mailkey){
    if($mailbox != '' && $mailkey != ''){
      $mbox = $_SESSION['mboxes']->find($mailbox);
      $_SESSION['last_mail'] = new ReadMail($mbox,$mailkey);
    }
  }
  function getReadMail($mailbox,$mailkey){
    if(!$_SESSION['last_mail'] ||
       $_SESSION['last_mail']->mailbox_name !=  $mailbox ||
       $_SESSION['last_mail']->key !=  $mailkey){
      Cache::initReadMail($mailbox,$mailkey);
    }
    return $_SESSION['last_mail'];
  }
    
  function initThreads($mailbox){
    $mp = getIMAP($GLOBALS['MAIL_USER_NAME'],$GLOBALS['MAIL_USER_PASSWORD']);
    $_SESSION['threads'][$mailbox] = $mp->get_threads($mailbox);
  }
  
  function getThreads($mailbox){
    if(!$_SESSION['threads'][$mailbox]){
      Cache::initThreads($mailbox,$mailkey);
    }
    return $_SESSION['threads'][$mailbox];
  }

  // gpg passphrase caching
  
  function cacheGPGPassphrase($passphrase){
    $_SESSION['gpg_passphrase'] = $passphrase;
  }

  function getCachedGPGPassphrase(){
    return $_SESSION['gpg_passphrase'];
  }

  function haveCachedGPGPassphrase(){
    return isset($_SESSION['gpg_passphrase']);
  }

  function resetCachedGPGPassphrase(){
    unset($_SESSION['gpg_passphrase']);
  }
}

?>
Return current item: CsWebmail