Merge pull request #513 from annando/twitter-fail

Quit if twitter addon is not configured
pull/515/head
Hypolite Petovan 2018-01-30 14:07:09 -05:00 committed by GitHub
commit 43c81dfb86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -158,6 +158,12 @@ function twitter_follow(App $a, &$contact)
$otoken = PConfig::get($uid, 'twitter', 'oauthtoken');
$osecret = PConfig::get($uid, 'twitter', 'oauthsecret');
// If the addon is not configured (general or for this user) quit here
if (empty($ckey) || empty($csecret) || empty($otoken) || empty($osecret)) {
$contact = false;
return;
}
$connection = new TwitterOAuth($ckey, $csecret, $otoken, $osecret);
$connection->post('friendships/create', ['screen_name' => $nickname]);