X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FHashtag.php;h=471515e6296ea4cccdc63a0833454b035a720eb6;hb=99284222c1d7fb4adca9077e3057faf3b36f7180;hp=82cfa1f847a6a25d0d1e6ea80ff01c5be3774992;hpb=7acb4b04343df31c2cc78214fae5429c66d95fb2;p=friendica.git diff --git a/src/Module/Hashtag.php b/src/Module/Hashtag.php index 82cfa1f847..471515e629 100644 --- a/src/Module/Hashtag.php +++ b/src/Module/Hashtag.php @@ -1,40 +1,53 @@ . + * */ + namespace Friendica\Module; use Friendica\BaseModule; use Friendica\Core\System; -use dba; - -require_once 'include/dba.php'; -require_once 'include/text.php'; +use Friendica\Database\DBA; +use Friendica\Util\Strings; /** * Hashtag module. */ class Hashtag extends BaseModule { - - public static function content() + protected function content(array $request = []): string { $result = []; - $t = escape_tags($_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) - ); - while ($tag = dba::fetch($taglist)) { - $result[] = ['text' => strtolower($tag['term'])]; + $taglist = DBA::select('tag', ['name'], ["`name` LIKE ?", $t . "%"], ['order' => ['name'], 'limit' => 100]); + while ($tag = DBA::fetch($taglist)) { + $result[] = ['text' => $tag['name']]; } - dba::close($taglist); + DBA::close($taglist); System::jsonExit($result); + + return ''; } }