Code

Base 64_coding for partition entries
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 9 Sep 2005 07:26:21 +0000 (07:26 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 9 Sep 2005 07:26:21 +0000 (07:26 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1339 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/FAI/class_faiPartitionTable.inc
plugins/admin/FAI/class_faiPartitionTableEntry.inc
plugins/admin/FAI/main.inc

index 2775620876f4bd4b19b1730002435d872de53501..e8735f79d7564c436dadbd35ee6b10abf652d501 100644 (file)
@@ -11,6 +11,7 @@ class faiPartitionTable extends plugin
   var $ignore_account   = TRUE;
   var $attributes       = array("cn","description");
   var $objectclasses    = array("top","FAIclass","FAIpartitionTable");
+  var $base64_encode    = array("FAImountPoint","FAImountOptions","FAIfsOptions","description");
 
   /* Specific attributes */
   var $cn               = "";       // The class name for this object
@@ -67,6 +68,10 @@ class faiPartitionTable extends plugin
           /* Append fetched partitions
            */
           $partition['status']="edited";
+    
+          foreach($this->base64_encode as $attrs){
+            $partition[$attrs] = base64_decode($partition[$attrs]);
+          }
           $this->disks[$name]['partitions'][$partition['FAIpartitionNr']] = $partition; 
         }  
       }
@@ -249,11 +254,18 @@ class faiPartitionTable extends plugin
   /* Check supplied data */
   function check()
   {
+
     $message= array();
-    if(empty($this->description)){
+
+    $str = utf8_encode("üöä");
+    if((empty($this->description))||(preg_match("/[^a-z0-9".$str."\.,;:-_\? ]/i",$this->description))){
       $message[]=_("Please enter a valid description.");
     }
 
+    if((empty($this->cn))||(preg_match("/[^a-z0-9]/i",$this->cn))){
+      $message[]=_("Please enter a valid name.");
+    }
+
     return ($message);
   }
 
@@ -321,14 +333,16 @@ class faiPartitionTable extends plugin
         print_red("unknown status while saving disks");
       }
 
-      //print $disk_dn;
-      //print_a($disk_attrs);
-
       show_ldap_error($ldap->get_error());
       if($disk['status']!="delete")
       /* Add all partitions */
       foreach($disk['partitions'] as $key => $partition){
         $partition_attrs = array();
+
+        foreach($this->base64_encode as $attrs){
+          $partition[$attrs] = base64_encode($partition[$attrs]);          
+        }
+
         foreach($partition as $key => $value){
           if(!empty($value)){
             $partition_attrs[$key]=$value;        
@@ -343,10 +357,6 @@ class faiPartitionTable extends plugin
         unset($partition_attrs['status']);
         unset($partition_attrs['old_cn']);
       
-        //print $partition_dn;
-        //print_a($partition);
-        //print_a($partition_attrs);
-
         if(($partition['status'] == "delete")&&($disk['status']!="new")){
           $ldap->cd($partition_dn);
           $ldap->rmdir_recursive($partition_dn);
index a42958123caba08539793d58d6be7aad9b8682b9..1367cbb022ffb17d639be07148d8e39c875cc711 100644 (file)
@@ -293,10 +293,12 @@ class faiPartitionTableEntry extends plugin
     if(empty($this->DISK_description)){
       $message[] = _("Please enter a description for your disk.");
     }
-    if(preg_match("/[^0-9a-z]/",$this->DISK_description)){
-      $message[] = _("Please enter a valid description for your disk. Only a-Z 0-9 are allowed.");
+
+    $str = utf8_encode("üöä");
+    if(preg_match("/[^a-z0-9".$str."\.,;:-_\? ]/i",$this->DISK_description)){
+      $message[]=_("Please enter a valid description.");
     }
-  
+    
     /* check every partition.
      * if there is an invalid value defined, append an errorstr to message
      */
index bdb04615c9704adc746e07b24ad227e62bb03802..36d3c502100f1f56345efebf1ef95e3f78a54dce 100644 (file)
@@ -35,9 +35,9 @@ if ($remove_lock){
 
        /* Page header*/
        if (isset($_SESSION['objectinfo'])){
-               $display= print_header(get_template_path('images/department.png'), _("FAI management"), "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".$_SESSION['objectinfo']);
+               $display= print_header(get_template_path('images/fai.png'), _("FAI management"), "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".$_SESSION['objectinfo']);
        } else {
-               $display= print_header(get_template_path('images/department.png'), _("FAI management"));
+               $display= print_header(get_template_path('images/fai.png'), _("FAI management"));
        }
 
        /* Reset requested? */