<?php
//
// +---------------------------------------------------------------------------+
// | Nitro :: Base :: XML |
// +---------------------------------------------------------------------------+
// | Copyright (c) 2006 June Systems BV |
// +---------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or modify it |
// | under the terms of the GNU Lesser General Public License as published by |
// | the Free Software Foundation; either version 2.1 of the License, or (at |
// | your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, but |
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public License |
// | along with this library; if not, write to the Free Software Foundation, |
// | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
// +---------------------------------------------------------------------------+
// | Authors: Siggi Oskarsson <hide@address.com> |
// | Jesper Avot <hide@address.com |
// +---------------------------------------------------------------------------+
//
// $Id: xml.php 229 2008-04-17 09:20:31Z oli $
//
// Nitro's XML index script
//
/**
* Include NitroBaseConfig file
*/
include_once "NitroBaseConfig.inc.php";
/**
* Default Error page
*/
$DefaultErrorPage = file_get_contents(NITRO_PATH . "Defaults/Texts/Error.html");
/**
* XML Debug messages
*/
Debug("xml.php", "XMLIndexFile", "\033[2J", __FILE__, __LINE__, DEBUG_APPL_OK);
Debug("xml.php", "XMLIndexFile", "\033[42;37;1m ====== Debug started at ".date('Y-m-d H:i:s')." ====== \033[0m", __FILE__, __LINE__, DEBUG_APPL_OK);
/**
* Check if the config is loaded correct.
*/
if ($__NitroConf->isLoaded) {
/**
* Include Nitro PageXML class
*/
include_once "Nitro/PageXML.inc.php";
Debug("xml.php", "XMLIndexFile", "Creating Nitro XML page", __FILE__, __LINE__, DEBUG_APPL_OK);
/**
* Extends the Nitro Page class, but only calls the object given.
*/
$XML = new NitroPageXML();
if ($_REQUEST["P"]) {
$XML->InitPageFromString($_REQUEST["P"]);
} else {
$XML->InitPageFromSystemString($__NitroConf->CONF["Default"]["Page"]);
}
/**
* Draw the requested or default page on the screen.
*/
$XMLRV = $XML->Draw($_REQUEST['O'], $_REQUEST['C']);
/**
* Save the user's settings in the user's Session.
*/
$__NSess->SaveUserSettings();
/**
* Include the Nitro XMLResponse class
*
* Class creates an XML Output of the given Output instead of plain HTML.
*/
include_once "Nitro/XML/XMLResponse.inc.php";
$XMLResponse = new XMLResponse();
if (is_array($XMLRV) && count($XMLRV) > 0) {
foreach ($XMLRV AS $id => $html) {
/**
* Add the current item to the XML Output.
*/
$XMLResponse->addDataUpdate($id, $html);
}
}
/**
* Draw the XML Output to the screen, inclusive header Mime-Type etc.
*/
$XMLResponse->writeXML();
} else {
/**
* No NitroBaseConfig file found, error time!
*/
echo str_replace(Array('{Msg}', '{Error}'),
Array('Configuration File could not be loaded.', $__NitroConf->Error),
$DefaultErrorPage);
exit;
}
?>