[763] | 1 | <?php |
---|
| 2 | /* |
---|
| 3 | * FCKeditor - The text editor for internet |
---|
| 4 | * Copyright (C) 2003-2006 Frederico Caldeira Knabben |
---|
| 5 | * |
---|
| 6 | * Licensed under the terms of the GNU Lesser General Public License: |
---|
| 7 | * http://www.opensource.org/licenses/lgpl-license.php |
---|
| 8 | * |
---|
| 9 | * For further information visit: |
---|
| 10 | * http://www.fckeditor.net/ |
---|
| 11 | * |
---|
| 12 | * "Support Open Source software. What about a donation today?" |
---|
| 13 | * |
---|
| 14 | * File Name: basexml.php |
---|
| 15 | * These functions define the base of the XML response sent by the PHP |
---|
| 16 | * connector. |
---|
| 17 | * |
---|
| 18 | * File Authors: |
---|
| 19 | * Frederico Caldeira Knabben (fredck@fckeditor.net) |
---|
| 20 | */ |
---|
| 21 | |
---|
| 22 | function SetXmlHeaders() |
---|
| 23 | { |
---|
| 24 | ob_end_clean() ; |
---|
| 25 | |
---|
| 26 | // Prevent the browser from caching the result. |
---|
| 27 | // Date in the past |
---|
| 28 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT') ; |
---|
| 29 | // always modified |
---|
| 30 | header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT') ; |
---|
| 31 | // HTTP/1.1 |
---|
| 32 | header('Cache-Control: no-store, no-cache, must-revalidate') ; |
---|
| 33 | header('Cache-Control: post-check=0, pre-check=0', false) ; |
---|
| 34 | // HTTP/1.0 |
---|
| 35 | header('Pragma: no-cache') ; |
---|
| 36 | |
---|
| 37 | // Set the response format. |
---|
| 38 | header( 'Content-Type:text/xml; charset=utf-8' ) ; |
---|
| 39 | } |
---|
| 40 | |
---|
| 41 | function CreateXmlHeader( $command, $resourceType, $currentFolder ) |
---|
| 42 | { |
---|
| 43 | SetXmlHeaders() ; |
---|
| 44 | |
---|
| 45 | // Create the XML document header. |
---|
| 46 | echo '<?xml version="1.0" encoding="utf-8" ?>' ; |
---|
| 47 | |
---|
| 48 | // Create the main "Connector" node. |
---|
| 49 | echo '<Connector command="' . $command . '" resourceType="' . $resourceType . '">' ; |
---|
| 50 | |
---|
| 51 | // Add the current folder node. |
---|
| 52 | echo '<CurrentFolder path="' . ConvertToXmlAttribute( $currentFolder ) . '" url="' . ConvertToXmlAttribute( GetUrlFromPath( $resourceType, $currentFolder ) ) . '" />' ; |
---|
| 53 | } |
---|
| 54 | |
---|
| 55 | function CreateXmlFooter() |
---|
| 56 | { |
---|
| 57 | echo '</Connector>' ; |
---|
| 58 | } |
---|
| 59 | |
---|
| 60 | function SendError( $number, $text ) |
---|
| 61 | { |
---|
| 62 | SetXmlHeaders() ; |
---|
| 63 | |
---|
| 64 | // Create the XML document header |
---|
| 65 | echo '<?xml version="1.0" encoding="utf-8" ?>' ; |
---|
| 66 | |
---|
| 67 | echo '<Connector><Error number="' . $number . '" text="' . htmlspecialchars( $text ) . '" /></Connector>' ; |
---|
| 68 | |
---|
| 69 | exit ; |
---|
| 70 | } |
---|
| 71 | ?> |
---|