authPage(); ?> error('Could not send mail to: '.$mail.' | subject: '.$subj); } header('Location: /mail.php'); exit(); } // // Includes // require $VEN_DIR . DIRECTORY_SEPARATOR . 'Mail' . DIRECTORY_SEPARATOR .'Mbox.php'; require $VEN_DIR . DIRECTORY_SEPARATOR . 'Mail' . DIRECTORY_SEPARATOR .'mimeDecode.php'; require $LIB_DIR . DIRECTORY_SEPARATOR . 'Mail.php'; require $LIB_DIR . DIRECTORY_SEPARATOR . 'Sort.php'; if (isset($_GET['get-body']) && is_numeric($_GET['get-body'])) { $messageNumber = $_GET['get-body']; $MyMbox = new \devilbox\Mail('/var/mail/devilbox'); $message = $MyMbox->getMessage($messageNumber-1); $structure = $message['decoded']; $body = null; if (isset($structure->body)) { $body = $structure->body; } elseif(isset($structure->parts[1]->body)) { $body = $structure->parts[1]->body; } elseif(isset($structure->parts[0]->body)) { $body = $structure->parts[0]->body; } exit(json_encode(array( 'raw' => htmlentities($message['raw']), 'body' => $body, ))); } if (isset($_GET['delete']) && is_numeric($_GET['delete'])) { $message = $_GET['delete']; $MyMbox = new \devilbox\Mail('/var/mail/devilbox'); $MyMbox->delete($message); header('Location: /mail.php'); exit(); } // // Setup Sort/Order // // Sort/Order settings $defaultSort = array('sort' => 'date', 'order' => 'DESC'); $allowedSorts = array('date', 'subject', 'x-original-to', 'from'); $allowedOrders = array('ASC', 'DESC'); $GET_sortKeys = array('sort' => 'sort', 'order' => 'order'); // Get sort/order $MySort = new \devilbox\Sort($defaultSort, $allowedSorts, $allowedOrders, $GET_sortKeys); $sort = $MySort->getSort(); $order = $MySort->getOrder(); // Evaluate Sorters/Orderers $orderDate = ''; $orderFrom = ''; $orderTo = ''; $orderSubj = ''; if ($sort == 'date') { if ($order == 'ASC') { $orderDate = ' '; } else { $orderDate = ' '; } } else if ($sort == 'subject') { if ($order == 'ASC') { $orderSubj = ' '; } else { $orderSubj = ' '; } } else if ($sort == 'x-original-to') { if ($order == 'ASC') { $orderTo = ' '; } else { $orderTo = ' '; } } else if ($sort == 'from') { if ($order == 'ASC') { $orderFrom = ' '; } else { $orderFrom = ' '; } } // // Mbox Reader // $MyMbox = new \devilbox\Mail('/var/mail/devilbox'); // If default sort is on, use NULL, so we do not have to sort the mails after retrieval, // because they are being read in the default sort/order anyway $sortOrderArr = $MySort->isDefault($sort, $order) ? null : array($sort => $order); $messages = $MyMbox->get($sortOrderArr); ?>
getHead(true); ?> getNavbar(); ?> getFooter(); ?>