You are here

function ldap_servers_msguid in Lightweight Directory Access Protocol (LDAP) 8.2

Same name and namespace in other branches
  1. 7.2 ldap_servers/ldap_servers.module \ldap_servers_msguid()

function to convert microsoft style guids to strings

4 calls to ldap_servers_msguid()
LdapServersTestCase::testInstall in ldap_servers/tests/ldap_servers.test
ldap_servers_binary in ldap_servers/ldap_servers.module
general binary conversion function for guids tries to determine which approach based on length of string
ldap_servers_convert_attribute in ldap_servers/ldap_servers.module
ldap_servers_token_tokenize_entry in ldap_servers/ldap_servers.tokens.inc
Turn an ldap entry into a token array suitable for the t() function

File

ldap_servers/ldap_servers.module, line 615

Code

function ldap_servers_msguid($value) {
  $hex_string = bin2hex($value);

  // (MS?) GUID are displayed with first three GUID parts as "big endian"
  // Doing this so String value matches what other LDAP tool displays for AD.
  $value = strtoupper(substr($hex_string, 6, 2) . substr($hex_string, 4, 2) . substr($hex_string, 2, 2) . substr($hex_string, 0, 2) . '-' . substr($hex_string, 10, 2) . substr($hex_string, 8, 2) . '-' . substr($hex_string, 14, 2) . substr($hex_string, 12, 2) . '-' . substr($hex_string, 16, 4) . '-' . substr($hex_string, 20, 12));
  return $value;
}