Source for file move_messages.php
Documentation is available at move_messages.php
* Copyright (c) 1999-2006 The SquirrelMail Project Team
* Licensed under the GNU GPL. For full terms see the file COPYING.
* Enables message moving between folders on the IMAP server.
* $Id: move_messages.php,v 1.81.2.11 2006/05/13 20:01:15 tokul Exp $
/* Path for SquirrelMail required files. */
/* SquirrelMail required files. */
require_once(SM_PATH .
'include/validate.php');
require_once(SM_PATH .
'functions/global.php');
require_once(SM_PATH .
'functions/display_messages.php');
require_once(SM_PATH .
'functions/imap.php');
require_once(SM_PATH .
'functions/html.php');
if (!isset
($compose_messages)) {
$compose_messages =
array();
$hashed_attachment_dir =
getHashedDir($username, $attachment_dir, $composesession);
if ($thread_sort_messages ||
$allow_server_sort) {
$start_index =
($startMessage-
1) *
$show_num;
$hashed_attachment_dir =
getHashedDir($username, $attachment_dir);
$composeMessage->rfc822_header =
$rfc822_header;
$composeMessage->reply_rfc822_header =
'';
while ($j <
count($msg)) {
$body_a =
sqimap_run_command($imapConnection, "FETCH $id RFC822",true, $response, $readmessage, $uid_support);
// fetch the subject for the message with $id from msgs.
// is there a more efficient way to do this?
foreach($msgs as $k =>
$vals) {
$subject =
$msgs[$k]['SUBJECT'];
$full_localfilename =
"$hashed_attachment_dir/$localfilename";
$fp =
fopen( $full_localfilename, 'wb');
$composeMessage->initAttachment('message/rfc822',$subject.
'.msg',
$compose_messages[$composesession] =
$composeMessage;
$imapConnection =
sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
$location =
set_url_var($location,'composenew',0,false);
$location =
set_url_var($location,'composesession',0,false);
// make sure that cache is not used
$location =
set_url_var($location,'use_mailbox_cache',0,false);
/* remember changes to mailbox setting */
if (!isset
($lastTargetMailbox)) {
$lastTargetMailbox =
'INBOX';
if ($targetMailbox !=
$lastTargetMailbox) {
$lastTargetMailbox =
$targetMailbox;
Move msg list sorting up here, as it is used several times,
makes it more efficient to do it in one place for the code
foreach( $msg as $key=>
$uid ) {
// using foreach removes the risk of infinite loops that was there //
// expunge-on-demand if user isn't using move_to_trash or auto_expunge
if(isset
($expungeButton)) {
if (($startMessage+
$cnt-
1) >=
$mbx_response['EXISTS']) {
if ($startMessage >
$show_num) {
$location =
set_url_var($location,'startMessage',$startMessage-
$show_num,false);
$location =
set_url_var($location,'startMessage',1,false);
} elseif(isset
($undeleteButton)) {
// undelete messages if user isn't using move_to_trash or auto_expunge
// Removes \Deleted flag from selected messages
} elseif (!isset
($moveButton)) {
} else if (isset
($markUnread)) {
if (($startMessage+
$cnt-
1) >=
$mbx_response['EXISTS']) {
if ($startMessage >
$show_num) {
$location =
set_url_var($location,'startMessage',$startMessage-
$show_num, false);
$location =
set_url_var($location,'startMessage',1, false);
$location =
set_url_var($location, 'session', $composesession, false);
$location =
set_url_var($location, 'composenew', 1, false);
$location =
str_replace('search.php','compose.php',$location);
$location =
str_replace('right_main.php','compose.php',$location);
} else { // Move messages
// move messages only when target mailbox is not the same as source mailbox
if ($mailbox!=
$targetMailbox) {
if (($startMessage+
$cnt-
1) >=
$mbx_response['EXISTS']) {
if ($startMessage >
$show_num) {
$location =
set_url_var($location,'startMessage',$startMessage-
$show_num, false);
$location =
set_url_var($location,'startMessage',1, false);
error_message(_("No messages were selected."), $mailbox, $sort, $startMessage, $color);
header("Location: $location");
Documentation generated on Sat, 07 Oct 2006 16:32:38 +0300 by phpDocumentor 1.3.0RC6