* CalDAV: fixed parsing of principal urls used by iOS6 for users

This commit is contained in:
Ralf Becker 2012-10-22 16:43:51 +00:00
parent 685bcd6632
commit c87d6997ab

View File

@ -974,7 +974,7 @@ class groupdav_principals extends groupdav_handler
*/
static public function url2uid($url, $only_type=null)
{
if (!$only_type) $only_type = array('accounts', 'groups', 'resources', 'locations', 'mailto');
if (!$only_type) $only_type = array('users', 'groups', 'resources', 'locations', 'mailto');
if ($url[0] == '/')
{
@ -990,7 +990,7 @@ class groupdav_principals extends groupdav_handler
{
case 'http':
case 'https':
list(,$rest) = explode($GLOBALS['egw_info']['server']['webserver_url'].'/groupdav.php/principals/', $url);
list(,$rest) = explode('/groupdav.php/principals/', $url);
list($type, $name) = explode('/', $rest);
switch($type)
{
@ -1008,7 +1008,7 @@ class groupdav_principals extends groupdav_handler
case 'mailto':
if (($uid = $GLOBALS['egw']->accounts->name2id($rest, 'account_email')))
{
$type = $uid > 0 ? 'accounts' : 'groups';
$type = $uid > 0 ? 'users' : 'groups';
break;
}
// search contacts for email
@ -1039,6 +1039,7 @@ class groupdav_principals extends groupdav_handler
{
if ($type == 'accounts')
{
$type = $id > 0 ? 'users' : 'groups';
$uid = $id;
}
else
@ -1064,6 +1065,7 @@ class groupdav_principals extends groupdav_handler
}
return false;
}
//error_log(__METHOD__."('$url', ".array2string($only_type).") uid='$uid', type='$type' --> returning ".array2string($uid && in_array($type, $only_type) ? $uid : false));
return $uid && in_array($type, $only_type) ? $uid : false;
}