/
edit_structure.php
57 lines (49 loc) · 2.41 KB
/
edit_structure.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
/************************************************************************/
/* AContent */
/************************************************************************/
/* Copyright (c) 2013 */
/* Inclusive Design Institute */
/* */
/* This program is free software. You can redistribute it and/or */
/* modify it under the terms of the GNU General Public License */
/* as published by the Free Software Foundation. */
/************************************************************************/
define('TR_INCLUDE_PATH', '../include/');
require(TR_INCLUDE_PATH.'vitals.inc.php');
require_once(TR_INCLUDE_PATH.'classes/DAO/UsersDAO.class.php');
$_custom_head .= '<link rel="stylesheet" href="themes/'.$_SESSION['prefs']['PREF_THEME'].'/template_editor/style.css" type="text/css" />';
$_custom_head .= '<script type="text/javascript" src="template_editor/js/structure.js"></script>';
$_custom_head .= '<script type="text/javascript" src="template_editor/js/jquery.ui.sortable.js"></script>';
if($_POST['submit'] == _AT('cancel')){
header('Location: index.php?tab=structures');
exit;
}
$template=$_GET['temp'];
require('classes/TemplateCommons.php');
$commons=new TemplateCommons('../templates');
// non existing template name
if($commons->template_exists('structure', $template)) {
Header('Location: index.php');
exit;
}
// save the changes
if(isset ($_POST['submit'])) {
$dom=$commons->parse_to_XML($_POST['xml_text']);
$commons->save_xml($dom, "structures/".$template, "content.xml");
}
require(TR_INCLUDE_PATH.'header.inc.php');
// edit an existing template
$xmlpath=realpath("../templates/structures")."/". $template."/content.xml";
$xmlDoc = new DOMDocument();
$xmlDoc->load($xmlpath);
$x = $xmlDoc->documentElement;
$page_temp_list=$commons->get_template_list("page_templates");
$savant->assign('template', $template);
$savant->assign('xml_script', $xmlDoc->saveXML($xmlDoc->documentElement));
$savant->assign('image_path', TR_BASE_HREF.'images');
$savant->assign('page_temp_list', $page_temp_list);
$savant->assign('referer', $_SERVER['HTTP_REFERER']);
$savant->display('template_editor/structure_tool.tmpl.php');
require(TR_INCLUDE_PATH.'footer.inc.php');
?>