From db6b9b280122d2be93bd640e68130871f8d53368 Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 9 Sep 2005 07:26:21 +0000 Subject: [PATCH] Base 64_coding for partition entries git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1339 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/admin/FAI/class_faiPartitionTable.inc | 26 +++++++++++++------ .../FAI/class_faiPartitionTableEntry.inc | 8 +++--- plugins/admin/FAI/main.inc | 4 +-- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/plugins/admin/FAI/class_faiPartitionTable.inc b/plugins/admin/FAI/class_faiPartitionTable.inc index 277562087..e8735f79d 100644 --- a/plugins/admin/FAI/class_faiPartitionTable.inc +++ b/plugins/admin/FAI/class_faiPartitionTable.inc @@ -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); diff --git a/plugins/admin/FAI/class_faiPartitionTableEntry.inc b/plugins/admin/FAI/class_faiPartitionTableEntry.inc index a42958123..1367cbb02 100644 --- a/plugins/admin/FAI/class_faiPartitionTableEntry.inc +++ b/plugins/admin/FAI/class_faiPartitionTableEntry.inc @@ -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 */ diff --git a/plugins/admin/FAI/main.inc b/plugins/admin/FAI/main.inc index bdb04615c..36d3c5021 100644 --- a/plugins/admin/FAI/main.inc +++ b/plugins/admin/FAI/main.inc @@ -35,9 +35,9 @@ if ($remove_lock){ /* Page header*/ if (isset($_SESSION['objectinfo'])){ - $display= print_header(get_template_path('images/department.png'), _("FAI management"), "\"\" ".$_SESSION['objectinfo']); + $display= print_header(get_template_path('images/fai.png'), _("FAI management"), "\"\" ".$_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? */ -- 2.30.2