]> git.mxchange.org Git - friendica.git/commitdiff
Fix for several fatal errors
authorMichael <heluecht@pirati.ca>
Wed, 23 Jan 2019 21:54:20 +0000 (21:54 +0000)
committerMichael <heluecht@pirati.ca>
Wed, 23 Jan 2019 21:54:20 +0000 (21:54 +0000)
src/Content/OEmbed.php
src/Content/Widget/ContactBlock.php
src/Module/Inbox.php
src/Protocol/DFRN.php
src/Protocol/OStatus.php
src/Worker/Notifier.php

index 7adff8908682d26e189dec42198f870f0496a1c0..0093ba11af38a8e948ab6cca40d5b0c59be0cf40 100644 (file)
@@ -86,8 +86,7 @@ class OEmbed
                                $redirects = 0;
                                $html_text = Network::fetchUrl($embedurl, false, $redirects, 15, 'text/*');
                                if ($html_text) {
-                                       $dom = new DOMDocument();
-                                       $dom->loadHTML($html_text);
+                                       $dom = @DOMDocument::loadHTML($html_text);
                                        if ($dom) {
                                                $xpath = new DOMXPath($dom);
                                                $entries = $xpath->query("//link[@type='application/json+oembed']");
@@ -275,8 +274,7 @@ class OEmbed
                        $html_text = mb_convert_encoding($text, 'HTML-ENTITIES', mb_detect_encoding($text));
 
                        // If it doesn't parse at all, just return the text.
-                       $dom = new DOMDocument();
-                       $dom->loadHTML($html_text);
+                       $dom = @DOMDocument::loadHTML($html_text);
                        if (!$dom) {
                                return $text;
                        }
index 33f72af40e82c0128286942475b413e58f38d6a5..fdc7a470f7e468a52ded3f42468ed6c4f5fe9553 100644 (file)
@@ -57,9 +57,9 @@ class ContactBlock
 
                $contacts_title = L10n::t('No contacts');
 
-               if (!$total) {
-                       $micropro = [];
-               } else {
+               $micropro = [];
+
+               if ($total) {
                        // Only show followed for personal accounts, followers for pages
                        if (defaults($profile, 'account-type', User::ACCOUNT_TYPE_PERSON) == User::ACCOUNT_TYPE_PERSON) {
                                $rel = [Contact::FOLLOWER, Contact::FRIEND];
index 8842c66bcb67f82db1137c7e2b1479ca52dcaeb0..c075dd6a638888384ee9e18db7617de4b90ab27c 100644 (file)
@@ -10,6 +10,7 @@ use Friendica\Protocol\ActivityPub;
 use Friendica\Core\System;
 use Friendica\Database\DBA;
 use Friendica\Util\HTTPSignature;
+use Friendica\Core\Config;
 
 /**
  * ActivityPub Inbox
index 5e6c733e211068c5be3bb85b6257226bfe5c3072..52790d46dddb8c89e0e92feaefa7869b00df13a4 100644 (file)
@@ -2512,7 +2512,7 @@ class DFRN
                }
 
                $notice_info = $xpath->query("statusnet:notice_info", $entry);
-               if ($notice_info && ($notice_info->length > 0)) {
+               if ($notice_info && ($notice_info->length > 0) && !empty($notice_info->item)) {
                        foreach ($notice_info->item[0]->attributes as $attributes) {
                                if ($attributes->name == "source") {
                                        $item["app"] = strip_tags($attributes->textContent);
@@ -2588,7 +2588,7 @@ class DFRN
                $item['conversation-uri'] = XML::getFirstNodeValue($xpath, 'ostatus:conversation/text()', $entry);
 
                $conv = $xpath->query('ostatus:conversation', $entry);
-               if (is_object($conv->item[0])) {
+               if (!empty($conv->item[0])) {
                        foreach ($conv->item[0]->attributes as $attributes) {
                                if ($attributes->name == "ref") {
                                        $item['conversation-uri'] = $attributes->textContent;
@@ -2603,7 +2603,7 @@ class DFRN
                $item["parent-uri"] = $item["uri"];
 
                $inreplyto = $xpath->query("thr:in-reply-to", $entry);
-               if (is_object($inreplyto->item[0])) {
+               if (!empty($inreplyto->item[0])) {
                        foreach ($inreplyto->item[0]->attributes as $attributes) {
                                if ($attributes->name == "ref") {
                                        $item["parent-uri"] = $attributes->textContent;
index b2d0004c06ef7fd7e1da8dd50c7695d069337384..051c0d6c8c99db01946652afbba4f46680818ddb 100644 (file)
@@ -53,7 +53,7 @@ class OStatus
         * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         * @throws \ImagickException
         */
-       private static function fetchAuthor(DOMXPath $xpath, $context, array $importer, array &$contact, $onlyfetch)
+       private static function fetchAuthor(DOMXPath $xpath, $context, array $importer, &$contact, $onlyfetch)
        {
                $author = [];
                $author["author-link"] = XML::getFirstNodeValue($xpath, 'atom:author/atom:uri/text()', $context);
@@ -322,7 +322,7 @@ class OStatus
         * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         * @throws \ImagickException
         */
-       private static function process($xml, array $importer, array &$contact, &$hub, $stored = false, $initialize = true)
+       private static function process($xml, array $importer, &$contact, &$hub, $stored = false, $initialize = true)
        {
                if ($initialize) {
                        self::$itemlist = [];
index 9e5430e8fa8d7f831437cc168ac0f8b40f6cff53..ef4e8824922ec03926a3f683265208ee8354dc0e 100644 (file)
@@ -152,7 +152,7 @@ class Notifier
                if (!empty($target_item) && !empty($items)) {
                        $parent = $items[0];
 
-                       $delivery_queue_count += self::activityPubDelivery($cmd, $target_item, $parent, $a->queue['priority'], $a->query_string['created']);
+                       $delivery_queue_count += self::activityPubDelivery($cmd, $target_item, $parent, $a->queue['priority'], defaults($a->query_string, 'created', ''));
 
                        $fields = ['network', 'author-id', 'owner-id'];
                        $condition = ['uri' => $target_item["thr-parent"], 'uid' => $target_item["uid"]];