Some more work in progress on multiple grouping by.
[timetracker.git] / WEB-INF / lib / common.lib.php
index d1ad384..d29ba1a 100644 (file)
@@ -319,7 +319,7 @@ function ttValidCondition($val, $emptyValid = true)
   if (stristr($val, '<script>') || stristr($val, '<script '))
     return false;
 
-  if (!preg_match("/^count\s?(=|[<>]=?)\s?\d+$/", $val))
+  if (!preg_match("/^count\s?(=|[<>]=?|<>)\s?\d+$/", $val))
     return false;
 
   return true;
@@ -390,3 +390,11 @@ function ttStartsWith($string, $startString)
     $len = strlen($startString);
     return (substr($string, 0, $len) === $startString);
 }
+
+// ttDateToUserFormat converts a date from database format to user format.
+function ttDateToUserFormat($date)
+{
+  global $user;
+  $o_date = new DateAndTime(DB_DATEFORMAT, $date);
+  return $o_date->toString($user->date_format);
+}