| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * delete_message.php |
| 5 | * |
| 6 | * Copyright (c) 1999-2002 The SquirrelMail Project Team |
| 7 | * Licensed under the GNU GPL. For full terms see the file COPYING. |
| 8 | * |
| 9 | * Deletes a meesage from the IMAP server |
| 10 | * |
| 11 | * $Id$ |
| 12 | */ |
| 13 | |
| 14 | /* Path for SquirrelMail required files. */ |
| 15 | define('SM_PATH','../'); |
| 16 | |
| 17 | /* SquirrelMail required files. */ |
| 18 | require_once(SM_PATH . 'include/validate.php'); |
| 19 | require_once(SM_PATH . 'functions/display_messages.php'); |
| 20 | require_once(SM_PATH . 'functions/imap.php'); |
| 21 | |
| 22 | $key = $_COOKIE['key']; |
| 23 | $username = $_SESSION['username']; |
| 24 | $onetimepad = $_SESSION['onetimepad']; |
| 25 | |
| 26 | $message = $_GET['message']; |
| 27 | $mailbox = $_GET['mailbox']; |
| 28 | |
| 29 | if (isset($_GET['saved_draft'])) { |
| 30 | $saved_draft = $_GET['saved_draft']; |
| 31 | } |
| 32 | if (isset($_GET['mail_sent'])) { |
| 33 | $mail_sent = $_GET['mail_sent']; |
| 34 | } |
| 35 | $sort = $_GET['sort']; |
| 36 | $startMessage = $_GET['startMessage']; |
| 37 | |
| 38 | if(isset($_GET['where'])) { |
| 39 | $where = $_GET['where']; |
| 40 | } |
| 41 | if(isset($_GET['what'])) { |
| 42 | $what = $_GET['what']; |
| 43 | } |
| 44 | |
| 45 | $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); |
| 46 | |
| 47 | sqimap_mailbox_select($imapConnection, $mailbox); |
| 48 | |
| 49 | sqimap_messages_delete($imapConnection, $message, $message, $mailbox); |
| 50 | if ($auto_expunge) { |
| 51 | sqimap_mailbox_expunge($imapConnection, $mailbox, true); |
| 52 | } |
| 53 | if (!isset($saved_draft)) { |
| 54 | $saved_draft = ''; |
| 55 | } |
| 56 | |
| 57 | if (!isset($mail_sent)) { |
| 58 | $mail_sent = ''; |
| 59 | } |
| 60 | |
| 61 | $location = get_location(); |
| 62 | |
| 63 | if (isset($where) && isset($what)) { |
| 64 | header("Location: $location/search.php?where=" . urlencode($where) . |
| 65 | '&what=' . urlencode($what) . '&mailbox=' . urlencode($mailbox)); |
| 66 | } else { |
| 67 | if (!empty($saved_draft) || !empty($mail_sent)) { |
| 68 | header("Location: $location/compose.php?mail_sent=$mail_sent&saved_draft=$saved_draft"); |
| 69 | } |
| 70 | else { |
| 71 | header("Location: $location/right_main.php?sort=$sort&startMessage=$startMessage&mailbox=" . |
| 72 | urlencode($mailbox)); |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | sqimap_logout($imapConnection); |
| 77 | |
| 78 | ?> |