source: subversion/trunk/roundcubemail/program/include/rcube_sqlite.inc @ 3553

Last change on this file since 3553 was 3553, checked in by alec, 3 years ago
  • code cleanup (mostly identation fixes)
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.0 KB
Line 
1<?php
2
3/*
4 +-----------------------------------------------------------------------+
5 | program/include/rcube_sqlite.inc                                      |
6 |                                                                       |
7 | This file is part of the RoundCube Webmail client                     |
8 | Copyright (C) 2005-2010, RoundCube Dev. - Switzerland                 |
9 | Licensed under the GNU GPL                                            |
10 |                                                                       |
11 | PURPOSE:                                                              |
12 |   Provide callback functions for sqlite that will emulate             |
13 |   sone MySQL functions                                                |
14 |                                                                       |
15 +-----------------------------------------------------------------------+
16 | Author: Thomas Bruederli <roundcube@gmail.com>                        |
17 +-----------------------------------------------------------------------+
18
19 $Id$
20
21*/
22
23/**
24 * Callback functions for sqlite database interface
25 *
26 * @package Database
27 */
28
29
30function rcube_sqlite_from_unixtime($timestamp)
31{
32    $timestamp = trim($timestamp);
33    if (!preg_match('/^[0-9]+$/is', $timestamp))
34        $ret = strtotime($timestamp);
35    else
36        $ret = $timestamp;
37   
38    $ret = date('Y-m-d H:i:s', $ret);
39    rcube_sqlite_debug("FROM_UNIXTIME ($timestamp) = $ret");
40    return $ret;
41}
42
43
44function rcube_sqlite_unix_timestamp($timestamp='')
45{
46    $timestamp = trim($timestamp);
47    if (!$timestamp)
48        $ret = time();
49    else if (!preg_match('/^[0-9]+$/is', $timestamp))
50        $ret = strtotime($timestamp);
51    else
52        $ret = $timestamp;
53
54    rcube_sqlite_debug("UNIX_TIMESTAMP ($timestamp) = $ret");
55    return $ret;
56}
57
58
59function rcube_sqlite_now()
60{
61    rcube_sqlite_debug("NOW() = ".date("Y-m-d H:i:s"));
62    return date("Y-m-d H:i:s");
63}
64
65
66function rcube_sqlite_md5($str)
67{
68    return md5($str);
69}
70
71
72function rcube_sqlite_debug($str)
73{
74    //console($str);
75}
76 
77?>
Note: See TracBrowser for help on using the repository browser.