mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-08 17:07:03 +03:00
Privacy/GDPR friendly version (removed: Social, Gravatar, Facebook, Google, Twitter, DropBox, OwnCloud)
Also removed: POP3, OAuth2 and update feature Added: admin password_hash/password_verify Requires: PHP 7.3+ Replaced: CRLF with LF Replaced: pclZip with ZipArchive
This commit is contained in:
parent
15ceddc202
commit
2cada68f41
293 changed files with 23728 additions and 85420 deletions
|
|
@ -66,7 +66,7 @@ class Contact
|
|||
$this->Etag = '';
|
||||
}
|
||||
|
||||
public function PopulateDisplayAndFullNameValue($bForceFullNameReplace = false)
|
||||
public function PopulateDisplayAndFullNameValue(bool $bForceFullNameReplace = false)
|
||||
{
|
||||
$sFullName = '';
|
||||
$sLastName = '';
|
||||
|
|
@ -161,19 +161,13 @@ class Contact
|
|||
$this->PopulateDisplayAndFullNameValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function RegenerateContactStr()
|
||||
public function RegenerateContactStr() : array
|
||||
{
|
||||
$this->IdContactStr = \class_exists('SabreForRainLoop\DAV\Client') ?
|
||||
\SabreForRainLoop\DAV\UUIDUtil::getUUID() : \MailSo\Base\Utils::Md5Rand();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function GetEmails()
|
||||
public function GetEmails() : array
|
||||
{
|
||||
$aResult = array();
|
||||
foreach ($this->Properties as /* @var $oProperty \RainLoop\Providers\AddressBook\Classes\Property */ &$oProperty)
|
||||
|
|
@ -187,18 +181,12 @@ class Contact
|
|||
return \array_unique($aResult);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function CardDavNameUri()
|
||||
public function CardDavNameUri() : string
|
||||
{
|
||||
return $this->IdContactStr.'.vcf';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function ToVCard($sPreVCard = '', $oLogger = null)
|
||||
public function ToVCard(string $sPreVCard = '', $oLogger = null) : string
|
||||
{
|
||||
$this->UpdateDependentValues();
|
||||
|
||||
|
|
@ -219,7 +207,7 @@ class Contact
|
|||
{
|
||||
$oVCard = \SabreForRainLoop\VObject\Reader::read($sPreVCard);
|
||||
}
|
||||
catch (\Exception $oExc)
|
||||
catch (\Throwable $oExc)
|
||||
{
|
||||
if ($oLogger)
|
||||
{
|
||||
|
|
@ -309,10 +297,7 @@ class Contact
|
|||
return (string) $oVCard->serialize();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function ToCsv($bWithHeader = false)
|
||||
public function ToCsv(bool $bWithHeader = false) : string
|
||||
{
|
||||
$aData = array();
|
||||
if ($bWithHeader)
|
||||
|
|
@ -470,10 +455,8 @@ class Contact
|
|||
|
||||
/**
|
||||
* @param mixed $oProp
|
||||
* @param bool $bOldVersion
|
||||
* @return string
|
||||
*/
|
||||
private function getPropertyValueHelper($oProp, $bOldVersion)
|
||||
private function getPropertyValueHelper($oProp, bool $bOldVersion) : string
|
||||
{
|
||||
$sValue = \trim($oProp);
|
||||
if ($bOldVersion && !isset($oProp->parameters['CHARSET']))
|
||||
|
|
@ -495,10 +478,8 @@ class Contact
|
|||
|
||||
/**
|
||||
* @param mixed $oProp
|
||||
* @param bool $bOldVersion
|
||||
* @return string
|
||||
*/
|
||||
private function addArrayPropertyHelper(&$aProperties, $oArrayProp, $iType)
|
||||
private function addArrayPropertyHelper(array &$aProperties, $oArrayProp, int $iType) : string
|
||||
{
|
||||
foreach ($oArrayProp as $oProp)
|
||||
{
|
||||
|
|
@ -520,7 +501,7 @@ class Contact
|
|||
}
|
||||
}
|
||||
|
||||
public function PopulateByVCard($sUid, $sVCard, $sEtag = '', $oLogger = null)
|
||||
public function PopulateByVCard(string $sUid, string $sVCard, string $sEtag = '', $oLogger = null)
|
||||
{
|
||||
if ("\xef\xbb\xbf" === \substr($sVCard, 0, 3))
|
||||
{
|
||||
|
|
@ -545,7 +526,7 @@ class Contact
|
|||
{
|
||||
$oVCard = \SabreForRainLoop\VObject\Reader::read($sVCard);
|
||||
}
|
||||
catch (\Exception $oExc)
|
||||
catch (\Throwable $oExc)
|
||||
{
|
||||
if ($oLogger)
|
||||
{
|
||||
|
|
@ -559,14 +540,10 @@ class Contact
|
|||
// $oLogger->WriteDump($sVCard);
|
||||
// }
|
||||
|
||||
$bOwnCloud = false;
|
||||
$aProperties = array();
|
||||
|
||||
if ($oVCard)
|
||||
{
|
||||
$bOwnCloud = empty($oVCard->PRODID) ? false :
|
||||
false !== \strpos(\strtolower($oVCard->PRODID), 'owncloud');
|
||||
|
||||
$bOldVersion = empty($oVCard->VERSION) ? false :
|
||||
\in_array((string) $oVCard->VERSION, array('2.1', '2.0', '1.0'));
|
||||
|
||||
|
|
|
|||
|
|
@ -65,51 +65,33 @@ class Property
|
|||
$this->Frec = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function IsName()
|
||||
public function IsName() : bool
|
||||
{
|
||||
return \in_array($this->Type, array(PropertyType::FULLNAME, PropertyType::FIRST_NAME,
|
||||
PropertyType::LAST_NAME, PropertyType::MIDDLE_NAME, PropertyType::NICK_NAME));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function IsEmail()
|
||||
public function IsEmail() : bool
|
||||
{
|
||||
return PropertyType::EMAIl === $this->Type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function IsPhone()
|
||||
public function IsPhone() : bool
|
||||
{
|
||||
return PropertyType::PHONE === $this->Type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function IsWeb()
|
||||
public function IsWeb() : bool
|
||||
{
|
||||
return PropertyType::WEB_PAGE === $this->Type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function IsValueForLower()
|
||||
public function IsValueForLower() : bool
|
||||
{
|
||||
return $this->IsEmail() || $this->IsName() || $this->IsWeb();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function TypesAsArray()
|
||||
public function TypesAsArray() : bool
|
||||
{
|
||||
$aResult = array();
|
||||
if (!empty($this->TypeStr))
|
||||
|
|
@ -121,10 +103,7 @@ class Property
|
|||
return $aResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function TypesUpperAsArray()
|
||||
public function TypesUpperAsArray() : array
|
||||
{
|
||||
return \array_map('strtoupper', $this->TypesAsArray());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue