| | |
| | | var $search_sort_field = ''; |
| | | var $debug_level = 1; |
| | | var $error_code = 0; |
| | | var $options = array('imap' => 'check'); |
| | | var $options = array('auth_method' => 'check'); |
| | | |
| | | private $host, $user, $pass, $port, $ssl; |
| | | |
| | |
| | | // cache is incomplete |
| | | $cache_index = $this->get_message_cache_index($cache_key); |
| | | |
| | | foreach ($a_header_index as $i => $headers) |
| | | { |
| | | // add message to cache |
| | | foreach ($a_header_index as $i => $headers) { |
| | | if ($this->caching_enabled && $cache_index[$headers->id] != $headers->uid) { |
| | | // prevent index duplicates |
| | | if ($cache_index[$headers->id]) { |
| | | $this->remove_message_cache($cache_key, $headers->id, true); |
| | | unset($cache_index[$headers->id]); |
| | | } |
| | | // add message to cache |
| | | $this->add_message_cache($cache_key, $headers->id, $headers, NULL, |
| | | !in_array($headers->uid, $cache_index)); |
| | | !in_array($headers->uid, $cache_index)); |
| | | } |
| | | |
| | | $a_msg_headers[$headers->uid] = $headers; |
| | |
| | | /** |
| | | * @access private |
| | | */ |
| | | private function remove_message_cache($key, $uids) |
| | | private function remove_message_cache($key, $ids, $idx=false) |
| | | { |
| | | if (!$this->caching_enabled) |
| | | return; |
| | | |
| | | $this->db->query( |
| | | "DELETE FROM ".get_table_name('messages')." |
| | | WHERE user_id=? |
| | | AND cache_key=? |
| | | AND uid IN (".$this->db->array2list($uids, 'integer').")", |
| | | WHERE user_id=? |
| | | AND cache_key=? |
| | | AND ".($idx ? "idx" : "uid")." IN (".$this->db->array2list($ids, 'integer').")", |
| | | $_SESSION['user_id'], |
| | | $key); |
| | | } |
| | |
| | | |
| | | $this->db->query( |
| | | "DELETE FROM ".get_table_name('messages')." |
| | | WHERE user_id=? |
| | | AND cache_key=? |
| | | AND idx>=?", |
| | | $_SESSION['user_id'], |
| | | $key, |
| | | $start_index); |
| | | WHERE user_id=? |
| | | AND cache_key=? |
| | | AND idx>=?", |
| | | $_SESSION['user_id'], $key, $start_index); |
| | | } |
| | | |
| | | /** |