59177427 |
1 | <?php |
895905c0 |
2 | |
35586184 |
3 | /** |
4 | * delete_message.php |
5 | * |
76911253 |
6 | * Copyright (c) 1999-2003 The SquirrelMail Project Team |
35586184 |
7 | * Licensed under the GNU GPL. For full terms see the file COPYING. |
8 | * |
65c3ec94 |
9 | * Deletes a meesage from the IMAP server |
35586184 |
10 | * |
11 | * $Id$ |
12 | */ |
ef870322 |
13 | |
86725763 |
14 | /* Path for SquirrelMail required files. */ |
15 | define('SM_PATH','../'); |
16 | |
17 | /* SquirrelMail required files. */ |
08185f2a |
18 | require_once(SM_PATH . 'include/validate.php'); |
86725763 |
19 | require_once(SM_PATH . 'functions/display_messages.php'); |
20 | require_once(SM_PATH . 'functions/imap.php'); |
d3cdb279 |
21 | |
f38b7cf0 |
22 | /* get globals */ |
23 | sqgetGlobalVar('username', $username, SQ_SESSION); |
24 | sqgetGlobalVar('key', $key, SQ_COOKIE); |
25 | sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION); |
26 | |
27 | sqgetGlobalVar('message', $message, SQ_GET); |
28 | sqgetGlobalVar('mailbox', $mailbox, SQ_GET); |
29 | /* end globals */ |
0b97a708 |
30 | |
31 | if (isset($_GET['saved_draft'])) { |
9b761dbd |
32 | $saved_draft = urlencode($_GET['saved_draft']); |
0b97a708 |
33 | } |
34 | if (isset($_GET['mail_sent'])) { |
9b761dbd |
35 | $mail_sent = urlencode($_GET['mail_sent']); |
0b97a708 |
36 | } |
fc266700 |
37 | if (isset($_GET['sort'])) { |
38 | $sort = (int) $_GET['sort']; |
39 | } |
40 | |
41 | if (isset($_GET['startMessage'])) { |
42 | $startMessage = (int) $_GET['startMessage']; |
43 | } |
0b97a708 |
44 | |
45 | if(isset($_GET['where'])) { |
9b761dbd |
46 | $where = urlencode($_GET['where']); |
0b97a708 |
47 | } |
48 | if(isset($_GET['what'])) { |
9b761dbd |
49 | $what = urlencode($_GET['what']); |
0b97a708 |
50 | } |
51 | |
65c3ec94 |
52 | $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); |
53 | |
54 | sqimap_mailbox_select($imapConnection, $mailbox); |
d4467150 |
55 | |
65c3ec94 |
56 | sqimap_messages_delete($imapConnection, $message, $message, $mailbox); |
57 | if ($auto_expunge) { |
58 | sqimap_mailbox_expunge($imapConnection, $mailbox, true); |
59 | } |
9c3e6cd4 |
60 | if (!isset($saved_draft)) { |
61 | $saved_draft = ''; |
62 | } |
acaa9842 |
63 | |
439166c1 |
64 | if (!isset($mail_sent)) { |
65 | $mail_sent = ''; |
66 | } |
67 | |
65c3ec94 |
68 | $location = get_location(); |
7058a2a9 |
69 | |
65c3ec94 |
70 | if (isset($where) && isset($what)) { |
9b761dbd |
71 | header("Location: $location/search.php?where=" . $where . |
72 | '&what=' . $what . '&mailbox=' . urlencode($mailbox)); |
65c3ec94 |
73 | } else { |
854000c0 |
74 | if (!empty($saved_draft) || !empty($mail_sent)) { |
732fd5a4 |
75 | header("Location: $location/compose.php?mail_sent=$mail_sent&saved_draft=$saved_draft"); |
9c3e6cd4 |
76 | } |
77 | else { |
732fd5a4 |
78 | header("Location: $location/right_main.php?sort=$sort&startMessage=$startMessage&mailbox=" . |
e02775fe |
79 | urlencode($mailbox)); |
9c3e6cd4 |
80 | } |
65c3ec94 |
81 | } |
a48fbf9b |
82 | |
65c3ec94 |
83 | sqimap_logout($imapConnection); |
e02775fe |
84 | |
5e9e90fd |
85 | ?> |