From: hickert Date: Fri, 11 Aug 2006 06:04:31 +0000 (+0000) Subject: Updated hotPlugDialog X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=a2b7fca705b6561892eb6f1a064703ea845be444;p=gosa.git Updated hotPlugDialog git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4475 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/personal/environment/class_hotplugDialog.inc b/plugins/personal/environment/class_hotplugDialog.inc index dbb082141..dc61ecf84 100644 --- a/plugins/personal/environment/class_hotplugDialog.inc +++ b/plugins/personal/environment/class_hotplugDialog.inc @@ -92,14 +92,18 @@ class hotplugDialog extends plugin function save_object() { if(isset($_POST['dialogissubmitted'])){ + plugin::save_object(); foreach($this->attributes as $s_attr){ if(isset($_POST[$s_attr])){ - $this->$s_attr = stripslashes($_POST[$s_attr]); + if(in_array($s_attr,array("HOT_produkt","HOT_vendor"))){ + $this->$s_attr = strtolower(stripslashes($_POST[$s_attr])); + }else{ + $this->$s_attr = stripslashes($_POST[$s_attr]); + } }else{ $this->$s_attr = false; } } - plugin::save_object(); } } @@ -111,20 +115,22 @@ class hotplugDialog extends plugin $message= plugin::check(); if(!$this->use_existing){ - if((empty($this->HOT_name))||(preg_match("/[^a-z0-9]/i",$this->HOT_name))){ + + if(empty($this->HOT_name)||(preg_match("/[^a-z0-9]/i",$this->HOT_name))){ $message[]=_("Please specify a valid name. Only 0-9 a-Z is allowed."); } - if((empty($this->HOT_description))||(preg_match("/[^a-z0-9!\"?.,;:-_\(\) ]/i",$this->HOT_description))){ + if(preg_match("/[^a-z0-9!\"?.,;:-_\(\) ]/i",$this->HOT_description)){ $message[]=_("Invalid character in description. Please specify a valid description."); } - if((empty($this->HOT_id))||(preg_match("/[\|]/i",$this->HOT_id))){ + + if(preg_match("/[\|]/i",$this->HOT_id)){ $message[]=_("Please specify a valid id."); } - if((empty($this->HOT_vendor))||(preg_match("/[\|]/i",$this->HOT_vendor))){ - $message[]=_("Please specify a valid id."); + if(!$this->is_2byteHex($this->HOT_vendor)){ + $message[]=_("Please specify a valid vendor id. (2 byte hex like '0xFFFF')"); } - if((empty($this->HOT_produkt))||(preg_match("/[\|]/i",$this->HOT_produkt))){ - $message[]=_("Please specify a valid id."); + if(!$this->is_2byteHex($this->HOT_produkt)){ + $message[]=_("Please specify a valid product id. (2 byte hex like '0xFFFF')"); } $ldap = $this->config->get_ldap_link(); @@ -142,6 +148,13 @@ class hotplugDialog extends plugin return ($message); } + function is_2byteHex($str) + { + return empty($str) || preg_match("/^(0x|x|)[a-f0-9][a-f0-9][a-f0-9][a-f0-9]/i",$str); + } + + + /* Save to LDAP */ function save() diff --git a/plugins/personal/environment/hotplugDialogNew.tpl b/plugins/personal/environment/hotplugDialogNew.tpl index 5a6fb3386..927395d01 100644 --- a/plugins/personal/environment/hotplugDialogNew.tpl +++ b/plugins/personal/environment/hotplugDialogNew.tpl @@ -14,7 +14,7 @@ - {$must} + @@ -25,22 +25,22 @@ - + - - -
{$must} + - +  
{$must} + - +  
{$must} +