From 3874e491f913cfafe12e14f57a217273e63e4f4c Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 8 Jul 2018 17:19:35 +0000 Subject: [PATCH] Avoid warnings in addons --- blockem/blockem.php | 6 +++++- jappixmini/jappixmini.php | 2 +- openstreetmap/openstreetmap.php | 2 +- pumpio/pumpio.php | 1 + rendertime/rendertime.php | 2 +- showmore/showmore.php | 2 ++ xmpp/xmpp.php | 2 +- 7 files changed, 12 insertions(+), 5 deletions(-) diff --git a/blockem/blockem.php b/blockem/blockem.php index aaa69399..3de7be40 100644 --- a/blockem/blockem.php +++ b/blockem/blockem.php @@ -138,6 +138,10 @@ function blockem_prepare_body_content_filter(\Friendica\App $a, &$hook_data) } function blockem_display_item(&$a,&$b) { + if (empty($b['output']['body'])) { + return; + } + if(strstr($b['output']['body'],'id="blockem-wrap-')) $b['output']['thumb'] = $a->get_baseurl() . "/images/person-80.jpg"; } @@ -177,7 +181,7 @@ function blockem_item_photo_menu(&$a,&$b) { $blocked = false; $author = $b['item']['author-link']; - if(is_array($a->data['blockem'])) { + if(!empty($a->data['blockem'])) { foreach($a->data['blockem'] as $bloke) { if(link_compare($bloke,$author)) { $blocked = true; diff --git a/jappixmini/jappixmini.php b/jappixmini/jappixmini.php index 37d2ce5c..372193fb 100644 --- a/jappixmini/jappixmini.php +++ b/jappixmini/jappixmini.php @@ -477,7 +477,7 @@ function jappixmini_script(App $a) return; } - if ($_GET["mode"] == "minimal") { + if (defaults($_GET, "mode", '') == "minimal") { return; } diff --git a/openstreetmap/openstreetmap.php b/openstreetmap/openstreetmap.php index 974be0a0..0fe2a2fd 100644 --- a/openstreetmap/openstreetmap.php +++ b/openstreetmap/openstreetmap.php @@ -94,7 +94,7 @@ function openstreetmap_location($a, &$item) } } - if ($target == "") { + if (empty($target)) { $target = $nomserver.'?q='.urlencode($item['location']); } diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index 1b6469ed..2c7d0be4 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -957,6 +957,7 @@ function pumpio_dolike(&$a, $uid, $self, $post, $own_id, $threadcompletion = tru $likedata['gravity'] = GRAVITY_ACTIVITY; $likedata['uid'] = $uid; $likedata['wall'] = 0; + $likedata['network'] = NETWORK_PUMPIO; $likedata['uri'] = Item::newURI($uid); $likedata['parent-uri'] = $orig_post["uri"]; $likedata['contact-id'] = $contactid; diff --git a/rendertime/rendertime.php b/rendertime/rendertime.php index ae7f6d66..3bb8892b 100644 --- a/rendertime/rendertime.php +++ b/rendertime/rendertime.php @@ -30,7 +30,7 @@ function rendertime_page_end(&$a, &$o) { $ignored_modules = ["fbrowser"]; $ignored = in_array($a->module, $ignored_modules); - if (is_site_admin() && ($_GET["mode"] != "minimal") && !$a->is_mobile && !$a->is_tablet && !$ignored) { + if (is_site_admin() && (defaults($_GET, "mode", '') != "minimal") && !$a->is_mobile && !$a->is_tablet && !$ignored) { $o = $o.'
'. L10n::t("Database: %s/%s, Network: %s, Rendering: %s, Session: %s, I/O: %s, Other: %s, Total: %s", round($a->performance["database"] - $a->performance["database_write"], 3), round($a->performance["database_write"], 3), diff --git a/showmore/showmore.php b/showmore/showmore.php index e39acdee..3673c956 100644 --- a/showmore/showmore.php +++ b/showmore/showmore.php @@ -126,6 +126,8 @@ function showmore_prepare_body(\Friendica\App $a, &$hook_data) if (get_body_length($hook_data['html']) > $chars) { $found = true; $shortened = trim(showmore_cutitem($hook_data['html'], $chars)) . "..."; + } else { + $found = false; } if ($found) { diff --git a/xmpp/xmpp.php b/xmpp/xmpp.php index bd5adb57..bef31fed 100644 --- a/xmpp/xmpp.php +++ b/xmpp/xmpp.php @@ -131,7 +131,7 @@ function xmpp_converse(App $a) return; } - if ($_GET["mode"] == "minimal") { + if (defaults($_GET, "mode", '') == "minimal") { return; }