partial solution for obj|tgt multiple (zot and zot6) encodings; the zot6 version will be stored under $item['obj']['asld']

This commit is contained in:
zotlabs 2018-12-03 20:09:57 -08:00
parent ffc3dba682
commit 42aeb19562
3 changed files with 12 additions and 0 deletions

View File

@ -11,9 +11,15 @@ class Activity {
static function encode_object($x) { static function encode_object($x) {
if(($x) && (! is_array($x)) && (substr(trim($x),0,1)) === '{' ) { if(($x) && (! is_array($x)) && (substr(trim($x),0,1)) === '{' ) {
$x = json_decode($x,true); $x = json_decode($x,true);
} }
if(is_array($x) && array_key_exists('asld',$x)) {
$x = $x['asld'];
}
if($x['type'] === ACTIVITY_OBJ_PERSON) { if($x['type'] === ACTIVITY_OBJ_PERSON) {
return self::fetch_person($x); return self::fetch_person($x);
} }

View File

@ -1,6 +1,8 @@
<?php <?php
namespace Zotlabs\Module; namespace Zotlabs\Module;
use Zotlabs\Lib\Activity;
require_once('include/security.php'); require_once('include/security.php');
require_once('include/bbcode.php'); require_once('include/bbcode.php');
require_once('include/items.php'); require_once('include/items.php');
@ -400,6 +402,7 @@ class Like extends \Zotlabs\Web\Controller {
$object = json_encode(array( $object = json_encode(array(
'type' => $objtype, 'type' => $objtype,
'id' => $item['mid'], 'id' => $item['mid'],
'asld' => Activity::fetch_item( [ 'id' => $item['mid'] ] ),
'parent' => (($item['thr_parent']) ? $item['thr_parent'] : $item['parent_mid']), 'parent' => (($item['thr_parent']) ? $item['thr_parent'] : $item['parent_mid']),
'link' => $links, 'link' => $links,
'title' => $item['title'], 'title' => $item['title'],

View File

@ -43,6 +43,9 @@ class Wfinger extends \Zotlabs\Web\Controller {
if(strpos($resource,'acct:') === 0) { if(strpos($resource,'acct:') === 0) {
$channel = str_replace('acct:','',$resource); $channel = str_replace('acct:','',$resource);
if(substr($channel,0,1) === '@' && strpos(substr($channel,1),'@')) {
$channel = substr($channel,1);
}
if(strpos($channel,'@') !== false) { if(strpos($channel,'@') !== false) {
$host = substr($channel,strpos($channel,'@')+1); $host = substr($channel,strpos($channel,'@')+1);