[Pkg-owncloud-commits] [owncloud] 153/223: Make testremote more robust
David Prévot
taffit at moszumanska.debian.org
Sun Jun 22 01:54:19 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository owncloud.
commit 5b1b6572f7ae9ac9e300032e049e317ac7496a30
Author: Robin Appelman <icewind at owncloud.com>
Date: Mon Jun 16 13:21:00 2014 +0200
Make testremote more robust
---
apps/files_sharing/ajax/testremote.php | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/apps/files_sharing/ajax/testremote.php b/apps/files_sharing/ajax/testremote.php
index 5a07300..32e2f55 100644
--- a/apps/files_sharing/ajax/testremote.php
+++ b/apps/files_sharing/ajax/testremote.php
@@ -8,13 +8,18 @@
OCP\JSON::checkAppEnabled('files_sharing');
OCP\JSON::checkLoggedIn();
-OCP\JSON::callCheck();
$remote = $_GET['remote'];
-if (file_get_contents('https://' . $remote . '/status.php')) {
+function testUrl($url) {
+ $result = file_get_contents($url);
+ $data = json_decode($result);
+ return is_object($data) and !empty($data->version);
+}
+
+if (testUrl('https://' . $remote . '/status.php')) {
echo 'https';
-} elseif (file_get_contents('http://' . $remote . '/status.php')) {
+} elseif (testUrl('http://' . $remote . '/status.php')) {
echo 'http';
} else {
echo 'false';
--
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