[Pkg-owncloud-commits] [owncloud] 86/107: Use XMLWriter to generate response

David Prévot taffit at moszumanska.debian.org
Thu Dec 17 19:40:40 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch stable8
in repository owncloud.

commit cccf4b607340f52cd0e9301c6e2813c121f2c236
Author: Lukas Reschke <lukas at owncloud.com>
Date:   Mon Nov 30 15:40:10 2015 +0100

    Use XMLWriter to generate response
    
    Gets rid of manual XML generation.
---
 ocs/providers.php | 43 ++++++++++++++++++++++++++-----------------
 1 file changed, 26 insertions(+), 17 deletions(-)

diff --git a/ocs/providers.php b/ocs/providers.php
index ce818a0..93035d0 100644
--- a/ocs/providers.php
+++ b/ocs/providers.php
@@ -29,20 +29,29 @@ header('Content-type: application/xml');
 
 $url=OCP\Util::getServerProtocol().'://'.substr(OCP\Util::getServerHost().OCP\Util::getRequestUri(), 0, -17).'ocs/v1.php/';
 
-echo('
-<providers>
-<provider>
- <id>ownCloud</id>
- <location>'.$url.'</location>
- <name>ownCloud</name>
- <icon></icon>
- <termsofuse></termsofuse>
- <register></register>
- <services>
-   <config ocsversion="1.7" />
-   <activity ocsversion="1.7" />
-   <cloud ocsversion="1.7" />
- </services>
-</provider>
-</providers>
-');
+$writer = new XMLWriter();
+$writer->openURI('php://output');
+$writer->startDocument('1.0','UTF-8');
+$writer->setIndent(4);
+$writer->startElement('providers');
+$writer->startElement('provider');
+$writer->writeElement('id', 'ownCloud');
+$writer->writeElement('location', $url);
+$writer->writeElement('name', 'ownCloud');
+$writer->writeElement('icon', '');
+$writer->writeElement('termsofuse', '');
+$writer->writeElement('register', '');
+$writer->startElement('services');
+$writer->startElement('config');
+$writer->writeAttribute('ocsversion', '1.7');
+$writer->endElement();
+$writer->startElement('activity');
+$writer->writeAttribute('ocsversion', '1.7');
+$writer->endElement();
+$writer->startElement('cloud');
+$writer->writeAttribute('ocsversion', '1.7');
+$writer->endElement();
+$writer->endElement();
+$writer->endElement();
+$writer->endDocument();
+$writer->flush();

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list