aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-11-29 18:07:59 -0800
committerredmatrix <redmatrix@redmatrix.me>2015-11-29 18:07:59 -0800
commit29877963be2f13607976df84e1c88a161714a4a6 (patch)
tree40d8014541f2bc74a8b546d25c51549bb6f790dc
parent302c5afdeed2dbb7502a1dd79e269a3082d5eb18 (diff)
downloadvolse-hubzilla-29877963be2f13607976df84e1c88a161714a4a6.tar.gz
volse-hubzilla-29877963be2f13607976df84e1c88a161714a4a6.tar.bz2
volse-hubzilla-29877963be2f13607976df84e1c88a161714a4a6.zip
issue #189
-rwxr-xr-xinclude/items.php7
-rw-r--r--mod/feed.php1
2 files changed, 7 insertions, 1 deletions
diff --git a/include/items.php b/include/items.php
index 7d349c631..46b396ad2 100755
--- a/include/items.php
+++ b/include/items.php
@@ -550,6 +550,7 @@ function get_public_feed($channel, $params) {
$params['direction'] = ((x($params,'direction')) ? $params['direction'] : 'desc');
$params['pages'] = ((x($params,'pages')) ? intval($params['pages']) : 0);
$params['top'] = ((x($params,'top')) ? intval($params['top']) : 0);
+ $params['cat'] = ((x($params,'cat')) ? $params['cat'] : '');
switch($params['type']) {
case 'json':
@@ -593,7 +594,8 @@ function get_feed_for($channel, $observer_hash, $params) {
'direction' => $params['direction'], // FIXME
'pages' => $params['pages'],
'order' => 'post',
- 'top' => $params['top']
+ 'top' => $params['top'],
+ 'cat' => $params['cat']
), $channel, $observer_hash, CLIENT_MODE_NORMAL, get_app()->module);
@@ -4817,6 +4819,9 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
if($arr['since_id'])
$sql_extra .= " and item.id > " . $since_id . " ";
+ if($arr['cat'])
+ $sql_extra .= protect_sprintf(term_query('item', $arr['cat'], TERM_CATEGORY));
+
if($arr['gid'] && $uid) {
$r = q("SELECT * FROM `groups` WHERE id = %d AND uid = %d LIMIT 1",
intval($arr['group']),
diff --git a/mod/feed.php b/mod/feed.php
index 3b622fc17..eb72af9cf 100644
--- a/mod/feed.php
+++ b/mod/feed.php
@@ -15,6 +15,7 @@ function feed_init(&$a) {
$params['start'] = ((x($params,'start')) ? intval($params['start']) : 0);
$params['records'] = ((x($params,'records')) ? intval($params['records']) : 40);
$params['direction'] = ((x($params,'direction')) ? dbesc($params['direction']) : 'desc');
+ $params['cat'] = ((x($_REQUEST,'cat')) ? escape_tags($_REQUEST['cat']) : '');
$channel = '';
if(argc() > 1) {