diff options
Diffstat (limited to 'Zotlabs/Module/Channel.php')
-rw-r--r-- | Zotlabs/Module/Channel.php | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php index 3d3eb2a85..327ca53db 100644 --- a/Zotlabs/Module/Channel.php +++ b/Zotlabs/Module/Channel.php @@ -152,7 +152,8 @@ class Channel extends \Zotlabs\Web\Controller { 'editor_autocomplete' => true, 'bbco_autocomplete' => 'bbcode', 'bbcode' => true, - 'jotnets' => true + 'jotnets' => true, + 'reset' => t('Reset form') ); $o .= status_editor($a,$x); @@ -178,6 +179,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', @@ -204,7 +220,7 @@ class Channel extends \Zotlabs\Web\Controller { $_SESSION['loadtime'] = datetime_convert(); } else { - $r = q("SELECT distinct parent AS item_id from item + $r = q("SELECT parent AS item_id from item left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids ) WHERE uid = %d $item_normal_update AND item_wall = 1 $simple_update @@ -233,6 +249,10 @@ class Channel extends \Zotlabs\Web\Controller { $sql_extra2 .= protect_sprintf(sprintf(" AND item.created >= '%s' ", dbesc(datetime_convert(date_default_timezone_get(),'',$datequery2)))); } + if($datequery || $datequery2) { + $sql_extra2 .= " and item.item_thread_top != 0 "; + } + $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 +271,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 +343,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), @@ -380,7 +400,7 @@ class Channel extends \Zotlabs\Web\Controller { } if((! $update) || ($checkjs->disabled())) { - $o .= alt_pager($a,count($items)); + $o .= alt_pager(count($items)); if ($mid && $items[0]['title']) \App::$page['title'] = $items[0]['title'] . " - " . \App::$page['title']; } |