X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FHashtag.php;h=365e77572cfa50f1227534b273ee4dfd4652e1fc;hb=52ea22505d109d07033066d4a45c1b785ceade33;hp=a53585c28412f1aec644427fb3bd958afb7657d6;hpb=daa1177e3a1e42b4c95e0a8759f1610942b952c7;p=friendica.git diff --git a/src/Module/Hashtag.php b/src/Module/Hashtag.php index a53585c284..365e77572c 100644 --- a/src/Module/Hashtag.php +++ b/src/Module/Hashtag.php @@ -1,39 +1,50 @@ . + * */ + 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\Database\DBA; +use Friendica\Util\Strings; /** * Hashtag module. */ class Hashtag extends BaseModule { - - public static function content() + public static function content(array $parameters = []) { $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' => $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); }