Twitter: Fix posting
This commit is contained in:
parent
886638f8a5
commit
340f3f41d7
1 changed files with 16 additions and 13 deletions
|
@ -106,9 +106,11 @@ function twitter_settings_post()
|
|||
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'twitter', 'access_token', $_POST['twitter-access-token']);
|
||||
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'twitter', 'access_secret', $_POST['twitter-access-secret']);
|
||||
|
||||
if (empty(DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'twitter', 'last_status')) ||
|
||||
if (
|
||||
empty(DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'twitter', 'last_status')) ||
|
||||
($api_key != $_POST['twitter-api-key']) || ($api_secret != $_POST['twitter-api-secret']) ||
|
||||
($access_token != $_POST['twitter-access-token']) || ($access_secret != $_POST['twitter-access-secret'])) {
|
||||
($access_token != $_POST['twitter-access-token']) || ($access_secret != $_POST['twitter-access-secret'])
|
||||
) {
|
||||
twitter_test_connection(DI::userSession()->getLocalUserId());
|
||||
}
|
||||
}
|
||||
|
@ -360,16 +362,17 @@ function twitter_post(int $uid, string $url, string $type, array $data): stdClas
|
|||
]);
|
||||
|
||||
$response = $client->post($url, ['auth' => 'oauth', $type => $data]);
|
||||
$body = $response->getBody()->getContents();
|
||||
|
||||
$status = [
|
||||
'code' => $response->getStatusCode(),
|
||||
'reason' => $response->getReasonPhrase(),
|
||||
'content' => $response->getBody()->getContents()
|
||||
'content' => $body
|
||||
];
|
||||
|
||||
DI::pConfig()->set($uid, 'twitter', 'last_status', $status);
|
||||
|
||||
$content = json_decode($response->getBody()->getContents()) ?? new stdClass;
|
||||
$content = json_decode($body) ?? new stdClass;
|
||||
Logger::debug('Success', ['content' => $content]);
|
||||
return $content;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue