Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Maarch
MaarchCapture
Commits
5afc1f02
Commit
5afc1f02
authored
Sep 06, 2022
by
Quentin Ribac
Browse files
FEAT #16458 TIME 1:30 EWSMailCapture: use absolute folder paths
parent
91507720
Changes
2
Hide whitespace changes
Inline
Side-by-side
modules/EWSMailCapture/EWS/ExchangeItem.php
View file @
5afc1f02
...
...
@@ -170,7 +170,7 @@ class ExchangeItem {
if
(
!
$attRes
->
IsInline
)
{
$this
->
attachments
[]
=
[
'id'
=>
$attRes
->
AttachmentId
->
Id
,
'filename'
=>
$attRes
->
Name
.
' [cid:'
.
$attRes
->
ContentId
.
'; uri: '
.
$attRes
->
ContentLocation
.
']'
,
'filename'
=>
$attRes
->
Name
,
'content'
=>
$attRes
->
Content
];
}
else
{
...
...
modules/EWSMailCapture/EWS/ExchangeMailbox.php
View file @
5afc1f02
...
...
@@ -49,12 +49,46 @@ class ExchangeMailbox {
$response
=
$this
->
client
->
FindFolder
(
$request
);
$folders
=
$response
->
ResponseMessages
->
FindFolderResponseMessage
[
0
]
->
RootFolder
->
Folders
->
Folder
;
$foldersPaths
=
[];
foreach
(
$folders
as
$folder
)
{
$this
->
folders
[
$folder
->
DisplayName
]
=
$folder
->
FolderId
;
$displayName
=
!
empty
(
$folder
->
FolderClass
)
?
$folder
->
DisplayName
:
''
;
$displayName
=
str_replace
(
'/'
,
'\/'
,
$displayName
);
foreach
(
$foldersPaths
as
$folderPath
)
{
if
(
$folder
->
ParentFolderId
->
Id
==
$folderPath
[
'id'
]
->
Id
)
{
$foldersPaths
[]
=
[
'id'
=>
$folder
->
FolderId
,
'parentId'
=>
$folder
->
ParentFolderId
,
'path'
=>
$folderPath
[
'path'
]
.
'/'
.
$displayName
];
continue
2
;
}
elseif
(
$folder
->
FolderId
->
Id
==
$folderPath
[
'parentId'
]
->
Id
)
{
$folderPath
[
'path'
]
=
$displayName
.
'/'
.
$folderPath
[
'path'
];
continue
2
;
}
}
$foldersPaths
[]
=
[
'id'
=>
$folder
->
FolderId
,
'parentId'
=>
$folder
->
ParentFolderId
,
'path'
=>
$displayName
];
}
$foldersPaths
=
array_map
(
function
(
$folderPath
)
{
$folderPath
[
'path'
]
=
trim
(
$folderPath
[
'path'
],
'/'
);
return
$folderPath
;
},
$foldersPaths
);
$foldersPaths
=
array_filter
(
$foldersPaths
,
function
(
$folderPath
)
{
return
!
empty
(
$folderPath
[
'path'
]);
});
foreach
(
$foldersPaths
as
$folderPath
)
{
$this
->
folders
[
$folderPath
[
'path'
]]
=
$folderPath
[
'id'
];
}
}
private
function
getFolderIdByName
(
$folderName
)
{
$folderName
=
trim
(
$folderName
,
'/'
);
return
array_key_exists
(
$folderName
,
$this
->
folders
)
?
$this
->
folders
[
$folderName
]
:
null
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment