r1163: Actually do the regex match on process_custom_fields()
authorRobert Sesek <rsesek@bluestatic.org>
Sun, 17 Sep 2006 18:31:48 +0000 (18:31 +0000)
committerRobert Sesek <rsesek@bluestatic.org>
Sun, 17 Sep 2006 18:31:48 +0000 (18:31 +0000)
docs/changes.txt
includes/functions.php

index 31005efe1c75311915ad4c6eb6111761dfe08ad7..d663fce2a734787529f0d958f16c4acd527a1307 100644 (file)
@@ -8,6 +8,7 @@
 - More changes to syndicate.php to increase performance
 - Add checks to newreport.php and search.php to see if there are products or versions, if there aren't, then throw a message about needing them to be setup
 - Process custom field data on newreport.php
+- Add regex matching check to process_custom_fields()
 
 1.1.0 Beta 2
 ===============================
index 03a12be4ccaad864557dee848d6b43a8c158aca1..559b7a6fffad5ec96ce14233d6b8f2e1766a4ba1 100755 (executable)
@@ -382,6 +382,15 @@ function process_custom_fields($bugid, $msg, $errorbox = false, $inputdata = arr
                        continue;
                }
                
+               if (!empty($field['regexmatch']))
+               {
+                       if (!preg_match('#' . str_replace('#', '\#', $field['regexmatch']) . '#si', $inputdata["field$field[fieldid]"]))
+                       {
+                               $errorlist[] = sprintf(_('%1$s does not match the specified format'), $field['name']);
+                               continue;
+                       }
+               }
+               
                if (isset($inputdata["field$field[fieldid]"]))
                {
                        $fieldbuild[] = 'field' . $field['fieldid'];