X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fadmin%2Ffai%2Fclass_faiVariableEntry.inc;h=5a0e04f2ef08421922c5758b78baef2087fbfcf2;hb=bf9fd071bad641f7fce6d3e3ed61f866841ec183;hp=44780047c8add96fad704f6aa30a5d4d81600586;hpb=cc2de47023584285f289c222e64bd7c6aeb5a927;p=gosa.git diff --git a/plugins/admin/fai/class_faiVariableEntry.inc b/plugins/admin/fai/class_faiVariableEntry.inc index 44780047c..5a0e04f2e 100644 --- a/plugins/admin/fai/class_faiVariableEntry.inc +++ b/plugins/admin/fai/class_faiVariableEntry.inc @@ -9,34 +9,44 @@ class faiVariableEntry extends plugin /* attribute list for save action */ var $ignore_account= TRUE; - var $attributes = array("Object_cn","Object_description","Object_FAIvariableContent"); + var $attributes = array("cn","description","FAIvariableContent"); var $objectclasses= array(); var $orig_cn = ""; - var $Object_dn = ""; - var $Object_cn = ""; - var $Object_FAIvariableContent = ""; - var $Object_description = ""; - var $Object_status = "new"; + var $dn = ""; + var $cn = ""; + var $FAIvariableContent = ""; + var $description = ""; + var $status = "new"; + + var $FAIstate = ""; function faiVariableEntry ($config, $dn= NULL,$object=false) { plugin::plugin ($config, $dn); - if($dn != "new"){ + if((isset($object['cn'])) && (!empty($object['cn']))){ $this->orig_cn= $object['cn']; $this->dn=$object['dn']; foreach($object as $name=>$value){ - $oname = "Object_".$name; - $this->$oname=$value; + $oname = $name; + $this->$oname=addslashes($value); + } + + if(isset($this->attrs['FAIstate'][0])){ + $this->FAIstate = $this->attrs['FAIstate'][0]; } + }else{ - $this->Object_status = "new"; + $this->status = "new"; $this->orig_cn = false; } } function execute() { + /* Call parent execute */ + plugin::execute(); + /* Fill templating stuff */ $smarty = get_smarty(); $display = ""; @@ -46,16 +56,20 @@ class faiVariableEntry extends plugin */ foreach($this->attributes as $attrs){ if(get_magic_quotes_gpc()){ - $smarty->assign($attrs,stripslashes($this->$attrs)); + $smarty->assign($attrs,htmlentities (stripslashes(utf8_decode($this->$attrs)))); }else{ - $smarty->assign($attrs,($this->$attrs)); + $smarty->assign($attrs,htmlentities (utf8_decode($this->$attrs))); } } - for($i =1 ; $i <= 100 ; $i++){ - $Object_FAIprioritys[$i]=$i; + foreach($this->attributes as $attr){ + if(($this->FAIstate == "freeze") || (chkacl($this->acl,$attr)!= "")){ + $smarty->assign($attr."ACL"," disabled "); + }else{ + $smarty->assign($attr."ACL"," "); + } } - $smarty->assign("Object_FAIprioritys",$Object_FAIprioritys); + $display.= $smarty->fetch(get_template_path('faiVariableEntry.tpl', TRUE)); return($display); } @@ -63,7 +77,7 @@ class faiVariableEntry extends plugin /* Save data to object */ function save_object() { - if(isset($_POST['SubObjectFormSubmitted'])){ + if((isset($_POST['SubObjectFormSubmitted'])) && ($this->FAIstate != "freeze")){ foreach($this->attributes as $attrs){ if(isset($_POST[$attrs])){ $this->$attrs = $_POST[$attrs]; @@ -77,20 +91,17 @@ class faiVariableEntry extends plugin /* Check supplied data */ function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); - if(empty($this->Object_FAIvariableContent)) { + if(empty($this->FAIvariableContent)) { $message[]=_("Please specify a value for the attribute 'content'."); } - if(empty($this->Object_cn)){ + if(empty($this->cn)){ $message[] = _("Please enter a name."); } - if(preg_match("/[^0-9a-z]/i",$this->Object_cn)){ - $message[] = _("Please enter a valid name. Only a-Z 0-9 are allowed."); - } - return ($message); } @@ -98,8 +109,7 @@ class faiVariableEntry extends plugin { $tmp=array(); foreach($this->attributes as $attrs){ - $attr = preg_replace("/^Object_/","",$attrs); - $tmp[$attr] = $this->$attrs; + $tmp[$attrs] = stripslashes( $this->$attrs); } if(($this->orig_cn)&&($tmp['cn']!=$this->orig_cn)){ @@ -108,7 +118,7 @@ class faiVariableEntry extends plugin } $tmp['dn'] = $this->dn; - $tmp['status'] = $this->Object_status; + $tmp['status'] = $this->status; return($tmp); } }