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