mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-19 23:35:12 +00:00
wip: replies collection cont.
This commit is contained in:
parent
888010df5c
commit
fd139224d0
1 changed files with 5 additions and 14 deletions
|
@ -52,7 +52,7 @@ class Replies extends Controller
|
||||||
$portable_id = $sigdata['portable_id'];
|
$portable_id = $sigdata['portable_id'];
|
||||||
observer_auth($portable_id);
|
observer_auth($portable_id);
|
||||||
|
|
||||||
// first see if we have a copy of this item's parent owned by the current signer
|
// first see if we have a copy of this item owned by the current signer
|
||||||
// include xchans for all zot-like networks - these will have the same guid and public key
|
// include xchans for all zot-like networks - these will have the same guid and public key
|
||||||
|
|
||||||
$x = q(
|
$x = q(
|
||||||
|
@ -76,15 +76,6 @@ class Replies extends Controller
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$parsed = parse_url($sigdata['signer']);
|
|
||||||
unset($parsed['fragment']);
|
|
||||||
unset($parsed['query']);
|
|
||||||
|
|
||||||
$idUrl = unparse_url($parsed);
|
|
||||||
$hublocs = q("select * from hubloc where hubloc_id_url = '%s'",
|
|
||||||
dbesc($idUrl)
|
|
||||||
);
|
|
||||||
$zot6Hubloc = $hublocs && $hublocs[0]['hubloc_network'] === 'zot6';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we don't have a parent id belonging to the signer see if we can obtain one as a visitor that we have permission to access
|
// if we don't have a parent id belonging to the signer see if we can obtain one as a visitor that we have permission to access
|
||||||
|
@ -105,7 +96,7 @@ class Replies extends Controller
|
||||||
|
|
||||||
xchan_query($i);
|
xchan_query($i);
|
||||||
|
|
||||||
$sql_noAdd = ($zot6Hubloc) ? " and verb not in ('Add', 'Remove') " : '';
|
$sql_noAdd = " and verb not in ('Add', 'Remove') ";
|
||||||
|
|
||||||
$items = q(
|
$items = q(
|
||||||
"SELECT item.*, item.id AS item_id FROM item WHERE item.thr_parent = '%s' $item_normal $sql_noAdd and item_private = %d and item_deleted = 0 and uid = %d",
|
"SELECT item.*, item.id AS item_id FROM item WHERE item.thr_parent = '%s' $item_normal $sql_noAdd and item_private = %d and item_deleted = 0 and uid = %d",
|
||||||
|
@ -172,17 +163,17 @@ class Replies extends Controller
|
||||||
http_status_exit(403, 'Forbidden');
|
http_status_exit(403, 'Forbidden');
|
||||||
}
|
}
|
||||||
|
|
||||||
$i = ZlibActivity::encode_item_collection($nitems, 'replies/' . $item_mid, 'OrderedCollection', true, z_root() . '/channel/' . $chan['channel_address'], count($nitems));
|
$collection = ZlibActivity::encode_item_collection($nitems, 'replies/' . $item_mid, 'OrderedCollection', true, z_root() . '/channel/' . $chan['channel_address'], count($nitems));
|
||||||
if ($portable_id && (!intval($items[0]['item_private']))) {
|
if ($portable_id && (!intval($items[0]['item_private']))) {
|
||||||
ThreadListener::store(z_root() . '/activity/' . $item_mid, $portable_id);
|
ThreadListener::store(z_root() . '/activity/' . $item_mid, $portable_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$i) {
|
if (!$collection) {
|
||||||
http_status_exit(404, 'Not found');
|
http_status_exit(404, 'Not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
$channel = Channel::from_id($i[0]['uid']);
|
$channel = Channel::from_id($i[0]['uid']);
|
||||||
as_return_and_die($i, $channel);
|
as_return_and_die($collection, $channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
goaway(z_root() . '/item/' . argv(1));
|
goaway(z_root() . '/item/' . argv(1));
|
||||||
|
|
Loading…
Reference in a new issue