Merge pull request #884 from nupplaphil/bug/friendica-7299

Check twitter details before showing it
pull/885/head
Tobias Diekershoff 2019-09-03 19:04:51 +02:00 committed by GitHub
commit 789754e8f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 1 deletions

View File

@ -352,6 +352,9 @@ function twitter_settings(App $a, &$s)
$field_checkbox = Renderer::getMarkupTemplate('field_checkbox.tpl'); $field_checkbox = Renderer::getMarkupTemplate('field_checkbox.tpl');
if (property_exists($details, 'screen_name') &&
property_exists($details, 'description') &&
property_exists($details, 'profile_image_url')) {
$s .= '<div id="twitter-info" > $s .= '<div id="twitter-info" >
<p>' . L10n::t('Currently connected to: ') . '<a href="https://twitter.com/' . $details->screen_name . '" target="_twitter">' . $details->screen_name . '</a> <p>' . L10n::t('Currently connected to: ') . '<a href="https://twitter.com/' . $details->screen_name . '" target="_twitter">' . $details->screen_name . '</a>
<button type="submit" name="twitter-disconnect" value="1">' . L10n::t('Disconnect') . '</button> <button type="submit" name="twitter-disconnect" value="1">' . L10n::t('Disconnect') . '</button>
@ -361,6 +364,12 @@ function twitter_settings(App $a, &$s)
<em>' . $details->description . '</em> <em>' . $details->description . '</em>
</p> </p>
</div>'; </div>';
} else {
$s .= '<div id="twitter-info" >
<p>Invalid Twitter info</p>
</div>';
Logger::info('Invalid twitter info (verify credentials).', ['auth' => TwitterOAuth::class]);
}
$s .= '<div class="clear"></div>'; $s .= '<div class="clear"></div>';
$s .= Renderer::replaceMacros($field_checkbox, [ $s .= Renderer::replaceMacros($field_checkbox, [