1 <?xml version="1.0" encoding="UTF-8"?>
2 <!-- EN-Revision: 21496 -->
4 <sect1 id="zend.ldap.ldif">
5 <title>Serialiser des données LDAP depuis/vers LDIF</title>
7 <sect2 id="zend.ldap.ldif.encode">
8 <title>Serialiser une entrée LDAP vers LDIF</title>
10 <programlisting language="php"><![CDATA[
12 'dn' => 'uid=rogasawara,ou=営業部,o=Airius',
13 'objectclass' => array('top',
15 'organizationalPerson',
17 'uid' => array('rogasawara'),
18 'mail' => array('rogasawara@airius.co.jp'),
19 'givenname;lang-ja' => array('ロドニー'),
20 'sn;lang-ja' => array('小笠原'),
21 'cn;lang-ja' => array('小笠原 ロドニー'),
22 'title;lang-ja' => array('営業部 部長'),
23 'preferredlanguage' => array('ja'),
24 'givenname' => array('ロドニー'),
26 'cn' => array('小笠原 ロドニー'),
27 'title' => array('営業部 部長'),
28 'givenname;lang-ja;phonetic' => array('ろどにー'),
29 'sn;lang-ja;phonetic' => array('おがさわら'),
30 'cn;lang-ja;phonetic' => array('おがさわら ろどにー'),
31 'title;lang-ja;phonetic' => array('えいぎょうぶ ぶちょう'),
32 'givenname;lang-en' => array('Rodney'),
33 'sn;lang-en' => array('Ogasawara'),
34 'cn;lang-en' => array('Rodney Ogasawara'),
35 'title;lang-en' => array('Sales, Director'),
37 $ldif = Zend_Ldap_Ldif_Encoder::encode($data, array('sort' => false,
41 dn:: dWlkPXJvZ2FzYXdhcmEsb3U95Za25qWt6YOoLG89QWlyaXVz
44 objectclass: organizationalPerson
45 objectclass: inetOrgPerson
47 mail: rogasawara@airius.co.jp
48 givenname;lang-ja:: 44Ot44OJ44OL44O8
49 sn;lang-ja:: 5bCP56yg5Y6f
50 cn;lang-ja:: 5bCP56yg5Y6fIOODreODieODi+ODvA==
51 title;lang-ja:: 5Za25qWt6YOoIOmDqOmVtw==
53 givenname:: 44Ot44OJ44OL44O8
55 cn:: 5bCP56yg5Y6fIOODreODieODi+ODvA==
56 title:: 5Za25qWt6YOoIOmDqOmVtw==
57 givenname;lang-ja;phonetic:: 44KN44Gp44Gr44O8
58 sn;lang-ja;phonetic:: 44GK44GM44GV44KP44KJ
59 cn;lang-ja;phonetic:: 44GK44GM44GV44KP44KJIOOCjeOBqeOBq+ODvA==
60 title;lang-ja;phonetic:: 44GI44GE44GO44KH44GG44G2IOOBtuOBoeOCh+OBhg==
61 givenname;lang-en: Rodney
63 cn;lang-en: Rodney Ogasawara
64 title;lang-en: Sales, Director
69 <sect2 id="zend.ldap.ldif.decode">
70 <title>Desérialiser une chaine LDIF dans une entrée LDAP</title>
72 <programlisting language="php"><![CDATA[
73 $ldif = "dn:: dWlkPXJvZ2FzYXdhcmEsb3U95Za25qWt6YOoLG89QWlyaXVz
76 objectclass: organizationalPerson
77 objectclass: inetOrgPerson
79 mail: rogasawara@airius.co.jp
80 givenname;lang-ja:: 44Ot44OJ44OL44O8
81 sn;lang-ja:: 5bCP56yg5Y6f
82 cn;lang-ja:: 5bCP56yg5Y6fIOODreODieODi+ODvA==
83 title;lang-ja:: 5Za25qWt6YOoIOmDqOmVtw==
85 givenname:: 44Ot44OJ44OL44O8
87 cn:: 5bCP56yg5Y6fIOODreODieODi+ODvA==
88 title:: 5Za25qWt6YOoIOmDqOmVtw==
89 givenname;lang-ja;phonetic:: 44KN44Gp44Gr44O8
90 sn;lang-ja;phonetic:: 44GK44GM44GV44KP44KJ
91 cn;lang-ja;phonetic:: 44GK44GM44GV44KP44KJIOOCjeOBqeOBq+ODvA==
92 title;lang-ja;phonetic:: 44GI44GE44GO44KH44GG44G2IOOBtuOBoeOCh+OBhg==
93 givenname;lang-en: Rodney
95 cn;lang-en: Rodney Ogasawara
96 title;lang-en: Sales, Director";
97 $data = Zend_Ldap_Ldif_Encoder::decode($ldif);
100 'dn' => 'uid=rogasawara,ou=営業部,o=Airius',
101 'objectclass' => array('top',
103 'organizationalPerson',
105 'uid' => array('rogasawara'),
106 'mail' => array('rogasawara@airius.co.jp'),
107 'givenname;lang-ja' => array('ロドニー'),
108 'sn;lang-ja' => array('小笠原'),
109 'cn;lang-ja' => array('小笠原 ロドニー'),
110 'title;lang-ja' => array('営業部 部長'),
111 'preferredlanguage' => array('ja'),
112 'givenname' => array('ロドニー'),
113 'sn' => array('小笠原'),
114 'cn' => array('小笠原 ロドニー'),
115 'title' => array('営業部 部長'),
116 'givenname;lang-ja;phonetic' => array('ろどにー'),
117 'sn;lang-ja;phonetic' => array('おがさわら'),
118 'cn;lang-ja;phonetic' => array('おがさわら ろどにー'),
119 'title;lang-ja;phonetic' => array('えいぎょうぶ ぶちょう'),
120 'givenname;lang-en' => array('Rodney'),
121 'sn;lang-en' => array('Ogasawara'),
122 'cn;lang-en' => array('Rodney Ogasawara'),
123 'title;lang-en' => array('Sales, Director'),