1 <script src=
"../system/engines/jquery/dropzone/dropzone.js"></script>
2 <link href=
"../system/engines/jquery/dropzone/dropzone.css" rel=
"stylesheet">
3 <script src=
"../system/engines/jquery/lightbox2/js/lightbox.min.js"></script>
4 <link rel=
"stylesheet" href=
"../system/engines/jquery/lightbox2/css/lightbox.min.css" type=
"text/css" media=
"all">
19 require_once
'../system/classes/editor.php';
27 require_once
"../system/engines/imapClient/ImapClient.php";
28 require_once
"../system/engines/imapClient/ImapClientException.php";
29 require_once
"../system/engines/imapClient/ImapConnect.php";
30 require_once
"../system/engines/imapClient/IncomingMessage.php";
31 require_once
"../system/engines/imapClient/IncomingMessageAttachment.php";
33 require_once
"../system/engines/imapClient/Section.php";
34 require_once
"../system/engines/imapClient/SubtypeBody.php";
35 require_once
"../system/engines/imapClient/TypeAttachments.php";
36 require_once
"../system/engines/imapClient/TypeBody.php";
39 use SSilence\ImapClient\ImapClientException;
40 use SSilence\ImapClient\ImapClient as Imap;
61 require_once
"../system/classes/webmail.php";
69 $imap->connection =
$imap->getImapConnection();
72 if (isset(
$_GET[
'folder']) && (!empty(
$_GET[
'folder']) && (is_string(
$_GET[
'folder']))))
80 $imap->selectFolder(
'INBOX');
81 $imap->currentFolder =
"INBOX";
86 catch (ImapClientException
$error)
93 $msgno = (int)
$_GET[
'msgno'];
98 if (isset(
$_GET[
'markAsUnread']) && (
$_GET[
'markAsUnread'] ==
true))
101 if (
$imap->setUnseenMessage($msgno) ==
true)
103 alert::draw(
"success",
"Marked as unread",
"The email was marked as unseen",
"", 1200);
107 alert::draw(
"warning",
"ERROR:",
"Unable to mark email as read",
"", 2800);
112 if (
$imap->incomingMessage->header->seen == 0)
114 $imap->setSeenMessage($msgno);
129 <script
type=
"text/javascript">
131 Dropzone.options.myDropzone = {
133 url:
"js/email-send.php",
135 autoProcessQueue:
false,
136 uploadMultiple:
true,
137 parallelUploads: 100,
140 addRemoveLinks:
true,
142 acceptedFiles:
".jpg, .jpeg, .png, .gif, .pdf, .doc, .xls, .wav, .mp3, .mp4, .mpg",
143 clickable:
".fileinput-button",
145 dictFileTooBig:
"File is to big ({{filesize}}mb). Max allowed file size is {{maxFilesize}}mb",
146 dictInvalidFileType:
"Invalid File Type",
147 dictCancelUpload:
"Cancel",
148 dictRemoveFile:
"Remove",
149 dictMaxFilesExceeded:
"Only {{maxFiles}} files are allowed",
150 dictDefaultMessage:
"Drop files here to upload",
154 var myDropzone =
this;
155 var dropzoneFormElement = $(
'#my-dropzone');
157 $(
".dz-message").hide();
159 this.element.querySelector(
"button[type=submit]").addEventListener(
"click",
function(
e) {
165 if (myDropzone.getQueuedFiles().length > 0) {
166 myDropzone.processQueue();
171 $(dropzoneFormElement).attr(
'action',
'js/email-send.php');
172 $(dropzoneFormElement).attr(
'method',
'post');
173 $(dropzoneFormElement).submit();
179 this.
on(
"sendingmultiple",
function(file) {
182 $(
"#submitIcon").removeClass().addClass(
"fa fa-spinner fa-spin");
183 $(
"#submitBtn").removeClass().addClass(
"btn btn-danger disabled pull-right");
184 $(
"#draftBtn").removeClass().addClass(
"btn btn-default disabled");
185 $(
"#addBtn").removeClass().addClass(
"btn btn-success disabled");
188 this.
on(
"successmultiple",
function(files, response) {
191 window.location.replace(
"index.php?page=webmail");
193 this.
on(
"errormultiple",
function(files, response) {
200 $(document).
ready(
function() {
201 $(
'#table-sort').dataTable({
203 "bLengthChange":
false,
211 let markAsUnseenIcon = $(
'#icon-markAsUnseen');
212 let replyBtn = $(
'#replyBtn');
213 let replyIcon = $(
'#icon-reply');
214 let forwardIcon = $(
'#icon-forward');
215 let replyTextArea = $(
'#summernote');
216 let form = $(
'#my-dropzone');
217 let toFormGroup = $(
'#toFormGroup');
218 let boxFooter = $(
'#box-footer');
219 let replyTo = $(
'#replyTo');
222 $(replyBtn).click(
function() {
225 toFormGroup.removeClass();
226 $(
'.note-editable').focus();
230 $(replyIcon).click(
function() {
233 toFormGroup.removeClass();
234 $(
'.note-editable').focus();
238 $(forwardIcon).click(
function() {
239 let toField = $(
'#toField');
242 toFormGroup.removeClass();
243 $(
'.note-editable').focus();
248 $(
"#btn-markAsUnseen").hover(
250 $(markAsUnseenIcon).removeClass(
"fa fa-envelope-open-o");
251 $(markAsUnseenIcon).addClass(
"fa fa-envelope");
253 $(markAsUnseenIcon).removeClass(
"fa fa-envelope");
254 $(markAsUnseenIcon).addClass(
"fa fa-envelope-open-o");
259 $(
"#printButton").click(
261 $(
"#emailMessageContent").printThis();
265 $(
"#icon-print").click(
267 $(
"#emailMessageContent").printThis();
271 $(
"#addCCBtn" ).click(
function() {
273 var ccField = $(
'#ccField');
274 var ccFieldClass = $(ccField).attr(
'class');
275 if (ccFieldClass ===
'form-control hidden')
277 $(ccField).removeClass().addClass(
'form-control animated fadeIn');
279 else if (ccFieldClass ===
'form-control animated fadeIn')
281 $(ccField).removeClass().addClass(
'form-control animated fadeOut hidden');
283 else if (ccFieldClass ===
'form-control animated fadeOut hidden')
285 $(ccField).removeClass().addClass(
'form-control animated fadeIn');
290 $(
"#addBCCBtn" ).click(
function() {
292 var bccField = $(
'#bccField');
293 var bccFieldClass = $(bccField).attr(
'class');
294 if (bccFieldClass ===
'form-control hidden')
296 $(bccField).removeClass().addClass(
'form-control animated fadeIn');
298 else if (bccFieldClass ===
'form-control animated fadeIn')
300 $(bccField).removeClass().addClass(
'form-control animated fadeOut hidden');
302 else if (bccFieldClass ===
'form-control animated fadeOut hidden')
304 $(bccField).removeClass().addClass(
'form-control animated fadeIn');
313 function openReplyBox()
316 let replyBox = $(
'#replyBox');
317 let sendBtn = $(
'#sendBtn');
318 let submitBtn = $(
'#submitBtn');
319 let replyBtn = $(
'#replyBtn');
320 let deleteBtn = $(
'#deleteBtn');
321 let printBtn = $(
'#printBtn');
322 let forwardBtn = $(
'#forwardBtn');
323 let actions = $(
'#actions');
325 $(actions).removeClass().addClass(
'animated fadeIn');
326 $(replyBox).removeClass().addClass(
'box-footer hidden-print animated fadeIn');
328 $(forwardBtn).hide();
331 $(submitBtn).removeClass().addClass(
'btn btn-success hidden-print animated flipInX');
340 function moveMessage(uid, folder, targetFolder){
343 url:
'js/webmail-moveMessage.php',
344 data: {uid: uid, folder:folder, targetFolder:targetFolder},
345 success:
function(data){
350 window.location.replace(
'index.php?page=webmail');
356 <script src=
"../system/engines/jquery/printThis/printThis.js" type=
"text/javascript"></script>
360 <!-- Content Wrapper. Contains page content -->
361 <div class=\"content-wrapper\" id=\"content-FX\">
362 <!-- Content Header (Page header) -->
363 <section class=\"content-header\">";
365 echo backend::getTitle(
$lang[
'WEBMAIL'],
$lang[
'WEBMAIL_SUBTEXT']);
366 echo
"<ol class=\"breadcrumb\">
367 <li><a href=\"index.php\" title=\"$lang[DASHBOARD]\"><i class=\"fa fa-dashboard\"></i> $lang[DASHBOARD]</a></li>
368 <li class=\"active\"><a href=\"index.php?page=webmail\" title=\"$lang[WEBMAIL]\"> $lang[WEBMAIL]</a></li>
371 <!-- Main content -->
372 <section class=\"content\">";
379 <div
class=
"col-md-3">
381 <
a href=
"index.php?page=webmail" class=
"btn btn-success btn-large" style=
"width: 100%;"><
i class=
"fa fa-reply-all"></
i> &
nbsp;Back to
383 <div
class=
"box box-default">
384 <div
class=
"box-header with-border">
385 <h3
class=
"box-title">Folders</h3>
387 <div
class=
"box-tools">
388 <button
type=
"button" class=
"btn btn-box-tool" data-widget=
"collapse">
389 <
i class=
"fa fa-minus"></
i>
393 <div
class=
"box-body no-padding animated fadeIn" style=
"">
394 <ul
class=
"nav nav-pills nav-stacked">
405 <div
id=
"messageBox" class=
"col-md-9 animated fadeIn">
407 <form
id=
"my-dropzone" class=
"dropzone" enctype=
"multipart/form-data">
409 <div
class=
"box box-secondary" id=
"emailMessageContent">
410 <div
class=
"box-header with-border">
415 $replies = substr_count(
$imap->incomingMessage->header->subject ,
'Re:');
419 $subject = str_replace(
"Re:",
"",
$imap->incomingMessage->header->subject);
420 $subject =
"Re:(".$replies.
") ".$subject;
424 $subject =
$imap->incomingMessage->header->subject;
427 <h3><?php echo $subject; ?></h3>
429 <h4>From: <?php echo
$imap->incomingMessage->header->details->from[0]->mailbox .
"@" .
$imap->incomingMessage->header->details->from[0]->host ?></h4>
430 <h4 style=
"margin-top:-10px;"><small>To: <?php echo
$imap->incomingMessage->header->details->to[0]->mailbox .
"@" .
$imap->incomingMessage->header->details->to[0]->host ?></small>
431 <span style=
"margin-top:-15px;" class=
"mailbox-read-time pull-right"><?php echo substr(
$imap->incomingMessage->header->date, 0, -6); ?>
433 <span
class=
"pull-right">
434 <?php echo sys::time_ago(
$imap->incomingMessage->header->date,
$lang); ?></span>
439 <div
class=
"box-tools pull-right">
440 <
a href=
"index.php?page=webmail&folder=INBOX" class=
"btn btn-box-tool" data-toggle=
"tooltip" title=
"<?php echo $lang['CLOSE'];?>"
441 data-original-
title=
"<?php echo $lang['CLOSE'];?>"><
i class=
"fa fa-close text-light"></
i>
445 <!-- /.box-header -->
446 <div
class=
"box-body no-padding">
448 <div
class=
"mailbox-read-info">
451 <!-- /.mailbox-read-info -->
452 <!-- <div
class=
"mailbox-controls with-border text-center"> -->
454 <!-- /.mailbox-controls -->
455 <div
class=
"mailbox-read-message">
459 echo
$imap->incomingMessage->message->html;
462 if (count(
$imap->incomingMessage->attachments) > 0)
465 $downloadPath =
"../media/mailbox";
468 if (is_writeable($downloadPath) ===
false)
470 alert::draw(
"warning",
$lang[
'ERROR'],
$lang[
'ATTACH_DIR_NOT_WRITEABLE'],
"", 3800);
474 $attachmentOptions = array(
'dir' => $downloadPath,
'incomingMessage' =>
$imap->incomingMessage);
477 echo
"<ul class=\"mailbox-attachments clearfix\">";
480 foreach (
$imap->incomingMessage->attachments as $key => $attachment)
483 $imap->saveAttachments($attachmentOptions);
485 $downloadPath = sys::addTrailingSlash($downloadPath);
487 $attachment->currentFile = $downloadPath.$attachment->name;
489 $attachment->isImage =
'';
492 if (is_file($attachment->currentFile))
494 $attachment->size = filesize($attachment->currentFile);
496 $attachment->size = filemanager::sizeFilter($attachment->size, 0);
499 if (strlen($attachment->name) >= 20)
501 $attachment->namePreview = substr($attachment->name, 0, 20);
503 $attachment->namePreview = $attachment->namePreview.
"...";
507 $attachment->namePreview = $attachment->name;
511 $attachment->currentMimeType = mime_content_type($attachment->currentFile);
515 if(strpos($attachment->currentMimeType,
"image") !==
false)
517 $attachment->isImage =
true;
522 else if(strpos($attachment->currentMimeType,
"zip") !==
false)
524 $attachmentIcon =
"fa fa-file-archive-o";
528 else if(strpos($attachment->currentMimeType,
"pdf") !==
false)
530 $attachmentIcon =
"fa fa-file-pdf-o";
534 else if(strpos($attachment->currentMimeType,
"text") !==
false)
536 $attachmentIcon =
"fa fa-file-text-o";
540 else if(strpos($attachment->currentMimeType,
"audio") !==
false)
542 $attachmentIcon =
"fa fa-file-audio-o";
546 else if(strpos($attachment->currentMimeType,
"video") !==
false)
548 echo
"Attachment must be a video";
549 $attachmentIcon =
"fa fa-file-video-o";
553 else if(strpos($attachment->currentMimeType,
"word") !==
false)
555 $attachmentIcon =
"fa fa-file-word-o";
559 else if(strpos($attachment->currentMimeType,
"excel") !==
false)
561 $attachmentIcon =
"fa fa-file-excel-o";
565 else if(strpos($attachment->currentMimeType,
"powerpoint") !==
false)
567 $attachmentIcon =
"fa fa-file-powerpoint-o";
574 $attachmentIcon =
"fa fa-file-o";
579 if ($attachment->isImage ===
true)
585 <!-- <span class=\"mailbox-attachment-icon\"><i class=\"fa fa-file-image-o\"></i></span> -->
587 <div class=\"mailbox-attachment-info\" style=\"min-height:180px; overflow: hidden;\">
588 <a href=\"".$downloadPath.$attachment->name.
"\" data-lightbox=\"attachment-set\" data-title=\"".$attachment->name.
"\" class=\"mailbox-attachment-name\">
589 <img src=\"".$downloadPath.$attachment->name.
"\" class=\"img-responsive\" alt=\"attachment\"> ".$attachment->namePreview.
"
591 <span class=\"mailbox-attachment-size\">
592 ".$attachment->size.
"
593 <a href=\"".$downloadPath.$attachment->name.
"\" class=\"btn btn-default btn-xs pull-right\"><i class=\"fa fa-cloud-download\"></i></a>
602 <span class=\"mailbox-attachment-icon\"><a href=\"".$attachment->currentFile.
"\" target=\"_blank\"><i class=\"".$attachmentIcon.
"\"></i></a></span>
604 <div class=\"mailbox-attachment-info\">
605 <i class=\"fa fa-paperclip\"></i> <a href=\"".$downloadPath.$attachment->name.
"\">".$attachment->namePreview.
"</a>
606 <span class=\"mailbox-attachment-size\">
607 ".$attachment->size.
"
608 <a href=\"".$downloadPath.$attachment->name.
"\" class=\"btn btn-default btn-xs pull-right\"><i class=\"fa fa-cloud-download\"></i></a>
617 echo
"The email got attachments, but no files were found. <a href=\"#\">Try to download</a>";
623 <!-- /.mailbox-read-message -->
628 <div
id=
"toFormGroup" class=
"form-group hidden">
629 <input
id=
"toField" class=
"form-control hidden" name=
"to" placeholder=
"<?php echo $imap->incomingMessage->header->details->from[0]->mailbox . "@" . $imap->incomingMessage->header->details->from[0]->host ?>" value=
"<?php echo $imap->incomingMessage->header->details->from[0]->mailbox . "@" . $imap->incomingMessage->header->details->from[0]->host ?>">
630 <input
id=
"ccField" class=
"form-control hidden" name=
"ccField" placeholder=
"CC:">
631 <input
id=
"bccField" class=
"form-control hidden" name=
"bccField" placeholder=
"BCC:">
633 <div
id=
"subjectFormGroup" class=
"form-group hidden">
634 <input
class=
"form-control" name=
"subject" placeholder=
"Subject:" value=
"<?php "Re:
".$imap->incomingMessage->header->subject; ?>">
636 <div
id=
"replyBox" class=
"form-group hidden">
637 <small
class=
"text-muted"><?php echo
$lang[
'REPLY'].
" ".
$lang[
'TO'].
": ".
$imap->incomingMessage->header->details->from[0]->mailbox .
"@" .
$imap->incomingMessage->header->details->from[0]->host; ?>
638 <span
id=
"addBCCBtn" class=
"pull-right" style=
"cursor:pointer;">&
nbsp;BCC</span>
639 <span
id=
"addCCBtn" class=
"pull-right" style=
"cursor: pointer;">CC&
nbsp;</span>
641 <label
for=
"summernote" class=
"hidden"></label>
642 <!-- summernote
editor -->
643 <textarea
id=
"summernote" name=
"body" class=
"form-control">
646 <h4>".$lang[
'SENT'].
": ".substr(
$imap->incomingMessage->header->date, 0, -6).
" ".
$lang[
'FROM'].
" ".
$imap->incomingMessage->header->details->from[0]->mailbox .
"@" .
$imap->incomingMessage->header->details->from[0]->host.
"</h4>";
647 echo
"<br>".$imap->incomingMessage->message->html; ?>
651 <!-- start dropzone -->
652 <div
id=
"actions" class=
"hidden">
653 <!--
this is were the previews should be shown. -->
654 <div
class=
"dropzone-previews"></div>
655 <!-- The fileinput-button span is used to style the file input field as button -->
656 <span
id=
"addBtn" class=
"btn btn-success fileinput-button">
657 <
i class=
"fa fa-plus"></
i>
658 <span>Add files...</span>
661 <div
class=
"pull-right">
662 <
a id=
"draftBtn" href=
"index.php?page=webmail-compose&draft=1" type=
"button" class=
"btn btn-default"><
i class=
"fa fa-pencil"></
i>&
nbsp; Draft</
a>
664 <button
id=
"submitBtn" type=
"submit" class=
"btn btn-success pull-right"><
i id=
"submitIcon" class=
"fa fa-paper-plane-o"></
i> &
nbsp;&
nbsp;Send Email</button>
665 <!-- <button
type=
"submit" id=
"submitBtn" class=
"btn btn-success start"><
i class=
"fa fa-paper-plane-o"></
i>&
nbsp; Send</button> -->
666 <input
type=
"hidden" name=
"sendEmail" value=
"true">
667 <input
type=
"hidden" name=
"subject" value=
"<?php echo "Re:
".$imap->incomingMessage->header->subject;?>">
670 <
p class=
"help-block">Max. <?php echo filemanager::getPostMaxSize(); ?></
p>
672 <!-- /. bootstrap dropzone -->
675 <!-- /.box-footer -->
676 <div
id=
"box-footer" class=
"box-footer hidden-print">
677 <div
class=
"pull-right hidden-print">
678 <!-- <
a href=
"http://raspi/web/clone/admin/index.php?page=webmail&moveMessage=true&folder=INBOX&targetFolder=Trash&uid=<?php echo $imap->incomingMessage->header->uid; ?>" class=
"btn btn-default hidden-print"><
i class=
"fa fa-trash-o"></
i> <?php
679 <button
type=
"button" id=
"deleteBtn" class=
"btn btn-default hidden-print"><
i class=
"fa fa-trash-o"></
i> <?php echo
$lang[
'DELETE']; ?></button>
680 <button
type=
"button" id=
"printBtn" class=
"btn btn-default hidden-print"><
i class=
"fa fa-print"></
i> <?php echo
$lang[
'PRINT']; ?></button>
683 <button
id=
"sendBtn" class=
"btn btn-default hidden-print hidden"><
i class=
"fa fa-send"></
i> &
nbsp;<?php echo
$lang[
'SUBMIT']; ?></button>
684 <
a id=
"replyBtn" href=
"#summernote" class=
"btn btn-default hidden-print"><
i class=
"fa fa-reply"></
i> &
nbsp;<?php echo
$lang[
'REPLY']; ?></
a>
685 <!-- <button
id=
"forwardBtn" class=
"btn btn-default hidden-print"><
i class=
"fa fa-mail-forward"></
i> &
nbsp;<?php
690 <!-- /.box-footer -->
704 echo
"<h4>Webmail is not enabled! Go to <a href=\"index.php?page=settings-webmail\">Settings / Webmail</a> and enable it.</a></h4>";
print $lang['FILEMAN_UPLOAD']
Throws a fancy Bootstrap Alert (success, info, warning or danger)
Backend class serves a few useful functions for the admin backend.
Mysqli database class; returns db connection object.
Load editor settings, required javascript and html markup.
Basic File Manager (Backend)
The language class - support multilingual backend.
Settings class: get and set YaWK system settings.
The sys class - handles yawk's system core functions.
<!-- backend language -->< h3 >< i class="fa fa-language"></i > & nbsp
document ready(function() { $('a[data-confirm]').click(function(ev) { modal='#dataConfirmModal';var href=$(this).attr('href');var title=$(this).attr('title');var icon=$(this).attr('data-icon');if(!icon) { icon='fa fa-trash-o';} if(!$(modal).length) { $('body').append('< div id="dataConfirmModal" class="modal fade" role="dialog" aria-labelledby="dataConfirmLabel" aria-hidden="true">< div class="modal-dialog">< div class="modal-content">< div class="modal-header">< button type="button" class="close" data-dismiss="modal" aria-hidden="true">< i class="fa fa-times"></i ></button >< br >< div class="col-md-1">< h3 class="modal-title">< i class="'+icon+'"></i ></h3 ></div >< div class="col-md-11">< h3 class="modal-title" id="dataConfirmLabel">'+title+'</h3 ></div ></h3 ></div >< div class="modal-body"></div >< div class="modal-footer">< button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true">Abbrechen</button >< a type="button" class="btn btn-danger" id="dataConfirmOK">< i class="'+icon+'"></i > L öschen</a ></div ></div ></div ></div >');} $(modal).find('.modal-body').text($(this).attr('data-confirm'));$('#dataConfirmOK').attr('href', href);$(modal).modal({show:true});return false;});$('#terminateUser').click(function() { var terminate=window.confirm("ACHTUNG!\nDas wird Deinen Account permanent deaktivieren.\n"+"Bist Du Dir sicher, dass Du das tun willst?");if(terminate===true) { var terminateUser=window.confirm("Bist Du Dir wirklich ganz sicher?\n"+"Diese Aktion kann nicht rueckgaengig gemacht werden.");if(terminateUser===true) { $.get('system/templates/YaWK-bootstrap3/js/terminate-user.php', function(data) { if(data==="true") { setTimeout("window.location='logout.html'", 0);} else { alert("Fehler: "+data);} });} } });function dismissNotifications() { $.ajax({ url:'js/dismiss-notifications.php', type:'POST', success:function(data) { if(!data) { alert('Something went wrong!');return false;} } });$("#bell-label").fadeOut();$('#notification-header').html('You have 0 notifications');$('#notification-menu').fadeOut();} $("#dismiss").click(function() { dismissNotifications();});function disableButtons(delay) { $('#loginButton').removeClass().addClass('btn btn-success disabled').attr('id', 'LOGIN_FORBIDDEN');$('#resetPasswordButton').removeClass().addClass('btn btn-danger disabled');setTimeout(function() { $('#LOGIN_FORBIDDEN').attr('id', 'loginButton').removeClass().addClass('btn btn-success');$('#resetPasswordButton').removeClass().addClass('btn btn-danger');}, delay);} $("#loginButton").click(function(){ if($('#loginButton').length > 0) { if($('#loginButton').hasClass('btn') &&$('#loginButton').hasClass('btn-success') &&$('#loginButton').hasClass('disabled')) { } else { $("#loginForm").submit();disableButtons(10000);} } else if($('#LOGIN_FORBIDDEN').length > 0) { if($('#LOGIN_FORBIDDEN').hasClass('btn') &&$('#LOGIN_FORBIDDEN').hasClass('btn-success') &&$('#LOGIN_FORBIDDEN').hasClass('disabled')) { } else { } } });$("#blockedBtn").hover(function() { $("#blockedBtn").hide();$("#askBtn").fadeIn(820);});})