removing version info from login_error page.
[squirrelmail.git] / src / delete_message.php
1 <?php
2
3 /**
4 * delete_message.php
5 *
6 * Copyright (c) 1999-2005 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 * @version $Id$
12 * @package squirrelmail
13 */
14
15 /**
16 * Path for SquirrelMail required files.
17 * @ignore
18 */
19 define('SM_PATH','../');
20
21 /* SquirrelMail required files. */
22 require_once(SM_PATH . 'include/validate.php');
23 require_once(SM_PATH . 'functions/display_messages.php');
24 require_once(SM_PATH . 'functions/imap.php');
25
26 /* get globals */
27 sqgetGlobalVar('username', $username, SQ_SESSION);
28 sqgetGlobalVar('key', $key, SQ_COOKIE);
29 sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION);
30
31 sqgetGlobalVar('message', $message, SQ_FORM);
32 sqgetGlobalVar('mailbox', $mailbox, SQ_GET);
33
34 sqgetGlobalVar('bypass_trash', $bypass_trash, SQ_FORM);
35
36 /* end globals */
37
38 if (sqGetGlobalVar('saved_draft', $tmp, SQ_GET)) {
39 $saved_draft = urlencode($tmp);
40 }
41 if (sqGetGlobalVar('mail_sent', $tmp, SQ_GET)) {
42 $mail_sent = urlencode($tmp);
43 }
44 if (sqGetGlobalVar('where', $tmp, SQ_FORM)) {
45 $where = urlencode($tmp);
46 }
47 if (sqGetGlobalVar('what', $tmp, SQ_FORM)) {
48 $what = urlencode($tmp);
49 }
50 if (sqGetGlobalVar('sort', $tmp, SQ_FORM)) {
51 $sort = (int) $tmp;
52 }
53 if (sqGetGlobalVar('startMessage', $tmp, SQ_FORM)) {
54 $startMessage = (int) $tmp;
55 }
56
57 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
58
59 sqimap_mailbox_select($imapConnection, $mailbox);
60
61 sqimap_messages_delete($imapConnection, $message, $message, $mailbox,$bypass_trash);
62 if ($auto_expunge) {
63 sqimap_mailbox_expunge($imapConnection, $mailbox, true);
64 }
65 if (!isset($saved_draft)) {
66 $saved_draft = '';
67 }
68
69 if (!isset($mail_sent)) {
70 $mail_sent = '';
71 }
72
73 $location = get_location();
74
75 if (isset($where) && isset($what)) {
76 header("Location: $location/search.php?where=" . $where .
77 '&what=' . $what . '&mailbox=' . urlencode($mailbox));
78 }
79
80 header("Location: $location/right_main.php?sort=$sort&startMessage=$startMessage&mailbox=" .
81 urlencode($mailbox));
82
83 sqimap_logout($imapConnection);
84
85 ?>