X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FHashtag.php;h=0c4c41c7e17c002334069025c9a17b8f82ed2333;hb=e1863951986ba5be173758324a00652bc5af870c;hp=879b27ea7a73dcc219d991e739eb91f0286a59b3;hpb=96c086ea139047fc893ffb51843d3e24c5422c44;p=friendica.git diff --git a/src/Module/Hashtag.php b/src/Module/Hashtag.php index 879b27ea7a..0c4c41c7e1 100644 --- a/src/Module/Hashtag.php +++ b/src/Module/Hashtag.php @@ -1,35 +1,54 @@ . + * */ + namespace Friendica\Module; use Friendica\BaseModule; use Friendica\Core\System; -use dba; +use Friendica\Database\DBA; +use Friendica\Util\Strings; /** * Hashtag module. */ -class Hashtag extends BaseModule { - - public static function init() +class Hashtag extends BaseModule { + 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' => strtolower($tag['term'])]; + while ($tag = DBA::fetch($taglist)) { + $result[] = ['text' => $tag['name']]; } - dba::close($taglist); + DBA::close($taglist); System::jsonExit($result); }