pages feed
This commit is contained in:
parent
3b697957af
commit
4df0aad6ab
@ -220,6 +220,7 @@ function get_public_feed($channel,$params) {
|
|||||||
$start = 0;
|
$start = 0;
|
||||||
$records = 40;
|
$records = 40;
|
||||||
$direction = 'desc';
|
$direction = 'desc';
|
||||||
|
$pages = 0;
|
||||||
|
|
||||||
if(! $params)
|
if(! $params)
|
||||||
$params = array();
|
$params = array();
|
||||||
@ -230,6 +231,7 @@ function get_public_feed($channel,$params) {
|
|||||||
$params['start'] = ((x($params,'start')) ? $params['start'] : 0);
|
$params['start'] = ((x($params,'start')) ? $params['start'] : 0);
|
||||||
$params['records'] = ((x($params,'records')) ? $params['records'] : 40);
|
$params['records'] = ((x($params,'records')) ? $params['records'] : 40);
|
||||||
$params['direction'] = ((x($params,'direction')) ? $params['direction'] : 'desc');
|
$params['direction'] = ((x($params,'direction')) ? $params['direction'] : 'desc');
|
||||||
|
$params['pages'] = ((x($params,'pages')) ? intval($params['pages']) : 0);
|
||||||
|
|
||||||
switch($params['type']) {
|
switch($params['type']) {
|
||||||
case 'json':
|
case 'json':
|
||||||
@ -250,9 +252,15 @@ function get_feed_for($channel, $observer_hash, $params) {
|
|||||||
if(! channel)
|
if(! channel)
|
||||||
http_status_exit(401);
|
http_status_exit(401);
|
||||||
|
|
||||||
|
|
||||||
|
if($params['pages']) {
|
||||||
|
if(! perm_is_allowed($channel['channel_id'],$observer_hash,'view_pages'))
|
||||||
|
http_status_exit(403);
|
||||||
|
}
|
||||||
|
else {
|
||||||
if(! perm_is_allowed($channel['channel_id'],$observer_hash,'view_stream'))
|
if(! perm_is_allowed($channel['channel_id'],$observer_hash,'view_stream'))
|
||||||
http_status_exit(403);
|
http_status_exit(403);
|
||||||
|
}
|
||||||
$items = items_fetch(array(
|
$items = items_fetch(array(
|
||||||
'wall' => '1',
|
'wall' => '1',
|
||||||
'datequery' => $params['begin'],
|
'datequery' => $params['begin'],
|
||||||
@ -260,6 +268,7 @@ function get_feed_for($channel, $observer_hash, $params) {
|
|||||||
'start' => $params['start'], // FIXME
|
'start' => $params['start'], // FIXME
|
||||||
'records' => $params['records'], // FIXME
|
'records' => $params['records'], // FIXME
|
||||||
'direction' => $params['direction'], // FIXME
|
'direction' => $params['direction'], // FIXME
|
||||||
|
'pages' => $params['pages'],
|
||||||
'order' => 'post'
|
'order' => 'post'
|
||||||
), $channel, $observer_hash, CLIENT_MODE_NORMAL, get_app()->module);
|
), $channel, $observer_hash, CLIENT_MODE_NORMAL, get_app()->module);
|
||||||
|
|
||||||
@ -2938,9 +2947,8 @@ function atom_entry($item,$type,$author,$owner,$comment = false,$cid = 0) {
|
|||||||
$o .= '<title>' . xmlify($item['title']) . '</title>' . "\r\n";
|
$o .= '<title>' . xmlify($item['title']) . '</title>' . "\r\n";
|
||||||
$o .= '<published>' . xmlify(datetime_convert('UTC','UTC',$item['created'] . '+00:00',ATOM_TIME)) . '</published>' . "\r\n";
|
$o .= '<published>' . xmlify(datetime_convert('UTC','UTC',$item['created'] . '+00:00',ATOM_TIME)) . '</published>' . "\r\n";
|
||||||
$o .= '<updated>' . xmlify(datetime_convert('UTC','UTC',$item['edited'] . '+00:00',ATOM_TIME)) . '</updated>' . "\r\n";
|
$o .= '<updated>' . xmlify(datetime_convert('UTC','UTC',$item['edited'] . '+00:00',ATOM_TIME)) . '</updated>' . "\r\n";
|
||||||
$o .= '<zot:env>' . base64url_encode($body, true) . '</zot:env>' . "\r\n";
|
|
||||||
// FIXME for other content types
|
$o .= '<content type="' . $type . '" >' . xmlify(prepare_text($body,$item['mimetype'])) . '</content>' . "\r\n";
|
||||||
$o .= '<content type="' . $type . '" >' . xmlify((($type === 'html') ? bbcode($body) : $body)) . '</content>' . "\r\n";
|
|
||||||
$o .= '<link rel="alternate" type="text/html" href="' . xmlify($item['plink']) . '" />' . "\r\n";
|
$o .= '<link rel="alternate" type="text/html" href="' . xmlify($item['plink']) . '" />' . "\r\n";
|
||||||
|
|
||||||
if($item['location']) {
|
if($item['location']) {
|
||||||
@ -3710,11 +3718,17 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
|
|||||||
require_once('include/security.php');
|
require_once('include/security.php');
|
||||||
$sql_extra .= item_permissions_sql($channel['channel_id']);
|
$sql_extra .= item_permissions_sql($channel['channel_id']);
|
||||||
|
|
||||||
|
if($arr['pages'])
|
||||||
|
$item_restrict = " AND (item_restrict & " . ITEM_WEBPAGE . ") ";
|
||||||
|
else
|
||||||
|
$item_restrict = " AND item_restrict = 0 ";
|
||||||
|
|
||||||
|
|
||||||
if($arr['nouveau'] && ($client_mode & CLIENT_MODELOAD) && $channel) {
|
if($arr['nouveau'] && ($client_mode & CLIENT_MODELOAD) && $channel) {
|
||||||
// "New Item View" - show all items unthreaded in reverse created date order
|
// "New Item View" - show all items unthreaded in reverse created date order
|
||||||
|
|
||||||
$items = q("SELECT item.*, item.id AS item_id FROM item
|
$items = q("SELECT item.*, item.id AS item_id FROM item
|
||||||
WHERE $item_uids AND item_restrict = 0
|
WHERE $item_uids $item_restrict
|
||||||
$simple_update
|
$simple_update
|
||||||
$sql_extra $sql_nets
|
$sql_extra $sql_nets
|
||||||
ORDER BY item.received DESC $pager_sql "
|
ORDER BY item.received DESC $pager_sql "
|
||||||
@ -3741,7 +3755,7 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
|
|||||||
|
|
||||||
$r = q("SELECT distinct item.id AS item_id FROM item
|
$r = q("SELECT distinct item.id AS item_id FROM item
|
||||||
left join abook on item.author_xchan = abook.abook_xchan
|
left join abook on item.author_xchan = abook.abook_xchan
|
||||||
WHERE $item_uids AND item.item_restrict = 0
|
WHERE $item_uids $item_restrict
|
||||||
AND item.parent = item.id
|
AND item.parent = item.id
|
||||||
and ((abook.abook_flags & %d) = 0 or abook.abook_flags is null)
|
and ((abook.abook_flags & %d) = 0 or abook.abook_flags is null)
|
||||||
$sql_extra3 $sql_extra $sql_nets
|
$sql_extra3 $sql_extra $sql_nets
|
||||||
@ -3754,7 +3768,7 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
|
|||||||
// update
|
// update
|
||||||
$r = q("SELECT item.parent AS item_id FROM item
|
$r = q("SELECT item.parent AS item_id FROM item
|
||||||
left join abook on item.author_xchan = abook.abook_xchan
|
left join abook on item.author_xchan = abook.abook_xchan
|
||||||
WHERE $item_uids AND item.item_restrict = 0 $simple_update
|
WHERE $item_uids $item_restrict $simple_update
|
||||||
and ((abook.abook_flags & %d) = 0 or abook.abook_flags is null)
|
and ((abook.abook_flags & %d) = 0 or abook.abook_flags is null)
|
||||||
$sql_extra3 $sql_extra $sql_nets ",
|
$sql_extra3 $sql_extra $sql_nets ",
|
||||||
intval(ABOOK_FLAG_BLOCKED)
|
intval(ABOOK_FLAG_BLOCKED)
|
||||||
@ -3770,7 +3784,7 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
|
|||||||
$parents_str = ids_to_querystr($r,'item_id');
|
$parents_str = ids_to_querystr($r,'item_id');
|
||||||
|
|
||||||
$items = q("SELECT item.*, item.id AS item_id FROM item
|
$items = q("SELECT item.*, item.id AS item_id FROM item
|
||||||
WHERE $item_uids AND item.item_restrict = 0
|
WHERE $item_uids $item_restrict
|
||||||
AND item.parent IN ( %s )
|
AND item.parent IN ( %s )
|
||||||
$sql_extra ",
|
$sql_extra ",
|
||||||
dbesc($parents_str)
|
dbesc($parents_str)
|
||||||
|
@ -10,6 +10,7 @@ function feed_init(&$a) {
|
|||||||
$params['begin'] = ((x($_REQUEST,'date_begin')) ? $_REQUEST['date_begin'] : '0000-00-00 00:00:00');
|
$params['begin'] = ((x($_REQUEST,'date_begin')) ? $_REQUEST['date_begin'] : '0000-00-00 00:00:00');
|
||||||
$params['end'] = ((x($_REQUEST,'date_end')) ? $_REQUEST['date_end'] : '');
|
$params['end'] = ((x($_REQUEST,'date_end')) ? $_REQUEST['date_end'] : '');
|
||||||
$params['type'] = ((stristr(argv(0),'json')) ? 'json' : 'xml');
|
$params['type'] = ((stristr(argv(0),'json')) ? 'json' : 'xml');
|
||||||
|
$params['pages'] = ((x($_REQUEST,'pages')) ? intval($_REQUEST['pages']) : 0);
|
||||||
|
|
||||||
$channel = '';
|
$channel = '';
|
||||||
if(argc() > 1) {
|
if(argc() > 1) {
|
||||||
|
Reference in New Issue
Block a user