From a7ec1805e3f5836641503d1f8cb6ccc1d8c885fa Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 13 Feb 2022 18:58:12 +0000 Subject: address deprecation warnings --- Zotlabs/Lib/Enotify.php | 6 +++++- Zotlabs/Lib/LDSignatures.php | 11 ++++++----- Zotlabs/Lib/Libzot.php | 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) (limited to 'Zotlabs/Lib') diff --git a/Zotlabs/Lib/Enotify.php b/Zotlabs/Lib/Enotify.php index 2e483cb92..1421c72ae 100644 --- a/Zotlabs/Lib/Enotify.php +++ b/Zotlabs/Lib/Enotify.php @@ -845,6 +845,10 @@ class Enotify { // convert this logic into a json array just like the system notifications $who = (($item['verb'] === ACTIVITY_SHARE) ? 'owner' : 'author'); + $body = html2plain(bbcode($item['body'], ['drop_media']), 75, true); + if ($body) { + $body = htmlentities($body, ENT_QUOTES, 'UTF-8', false); + } $x = array( 'notify_link' => $item['llink'], @@ -858,7 +862,7 @@ class Enotify { //'b64mid' => ((in_array($item['verb'], [ACTIVITY_LIKE, ACTIVITY_DISLIKE])) ? gen_link_id($item['thr_parent']) : gen_link_id($item['mid'])), 'thread_top' => (($item['item_thread_top']) ? true : false), 'message' => bbcode(escape_tags($itemem_text)), - 'body' => htmlentities(html2plain(bbcode($item['body'], ['drop_media', true]), 75, true), ENT_QUOTES, 'UTF-8', false), + 'body' => $body, // these are for the superblock addon 'hash' => $item[$who]['xchan_hash'], 'uid' => $item['uid'], diff --git a/Zotlabs/Lib/LDSignatures.php b/Zotlabs/Lib/LDSignatures.php index 1c2095f10..00042bc7a 100644 --- a/Zotlabs/Lib/LDSignatures.php +++ b/Zotlabs/Lib/LDSignatures.php @@ -75,22 +75,23 @@ class LDSignatures { } static function hash($obj) { - - return hash('sha256',self::normalise($obj)); + return hash('sha256', self::normalise($obj)); } static function normalise($data) { + $ret = ''; + if(is_string($data)) { $data = json_decode($data); } if(! is_object($data)) - return ''; + return $ret; jsonld_set_document_loader('jsonld_document_loader'); try { - $d = jsonld_normalize($data,[ 'algorithm' => 'URDNA2015', 'format' => 'application/nquads' ]); + $ret = jsonld_normalize($data,[ 'algorithm' => 'URDNA2015', 'format' => 'application/nquads' ]); } catch (\Exception $e) { // Don't log the exception - this can exhaust memory @@ -98,7 +99,7 @@ class LDSignatures { logger('normalise error: ' . print_r($data,true)); } - return $d; + return $ret; } static function salmon_sign($data,$channel) { diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php index e4d8d2275..83536a033 100644 --- a/Zotlabs/Lib/Libzot.php +++ b/Zotlabs/Lib/Libzot.php @@ -1003,7 +1003,7 @@ class Libzot { $x = Crypto::unencapsulate($x, get_config('system', 'prvkey')); - if (!is_array($x)) { + if ($x && !is_array($x)) { $x = json_decode($x, true); } -- cgit v1.2.3