}else{
		if(!$task->get($_REQUEST['id'])){
			fatal_error("Could not retreive task!");
			debug_message($task->getLastError());
		}
		if($project->get($task->project_id) === FALSE){
			fatal_error("Could not retreive project!");
			debug_message($project->getLastError());
		}
		if(!$project->hasRights(PROJECT_RIGHT_FULL)){
			fatal_error('Insufficent access rights for this project!');
		}
	}


	if($task->deleteAttachment($_REQUEST['attachment_id']) === FALSE){
		$error_msg .= "Error deleting attachment from project!\n";
		debug_message($task->getLastError());
	}
	if($project->sendUpdateNotification(array("Removed attachment ID ".$_REQUEST['attachment_id'])) === FALSE){
		$error_msg .= "Error sending update notification!\n";
		debug_message($project->getLastError());
	}
	$_REQUEST['mode'] = 'edit';

}else{
	fatal_error("Error: Invalid mode!\n");
}

?>
<? require('header.php'); ?>