<?
//   Wouter van Wijk
//   2004
//
//   This program is free software; you can redistribute it and/or modify
//   it under the terms of the GNU General Public License as published by
//   the Free Software Foundation; either version 2 of the License, or
//   (at your option) any later version.
//
//   This program is distributed in the hope that it will be useful,
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//   GNU General Public License for more details.
//
//   You should have received a copy of the GNU General Public License
//   along with this program; if not, write to the Free Software
//   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
// session check
include('settings.php');
session_start();
if (!isset($_SESSION['user']))
{
	header("Location: error.php?ec=2");
	exit;
}

	$idarray = trim($_GET['id']);
	$action=trim($_GET['action']);

	switch($action) {
		case 'delete':
			$mailbox=$_GET['mailbox'];
			header("Location: mailsplash.php?messagetitle=". urlencode('Message deleted'). '&message='. urlencode($SESSION_MAIL_SERVER));
			moveMessageToTrash($mailbox, $idarray);
			exit;
			break;
		case 'move':
			$sourcemailbox=$_GET['sourcemailbox'];
			$targetmailbox=$_GET['targetmailbox'];
			copymoveMessage($sourcemailbox, $targetmailbox, $idarray, 'move');
			header("Location: mailsplash.php?messagetitle=". urlencode('Message moved'). '&message='. urlencode('From: ' . $sourcemailbox . ', To: '  . $targetmailbox));
			exit;
			break;
		case 'copy':
			$sourcemailbox=$_GET['sourcemailbox'];
			$targetmailbox=$_GET['targetmailbox'];
			copymoveMessage($sourcemailbox, $targetmailbox, $idarray, 'copy');
			header("Location: mailsplash.php?messagetitle=". urlencode('Message copied'). '&message='. urlencode('From: ' . $sourcemailbox . ', To: '  . $targetmailbox));
			exit;
			break;
	}
?>