summaryrefslogtreecommitdiff
path: root/roundcubemail/program/include/rcube_sqlite.inc
diff options
context:
space:
mode:
authorroundcube <roundcube@208e9e7b-5314-0410-a742-e7e81cd9613c>2005-12-03 16:54:12 +0000
committerroundcube <roundcube@208e9e7b-5314-0410-a742-e7e81cd9613c>2005-12-03 16:54:12 +0000
commit2dc87919396cd68a07a20164d0816761dca909ea (patch)
tree7fc050b1e1c2215e1c8c5d43af1f45c6f33eb498 /roundcubemail/program/include/rcube_sqlite.inc
parentaec4bd921d413dd835f21f4ab6765fab7e882d89 (diff)
Re-design of caching (new database table added\!); some bugfixes; Postgres support
git-svn-id: https://svn.roundcube.net/trunk@88 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include/rcube_sqlite.inc')
-rw-r--r--roundcubemail/program/include/rcube_sqlite.inc71
1 files changed, 71 insertions, 0 deletions
diff --git a/roundcubemail/program/include/rcube_sqlite.inc b/roundcubemail/program/include/rcube_sqlite.inc
new file mode 100644
index 000000000..78c671d38
--- /dev/null
+++ b/roundcubemail/program/include/rcube_sqlite.inc
@@ -0,0 +1,71 @@
+<?php
+
+/*
+ +-----------------------------------------------------------------------+
+ | program/include/rcube_sqlite.inc |
+ | |
+ | This file is part of the RoundCube Webmail client |
+ | Copyright (C) 2005, RoundCube Dev. - Switzerland |
+ | Licensed under the GNU GPL |
+ | |
+ | PURPOSE: |
+ | Provide callback functions for sqlite that will emulate |
+ | sone MySQL functions |
+ | |
+ +-----------------------------------------------------------------------+
+ | Author: Thomas Bruederli <roundcube@gmail.com> |
+ +-----------------------------------------------------------------------+
+
+ $Id$
+
+*/
+
+
+function rcube_sqlite_from_unixtime($timestamp)
+ {
+ $timestamp = trim($timestamp);
+ if (!preg_match("/^[0-9]+$/is", $timestamp))
+ $ret = strtotime($timestamp);
+ else
+ $ret = $timestamp;
+
+ $ret = date("Y-m-d H:i:s", $ret);
+ rcube_sqlite_debug("FROM_UNIXTIME ($timestamp) = $ret");
+ return $ret;
+ }
+
+
+function rcube_sqlite_unix_timestamp($timestamp="")
+ {
+ $timestamp = trim($timestamp);
+ if (!$timestamp)
+ $ret = time();
+ else if (!preg_match("/^[0-9]+$/is", $timestamp))
+ $ret = strtotime($timestamp);
+ else
+ $ret = $timestamp;
+
+ rcube_sqlite_debug("UNIX_TIMESTAMP ($timestamp) = $ret");
+ return $ret;
+ }
+
+
+function rcube_sqlite_now()
+ {
+ rcube_sqlite_debug("NOW() = ".date("Y-m-d H:i:s"));
+ return date("Y-m-d H:i:s");
+ }
+
+
+function rcube_sqlite_md5($str)
+ {
+ return md5($str);
+ }
+
+
+function rcube_sqlite_debug($str)
+ {
+ //console($str);
+ }
+
+?> \ No newline at end of file