From de10d06e2646393336adbb4ec7d0641419cb28cd Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 29 Jan 2018 08:15:43 -0500 Subject: [PATCH] Upgrade TwitterOAuth calls in twitter addon --- twitter/twitter.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/twitter/twitter.php b/twitter/twitter.php index 7e38bd43..8b483c9e 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -223,7 +223,7 @@ function twitter_settings_post(App $a, $post) // form as token and token2, we need a new connection to Twitter using these token // and secret to request a Access Token with the PIN $connection = new TwitterOAuth($ckey, $csecret, $_POST['twitter-token'], $_POST['twitter-token2']); - $token = $connection->getAccessToken($_POST['twitter-pin']); + $token = $connection->oauth("oauth/access_token", ["oauth_verifier" => $_POST['twitter-pin']]); // ok, now that we have the Access Token, save them in the user config PConfig::set(local_user(), 'twitter', 'oauthtoken', $token['oauth_token']); PConfig::set(local_user(), 'twitter', 'oauthsecret', $token['oauth_token_secret']); @@ -298,17 +298,16 @@ function twitter_settings(App $a, &$s) * account at Twitter. */ $connection = new TwitterOAuth($ckey, $csecret); - $request_token = $connection->getRequestToken(); - $token = $request_token['oauth_token']; + $request_token = $connection->url('oauth/request_token', ['oauth_callback' => 'oob']); /* * * * make some nice form */ $s .= '

' . L10n::t('At this Friendica instance the Twitter addon was enabled but you have not yet connected your account to your Twitter account. To do so click the button below to get a PIN from Twitter which you have to copy into the input box below and submit the form. Only your public posts will be posted to Twitter.') . '

'; - $s .= '' . L10n::t('Log in with Twitter') . ''; + $s .= '' . L10n::t('Log in with Twitter') . ''; $s .= '
'; $s .= ''; $s .= ''; - $s .= ''; + $s .= ''; $s .= ''; $s .= '
'; $s .= '
';