tiki-notepad_get.php 920 Bytes
Newer Older
awcolley's avatar
awcolley committed
1
<?php
2
// (c) Copyright 2002-2011 by authors of the Tiki Wiki CMS Groupware Project
changi67's avatar
changi67 committed
3
// 
4 5
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
6
// $Id$
changi67's avatar
changi67 committed
7

8 9
require_once ('tiki-setup.php');
include_once ('lib/notepad/notepadlib.php');
10 11 12
$access->check_feature('feature_notepad');
$access->check_user($user);
$access->check_permission('tiki_p_notepad');
13 14
if (!isset($_REQUEST["noteId"])) {
	$smarty->assign('msg', tra("No note indicated"));
15
	$smarty->display("error.tpl");
16 17
	die;
}
18 19 20 21 22
if (isset($_REQUEST["save"])) {
	$disposition = "attachment";
} else {
	$disposition = "inline";
}
23
$info = $notepadlib->get_note($user, $_REQUEST["noteId"]);
changi67's avatar
changi67 committed
24 25
header("Content-type: text/plain");
header("Content-Disposition: $disposition; filename=note_" . urlencode($user) . '_' . $_REQUEST["noteId"] . ".txt;");
awcolley's avatar
awcolley committed
26
echo $info['data'];