|
| 1 | +<?php require '../config.php'; ?> |
| 2 | +<?php loadClass('Helper')->authPage(); ?> |
| 3 | +<?php |
| 4 | + |
| 5 | +// |
| 6 | +// Includes |
| 7 | +// |
| 8 | +require $VEN_DIR . DIRECTORY_SEPARATOR . 'Mail' . DIRECTORY_SEPARATOR .'Mbox.php'; |
| 9 | +require $VEN_DIR . DIRECTORY_SEPARATOR . 'Mail' . DIRECTORY_SEPARATOR .'mimeDecode.php'; |
| 10 | +require $LIB_DIR . DIRECTORY_SEPARATOR . 'Mail.php'; |
| 11 | +require $LIB_DIR . DIRECTORY_SEPARATOR . 'Sort.php'; |
| 12 | + |
| 13 | +// |
| 14 | +// Setup Sort/Order |
| 15 | +// |
| 16 | + |
| 17 | +// Sort/Order settings |
| 18 | +$defaultSort = array('sort' => 'date', 'order' => 'DESC'); |
| 19 | +$allowedSorts = array('date', 'subject', 'x-original-to', 'from'); |
| 20 | +$allowedOrders = array('ASC', 'DESC'); |
| 21 | +$GET_sortKeys = array('sort' => 'sort', 'order' => 'order'); |
| 22 | + |
| 23 | +// Get sort/order |
| 24 | +$MySort = new \devilbox\Sort($defaultSort, $allowedSorts, $allowedOrders, $GET_sortKeys); |
| 25 | +$sort = $MySort->getSort(); |
| 26 | +$order = $MySort->getOrder(); |
| 27 | + |
| 28 | +$body = null; |
| 29 | +if (isset($_GET['mail-id']) && is_numeric($_GET['mail-id'])) { |
| 30 | + $messageNumber = $_GET['mail-id']; |
| 31 | + $MyMbox = new \devilbox\Mail('/var/mail/devilbox'); |
| 32 | + $message = $MyMbox->getMessage($messageNumber-1); |
| 33 | + $structure = $message['decoded']; |
| 34 | + |
| 35 | + if (isset($structure->body)) { |
| 36 | + $body = $structure->body; |
| 37 | + } |
| 38 | + elseif(isset($structure->parts[1]->body)) { |
| 39 | + $body = $structure->parts[1]->body; |
| 40 | + } |
| 41 | + elseif(isset($structure->parts[0]->body)) { |
| 42 | + $body = $structure->parts[0]->body; |
| 43 | + } |
| 44 | +} |
| 45 | +?> |
| 46 | +<?= $body ?: 'No valid body found' ?> |
0 commit comments