replace fopen with fetch_url in statusnet plugin, many sites do not have fopen_url allowed.
This commit is contained in:
parent
1b8e93c70b
commit
1fcf8ff5de
|
@ -103,9 +103,7 @@ function statusnet_settings_post ($a,$post) {
|
||||||
// we'll check the API Version for that, if we don't get one we'll try to fix the path but will
|
// we'll check the API Version for that, if we don't get one we'll try to fix the path but will
|
||||||
// resign quickly after this one try to fix the path ;-)
|
// resign quickly after this one try to fix the path ;-)
|
||||||
$apibase = $_POST['statusnet-baseapi'];
|
$apibase = $_POST['statusnet-baseapi'];
|
||||||
$f = fopen( $apibase . 'statusnet/version.xml', 'r');
|
$c = fetch_url( $apibase . 'statusnet/version.xml' );
|
||||||
$c = stream_get_contents($f);
|
|
||||||
fclose($f);
|
|
||||||
if (strlen($c) > 0) {
|
if (strlen($c) > 0) {
|
||||||
// ok the API path is correct, let's save the settings
|
// ok the API path is correct, let's save the settings
|
||||||
set_pconfig(local_user(), 'statusnet', 'consumerkey', $_POST['statusnet-consumerkey']);
|
set_pconfig(local_user(), 'statusnet', 'consumerkey', $_POST['statusnet-consumerkey']);
|
||||||
|
@ -114,9 +112,7 @@ function statusnet_settings_post ($a,$post) {
|
||||||
} else {
|
} else {
|
||||||
// the API path is not correct, maybe missing trailing / ?
|
// the API path is not correct, maybe missing trailing / ?
|
||||||
$apibase = $apibase . '/';
|
$apibase = $apibase . '/';
|
||||||
$f = fopen( $apibase . 'statusnet/version.xml', 'r');
|
$c = fetch_url( $apibase . 'statusnet/version.xml' );
|
||||||
$c = stream_get_contents($f);
|
|
||||||
fclose($f);
|
|
||||||
if (strlen($c) > 0) {
|
if (strlen($c) > 0) {
|
||||||
// ok the API path is now correct, let's save the settings
|
// ok the API path is now correct, let's save the settings
|
||||||
set_pconfig(local_user(), 'statusnet', 'consumerkey', $_POST['statusnet-consumerkey']);
|
set_pconfig(local_user(), 'statusnet', 'consumerkey', $_POST['statusnet-consumerkey']);
|
||||||
|
|
Loading…
Reference in a new issue