Make testremote more robust
This commit is contained in:
parent
6e06e1da0e
commit
5b1b6572f7
|
@ -8,13 +8,18 @@
|
||||||
|
|
||||||
OCP\JSON::checkAppEnabled('files_sharing');
|
OCP\JSON::checkAppEnabled('files_sharing');
|
||||||
OCP\JSON::checkLoggedIn();
|
OCP\JSON::checkLoggedIn();
|
||||||
OCP\JSON::callCheck();
|
|
||||||
|
|
||||||
$remote = $_GET['remote'];
|
$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';
|
echo 'https';
|
||||||
} elseif (file_get_contents('http://' . $remote . '/status.php')) {
|
} elseif (testUrl('http://' . $remote . '/status.php')) {
|
||||||
echo 'http';
|
echo 'http';
|
||||||
} else {
|
} else {
|
||||||
echo 'false';
|
echo 'false';
|
||||||
|
|
Loading…
Reference in New Issue