1 | <?php |
---|
2 | /* |
---|
3 | * FCKeditor - The text editor for Internet - http://www.fckeditor.net |
---|
4 | * Copyright (C) 2003-2007 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 ) ) . '" />' ; |
---|
57 | } |
---|
58 | |
---|
59 | function CreateXmlFooter() |
---|
60 | { |
---|
61 | echo '</Connector>' ; |
---|
62 | } |
---|
63 | |
---|
64 | function SendError( $number, $text ) |
---|
65 | { |
---|
66 | SetXmlHeaders() ; |
---|
67 | |
---|
68 | // Create the XML document header |
---|
69 | echo '<?xml version="1.0" encoding="utf-8" ?>' ; |
---|
70 | |
---|
71 | echo '<Connector><Error number="' . $number . '" text="' . htmlspecialchars( $text ) . '" /></Connector>' ; |
---|
72 | |
---|
73 | exit ; |
---|
74 | } |
---|
75 | ?> |
---|