--- /dev/null
+<?php\r
+/*\r
+ * FCKeditor - The text editor for Internet - http://www.fckeditor.net\r
+ * Copyright (C) 2003-2008 Frederico Caldeira Knabben\r
+ *\r
+ * == BEGIN LICENSE ==\r
+ *\r
+ * Licensed under the terms of any of the following licenses at your\r
+ * choice:\r
+ *\r
+ * - GNU General Public License Version 2 or later (the "GPL")\r
+ * http://www.gnu.org/licenses/gpl.html\r
+ *\r
+ * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")\r
+ * http://www.gnu.org/licenses/lgpl.html\r
+ *\r
+ * - Mozilla Public License Version 1.1 or later (the "MPL")\r
+ * http://www.mozilla.org/MPL/MPL-1.1.html\r
+ *\r
+ * == END LICENSE ==\r
+ *\r
+ * These functions define the base of the XML response sent by the PHP\r
+ * connector.\r
+ */\r
+\r
+function SetXmlHeaders()\r
+{\r
+ ob_end_clean() ;\r
+\r
+ // Prevent the browser from caching the result.\r
+ // Date in the past\r
+ header('Expires: Mon, 26 Jul 1997 05:00:00 GMT') ;\r
+ // always modified\r
+ header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT') ;\r
+ // HTTP/1.1\r
+ header('Cache-Control: no-store, no-cache, must-revalidate') ;\r
+ header('Cache-Control: post-check=0, pre-check=0', false) ;\r
+ // HTTP/1.0\r
+ header('Pragma: no-cache') ;\r
+\r
+ // Set the response format.\r
+ header( 'Content-Type: text/xml; charset=utf-8' ) ;\r
+}\r
+\r
+function CreateXmlHeader( $command, $resourceType, $currentFolder )\r
+{\r
+ SetXmlHeaders() ;\r
+\r
+ // Create the XML document header.\r
+ echo '<?xml version="1.0" encoding="utf-8" ?>' ;\r
+\r
+ // Create the main "Connector" node.\r
+ echo '<Connector command="' . $command . '" resourceType="' . $resourceType . '">' ;\r
+\r
+ // Add the current folder node.\r
+ echo '<CurrentFolder path="' . ConvertToXmlAttribute( $currentFolder ) . '" url="' . ConvertToXmlAttribute( GetUrlFromPath( $resourceType, $currentFolder, $command ) ) . '" />' ;\r
+\r
+ $GLOBALS['HeaderSent'] = true ;\r
+}\r
+\r
+function CreateXmlFooter()\r
+{\r
+ echo '</Connector>' ;\r
+}\r
+\r
+function SendError( $number, $text )\r
+{\r
+ if ( isset( $GLOBALS['HeaderSent'] ) && $GLOBALS['HeaderSent'] )\r
+ {\r
+ SendErrorNode( $number, $text ) ;\r
+ CreateXmlFooter() ;\r
+ }\r
+ else\r
+ {\r
+ SetXmlHeaders() ;\r
+\r
+ // Create the XML document header\r
+ echo '<?xml version="1.0" encoding="utf-8" ?>' ;\r
+\r
+ echo '<Connector>' ;\r
+\r
+ SendErrorNode( $number, $text ) ;\r
+\r
+ echo '</Connector>' ;\r
+ }\r
+ exit ;\r
+}\r
+\r
+function SendErrorNode( $number, $text )\r
+{\r
+ echo '<Error number="' . $number . '" text="' . htmlspecialchars( $text ) . '" />' ;\r
+}\r
+?>\r