]> wagnertech.de Git - timetracker.git/blobdiff - WEB-INF/lib/common.lib.php
Improved error.mail_send text by adding MAIL_SMTP_DEBUG part.
[timetracker.git] / WEB-INF / lib / common.lib.php
index 629e7d78b8625db0bc0bd6dd1a4e5fc9e43596f1..43377103a294f0e7738dd01380b475c1721f2915 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;
@@ -332,8 +332,8 @@ function ttValidCondition($val, $emptyValid = true)
 function ttValidIP($val, $emptyValid = false)
 {
   $val = trim($val);
-  if (strlen($val) == 0 && !$emptyValid)
-    return false;
+  if (strlen($val) == 0 && $emptyValid)
+    return true;
 
   $subnets = explode(',', $val);
   foreach ($subnets as $subnet) {
@@ -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);
+}