tiki-notepad_write.php 1.62 KB
Newer Older
awcolley's avatar
awcolley committed
1
<?php
changi67's avatar
changi67 committed
2 3 4
/**
 * @package tikiwiki
 */
5
// (c) Copyright 2002-2016 by authors of the Tiki Wiki CMS Groupware Project
changi67's avatar
changi67 committed
6
// 
7 8
// 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.
9
// $Id$
changi67's avatar
changi67 committed
10

11
$section = 'mytiki';
12 13
require_once ('tiki-setup.php');
include_once ('lib/notepad/notepadlib.php');
14 15 16
$access->check_feature('feature_notepad');
$access->check_user($user);
$access->check_permission('tiki_p_notepad');
17
if (isset($_REQUEST["remove"])) {
18
	check_ticket('notepad-write');
19
	$notepadlib->remove_note($user, $_REQUEST['remove']);
awcolley's avatar
awcolley committed
20
}
21
include 'lib/setup/editmode.php';
22
if (isset($_REQUEST["noteId"])) {
23
	$info = $notepadlib->get_note($user, $_REQUEST["noteId"]);
changi67's avatar
changi67 committed
24
	if ($info['parse_mode'] == 'raw') {
25
		$info['parsed'] = nl2br(htmlspecialchars($info['data']));
26
		$smarty->assign('wysiwyg', 'n');
27
	} else $info['parsed'] = $tikilib->parse_data($info['data'], array('is_html' => $is_html));
awcolley's avatar
awcolley committed
28
} else {
29 30 31
	$info = array();
	$info['name'] = '';
	$info['data'] = '';
32
	$info['parse_mode'] = 'wiki';
awcolley's avatar
awcolley committed
33
}
34
if (isset($_REQUEST['save'])) {
35
	check_ticket('notepad-write');
36 37
	$noteId = $notepadlib->replace_note($user, isset($_REQUEST["noteId"]) ? $_REQUEST["noteId"] : 0, $_REQUEST["name"], $_REQUEST["data"], $_REQUEST["parse_mode"]);
	header('location: tiki-notepad_read.php?noteId=' . $noteId);
38
	die;
awcolley's avatar
awcolley committed
39
}
40 41
$smarty->assign('noteId', $_REQUEST["noteId"]);
$smarty->assign('info', $info);
42
include_once ('tiki-section_options.php');
43
include_once ('tiki-mytiki_shared.php');
44
ask_ticket('notepad-write');
45
$smarty->assign('mid', 'tiki-notepad_write.tpl');
46
$smarty->display("tiki.tpl");