From 858fd127a16bf02cb1b9566e2263cd3263bf9ed4 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 14 Mar 2018 00:27:15 +0000 Subject: [PATCH] Fix: subscribing to the old followers hadn't worked --- mod/ostatus_subscribe.php | 3 +++ mod/settings.php | 3 +-- src/Util/Network.php | 7 ++++++- view/templates/settings/connectors.tpl | 2 +- view/theme/frio/templates/settings/connectors.tpl | 4 ++-- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/mod/ostatus_subscribe.php b/mod/ostatus_subscribe.php index 07f4647e69..e8ba144a16 100644 --- a/mod/ostatus_subscribe.php +++ b/mod/ostatus_subscribe.php @@ -29,12 +29,14 @@ function ostatus_subscribe_content(App $a) { if (PConfig::get($uid, "ostatus", "legacy_friends") == "") { if ($_REQUEST["url"] == "") { + PConfig::delete($uid, "ostatus", "legacy_contact"); return $o.L10n::t("No contact provided."); } $contact = Probe::uri($_REQUEST["url"]); if (!$contact) { + PConfig::delete($uid, "ostatus", "legacy_contact"); return $o.L10n::t("Couldn't fetch information for contact."); } @@ -44,6 +46,7 @@ function ostatus_subscribe_content(App $a) { $data = Network::curl($api."statuses/friends.json?screen_name=".$contact["nick"]); if (!$data["success"]) { + PConfig::delete($uid, "ostatus", "legacy_contact"); return $o.L10n::t("Couldn't fetch friends for contact."); } diff --git a/mod/settings.php b/mod/settings.php index b2dc37324c..5fd67afa12 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -207,8 +207,7 @@ function settings_post(App $a) return; } - if (($a->argc > 1) && ($a->argv[1] == 'connectors')) - { + if (($a->argc > 1) && ($a->argv[1] == 'connectors')) { check_form_security_token_redirectOnErr('/settings/connectors', 'settings_connectors'); if (x($_POST, 'general-submit')) { diff --git a/src/Util/Network.php b/src/Util/Network.php index c9955f800f..d25b799242 100644 --- a/src/Util/Network.php +++ b/src/Util/Network.php @@ -217,7 +217,7 @@ class Network $newurl = $curl_info['redirect_url']; - if (($new_location_info['path'] == '') && ( $new_location_info['host'] != '')) { + if (($new_location_info['path'] == '') && ($new_location_info['host'] != '')) { $newurl = $new_location_info['scheme'] . '://' . $new_location_info['host'] . $old_location_info['path']; } @@ -229,6 +229,11 @@ class Network if (strpos($newurl, '/') === 0) { $newurl = $old_location_info["scheme"]."://".$old_location_info["host"].$newurl; } + $old_location_query = @parse_url($url, PHP_URL_QUERY); + + if ($old_location_query != '') { + $newurl .= '?' . $old_location_query; + } if (filter_var($newurl, FILTER_VALIDATE_URL)) { $redirects++; diff --git a/view/templates/settings/connectors.tpl b/view/templates/settings/connectors.tpl index 58306fb279..83ebd74f5f 100644 --- a/view/templates/settings/connectors.tpl +++ b/view/templates/settings/connectors.tpl @@ -22,7 +22,7 @@

{{$repair_ostatus_text}}

-
+
diff --git a/view/theme/frio/templates/settings/connectors.tpl b/view/theme/frio/templates/settings/connectors.tpl index c388a6e25d..e5d21158c2 100644 --- a/view/theme/frio/templates/settings/connectors.tpl +++ b/view/theme/frio/templates/settings/connectors.tpl @@ -28,7 +28,7 @@

{{$repair_ostatus_text}}

- +
@@ -67,4 +67,4 @@ {{/if}} - \ No newline at end of file +