Source for file delete_message.php

Documentation is available at delete_message.php

  1. <?php
  2.  
  3. /**
  4.  * delete_message.php
  5.  *
  6.  * Deletes a meesage from the IMAP server
  7.  *
  8.  * @copyright 1999-2014 The SquirrelMail Project Team
  9.  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  10.  * @version $Id: delete_message.php 14436 2014-01-21 21:30:59Z pdontthink $
  11.  * @package squirrelmail
  12.  */
  13.  
  14. /**
  15.  * Path for SquirrelMail required files.
  16.  * @ignore
  17.  */
  18. define('SM_PATH','../');
  19.  
  20. /* SquirrelMail required files. */
  21. require_once(SM_PATH 'include/validate.php');
  22. require_once(SM_PATH 'functions/display_messages.php');
  23. require_once(SM_PATH 'functions/imap.php');
  24.  
  25. /* get globals */
  26. sqgetGlobalVar('username'$usernameSQ_SESSION);
  27. sqgetGlobalVar('key'$keySQ_COOKIE);
  28. sqgetGlobalVar('onetimepad'$onetimepadSQ_SESSION);
  29.  
  30. sqgetGlobalVar('message'$messageSQ_GET);
  31. sqgetGlobalVar('mailbox'$mailboxSQ_GET);
  32. if (!sqgetGlobalVar('smtoken',$submitted_tokenSQ_GET)) {
  33.     $submitted_token '';
  34. }
  35. /* end globals */
  36.  
  37. if (isset($_GET['saved_draft'])) {
  38.     $saved_draft urlencode($_GET['saved_draft']);
  39. }
  40. if (isset($_GET['mail_sent'])) {
  41.     $mail_sent urlencode($_GET['mail_sent']);
  42. }
  43. if (isset($_GET['where'])) {
  44.     $where urlencode($_GET['where']);
  45. }
  46. if (isset($_GET['what'])) {
  47.     $what urlencode($_GET['what']);
  48. }
  49. if (isset($_GET['sort'])) {
  50.     $sort = (int) $_GET['sort'];
  51. }
  52. if (isset($_GET['startMessage'])) {
  53.     $startMessage = (int) $_GET['startMessage'];
  54. }
  55.  
  56. // first, validate security token
  57. sm_validate_security_token($submitted_token-1TRUE);
  58.  
  59. global $imap_stream_options// in case not defined in config
  60. $imapConnection sqimap_login($username$key$imapServerAddress$imapPort0$imap_stream_options);
  61.  
  62. sqimap_mailbox_select($imapConnection$mailbox);
  63.  
  64. sqimap_msgs_list_delete($imapConnection$mailbox$message);
  65. if ($auto_expunge{
  66.     sqimap_mailbox_expunge($imapConnection$mailboxtrue);
  67. }
  68. sqimap_logout($imapConnection);
  69.  
  70. if (!isset($saved_draft)) {
  71.     $saved_draft '';
  72. }
  73.  
  74. if (!isset($mail_sent)) {
  75.     $mail_sent '';
  76. }
  77.  
  78. $location get_location();
  79.  
  80. if (isset($where&& isset($what)) {
  81.     header("Location: $location/search.php?where=$where .
  82.            '&smtoken=' sm_generate_security_token(.
  83.            '&what=' $what '&mailbox=' urlencode($mailbox));
  84. else {
  85.     if (!empty($saved_draft|| !empty($mail_sent)) {
  86.           if ($compose_new_win == '1')
  87.               header("Location: $location/compose.php?mail_sent=$mail_sent&saved_draft=$saved_draft");
  88.           else
  89.               header("Location: $location/right_main.php?mail_sent=$mail_sent&saved_draft=$saved_draft");
  90.     }
  91.     else {
  92.         header("Location: $location/right_main.php?sort=$sort&startMessage=$startMessage&mailbox=.
  93.                urlencode($mailbox));
  94.     }
  95. }

Documentation generated on Sat, 19 Apr 2014 04:20:36 +0200 by phpDocumentor 1.4.3