1<?php
2// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
3//
4// All Rights Reserved. See copyright.txt for details and a complete list of authors.
5// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
6// $Id$
7
8require_once('tiki-setup.php');
9include_once('lib/notepad/notepadlib.php');
10$access->check_feature('feature_notepad');
11$access->check_user($user);
12$access->check_permission('tiki_p_notepad');
13if (! isset($_REQUEST["noteId"])) {
14	$smarty->assign('msg', tra("No note indicated"));
15	$smarty->display("error.tpl");
16	die;
17}
18if (isset($_REQUEST["save"])) {
19	$disposition = "attachment";
20} else {
21	$disposition = "inline";
22}
23$info = $notepadlib->get_note($user, $_REQUEST["noteId"]);
24header("Content-type: text/plain");
25header("Content-Disposition: $disposition; filename=note_" . urlencode($user) . '_' . $_REQUEST["noteId"] . ".txt;");
26echo $info['data'];
27