ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
class.ilMailFormGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2012 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once 'Services/User/classes/class.ilObjUser.php';
5require_once 'Services/Mail/classes/class.ilMailbox.php';
6require_once 'Services/Mail/classes/class.ilFormatMail.php';
7require_once './Services/Mail/classes/class.ilFileDataMail.php';
8require_once 'Services/Mail/classes/class.ilMailFormCall.php';
9
18{
19 private $tpl = null;
20 private $ctrl = null;
21 private $lng = null;
22
23 private $umail = null;
24 private $mbox = null;
25 private $mfile = null;
26
27 public function __construct()
28 {
29 global $tpl, $ilCtrl, $lng, $ilUser;
30
31 $this->tpl = $tpl;
32 $this->ctrl = $ilCtrl;
33 $this->lng = $lng;
34
35 $this->umail = new ilFormatMail($ilUser->getId());
36 $this->mfile = new ilFileDataMail($ilUser->getId());
37 $this->mbox = new ilMailBox($ilUser->getId());
38
39 if(isset($_POST['mobj_id']) && (int)$_POST['mobj_id'])
40 {
41 $_GET['mobj_id'] = $_POST['mobj_id'];
42 }
43 // IF THERE IS NO OBJ_ID GIVEN GET THE ID OF MAIL ROOT NODE
44 if(!(int)$_GET['mobj_id'])
45 {
46 $_GET['mobj_id'] = $this->mbox->getInboxFolder();
47 }
48 $_GET['mobj_id'] = (int)$_GET['mobj_id'];
49 $this->ctrl->saveParameter($this, 'mobj_id');
50 }
51
52 public function executeCommand()
53 {
54 $forward_class = $this->ctrl->getNextClass($this);
55 switch($forward_class)
56 {
57 case 'ilmailfoldergui':
58 include_once 'Services/Mail/classes/class.ilMailFolderGUI.php';
59
60 $this->ctrl->forwardCommand(new ilMailFolderGUI());
61 break;
62
63 case 'ilmailattachmentgui':
64 include_once 'Services/Mail/classes/class.ilMailAttachmentGUI.php';
65
66 $this->ctrl->setReturn($this, "returnFromAttachments");
67 $this->ctrl->forwardCommand(new ilMailAttachmentGUI());
68 break;
69
70 case 'ilmailsearchgui':
71 include_once 'Services/Contact/classes/class.ilMailSearchGUI.php';
72
73 $this->ctrl->setReturn($this, "searchResults");
74 $this->ctrl->forwardCommand(new ilMailSearchGUI());
75 break;
76
77 case 'ilmailsearchcoursesgui':
78 include_once 'Services/Contact/classes/class.ilMailSearchCoursesGUI.php';
79
80 $this->ctrl->setReturn($this, "searchResults");
81 $this->ctrl->forwardCommand(new ilMailSearchCoursesGUI());
82 break;
83
84 case 'ilmailinglistsgui':
85 include_once 'Services/Contact/classes/class.ilMailingListsGUI.php';
86
87 $this->ctrl->setReturn($this, 'searchResults');
88 $this->ctrl->forwardCommand(new ilMailingListsGUI());
89 break;
90
91 case 'ilmailsearchgroupsgui':
92 include_once 'Services/Contact/classes/class.ilMailSearchGroupsGUI.php';
93
94 $this->ctrl->setReturn($this, "searchResults");
95 $this->ctrl->forwardCommand(new ilMailSearchGroupsGUI());
96 break;
97
98 default:
99 if (!($cmd = $this->ctrl->getCmd()))
100 {
101 $cmd = "showForm";
102 }
103
104 $this->$cmd();
105 break;
106 }
107 return true;
108 }
109
114 protected function decodeAttachmentFiles(array $files)
115 {
116 $decodedFiles = array();
117
118 foreach($files as $value)
119 {
120 if(is_file($this->mfile->getMailPath() . '/' . $GLOBALS['ilUser']->getId() . '_' . urldecode($value)))
121 {
122 $decodedFiles[] = urldecode($value);
123 }
124 }
125
126 return $decodedFiles;
127 }
128
129 public function sendMessage()
130 {
131 global $ilUser;
132
133 $files = $this->decodeAttachmentFiles(isset($_POST['attachments']) ? (array)$_POST['attachments'] : array());
134
135 // Remove \r
136 $f_message = str_replace("\r", '', ilUtil::securePlainString($_POST['m_message']));
137
138 // Note: For security reasons, ILIAS only allows Plain text strings in E-Mails.
139 $f_message = $this->umail->formatLinebreakMessage($f_message);
140
141 $this->umail->setSaveInSentbox(true);
142
143 $m_type = isset($_POST["m_type"]) ? $_POST["m_type"] : array("normal");
144
145 // Note: For security reasons, ILIAS only allows Plain text strings in E-Mails.
146 if($errorMessage = $this->umail->sendMail(
150 ilUtil::securePlainString($_POST['m_subject']), $f_message,
151 $files,
152// $_POST['m_type'],
153 $m_type,
154 ilUtil::securePlainString($_POST['use_placeholders'])
155 )
156 )
157 {
158 $_POST['attachments'] = $files;
159 ilUtil::sendInfo($errorMessage);
160 }
161 else
162 {
163 $this->umail->savePostData($ilUser->getId(), array(), "", "", "", "", "", "", "", "");
164
165 $this->ctrl->setParameterByClass('ilmailgui', 'type', 'message_sent');
166
168 {
169 ilUtil::sendInfo($this->lng->txt('mail_message_send'), true);
171 }
172 else
173 $this->ctrl->redirectByClass('ilmailgui');
174 }
175
176 $this->showForm();
177 }
178
179 public function saveDraft()
180 {
181 if(!$_POST['m_subject'])
182 {
183 $_POST['m_subject'] = 'No title';
184 }
185
186 $draftsId = $this->mbox->getDraftsFolder();
187
188 $files = $this->decodeAttachmentFiles(isset($_POST['attachments']) ? (array)$_POST['attachments'] : array());
189
190 if($errorMessage = $this->umail->validateRecipients(
194 ))
195 {
196 $_POST['attachments'] = $files;
197 ilUtil::sendInfo($errorMessage);
198 $this->showForm();
199 return;
200 }
201
202 if(isset($_SESSION["draft"]))
203 {
204 // Note: For security reasons, ILIAS only allows Plain text strings in E-Mails.
205 $this->umail->updateDraft($draftsId, $files,
209 $_POST["m_type"],
211 ilUtil::securePlainString($_POST["m_subject"]),
212 ilUtil::securePlainString($_POST["m_message"]),
213 (int)$_SESSION["draft"],
214 (int)ilUtil::securePlainString($_POST['use_placeholders'])
215 );
216 #session_unregister("draft");
217 #ilUtil::sendInfo($this->lng->txt("mail_saved"),true);
218 #ilUtil::redirect("ilias.php?baseClass=ilMailGUI&mobj_id=".$mbox->getInboxFolder());
219
220 unset($_SESSION["draft"]);
221 ilUtil::sendInfo($this->lng->txt("mail_saved"), true);
222
225 else
226 $this->ctrl->redirectByClass("ilmailfoldergui");
227 }
228 else
229 {
230 if ($this->umail->sendInternalMail($draftsId,$_SESSION["AccountId"],$files,
231 // Note: For security reasons, ILIAS only allows Plain text strings in E-Mails.
235 'read',
236 $_POST["m_type"],
238 ilUtil::securePlainString($_POST["m_subject"]),
239 ilUtil::securePlainString($_POST["m_message"]),
240 $_SESSION["AccountId"],
241 ilUtil::securePlainString($_POST['use_placeholders'])
242 )
243 )
244 {
245 ilUtil::sendInfo($this->lng->txt("mail_saved"),true);
246 #$this->ctrl->setParameterByClass("ilmailfoldergui", "mobj_id", $this->mbox->getDraftsFolder());
247
250 else
251 $this->ctrl->redirectByClass("ilmailfoldergui");
252 }
253 else
254 {
255 ilUtil::sendInfo($this->lng->txt("mail_send_error"));
256 }
257 }
258
259 $this->showForm();
260 }
261
262 public function searchUsers($save = true)
263 {
264 global $ilUser, $ilCtrl;
265
266 $this->tpl->setTitle($this->lng->txt("mail"));
267
268 if ($save)
269 {
270 // decode post values
271 $files = array();
272 if(is_array($_POST['attachments']))
273 {
274 foreach($_POST['attachments'] as $value)
275 {
276 $files[] = urldecode($value);
277 }
278 }
279
280 // Note: For security reasons, ILIAS only allows Plain text strings in E-Mails.
281 $this->umail->savePostData($ilUser->getId(),
282 $files,
286 $_POST["m_type"],
288 ilUtil::securePlainString($_POST["m_subject"]),
289 ilUtil::securePlainString($_POST["m_message"]),
290 ilUtil::securePlainString($_POST['use_placeholders'])
291 );
292 }
293 include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
294 $form = new ilPropertyFormGUI();
295 $form->setId('search_rcp');
296 $form->setTitle($this->lng->txt('search_recipients'));
297 $form->setFormAction($ilCtrl->getFormAction($this, 'search'));
298
299 $inp = new ilTextInputGUI($this->lng->txt("search_for"), 'search');
300 $inp->setSize(30);
301 $dsDataLink = $ilCtrl->getLinkTarget($this, 'lookupRecipientAsync', '', true, false);
302 $inp->setDataSource($dsDataLink);
303
304 if (strlen(trim($_SESSION["mail_search_search"])) > 0)
305 {
306 $inp->setValue(ilUtil::prepareFormOutput(trim($_SESSION["mail_search_search"]), true));
307 }
308 $form->addItem($inp);
309
310 $form->addCommandButton('search', $this->lng->txt("search"));
311 $form->addCommandButton('cancelSearch', $this->lng->txt("cancel"));
312
313 $this->tpl->setContent($form->getHtml());
314 $this->tpl->show();
315 }
316
320 public function searchCoursesTo()
321 {
322 $this->saveMailBeforeSearch();
323
324 if($_SESSION['search_crs'])
325 {
326 $this->ctrl->setParameterByClass('ilmailsearchcoursesgui', 'cmd', 'showMembers');
327 }
328
329 $this->ctrl->setParameterByClass('ilmailsearchcoursesgui', 'ref', 'mail');
330 $this->ctrl->redirectByClass('ilmailsearchcoursesgui');
331 }
332
336 public function searchGroupsTo()
337 {
338 $this->saveMailBeforeSearch();
339
340 $this->ctrl->setParameterByClass('ilmailsearchgroupsgui', 'ref', 'mail');
341 $this->ctrl->redirectByClass('ilmailsearchgroupsgui');
342 }
343
344 public function search()
345 {
346 $_SESSION["mail_search_search"] = $_POST["search"];
347 if(strlen(trim($_SESSION["mail_search_search"])) == 0)
348 {
349 ilUtil::sendInfo($this->lng->txt("mail_insert_query"));
350 $this->searchUsers(false);
351 }
352 else
353 {
354 if(strlen(trim($_SESSION["mail_search_search"])) < 3)
355 {
356 $this->lng->loadLanguageModule('search');
357 ilUtil::sendInfo($this->lng->txt('search_minimum_three'));
358 $this->searchUsers(false);
359 }
360 else
361 {
362 $this->ctrl->setParameterByClass("ilmailsearchgui", "search", urlencode($_SESSION["mail_search_search"]));
363 $this->ctrl->redirectByClass("ilmailsearchgui");
364 }
365 }
366 }
367
368 public function cancelSearch()
369 {
370 unset($_SESSION["mail_search"]);
371 $this->searchResults();
372 }
373
374 public function editAttachments()
375 {
376 // decode post values
377 $files = array();
378 if(is_array($_POST['attachments']))
379 {
380 foreach($_POST['attachments'] as $value)
381 {
382 $files[] = urldecode($value);
383 }
384 }
385
386 // Note: For security reasons, ILIAS only allows Plain text messages.
387 $this->umail->savePostData($_SESSION["AccountId"],
388 $files,
392 $_POST["m_type"],
394 ilUtil::securePlainString($_POST["m_subject"]),
395 ilUtil::securePlainString($_POST["m_message"]),
396 ilUtil::securePlainString($_POST['use_placeholders'])
397 );
398
399 $this->ctrl->redirectByClass("ilmailattachmentgui");
400 }
401
402 public function returnFromAttachments()
403 {
404 $_GET["type"] = "attach";
405 $this->showForm();
406 }
407
408 public function searchResults()
409 {
410 $_GET["type"] = "search_res";
411 $this->showForm();
412 }
413
414 public function mailUser()
415 {
416 $_GET["type"] = "new";
417 $this->showForm();
418 }
419
420 public function mailRole()
421 {
422 $_GET["type"] = "role";
423 $this->showForm();
424 }
425
426 public function replyMail()
427 {
428 $_GET["type"] = "reply";
429 $this->showForm();
430 }
431
432 public function mailAttachment()
433 {
434 $_GET["type"] = "attach";
435 $this->showForm();
436 }
437
438 public function showForm()
439 {
440 global $rbacsystem, $ilUser, $ilCtrl, $lng, $ilTabs;
441
442 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.mail_new.html", "Services/Mail");
443 $this->tpl->setTitle($this->lng->txt("mail"));
444
445 $this->lng->loadLanguageModule("crs");
446
448 $ilTabs->setBackTarget($lng->txt('back'), $ilCtrl->getLinkTarget($this, 'cancelMail'));
449
450 switch($_GET["type"])
451 {
452 case 'reply':
453 if($_SESSION['mail_id'])
454 {
455 $_GET['mail_id'] = $_SESSION['mail_id'];
456 }
457 $mailData = $this->umail->getMail($_GET["mail_id"]);
458 $mailData["m_subject"] = $this->umail->formatReplySubject();
459 $mailData["m_message"] = $this->umail->formatReplyMessage();
460 $mailData["m_message"] = $this->umail->prependSignature();
461 // NO ATTACHMENTS FOR REPLIES
462 $mailData["attachments"] = array();
463 //$mailData["rcp_cc"] = $this->umail->formatReplyRecipientsForCC();
464 $mailData["rcp_cc"] = '';
465 $mailData["rcp_to"] = $this->umail->formatReplyRecipient();
466 $_SESSION["mail_id"] = "";
467 break;
468
469 case 'search_res':
470 $mailData = $this->umail->getSavedData();
471
472 /*if($_SESSION["mail_search_results"])
473 {
474 $mailData = $this->umail->appendSearchResult($_SESSION["mail_search_results"],$_SESSION["mail_search"]);
475 }
476 unset($_SESSION["mail_search"]);
477 unset($_SESSION["mail_search_results"]);*/
478
479 if($_SESSION["mail_search_results_to"])
480 {
481 $mailData = $this->umail->appendSearchResult($_SESSION["mail_search_results_to"], 'to');
482 }
483 if($_SESSION["mail_search_results_cc"])
484 {
485 $mailData = $this->umail->appendSearchResult($_SESSION["mail_search_results_cc"], 'cc');
486 }
487 if($_SESSION["mail_search_results_bcc"])
488 {
489 $mailData = $this->umail->appendSearchResult($_SESSION["mail_search_results_bcc"], 'bc');
490 }
491
492 unset($_SESSION["mail_search_results_to"]);
493 unset($_SESSION["mail_search_results_cc"]);
494 unset($_SESSION["mail_search_results_bcc"]);
495
496 break;
497
498 case 'attach':
499 $mailData = $this->umail->getSavedData();
500 break;
501
502 case 'draft':
503 $_SESSION["draft"] = $_GET["mail_id"];
504 $mailData = $this->umail->getMail($_GET["mail_id"]);
505 break;
506
507 case 'forward':
508 $mailData = $this->umail->getMail($_GET["mail_id"]);
509 $mailData["rcp_to"] = $mailData["rcp_cc"] = $mailData["rcp_bcc"] = '';
510 $mailData["m_subject"] = $this->umail->formatForwardSubject();
511 $mailData["m_message"] = $this->umail->prependSignature();
512 if(count($mailData["attachments"]))
513 {
514 if($error = $this->mfile->adoptAttachments($mailData["attachments"],$_GET["mail_id"]))
515 {
516 ilUtil::sendInfo($error);
517 }
518 }
519 break;
520
521 case 'new':
522 if($_GET['rcp_to'])
523 {
524 // Note: For security reasons, ILIAS only allows Plain text strings in E-Mails.
525 $mailData["rcp_to"] = ilUtil::securePlainString($_GET['rcp_to']);
526 }
527 else if($_SESSION['rcp_to'])
528 {
529 $mailData["rcp_to"] = $_SESSION['rcp_to'];
530 }
531 if($_GET['rcp_cc'])
532 {
533 // Note: For security reasons, ILIAS only allows Plain text strings in E-Mails.
534 $mailData["rcp_cc"] = ilUtil::securePlainString($_GET['rcp_cc']);
535 }
536 else if($_SESSION['rcp_cc'])
537 {
538 $mailData["rcp_cc"] = $_SESSION['rcp_cc'];
539 }
540 if($_GET['rcp_bcc'])
541 {
542 // Note: For security reasons, ILIAS only allows Plain text strings in E-Mails.
543 $mailData["rcp_bcc"] = ilUtil::securePlainString($_GET['rcp_bcc']);
544 }
545 else if($_SESSION['rcp_bcc'])
546 {
547 $mailData["rcp_bcc"] = $_SESSION['rcp_bcc'];
548 }
549 $mailData['m_message'] = '';
550 if(strlen($sig = ilMailFormCall::getSignature()))
551 {
552 $mailData['m_message'] = $sig;
553 $mailData['m_message'] .= chr(13).chr(10).chr(13).chr(10);
554 }
555 $mailData['m_message'] .= $this->umail->appendSignature();
556
557 $_SESSION['rcp_to'] = '';
558 $_SESSION['rcp_cc'] = '';
559 $_SESSION['rcp_bcc'] = '';
560 break;
561
562 case 'role':
563
564 if(is_array($_POST['roles']))
565 {
566 // Note: For security reasons, ILIAS only allows Plain text strings in E-Mails.
567 $mailData['rcp_to'] = ilUtil::securePlainString(implode(',',$_POST['roles']));
568 }
569 elseif(is_array($_SESSION['mail_roles']))
570 {
571 $mailData['rcp_to'] = ilUtil::securePlainString(implode(',', $_SESSION['mail_roles']));
572 }
573
574 $mailData['m_message'] = '';
575 if(strlen($sig = ilMailFormCall::getSignature()))
576 {
577 $mailData['m_message'] = $sig;
578 $mailData['m_message'] .= chr(13).chr(10).chr(13).chr(10);
579 }
580
581 $mailData['m_message'] .= $_POST["additional_message_text"].chr(13).chr(10).$this->umail->appendSignature();
582 $_POST["additional_message_text"] = "";
583 $_SESSION['mail_roles'] = "";
584 break;
585
586 case 'address':
587 $mailData["rcp_to"] = urldecode($_GET["rcp"]);
588 break;
589
590 default:
591 // GET DATA FROM POST
592 $mailData = $_POST;
593
594 // strip slashes
595 foreach ($mailData as $key => $value)
596 {
597 if (is_string($value))
598 {
599 // Note: For security reasons, ILIAS only allows Plain text strings in E-Mails.
600 $mailData[$key] = ilUtil::securePlainString($value);
601 }
602 }
603 break;
604 }
605
606 include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
607
608 $form_gui = new ilPropertyFormGUI();
609 $form_gui->setTitle($this->lng->txt('compose'));
610 $form_gui->setOpenTag(false);
611 $this->tpl->setVariable('FORM_ACTION', $this->ctrl->getFormAction($this, 'sendMessage'));
612
613 $this->tpl->setVariable('BUTTON_TO', $lng->txt("search_recipients"));
614 $this->tpl->setVariable('BUTTON_COURSES_TO', $lng->txt("mail_my_courses"));
615 $this->tpl->setVariable('BUTTON_GROUPS_TO', $lng->txt("mail_my_groups"));
616 $this->tpl->setVariable('BUTTON_MAILING_LISTS_TO', $lng->txt("mail_my_mailing_lists"));
617
618 $dsDataLink = $ilCtrl->getLinkTarget($this, 'lookupRecipientAsync', '', true);
619
620 // RECIPIENT
621 $inp = new ilTextInputGUI($this->lng->txt('mail_to'), 'rcp_to');
622 $inp->setRequired(true);
623 $inp->setSize(50);
624 $inp->setValue($mailData["rcp_to"]);
625 $inp->setDataSource($dsDataLink, ",");
626 $inp->setMaxLength(null);
627 $form_gui->addItem($inp);
628
629 // CC
630 $inp = new ilTextInputGUI($this->lng->txt('cc'), 'rcp_cc');
631 $inp->setSize(50);
632 $inp->setValue($mailData["rcp_cc"]);
633 $inp->setDataSource($dsDataLink, ",");
634 $inp->setMaxLength(null);
635 $form_gui->addItem($inp);
636
637 // BCC
638 $inp = new ilTextInputGUI($this->lng->txt('bc'), 'rcp_bcc');
639 $inp->setSize(50);
640 $inp->setValue($mailData["rcp_bcc"]);
641 $inp->setDataSource($dsDataLink, ",");
642 $inp->setMaxLength(null);
643 $form_gui->addItem($inp);
644
645 // SUBJECT
646 $inp = new ilTextInputGUI($this->lng->txt('subject'), 'm_subject');
647 $inp->setSize(50);
648 $inp->setRequired(true);
649 $inp->setValue($mailData["m_subject"]);
650 $form_gui->addItem($inp);
651
652 // Attachments
653 include_once 'Services/Mail/classes/class.ilMailFormAttachmentFormPropertyGUI.php';
654 $att = new ilMailFormAttachmentPropertyGUI($this->lng->txt( ($mailData["attachments"]) ? 'edit' : 'add' ));
655
656
657 if (is_array($mailData["attachments"]) && count($mailData["attachments"]))
658 {
659 foreach($mailData["attachments"] as $data)
660 {
661 if(is_file($this->mfile->getMailPath() . '/' . $ilUser->getId() . "_" . $data))
662 {
663 $hidden = new ilHiddenInputGUI('attachments[]');
664 $form_gui->addItem($hidden);
665 $size = filesize($this->mfile->getMailPath() . '/' . $ilUser->getId() . "_" . $data);
666 $label = $data . " [" . ilFormat::formatSize($size) . "]";
667 $att->addItem($label);
668 $hidden->setValue(urlencode($data));
669 }
670 }
671 }
672 $form_gui->addItem($att);
673
674 // ONLY IF SYSTEM MAILS ARE ALLOWED
675 if($rbacsystem->checkAccess("system_message",$this->umail->getMailObjectReferenceId()))
676 {
677 $chb = new ilCheckboxInputGUI($this->lng->txt('type'), 'm_type[]');
678 $chb->setOptionTitle($this->lng->txt('system_message'));
679 $chb->setValue('system');
680 $chb->setChecked(false);
681 if(is_array($mailData["m_type"]) and in_array('system',$mailData["m_type"]))
682 {
683 $chb->setChecked(true);
684 }
685 $form_gui->addItem($chb);
686 }
687
688
689 // MESSAGE
690 $inp = new ilTextAreaInputGUI($this->lng->txt('message_content'), 'm_message');
691 //$inp->setValue(htmlspecialchars($mailData["m_message"], false));
692 $inp->setValue($mailData["m_message"]);
693 $inp->setRequired(false);
694 $inp->setCols(60);
695 $inp->setRows(10);
696
697 // PLACEHOLDERS
698 $chb = new ilCheckboxInputGUI($this->lng->txt('activate_serial_letter_placeholders'), 'use_placeholders');
699 $chb->setOptionTitle($this->lng->txt('activate_serial_letter_placeholders'));
700 $chb->setValue(1);
701 $chb->setChecked(false);
702 $form_gui->addItem($inp);
703
704 include_once 'Services/Mail/classes/class.ilMailFormPlaceholdersPropertyGUI.php';
706
707 $chb->addSubItem($prop);
708
709 if ($mailData['use_placeholders'])
710 {
711 $chb->setChecked(true);
712 }
713
714 $form_gui->addItem($chb);
715
716 $form_gui->addCommandButton('sendMessage', $this->lng->txt('send_mail'));
717 $form_gui->addCommandButton('saveDraft', $this->lng->txt('save_message'));
719 $form_gui->addCommandButton('cancelMail', $this->lng->txt('cancel'));
720
721 $this->tpl->parseCurrentBlock();
722
723 $this->tpl->setVariable('FORM', $form_gui->getHTML());
724
725 $this->tpl->addJavaScript('Services/Mail/js/ilMailComposeFunctions.js');
726 $this->tpl->show();
727 }
728
729 public function lookupRecipientAsync()
730 {
731 include_once 'Services/JSON/classes/class.ilJsonUtil.php';
732 include_once 'Services/Mail/classes/class.ilMailForm.php';
733
734 $search = $_REQUEST["term"];
735 $result = array();
736 if (!$search)
737 {
739 exit;
740 }
741
742 // #14768
743 $quoted = ilUtil::stripSlashes($search);
744 $quoted = str_replace('%', '\%', $quoted);
745 $quoted = str_replace('_', '\_', $quoted);
746
747 $mailFormObj = new ilMailForm;
748 $result = $mailFormObj->getRecipientAsync("%" . $quoted . "%", ilUtil::stripSlashes($search));
749
751 exit;
752 }
753
754 public function cancelMail()
755 {
758 else
759 return $this->showForm();
760 }
761
765 protected function saveMailBeforeSearch()
766 {
770 global $ilUser;
771
772 // decode post values
773 $files = array();
774 if(is_array($_POST['attachments']))
775 {
776 foreach($_POST['attachments'] as $value)
777 {
778 $files[] = urldecode($value);
779 }
780 }
781
782 $this->umail->savePostData($ilUser->getId(),
783 $files,
787 $_POST['m_type'],
789 ilUtil::securePlainString($_POST['m_subject']),
790 ilUtil::securePlainString($_POST['m_message']),
791 ilUtil::securePlainString($_POST['use_placeholders'])
792 );
793 }
794
798 public function searchMailingListsTo()
799 {
800 $this->saveMailBeforeSearch();
801
802 $this->ctrl->setParameterByClass('ilmailinglistsgui', 'ref', 'mail');
803 $this->ctrl->redirectByClass('ilmailinglistsgui');
804 }
805}
$result
$size
Definition: RandomTest.php:79
$_GET["client_id"]
This class represents a checkbox property in a property form.
This class handles all operations on files (attachments) in directory ilias_data/mail.
Class UserMail this class handles user mails.
static formatSize($size, $a_mode='short', $a_lng=null)
Returns the specified file size value in a human friendly form.
This class represents a hidden form property in a property form.
static encode($mixed, $suppress_native=false)
static getSignature()
Get preset signature.
searchUsers($save=true)
decodeAttachmentFiles(array $files)
This class represents a property form user interface.
This class represents a text area property in a property form.
This class represents a text property in a property form.
static redirect($a_script)
http redirect to other script
static securePlainString($a_str)
Remove unsecure characters from a plain text string.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
$_POST['username']
Definition: cron.php:12
$GLOBALS['ct_recipient']
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
global $ilCtrl
Definition: ilias.php:18
exit
Definition: login.php:54
$cmd
Definition: sahs_server.php:35
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
global $ilUser
Definition: imgupload.php:15