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

This commit is contained in:
nobody 2021-03-21 22:01:51 -07:00
commit 5e4d7d15a1
6 changed files with 100 additions and 15 deletions

View file

@ -745,6 +745,51 @@ class Activity {
else
return [];
if (! isset($ret['url'])) {
$urls = [];
if (intval($i['item_wall'])) {
$locs = self::nomadic_locations($i);
if ($locs) {
foreach ($locs as $l) {
if (strpos($ret['id'],$l['hubloc_url']) !== false) {
continue;
}
$urls[] = [
'type' => 'Link',
'href' => str_replace(z_root(),$l['hubloc_url'],$ret['id']),
'rel' => 'alternate',
'mediaType' => 'text/html'
];
$urls[] = [
'type' => 'Link',
'href' => str_replace(z_root(),$l['hubloc_url'],$ret['id']),
'rel' => 'alternate',
'mediaType' => 'application/activity+json'
];
$urls[] = [
'type' => 'Link',
'href' => str_replace(z_root(),$l['hubloc_url'],$ret['id']),
'rel' => 'alternate',
'mediaType' => 'application/x-zot+json'
];
}
}
}
if ($urls) {
$curr[] = [
'type' => 'Link',
'href' => $ret['id'],
'rel' => 'alternate',
'mediaType' => 'text/html'
];
$ret['url'] = array_merge($curr, $urls);
}
else {
$ret['url'] = $ret['id'];
}
}
if ($i['obj']) {
if (! is_array($i['obj'])) {
$i['obj'] = json_decode($i['obj'],true);
@ -1072,19 +1117,49 @@ class Activity {
}
if (! isset($ret['url'])) {
$ret['url'] = $ret['id'];
$urls = [];
if (intval($i['item_wall'])) {
$locs = self::nomadic_locations($i);
if ($locs) {
foreach ($locs as $l) {
if (strpos($i['mid'],$l['hubloc_url']) !== false) {
continue;
}
$urls[] = [
'type' => 'Link',
'href' => str_replace(z_root(),$l['hubloc_url'],$ret['id']),
'rel' => 'alternate',
'mediaType' => 'text/html'
];
$urls[] = [
'type' => 'Link',
'href' => str_replace(z_root(),$l['hubloc_url'],$ret['id']),
'rel' => 'alternate',
'mediaType' => 'application/activity+json'
];
$urls[] = [
'type' => 'Link',
'href' => str_replace(z_root(),$l['hubloc_url'],$ret['id']),
'rel' => 'alternate',
'mediaType' => 'application/x-zot+json'
];
}
}
}
if ($urls) {
$curr[] = [
'type' => 'Link',
'href' => $ret['id'],
'rel' => 'alternate',
'mediaType' => 'text/html'
];
$ret['url'] = array_merge($curr, $urls);
}
else {
$ret['url'] = $ret['id'];
}
}
// Very few ActivityPub projects currently support url as array
// and most will choke and die if you supply one here.
// $ret['url'] = [
// 'type' => 'Link',
// 'rel' => 'alternate',
// 'mediaType' => 'text/html',
// 'href' => $ret['id']
// ];
$t = self::encode_taxonomy($i);
if ($t) {
$ret['tag'] = $t;

View file

@ -267,9 +267,10 @@ class Item extends Controller {
// the text/html page of the item.
if (argc() > 1 && argv(1) !== 'drop') {
$x = q("select uid, item_wall, llink, mid from item where mid = '%s' or mid = '%s' ",
$x = q("select uid, item_wall, llink, mid from item where mid = '%s' or mid = '%s' or uuid = '%s'",
dbesc(z_root() . '/item/' . argv(1)),
dbesc(z_root() . '/activity/' . argv(1))
dbesc(z_root() . '/activity/' . argv(1)),
dbesc(argv(1))
);
if ($x) {
foreach ($x as $xv) {

View file

@ -109,7 +109,7 @@ class Search extends Controller {
}
// look for a naked webbie
if (strpos($search,'@') !== false) {
if (strpos($search,'@') !== false && strpos($search,'http') !== 0) {
goaway(z_root() . '/directory' . '?f=1&navsearch=1&search=' . $search);
}

View file

@ -614,7 +614,7 @@ class Channel {
'$lbl_p2macro' => t('Channel Permission Limits'),
'$expire' => array('expire',t('Expire other channel content after this many days'),$expire, t('0 or blank to use the website limit.') . ' ' . ((intval($sys_expire)) ? sprintf( t('This website expires after %d days.'),intval($sys_expire)) : t('This website does not expire imported content.')) . ' ' . t('The website limit takes precedence if lower than your limit.')),
'$expire' => array('expire',t('Expire conversations you have not participated in after this many days'),$expire, t('0 or blank to use the website limit.') . ' ' . ((intval($sys_expire)) ? sprintf( t('This website expires after %d days.'),intval($sys_expire)) : t('This website does not provide an expiration policy.')) . ' ' . t('The website limit takes precedence if lower than your limit.')),
'$maxreq' => array('maxreq', t('Maximum Friend Requests/Day:'), intval($channel['channel_max_friend_req']) , t('May reduce spam activity')),
'$permissions' => t('Default Access List'),
'$permdesc' => t("(click to open/close)"),

View file

@ -1493,6 +1493,7 @@ function bbcode($Text, $options = []) {
// blockquotes
$Text = preg_replace('#^(&gt;)+ +(.*?)$#m','<blockquote>$2</blockquote>',$Text);
$Text = preg_replace('#^(\>)+ +(.*?)$#m','<blockquote>$2</blockquote>',$Text);
$Text = preg_replace('#</blockquote>\n<blockquote>#',"\n", $Text);
// links

View file

@ -3397,6 +3397,14 @@ function item_expire($uid,$days,$comment_days = 7) {
continue;
}
// don't expire pinned items either
$pinned = PConfig::Get($item['uid'], 'pinned', $item['item_type'], []);
if (in_array($item['mid'], $pinned)) {
retain_item($item['id']);
continue;
}
drop_item($item['id'],false);
}