aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2018-05-08 20:12:49 -0700
committerzotlabs <mike@macgirvin.com>2018-05-08 20:12:49 -0700
commit0545baaf56efa6353b728b46e25e64f1a058bb5f (patch)
treebf8e50ce0898cccc083c6526d105231557d1269a /Zotlabs/Module
parentfbd26e8d9d5482961d5b0d0f2f10a38b2ea8009c (diff)
downloadvolse-hubzilla-0545baaf56efa6353b728b46e25e64f1a058bb5f.tar.gz
volse-hubzilla-0545baaf56efa6353b728b46e25e64f1a058bb5f.tar.bz2
volse-hubzilla-0545baaf56efa6353b728b46e25e64f1a058bb5f.zip
initial backend support for channel page item search
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r--Zotlabs/Module/Channel.php20
1 files changed, 18 insertions, 2 deletions
diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php
index 953f87f11..2ed40047b 100644
--- a/Zotlabs/Module/Channel.php
+++ b/Zotlabs/Module/Channel.php
@@ -178,6 +178,21 @@ class Channel extends \Zotlabs\Web\Controller {
$simple_update = (($update) ? " AND item_unseen = 1 " : '');
+
+ $search = EMPTY_STR;
+ if(x($_GET,'search')) {
+ $search = escape_tags($_GET['search']);
+ if(strpos($search,'#') === 0) {
+ $sql_extra2 .= term_query('item',substr($search,1),TERM_HASHTAG,TERM_COMMUNITYTAG);
+ }
+ else {
+ $sql_extra2 .= sprintf(" AND item.body like '%s' ",
+ dbesc(protect_sprintf('%' . $search . '%'))
+ );
+ }
+ }
+
+
head_add_link([
'rel' => 'alternate',
'type' => 'application/json+oembed',
@@ -233,6 +248,7 @@ class Channel extends \Zotlabs\Web\Controller {
$sql_extra2 .= protect_sprintf(sprintf(" AND item.created >= '%s' ", dbesc(datetime_convert(date_default_timezone_get(),'',$datequery2))));
}
+
$itemspage = get_pconfig(local_channel(),'system','itemspage');
\App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20));
$pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(\App::$pager['itemspage']), intval(\App::$pager['start']));
@@ -251,7 +267,7 @@ class Channel extends \Zotlabs\Web\Controller {
else {
$r = q("SELECT item.parent AS item_id FROM item
left join abook on ( item.author_xchan = abook.abook_xchan $abook_uids )
- WHERE true and item.uid = %d AND item.item_thread_top = 1 $item_normal
+ WHERE true and item.uid = %d $item_normal
AND (abook.abook_blocked = 0 or abook.abook_flags is null)
AND item.item_wall = 1
$sql_extra $sql_extra2
@@ -323,7 +339,7 @@ class Channel extends \Zotlabs\Web\Controller {
'$fh' => '0',
'$static' => $static,
'$page' => ((\App::$pager['page'] != 1) ? \App::$pager['page'] : 1),
- '$search' => '',
+ '$search' => $search,
'$xchan' => '',
'$order' => '',
'$list' => ((x($_REQUEST,'list')) ? intval($_REQUEST['list']) : 0),