fantu
2008-12-20 3ae3d88a8789ad1d0f6f92cab1112d9477cc71a7
add ip validator in form system, for now only for ipv4
1 files modified
10 ■■■■■ changed files
interface/lib/classes/tform.inc.php 10 ●●●●● patch | view | raw | blame | history
interface/lib/classes/tform.inc.php
@@ -631,6 +631,16 @@
                                          }
                                        }
                                break;
                                case 'ISIPV4':
                                        if(!preg_match("/^[0-9]{1,3}(.)[0-9]{1,3}(.)[0-9]{1,3}(.)[0-9]{1,3}$/", $field_value)) {
                                                $errmsg = $validator['errmsg'];
                                                if(isset($this->wordbook[$errmsg])) {
                                                    $this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
                                                } else {
                                                    $this->errorMessage .= $errmsg."<br />\r\n";
                                                }
                                        }
                                break;
                                case 'CUSTOM':
                                        // Calls a custom class to validate this record
                                        if($validator['class'] != '' and $validator['function'] != '') {