Merge branch 'dev' of /home/macgirvin/roadhouse into dev

This commit is contained in:
nobody 2021-02-23 16:13:48 -08:00
commit 7a831b5554
2 changed files with 24 additions and 8 deletions

View file

@ -989,7 +989,11 @@ class Activity {
if ($token && $has_images) {
for ($n = 0; $n < count($images); $n ++) {
$match = $images[$n];
if (strpos($match[2],z_root() . '/photo/') !== false) {
if (strpos($match[1],'=http') === 0 && strpos($match[1],'/photo/' !== false)) {
$i['body'] = str_replace($match[1],$match[1] . '?token=' . $token, $i['body']);
$images[$n][2] = substr($match[1],1) . '?token=' . $token;
}
elseif (strpos($match[2],z_root() . '/photo/') !== false) {
$i['body'] = str_replace($match[2],$match[2] . '?token=' . $token, $i['body']);
$images[$n][2] = $match[2] . '?token=' . $token;
}
@ -1053,13 +1057,20 @@ class Activity {
if ($activitypub && $has_images && $ret['type'] === 'Note') {
$img = [];
foreach ($images as $match) {
$img[] = [ 'type' => 'Image', 'url' => $match[2] ];
// handle Friendica-style img links with [img=$url]$alttext[/img]
if (strpos($match,'=http') === 0) {
$img[] = [ 'type' => 'Image', 'url' => substr($match[1],1) ];
}
else {
$img[] = [ 'type' => 'Image', 'url' => $match[2] ];
}
if (! $ret['attachment']) {
$ret['attachment'] = [];
}
$ret['attachment'] = array_merge($img,$ret['attachment']);
}
if (! $ret['attachment']) {
$ret['attachment'] = [];
}
$ret['attachment'] = array_merge($img,$ret['attachment']);
}
}
// addressing madness

View file

@ -1367,7 +1367,12 @@ function purify_imported_object($obj) {
$ret = null;
if (is_array($obj)) {
foreach ( $obj as $k => $v ) {
$ret[$k] = purify_html($v);
if (is_array($v)) {
$ret[$k] = purify_imported_object($v);
}
elseif (is_string($v)) {
$ret[$k] = purify_html($v);
}
}
}
elseif (is_string($obj)) {