<?php
// +-------------------------------------------------------------+
// | HiveMail™ version 1.3.1
// +-------------------------------------------------------------+
// | HIVEMAIL™ IS NOT FREE SOFTWARE
// | If you have downloaded this software from a website other
// | than Hivemail or if you have otherwise received
// | this software from someone who is not a representative of
// | this organization you are involved in an illegal activity.
// +-------------------------------------------------------------+
// | $RCSfile: compose.draft.php,v $ - $Revision: 1.15 $
// | $Date: 2004/07/21 02:49:32 $ - $Author: tubedogg $
// +-------------------------------------------------------------+

error_reporting(E_ALL & ~E_NOTICE);
$templatesused = 'redirect_draftsaved,redirect_draftdeleted';
require_once('./global.php');

// ############################################################################
$draft = getinfo('draft', $draftid);

// Is it already a draft or are we to make it one?
if ($draft['dateline'] == 0 and empty($updatedraft)) {
	$DB_site->query("
		DELETE FROM hive_draft
		WHERE draftid = $draftid
	");
	rebuild_drafts_cache();

	eval(makeredirect("redirect_draftdeleted", INDEX_FILE));
} else {
	if ($data['html']) {
		$data['message'] = $message;
	}

	$DB_site->query("
		UPDATE hive_draft
		SET dateline = 0, data = '".addslashes(base64_encode(serialize($data)))."'
		WHERE draftid = $draftid
	");
	rebuild_drafts_cache();

	eval(makeredirect("redirect_draftsaved", INDEX_FILE));
}

?>