| | |
| | | */ |
| | | private function _messagecount($mailbox='', $mode='ALL', $force=FALSE) |
| | | { |
| | | $a_mailbox_cache = FALSE; |
| | | $mode = strtoupper($mode); |
| | | |
| | | if (empty($mailbox)) |
| | |
| | | $this->struct_charset = $headers->charset; |
| | | else |
| | | $this->struct_charset = $this->_structure_charset($structure); |
| | | |
| | | /* |
| | | @TODO: here we can recognize malformed BODYSTRUCTURE and parse |
| | | the message in other way to create our own message structure. |
| | | Example of structure for malformed MIME message: |
| | | ("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 2154 70 NIL NIL NIL) |
| | | |
| | | if ($headers->ctype != 'text/plain' |
| | | && !is_array($structure[0]) && $structure[0] == 'text' |
| | | && !is_array($structure[1]) && $structure[1] == 'plain') |
| | | { } |
| | | */ |
| | | |
| | | $struct = &$this->_structure_part($structure); |
| | | $struct->headers = get_object_vars($headers); |
| | |
| | | */ |
| | | function get_cache($key) |
| | | { |
| | | // read cache |
| | | if (!isset($this->cache[$key]) && $this->caching_enabled) |
| | | // read cache (if it was not read before) |
| | | if (!count($this->cache) && $this->caching_enabled) |
| | | { |
| | | return $this->_read_cache_record($key); |
| | | } |
| | |
| | | { |
| | | $sql_key = preg_replace('/^IMAP\./', '', $sql_arr['cache_key']); |
| | | $this->cache_keys[$sql_key] = $sql_arr['cache_id']; |
| | | $this->cache[$sql_key] = $sql_arr['data'] ? unserialize($sql_arr['data']) : FALSE; |
| | | if (!isset($this->cache[$sql_key])) |
| | | $this->cache[$sql_key] = $sql_arr['data'] ? unserialize($sql_arr['data']) : FALSE; |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | if (!$this->db) |
| | | return FALSE; |
| | | |
| | | // check if we already have a cache entry for this key |
| | | if (!isset($this->cache_keys[$key])) |
| | | { |
| | | $sql_result = $this->db->query( |
| | | "SELECT cache_id |
| | | FROM ".get_table_name('cache')." |
| | | WHERE user_id=? |
| | | AND cache_key=?", |
| | | $_SESSION['user_id'], |
| | | 'IMAP.'.$key); |
| | | |
| | | if ($sql_arr = $this->db->fetch_assoc($sql_result)) |
| | | $this->cache_keys[$key] = $sql_arr['cache_id']; |
| | | else |
| | | $this->cache_keys[$key] = FALSE; |
| | | } |
| | | |
| | | // update existing cache record |
| | | if ($this->cache_keys[$key]) |
| | |
| | | $_SESSION['user_id'], |
| | | 'IMAP.'.$key, |
| | | $data); |
| | | |
| | | // get cache entry ID for this key |
| | | $sql_result = $this->db->query( |
| | | "SELECT cache_id |
| | | FROM ".get_table_name('cache')." |
| | | WHERE user_id=? |
| | | AND cache_key=?", |
| | | $_SESSION['user_id'], |
| | | 'IMAP.'.$key); |
| | | |
| | | if ($sql_arr = $this->db->fetch_assoc($sql_result)) |
| | | $this->cache_keys[$key] = $sql_arr['cache_id']; |
| | | } |
| | | } |
| | | |
| | |
| | | AND cache_key=?", |
| | | $_SESSION['user_id'], |
| | | 'IMAP.'.$key); |
| | | |
| | | unset($this->cache_keys[$key]); |
| | | } |
| | | |
| | | |