1921 |
jp_milcent |
1 |
<?php
|
|
|
2 |
/*
|
|
|
3 |
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
|
|
4 |
* Copyright (C) 2003-2008 Frederico Caldeira Knabben
|
|
|
5 |
*
|
|
|
6 |
* == BEGIN LICENSE ==
|
|
|
7 |
*
|
|
|
8 |
* Licensed under the terms of any of the following licenses at your
|
|
|
9 |
* choice:
|
|
|
10 |
*
|
|
|
11 |
* - GNU General Public License Version 2 or later (the "GPL")
|
|
|
12 |
* http://www.gnu.org/licenses/gpl.html
|
|
|
13 |
*
|
|
|
14 |
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
|
|
15 |
* http://www.gnu.org/licenses/lgpl.html
|
|
|
16 |
*
|
|
|
17 |
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
|
|
18 |
* http://www.mozilla.org/MPL/MPL-1.1.html
|
|
|
19 |
*
|
|
|
20 |
* == END LICENSE ==
|
|
|
21 |
*
|
|
|
22 |
* These functions define the base of the XML response sent by the PHP
|
|
|
23 |
* connector.
|
|
|
24 |
*/
|
|
|
25 |
|
|
|
26 |
function SetXmlHeaders()
|
|
|
27 |
{
|
|
|
28 |
ob_end_clean() ;
|
|
|
29 |
|
|
|
30 |
// Prevent the browser from caching the result.
|
|
|
31 |
// Date in the past
|
|
|
32 |
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT') ;
|
|
|
33 |
// always modified
|
|
|
34 |
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT') ;
|
|
|
35 |
// HTTP/1.1
|
|
|
36 |
header('Cache-Control: no-store, no-cache, must-revalidate') ;
|
|
|
37 |
header('Cache-Control: post-check=0, pre-check=0', false) ;
|
|
|
38 |
// HTTP/1.0
|
|
|
39 |
header('Pragma: no-cache') ;
|
|
|
40 |
|
|
|
41 |
// Set the response format.
|
|
|
42 |
header( 'Content-Type: text/xml; charset=utf-8' ) ;
|
|
|
43 |
}
|
|
|
44 |
|
|
|
45 |
function CreateXmlHeader( $command, $resourceType, $currentFolder )
|
|
|
46 |
{
|
|
|
47 |
SetXmlHeaders() ;
|
|
|
48 |
|
|
|
49 |
// Create the XML document header.
|
|
|
50 |
echo '<?xml version="1.0" encoding="utf-8" ?>' ;
|
|
|
51 |
|
|
|
52 |
// Create the main "Connector" node.
|
|
|
53 |
echo '<Connector command="' . $command . '" resourceType="' . $resourceType . '">' ;
|
|
|
54 |
|
|
|
55 |
// Add the current folder node.
|
|
|
56 |
echo '<CurrentFolder path="' . ConvertToXmlAttribute( $currentFolder ) . '" url="' . ConvertToXmlAttribute( GetUrlFromPath( $resourceType, $currentFolder, $command ) ) . '" />' ;
|
|
|
57 |
|
|
|
58 |
$GLOBALS['HeaderSent'] = true ;
|
|
|
59 |
}
|
|
|
60 |
|
|
|
61 |
function CreateXmlFooter()
|
|
|
62 |
{
|
|
|
63 |
echo '</Connector>' ;
|
|
|
64 |
}
|
|
|
65 |
|
|
|
66 |
function SendError( $number, $text )
|
|
|
67 |
{
|
|
|
68 |
if ( isset( $GLOBALS['HeaderSent'] ) && $GLOBALS['HeaderSent'] )
|
|
|
69 |
{
|
|
|
70 |
SendErrorNode( $number, $text ) ;
|
|
|
71 |
CreateXmlFooter() ;
|
|
|
72 |
}
|
|
|
73 |
else
|
|
|
74 |
{
|
|
|
75 |
SetXmlHeaders() ;
|
|
|
76 |
|
|
|
77 |
// Create the XML document header
|
|
|
78 |
echo '<?xml version="1.0" encoding="utf-8" ?>' ;
|
|
|
79 |
|
|
|
80 |
echo '<Connector>' ;
|
|
|
81 |
|
|
|
82 |
SendErrorNode( $number, $text ) ;
|
|
|
83 |
|
|
|
84 |
echo '</Connector>' ;
|
|
|
85 |
}
|
|
|
86 |
exit ;
|
|
|
87 |
}
|
|
|
88 |
|
|
|
89 |
function SendErrorNode( $number, $text )
|
|
|
90 |
{
|
|
|
91 |
echo '<Error number="' . $number . '" text="' . htmlspecialchars( $text ) . '" />' ;
|
|
|
92 |
}
|
|
|
93 |
?>
|