Code

Fixed attachment for printer
[gosa.git] / plugins / admin / fai / class_faiVariableEntry.inc
index 18f635f129a75534f3d717dae1bc9c0a3cabc97c..f367315026db30f7af6f4bf136aacb228cd9a0ed 100644 (file)
@@ -9,15 +9,15 @@ 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";
   
   function faiVariableEntry ($config, $dn= NULL,$object=false)
   {
@@ -26,17 +26,20 @@ class faiVariableEntry extends plugin
       $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);
       }
     }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,9 +49,9 @@ 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)));
       }
     }
 
@@ -75,18 +78,14 @@ class faiVariableEntry extends plugin
   {
     $message= array();
     
-    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);
   }
  
@@ -94,8 +93,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)){
@@ -104,7 +102,7 @@ class faiVariableEntry extends plugin
     }
   
     $tmp['dn']      = $this->dn;  
-    $tmp['status']  = $this->Object_status;  
+    $tmp['status']  = $this->status;  
     return($tmp);
   }
 }