tiki-admin_html_pages.php 3.51 KB
Newer Older
1
<?php
2 3
// (c) Copyright 2002-2009 by authors of the Tiki Wiki/CMS/Groupware Project
// 
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: /cvsroot/tikiwiki/tiki/tiki-admin_html_pages.php,v 1.16.2.1 2007-10-29 22:14:01 pkdille Exp $
7 8
require_once ('tiki-setup.php');
include_once ('lib/htmlpages/htmlpageslib.php');
9
if ($prefs['feature_html_pages'] != 'y') {
10 11 12
	$smarty->assign('msg', tra("This feature is disabled") . ": feature_html_pages");
	$smarty->display("error.tpl");
	die;
13
}
14
if ($tiki_p_edit_html_pages != 'y') {
15 16 17 18
	$smarty->assign('errortype', 401);
	$smarty->assign('msg', tra("You do not have permission to use this feature"));
	$smarty->display("error.tpl");
	die;
19
}
changi67's avatar
changi67 committed
20
include_once ("textareasize.php");
21
if (!isset($_REQUEST["pageName"])) {
22
	$_REQUEST["pageName"] = '';
23
}
24 25
$smarty->assign('pageName', $_REQUEST["pageName"]);
if ($_REQUEST["pageName"]) {
26
	$info = $htmlpageslib->get_html_page($_REQUEST["pageName"]);
27
} else {
28 29 30 31 32
	$info = array();
	$info["pageName"] = '';
	$info["content"] = '';
	$info["refresh"] = 0;
	$info["type"] = 's';
33
}
34 35
$smarty->assign('info', $info);
if (isset($_REQUEST["remove"])) {
36 37 38 39 40 41 42
	$area = 'delhtmlpage';
	if ($prefs['feature_ticketlib2'] != 'y' or (isset($_POST['daconfirm']) and isset($_SESSION["ticket_$area"]))) {
		key_check($area);
		$htmlpageslib->remove_html_page($_REQUEST["remove"]);
	} else {
		key_get($area);
	}
43
}
44
if (isset($_REQUEST["templateId"]) && $_REQUEST["templateId"] > 0) {
45 46 47
	$template_data = $tikilib->get_template($_REQUEST["templateId"]);
	$_REQUEST["content"] = $template_data["content"];
	$_REQUEST["preview"] = 1;
48
}
49 50
$smarty->assign('preview', 'n');
if (isset($_REQUEST["preview"])) {
51 52 53 54 55 56 57 58 59
	$smarty->assign('preview', 'y');
	//$parsed = $tikilib->parse_data($_REQUEST["content"]);
	$parsed = $htmlpageslib->parse_html_page($_REQUEST["pageName"], $_REQUEST["content"]);
	$smarty->assign('parsed', $parsed);
	$info["content"] = $_REQUEST["content"];
	$info["refresh"] = $_REQUEST["refresh"];
	$info["pageName"] = $_REQUEST["pageName"];
	$info["type"] = $_REQUEST["type"];
	$smarty->assign('info', $info);
60
}
61
if (isset($_REQUEST["save"]) && !empty($_REQUEST["pageName"])) {
62 63 64 65 66 67 68 69
	check_ticket('admin-html-pages');
	$tid = $htmlpageslib->replace_html_page($_REQUEST["pageName"], $_REQUEST["type"], $_REQUEST["content"], $_REQUEST["refresh"]);
	$smarty->assign("pageName", '');
	$info["pageName"] = '';
	$info["content"] = '';
	$info["regresh"] = 0;
	$info["type"] = 's';
	$smarty->assign('info', $info);
70
}
71
if (!isset($_REQUEST["sort_mode"])) {
72
	$sort_mode = 'created_desc';
73
} else {
74
	$sort_mode = $_REQUEST["sort_mode"];
75 76
}
if (!isset($_REQUEST["offset"])) {
77
	$offset = 0;
78
} else {
79
	$offset = $_REQUEST["offset"];
80
}
81 82
$smarty->assign_by_ref('offset', $offset);
if (isset($_REQUEST["find"])) {
83
	$find = $_REQUEST["find"];
84
} else {
85
	$find = '';
86
}
87 88 89
$smarty->assign('find', $find);
$smarty->assign_by_ref('sort_mode', $sort_mode);
$channels = $htmlpageslib->list_html_pages($offset, $maxRecords, $sort_mode, $find);
90
$smarty->assign_by_ref('cant_pages', $channels["cant"]);
91 92
$smarty->assign_by_ref('channels', $channels["data"]);
if ($tiki_p_use_content_templates == 'y') {
93
	$templates = $tikilib->list_templates('html', 0, -1, 'name_asc', '');
94
}
95
$smarty->assign_by_ref('templates', $templates["data"]);
96
ask_ticket('admin-html-pages');
97 98
// disallow robots to index page:
$smarty->assign('metatag_robots', 'NOINDEX, NOFOLLOW');
99
// Display the template
100
$smarty->assign('mid', 'tiki-admin_html_pages.tpl');
101
$smarty->display("tiki.tpl");