phpdoc updates
[squirrelmail.git] / src / delete_message.php
CommitLineData
59177427 1<?php
895905c0 2
35586184 3/**
4 * delete_message.php
5 *
82d304a0 6 * Copyright (c) 1999-2004 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$
8f6f9ba5 12 * @package squirrelmail
35586184 13 */
ef870322 14
8f6f9ba5 15/** Path for SquirrelMail required files. */
86725763 16define('SM_PATH','../');
17
18/* SquirrelMail required files. */
08185f2a 19require_once(SM_PATH . 'include/validate.php');
86725763 20require_once(SM_PATH . 'functions/display_messages.php');
21require_once(SM_PATH . 'functions/imap.php');
d3cdb279 22
f38b7cf0 23/* get globals */
24sqgetGlobalVar('username', $username, SQ_SESSION);
25sqgetGlobalVar('key', $key, SQ_COOKIE);
26sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION);
27
98a9cc03 28sqgetGlobalVar('message', $message, SQ_FORM);
f38b7cf0 29sqgetGlobalVar('mailbox', $mailbox, SQ_GET);
abafb676 30
98a9cc03 31sqgetGlobalVar('bypass_trash', $bypass_trash, SQ_FORM);
abafb676 32
f38b7cf0 33/* end globals */
0b97a708 34
98a9cc03 35if (sqGetGlobalVar('saved_draft', $tmp, SQ_GET)) {
36 $saved_draft = urlencode($tmp);
0b97a708 37}
98a9cc03 38if (sqGetGlobalVar('mail_sent', $tmp, SQ_GET)) {
39 $mail_sent = urlencode($tmp);
0b97a708 40}
98a9cc03 41if (sqGetGlobalVar('where', $tmp, SQ_FORM)) {
42 $where = urlencode($tmp);
fc266700 43}
98a9cc03 44if (sqGetGlobalVar('what', $tmp, SQ_FORM)) {
45 $what = urlencode($tmp);
fc266700 46}
98a9cc03 47if (sqGetGlobalVar('sort', $tmp, SQ_FORM)) {
48 $sort = (int) $tmp;
0b97a708 49}
98a9cc03 50if (sqGetGlobalVar('startMessage', $tmp, SQ_FORM)) {
51 $startMessage = (int) $tmp;
0b97a708 52}
53
65c3ec94 54$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
55
56sqimap_mailbox_select($imapConnection, $mailbox);
d4467150 57
abafb676 58sqimap_messages_delete($imapConnection, $message, $message, $mailbox,$bypass_trash);
65c3ec94 59if ($auto_expunge) {
60 sqimap_mailbox_expunge($imapConnection, $mailbox, true);
61}
9c3e6cd4 62if (!isset($saved_draft)) {
63 $saved_draft = '';
64}
acaa9842 65
439166c1 66if (!isset($mail_sent)) {
67 $mail_sent = '';
68}
69
65c3ec94 70$location = get_location();
7058a2a9 71
65c3ec94 72if (isset($where) && isset($what)) {
9b761dbd 73 header("Location: $location/search.php?where=" . $where .
74 '&what=' . $what . '&mailbox=' . urlencode($mailbox));
65c3ec94 75} else {
854000c0 76 if (!empty($saved_draft) || !empty($mail_sent)) {
732fd5a4 77 header("Location: $location/compose.php?mail_sent=$mail_sent&saved_draft=$saved_draft");
9c3e6cd4 78 }
79 else {
732fd5a4 80 header("Location: $location/right_main.php?sort=$sort&startMessage=$startMessage&mailbox=" .
e02775fe 81 urlencode($mailbox));
9c3e6cd4 82 }
65c3ec94 83}
a48fbf9b 84
65c3ec94 85sqimap_logout($imapConnection);
e02775fe 86
5e9e90fd 87?>