]> git.entuzijast.net Git - freeradius-dialup-admin.git/commitdiff
* Add a string encoder for greek
authorkkalev <kkalev>
Sun, 13 Oct 2002 20:18:17 +0000 (20:18 +0000)
committerkkalev <kkalev>
Sun, 13 Oct 2002 20:18:17 +0000 (20:18 +0000)
* If general_decode_normal_attributes is set then encode attributes in lib/ldap/change_info. In the near future
  language specific user attributes will be added in the change info and new user pages. Remove comments from
  admin.conf about the change info page not working if this directive is used.
* When spliting cn in lib/ldap/create_user.php3 limit the split to 2 new elements not 3.

Changelog
conf/admin.conf
lib/lang/el/utf8.php3
lib/ldap/change_info.php3
lib/ldap/create_user.php3

index 7c2409387cb509b0db977eccde6febca0d551f97..023c40693f174548e76b63e40ff6313f88f94daf 100644 (file)
--- a/Changelog
+++ b/Changelog
@@ -1,3 +1,9 @@
+Ver 1.61:
+* Add a string encoder for greek
+* If general_decode_normal_attributes is set then encode attributes in lib/ldap/change_info. In the near future
+  language specific user attributes will be added in the change info and new user pages. Remove comments from
+  admin.conf about the change info page not working if this directive is used.
+* When spliting cn in lib/ldap/create_user.php3 limit the split to 2 new elements not 3.
 Ver 1.60:
 * Use require_once when including lib/functions.php3 in lib/sql
 * In the buttons toolbar Edit User should not be clickable.
index f9cc061bb6fb7315dad0573923af48c980f95749..c281e99964cd83b750e9aca9708461aa8524e581 100644 (file)
@@ -10,8 +10,6 @@ general_prefered_lang_name: Greek
 #
 # Uncomment this if normal attributes (not the ;lang-xx ones) in ldap
 # are utf8 encoded.
-# Changing user attribute through user_info will *not* work in that case,
-# but you will at least be able to see user attributes.
 #
 #general_decode_normal_attributes: yes
 #
index 8048ea74fb4b2c4991548c71e2b84dddcb21064f..6d2f17303083f4da2a7d738f6cb6706dbb19272f 100644 (file)
@@ -1,4 +1,34 @@
 <?php
+function init_encoder()
+{
+       $k = array(
+
+               "~@"=>"\80", "~A"=>"\81", "~B"=>"\82", "~C"=>"\83", "~D"=>"\84", "~E"=>"\85",
+               "~F"=>"\86", "~G"=>"\87", "~H"=>"\88", "~I"=>"\89", "~J"=>"\8a", "~K"=>"\8b",
+               "~L"=>"\8c", "~M"=>"\8d", "~N"=>"\8e", "~O"=>"\8f", "~P"=>"\90", "~Q"=>"\91",
+               "~R"=>"\92", "~S"=>"\93", "~T"=>"\94", "~U"=>"\95", "~V"=>"\96", "~W"=>"\97",
+               "~^"=>"Â\9e", "~_"=>"Â\9f", "| "=>" ", "¡"=>"ʽ", "¢"=>"ʼ", "£"=>"£",
+               "¤"=>"�", "¥"=>"�", "¦"=>"¦", "§"=>"§", "¨"=>"¨", "©"=>"©",
+               "ª"=>"�", "«"=>"«", "¬"=>"¬", "­"=>"­", "®"=>"�", "¯"=>"â\80\95",
+               "°"=>"°", "±"=>"±", "²"=>"²", "³"=>"³", "´"=>"Î\84", "µ"=>"Î\85",
+               "¶"=>"Î\86", "·"=>"·", "¸"=>"Î\88", "¹"=>"Î\89", "º"=>"Î\8a", "»"=>"»",
+               "¼"=>"Î\8c", "½"=>"½", "¾"=>"Î\8e", "¿"=>"Î\8f", "À"=>"Î\90", "Á"=>"Î\91",
+               "Â"=>"Î\92", "Ã"=>"Î\93", "Ä"=>"Î\94", "Å"=>"Î\95", "Æ"=>"Î\96", "Ç"=>"Î\97",
+               "È"=>"Î\98", "É"=>"Î\99", "Ê"=>"Î\9a", "Ë"=>"Î\9b", "Ì"=>"Î\9c", "Í"=>"Î\9d",
+               "Î"=>"Î\9e", "Ï"=>"Î\9f", "Ð"=>"Π", "Ñ"=>"Ρ", "Ò"=>"�", "Ó"=>"Σ",
+               "Ô"=>"Τ", "Õ"=>"Î¥", "Ö"=>"Φ", "×"=>"Χ", "Ø"=>"Ψ", "Ù"=>"Ω",
+               "Ú"=>"Ϊ", "Û"=>"Ϋ", "Ü"=>"ά", "Ý"=>"έ", "Þ"=>"ή", "ß"=>"ί",
+               "à"=>"ΰ", "á"=>"α", "â"=>"β", "ã"=>"γ", "ä"=>"δ", "å"=>"ε",
+               "æ"=>"ζ", "ç"=>"η", "è"=>"θ", "é"=>"ι", "ê"=>"κ", "ë"=>"λ",
+               "ì"=>"μ", "í"=>"ν", "î"=>"ξ", "ï"=>"ο", "ð"=>"Ï\80", "ñ"=>"Ï\81",
+               "ò"=>"Ï\82", "ó"=>"Ï\83", "ô"=>"Ï\84", "õ"=>"Ï\85", "ö"=>"Ï\86", "÷"=>"Ï\87",
+               "ø"=>"Ï\88", "ù"=>"Ï\89", "ú"=>"Ï\8a", "û"=>"Ï\8b", "ü"=>"Ï\8c", "ý"=>"Ï\8d",
+               "þ"=>"Ï\8e", "~X"=>"Â\98", "~Y"=>"Â\99", "~Z"=>"Â\9a", "~["=>"Â\9b", "~]"=>"Â\9d"
+       );
+
+       return $k;
+}
+
 function init_decoder()
 {
        $k = array(
@@ -28,6 +58,18 @@ function init_decoder()
        return $k;
 }
 
+function encode_string($line,$k)
+{
+       for($i=0;$i<strlen($line);$i++){
+               $c = $line{$i};
+               $val = $k["$c"];
+               $c = ($val != "") ? "$val" : "$c";
+               $new_line .= $c;
+       }
+
+       return $new_line;
+}
+
 function decode_string($line,$k)
 {
        $line = ereg_replace("&","&&",$line);
index bb41a9a737f595feb0983d234267f13a65d633a6..8d0e47e3fb3eb9cbb462bb895d264836f8f5cb6a 100644 (file)
@@ -4,15 +4,33 @@ require_once('../lib/ldap/functions.php3');
                $ds = @ldap_connect($config[ldap_write_server]);
        else
                $ds = @ldap_connect($config[ldap_server]);
+       if ($config[general_decode_normal_attributes] == 'yes'){
+               $decode_normal = 1;
+               if (is_file("../lib/lang/$config[general_prefered_lang]/utf8.php3"))
+                       include_once("../lib/lang/$config[general_prefered_lang]/utf8.php3");
+               else
+                       include_once('../lib/lang/default/utf8.php3');
+               $k = init_encoder();
+       }
        if ($ds){
                $r = @da_ldap_bind($ds,$config);
                if ($r){
-                       if ($Fcn != '' && $Fcn != '-' && $Fcn != $cn)
+                       if ($Fcn != '' && $Fcn != '-' && $Fcn != $cn){
+                               list ($givenname,$sn) = split(' ',$Fcn,2);
                                $mod['cn'] = $Fcn;
+                               $mod['cn'] = ($decode_normal) ? encode_string($mod['cn'],$k) : $mod['cn'];
+                               $mod['givenname'] = $givenname;
+                       $mod['givenname'] = ($decode_normal) ? encode_string($mod['givenname'],$k) : $mod['givenname'];
+                               $mod['sn'] = $sn;
+                               $mod['sn'] = ($decode_normal) ? encode_string($mod['sn'],$k) : $mod['sn'];
+                               
+                       }
                        if ($Fmail != '' && $Fmail != '-' && $Fmail != $mail)
                                $mod['mail'] = $Fmail;
-                       if ($Fou != '' && $Fou != '-' && $Fou != $ou)
+                       if ($Fou != '' && $Fou != '-' && $Fou != $ou){
                                $mod['ou'] = $Fou;
+                               $mod['ou'] = ($decode_normal) ? encode_string($mod['ou'],$k) : $mod['ou'];
+                       }
                        if ($Ftelephonenumber != '' && $Ftelephonenumber != '-' && $Ftelephonenumber != $telephonenumber)
                                $mod['telephonenumber'] = $Ftelephonenumber;
                        if ($Fhomephone != '' && $Fhomephone != '-' && $Fhomephone != $homephone)
index f89ec6e2d18fe55d0b4745d2cf44b00f3bf78fe9..f59eb394d182f1f97f45a4419d032a4b93c46485 100644 (file)
@@ -8,7 +8,7 @@ require_once('../lib/ldap/functions.php3');
        if ($ds){
                $r = @da_ldap_bind($ds,$config);
                if ($r){
-                       list ($givenname,$sn) = split(' ',$Fcn,3);
+                       list ($givenname,$sn) = split(' ',$Fcn,2);
                        $dn = 'uid=' . $login . ',' . $config[ldap_default_new_entry_suffix];
                        $new_user_entry["objectclass"][0]="top";
                        $new_user_entry["objectclass"][1]="person";