diff --git a/sources/backend/caldav/caldav.php b/sources/backend/caldav/caldav.php index a937381..9a3c19c 100644 --- a/sources/backend/caldav/caldav.php +++ b/sources/backend/caldav/caldav.php @@ -394,6 +394,19 @@ class BackendCalDAV extends BackendDiff { return $events; } + /** + * Resolves recipients + * + * @param SyncObject $resolveRecipients + * + * @access public + * @return SyncObject $resolveRecipients + */ + public function ResolveRecipients($resolveRecipients) { + // TODO: + return false; + } + /** * Indicates which AS version is supported by the backend. * diff --git a/sources/backend/carddav/carddav.php b/sources/backend/carddav/carddav.php index 653502d..53144e7 100644 --- a/sources/backend/carddav/carddav.php +++ b/sources/backend/carddav/carddav.php @@ -702,6 +702,20 @@ class BackendCardDAV extends BackendDiff implements ISearchProvider { } + /** + * Resolves recipients + * + * @param SyncObject $resolveRecipients + * + * @access public + * @return SyncObject $resolveRecipients + */ + public function ResolveRecipients($resolveRecipients) { + // TODO: + return false; + } + + /** * Indicates which AS version is supported by the backend. * diff --git a/sources/backend/combined/combined.php b/sources/backend/combined/combined.php index c88e915..28d110e 100644 --- a/sources/backend/combined/combined.php +++ b/sources/backend/combined/combined.php @@ -393,6 +393,19 @@ class BackendCombined extends Backend implements ISearchProvider { return $backend->MeetingResponse($requestid, $this->GetBackendFolder($folderid), $response); } + /** + * Resolves recipients + * + * @param SyncObject $resolveRecipients + * + * @access public + * @return SyncObject $resolveRecipients + */ + public function ResolveRecipients($resolveRecipients) { + // TODO: + return false; + } + /** * Deletes all contents of the specified folder. diff --git a/sources/backend/imap/imap.php b/sources/backend/imap/imap.php index 5f2a08e..42e04f0 100644 --- a/sources/backend/imap/imap.php +++ b/sources/backend/imap/imap.php @@ -1730,6 +1730,20 @@ class BackendIMAP extends BackendDiff implements ISearchProvider { } + /** + * Resolves recipients + * + * @param SyncObject $resolveRecipients + * + * @access public + * @return SyncObject $resolveRecipients + */ + public function ResolveRecipients($resolveRecipients) { + // TODO: + return false; + } + + /** * Returns the email address and the display name of the user. Used by autodiscover. * @@ -1841,7 +1855,7 @@ class BackendIMAP extends BackendDiff implements ISearchProvider { $search = true; if (empty($searchFolderId)) { - $searchFolderId = $this->getFolderIdFromImapId('INBOX'); + $searchFolderId = $this->getFolderIdFromImapId($this->create_name_folder(IMAP_FOLDER_INBOX), false); } // Convert searchFolderId to IMAP id @@ -2049,20 +2063,36 @@ class BackendIMAP extends BackendDiff implements ISearchProvider { * @access protected * @return string hex folder id */ - protected function getFolderIdFromImapId($imapid) { + protected function getFolderIdFromImapId($imapid, $case_sensitive = true) { $this->InitializePermanentStorage(); - if (isset($this->permanentStorage->fmFimapFid)) { - if (isset($this->permanentStorage->fmFimapFid[$imapid])) { - $folderid = $this->permanentStorage->fmFimapFid[$imapid]; - ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->getFolderIdFromImapId('%s') = %s", $imapid, $folderid)); - return $folderid; - } - else { - ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->getFolderIdFromImapId('%s') = %s", $imapid, 'not found')); - return false; + if ($case_sensitive) { + if (isset($this->permanentStorage->fmFimapFid)) { + if (isset($this->permanentStorage->fmFimapFid[$imapid])) { + $folderid = $this->permanentStorage->fmFimapFid[$imapid]; + ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->getFolderIdFromImapId('%s') = %s", $imapid, $folderid)); + return $folderid; + } + else { + ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->getFolderIdFromImapId('%s') = %s", $imapid, 'not found')); + return false; + } } } + else { + if (isset($this->permanentStorage->fmFimapFidLowercase)) { + if (isset($this->permanentStorage->fmFimapFidLowercase[strtolower($imapid)])) { + $folderid = $this->permanentStorage->fmFimapFidLowercase[strtolower($imapid)]; + ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->getFolderIdFromImapId('%s', false) = %s", $imapid, $folderid)); + return $folderid; + } + else { + ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->getFolderIdFromImapId('%s', false) = %s", $imapid, 'not found')); + return false; + } + } + } + ZLog::Write(LOGLEVEL_WARN, sprintf("BackendIMAP->getFolderIdFromImapId('%s') = %s", $imapid, 'not initialized!')); return false; } @@ -2103,6 +2133,13 @@ class BackendIMAP extends BackendDiff implements ISearchProvider { $b = $this->permanentStorage->fmFimapFid; $b[$imapid] = $folderid; $this->permanentStorage->fmFimapFid = $b; + + if (!isset($this->permanentStorage->fmFimapFidLowercase)) + $this->permanentStorage->fmFimapFidLowercase = array(); + + $c = $this->permanentStorage->fmFimapFidLowercase; + $c[strtolower($imapid)] = $folderid; + $this->permanentStorage->fmFimapFidLowercase = $c; } ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->convertImapId('%s') = %s", $imapid, $folderid)); @@ -2328,7 +2365,7 @@ class BackendIMAP extends BackendDiff implements ISearchProvider { */ protected function checkIfIMAPFolder($folderName) { $folder_name = $folderName; - if (defined(IMAP_FOLDER_PREFIX) && strlen(IMAP_FOLDER_PREFIX) > 0) { + if (defined('IMAP_FOLDER_PREFIX') && strlen(IMAP_FOLDER_PREFIX) > 0) { // TODO: We don't care about the inbox exception with the prefix, because we won't check inbox $folder_name = IMAP_FOLDER_PREFIX . $this->getServerDelimiter() . $folder_name; } @@ -2470,7 +2507,7 @@ class BackendIMAP extends BackendDiff implements ISearchProvider { } if ($this->sentID === false) { - $this->sentID = $this->getFolderIdFromImapId($this->create_name_folder(IMAP_FOLDER_SENT)); + $this->sentID = $this->getFolderIdFromImapId($this->create_name_folder(IMAP_FOLDER_SENT), false); } $saved = false; diff --git a/sources/backend/ldap/ldap.php b/sources/backend/ldap/ldap.php index 2ad52c2..af1584b 100644 --- a/sources/backend/ldap/ldap.php +++ b/sources/backend/ldap/ldap.php @@ -9,8 +9,8 @@ * Created : 07.04.2012 * * Copyright 2012 - 2014 Jean-Louis Dupond -* * Jean-Louis Dupond released this code as AGPLv3 here: https://github.com/dupondje/PHP-Push-2/issues/93 +* Copyright 2015 - Francisco Miguel Biete * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License, version 3, @@ -565,6 +565,19 @@ class BackendLDAP extends BackendDiff { return false; } + /** + * Resolves recipients + * + * @param SyncObject $resolveRecipients + * + * @access public + * @return SyncObject $resolveRecipients + */ + public function ResolveRecipients($resolveRecipients) { + // TODO: + return false; + } + /** * Indicates which AS version is supported by the backend. * diff --git a/sources/index.php b/sources/index.php index 0df69eb..1568a87 100644 --- a/sources/index.php +++ b/sources/index.php @@ -89,7 +89,7 @@ if (defined('LOG_MEMORY_PROFILER') && LOG_MEMORY_PROFILER) { // Stop here if this is an OPTIONS request if (Request::IsMethodOPTIONS()) { if (!$autenticationInfo || !$GETUser) { - throw new AuthenticationRequiredException("Access denied. Please send authorisation information"); + throw new AuthenticationRequiredException("Access denied. Please send authentication information"); } else { throw new NoPostRequestException("Options request", NoPostRequestException::OPTIONS_REQUEST);