diff options
author | Mario Vavti <mario@mariovavti.com> | 2021-01-22 11:12:39 +0100 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2021-01-22 11:12:39 +0100 |
commit | e6aed4fb8ef5853f27100a2b9e2903323c874ce8 (patch) | |
tree | 46169f6b8df8dd5f29d13de663ed80e1df037542 /Zotlabs/Module | |
parent | bdd6d878f1d83c1cc7b84ead5e171bf2c3a73b7c (diff) | |
download | volse-hubzilla-e6aed4fb8ef5853f27100a2b9e2903323c874ce8.tar.gz volse-hubzilla-e6aed4fb8ef5853f27100a2b9e2903323c874ce8.tar.bz2 volse-hubzilla-e6aed4fb8ef5853f27100a2b9e2903323c874ce8.zip |
implement externals via zot6 and zotfeed - part 2
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r-- | Zotlabs/Module/Zotfeed.php | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/Zotlabs/Module/Zotfeed.php b/Zotlabs/Module/Zotfeed.php index 6f4cd9fc4..e838ae34c 100644 --- a/Zotlabs/Module/Zotfeed.php +++ b/Zotlabs/Module/Zotfeed.php @@ -19,19 +19,11 @@ class Zotfeed extends Controller { killme(); } - if (argc() < 2) { - killme(); - } - - $channel = channelx_by_nick(argv(1)); + $channel = ((argv(1)) ? channelx_by_nick(argv(1)) : get_sys_channel()); if (!$channel) { killme(); } - if (intval($channel['channel_system'])) { - killme(); - } - $sigdata = HTTPSig::verify(($_SERVER['REQUEST_METHOD'] === 'POST') ? file_get_contents('php://input') : EMPTY_STR); if ($sigdata['portable_id'] && $sigdata['header_valid']) { $portable_id = $sigdata['portable_id']; @@ -60,10 +52,32 @@ class Zotfeed extends Controller { $params['cat'] = ((x($_REQUEST, 'cat')) ? escape_tags($_REQUEST['cat']) : ''); $params['compat'] = 1; + if (intval($channel['channel_system'])) { + $total = zot_feed($channel['channel_id'], $observer_hash, ['total' => true]); + + if ($total) { + App::set_pager_total($total); + App::set_pager_itemspage(30); + } + + if (App::$pager['unset'] && $total > 30) { + $ret = Activity::paged_collection_init($total, App::$query_string); + + } + else { + $items = zot_feed($channel['channel_id'], $observer_hash, []); + $ret = Activity::encode_item_collection($items, App::$query_string, 'OrderedCollection', $total); + } + + as_return_and_die($ret, $channel); + + return; + } + $total = items_fetch( [ 'total' => true, - 'wall' => '1', + 'wall' => 1, 'datequery' => $params['end'], 'datequery2' => $params['begin'], 'direction' => dbesc($params['direction']), @@ -77,16 +91,17 @@ class Zotfeed extends Controller { if ($total) { App::set_pager_total($total); - App::set_pager_itemspage(100); + App::set_pager_itemspage(30); } - if (App::$pager['unset'] && $total > 100) { + if (App::$pager['unset'] && $total > 30) { $ret = Activity::paged_collection_init($total, App::$query_string); } else { + $items = items_fetch( [ - 'wall' => '1', + 'wall' => 1, 'datequery' => $params['end'], 'datequery2' => $params['begin'], 'records' => intval(App::$pager['itemspage']), @@ -99,7 +114,6 @@ class Zotfeed extends Controller { 'compat' => $params['compat'] ], $channel, $observer_hash, CLIENT_MODE_NORMAL, App::$module ); - $ret = Activity::encode_item_collection($items, App::$query_string, 'OrderedCollection', $total); } |