1<?
php declare(strict_types=1);
5use Psr\Http\Message\ServerRequestInterface;
59 $this->tpl =
$DIC->ui()->mainTemplate();
60 $this->ctrl =
$DIC->ctrl();
61 $this->lng =
$DIC->language();
62 $this->toolbar =
$DIC->toolbar();
63 $this->
user = $DIC->user();
64 $this->tabs =
$DIC->tabs();
65 $this->httpRequest =
$DIC->http()->request();
67 $this->umail =
new ilMail($this->
user->getId());
78 $folderId = (int) ($this->httpRequest->getParsedBody()[
'mobj_id'] ?? 0);
79 if (0 === $folderId) {
80 $folderId = (int) ($this->httpRequest->getQueryParams()[
'mobj_id'] ?? 0);
83 if (0 === $folderId || !$this->mbox->isOwnedFolder($folderId)) {
84 $folderId = $this->mbox->getInboxFolder();
87 $this->currentFolderId = (int) $folderId;
97 if (preg_match(
'/^([a-zA-Z0-9]+?)_(\d+?)$/', $originalCommand, $matches) && 3 === count($matches)) {
98 $originalCommand = $matches[1];
101 return $originalCommand;
113 preg_match(
'/^([a-zA-Z0-9]+?)_(\d+?)$/', $command, $matches) &&
114 3 === count($matches) && is_numeric($matches[2])
116 return (
int) $matches[2];
119 throw new InvalidArgumentException(
"Cannot parse a numeric folder id from command string!");
128 $this->ctrl->getCmd()
131 $nextClass = $this->ctrl->getNextClass($this);
132 switch ($nextClass) {
137 case 'ilmailoptionsgui':
138 $this->tpl->setTitle($this->lng->txt(
'mail'));
142 case 'ilpublicuserprofilegui':
143 $this->tpl->setTitle($this->lng->txt(
'mail'));
146 $this->ctrl->setParameter($this,
'mobj_id', $this->currentFolderId);
147 $profileGui->setBackUrl($this->ctrl->getLinkTarget($this,
'showMail'));
148 $this->ctrl->clearParameters($this);
150 $ret = $this->ctrl->forwardCommand($profileGui);
152 $this->tpl->setContent(
$ret);
154 $this->tpl->printToStdout();
158 if (!method_exists($this, $cmd)) {
171 $this->umail->deleteMailsOfFolder($this->currentFolderId);
173 ilUtil::sendSuccess($this->lng->txt(
'mail_deleted'),
true);
174 $this->ctrl->setParameter($this,
'mobj_id', $this->currentFolderId);
175 $this->ctrl->redirect($this,
'showFolder');
183 if ($this->umail->countMailsOfFolder($this->currentFolderId)) {
184 $this->confirmTrashDeletion =
true;
195 $this->tpl->setVariable(
'TBL_TITLE', implode(
' ', [
196 $this->lng->txt(
'profile_of'),
200 $this->tpl->setVariable(
'TBL_TITLE_IMG_ALT', $this->lng->txt(
'public_profile'));
204 $this->ctrl->setParameter($this,
'mail_id', (
int) $this->httpRequest->getQueryParams()[
'mail_id']);
205 $this->ctrl->setParameter($this,
'mobj_id', $this->currentFolderId);
206 $profile_gui->setBackUrl($this->ctrl->getLinkTarget($this,
'showMail'));
207 $this->ctrl->clearParameters($this);
209 $this->tpl->setTitle($this->lng->txt(
'mail'));
210 $this->tpl->setContent($this->ctrl->getHTML($profile_gui));
211 $this->tpl->printToStdout();
219 $this->ctrl->setParameter($this,
'mobj_id', $this->currentFolderId);
220 $this->toolbar->addButton(
221 $this->lng->txt(
'mail_add_subfolder'),
222 $this->ctrl->getLinkTarget($this,
'addSubFolder')
225 if ($isUserSubFolder) {
226 $this->toolbar->addButton($this->lng->txt(
'rename'), $this->ctrl->getLinkTarget($this,
'renameSubFolder'));
227 $this->toolbar->addButton($this->lng->txt(
'delete'), $this->ctrl->getLinkTarget($this,
'deleteSubFolder'));
229 $this->ctrl->clearParameters($this);
236 protected function showFolder(
bool $oneConfirmationDialogueRendered =
false) : void
238 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.mail.html',
'Services/Mail');
239 $this->tpl->setTitle($this->lng->txt(
'mail'));
241 $isTrashFolder = $this->currentFolderId == $this->mbox->getTrashFolder();
243 if ($isTrashFolder &&
'deleteMails' === $this->
parseCommand($this->ctrl->getCmd()) && !$this->errorDelete) {
245 $confirmationGui->setHeaderText($this->lng->txt(
'mail_sure_delete'));
247 $confirmationGui->addHiddenItem(
'mail_id[]', $mailId);
249 $this->ctrl->setParameter($this,
'mobj_id', $this->currentFolderId);
250 $confirmationGui->setFormAction($this->ctrl->getFormAction($this,
'showFolder'));
251 $this->ctrl->clearParameters($this);
252 $confirmationGui->setConfirm($this->lng->txt(
'confirm'),
'confirmDeleteMails');
253 $confirmationGui->setCancel($this->lng->txt(
'cancel'),
'showFolder');
254 $this->tpl->setVariable(
'CONFIRMATION', $confirmationGui->getHTML());
255 $oneConfirmationDialogueRendered =
true;
258 $folders = $this->mbox->getSubFolders();
260 $mtree->setTableNames(
'mail_tree',
'mail_obj_data');
262 $isUserSubFolder =
false;
263 $isUserRootFolder =
false;
265 $folder_d = $mtree->getNodeData($this->currentFolderId);
266 if ($folder_d[
'm_type'] ===
'user_folder') {
267 $isUserSubFolder =
true;
268 } elseif ($folder_d[
'm_type'] ===
'local') {
269 $isUserRootFolder =
true;
276 $mailtable->prepareHTML();
277 }
catch (Exception
$e) {
279 $this->lng->txt(
$e->getMessage()) !=
'-' .
$e->getMessage() .
'-' ?
280 $this->lng->txt(
$e->getMessage()) :
285 $table_html = $mailtable->getHtml();
287 $folder_options = [];
288 foreach ($folders as $folder) {
289 $folder_d = $mtree->getNodeData($folder[
'obj_id']);
291 if ($folder[
'obj_id'] == $this->currentFolderId) {
292 if ($folder[
'type'] ===
'user_folder') {
293 $isUserSubFolder =
true;
294 } elseif ($folder[
'type'] ===
'local') {
295 $isUserRootFolder =
true;
296 $isUserSubFolder =
false;
300 $folder_options[$folder[
'obj_id']] = sprintf(
301 $this->lng->txt(
'mail_change_to_folder'),
302 $this->lng->txt(
'mail_' . $folder[
'title'])
304 if ($folder[
'type'] ===
'user_folder') {
306 for (
$i = 2;
$i < $folder_d[
'depth'] - 1;
$i++) {
310 if ($folder_d[
'depth'] > 1) {
314 $folder_options[$folder[
'obj_id']] = sprintf(
315 $this->lng->txt(
'mail_change_to_folder'),
316 $pre .
' ' . $folder[
'title']
321 if ($oneConfirmationDialogueRendered ===
false && $this->confirmTrashDeletion ===
false) {
322 $this->toolbar->setFormAction($this->ctrl->getFormAction($this,
'showFolder'));
324 if ($isUserRootFolder ==
true || $isUserSubFolder ==
true) {
329 if ($mailtable->isTrashFolder() && $mailtable->getNumberOfMails() > 0 && $this->confirmTrashDeletion ===
true) {
331 $confirmationGui->setHeaderText($this->lng->txt(
'mail_empty_trash_confirmation'));
332 $this->ctrl->setParameter($this,
'mobj_id', $this->currentFolderId);
333 $confirmationGui->setFormAction($this->ctrl->getFormAction($this,
'performEmptyTrash'));
334 $this->ctrl->clearParameters($this);
335 $confirmationGui->setConfirm($this->lng->txt(
'confirm'),
'performEmptyTrash');
336 $confirmationGui->setCancel($this->lng->txt(
'cancel'),
'showFolder');
337 $this->tpl->setVariable(
'CONFIRMATION', $confirmationGui->getHTML());
340 $this->tpl->setVariable(
'MAIL_TABLE', $table_html);
341 $this->tpl->printToStdout();
349 if ($a_show_confirm) {
351 $this->ctrl->setParameter($this,
'mobj_id', $this->currentFolderId);
352 $confirmationGui->setFormAction($this->ctrl->getFormAction($this,
'showFolder'));
353 $this->ctrl->clearParameters($this);
354 $confirmationGui->setHeaderText($this->lng->txt(
'mail_sure_delete_folder'));
355 $confirmationGui->setCancel($this->lng->txt(
'cancel'),
'showFolder');
356 $confirmationGui->setConfirm($this->lng->txt(
'confirm'),
'performDeleteSubFolder');
357 $this->tpl->setVariable(
'CONFIRMATION', $confirmationGui->getHTML());
370 $parentFolderId = $this->mbox->getParentFolderId($this->currentFolderId);
371 if ($parentFolderId > 0 && $this->mbox->deleteFolder($this->currentFolderId)) {
373 $this->ctrl->setParameterByClass(
'ilMailGUI',
'mobj_id', (
int) $parentFolderId);
374 $this->ctrl->redirectByClass(
'ilMailGUI');
388 $this->ctrl->setParameter($this,
'mobj_id', $this->currentFolderId);
389 $form->setFormAction($this->ctrl->getFormAction($this,
'performAddSubFolder'));
390 $this->ctrl->clearParameters($this);
391 if (
'edit' === $mode) {
392 $form->addCommandButton(
'performRenameSubFolder', $this->lng->txt(
'save'));
393 $form->setTitle($this->lng->txt(
'mail_rename_folder'));
395 $form->addCommandButton(
'performAddSubFolder', $this->lng->txt(
'save'));
396 $form->setTitle($this->lng->txt(
'mail_add_folder'));
398 $form->addCommandButton(
'showFolder', $this->lng->txt(
'cancel'));
400 $title =
new ilTextInputGUI($this->lng->txt(
'title'),
'subfolder_title');
401 $title->setRequired(
true);
402 $form->addItem($title);
413 $isFormValid = $form->checkInput();
414 $form->setValuesByPost();
420 $newFolderId = $this->mbox->addFolder($this->currentFolderId, $form->getInput(
'subfolder_title'));
421 if ($newFolderId > 0) {
422 ilUtil::sendSuccess($this->lng->txt(
'mail_folder_created'),
true);
423 $this->ctrl->setParameterByClass(
'ilMailGUI',
'mobj_id', $newFolderId);
424 $this->ctrl->redirectByClass(
'ilMailGUI');
437 if (
null === $form) {
441 $this->tpl->setTitle($this->lng->txt(
'mail'));
442 $this->tpl->setContent($form->getHTML());
443 $this->tpl->printToStdout();
452 $isFormValid = $form->checkInput();
453 $form->setValuesByPost();
459 $folderData = $this->mbox->getFolderData($this->currentFolderId);
460 if ($folderData[
'title'] === $form->getInput(
'subfolder_title')) {
465 if ($this->mbox->renameFolder($this->currentFolderId, $form->getInput(
'subfolder_title'))) {
466 ilUtil::sendSuccess($this->lng->txt(
'mail_folder_name_changed'),
true);
467 $this->ctrl->setParameterByClass(
'ilMailGUI',
'mobj_id', $this->currentFolderId);
468 $this->ctrl->redirectByClass(
'ilMailGUI');
481 if (
null === $form) {
483 $form->setValuesByArray([
'subfolder_title' => $this->mbox->getFolderData($this->currentFolderId)[
'title']]);
486 $this->tpl->setTitle($this->lng->txt(
'mail'));
487 $this->tpl->setContent($form->getHTML());
488 $this->tpl->printToStdout();
497 $mailIds = $this->httpRequest->getParsedBody()[
'mail_id'] ?? [];
498 if (!is_array($mailIds)) {
502 if (0 === count($mailIds) && !$ignoreHttpGet) {
503 $mailId = $this->httpRequest->getQueryParams()[
'mail_id'] ?? 0;
504 if (is_numeric($mailId)) {
505 $mailIds = [$mailId];
509 return array_filter(array_map(
'intval', $mailIds));
518 if (count($mailIds) > 0) {
519 $this->umail->markRead($mailIds);
520 ilUtil::sendSuccess($this->lng->txt(
'saved_successfully'));
534 if (count($mailIds) > 0) {
535 $this->umail->markUnread($mailIds);
536 ilUtil::sendSuccess($this->lng->txt(
'saved_successfully'));
550 if (1 !== count($mailIds)) {
556 $newFolderId = (int) ($this->httpRequest->getParsedBody()[
'folder_id'] ?? 0);
557 $redirectFolderId = $newFolderId;
558 foreach ($mailIds as $mailId) {
559 $mailData = $this->umail->getMail($mailId);
560 if (isset($mailData[
'folder_id']) && is_numeric($mailData[
'folder_id']) && (int) $mailData[
'folder_id'] > 0) {
561 $redirectFolderId = $mailData[
'folder_id'];
566 if ($this->umail->moveMailsToFolder($mailIds, $newFolderId)) {
567 ilUtil::sendSuccess($this->lng->txt(
'mail_moved'),
true);
568 $this->ctrl->setParameter($this,
'mobj_id', $redirectFolderId);
569 $this->ctrl->redirect($this,
'showFolder');
582 if (0 === count($mailIds)) {
589 if ($this->umail->moveMailsToFolder($mailIds, $folderId)) {
590 ilUtil::sendSuccess($this->lng->txt(
'mail_moved'),
true);
591 $this->ctrl->setParameter($this,
'mobj_id', $this->currentFolderId);
592 $this->ctrl->redirect($this,
'showFolder');
604 $trashFolderId = (int) $this->mbox->getTrashFolder();
607 if ($trashFolderId == $this->currentFolderId) {
608 if (0 === count($mailIds)) {
610 $this->errorDelete =
true;
613 if (0 === count($mailIds)) {
615 } elseif ($this->umail->moveMailsToFolder($mailIds, $trashFolderId)) {
616 ilUtil::sendSuccess($this->lng->txt(
'mail_moved_to_trash'),
true);
617 $this->ctrl->setParameter($this,
'mobj_id', $this->currentFolderId);
618 $this->ctrl->redirect($this,
'showFolder');
633 if (0 === count($mailIds)) {
639 if ((
int) $this->mbox->getTrashFolder() === (
int) $this->currentFolderId) {
640 $this->umail->deleteMails($mailIds);
641 ilUtil::sendSuccess($this->lng->txt(
'mail_deleted'),
true);
642 $this->ctrl->setParameter($this,
'mobj_id', $this->currentFolderId);
643 $this->ctrl->redirect($this,
'showFolder');
652 protected function showMail() : void
658 $mailId = (int) ($this->httpRequest->getQueryParams()[
'mail_id'] ?? 0);
661 $mailData = $this->umail->getMail($mailId);
662 $this->umail->markRead([$mailId]);
664 $this->tpl->setTitle($this->lng->txt(
'mail_mails_of'));
666 $this->tabs->clearTargets();
667 $this->ctrl->setParameter($this,
'mobj_id', $mailData[
'folder_id']);
668 $this->tabs->setBackTarget($this->lng->txt(
'back_to_folder'), $this->ctrl->getFormAction($this,
'showFolder'));
669 $this->ctrl->clearParameters($this);
671 $this->ctrl->setParameter($this,
'mail_id', $mailId);
672 $this->ctrl->setParameter($this,
'mobj_id', $mailData[
'folder_id']);
673 $this->toolbar->setFormAction($this->ctrl->getFormAction($this,
'showMail'));
674 $this->ctrl->clearParameters($this);
677 $form->setPreventDoubleSubmission(
false);
678 $form->setTableWidth(
'100%');
679 $this->ctrl->setParameter($this,
'mobj_id', $mailData[
'folder_id']);
680 $this->ctrl->setParameter($this,
'mail_id', $mailId);
681 $form->setFormAction($this->ctrl->getFormAction($this,
'showMail'));
682 $this->ctrl->clearParameters($this);
683 $form->setTitle($this->lng->txt(
'mail_mails_of'));
690 if ($sender && $sender->getId() && !$sender->isAnonymous()) {
692 $replyBtn->setCaption(
'reply');
693 $this->ctrl->setParameterByClass(
'ilmailformgui',
'mobj_id', $mailData[
'folder_id']);
694 $this->ctrl->setParameterByClass(
'ilmailformgui',
'mail_id', $mailId);
695 $this->ctrl->setParameterByClass(
'ilmailformgui',
'type',
'reply');
696 $replyBtn->setUrl($this->ctrl->getLinkTargetByClass(
'ilmailformgui'));
697 $this->ctrl->clearParametersByClass(
'ilmailformgui');
699 $replyBtn->setPrimary(
true);
700 $this->toolbar->addStickyItem($replyBtn);
704 $fwdBtn->setCaption(
'forward');
705 $this->ctrl->setParameterByClass(
'ilmailformgui',
'mobj_id', $mailData[
'folder_id']);
706 $this->ctrl->setParameterByClass(
'ilmailformgui',
'mail_id', $mailId);
707 $this->ctrl->setParameterByClass(
'ilmailformgui',
'type',
'forward');
708 $fwdBtn->setUrl($this->ctrl->getLinkTargetByClass(
'ilmailformgui'));
709 $this->ctrl->clearParametersByClass(
'ilmailformgui');
712 $fwdBtn->setPrimary(
true);
713 $this->toolbar->addStickyItem($fwdBtn);
715 $this->toolbar->addButtonInstance($fwdBtn);
719 $printBtn->setCaption(
'print');
720 $this->ctrl->setParameter($this,
'mail_id', $mailId);
721 $this->ctrl->setParameter($this,
'mobj_id', $mailData[
'folder_id']);
722 $printBtn->setUrl($this->ctrl->getLinkTarget($this,
'printMail'));
723 $this->ctrl->clearParameters($this);
724 $printBtn->setTarget(
'_blank');
725 $this->toolbar->addButtonInstance($printBtn);
728 $deleteBtn->setCaption(
'delete');
729 $deleteBtn->setCommand(
'deleteMails');
731 $this->toolbar->addButtonInstance($deleteBtn);
733 if ($sender && $sender->getId() && !$sender->isAnonymous()) {
734 $linked_fullname = $sender->getPublicName();
736 $sender->getPersonalPicturePath(
'xsmall'),
737 $sender->getPublicName(),
746 $this->ctrl->setParameter($this,
'mail_id', $mailId);
747 $this->ctrl->setParameter($this,
'mobj_id', $mailData[
'folder_id']);
748 $this->ctrl->setParameter($this,
'user', $sender->getId());
749 $linked_fullname =
'<br /><a href="' . $this->ctrl->getLinkTarget(
752 ) .
'" title="' . $linked_fullname .
'">' . $linked_fullname .
'</a>';
753 $this->ctrl->clearParameters($this);
757 $from->setHtml($picture .
' ' . $linked_fullname);
758 $form->addItem($from);
759 } elseif (!$sender || !$sender->getId()) {
761 $from->setHtml($mailData[
'import_name'] .
' (' . $this->lng->txt(
'user_deleted') .
')');
762 $form->addItem($from);
768 ilMail::_getIliasMailerName(),
775 '<br />' . ilMail::_getIliasMailerName()
777 $form->addItem($from);
784 if ($mailData[
'rcp_cc']) {
790 if ($mailData[
'rcp_bcc']) {
793 $this->umail->formatNamesForOutput((
string) $mailData[
'rcp_bcc']),
796 $form->addItem($bcc);
801 $form->addItem($subject);
805 $form->addItem($date);
811 if ($mailData[
'attachments']) {
815 foreach ($mailData[
'attachments'] as $file) {
819 $att->setHtml($radiog->render());
820 $form->addCommandButton(
'deliverFile', $this->lng->txt(
'download'));
821 $form->addItem($att);
824 $isTrashFolder =
false;
825 if ($this->mbox->getTrashFolder() == $mailData[
'folder_id']) {
826 $isTrashFolder =
true;
829 $currentFolderData = $this->mbox->getFolderData($mailData[
'folder_id']);
830 $actions = $this->mbox->getActions((
int) $mailData[
'folder_id']);
833 foreach ($actions as $key => $action) {
834 if ($key ===
'moveMails') {
835 $folders = $this->mbox->getSubFolders();
836 foreach ($folders as $folder) {
838 ($folder[
'type'] !==
'trash' || !$isTrashFolder) &&
839 $folder[
'obj_id'] != $mailData[
'folder_id']
841 $optionText = $action .
' ' . $folder[
'title'];
842 if ($folder[
'type'] !==
'user_folder') {
843 $optionText = $action .
' ' . $this->lng->txt(
'mail_' . $folder[
'title']) . ($folder[
'type'] ==
'trash' ?
' (' . $this->lng->txt(
'delete') .
')' :
'');
846 $selectOptions[$folder[
'obj_id']] = $optionText;
852 $folderLabel = $this->lng->txt(
'mail_' . $currentFolderData[
'title']);
853 if ($currentFolderData[
'type'] ===
'user_folder') {
854 $folderLabel = $currentFolderData[
'title'];
857 $this->toolbar->addSeparator();
858 $this->toolbar->addText(sprintf($this->lng->txt(
'current_folder'), $folderLabel));
860 if (is_array($selectOptions) && count($selectOptions) > 0) {
862 $actions->setOptions($selectOptions);
863 $this->toolbar->addInputItem($actions);
866 $moveBtn->setCaption(
'execute');
867 $moveBtn->setCommand(
'moveSingleMail');
868 $this->toolbar->addButtonInstance($moveBtn);
871 $prevMail = $this->umail->getPreviousMail($mailId);
872 $nextMail = $this->umail->getNextMail($mailId);
873 if (is_array($prevMail) || is_array($nextMail)) {
874 $this->toolbar->addSeparator();
876 if ($prevMail[
'mail_id']) {
878 $prevBtn->setCaption(
'previous');
879 $this->ctrl->setParameter($this,
'mail_id', $prevMail[
'mail_id']);
880 $this->ctrl->setParameter($this,
'mobj_id', $this->currentFolderId);
881 $prevBtn->setUrl($this->ctrl->getLinkTarget($this,
'showMail'));
882 $this->ctrl->clearParameters($this);
883 $this->toolbar->addButtonInstance($prevBtn);
886 if ($nextMail[
'mail_id']) {
888 $nextBtn->setCaption(
'next');
889 $this->ctrl->setParameter($this,
'mail_id', $nextMail[
'mail_id']);
890 $this->ctrl->setParameter($this,
'mobj_id', $this->currentFolderId);
891 $nextBtn->setUrl($this->ctrl->getLinkTarget($this,
'showMail'));
892 $this->ctrl->clearParameters($this);
893 $this->toolbar->addButtonInstance($nextBtn);
897 $this->tpl->setContent($form->getHTML());
898 $this->tpl->printToStdout();
904 protected function printMail() : void
906 $tplprint =
new ilTemplate(
'tpl.mail_print.html',
true,
true,
'Services/Mail');
908 $mailData = $this->umail->getMail((
int) ($this->httpRequest->getQueryParams()[
'mail_id'] ?? 0));
915 $tplprint->setVariable(
'TXT_FROM', $this->lng->txt(
'from'));
916 if ($sender && $sender->getId() && !$sender->isAnonymous()) {
917 $tplprint->setVariable(
'FROM', $sender->getPublicName());
918 } elseif (!$sender || !$sender->getId()) {
919 $tplprint->setVariable(
'FROM', $mailData[
'import_name'] .
' (' . $this->lng->txt(
'user_deleted') .
')');
921 $tplprint->setVariable(
'FROM', ilMail::_getIliasMailerName());
924 $tplprint->setVariable(
'TXT_TO', $this->lng->txt(
'mail_to'));
925 $tplprint->setVariable(
'TO', $mailData[
'rcp_to']);
927 if ($mailData[
'rcp_cc']) {
928 $tplprint->setCurrentBlock(
'cc');
929 $tplprint->setVariable(
'TXT_CC', $this->lng->txt(
'mail_cc'));
930 $tplprint->setVariable(
'CC', $mailData[
'rcp_cc']);
931 $tplprint->parseCurrentBlock();
934 if ($mailData[
'rcp_bcc']) {
935 $tplprint->setCurrentBlock(
'bcc');
936 $tplprint->setVariable(
'TXT_BCC', $this->lng->txt(
'mail_bcc'));
937 $tplprint->setVariable(
'BCC', $mailData[
'rcp_bcc']);
938 $tplprint->parseCurrentBlock();
941 $tplprint->setVariable(
'TXT_SUBJECT', $this->lng->txt(
'subject'));
942 $tplprint->setVariable(
'SUBJECT', htmlspecialchars($mailData[
'm_subject']));
944 $tplprint->setVariable(
'TXT_DATE', $this->lng->txt(
'date'));
945 $tplprint->setVariable(
950 $tplprint->setVariable(
'TXT_MESSAGE', $this->lng->txt(
'message'));
951 $tplprint->setVariable(
'MAIL_MESSAGE', nl2br(htmlspecialchars($mailData[
'm_message'])));
958 $mailId = $this->httpRequest->getQueryParams()[
'mail_id'] ?? 0;
964 $filename = $this->httpRequest->getParsedBody()[
'filename'] ??
'';
972 while (strpos(
$filename,
'..') !==
false) {
978 $file = $mailFileData->getAttachmentPathAndFilenameByMd5Hash(
$filename, (
int) $mailId);
980 }
catch (OutOfBoundsException
$e) {
981 throw new ilException(
'mail_error_reading_attachment');
987 }
catch (Exception
$e) {
989 $this->ctrl->setParameter($this,
'mobj_id', $this->currentFolderId);
990 $this->ctrl->redirect($this);
997 $mailId = $this->httpRequest->getQueryParams()[
'mail_id'] ?? 0;
999 $mailData = $this->umail->getMail((
int) $mailId);
1000 if (
null === $mailData || 0 === count((array) $mailData[
'attachments'])) {
1001 throw new ilException(
'mail_error_reading_attachment');
1004 $type = $this->httpRequest->getQueryParams()[
'type'] ??
'';
1007 if (count($mailData[
'attachments']) === 1) {
1008 $attachment = current($mailData[
'attachments']);
1011 if (
'draft' ===
$type) {
1012 if (!$mailFileData->checkFilesExist([$attachment])) {
1013 throw new OutOfBoundsException(
'');
1015 $pathToFile = $mailFileData->getAbsoluteAttachmentPoolPathByFilename($attachment);
1016 $fileName = $attachment;
1018 $file = $mailFileData->getAttachmentPathAndFilenameByMd5Hash(
1022 $pathToFile = $file[
'path'];
1023 $fileName = $file[
'filename'];
1026 }
catch (OutOfBoundsException
$e) {
1027 throw new ilException(
'mail_error_reading_attachment');
1030 $mailFileData->deliverAttachmentsAsZip(
1031 $mailData[
'm_subject'],
1033 $mailData[
'attachments'],
1037 }
catch (Exception
$e) {
1039 $this->ctrl->setParameter($this,
'mobj_id', $this->currentFolderId);
1040 $this->ctrl->redirect($this);
1051 $this->currentFolderId,
1053 $this->currentFolderId == $this->mbox->getTrashFolder(),
1054 $this->currentFolderId == $this->mbox->getSentFolder(),
1055 $this->currentFolderId == $this->mbox->getDraftsFolder()
1057 $table->initFilter();
1068 $table->resetOffset();
1069 $table->writeFilterToSession();
1080 $table->resetOffset();
1081 $table->resetFilter();
An exception for terminatinating execution or to throw for unit testing.
Confirmation screen class.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
@classDescription Date and time handling
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addSubFolderCommands(bool $isUserSubFolder=false)
markMailsUnread()
Called if multiple messages should be marked as un-read in the list view.
addSubFolder(ilPropertyFormGUI $form=null)
Called if the acting user wants to create a folder.
confirmDeleteMails()
Called if the final deletion of selected messages was confirmed by the acting user.
showFolder(bool $oneConfirmationDialogueRendered=false)
Shows current folder.
__construct()
ilMailFolderGUI constructor.
confirmEmptyTrash()
Called if the deletion of messages in trash should be confirmed by the acting user.
parseFolderIdFromCommand(string $command)
markMailsRead()
Called if multiple messages should be marked as read in the list view.
getMailIdsFromRequest(bool $ignoreHttpGet=false)
renameSubFolder(ilPropertyFormGUI $form=null)
Called if the acting user wants to rename a folder.
getSubFolderForm(string $mode='create')
deleteSubFolder($a_show_confirm=true)
performAddSubFolder()
Called if a folder is created by the action user.
moveMails()
Called if a single message or multiple messages should be be moved in the list view.
performEmptyTrash()
Called if the deletion of all messages in trash was confirmed by the acting user.
performRenameSubFolder()
Called if the folder title is renamed by the acting user.
deleteMails()
Called if a single message or multiple messages should be deleted.
moveSingleMail()
Called if a single message should be be moved in the detail view.
parseCommand(string $originalCommand)
Mail Box class Base class for creating and handling mail boxes.
static _lookupPref($a_usr_id, $a_keyword)
static _lookupLogin($a_user_id)
lookup login
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
GUI class for public user profile presentation.
This class represents an option in a radio group.
static set($a_var, $a_val)
Set a value.
static get($a_var)
Get a value.
special template class to simplify handling of ITX/PEAR
This class represents a text property in a property form.
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static img($a_src, $a_alt=null, $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
static htmlencodePlainString($a_str, $a_make_links_clickable, $a_detect_goto_links=false)
Encodes a plain text string into HTML for display in a browser.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)