X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FHashtag.php;h=0c4c41c7e17c002334069025c9a17b8f82ed2333;hb=e1863951986ba5be173758324a00652bc5af870c;hp=bfe1eee7de3eb79e1a7142564470af1d9249b17a;hpb=4f2ae8868431952bd3acda1537ee899740cbf205;p=friendica.git diff --git a/src/Module/Hashtag.php b/src/Module/Hashtag.php index bfe1eee7de..0c4c41c7e1 100644 --- a/src/Module/Hashtag.php +++ b/src/Module/Hashtag.php @@ -1,37 +1,52 @@ . + * */ + namespace Friendica\Module; use Friendica\BaseModule; use Friendica\Core\System; use Friendica\Database\DBA; - -require_once 'include/dba.php'; -require_once 'include/text.php'; +use Friendica\Util\Strings; /** * Hashtag module. */ class Hashtag extends BaseModule { - - public static function content() + protected function rawContent(array $request = []) { $result = []; - $t = escape_tags($_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(TERM_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);