]> wagnertech.de Git - timetracker.git/blobdiff - WEB-INF/lib/common.lib.php
Extended conditions to include >=, <, <=, and = situations.
[timetracker.git] / WEB-INF / lib / common.lib.php
index 325ae73b42f29b436a4b759618acc18028b1ddc3..d1ad384f5b5741ed9886fb9cc0be4bbd9ac57d0b 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;
@@ -383,3 +383,10 @@ function ttAccessAllowed($required_right)
 
   return false;
 }
+
+// ttStartsWith functions checks if a string starts with a given substring.
+function ttStartsWith($string, $startString)
+{
+    $len = strlen($startString);
+    return (substr($string, 0, $len) === $startString);
+}