From 74353e7f2d2da744e61304af7b2011c4483ac12f Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 1 Aug 2018 17:28:55 +0000 Subject: [PATCH 1/3] Some more notices in addons --- fromgplus/fromgplus.php | 7 +++++-- pumpio/pumpio.php | 1 + tumblr/tumblr.php | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/fromgplus/fromgplus.php b/fromgplus/fromgplus.php index 959ad1f7..ac433526 100644 --- a/fromgplus/fromgplus.php +++ b/fromgplus/fromgplus.php @@ -341,10 +341,13 @@ function fromgplus_handleattachments($a, $uid, $item, $displaytext, $shared) { if ($images["full"] != "") $pagedata["images"][0]["src"] = $images["full"]; - $quote = trim(fromgplus_html2bbcode($attachment->content)); + if (!empty($attachment->content)) { + $quote = trim(fromgplus_html2bbcode($attachment->content)); + } - if ($quote != "") + if (!empty($quote)) { $pagedata["text"] = $quote; + } // Add Keywords to page link $data = parseurl_getsiteinfo_cached($pagedata["url"], true); diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index 4431cf4c..501c8446 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -778,6 +778,7 @@ function pumpio_fetchtimeline(App $a, $uid) $success = $client->CallAPI($url, 'GET', [], ['FailOnAccessError'=>true], $user); } else { $success = false; + $user = []; } if (!$success) { diff --git a/tumblr/tumblr.php b/tumblr/tumblr.php index 86a90737..dc3d9db1 100644 --- a/tumblr/tumblr.php +++ b/tumblr/tumblr.php @@ -443,7 +443,7 @@ function tumblr_send(App $a, array &$b) { "

".$params['caption']."

"; } - if (empty($params['caption'])) { + if (empty($params['caption']) && !empty($siteinfo["description"])) { $params['caption'] = BBCode::convert("[quote]" . $siteinfo["description"] . "[/quote]", false, 4); } From c0d7330b458fefd4808ae5d01a05e4a36dfdde49 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 1 Aug 2018 19:14:28 +0000 Subject: [PATCH 2/3] We should quit on not getting data --- pumpio/pumpio.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index 501c8446..3bc03efa 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -1387,6 +1387,10 @@ function pumpio_getallusers(App &$a, $uid) $success = false; } + if (empty($users)) { + return; + } + if ($users->totalItems > count($users->items)) { $url = 'https://'.$hostname.'/api/user/'.$username.'/following?count='.$users->totalItems; From 8f562a4b22e9ac038d323832cc3dac8aa5ab190a Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 2 Aug 2018 05:09:37 +0000 Subject: [PATCH 3/3] Avoid empty post --- twitter/twitter.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/twitter/twitter.php b/twitter/twitter.php index 8ac6197b..a130a1cd 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -1514,6 +1514,11 @@ function twitter_fetchparentposts(App $a, $uid, $post, TwitterOAuth $connection, break; } + if (empty($post->id_str)) { + logger("twitter_fetchparentposts: This is not a post " . json_encode($post), LOGGER_DEBUG); + break; + } + if (DBA::exists('item', ['uri' => 'twitter::' . $post->id_str, 'uid' => $uid])) { break; }