mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-06 07:57:02 +03:00
vCard parser fixes
This commit is contained in:
parent
147dce6e4a
commit
3613bf5270
8 changed files with 62 additions and 20 deletions
|
|
@ -182,7 +182,7 @@ class Contact
|
|||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function ToVCard($sPreVCard = '')
|
||||
public function ToVCard($sPreVCard = '', $oLogger = null)
|
||||
{
|
||||
$this->UpdateDependentValues();
|
||||
|
||||
|
|
@ -191,6 +191,11 @@ class Contact
|
|||
return '';
|
||||
}
|
||||
|
||||
if ("\xef\xbb\xbf" === \substr($sPreVCard, 0, 3))
|
||||
{
|
||||
$sPreVCard = \substr($sPreVCard, 3);
|
||||
}
|
||||
|
||||
$oVCard = null;
|
||||
if (0 < \strlen($sPreVCard))
|
||||
{
|
||||
|
|
@ -198,7 +203,14 @@ class Contact
|
|||
{
|
||||
$oVCard = \Sabre\VObject\Reader::read($sPreVCard);
|
||||
}
|
||||
catch (\Exception $oExc) {};
|
||||
catch (\Exception $oExc)
|
||||
{
|
||||
if ($oLogger)
|
||||
{
|
||||
$oLogger->WriteException($oExc);
|
||||
$oLogger->WriteDump($sPreVCard);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$oVCard)
|
||||
|
|
@ -484,8 +496,13 @@ class Contact
|
|||
}
|
||||
}
|
||||
|
||||
public function PopulateByVCard($sVCard, $sEtag = '')
|
||||
public function PopulateByVCard($sUid, $sVCard, $sEtag = '', $oLogger = null)
|
||||
{
|
||||
if ("\xef\xbb\xbf" === \substr($sVCard, 0, 3))
|
||||
{
|
||||
$sVCard = \substr($sVCard, 3);
|
||||
}
|
||||
|
||||
$this->Properties = array();
|
||||
|
||||
if (!\class_exists('Sabre\DAV\Client'))
|
||||
|
|
@ -502,7 +519,16 @@ class Contact
|
|||
{
|
||||
$oVCard = \Sabre\VObject\Reader::read($sVCard);
|
||||
}
|
||||
catch (\Exception $oExc) {};
|
||||
catch (\Exception $oExc)
|
||||
{
|
||||
if ($oLogger)
|
||||
{
|
||||
$oLogger->WriteException($oExc);
|
||||
$oLogger->WriteDump($sVCard);
|
||||
}
|
||||
|
||||
$this->IdContactStr = $sUid;
|
||||
}
|
||||
|
||||
$aProperties = array();
|
||||
if ($oVCard)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue