<?php
require_once('../../../config.php');
require_once(FOLDER_RELATIVE_COMMON . 'authorization.php');
require_once(FOLDER_RELATIVE_COMMON . 'database.php');
require_once(FOLDER_RELATIVE_COMMON . 'html.php');
// Check for XML request (XMLHttpRequest).
$request = isset($_GET['request']) ? $_GET['request'] : '';
if ($request == 'xml') {
$sql = 'SELECT id, parent_id, title, require_login from Pages ORDER BY parent_id, sortorder';
$rows = databaseGetRows($sql, array());
header('Content-Type: text/xml');
$xml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' . "\n";
$xml .= "<root>\n";
$counter = 0;
foreach ($rows as $row) {
// Remove breaks, as they will appear funny.
$page_title = removeBreak($row['title'], false);
if ($row['require_login'] == 'Y') $page_title .= " (login req'd)";
$xml .= "\t<record>\n";
$xml .= "\t\t<id>" . $row['id'] . "</id>\n";
$xml .= "\t\t<parent_id>" . $row['parent_id'] . "</parent_id>\n";
$xml .= "\t\t<is_leaf>0</is_leaf>\n";
$xml .= "\t\t<title><![CDATA[" . $page_title . "]]></title>\n";
$xml .= "\t</record>\n";
}
$xml .= "</root>\n";
echo $xml;
exit;
}
// Show the pages list form.
require_once(FOLDER_RELATIVE_COMMON . 'builder-admin.php');
$header = '';
$header .= '<script type="text/javascript">';
$header .= 'jaxTreeShowAdd("admin_pages.php");';
$header .= 'jaxTreeShowEdit("admin_pages.php");jaxTreeShowDelete("admin_pages.php");';
$header .= 'jaxTreeShowMoveUp("admin_pages.php");jaxTreeShowMoveDown("admin_pages.php");';
$header .= '</script>' . "\n";
$onload = "jaxTreeRegister('admin_pages_list.php?request=xml', 'pagelist');";
$title = 'Pages';
$content = 'admin_pages_list.html';
$page = buildAdminPage($header, $onload, $title, $content);
echo $page;
?>