summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/classes/Form/IpAddress.class.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/usr/local/www/classes/Form/IpAddress.class.php')
-rw-r--r--src/usr/local/www/classes/Form/IpAddress.class.php18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/usr/local/www/classes/Form/IpAddress.class.php b/src/usr/local/www/classes/Form/IpAddress.class.php
index be2f4c1..72f885f 100644
--- a/src/usr/local/www/classes/Form/IpAddress.class.php
+++ b/src/usr/local/www/classes/Form/IpAddress.class.php
@@ -31,11 +31,23 @@ class Form_IpAddress extends Form_Input
{
protected $_mask;
- public function __construct($name, $title, $value)
+ public function __construct($name, $title, $value, $type = "BOTH")
{
parent::__construct($name, $title, 'text', $value);
- $this->_attributes['pattern'] = '[a-f0-9:.]*';
+ switch ($type) {
+ case "BOTH":
+ $this->_attributes['pattern'] = '[a-f0-9:.]*';
+ break;
+
+ case "V4":
+ $this->_attributes['pattern'] = '[a-f0-9.]*';
+ break;
+
+ case "V6":
+ $this->_attributes['pattern'] = '[a-f0-9:]*';
+ break;
+ }
}
// $min is provided to allow for VPN masks in which '0' is valid
@@ -58,7 +70,7 @@ class Form_IpAddress extends Form_Input
return parent::setIsRepeated();
}
-
+
protected function _getInput()
{
$input = parent::_getInput();
OpenPOWER on IntegriCloud