From 4e98627c646b70788cd5a28343f57fa7aefc1c37 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 18 Jan 2006 11:57:20 +0000 Subject: [PATCH] Excluded encodings in a seperated file git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2520 594d385d-05f5-0310-b6e9-bd551577e9d8 --- contrib/encodings | 9 +++++++ plugins/admin/systems/class_servNfs.inc | 34 ++++++++++++++++++++----- 2 files changed, 36 insertions(+), 7 deletions(-) create mode 100755 contrib/encodings diff --git a/contrib/encodings b/contrib/encodings new file mode 100755 index 000000000..51d6f8211 --- /dev/null +++ b/contrib/encodings @@ -0,0 +1,9 @@ +# Encodings for class_servNfs.inc +# This file should be placed in /etc/gosa/ +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) +cp850=CP850 (Europe) diff --git a/plugins/admin/systems/class_servNfs.inc b/plugins/admin/systems/class_servNfs.inc index d7012296e..7a72a47d2 100644 --- a/plugins/admin/systems/class_servNfs.inc +++ b/plugins/admin/systems/class_servNfs.inc @@ -28,13 +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)", - "cp850"=>"CP850 (Europe)"); + + $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); -- 2.30.2