diff options
author | thomascube <thomas@roundcube.net> | 2005-10-26 22:12:36 +0000 |
---|---|---|
committer | thomascube <thomas@roundcube.net> | 2005-10-26 22:12:36 +0000 |
commit | b076a460e5418ae8f0db0b4b392d91853fd2a21b (patch) | |
tree | 2528fa73bddf1fe04f35192d611d2dd1f91d0671 /program/include | |
parent | fa3addfc5d03046cd173fde7e7875bad2badc6da (diff) |
Finished message sorting and fixed some skin issues
Diffstat (limited to 'program/include')
-rw-r--r-- | program/include/main.inc | 4 | ||||
-rw-r--r-- | program/include/rcube_imap.inc | 4 | ||||
-rwxr-xr-x | program/include/rcube_mdb2.inc | 34 |
3 files changed, 38 insertions, 4 deletions
diff --git a/program/include/main.inc b/program/include/main.inc index 0e206166e..ce9eaf069 100644 --- a/program/include/main.inc +++ b/program/include/main.inc @@ -947,8 +947,10 @@ function format_date($date, $format=NULL) if (is_numeric($date)) $ts = $date; - else + else if (!empty($date)) $ts = strtotime($date); + else + return ''; // convert time to user's timezone $timestamp = $ts - date('Z', $ts) + ($CONFIG['timezone'] * 3600); diff --git a/program/include/rcube_imap.inc b/program/include/rcube_imap.inc index 47999c860..8253442ab 100644 --- a/program/include/rcube_imap.inc +++ b/program/include/rcube_imap.inc @@ -433,7 +433,7 @@ class rcube_imap } - // old function; replaced 2005/10/18 + // original function; replaced 2005/10/18 // private method for listing message header function _list_headers($mailbox='', $page=NULL, $sort_field='date', $sort_order='DESC') { @@ -478,7 +478,7 @@ class rcube_imap // return complete list of messages if (strtolower($page)=='all') return $a_headers; - + $start_msg = ($this->list_page-1) * $this->page_size; return array_slice($a_headers, $start_msg, $this->page_size); } diff --git a/program/include/rcube_mdb2.inc b/program/include/rcube_mdb2.inc index a61f0b899..53590aa0b 100755 --- a/program/include/rcube_mdb2.inc +++ b/program/include/rcube_mdb2.inc @@ -55,7 +55,7 @@ class rcube_db function dsn_connect($dsn) { // Use persistent connections if available - $dbh = MDB2::factory($dsn, array('persistent' => $true)); + $dbh = MDB2::factory($dsn, array('persistent' => TRUE)); if (PEAR::isError($dbh)) raise_error(array('code' => 500, @@ -104,21 +104,37 @@ class rcube_db // Query database function query() + { + $params = func_get_args(); + $query = array_shift($params); + + return $this->_query($query, 0, 0, $params); + } + + function limitquery() + { + $params = func_get_args(); + $query = array_shift($params); + $offset = array_shift($params); + $numrows = array_shift($params); + + return $this->_query($query, $offset, $numrows, $params); + } function _query($query, $offset, $numrows, $params) @@ -194,23 +210,39 @@ class rcube_db } function quoteIdentifier ( $str ) + { + if (!$this->db_handle) + $this->db_connect('r'); + + return $this->db_handle->quoteIdentifier($str); + } function unixtimestamp($field) + { + switch($this->db_provider) + { + case 'pgsql': + return "EXTRACT (EPOCH FROM $field)"; + break; + default: + return "UNIX_TIMESTAMP($field)"; + } + } function _add_result($res, $query) |