HEADcourier-fixdev-browser-capabilitiespdorelease-0.6release-0.7release-0.8
|
Last change
on this file since 5349b78 was
5349b78,
checked in by svncommit <devs@…>, 6 years ago
|
|
Update copyright notice
|
-
Property mode set to
100644
|
|
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-2007, 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 | |
|---|
| 30 | function 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 | |
|---|
| 44 | function 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 | |
|---|
| 59 | function 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 | |
|---|
| 66 | function rcube_sqlite_md5($str) |
|---|
| 67 | { |
|---|
| 68 | return md5($str); |
|---|
| 69 | } |
|---|
| 70 | |
|---|
| 71 | |
|---|
| 72 | function rcube_sqlite_debug($str) |
|---|
| 73 | { |
|---|
| 74 | //console($str); |
|---|
| 75 | } |
|---|
| 76 | |
|---|
| 77 | ?> |
|---|
Note: See
TracBrowser
for help on using the repository browser.