$msgs = $_REQUEST['id']; // If a value exists in the array, start to move the messages. if ($msgs[0]) { $mail->login(); // Loop through the selected msgs to move, the new folder to move to // is seperated by :: . e.g 56::Trash , msg 56 from the Trash folder foreach ($msgs as $id) { if (preg_match('/::(.*)/', $id, $m)) { $folder = $m[1]; } $id = preg_replace('/::.*/', '', $id); // Don't move messages if we are already in the same folder if ($folder == $var['newfolder']) { continue; } $mail->move($id, $folder, $var['newfolder']); $var['move']++; } print $atmail->parse("html/{$atmail->Language}/{$atmail->LoginType}/searchmove.html", $var); $atmail->end(); } // apend 'search_' to the function name passed via $_REQUEST so that // user cannot call some arbitrary function such as 'phpinfo()' $func = 'search_' . $_REQUEST['func']; // check that the requested function exists then call it if (function_exists($func)) { $func(); } else { die("the function <b>'{$func}'</b> is not defined"); } $atmail->end();
// Also strip the @ for Groups foreach (array('EmailTo', 'EmailCC', 'EmailBCC') as $v) { $key = strtolower($v); $var[$key] = str_replace(array('<', '>'), array('<', '>'), $sendmsg->{$v}); $var[$key] = preg_replace('/@((Shared)?Group)(?=[^a-zA-Z0-9\\-.]*)/', '$1', $var[$key]); $var[$key] = $mail->quote_header($var[$key]); } // Receive a list of recipients from the user $var['AddRecipients'] = $sendmsg->AddRecipients; // Quote the email-message, subject & to fields ( e.g if in another language like Japanese ) #$var['emailmessage'] = Atmail::GetMail->decode_language("", $var['emailmessage'] ); $var['emailsubject'] = $mail->quote_header($sendmsg->EmailSubject); // If the user is replying to a draft, delete the original copy from the server if ($var['DraftID']) { // Remove the message from the drafts folder $mail->move($var['DraftID'], "Drafts", "erase", 1); } // Fix for IMAP update UIDL if (!empty($var['id'])) { $update_id = $pref['install_type'] != "server" && $mail->Type == 'imap' ? $var['id'] : "cur/{$var['UIDL']}"; // Update the email UIDL/unique-id if the message is a reply or forward $mail->updateuidl($var['UIDL'], $var['type'], '', "Inbox", $update_id); } // Log the sent message only if not in server mode if (!$_REQUEST['Draft']) { $log->write_log("SendMail", "{$_SERVER['REMOTE_ADDR']}:{$var['emailto']} {$var['emailcc']} {$var['emailbcc']}"); } // Append the message to the server $sentuid = $mail->append($sendmsg->EmailBox, $sendmsg->headers . "\r\n\r\n" . $sendmsg->body); //$mail->mailer->markAsFlag($sentuid, '+FLAGS', '\\Answered'); // Display the sent-message template to the user
$count = 0; $cnt = 0; $var['moved_status'] = true; foreach ($msgs as $id) { if (strpos($id, '::') !== false) { $tmp = explode('::', $id); $var['folder'] = $tmp[1]; $arr[0] = $tmp[0]; $arr[1] = $tmp[2]; } else { $arr = explode(":", $id); } $cnt++; if ($arr[1] && !$count) { // Move the selected message, but first check the sequence number/uidl matches the message header if ($mail->move($arr[0], $var['folder'], $var['newfolder'], $atmail->AutoTrash, $arr[1]) === false) { $var['moved_status'] = false; } else { $cnt++; } } else { // Move the selected message if ($mail->move($arr[0], $var['folder'], $var['newfolder'], $atmail->AutoTrash) === false) { $var['moved_status'] = false; } else { $cnt++; } } $uniqueid = $arr[0]; $uniqueid = preg_replace('/:2.*/', '', $uniqueid); //$var['folder'] =~ s/'/\'/g;
// Automatically delete messages if AutoTrash is defined $count = 0; $cnt = 0; foreach ($msgs as $id) { if (strpos($id, '::') !== false) { $tmp = explode('::', $id); //$var['folder'] = $tmp[1]; $arr[0] = $tmp[0]; //$arr[1] = $tmp[2]; } else { $arr = explode(":", $id); } $cnt++; if ($arr[1] && !$count) { // Move the selected message, but first check the sequence number/uidl matches the message header $mail->move($arr[0], $var['folder'], $var['newfolder'], $atmail->AutoTrash, $arr[1]); } else { // Move the selected message $mail->move($arr[0], $var['folder'], $var['newfolder'], $atmail->AutoTrash); } $uniqueid = $arr[0]; $uniqueid = preg_replace('/:2.*/', '', $uniqueid); //$var['folder'] =~ s/'/\'/g; $var['folder'] = addslashes($var['folder']); } // If this is an Ajax call, print the header, then exit if ($atmail->Ajax && $var['newfolder']) { $var['folder'] = str_replace('&', '&', $var['folder']); print <<<EOF <?xml version="1.0" ?> <MovedMsgs>