1<?php
2	/**************************************************************************\
3	* phpGroupWare - E-Mail *
4	* http://www.phpgroupware.org *
5	* Based on Aeromail by Mark C3ushman <mark@cushman.net> *
6	* http://the.cushman.net/ *
7	* Currently maintained by Angles <angles@phpgroupware.org> *
8	* -------------------------------------------- *
9	* This program is free software; you can redistribute it and/or modify it *
10	* under the terms of the GNU General Public License as published by the *
11	* Free Software Foundation; either version 2 of the License, or (at your *
12	* option) any later version.  *
13	\**************************************************************************/
14	/* $Id: compose.php 21073 2010-03-25 22:51:26Z Caeies $ */
15
16	Header('Cache-Control: no-cache');
17	Header('Pragma: no-cache');
18	Header('Expires: Sat, Jan 01 2000 01:01:01 GMT');
19
20	$GLOBALS['phpgw_info']['flags'] = array(
21		'currentapp' => 'email',
22		'noheader' => True,
23		'nofooter' => True,
24		'nonavbar' => True,
25		'noappheader' => True,
26		'noappfooter' => True
27	);
28	include('../header.inc.php');
29
30	// we need a msg object BUT NO LOGIN IS NEEDED
31	$my_msg_bootstrap = '';
32	$my_msg_bootstrap = CreateObject("email.msg_bootstrap");
33	$my_msg_bootstrap->set_do_login(False);
34	$my_msg_bootstrap->ensure_mail_msg_exists('email: compose.php', 0);
35
36	// time limit should be controlled elsewhere
37	//@set_time_limit(0);
38	$pass_the_ball_uri = '';
39
40	if ($GLOBALS['phpgw']->msg->get_isset_arg('fldball'))
41	{
42		$my_fldball = $GLOBALS['phpgw']->msg->get_arg_value('fldball');
43		$pass_the_ball_uri = '&fldball[folder]='.$my_fldball['folder']
44						.'&fldball[acctnum]='.$my_fldball['acctnum'];
45	}
46	elseif ($GLOBALS['phpgw']->msg->get_isset_arg('msgball'))
47	{
48		$my_msgball = $GLOBALS['phpgw']->msg->get_arg_value('msgball');
49		$pass_the_ball_uri = '&msgball[folder]='.$my_msgball['folder']
50						.'&msgball[acctnum]='.$my_msgball['acctnum']
51						.'&msgball[msgnum]='.$my_msgball['msgnum'];
52	}
53	else
54	{
55		$pass_the_ball_uri = '&fldball[folder]=INBOX'
56						.'&fldball[acctnum]=0';
57	}
58
59	header('Location: '.$GLOBALS['phpgw']->link(
60				'/index.php',
61				'menuaction=email.uicompose.compose'.
62				 $pass_the_ball_uri.
63				'&to='.$to.
64				'&cc='.$cc.
65				'&bcc='.$bcc.
66				'&subject='.$subject.
67				'&body='.$body.
68				'&personal='.$personal.
69				'&sort='.$sort.
70				'&order='.$order.
71				'&start='.$start));
72
73	if (is_object($GLOBALS['phpgw']->msg))
74	{
75		$terminate = True;
76	}
77	else
78	{
79		$terminate = False;
80	}
81
82	if ($terminate == True)
83	{
84		// close down ALL mailserver streams
85		$GLOBALS['phpgw']->msg->end_request();
86		// destroy the object
87		$GLOBALS['phpgw']->msg = '';
88		unset($GLOBALS['phpgw']->msg);
89	}
90	// shut down this transaction
91	$GLOBALS['phpgw']->common->phpgw_exit(False);
92
93?>
94