]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Search/Index.php
Issue 11309: improved check for wanted posts
[friendica.git] / src / Module / Search / Index.php
index 39bf940972aa7fd36b8b7fece42655e4ff6a635c..93c1af7aa6d5874afb82f08d744ae4392969c893 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2022, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -38,22 +38,19 @@ use Friendica\Model\Post;
 use Friendica\Model\Tag;
 use Friendica\Module\BaseSearch;
 use Friendica\Network\HTTPException;
-use Friendica\Util\Strings;
 
 class Index extends BaseSearch
 {
-       public static function content(array $parameters = [])
+       protected function content(array $request = []): string
        {
-               $search = (!empty($_GET['q']) ? Strings::escapeTags(trim(rawurldecode($_GET['q']))) : '');
+               $search = (!empty($_GET['q']) ? trim(rawurldecode($_GET['q'])) : '');
 
                if (DI::config()->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()) {
@@ -90,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