3 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
4 * Copyright (C) 2003-2008 Frederico Caldeira Knabben
8 * Licensed under the terms of any of the following licenses at your
11 * - GNU General Public License Version 2 or later (the "GPL")
12 * http://www.gnu.org/licenses/gpl.html
14 * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
15 * http://www.gnu.org/licenses/lgpl.html
17 * - Mozilla Public License Version 1.1 or later (the "MPL")
18 * http://www.mozilla.org/MPL/MPL-1.1.html
22 * These functions define the base of the XML response sent by the PHP
26 function SetXmlHeaders()
30 // Prevent the browser from caching the result.
32 header('Expires: Mon, 26 Jul 1997 05:00:00 GMT') ;
34 header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT') ;
36 header('Cache-Control: no-store, no-cache, must-revalidate') ;
37 header('Cache-Control: post-check=0, pre-check=0', false) ;
39 header('Pragma: no-cache') ;
41 // Set the response format.
42 header( 'Content-Type: text/xml; charset=utf-8' ) ;
45 function CreateXmlHeader( $command, $resourceType, $currentFolder )
49 // Create the XML document header.
50 echo '<?xml version="1.0" encoding="utf-8" ?>' ;
52 // Create the main "Connector" node.
53 echo '<Connector command="' . $command . '" resourceType="' . $resourceType . '">' ;
55 // Add the current folder node.
56 echo '<CurrentFolder path="' . ConvertToXmlAttribute( $currentFolder ) . '" url="' . ConvertToXmlAttribute( GetUrlFromPath( $resourceType, $currentFolder, $command ) ) . '" />' ;
58 $GLOBALS['HeaderSent'] = true ;
61 function CreateXmlFooter()
66 function SendError( $number, $text )
68 if ( isset( $GLOBALS['HeaderSent'] ) && $GLOBALS['HeaderSent'] )
70 SendErrorNode( $number, $text ) ;
77 // Create the XML document header
78 echo '<?xml version="1.0" encoding="utf-8" ?>' ;
82 SendErrorNode( $number, $text ) ;
89 function SendErrorNode( $number, $text )
91 echo '<Error number="' . $number . '" text="' . htmlspecialchars( $text ) . '" />' ;