Commit a007c61d authored by Björn Fischer's avatar Björn Fischer

convert binary data to string

parent b48c459f
...@@ -99,7 +99,9 @@ class BackendCalDAV extends BackendDiff { ...@@ -99,7 +99,9 @@ class BackendCalDAV extends BackendDiff {
if ($items['count'] > 0) { if ($items['count'] > 0) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->getIdentityFromLdap() - Found entry in LDAP. Generating From")); ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->getIdentityFromLdap() - Found entry in LDAP. Generating From"));
// We get the first object. It's your responsability to make the query unique // We get the first object. It's your responsability to make the query unique
$caldav_path = str_replace('%i', $items[0][CALDAV_IDENTITY_LDAP_IDENTIFIER][0], $caldav_path);
$identity = CALDAV_IDENTITY_LDAP_IDENTIFIER === "objectguid" ? $this->convertObjectGUID2Str($items[0][CALDAV_IDENTITY_LDAP_IDENTIFIER][0]) : $items[0][CALDAV_IDENTITY_LDAP_IDENTIFIER][0]
$caldav_path = str_replace('%i', , $caldav_path);
} }
else { else {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->getIdentityFromLdap() - No entry found in LDAP")); ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->getIdentityFromLdap() - No entry found in LDAP"));
...@@ -123,6 +125,25 @@ class BackendCalDAV extends BackendDiff { ...@@ -123,6 +125,25 @@ class BackendCalDAV extends BackendDiff {
return $caldav_path; return $caldav_path;
} }
private function convertObjectGUID2Str($oguid) {
$hex_guid = bin2hex($oguid);
$hex_guid_to_guid_str = '';
for($k = 1; $k <= 4; ++$k) {
$hex_guid_to_guid_str .= substr($hex_guid, 8 - 2 * $k, 2);
}
$hex_guid_to_guid_str .= '-';
for($k = 1; $k <= 2; ++$k) {
$hex_guid_to_guid_str .= substr($hex_guid, 12 - 2 * $k, 2);
}
$hex_guid_to_guid_str .= '-';
for($k = 1; $k <= 2; ++$k) {
$hex_guid_to_guid_str .= substr($hex_guid, 16 - 2 * $k, 2);
}
$hex_guid_to_guid_str .= '-' . substr($hex_guid, 16, 4);
$hex_guid_to_guid_str .= '-' . substr($hex_guid, 20);
return strtoupper($hex_guid_to_guid_str);
}
/** /**
* The connections to CalDAV are always directly closed. So nothing special needs to happen here. * The connections to CalDAV are always directly closed. So nothing special needs to happen here.
* @see IBackend::Logoff() * @see IBackend::Logoff()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment