forked from extern/egroupware
fix for functional folders showing up multiple times
This commit is contained in:
parent
fb037c49a9
commit
c173de3935
@ -3548,9 +3548,10 @@ class Mail
|
|||||||
* isSentFolder is the given folder the sent folder or at least a subfolder of it
|
* isSentFolder is the given folder the sent folder or at least a subfolder of it
|
||||||
* @param string $_folderName folder to perform the check on
|
* @param string $_folderName folder to perform the check on
|
||||||
* @param boolean $_checkexistance trigger check for existance
|
* @param boolean $_checkexistance trigger check for existance
|
||||||
|
* @param boolean $_exactMatch make the check more strict. return false if folder is subfolder only
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function isSentFolder($_folderName, $_checkexistance=TRUE)
|
function isSentFolder($_folderName, $_checkexistance=TRUE, $_exactMatch=false)
|
||||||
{
|
{
|
||||||
$sentFolder = $this->getSentFolder($_checkexistance);
|
$sentFolder = $this->getSentFolder($_checkexistance);
|
||||||
if(empty($sentFolder)) {
|
if(empty($sentFolder)) {
|
||||||
@ -3561,10 +3562,19 @@ class Mail
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(false !== stripos($_folderName, $sentFolder)) {
|
if ($_exactMatch)
|
||||||
return true;
|
{
|
||||||
|
if(false !== stripos($_folderName, $sentFolder)&& strlen($_folderName)==strlen($sentFolder)) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return false;
|
if(false !== stripos($_folderName, $sentFolder)) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3572,9 +3582,10 @@ class Mail
|
|||||||
* checks if the Outbox folder exists and is part of the foldername to be checked
|
* checks if the Outbox folder exists and is part of the foldername to be checked
|
||||||
* @param string $_folderName folder to perform the check on
|
* @param string $_folderName folder to perform the check on
|
||||||
* @param boolean $_checkexistance trigger check for existance
|
* @param boolean $_checkexistance trigger check for existance
|
||||||
|
* @param boolean $_exactMatch make the check more strict. return false if folder is subfolder only
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function isOutbox($_folderName, $_checkexistance=TRUE)
|
function isOutbox($_folderName, $_checkexistance=TRUE, $_exactMatch=false)
|
||||||
{
|
{
|
||||||
if (stripos($_folderName, 'Outbox')===false) {
|
if (stripos($_folderName, 'Outbox')===false) {
|
||||||
return false;
|
return false;
|
||||||
@ -3582,10 +3593,19 @@ class Mail
|
|||||||
// does the folder exist???
|
// does the folder exist???
|
||||||
if ($_checkexistance && $GLOBALS['egw_info']['user']['apps']['activesync'] && !$this->folderExists($_folderName)) {
|
if ($_checkexistance && $GLOBALS['egw_info']['user']['apps']['activesync'] && !$this->folderExists($_folderName)) {
|
||||||
$outboxFolder = $this->getOutboxFolder($_checkexistance);
|
$outboxFolder = $this->getOutboxFolder($_checkexistance);
|
||||||
if(false !== stripos($_folderName, $outboxFolder)) {
|
if ($_exactMatch)
|
||||||
return true;
|
{
|
||||||
|
if(false !== stripos($_folderName, $outboxFolder)&& strlen($_folderName)==strlen($outboxFolder)) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return false;
|
if(false !== stripos($_folderName, $outboxFolder)) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -3595,9 +3615,10 @@ class Mail
|
|||||||
* isDraftFolder is the given folder the sent folder or at least a subfolder of it
|
* isDraftFolder is the given folder the sent folder or at least a subfolder of it
|
||||||
* @param string $_folderName folder to perform the check on
|
* @param string $_folderName folder to perform the check on
|
||||||
* @param boolean $_checkexistance trigger check for existance
|
* @param boolean $_checkexistance trigger check for existance
|
||||||
|
* @param boolean $_exactMatch make the check more strict. return false if folder is subfolder only
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function isDraftFolder($_folderName, $_checkexistance=TRUE)
|
function isDraftFolder($_folderName, $_checkexistance=TRUE, $_exactMatch=false)
|
||||||
{
|
{
|
||||||
$draftFolder = $this->getDraftFolder($_checkexistance);
|
$draftFolder = $this->getDraftFolder($_checkexistance);
|
||||||
if(empty($draftFolder)) {
|
if(empty($draftFolder)) {
|
||||||
@ -3608,10 +3629,19 @@ class Mail
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (is_a($_folderName,"Horde_Imap_Client_Mailbox")) $_folderName = $_folderName->utf8;
|
if (is_a($_folderName,"Horde_Imap_Client_Mailbox")) $_folderName = $_folderName->utf8;
|
||||||
if(false !== stripos($_folderName, $draftFolder)) {
|
if ($_exactMatch)
|
||||||
return true;
|
{
|
||||||
|
if(false !== stripos($_folderName, $draftFolder)&& strlen($_folderName)==strlen($draftFolder)) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return false;
|
if(false !== stripos($_folderName, $draftFolder)) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3619,9 +3649,10 @@ class Mail
|
|||||||
* isTrashFolder is the given folder the sent folder or at least a subfolder of it
|
* isTrashFolder is the given folder the sent folder or at least a subfolder of it
|
||||||
* @param string $_folderName folder to perform the check on
|
* @param string $_folderName folder to perform the check on
|
||||||
* @param boolean $_checkexistance trigger check for existance
|
* @param boolean $_checkexistance trigger check for existance
|
||||||
|
* @param boolean $_exactMatch make the check more strict. return false if folder is subfolder only
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function isTrashFolder($_folderName, $_checkexistance=TRUE)
|
function isTrashFolder($_folderName, $_checkexistance=TRUE, $_exactMatch=false)
|
||||||
{
|
{
|
||||||
$trashFolder = $this->getTrashFolder($_checkexistance);
|
$trashFolder = $this->getTrashFolder($_checkexistance);
|
||||||
if(empty($trashFolder)) {
|
if(empty($trashFolder)) {
|
||||||
@ -3632,10 +3663,19 @@ class Mail
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(false !== stripos($_folderName, $trashFolder)) {
|
if ($_exactMatch)
|
||||||
return true;
|
{
|
||||||
|
if(false !== stripos($_folderName, $trashFolder)&& strlen($_folderName)==strlen($trashFolder)) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return false;
|
if(false !== stripos($_folderName, $trashFolder)) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3643,9 +3683,10 @@ class Mail
|
|||||||
* isTemplateFolder is the given folder the sent folder or at least a subfolder of it
|
* isTemplateFolder is the given folder the sent folder or at least a subfolder of it
|
||||||
* @param string $_folderName folder to perform the check on
|
* @param string $_folderName folder to perform the check on
|
||||||
* @param boolean $_checkexistance trigger check for existance
|
* @param boolean $_checkexistance trigger check for existance
|
||||||
|
* @param boolean $_exactMatch make the check more strict. return false if folder is subfolder only
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function isTemplateFolder($_folderName, $_checkexistance=TRUE)
|
function isTemplateFolder($_folderName, $_checkexistance=TRUE, $_exactMatch=false)
|
||||||
{
|
{
|
||||||
$templateFolder = $this->getTemplateFolder($_checkexistance);
|
$templateFolder = $this->getTemplateFolder($_checkexistance);
|
||||||
if(empty($templateFolder)) {
|
if(empty($templateFolder)) {
|
||||||
@ -3655,11 +3696,19 @@ class Mail
|
|||||||
if ($_checkexistance && !$this->folderExists($_folderName)) {
|
if ($_checkexistance && !$this->folderExists($_folderName)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if ($_exactMatch)
|
||||||
if(false !== stripos($_folderName, $templateFolder)) {
|
{
|
||||||
return true;
|
if(false !== stripos($_folderName, $templateFolder)&& strlen($_folderName)==strlen($templateFolder)) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return false;
|
if(false !== stripos($_folderName, $templateFolder)) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1643,27 +1643,27 @@ class mail_zpush implements activesync_plugin_write, activesync_plugin_sendmail,
|
|||||||
{
|
{
|
||||||
$folderObj->type = SYNC_FOLDER_TYPE_INBOX;
|
$folderObj->type = SYNC_FOLDER_TYPE_INBOX;
|
||||||
}
|
}
|
||||||
elseif($this->mail->isDraftFolder($folder, false))
|
elseif($this->mail->isDraftFolder($folder, false, true))
|
||||||
{
|
{
|
||||||
//ZLog::Write(LOGLEVEL_DEBUG,__METHOD__.' isDraft');
|
//ZLog::Write(LOGLEVEL_DEBUG,__METHOD__.' isDraft');
|
||||||
$folderObj->type = SYNC_FOLDER_TYPE_DRAFTS;
|
$folderObj->type = SYNC_FOLDER_TYPE_DRAFTS;
|
||||||
$folderObj->parentid = 0; // required by devices
|
$folderObj->parentid = 0; // required by devices
|
||||||
}
|
}
|
||||||
elseif($this->mail->isTrashFolder($folder, false))
|
elseif($this->mail->isTrashFolder($folder, false, true))
|
||||||
{
|
{
|
||||||
$folderObj->type = SYNC_FOLDER_TYPE_WASTEBASKET;
|
$folderObj->type = SYNC_FOLDER_TYPE_WASTEBASKET;
|
||||||
$this->_wasteID = $folder;
|
$this->_wasteID = $folder;
|
||||||
//error_log(__METHOD__.__LINE__.' TrashFolder:'.$this->_wasteID);
|
//error_log(__METHOD__.__LINE__.' TrashFolder:'.$this->_wasteID);
|
||||||
$folderObj->parentid = 0; // required by devices
|
$folderObj->parentid = 0; // required by devices
|
||||||
}
|
}
|
||||||
elseif($this->mail->isSentFolder($folder, false))
|
elseif($this->mail->isSentFolder($folder, false, true))
|
||||||
{
|
{
|
||||||
$folderObj->type = SYNC_FOLDER_TYPE_SENTMAIL;
|
$folderObj->type = SYNC_FOLDER_TYPE_SENTMAIL;
|
||||||
$folderObj->parentid = 0; // required by devices
|
$folderObj->parentid = 0; // required by devices
|
||||||
$this->_sentID = $folder;
|
$this->_sentID = $folder;
|
||||||
//error_log(__METHOD__.__LINE__.' SentFolder:'.$this->_sentID);
|
//error_log(__METHOD__.__LINE__.' SentFolder:'.$this->_sentID);
|
||||||
}
|
}
|
||||||
elseif($this->mail->isOutbox($folder, false))
|
elseif($this->mail->isOutbox($folder, false, true))
|
||||||
{
|
{
|
||||||
//ZLog::Write(LOGLEVEL_DEBUG,__METHOD__.' isOutbox');
|
//ZLog::Write(LOGLEVEL_DEBUG,__METHOD__.' isOutbox');
|
||||||
$folderObj->type = SYNC_FOLDER_TYPE_OUTBOX;
|
$folderObj->type = SYNC_FOLDER_TYPE_OUTBOX;
|
||||||
|
Loading…
Reference in New Issue
Block a user