From 3ae3d88a8789ad1d0f6f92cab1112d9477cc71a7 Mon Sep 17 00:00:00 2001
From: fantu <fantu@ispconfig3>
Date: Sat, 20 Dec 2008 17:44:00 -0500
Subject: [PATCH] add ip validator in form system, for now only for ipv4
---
interface/lib/classes/tform.inc.php | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/interface/lib/classes/tform.inc.php b/interface/lib/classes/tform.inc.php
index 308c6c0..d2d0e5d 100644
--- a/interface/lib/classes/tform.inc.php
+++ b/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'] != '') {
--
Gitblit v1.9.1