From 4ab75e2e8cb5e3c422d2c45e52a5a12d73ecfdbf Mon Sep 17 00:00:00 2001 From: Philipp Holzer Date: Tue, 3 Sep 2019 18:37:27 +0200 Subject: [PATCH] Check twitter details before showing it --- twitter/twitter.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/twitter/twitter.php b/twitter/twitter.php index eeee6caf..d846b1ad 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -352,7 +352,10 @@ function twitter_settings(App $a, &$s) $field_checkbox = Renderer::getMarkupTemplate('field_checkbox.tpl'); - $s .= '
+ if (property_exists($details, 'screen_name') && + property_exists($details, 'description') && + property_exists($details, 'profile_image_url')) { + $s .= '

' . L10n::t('Currently connected to: ') . '' . $details->screen_name . '

@@ -361,6 +364,12 @@ function twitter_settings(App $a, &$s) ' . $details->description . '

'; + } else { + $s .= '
+

Invalid Twitter info

+
'; + Logger::info('Invalid twitter info (verify credentials).', ['auth' => TwitterOAuth::class]); + } $s .= '
'; $s .= Renderer::replaceMacros($field_checkbox, [