aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2022-02-13 18:58:12 +0000
committerMario <mario@mariovavti.com>2022-02-13 18:58:12 +0000
commita7ec1805e3f5836641503d1f8cb6ccc1d8c885fa (patch)
tree048628b0da961a7cfda32dce7ed3572875e22907
parent4b06bc552f04fc78545a450343cc59e236791a66 (diff)
downloadvolse-hubzilla-a7ec1805e3f5836641503d1f8cb6ccc1d8c885fa.tar.gz
volse-hubzilla-a7ec1805e3f5836641503d1f8cb6ccc1d8c885fa.tar.bz2
volse-hubzilla-a7ec1805e3f5836641503d1f8cb6ccc1d8c885fa.zip
address deprecation warnings
-rw-r--r--Zotlabs/Lib/Enotify.php6
-rw-r--r--Zotlabs/Lib/LDSignatures.php11
-rw-r--r--Zotlabs/Lib/Libzot.php2
-rw-r--r--Zotlabs/Module/Directory.php12
-rw-r--r--Zotlabs/Web/HTTPSig.php7
-rw-r--r--include/bbcode.php4
-rw-r--r--include/language.php5
-rw-r--r--include/text.php7
8 files changed, 35 insertions, 19 deletions
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);
}
diff --git a/Zotlabs/Module/Directory.php b/Zotlabs/Module/Directory.php
index b39887c9e..da37c582f 100644
--- a/Zotlabs/Module/Directory.php
+++ b/Zotlabs/Module/Directory.php
@@ -254,21 +254,21 @@ class Directory extends Controller {
$connect_link = '';
$location = '';
- if(strlen($rr['locale']))
+ if(isset($rr['locale']))
$location .= $rr['locale'];
- if(strlen($rr['region'])) {
- if(strlen($rr['locale']))
+ if(isset($rr['region'])) {
+ if($location)
$location .= ', ';
$location .= $rr['region'];
}
- if(strlen($rr['country'])) {
- if(strlen($location))
+ if(isset($rr['country'])) {
+ if($location)
$location .= ', ';
$location .= $rr['country'];
}
$age = '';
- if(strlen($rr['birthday'])) {
+ if(isset($rr['birthday'])) {
if(($years = age($rr['birthday'],'UTC','')) > 0)
$age = $years;
}
diff --git a/Zotlabs/Web/HTTPSig.php b/Zotlabs/Web/HTTPSig.php
index a7a59b8cf..660fdc4ce 100644
--- a/Zotlabs/Web/HTTPSig.php
+++ b/Zotlabs/Web/HTTPSig.php
@@ -528,11 +528,14 @@ class HTTPSig {
if ($head) {
foreach ($head as $k => $v) {
- $headers .= strtolower($k) . ': ' . trim($v) . "\n";
+ $k = strtolower($k);
+ $v = (($v) ? trim($v) : '');
+
+ $headers .= $k . ': ' . $v . "\n";
if ($fields)
$fields .= ' ';
- $fields .= strtolower($k);
+ $fields .= $k;
}
// strip the trailing linefeed
$headers = rtrim($headers, "\n");
diff --git a/include/bbcode.php b/include/bbcode.php
index 03115effe..794cb25d0 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -488,9 +488,9 @@ function getAttachmentData($body) {
$data["preview"] = html_entity_decode($preview, ENT_QUOTES, 'UTF-8');
}
- $data["description"] = trim($match[3]);
+ $data["description"] = ((isset($match[3])) ? trim($match[3]) : '');
- $data["after"] = trim($match[4]);
+ $data["after"] = ((isset($match[4])) ? trim($match[4]) : '');
return $data;
}
diff --git a/include/language.php b/include/language.php
index d291deb63..23aff0a02 100644
--- a/include/language.php
+++ b/include/language.php
@@ -311,6 +311,11 @@ function string_plural_select_default($n) {
* @return string Language code in 2-letter ISO 639-1 (en, de, fr) format
*/
function detect_language($s) {
+
+ if (!$s) {
+ return EMPTY_STR;
+ }
+
$min_length = get_config('system', 'language_detect_min_length');
if ($min_length === false)
$min_length = LANGUAGE_DETECT_MIN_LENGTH;
diff --git a/include/text.php b/include/text.php
index 29a2ab3b1..f69801302 100644
--- a/include/text.php
+++ b/include/text.php
@@ -108,7 +108,10 @@ function notags($string) {
* @return string
*/
function escape_tags($string) {
- return(htmlspecialchars($string, ENT_COMPAT, 'UTF-8', false));
+ if (!$string) {
+ return EMPTY_STR;
+ }
+ return (htmlspecialchars($string, ENT_COMPAT, 'UTF-8', false));
}
@@ -3531,7 +3534,7 @@ function text_highlight($s, $lang) {
// echo (($xml->asXML('data.xml')) ? 'Your XML file has been generated successfully!' : 'Error generating XML file!');
function arrtoxml($root_elem,$arr) {
- $xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><' . $root_elem . '></' . $root_elem . '>', null, false);
+ $xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><' . $root_elem . '></' . $root_elem . '>', 0, false);
array2XML($xml,$arr);
return $xml->asXML();