Révision bc175c27
Ajouté par Assos Assos il y a plus de 5 ans
drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.tokens.inc | ||
---|---|---|
96 | 96 |
* |
97 | 97 |
* by reference return add ldap attribute triplet $attribute_maps[<attr_name>] = (<attr_name>, <ordinal>, <data_type>) to $attributes |
98 | 98 |
*/ |
99 |
function ldap_servers_token_extract_attributes(&$attribute_maps, $text) {
|
|
99 |
function ldap_servers_token_extract_attributes(&$attribute_maps, $text) { |
|
100 | 100 |
$tokens = ldap_servers_token_tokens_needed_for_template($text); |
101 | 101 |
foreach ($tokens as $token) { |
102 | 102 |
$token = str_replace(array(LDAP_SERVERS_TOKEN_PRE, LDAP_SERVERS_TOKEN_POST), array('', ''), $token); |
... | ... | |
164 | 164 |
[cn] = jdoe |
165 | 165 |
[cn:0] = jdoe |
166 | 166 |
[cn:last] => jdoe |
167 |
[cn:reverse:0] = jdoe |
|
167 | 168 |
[ou] = campus accounts |
168 | 169 |
[ou:0] = campus accounts |
169 | 170 |
[ou:1] = toledo campus |
170 | 171 |
[ou:last] = toledo campus |
172 |
[ou:reverse:0] = toledo campus |
|
173 |
[ou:reverse:1] = campus accounts |
|
171 | 174 |
[dc] = ad |
172 | 175 |
[dc:0] = ad |
173 | 176 |
[dc:1] = myuniversity |
174 | 177 |
[dc:2] = edu |
175 | 178 |
[dc:last] = edu |
179 |
[dc:reverse:0] = edu |
|
180 |
[dc:reverse:1] = myuniversity |
|
181 |
[dc:reverse:2] = ad |
|
176 | 182 |
|
177 | 183 |
-- from other attributes |
178 | 184 |
[mail] = jdoe@myuniversity.edu |
... | ... | |
237 | 243 |
$parts_count[$attr_name]++; |
238 | 244 |
} |
239 | 245 |
|
246 |
// Add the parts in reverse order to reflect the hierarchy. |
|
247 |
foreach ($parts_count as $part => $count) { |
|
248 |
$part = strtolower($part); |
|
249 |
for ($i = 0; $i < $count; $i++) { |
|
250 |
$reverse_position = $count - $i - 1; |
|
251 |
$tokens[$pre . $part . LDAP_SERVERS_TOKEN_DEL . 'reverse' . LDAP_SERVERS_TOKEN_DEL . $reverse_position . $post] = $tokens[$pre . $part . LDAP_SERVERS_TOKEN_DEL . $i . $post]; |
|
252 |
} |
|
253 |
} |
|
254 |
|
|
240 | 255 |
foreach ($parts_count as $attr_name => $count) { |
241 | 256 |
$tokens[$pre . ldap_server_massage_text($attr_name, 'attr_name', LDAP_SERVER_MASSAGE_TOKEN_REPLACE) . LDAP_SERVERS_TOKEN_DEL . 'last' . $post] = $parts_last_value[$attr_name]; |
242 | 257 |
} |
... | ... | |
253 | 268 |
$tokens[$pre . ldap_server_massage_text($attr_name, 'attr_name', LDAP_SERVER_MASSAGE_TOKEN_REPLACE) . LDAP_SERVERS_TOKEN_DEL . 'last' . $post] = check_plain($attr_value[0]); |
254 | 269 |
} |
255 | 270 |
elseif (is_array($attr_value) && $attr_value['count'] > 1) { |
256 |
$tokens[$pre . ldap_server_massage_text($attr_name, 'attr_name', LDAP_SERVER_MASSAGE_TOKEN_REPLACE) . LDAP_SERVERS_TOKEN_DEL . 'last' . $post] = check_plain($attr_value[$attr_value['count']-1]);
|
|
257 |
for ($i=0; $i<$attr_value['count']; $i++) {
|
|
271 |
$tokens[$pre . ldap_server_massage_text($attr_name, 'attr_name', LDAP_SERVER_MASSAGE_TOKEN_REPLACE) . LDAP_SERVERS_TOKEN_DEL . 'last' . $post] = check_plain($attr_value[$attr_value['count'] - 1]);
|
|
272 |
for ($i = 0; $i < $attr_value['count']; $i++) {
|
|
258 | 273 |
$tokens[$pre . ldap_server_massage_text($attr_name, 'attr_name', LDAP_SERVER_MASSAGE_TOKEN_REPLACE) . LDAP_SERVERS_TOKEN_DEL . $i . $post] = check_plain($attr_value[$i]); |
259 | 274 |
} |
260 | 275 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules