]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Hashtag.php
Separate section for contacts without any relationship
[friendica.git] / src / Module / Hashtag.php
index 8c1dad4afd3702767e904d9ae8aa1aff226ec96d..0c4c41c7e17c002334069025c9a17b8f82ed2333 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2023, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -25,30 +25,28 @@ use Friendica\BaseModule;
 use Friendica\Core\System;
 use Friendica\Database\DBA;
 use Friendica\Util\Strings;
-use Friendica\Model\Tag;
-use Friendica\Model\Term;
 
 /**
  * Hashtag module.
  */
 class Hashtag extends BaseModule
 {
-
-       public static function content(array $parameters = [])
+       protected function rawContent(array $request = [])
        {
                $result = [];
 
-               $t = Strings::escapeHtml($_REQUEST['t']);
-               if (empty($t)) {
+               if (empty($request['t'])) {
                        System::jsonExit($result);
                }
 
-               $taglist = DBA::p("SELECT DISTINCT(`term`) FROM `term` WHERE `term` LIKE ? AND `type` = ? ORDER BY `term`",
-                       $t . '%',
-                       intval(Tag::HASHTAG)
+               $taglist = DBA::select(
+                       'tag',
+                       ['name'],
+                       ["`name` LIKE ?", Strings::escapeHtml($request['t']) . "%"],
+                       ['order' => ['name'], 'limit' => 100]
                );
                while ($tag = DBA::fetch($taglist)) {
-                       $result[] = ['text' => $tag['term']];
+                       $result[] = ['text' => $tag['name']];
                }
                DBA::close($taglist);