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/leistungsschutzrecht/leistungsschutzrecht.php b/leistungsschutzrecht/leistungsschutzrecht.php index 04d3e556..6cfe95fe 100644 --- a/leistungsschutzrecht/leistungsschutzrecht.php +++ b/leistungsschutzrecht/leistungsschutzrecht.php @@ -138,6 +138,10 @@ function leistungsschutzrecht_is_member_site($url) { $cleanedurlpart = explode("%", $urldata["host"]); $hostname = explode(".", $cleanedurlpart[0]); + if (empty($hostname)) { + return false; + } + $site = $hostname[sizeof($hostname) - 2].".".$hostname[sizeof($hostname) - 1]; return (isset($sites[$site])); diff --git a/newmemberwidget/newmemberwidget.php b/newmemberwidget/newmemberwidget.php index 57b49230..5aff1c96 100644 --- a/newmemberwidget/newmemberwidget.php +++ b/newmemberwidget/newmemberwidget.php @@ -11,29 +11,42 @@ use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; -function newmemberwidget_install () { - Addon::registerHook( 'network_mod_init', 'addon/newmemberwidget/newmemberwidget.php', 'newmemberwidget_network_mod_init'); - logger('newmemberwidget installed'); -} -function newmemberwidget_uninstall () { - Addon::unregisterHook( 'network_mod_init', 'addon/newmemberwidget/newmemberwidget.php', 'newmemberwidget_network_mod_init'); +function newmemberwidget_install() +{ + Addon::registerHook( 'network_mod_init', 'addon/newmemberwidget/newmemberwidget.php', 'newmemberwidget_network_mod_init'); + logger('newmemberwidget installed'); } -function newmemberwidget_network_mod_init ( $a, $b) { - if (x($_SESSION['new_member'])) { +function newmemberwidget_uninstall() +{ + Addon::unregisterHook( 'network_mod_init', 'addon/newmemberwidget/newmemberwidget.php', 'newmemberwidget_network_mod_init'); +} + +function newmemberwidget_network_mod_init ($a, $b) +{ + if (empty($_SESSION['new_member'])) { + return; + } + $t = '
'; - $a->page['aside'] = $t . $a->page['aside']; - } + $a->page['aside'] = $t . $a->page['aside']; } function newmemberwidget_addon_admin_post(&$a) 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..9e02a74d 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -494,23 +494,23 @@ function pumpio_send(&$a, &$b) 'objectType' => "note", 'content' => $content]; - if ($title != "") { + if (!empty($title)) { $params["object"]["displayName"] = $title; } - if (count($receiver["to"])) { + if (!empty($receiver["to"])) { $params["to"] = $receiver["to"]; } - if (count($receiver["bto"])) { + if (!empty($receiver["bto"])) { $params["bto"] = $receiver["bto"]; } - if (count($receiver["cc"])) { + if (!empty($receiver["cc"])) { $params["cc"] = $receiver["cc"]; } - if (count($receiver["bcc"])) { + if (!empty($receiver["bcc"])) { $params["bcc"] = $receiver["bcc"]; } } else { @@ -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; @@ -1168,7 +1168,11 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet $reply = new stdClass; $reply->verb = "note"; - $reply->cc = $post->cc; + + if (isset($post->cc)) { + $reply->cc = $post->cc; + } + $reply->to = $post->to; $reply->object = new stdClass; $reply->object->objectType = $post->object->inReplyTo->objectType; @@ -1186,7 +1190,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,11 +1207,11 @@ 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"]; } - if ($post->object->displayName != "") { + if (!empty($post->object->displayName)) { $postarray['title'] = $post->object->displayName; } @@ -1303,6 +1307,10 @@ function pumpio_fetchinbox(&$a, $uid) $success = false; } + if (!$success) { + return; + } + if ($user->items) { $posts = array_reverse($user->items); @@ -1587,9 +1595,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.'