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/fromgplus/fromgplus.php b/fromgplus/fromgplus.php
index 5dfac50c..fcee3260 100644
--- a/fromgplus/fromgplus.php
+++ b/fromgplus/fromgplus.php
@@ -455,7 +455,7 @@ function fromgplus_fetch($a, $uid) {
$lastdate = 0;
- if (!is_array($activities->items))
+ if (empty($activities->items))
return;
$reversed = array_reverse($activities->items);
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..56888548 100644
--- a/pumpio/pumpio.php
+++ b/pumpio/pumpio.php
@@ -654,8 +654,7 @@ function pumpio_action(&$a, $uid, $uri, $action, $content = "")
function pumpio_sync(&$a)
{
- $r = q("SELECT * FROM `addon` WHERE `installed` = 1 AND `name` = 'pumpio'",
- $plugin);
+ $r = q("SELECT * FROM `addon` WHERE `installed` = 1 AND `name` = 'pumpio'");
if (!DBM::is_result($r)) {
return;
@@ -765,7 +764,7 @@ function pumpio_fetchtimeline(&$a, $uid)
logger('pumpio: fetching for user '.$uid.' '.$url.' C:'.$client->client_id.' CS:'.$client->client_secret.' T:'.$client->access_token.' TS:'.$client->access_token_secret);
- $username = $user.'@'.$host;
+ $useraddr = $username.'@'.$hostname;
if (pumpio_reachable($url)) {
$success = $client->CallAPI($url, 'GET', [], ['FailOnAccessError'=>true], $user);
@@ -774,7 +773,7 @@ function pumpio_fetchtimeline(&$a, $uid)
}
if (!$success) {
- logger('pumpio: error fetching posts for user '.$uid." ".$username." ".print_r($user, true));
+ logger('pumpio: error fetching posts for user '.$uid." ".$useraddr." ".print_r($user, true));
return;
}
@@ -903,7 +902,7 @@ function pumpio_dolike(&$a, $uid, $self, $post, $own_id, $threadcompletion = tru
{
require_once('include/items.php');
- if ($post->object->id == "") {
+ if (empty($post->object->id)) {
logger('Got empty like: '.print_r($post, true), LOGGER_DEBUG);
return;
}
@@ -957,6 +956,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;
@@ -1186,7 +1186,7 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet
$postarray['parent-uri'] = $post->object->inReplyTo->id;
}
- if ($post->object->pump_io->proxyURL) {
+ if (!empty($post->object->pump_io->proxyURL)) {
$postarray['extid'] = $post->object->pump_io->proxyURL;
}
@@ -1203,7 +1203,7 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet
$postarray['body'] = HTML::toBBCode($post->object->content);
$postarray['object'] = json_encode($post);
- if ($post->object->fullImage->url != "") {
+ if (!empty($post->object->fullImage->url)) {
$postarray["body"] = "[url=".$post->object->fullImage->url."][img]".$post->object->image->url."[/img][/url]\n".$postarray["body"];
}
@@ -1587,9 +1587,9 @@ function pumpio_fetchallcomments(&$a, $uid, $id)
$like->object->id = $item->id;
$like->actor = new stdClass;
$like->actor->displayName = $item->displayName;
- $like->actor->preferredUsername = $item->preferredUsername;
+ //$like->actor->preferredUsername = $item->preferredUsername;
+ //$like->actor->image = $item->image;
$like->actor->url = $item->url;
- $like->actor->image = $item->image;
$like->generator = new stdClass;
$like->generator->displayName = "pumpio";
pumpio_dolike($a, $uid, $self, $post, $own_id, false);
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/statusnet/statusnet.php b/statusnet/statusnet.php
index b97a6ca5..6fc5b8a9 100644
--- a/statusnet/statusnet.php
+++ b/statusnet/statusnet.php
@@ -1065,7 +1065,7 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex
$postarray['uid'] = $uid;
$postarray['wall'] = 0;
- if (is_object($post->retweeted_status)) {
+ if (!empty($post->retweeted_status)) {
$content = $post->retweeted_status;
statusnet_fetch_contact($uid, $content->user, false);
} else {
@@ -1080,7 +1080,7 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex
$contactid = 0;
- if ($content->in_reply_to_status_id != "") {
+ if (!empty($content->in_reply_to_status_id)) {
$parent = $hostname . "::" . $content->in_reply_to_status_id;
@@ -1166,19 +1166,19 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex
$postarray['created'] = DateTimeFormat::utc($content->created_at);
$postarray['edited'] = DateTimeFormat::utc($content->created_at);
- if (is_string($content->place->name)) {
+ if (!empty($content->place->name)) {
$postarray["location"] = $content->place->name;
}
- if (is_string($content->place->full_name)) {
+ if (!empty($content->place->full_name)) {
$postarray["location"] = $content->place->full_name;
}
- if (is_array($content->geo->coordinates)) {
+ if (!empty($content->geo->coordinates)) {
$postarray["coord"] = $content->geo->coordinates[0] . " " . $content->geo->coordinates[1];
}
- if (is_array($content->coordinates->coordinates)) {
+ if (!empty($content->coordinates->coordinates)) {
$postarray["coord"] = $content->coordinates->coordinates[1] . " " . $content->coordinates->coordinates[0];
}
diff --git a/twitter/twitter.php b/twitter/twitter.php
index 99c7d496..2b5b4b53 100644
--- a/twitter/twitter.php
+++ b/twitter/twitter.php
@@ -799,7 +799,7 @@ function twitter_do_mirrorpost(App $a, $uid, $post)
// $datarray['object'] = json_encode($post); // Activate for debugging
$datarray["title"] = "";
- if (is_object($post->retweeted_status)) {
+ if (!empty($post->retweeted_status)) {
// We don't support nested shares, so we mustn't show quotes as shares on retweets
$item = twitter_createpost($a, $uid, $post->retweeted_status, ['id' => 0], false, false, true);
@@ -1254,7 +1254,7 @@ function twitter_expand_entities(App $a, $body, $item, $picture)
function twitter_media_entities($post, &$postarray)
{
// There are no media entities? So we quit.
- if (!is_array($post->extended_entities->media)) {
+ if (empty($post->extended_entities->media)) {
return "";
}
@@ -1274,6 +1274,9 @@ function twitter_media_entities($post, &$postarray)
// This is a pure media post, first search for all media urls
$media = [];
foreach ($post->extended_entities->media AS $medium) {
+ if (!isset($media[$medium->url])) {
+ $media[$medium->url] = '';
+ }
switch ($medium->type) {
case 'photo':
$media[$medium->url] .= "\n[img]" . $medium->media_url_https . "[/img]";
@@ -1396,6 +1399,9 @@ function twitter_createpost(App $a, $uid, $post, $self, $create_user, $only_exis
if ($post->user->protected) {
$postarray['private'] = 1;
$postarray['allow_cid'] = '<' . $self['id'] . '>';
+ } else {
+ $postarray['private'] = 0;
+ $postarray['allow_cid'] = '';
}
if (is_string($post->full_text)) {
@@ -1420,22 +1426,22 @@ function twitter_createpost(App $a, $uid, $post, $self, $create_user, $only_exis
$statustext = $converted["plain"];
- if (is_string($post->place->name)) {
+ if (!empty($post->place->name)) {
$postarray["location"] = $post->place->name;
}
- if (is_string($post->place->full_name)) {
+ if (!empty($post->place->full_name)) {
$postarray["location"] = $post->place->full_name;
}
- if (is_array($post->geo->coordinates)) {
+ if (!empty($post->geo->coordinates)) {
$postarray["coord"] = $post->geo->coordinates[0] . " " . $post->geo->coordinates[1];
}
- if (is_array($post->coordinates->coordinates)) {
+ if (!empty($post->coordinates->coordinates)) {
$postarray["coord"] = $post->coordinates->coordinates[1] . " " . $post->coordinates->coordinates[0];
}
- if (is_object($post->retweeted_status)) {
+ if (!empty($post->retweeted_status)) {
$retweet = twitter_createpost($a, $uid, $post->retweeted_status, $self, false, false, $noquote);
- $retweet['object'] = $postarray['object'];
+ //$retweet['object'] = $postarray['object'];
$retweet['private'] = $postarray['private'];
$retweet['allow_cid'] = $postarray['allow_cid'];
$retweet['contact-id'] = $postarray['contact-id'];
@@ -1446,7 +1452,7 @@ function twitter_createpost(App $a, $uid, $post, $self, $create_user, $only_exis
$postarray = $retweet;
}
- if (is_object($post->quoted_status) && !$noquote) {
+ if (!empty($post->quoted_status) && !$noquote) {
$quoted = twitter_createpost($a, $uid, $post->quoted_status, $self, false, false, true);
$postarray['body'] = $statustext;
@@ -1508,10 +1514,6 @@ function twitter_fetchparentposts(App $a, $uid, $post, TwitterOAuth $connection,
$item = Item::insert($postarray);
- if ($notify) {
- $item = $notify;
- }
-
$postarray["id"] = $item;
logger('twitter_fetchparentpost: User ' . $self["nick"] . ' posted parent timeline item ' . $item);
@@ -1629,7 +1631,7 @@ function twitter_fetchhometimeline(App $a, $uid)
$postarray = twitter_createpost($a, $uid, $post, $self, $create_user, true, false);
- if (trim($postarray['body']) == "") {
+ if (empty($postarray['body']) || trim($postarray['body']) == "") {
continue;
}
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;
}