mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-25 18:19:22 +03:00
PreRelease fixes
This commit is contained in:
parent
34a9b8cbc5
commit
42bac6aa2f
55 changed files with 578 additions and 238 deletions
|
|
@ -49,7 +49,13 @@ class DateTimeHelper
|
|||
*/
|
||||
public static function ParseRFC2822DateString($sDateTime)
|
||||
{
|
||||
$sDateTime = \trim(\preg_replace('/ \([a-zA-Z0-9]+\)$/', '', \trim($sDateTime)));
|
||||
$sDateTime = \trim($sDateTime);
|
||||
if (empty($sDateTime))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
$sDateTime = \trim(\preg_replace('/ \([a-zA-Z0-9]+\)$/', '', $sDateTime));
|
||||
$oDateTime = \DateTime::createFromFormat('D, d M Y H:i:s O', $sDateTime, \MailSo\Base\DateTimeHelper::GetUtcTimeZoneObject());
|
||||
return $oDateTime ? $oDateTime->getTimestamp() : 0;
|
||||
}
|
||||
|
|
@ -65,7 +71,12 @@ class DateTimeHelper
|
|||
public static function ParseInternalDateString($sDateTime)
|
||||
{
|
||||
$sDateTime = \trim($sDateTime);
|
||||
if (\preg_match('/^[a-z]{2,4}, /i', $sDateTime)) // RFC2822
|
||||
if (empty($sDateTime))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (\preg_match('/^[a-z]{2,4}, /i', $sDateTime)) // RFC2822 ~ "Thu, 10 Jun 2010 08:58:33 -0700 (PDT)"
|
||||
{
|
||||
return \MailSo\Base\DateTimeHelper::ParseRFC2822DateString($sDateTime);
|
||||
}
|
||||
|
|
@ -83,7 +94,13 @@ class DateTimeHelper
|
|||
*/
|
||||
public static function ParseDateStringType1($sDateTime)
|
||||
{
|
||||
$oDateTime = \DateTime::createFromFormat('Y-m-d H:i:s O', \trim($sDateTime), \MailSo\Base\DateTimeHelper::GetUtcTimeZoneObject());
|
||||
$sDateTime = \trim($sDateTime);
|
||||
if (empty($sDateTime))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
$oDateTime = \DateTime::createFromFormat('Y-m-d H:i:s O', $sDateTime, \MailSo\Base\DateTimeHelper::GetUtcTimeZoneObject());
|
||||
return $oDateTime ? $oDateTime->getTimestamp() : 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2368,7 +2368,8 @@ END;
|
|||
{
|
||||
$aMatch = array();
|
||||
return \preg_match('/.+(\.[a-zA-Z]+)$/', $sDomain, $aMatch) && !empty($aMatch[1]) && \in_array($aMatch[1], \explode(' ',
|
||||
'.aero .asia .biz .cat .com .coop .edu .gov .info .int .jobs .mil .mobi .museum .name .net .org .pro .tel .travel .xxx .ac .ad .ae .af .ag .ai .al .am .an .ao .aq .ar .as .at .au .aw .ax .az .ba .bb .bd .be .bf .bg .bh .bi .bj .bm .bn .bo .br .bs .bt .bv .bw .by .bz .ca .cc .cd .cf .cg .ch .ci .ck .cl .cm .cn .co .cr .cs .cu .cv .cx .cy .cz .dd .de .dj .dk .dm .do .dz .ec .ee .eg .er .es .et .eu .fi .fj .fk .fm .fo .fr .ga .gb .gd .ge .gf .gg .gh .gi .gl .gm .gn .gp .gq .gr .gs .gt .gu .gw .gy .hk .hm .hn .hr .ht .hu .id .ie .il .im .in .io .iq .ir .is .it .je .jm .jo .jp .ke .kg .kh .ki .km .kn .kp .kr .kw .ky .kz .la .lb .lc .li .lk .lr .ls .lt .lu .lv .ly .ma .mc .md .me .mg .mh .mk .ml .mm .mn .mo .mp .mq .mr .ms .mt .mu .mv .mw .mx .my .mz .na .nc .ne .nf .ng .ni .nl .no .np .nr .nu .nz .om .pa .pe .pf .pg .ph .pk .pl .pm .pn .pr .ps .pt .pw .py .qa .re .ro .rs .ru . .rw .sa .sb .sc .sd .se .sg .sh .si .sj .sk .sl .sm .sn .so .sr .st .su .sv .sy .sz .tc .td .tf .tg .th .tj .tk .tl .tm .tn .to .tp .tr .tt .tv .tw .tz .ua .ug .uk .us .uy .uz .va .vc .ve .vg .vi .vn .vu .wf .ws .ye .yt .za .zm .zw'
|
||||
'.academy .actor .agency .audio .bar .beer .bike .blue .boutique .cab .camera .camp .capital .cards .careers .cash .catering .center .cheap .city .cleaning .clinic .clothing .club .coffee .community .company .computer .construction .consulting .contractors .cool .credit .dance .dating .democrat .dental .diamonds .digital .direct .directory .discount .domains .education .email .energy .equipment .estate .events .expert .exposed .fail .farm .fish .fitness .florist .fund .futbol .gallery .gift .glass .graphics .guru .help .holdings .holiday .host .hosting .house .institute .international .kitchen .land .life .lighting .limo .link .management .market .marketing .media .menu .moda .partners .parts .photo .photography .photos .pics .pink .press .productions .pub .red .rentals .repair .report .rest .sexy .shoes .social .solar .solutions .space .support .systems .tattoo .tax .technology .tips .today .tools .town .toys .trade .training .university .uno .vacations .vision .vodka .voyage .watch .webcam .wiki .work .works .wtf .zone .aero .asia .biz .cat .com .coop .edu .gov .info .int .jobs .mil .mobi .museum .name .net .org .pro .tel .travel .xxx '.
|
||||
'.ac .ad .ae .af .ag .ai .al .am .an .ao .aq .ar .as .at .au .aw .ax .az .ba .bb .bd .be .bf .bg .bh .bi .bj .bm .bn .bo .br .bs .bt .bv .bw .by .bz .ca .cc .cd .cf .cg .ch .ci .ck .cl .cm .cn .co .cr .cs .cu .cv .cx .cy .cz .dd .de .dj .dk .dm .do .dz .ec .ee .eg .er .es .et .eu .fi .fj .fk .fm .fo .fr .ga .gb .gd .ge .gf .gg .gh .gi .gl .gm .gn .gp .gq .gr .gs .gt .gu .gw .gy .hk .hm .hn .hr .ht .hu .id .ie .il .im .in .io .iq .ir .is .it .je .jm .jo .jp .ke .kg .kh .ki .km .kn .kp .kr .kw .ky .kz .la .lb .lc .li .lk .lr .ls .lt .lu .lv .ly .ma .mc .md .me .mg .mh .mk .ml .mm .mn .mo .mp .mq .mr .ms .mt .mu .mv .mw .mx .my .mz .na .nc .ne .nf .ng .ni .nl .no .np .nr .nu .nz .om .pa .pe .pf .pg .ph .pk .pl .pm .pn .pr .ps .pt .pw .py .qa .re .ro .rs .ru . .rw .sa .sb .sc .sd .se .sg .sh .si .sj .sk .sl .sm .sn .so .sr .st .su .sv .sy .sz .tc .td .tf .tg .th .tj .tk .tl .tm .tn .to .tp .tr .tt .tv .tw .tz .ua .ug .uk .us .uy .uz .va .vc .ve .vg .vi .vn .vu .wf .ws .ye .yt .za .zm .zw'
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1889,7 +1889,7 @@ class ImapClient extends \MailSo\Net\NetClient
|
|||
* @throws \MailSo\Net\Exceptions\Exception
|
||||
*/
|
||||
private function partialParseResponseBranch(&$oImapResponse, $iStackIndex = -1,
|
||||
$bTreatAsAtom = false, $sParentToken = '')
|
||||
$bTreatAsAtom = false, $sParentToken = '', $sOpenBracket = '')
|
||||
{
|
||||
$mNull = null;
|
||||
|
||||
|
|
@ -2020,7 +2020,7 @@ class ImapClient extends \MailSo\Net\NetClient
|
|||
if ($bTreatAsAtom)
|
||||
{
|
||||
$sAtomBlock = $this->partialParseResponseBranch($mNull, $iStackIndex, true,
|
||||
null === $sPreviousAtomUpperCase ? '' : \strtoupper($sPreviousAtomUpperCase));
|
||||
null === $sPreviousAtomUpperCase ? '' : \strtoupper($sPreviousAtomUpperCase), $sOpenBracket);
|
||||
|
||||
$sAtomBuilder .= $sAtomBlock;
|
||||
$iPos = $this->iResponseBufParsedPos;
|
||||
|
|
@ -2035,7 +2035,7 @@ class ImapClient extends \MailSo\Net\NetClient
|
|||
else if ($bIsGotoNotAtomBracket)
|
||||
{
|
||||
$aSubItems = $this->partialParseResponseBranch($mNull, $iStackIndex, false,
|
||||
null === $sPreviousAtomUpperCase ? '' : \strtoupper($sPreviousAtomUpperCase));
|
||||
null === $sPreviousAtomUpperCase ? '' : \strtoupper($sPreviousAtomUpperCase), $sOpenBracket);
|
||||
|
||||
$aList[] = $aSubItems;
|
||||
$iPos = $this->iResponseBufParsedPos;
|
||||
|
|
@ -2065,27 +2065,36 @@ class ImapClient extends \MailSo\Net\NetClient
|
|||
$sChar = $this->sResponseBuffer[$iPos];
|
||||
}
|
||||
|
||||
switch ($sChar)
|
||||
switch (true)
|
||||
{
|
||||
case ']':
|
||||
case ')':
|
||||
case ']' === $sChar:
|
||||
$iPos++;
|
||||
$sPreviousAtomUpperCase = null;
|
||||
$bIsEndOfList = true;
|
||||
break;
|
||||
case ' ':
|
||||
case ')' === $sChar:
|
||||
$iPos++;
|
||||
$sPreviousAtomUpperCase = null;
|
||||
$bIsEndOfList = true;
|
||||
break;
|
||||
case ' ' === $sChar:
|
||||
if ($bTreatAsAtom)
|
||||
{
|
||||
$sAtomBuilder .= ' ';
|
||||
}
|
||||
$iPos++;
|
||||
break;
|
||||
case '[':
|
||||
case '[' === $sChar:
|
||||
$bIsClosingBracketSquare = true;
|
||||
case '(':
|
||||
case '(' === $sChar:
|
||||
if ('(' === $sChar)
|
||||
{
|
||||
$bIsClosingBracketSquare = false;
|
||||
}
|
||||
|
||||
if ($bTreatAsAtom)
|
||||
{
|
||||
$sAtomBuilder .= ($bIsClosingBracketSquare) ? '[' : '(';
|
||||
$sAtomBuilder .= $bIsClosingBracketSquare ? '[' : '(';
|
||||
}
|
||||
$iPos++;
|
||||
|
||||
|
|
@ -2093,13 +2102,15 @@ class ImapClient extends \MailSo\Net\NetClient
|
|||
if ($bTreatAsAtom)
|
||||
{
|
||||
$bIsGotoAtomBracket = true;
|
||||
$sOpenBracket = $bIsClosingBracketSquare ? '[' : '(';
|
||||
}
|
||||
else
|
||||
{
|
||||
$bIsGotoNotAtomBracket = true;
|
||||
$sOpenBracket = $bIsClosingBracketSquare ? '[' : '(';
|
||||
}
|
||||
break;
|
||||
case '{':
|
||||
case '{' === $sChar:
|
||||
$bIsLiteralParsed = false;
|
||||
$mLiteralEndPos = \strpos($this->sResponseBuffer, '}', $iPos);
|
||||
if (false !== $mLiteralEndPos && $mLiteralEndPos > $iPos)
|
||||
|
|
@ -2120,7 +2131,7 @@ class ImapClient extends \MailSo\Net\NetClient
|
|||
}
|
||||
$sPreviousAtomUpperCase = null;
|
||||
break;
|
||||
case '"':
|
||||
case '"' === $sChar:
|
||||
$bIsQuotedParsed = false;
|
||||
while (true)
|
||||
{
|
||||
|
|
@ -2206,7 +2217,7 @@ class ImapClient extends \MailSo\Net\NetClient
|
|||
$sPreviousAtomUpperCase = null;
|
||||
break;
|
||||
|
||||
case 'GOTO_DEFAULT':
|
||||
case 'GOTO_DEFAULT' === $sChar:
|
||||
default:
|
||||
$iCharBlockStartPos = $iPos;
|
||||
|
||||
|
|
@ -2214,7 +2225,7 @@ class ImapClient extends \MailSo\Net\NetClient
|
|||
{
|
||||
$iPos = $iBufferEndIndex;
|
||||
|
||||
while ($iPos > $iCharBlockStartPos && $this->sResponseBuffer[$iCharBlockStartPos] == ' ')
|
||||
while ($iPos > $iCharBlockStartPos && $this->sResponseBuffer[$iCharBlockStartPos] === ' ')
|
||||
{
|
||||
$iCharBlockStartPos++;
|
||||
}
|
||||
|
|
@ -2224,9 +2235,9 @@ class ImapClient extends \MailSo\Net\NetClient
|
|||
while (!$bIsAtomDone && ($iPos <= $iBufferEndIndex))
|
||||
{
|
||||
$sCharDef = $this->sResponseBuffer[$iPos];
|
||||
switch ($sCharDef)
|
||||
switch (true)
|
||||
{
|
||||
case '[':
|
||||
case '[' === $sCharDef:
|
||||
if (null === $sAtomBuilder)
|
||||
{
|
||||
$sAtomBuilder = '';
|
||||
|
|
@ -2238,7 +2249,7 @@ class ImapClient extends \MailSo\Net\NetClient
|
|||
$this->iResponseBufParsedPos = $iPos;
|
||||
|
||||
$sListBlock = $this->partialParseResponseBranch($mNull, $iStackIndex, true,
|
||||
null === $sPreviousAtomUpperCase ? '' : \strtoupper($sPreviousAtomUpperCase));
|
||||
null === $sPreviousAtomUpperCase ? '' : \strtoupper($sPreviousAtomUpperCase), '[');
|
||||
|
||||
if (null !== $sListBlock)
|
||||
{
|
||||
|
|
@ -2248,9 +2259,9 @@ class ImapClient extends \MailSo\Net\NetClient
|
|||
$iPos = $this->iResponseBufParsedPos;
|
||||
$iCharBlockStartPos = $iPos;
|
||||
break;
|
||||
case ' ':
|
||||
case ']':
|
||||
case ')':
|
||||
case ' ' === $sCharDef:
|
||||
case ')' === $sCharDef && '(' === $sOpenBracket:
|
||||
case ']' === $sCharDef && '[' === $sOpenBracket:
|
||||
$bIsAtomDone = true;
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -622,7 +622,7 @@ class Message
|
|||
$this->sInReplyTo = $oHeaders->ValueByName(\MailSo\Mime\Enumerations\Header::IN_REPLY_TO);
|
||||
$this->sReferences = \MailSo\Base\Utils::StripSpaces(
|
||||
$oHeaders->ValueByName(\MailSo\Mime\Enumerations\Header::REFERENCES));
|
||||
|
||||
|
||||
$sHeaderDate = $oHeaders->ValueByName(\MailSo\Mime\Enumerations\Header::DATE);
|
||||
$this->sHeaderDate = $sHeaderDate;
|
||||
$this->iHeaderTimeStampInUTC = \MailSo\Base\DateTimeHelper::ParseRFC2822DateString($sHeaderDate);
|
||||
|
|
|
|||
|
|
@ -9411,14 +9411,23 @@ class Actions
|
|||
{
|
||||
$oAccount = \call_user_func($fGetAccount);
|
||||
|
||||
$iDateTimeStampInUTC = $mResponse->InternalTimeStampInUTC();
|
||||
if (0 === $iDateTimeStampInUTC || !!$this->Config()->Get('labs', 'date_from_headers', false))
|
||||
{
|
||||
$iDateTimeStampInUTC = $mResponse->HeaderTimeStampInUTC();
|
||||
if (0 === $iDateTimeStampInUTC)
|
||||
{
|
||||
$iDateTimeStampInUTC = $mResponse->InternalTimeStampInUTC();
|
||||
}
|
||||
}
|
||||
|
||||
$mResult = \array_merge($this->objectData($mResponse, $sParent, $aParameters), array(
|
||||
'Folder' => $mResponse->Folder(),
|
||||
'Uid' => (string) $mResponse->Uid(),
|
||||
'Subject' => \trim(\MailSo\Base\Utils::Utf8Clear($mResponse->Subject())),
|
||||
'MessageId' => $mResponse->MessageId(),
|
||||
'Size' => $mResponse->Size(),
|
||||
'DateTimeStampInUTC' => !!$this->Config()->Get('labs', 'date_from_headers', false)
|
||||
? $mResponse->HeaderTimeStampInUTC() : $mResponse->InternalTimeStampInUTC(),
|
||||
'DateTimeStampInUTC' => $iDateTimeStampInUTC,
|
||||
'ReplyTo' => $this->responseObject($mResponse->ReplyTo(), $sParent, $aParameters),
|
||||
'From' => $this->responseObject($mResponse->From(), $sParent, $aParameters),
|
||||
'To' => $this->responseObject($mResponse->To(), $sParent, $aParameters),
|
||||
|
|
|
|||
|
|
@ -98,6 +98,14 @@ class Property
|
|||
return PropertyType::WEB_PAGE === $this->Type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function IsValueForLower()
|
||||
{
|
||||
return $this->IsEmail() || $this->IsName() || $this->IsWeb();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
|
|
@ -142,7 +150,7 @@ class Property
|
|||
}
|
||||
|
||||
// lower value for searching
|
||||
if (\MailSo\Base\Utils::FunctionExistsAndEnabled('mb_strtolower'))
|
||||
if ($this->IsValueForLower() && \MailSo\Base\Utils::FunctionExistsAndEnabled('mb_strtolower'))
|
||||
{
|
||||
$this->ValueLower = (string) @\mb_strtolower($this->Value, 'UTF-8');
|
||||
}
|
||||
|
|
@ -153,6 +161,7 @@ class Property
|
|||
$sPhone = \trim($this->Value);
|
||||
$sPhone = \preg_replace('/^[+]+/', '', $sPhone);
|
||||
$sPhone = \preg_replace('/[^\d]/', '', $sPhone);
|
||||
|
||||
$this->ValueCustom = \trim($sPhone);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1895,6 +1895,11 @@ SQLITEINITIAL;
|
|||
1 => $this->getInitialTablesArray($this->sDsnType),
|
||||
2 => array(
|
||||
'ALTER TABLE rainloop_ab_properties ADD prop_value_lower varchar(255) NOT NULL DEFAULT \'\' AFTER prop_value_custom;'
|
||||
),
|
||||
3 => array(
|
||||
'ALTER TABLE rainloop_ab_properties CHANGE prop_value prop_value TEXT NOT NULL;',
|
||||
'ALTER TABLE rainloop_ab_properties CHANGE prop_value_custom prop_value_custom TEXT NOT NULL;',
|
||||
'ALTER TABLE rainloop_ab_properties CHANGE prop_value_lower prop_value_lower TEXT NOT NULL;'
|
||||
)
|
||||
));
|
||||
break;
|
||||
|
|
@ -1903,7 +1908,8 @@ SQLITEINITIAL;
|
|||
1 => $this->getInitialTablesArray($this->sDsnType),
|
||||
2 => array(
|
||||
'ALTER TABLE rainloop_ab_properties ADD prop_value_lower text NOT NULL DEFAULT \'\';'
|
||||
)
|
||||
),
|
||||
3 => array()
|
||||
));
|
||||
break;
|
||||
case 'sqlite':
|
||||
|
|
@ -1911,7 +1917,8 @@ SQLITEINITIAL;
|
|||
1 => $this->getInitialTablesArray($this->sDsnType),
|
||||
2 => array(
|
||||
'ALTER TABLE rainloop_ab_properties ADD prop_value_lower text NOT NULL DEFAULT \'\';'
|
||||
)
|
||||
),
|
||||
3 => array()
|
||||
));
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue