From 27577824de3918c2f44c236916f3b2faeb92ec4f Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 17 Feb 2021 18:14:29 +0000 Subject: fix php8 issue in include/oembed and unencapsulate for zot_refresh() --- include/oembed.php | 5 ++++- include/zot.php | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/oembed.php b/include/oembed.php index b6060c878..01cd8945f 100644 --- a/include/oembed.php +++ b/include/oembed.php @@ -433,9 +433,12 @@ function oembed_html2bbcode($text) { $html_text = mb_convert_encoding($text, 'HTML-ENTITIES', mb_detect_encoding($text)); // If it doesn't parse at all, just return the text. - $dom = @DOMDocument::loadHTML($html_text); + + $dom = new DOMDocument; + @$dom->loadHTML($html_text); if(! $dom) return $text; + $xpath = new DOMXPath($dom); $attr = "oembed"; diff --git a/include/zot.php b/include/zot.php index e68da4209..e1472b35e 100644 --- a/include/zot.php +++ b/include/zot.php @@ -464,6 +464,7 @@ function zot_refresh($them, $channel = null, $force = false) { if($j['permissions']['data']) { $permissions = Crypto::unencapsulate( [ + 'encrypted' => true, 'data' => $j['permissions']['data'], 'key' => $j['permissions']['key'], 'iv' => $j['permissions']['iv'], @@ -472,6 +473,7 @@ function zot_refresh($them, $channel = null, $force = false) { $channel['channel_prvkey']); if($permissions) { $permissions = json_decode($permissions,true); +hz_syslog(print_r($permissions,true)); } logger('decrypted permissions: ' . print_r($permissions,true), LOGGER_DATA, LOG_DEBUG); } -- cgit v1.2.3 From edd4ac791f959b19a68b7b244687b8b2273df5a3 Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 17 Feb 2021 18:15:09 +0000 Subject: remove logging --- include/zot.php | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/zot.php b/include/zot.php index e1472b35e..84bf3f9b2 100644 --- a/include/zot.php +++ b/include/zot.php @@ -473,7 +473,6 @@ function zot_refresh($them, $channel = null, $force = false) { $channel['channel_prvkey']); if($permissions) { $permissions = json_decode($permissions,true); -hz_syslog(print_r($permissions,true)); } logger('decrypted permissions: ' . print_r($permissions,true), LOGGER_DATA, LOG_DEBUG); } -- cgit v1.2.3 From 0aeb4d6fb5ebb18ff2814472db000fbdf321c1e2 Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 17 Feb 2021 19:41:27 +0000 Subject: php8: fix mod mail if there are no messages --- include/message.php | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'include') diff --git a/include/message.php b/include/message.php index 37fe6749d..e6c9ed8ee 100644 --- a/include/message.php +++ b/include/message.php @@ -17,9 +17,9 @@ function mail_prepare_binary($item) { // send a private message - -function send_message($uid = 0, $recipient = '', $body = '', $subject = '', $replyto = '', $expires = NULL_DATE, $mimetype = 'text/bbcode', $raw = false, $sig = '') { + +function send_message($uid = 0, $recipient = '', $body = '', $subject = '', $replyto = '', $expires = NULL_DATE, $mimetype = 'text/bbcode', $raw = false, $sig = '') { $ret = array('success' => false); $is_reply = false; @@ -80,7 +80,7 @@ function send_message($uid = 0, $recipient = '', $body = '', $subject = '', $rep $ret['message'] = t('No recipient provided.'); return $ret; } - + if(! strlen($subject)) $subject = t('[no subject]'); @@ -99,13 +99,13 @@ function send_message($uid = 0, $recipient = '', $body = '', $subject = '', $rep if($r) { $conv_guid = $r[0]['conv_guid']; } - } + } if(! $conv_guid) { // create a new conversation - $retconv = create_conversation($channel,$recipient,$subject); + $retconv = create_conversation($channel,$recipient,$subject); if($retconv) { $conv_guid = $retconv['guid']; } @@ -153,7 +153,7 @@ function send_message($uid = 0, $recipient = '', $body = '', $subject = '', $rep /** * - * When a photo was uploaded into the message using the (profile wall) ajax + * When a photo was uploaded into the message using the (profile wall) ajax * uploader, The permissions are initially set to disallow anybody but the * owner from seeing it. This is because the permissions may not yet have been * set for the post. If it's private, the photo permissions should be set @@ -232,7 +232,7 @@ function send_message($uid = 0, $recipient = '', $body = '', $subject = '', $rep dbesc($image_uri), intval($channel['channel_id']), dbesc('<' . $channel['channel_hash'] . '>') - ); + ); } } @@ -293,7 +293,7 @@ function create_conversation($channel,$recipient,$subject) { dbesc($conv_guid), intval($channel['channel_id']) ); - + return $r[0]; } @@ -308,11 +308,12 @@ function private_messages_list($uid, $mailbox = '', $start = 0, $numitems = 0) { if($numitems) $limit = " LIMIT " . intval($numitems) . " OFFSET " . intval($start); - + if($mailbox !== '') { $x = q("select channel_hash from channel where channel_id = %d limit 1", intval($uid) ); + if(! $x) return array(); @@ -332,10 +333,9 @@ function private_messages_list($uid, $mailbox = '', $start = 0, $numitems = 0) { case 'combined': default: $parents = q("SELECT mail.parent_mid FROM mail LEFT JOIN conv ON mail.conv_guid = conv.guid WHERE mail.mid = mail.parent_mid AND mail.channel_id = %d ORDER BY conv.updated DESC $limit", - dbesc($local_channel) + intval($local_channel) ); break; - } } @@ -346,7 +346,7 @@ function private_messages_list($uid, $mailbox = '', $start = 0, $numitems = 0) { foreach($parents as $parent) { $all = q("SELECT * FROM mail WHERE parent_mid = '%s' AND channel_id = %d ORDER BY created DESC limit 1", dbesc($parent['parent_mid']), - dbesc($local_channel) + intval($local_channel) ); if($all) { @@ -356,7 +356,7 @@ function private_messages_list($uid, $mailbox = '', $start = 0, $numitems = 0) { } } } - else { + elseif($sql) { $r = q($sql); } @@ -477,7 +477,7 @@ function private_messages_drop($channel_id, $messageitem_id, $drop_conversation dbesc($x[0]['conv_guid']), intval($channel_id) ); - } + } $m['mail'] = array(); foreach($z as $zz) { xchan_mail_query($zz); @@ -513,7 +513,7 @@ function private_messages_fetch_conversation($channel_id, $messageitem_id, $upda intval($messageitem_id) ); - if(! $r) + if(! $r) return array(); $messages = q("select * from mail where parent_mid = '%s' and channel_id = %d order by created asc", @@ -559,7 +559,7 @@ function private_messages_fetch_conversation($channel_id, $messageitem_id, $upda intval($channel_id) ); } - + return $messages; } -- cgit v1.2.3