mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-25 18:19:22 +03:00
Fix UrlSafeBase64Encode function
This commit is contained in:
parent
6b1fd1239f
commit
969f15dd6b
1 changed files with 3 additions and 9 deletions
|
|
@ -1721,7 +1721,7 @@ END;
|
||||||
*/
|
*/
|
||||||
public static function UrlSafeBase64Encode($sValue)
|
public static function UrlSafeBase64Encode($sValue)
|
||||||
{
|
{
|
||||||
return \str_replace(array('+', '/', '='), array('-', '_', '.'), \base64_encode($sValue));
|
return \rtrim(\strtr(\base64_encode(\trim($sValue)), '+/', '-_'), '=');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -1731,14 +1731,8 @@ END;
|
||||||
*/
|
*/
|
||||||
public static function UrlSafeBase64Decode($sValue)
|
public static function UrlSafeBase64Decode($sValue)
|
||||||
{
|
{
|
||||||
$sData = \str_replace(array('-', '_', '.'), array('+', '/', '='), $sValue);
|
$sValue = \rtrim(\strtr($sValue, '-_.', '+/='), '=');
|
||||||
$sMode = \strlen($sData) % 4;
|
return \MailSo\Base\Utils::Base64Decode(\str_pad($sValue, \strlen($sValue) % 4, '=', STR_PAD_RIGHT));
|
||||||
if ($sMode)
|
|
||||||
{
|
|
||||||
$sData .= \substr('====', $sMode);
|
|
||||||
}
|
|
||||||
|
|
||||||
return \MailSo\Base\Utils::Base64Decode($sData);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue