YaWK  24.1
Yet another WebKit
webmail.php
Go to the documentation of this file.
1 <?php
2 namespace YAWK {
3  /**
4  * @details <b>Integrated Webmail</b>
5  *
6  * YaWK includes a <i>seamless integrated</i> webmail. This means you can handle all emails of your website
7  * without leaving the backend. The seamless integration into the backend will help you with your daily work.
8  *
9  * This class features all the basic webmail functions that are required
10  * to build the desired views. It also acts as wrapper for the imap client and serve some low-level API
11  * methods to move, purge, delete emails and more.
12  *
13  * Beside this, this class serves methods to list folders and email headers / messages
14  *
15  * @author Daniel Retzl <[email protected]>
16  * @copyright 2019 Daniel Retzl http://www.yawk.io
17  * @license https://opensource.org/licenses/MIT
18  * @version 1.0.0/
19  * @since File available since Release 1.0.0
20  * @brief Integrated IMAP Webmail
21  *
22  */
23 
24  class webmail
25  {
26  /** @param string information about the connection */
27  public $connectionInfo = '';
28 
29  /**
30  * @brief Move a message from source to target folder. Requires imap handle, source folder, target folder and the mail UID to move.
31  * @param $imap object imap connection resource
32  * @param $folder string the source folder from which to move the uid
33  * @param $targetFolder string the target folder where to move the uid
34  * @param $uid int|string the mail UID
35  */
36  public function moveMessage($imap, $folder, $targetFolder, $uid)
37  { /** @param $imap \SSilence\ImapClient\ImapClient */
38 
39  // check email uid
40  if (!isset($uid) || (empty($uid)))
41  { // no uid set
42  return false;
43  // todo: add syslog call
44  // \YAWK\alert::draw("warning", "Warning", "Failed to delete email because there is no uid set!", "", 0);
45  }
46 
47  // check target folder
48  if (!isset($targetFolder) || (empty($targetFolder)))
49  { // target folder not set or empty
50  return false;
51  // todo: add syslog call
52  // \YAWK\alert::draw("warning", "Warning", "Failed to delete email because there is no target folder set!", "", 0);
53  }
54 
55  // check source folder
56  if (!isset($folder) || (empty($folder)))
57  {
58  // folder is not set or empty
59  return false;
60  // todo: add syslog call
61  // \YAWK\alert::draw("warning", "Warning", "Failed to delete email because there is no source folder set!", "", 0);
62  }
63  else
64  { // select current source folder
65  $imap->selectFolder($folder);
66  }
67 
68  // move email to target folder
69  if ($imap->moveMessage($uid, $targetFolder))
70  { // move email successful
71  return true;
72  }
73  else
74  { // move email failed
75  return false;
76  }
77  }
78 
79  /**
80  * @brief Delete a message. Requires imap handle, folder and uid of the mail to delete
81  * @param $imap object imap connection resource
82  * @param $folder string the source folder from which to move the uid
83  * @param $uid int|string the mail UID
84  */
85  public function deleteMessage($imap, $folder, $uid)
86  { /** @param $imap \SSilence\ImapClient\ImapClient */
87 
88  // folder is not set or empty
89  if (!isset($folder) || (empty($folder)))
90  { // todo: add syslog call
91  // \YAWK\alert::draw("warning", "Warning", "Failed to delete email because there is no source folder set!", "", 0);
92  }
93  else
94  { // select current source folder
95  $imap->selectFolder($folder);
96  }
97 
98  // mail uid is not set
99  if (!isset($uid) || (empty($uid)))
100  { // todo: add syslog call
101  // \YAWK\alert::draw("warning", "Warning", "Failed to delete email because there is no uid set!", "", 0);
102  }
103 
104  // move email to target folder
105  if ($imap->deleteMessage($uid))
106  { // move email successful
107  return true;
108  }
109  else
110  { // move email failed
111  return false;
112  }
113  }
114 
115 
116  /**
117  * @brief Cleanup trash and spam folder (delete all messages in requested folder)
118  * @param $imap object imap connection resource
119  */
120  public function purgeTrash($imap)
121  { /** @param $imap \SSilence\ImapClient\ImapClient */
122  // move email to target folder
123  if ($imap->purge() == true)
124  { // purge successful
125  return true;
126  }
127  else
128  { // purge failed
129  return false;
130  }
131  }
132 
133  /**
134  * @brief Draw mailbox control buttons (trash, reply, forward...)
135  * @param $imap object imap object
136  * @param $type string inbox|message| select proper button set which to display
137  * @param $uid int the current email uid to work with
138  * @param $folder string the current folder (to detect if folder is trash)
139  * @param $lang array language array
140  */
142  {
143  /** @param $imap \SSilence\ImapClient\ImapClient */
144  // check if uid is set
145  if (!isset($uid) || (empty($uid)))
146  { // set uid to zero
147  $uid = 0;
148  }
149  // check if folder is set (required for correct delete action)
150  if (!isset($folder) || (empty($folder)))
151  { // set folder to inbox
152  $folder = "INBOX";
153  }
154 
155  // check if type is set
156  if (isset($type) && (is_string($type)))
157  { // check, which type of button set is wanted
158  switch ($type)
159  {
160  // button iconset for message overview
161  case "inbox":
162  // if current folder is trash...
163  if ($folder == "trash" || ($folder == "Trash"))
164  { // link: do not move to trash, DELETE finally
165  $deleteClassicLink = "index.php?page=webmail&purgeTrash=true";
166  $deleteLink = '<a id="moveIconLink_'.$uid.'" onclick="moveMessage('.$uid.', \''.$_GET['folder'].'\', \''.$folder.'\');return false;" href="#"><i class="fa fa-trash-o" id="moveIcon_'.$uid.'"></i></a>';
167  $deleteClass = "btn btn-default btn-sm";
168  $refreshClass = "btn btn-default btn-sm hidden";
169  $markAsReadClass = "btn btn-default btn-sm checkbox-toggle hidden";
170  }
171  else
172  { // move to trash link
173  $deleteClassicLink = "index.php?page=webmail&moveMessage=true&folder=".$folder."&targetFolder=Trash&uid=".$uid."";
174  if (!isset($_GET['folder']) || (empty($_GET['folder']))) { ($folder = 'Inbox'); } else { ($folder = $_GET['folder']); }
175  $deleteLink = '<a id="moveIconLink_'.$uid.'" onclick="moveMessage('.$uid.', \''.$folder.'\', \'Trash\');return false;" href="#"><i class="fa fa-trash-o" id="moveIcon_'.$uid.'"></i></a>';
176  $deleteClass = "btn btn-default btn-sm hidden";
177  $refreshClass = "btn btn-default btn-sm";
178  $markAsReadClass = "btn btn-default btn-sm checkbox-toggle";
179 
180  }
181  echo "
182  <div class=\"mailbox-controls\">
183  <!-- Check all button -->
184  <a href=\"#\" class=\"".$markAsReadClass."\" data-toggle=\"tooltip\" data-container=\"body\" title=\"$lang[MARK_ALL_AS_READ]\" data-original-title=\"$lang[MARK_ALL_AS_READ]\"><i class=\"fa fa-square-o\"></i></a>
185  <div class=\"btn-group\">";
186  // echo $deleteLink;
187  // classic link
188  echo "<a href=\"".$deleteClassicLink."\" id=\"icon-trash\" class=\"".$deleteClass."\" data-toggle=\"tooltip\" data-container=\"body\" title=\"$lang[DELETE_ALL]\" data-original-title=\"$lang[DELETE_ALL]\"><i class=\"fa fa-trash-o\"></i> &nbsp;Empty Trash</a>
189  <a href=\"index.php?page=webmail\" id=\"icon-refresh\" class=\"".$refreshClass."\" data-toggle=\"tooltip\" data-container=\"body\" title=\"$lang[REFRESH]\" data-original-title=\"$lang[REFRESH]\"><i class=\"fa fa-refresh\"></i></a>
190  </div>
191  <!-- /.btn-group -->
192  <!-- additional buttons: settings + new mail -->
193  <div class=\"pull-right\">
194  <a href=\"index.php?page=settings-webmail\" id=\"icon-settings\" class=\"btn btn-default btn-sm\" data-toggle=\"tooltip\" data-container=\"body\" title=\"$lang[SETTINGS]\" data-original-title=\"$lang[SETTINGS]\"><i class=\"fa fa-gear\"></i></a>
195  <a href=\"index.php?page=webmail-compose\" id=\"icon-compose\" class=\"btn btn-default btn-sm\" data-toggle=\"tooltip\" data-container=\"body\" title=\"$lang[EMAIL_COMPOSE]\" data-original-title=\"$lang[EMAIL_COMPOSE]\"><i class=\"fa fa-plus\"></i></a>
196  <!-- /.btn-group -->
197  </div>
198  </div>";
199  break;
200 
201  // button iconset for wwbmail-message page
202  case "message":
203  // if current folder is trash...
204  if ($folder == "trash" || ($folder == "Trash"))
205  { // link: do not move to trash, DELETE finally
206  $deleteLink = "index.php?page=webmail&purgeTrash=true";
207  $deleteClass = "btn btn-default btn-sm";
208  }
209  else
210  { // move to trash link
211  // $deleteLink = "index.php?page=webmail&moveMessage=true&folder=".$folder."&targetFolder=Trash&uid=".$uid."";
212  $deleteClass = "btn btn-default btn-sm";
213  if (!isset($_GET['folder']) || (empty($_GET['folder']))) { ($folder = 'Inbox'); } else { ($folder = $_GET['folder']); }
214  $deleteLink = '<a id="moveIconLink_'.$uid.'" class="btn btn-default btn-sm" onclick="moveMessage('.$uid.', \''.$folder.'\', \'Trash\');return false;" href="#" title="'.$lang['DELETE'].'" data-toggle="tooltip" data-container="body" data-original-title="'.$lang['DELETE'].'"><i class="fa fa-trash-o" id="moveIcon_'.$uid.'"></i></a>';
215  }
216  echo "
217  <div class=\"mailbox-controls\">
218  <div class=\"btn-group\">
219  <a id=\"btn-markAsUnseen\" href=\"index.php?page=webmail-message&markAsUnread=true&folder=".$_GET['folder']."&msgno=".$_GET['msgno']."\" class=\"btn btn-default btn-sm\" data-toggle=\"tooltip\" data-container=\"body\" title=\"$lang[MARK_AS_UNSEEN]\" data-original-title=\"$lang[MARK_AS_UNSEEN]\"><i class=\"fa fa-envelope\" id=\"icon-markAsUnseen\"></i></a>
220  ";
221  echo $deleteLink;
222 
223  // <a href=\"".$deleteLink."\" id=\"icon-delete\" class=\"".$deleteClass."\" data-toggle=\"tooltip\" data-container=\"body\" title=\"$lang[DELETE]\" data-original-title=\"$lang[DELETE]\"><i class=\"fa fa-trash-o\"></i></a>
224  echo "<a id=\"icon-reply\" href=\"#summernote\" class=\"btn btn-default btn-sm\" data-toggle=\"tooltip\" data-container=\"body\" title=\"$lang[REPLY]\" data-original-title=\"$lang[REPLY]\"><i class=\"fa fa-reply\"></i></a>
225  <a href=\"index.php?page=webmail\" id=\"icon-forward\" class=\"btn btn-default btn-sm\" data-toggle=\"tooltip\" data-container=\"body\" title=\"$lang[FORWARD]\" data-original-title=\"$lang[FORWARD]\"><i class=\"fa fa-mail-forward\"></i></a>
226  <a href=\"#\" id=\"icon-print\" class=\"btn btn-default btn-sm\" data-toggle=\"tooltip\" data-container=\"body\" title=\"$lang[PRINT]\" data-original-title=\"$lang[PRINT]\"><i class=\"fa fa-print\"></i></a>
227  </div>
228  <div class=\"btn-group pull-right\">
229  <a href=\"index.php?page=webmail-compose\" id=\"icon-compose\" class=\"btn btn-default btn-sm\" data-toggle=\"tooltip\" data-container=\"body\" title=\"\" data-original-title=\"Email verfassen\"><i class=\"fa fa-plus\"></i></a>
230  </div>
231  <!-- /.btn-group -->
232  </div>";
233  break;
234  }
235  }
236  }
237 
238  /**
239  * @brief Draw a list with all folders of this mailbox
240  * @param $imap object The current imap handle
241  * @param $folders array The mailbox folders as array
242  */
243  public function drawFolders($imap, $folders)
244  { // check if folder array is set
245  /* @param $imap \SSilence\ImapClient\Imapclient */
246 
247  if (is_array($folders) || (!empty($folders)))
248  {
249  // sort folder array to bring inbox more upwards
250  ksort($folders);
251 
252  // count unread messages in current folder
253  $unreadMessages = $imap->countUnreadMessages();
254 
255  // init default active folder markup
256  $activeMarkupDefault = '';
257 
258  // if all mails in this folder are seen
259  if ($unreadMessages > 0)
260  { // hide new mail label
261  $newMessagesLabel = "<span id=\"newMessagesLabel\" class=\"label label-success pull-right\">+ ".$unreadMessages."</span>";
262  }
263  else
264  {
265  $newMessagesLabel = "";
266  }
267 
268  // walk through folders and display them
269  foreach ($folders as $folder => $item)
270  {
271 
272  // select current folder
273  $imap->selectFolder($folder);
274  // and count messages within
275  $messageCount = $imap->countMessages();
276 
277  // check if folder is requested via get param
278  if (isset($_GET['folder']) && (!empty($_GET['folder'])))
279  { // check, if folder is active (current equals request)
280  if ($folder === $_GET['folder'])
281  {
282  // set markup to view as active
283  $activeMarkup = " class=\"active\"";
284  $activeLabelNew = $newMessagesLabel;
285  $activeLabelInbox = '';
286  $activeLabelTotal = " <span id=\"messageCount_".$folder."\"><small>(".$messageCount.")</small></span>";
287  }
288  else
289  { // folder not active - no markup needed
290  $activeMarkup = '';
291  $activeLabelNew = '';
292  $activeLabelInbox = '';
293  $activeLabelTotal = " <span id=\"messageCount_".$folder."\"><small>(".$messageCount.")</small></span>";
294  }
295  }
296  else
297  { // page called w/o requested folder, set default (inbox) as active
298  $activeMarkup = "";
299  $activeLabelNew = "";
300  $activeLabelTotal = "";
301  $activeLabelInbox = $newMessagesLabel;
302  // $activeLabelInbox = "<span class=\"label label-success pull-right".$labelClass."\">+ ".$unreadMessages."</span>";
303 
304  $activeLabelTotal = " <span id=\"messageCount_".$folder."\"><small>(".$messageCount.")</small></span>";
305  $activeMarkupDefault = " class=\"active\"";
306  }
307 
308 
309  // check folder value and set markup to display icons corresponding to the folder
310  if ($folder == "INBOX" || $folder == "inbox" || $folder == "Inbox")
311  { // set inbox icon
312  echo "<li '".$activeMarkup.$activeMarkupDefault."><a href=\"index.php?page=webmail&folder=$folder\"><i class=\"fa fa-inbox\"></i> $folder
313  ".$activeLabelNew." ".$activeLabelInbox." ".$activeLabelTotal." </a></li>";
314  }
315 
316  else if ($folder == "SENT" || $folder == "sent" || $folder == "Sent")
317  { // set sent icon
318  echo "<li".$activeMarkup."><a href=\"index.php?page=webmail&folder=$folder\"><i class=\"fa fa-envelope-o\"></i> $folder
319  ".$activeLabelNew." ".$activeLabelTotal." </a></li>";
320  }
321 
322  else if ($folder == "Drafts" || $folder == "drafts" || $folder == "DRAFTS")
323  { // set draft icon
324  echo "<li".$activeMarkup."><a href=\"index.php?page=webmail&folder=$folder\"><i class=\"fa fa-file-text-o\"></i> ".$folder."
325  ".$activeLabelNew." ".$activeLabelTotal." </a></li>";
326  }
327 
328  else if ($folder == "Junk" || $folder == "junk" || $folder == "JUNK")
329  { // set junk icon
330  echo "<li".$activeMarkup."><a href=\"index.php?page=webmail&folder=$folder\"><i class=\"fa fa-filter\"></i> ".$folder."
331  ".$activeLabelNew." ".$activeLabelTotal." </a></li>";
332  }
333 
334  else if ($folder == "Trash" || $folder == "trash" || $folder == "TRASH")
335  { // set trash icon
336  echo "<li".$activeMarkup."><a href=\"index.php?page=webmail&folder=$folder\"><i class=\"fa fa-trash-o\"></i> ".$folder."
337  ".$activeLabelNew." ".$activeLabelTotal." </a></li>";
338  }
339 
340  else
341  { // any other folder: default folder icon
342  echo "<li".$activeMarkup."><a href=\"index.php?page=webmail&folder=$folder\"><i class=\"fa fa-folder-o\"></i> ".$folder."
343  ".$activeLabelNew." ".$activeLabelTotal." </a></li>";
344  }
345  }
346  }
347  else
348  { // folders array not set or empty
349  echo "Failed to draw folders because folders is not an array (or empty).";
350  }
351  }
352 
353 
354  /**
355  * @brief Draw email headers (will be used to overview the email list)
356  * @param $emails array email headers
357  * @param $currentFolder string the current folder from where to get the emails
358  * @param $lang array language array
359  */
360  public function drawHeaders($emails, $currentFolder, $lang)
361  { // check, if email array is set and not empty
362  if (is_array($emails) && (!empty($emails)))
363  {
364  // walk through every email...
365  foreach ($emails as $item => $email)
366  {
367  // mail is new (not seen)
368  if ($email->header->seen === 0)
369  { // display it bold
370  $state = "setSeen";
371  $boldRow = "text-bold";
372  $seenIcon = "fa fa-envelope text-muted";
373  $seenLink = 'index.php?page=webmail&markAsRead=true&folder='.$currentFolder.'&msgno='.$email->header->msgno.'';
374  // $seenTooltip = 'data-toggle="tooltip" data-container="body" title="'.$lang['MARK_AS_READ'].'" data-original-title="'.$lang['MARK_AS_READ'].'"';
375  $seenTooltip = '';
376  $messageLink = 'index.php?page=webmail-message&folder='.$currentFolder.'&msgno='.$email->header->msgno.'';
377  $markAsReadIcon = '<a id="seenIconLink_'.$email->header->msgno.'" onclick="markAsSeen('.$email->header->msgno.', \''.$state.'\');return false;" href="#" '.$seenTooltip.'><i id="seenIcon_'.$email->header->msgno.'" class="'.$seenIcon.'"></i></a>';
378  }
379  else
380  { // message already seen
381  $state = "setUnseen";
382  $boldRow = "";
383  $seenIcon = "fa fa-envelope-open-o text-muted";
384  $seenLink = 'index.php?page=webmail&markAsUnread=true&folder='.$currentFolder.'&msgno='.$email->header->msgno.'';
385  // $seenTooltip = 'data-toggle="tooltip" data-container="body" title="'.$lang['MARK_AS_UNSEEN'].'" data-original-title="'.$lang['MARK_AS_UNSEEN'].'"';
386  $seenTooltip = '';
387  $messageLink = 'index.php?page=webmail-message&folder='.$currentFolder.'&msgno='.$email->header->msgno.'';
388  $markAsReadIcon = '<a id="seenIconLink_'.$email->header->msgno.'" onclick="markAsSeen('.$email->header->msgno.', \''.$state.'\');return false;" href="#" '.$seenTooltip.'><i id="seenIcon_'.$email->header->msgno.'" class="'.$seenIcon.'"></i></a>';
389  }
390 
391  // get mail size
392  $size = \YAWK\filemanager::sizeFilter($email->header->size, 0);
393 
394  // count attachments
395  $attachment = count ($email->attachments);
396 
397  // check if attachment is set
398  if ($attachment >= 1)
399  { // set paperclip icon
400  $attachClip = '<b><i class="fa fa-paperclip"></i></b><br><small>'.$size.'</small>';
401  }
402  else
403  { // no paperclip
404  $attachClip = "";
405  }
406 
407  // calculate human friendly time info
408  $timeAgo = \YAWK\sys::time_ago($email->header->date, $lang);
409 
410  if ($currentFolder == "trash" || $currentFolder == "Trash" || $currentFolder == "TRASH")
411  {
412  $starIcon = '';
413  // set action icon to "RESTORE"
414  $markAsReadIcon = '<a id="moveIconLink_'.$email->header->uid.'" onclick="moveMessage('.$email->header->uid.', \''.$currentFolder.'\', \'Inbox\', );return false;" href="#"><i class="fa fa-undo text-dark" id="moveIcon_'.$email->header->uid.'"></i></a>';
415  // delete icon
416  $deleteIcon = '<a id="moveIconLink_'.$email->header->uid.'" data-toggle="tooltip" data-container="body" title="'.$lang['DELETE_FINALLY'].'" data-original-title="'.$lang['DELETE_FINALLY'].'" onclick="deleteMessage('.$email->header->uid.', \''.$currentFolder.'\');return false;" href="#"><i class="fa fa-trash-o" id="moveIcon_'.$email->header->uid.'"></i></a>';
417  // spam icon
418  $spamIcon = '<a id="spamIconLink_'.$email->header->uid.'" data-toggle="tooltip" data-container="body" title="'.$lang['SPAM'].'" data-original-title="'.$lang['SPAM'].'" onclick="moveMessage('.$email->header->uid.', \''.$currentFolder.'\', \'Junk\');return false;" href="#"><i class="fa fa-filter" id="spamIcon_'.$email->header->uid.'"></i></a>';
419  }
420  elseif ($currentFolder == "junk" || $currentFolder == "Junk" || $currentFolder == "JUNK"
421  || $currentFolder == "spam" || $currentFolder == "Spam" || $currentFolder == "SPAM")
422  {
423  $deleteIcon = '<a id="moveIconLink_'.$email->header->uid.'" data-toggle="tooltip" data-container="body" title="'.$lang['RECYCLE_BIN'].'" data-original-title="'.$lang['RECYCLE_BIN'].'" onclick="moveMessage('.$email->header->uid.', \''.$currentFolder.'\', \'Trash\');return false;" href="#"><i class="fa fa-trash-o" id="moveIcon_'.$email->header->uid.'"></i></a>';
424  // spam icon (move back to inbox)
425  $spamIcon = '<a id="spamIconLink_'.$email->header->uid.'" data-toggle="tooltip" data-container="body" title="'.$lang['MOVE_INBOX'].'" data-original-title="'.$lang['MOVE_INBOX'].'" onclick="moveMessage('.$email->header->uid.', \''.$currentFolder.'\', \'INBOX\');return false;" href="#"><i class="fa fa-inbox" id="spamIcon_'.$email->header->uid.'"></i></a>';
426  }
427  else
428  {
429  // in any other case:
430  $deleteIcon = '<a id="moveIconLink_'.$email->header->uid.'" data-toggle="tooltip" data-container="body" title="'.$lang['RECYCLE_BIN'].'" data-original-title="'.$lang['RECYCLE_BIN'].'" onclick="moveMessage('.$email->header->uid.', \''.$currentFolder.'\', \'Trash\');return false;" href="#"><i class="fa fa-trash-o" id="moveIcon_'.$email->header->uid.'"></i></a>';
431  // spam icon
432  $spamIcon = '<a id="spamIconLink_'.$email->header->uid.'" data-toggle="tooltip" data-container="body" title="'.$lang['SPAM'].'" data-original-title="'.$lang['SPAM'].'" onclick="moveMessage('.$email->header->uid.', \''.$currentFolder.'\', \'Junk\');return false;" href="#"><i class="fa fa-filter" id="spamIcon_'.$email->header->uid.'"></i></a>';
433  }
434 
435  // check if email is flagged
436  if ($email->header->flagged === 0)
437  { // if not, draw open star
438  $starIcon = '<a id="starIconLink_'.$email->header->uid.'" onclick="markAsFlagged('.$email->header->uid.', \'setFlagged\');return false;" href="#"><i id="starIcon_'.$email->header->uid.'" class="fa fa-star-o text-orange"></i></a>';
439  }
440  else
441  { // if mail is flagged, draw full star
442  $starIcon = '<a id="starIconLink_'.$email->header->uid.'" onclick="markAsFlagged('.$email->header->uid.', \'setUnFlagged\');return false;" href="#"><i id="starIcon_'.$email->header->uid.'" class="fa fa-star text-orange"></i></a>';
443  }
444 
445  // echo "<pre>";
446  // print_r($email);
447  // echo "</pre>";
448  // display every email as single table row
449  echo '
450  <tr id="emailRow_'.$email->header->uid.'">
451  <td><div class="icheckbox_flat-blue" aria-checked="false" aria-disabled="false" style="position: relative;"><input type="checkbox" style="position: absolute; opacity: 0;"><ins class="iCheck-helper" style="position: absolute; top: 0%; left: 0%; display: block; width: 100%; height: 100%; margin: 0px; padding: 0px; background: rgb(255, 255, 255); border: 0px; opacity: 0;"></ins></div></td>
452  <td class="mailbox-star">'.$markAsReadIcon.'</td>
453  <td class="mailbox-star">'.$starIcon.'</td>
454  <td id="mailboxName_'.$email->header->msgno.'" class="mailbox-name '.$boldRow.'" style="cursor:pointer;" onclick="window.location=\''.$messageLink.'\';"><a href="#">'.$email->header->from.'</a>
455  <br><small>'.$email->header->details->from[0]->mailbox.'@'.$email->header->details->from[0]->host.'</small></td>
456  <td id="mailboxSubject_'.$email->header->msgno.'" class="mailbox-subject '.$boldRow.'" style="cursor:pointer;" onclick="window.location=\''.$messageLink.'\';">'.$email->header->subject.'</td>
457  <td class="mailbox-attachment text-center">'.$attachClip.'</td>
458  <td class="mailbox-date">'.substr($email->header->date, 0, -6).'<br><small>'.$timeAgo.'</small></td>
459  <td class="mailbox-star">'.$spamIcon.'&nbsp;&nbsp;&nbsp;&nbsp;'.$deleteIcon.'</td>
460  </tr>';
461 
462  }
463  }
464  else
465  {
466  // echo "<b>This folder is empty.</b>";
467  }
468  }
469 
470 
471  /**
472  * Mark email as flagged
473  * @param $imap
474  * @param $uid
475  * @return bool
476  */
477  public function markAsFlagged($imap, $uid)
478  {
479  // /** @param $imap \SSilence\ImapClient\ImapClient */
480  return imap_setflag_full($imap, $uid, "\\Flagged", ST_UID);
481  }
482 
483  /**
484  * Clear flags from email
485  * @param $imap
486  * @param $uid
487  * @return bool
488  */
489  public function removeFlags($imap, $uid)
490  {
491  return imap_clearflag_full($imap, $uid, "\\Flagged", ST_UID);
492  }
493  } // ./class webmail
494 } // ./namespace
if(!isset($db)) $uid
$folder
Definition: actions.php:9
print $lang['FILEMAN_UPLOAD']
$imap
Definition: webmail.php:130
if(!isset($language)||(!isset($lang))) $item
The default pages class. Provide all functions to handle static pages.
Definition: page.php:20
Integrated IMAP Webmail.
Definition: webmail.php:25
drawMailboxControls($imap, $type, $uid, $folder, $lang)
Draw mailbox control buttons (trash, reply, forward...)
Definition: webmail.php:141
deleteMessage($imap, $folder, $uid)
Delete a message. Requires imap handle, folder and uid of the mail to delete.
Definition: webmail.php:85
drawHeaders($emails, $currentFolder, $lang)
Draw email headers (will be used to overview the email list)
Definition: webmail.php:360
drawFolders($imap, $folders)
Draw a list with all folders of this mailbox.
Definition: webmail.php:243
moveMessage($imap, $folder, $targetFolder, $uid)
Move a message from source to target folder. Requires imap handle, source folder, target folder and t...
Definition: webmail.php:36
purgeTrash($imap)
Cleanup trash and spam folder (delete all messages in requested folder)
Definition: webmail.php:120
function window
Definition: fuckAdBlock.js:8
function b(a)
Definition: browser.js:14
$type
This class serves methods to create backup from files.
Definition: AdminLTE.php:2
print $_GET['id']
Definition: page-edit.php:357
function o(e, t, n)
Definition: plyr.js:1
print $tourdates date
$email
Definition: user-new.php:94