X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FHashtag.php;h=dd0c94d8fa33d1e891fffdace52bc03f38c874a1;hb=8038c1b04ffa723ebd28610fb72927d8d21b3577;hp=b016b4da407ccf3dd3f5b0e40c9d8c0ca8062933;hpb=0e01568ccd5b5ce081eff83e2ed0b888e0b6db55;p=friendica.git diff --git a/src/Module/Hashtag.php b/src/Module/Hashtag.php index b016b4da40..dd0c94d8fa 100644 --- a/src/Module/Hashtag.php +++ b/src/Module/Hashtag.php @@ -1,7 +1,24 @@ . + * */ + namespace Friendica\Module; use Friendica\BaseModule; @@ -9,33 +26,28 @@ use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\Util\Strings; -require_once 'include/dba.php'; -require_once 'include/text.php'; - /** * Hashtag module. */ class Hashtag extends BaseModule { - - public static function content() + protected function content(array $request = []): string { $result = []; - $t = Strings::escapeTags($_REQUEST['t']); + $t = Strings::escapeHtml($_REQUEST['t']); if (empty($t)) { System::jsonExit($result); } - $taglist = DBA::p("SELECT DISTINCT(`term`) FROM `term` WHERE `term` LIKE ? AND `type` = ? ORDER BY `term`", - $t . '%', - intval(TERM_HASHTAG) - ); + $taglist = DBA::select('tag', ['name'], ["`name` LIKE ?", $t . "%"], ['order' => ['name'], 'limit' => 100]); while ($tag = DBA::fetch($taglist)) { - $result[] = ['text' => $tag['term']]; + $result[] = ['text' => $tag['name']]; } DBA::close($taglist); System::jsonExit($result); + + return ''; } }