assorted fixes

This commit is contained in:
zotlabs 2018-09-09 18:28:13 -07:00
parent 39d295462e
commit e1b0570690
3 changed files with 20 additions and 8 deletions

View file

@ -100,8 +100,10 @@ class ActivityStreams {
$this->tgt['actor'] = $this->get_actor('actor',$this->tgt);
$this->parent_id = $this->get_property_obj('inReplyTo');
if(! $this->parent_id) {
if(! $this->parent_id) {
$this->parent_id = $this->obj['inReplyTo'];
}
if(! $this->parent_id) {
$this->parent_id = $this->obj['id'];
}
}
@ -243,20 +245,30 @@ class ActivityStreams {
*/
function fetch_property($url) {
return self::fetch($url);
}
static function fetch($url) {
$redirects = 0;
if(! check_siteallowed($url)) {
logger('blacklisted: ' . $url);
return null;
}
logger('fetch: ' . $url, LOGGER_DEBUG);
$x = z_fetch_url($url, true, $redirects,
['headers' => [ 'Accept: application/activity+json, application/ld+json; profile="https://www.w3.org/ns/activitystreams"' ]]);
if($x['success'])
[ 'headers' => [ 'Accept: application/activity+json, application/ld+json; profile="https://www.w3.org/ns/activitystreams"' ]]);
if($x['success']) {
$y = json_decode($x['body'],true);
logger('returned: ' . json_encode($y,JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES));
return json_decode($x['body'], true);
}
else {
logger('fetch failed: ' . $url);
}
return null;
}
/**
* @brief
*

View file

@ -806,7 +806,7 @@ class Enotify {
else {
$itemem_text = (($item['item_thread_top'])
? t('created a new post')
: sprintf( t('commented on %s\'s post'), $item['owner']['xchan_name']));
: sprintf( t('reacted to %s\'s conversation'), $item['owner']['xchan_name']));
if($item['verb'] === 'Announce') {
$itemem_text = sprintf( t('post shared by %s'), $item['owner']['xchan_name']);
}

View file

@ -1343,7 +1343,7 @@ function preg_heart($x) {
$t = '';
for($cnt = 0; $cnt < strlen($x[1]); $cnt ++)
$t .= '<img class="smiley" src="' . z_root() . '/images/emoticons/smiley-heart.gif" alt="&lt;3" />';
$t .= '<img class="smiley" src="' . z_root() . '/images/emoticons/smiley-heart.gif" alt="&lt;&#8203;3" />';
$r = str_replace($x[0],$t,$x[0]);