X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FSearch%2FIndex.php;h=93c1af7aa6d5874afb82f08d744ae4392969c893;hb=69b7923df2beed71419bc38e61ca9755fad24b12;hp=1c55ff4b4b0f483bb046e12194b1aa46e1c38100;hpb=ee5207410c71492b2e771479ff1890d8ef4552da;p=friendica.git diff --git a/src/Module/Search/Index.php b/src/Module/Search/Index.php index 1c55ff4b4b..93c1af7aa6 100644 --- a/src/Module/Search/Index.php +++ b/src/Module/Search/Index.php @@ -1,6 +1,6 @@ get('system', 'block_public') && !Session::isAuthenticated()) { throw new HTTPException\ForbiddenException(DI::l10n()->t('Public access denied.')); } if (DI::config()->get('system', 'local_search') && !Session::isAuthenticated()) { - $e = new HTTPException\ForbiddenException(DI::l10n()->t('Only logged in users are permitted to perform a search.')); - $e->httpdesc = DI::l10n()->t('Public access denied.'); - throw $e; + throw new HTTPException\ForbiddenException(DI::l10n()->t('Only logged in users are permitted to perform a search.')); } if (DI::config()->get('system', 'permit_crawling') && !Session::isAuthenticated()) { @@ -91,7 +87,7 @@ class Index extends BaseSearch $tag = false; if (!empty($_GET['tag'])) { $tag = true; - $search = '#' . Strings::escapeTags(trim(rawurldecode($_GET['tag']))); + $search = '#' . trim(rawurldecode($_GET['tag'])); } // contruct a wrapper for the search header @@ -166,13 +162,15 @@ class Index extends BaseSearch $count = Tag::countByTag($search, local_user()); } else { Logger::info('Start fulltext search.', ['q' => $search]); - $uriids = ItemContent::getURIIdListBySearch($search, local_user(), $pager->getStart(), $pager->getItemsPerPage(), $last_uriid); - $count = ItemContent::countBySearch($search, local_user()); + $uriids = Post\Content::getURIIdListBySearch($search, local_user(), $pager->getStart(), $pager->getItemsPerPage(), $last_uriid); + $count = Post\Content::countBySearch($search, local_user()); } if (!empty($uriids)) { - $params = ['order' => ['id' => true], 'group_by' => ['uri-id']]; - $items = Post::toArray(Post::selectForUser(local_user(), [], ['uri-id' => $uriids], $params)); + $condition = ["(`uid` = ? OR (`uid` = ? AND NOT `global`))", 0, local_user()]; + $condition = DBA::mergeConditions($condition, ['uri-id' => $uriids]); + $params = ['order' => ['id' => true]]; + $items = Post::toArray(Post::selectForUser(local_user(), Item::DISPLAY_FIELDLIST, $condition, $params)); } if (empty($items)) { @@ -199,7 +197,7 @@ class Index extends BaseSearch Logger::info('Start Conversation.', ['q' => $search]); - $o .= conversation(DI::app(), $items, 'search', false, false, 'commented', local_user()); + $o .= DI::conversation()->create($items, 'search', false, false, 'commented', local_user()); if (DI::pConfig()->get(local_user(), 'system', 'infinite_scroll')) { $o .= HTML::scrollLoader();