Code

Updated System type & os type management, can't create existing entries, can't delete...
[gosa.git] / plugins / admin / systems / class_servNfs.inc
index 95957ecc554abb8ae838a8128c89ef37cf3313a1..7a72a47d206411a5edbac73e4a3a86e84dcabeb9 100644 (file)
@@ -28,12 +28,33 @@ class servnfs extends plugin
   {
     plugin::plugin ($config, $dn);
     $this->types   = array("NFS"=>"NFS","samba"=>"samba","NCP"=>"NCP");
-    $this->charsets = array("UTF-8" => "UTF-8",
-        "ISO8859-1"=>"ISO8859-1 (Latin 1)",
-        "ISO8859-2"=>"ISO8859-2 (Latin 2)",
-        "ISO8859-3"=>"ISO8859-3 (Latin 3)",
-        "ISO8859-4"=>"ISO8859-4 (Latin 4)",
-        "ISO8859-5"=>"ISO8859-5 (Latin 5)");
+
+    $this->charsets = array();
+
+    if(!file_exists("/etc/gosa/encodings")){
+      print_red(_("The file '/etc/gosa/encodings' does not exist, can't get supported charsets."));
+    }else{
+      if(!is_readable("/etc/gosa/encodings")){
+        print_red(_("Can't read '/etc/gosa/encodings', please check permissions."));
+      }else{
+        $fp = fopen("/etc/gosa/encodings","r");
+        $i = 100;
+        while(!feof($fp)&&$i){
+          $i -- ;
+          $str = trim(fgets($fp,256));
+      
+          /* Skip comments */
+          if(!preg_match("/^#/",$str)){
+            $arr = split("\=",$str);
+            if(count($arr)==2){
+              $this->charsets[$arr[0]]=$arr[1];
+            }
+          }
+        }
+
+    
+      }
+    }
 
     if($entry){
       $tmp = split("\|",$entry);
@@ -51,6 +72,9 @@ class servnfs extends plugin
 
   function execute()
   {
+       /* Call parent execute */
+       plugin::execute();
+
     /* Fill templating stuff */
     $smarty= get_smarty();
 
@@ -111,6 +135,18 @@ class servnfs extends plugin
       }
     }
 
+    if(preg_match("/\|/",$this->description)){
+      $message[]=_("Description contains invalid characters.");
+    }
+  
+    if(preg_match("/\|/",$this->path)){
+      $message[]=_("Path contains invalid characters.");
+    }
+
+    if(preg_match("/\|/",$this->option)){
+      $message[]=_("Option contains invalid characters.");
+    }
+
     $ldap= $this->config->get_ldap_link();
     $ldap->cd($this->config->current['BASE']);
     $ldap->search("(objectClass=goShareServer)", array("goExportEntry"));