This blob has been accessed 390 times via Git panel.
- <?php
- session_start();
- if (!isset($_SESSION['logged_uid']) or !isset($_SESSION['logged_lvl']) or !isset($_SESSION['logged_key']) or ($_SESSION['logged_lvl'] != "subscriber")) {
- exit;
- }
- $conn = '{127.0.0.1:143/imap/notls/norsh}';
- $mbox = imap_open($conn, $_SESSION['logged_uid'], $_SESSION['logged_key'], OP_HALFOPEN) or die("can't connect: " . imap_last_error());
- echo "<div class=\"folders\"><table border=\"0\" cellspacing=\"1\" callpadding=\"2\">";
- echo "<form method=\"post\">";
- echo "<input type=\"hidden\" name=\"new\" value=\"1\">";
- echo "<tr><td width=\"32\"><input type=\"image\" src=\"images/mail-new.png\"></td><td>Compose</td></tr>";
- echo "</form>";
- if (!isset($_POST['get']) and !isset($_POST['rep'])) {
- $mbox_prev = $mbox_min - $mbox_ppg;
- if ($mbox_prev >= 0) {
- echo "<form method=\"post\">";
- echo "<input type=\"hidden\" name=\"mbox_min\" value=\"$mbox_prev\">";
- echo "<input type=\"hidden\" name=\"box\" value=\"$folder\">";
- if (isset($_POST['imap_search_query']) and !empty($_POST['imap_search_query']) and isset($_POST['imap_search_where']) and !empty($_POST['imap_search_where'])) {
- echo "<input type=\"hidden\" name=\"imap_search_query\" value=\"{$_POST['imap_search_query']}\">";
- echo "<input type=\"hidden\" name=\"imap_search_where\" value=\"{$_POST['imap_search_where']}\">";
- }
- //echo "<tr><td width=\"32\"><input type=\"image\" src=\"images/mail-next.png\"></td><td>Prev $mbox_ppg Msgs</td></tr>";
- echo "<tr><td width=\"32\"><input type=\"image\" src=\"images/mail-next.png\"></td><td>Prev</td></tr>";
- echo "</form>";
- }
- $mbox_next = $mbox_min + $mbox_ppg;
- if ($mbox_next < $msgCount) {
- if (($msgCount - $mbox_next) < $mbox_ppg) {
- $mbox_ppg = $msgCount - $mbox_next;
- }
- echo "<form method=\"post\">";
- echo "<input type=\"hidden\" name=\"mbox_min\" value=\"$mbox_next\">";
- echo "<input type=\"hidden\" name=\"box\" value=\"$folder\">";
- if (isset($_POST['imap_search_query']) and !empty($_POST['imap_search_query']) and isset($_POST['imap_search_where']) and !empty($_POST['imap_search_where'])) {
- echo "<input type=\"hidden\" name=\"imap_search_query\" value=\"{$_POST['imap_search_query']}\">";
- echo "<input type=\"hidden\" name=\"imap_search_where\" value=\"{$_POST['imap_search_where']}\">";
- }
- //echo "<tr><td width=\"32\"><input type=\"image\" src=\"images/mail-prev.png\"></td><td>Next $mbox_ppg Msgs</td></tr>";
- echo "<tr><td width=\"32\"><input type=\"image\" src=\"images/mail-prev.png\"></td><td>Next</td></tr>";
- echo "</form>";
- }
- }
- if ($_POST['box'] == "Trash") {
- $trash_status = imap_status($mbox, "{$conn}Trash", SA_MESSAGES+SA_UNSEEN);
- if ($trash_status->messages > 0) {
- echo "<form method=\"post\">";
- echo "<input type=\"hidden\" name=\"emt\" value=\"1\">";
- echo "<input type=\"hidden\" name=\"box\" value=\"Trash\">";
- echo "<tr><td width=\"32\"><input type=\"image\" src=\"images/trashcan_purge.png\"></td><td><nobr>Empty Trash</nobr></td></tr>";
- echo "</form>";
- }
- }
- echo "</table></div>";
- echo "<div style=\"height: 4px;\"></div>";
- echo "<div class=\"folders\"><table border=\"0\" cellspacing=\"0\" callpadding=\"0\">";
- echo "<form method=\"post\">";
- echo "<input type=\"hidden\" name=\"dig\" value=\"1\">";
- echo "<input type=\"hidden\" name=\"box\" value=\"$folder\">";
- echo "<tr><td width=\"32\"><input type=\"image\" src=\"images/mail-search.png\"></td><td>Search</td></tr>";
- echo "</form>";
- echo "</table></div>";
- echo "<div style=\"height: 4px;\"></div>";
- $folders = imap_list($mbox, $conn, "*");
- if (is_array($folders)) {
- if (in_array("{$conn}INBOX",$folders)) {
- $inbox = array_search("{$conn}INBOX",$folders);
- unset($folders[$inbox]);
- unset($inbox);
- }
- sort($folders);
- array_unshift($folders,"{$conn}INBOX");
- reset($folders);
- echo "\n\n<div class=\"folders\"><table border=\"0\" cellspacing=\"1\" callpadding=\"2\">";
- foreach ($folders as $folder) {
- $status = imap_status($mbox, $folder, SA_MESSAGES+SA_UNSEEN);
- $status_folder = "(" . $status->unseen . "/" . $status->messages . ")";
- $folder = str_replace($conn,"",$folder);
- echo "<tr><form method=\"post\"><td align=\"center\"><input type=\"hidden\" name=\"box\" value=\"$folder\">";
- if ((!isset($_POST['box']) and ($folder == "INBOX")) or (isset($_POST['box']) and ($_POST['box'] == $folder))) {
- echo "<input type=\"image\" src=\"images/folder-open.png\"></td></form>";
- echo "<td><nobr><b>$folder</b> $status_folder</nobr></td></tr>";
- }
- else {
- echo "<input type=\"image\" src=\"images/folder-close.png\"></td></form>";
- echo "<td><nobr>$folder $status_folder</nobr></td></tr>";
- }
- }
- echo "</table></div>";
- }
- else {
- echo "imap_getmailboxes failed: " . imap_last_error() . "\n";
- }
- imap_close($mbox);
- echo "<div style=\"height: 4px;\"></div>";
- echo "<div class=\"folders\"><table border=\"0\" cellspacing=\"0\" callpadding=\"0\">";
- echo "<form method=\"post\">";
- echo "<input type=\"hidden\" name=\"set\" value=\"1\">";
- echo "<tr><td width=\"34\"><input type=\"image\" src=\"images/mail-settings.png\"></td><td>Settings</td></tr>";
- echo "</form>";
- echo "</table></div>";
- ?>