From 71999a3065ffa05056cac8a3a81ff8f2313eacf0 Mon Sep 17 00:00:00 2001 From: Shish Date: Thu, 8 Oct 2009 17:43:18 +0100 Subject: [PATCH] find truth --- core/util.inc.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/util.inc.php b/core/util.inc.php index 3e00e2ff..212a194d 100644 --- a/core/util.inc.php +++ b/core/util.inc.php @@ -120,6 +120,16 @@ function plural($num, $single_form="", $plural_form="s") { } +/** + * Different databases have different ways to represent booleans; this + * will try and standardise them + */ +function undb_bool($val) { + if($val === true || $val == 'Y' || $val == 'y' || $val == 'T' || $val == 't' || $val === 1) return true; + if($val === false || $val == 'N' || $val == 'n' || $val == 'F' || $val == 'f' || $val === 0) return false; +} + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\ * HTML Generation * \* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */