X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FHashtag.php;h=aebe15dd0d0e325e8d3ffa979ec7751af8264fe6;hb=714f0febc4918f5569eb09f8800b6739cff36347;hp=82cfa1f847a6a25d0d1e6ea80ff01c5be3774992;hpb=b54b0f072855f571b830c0b91a65076e0e0178be;p=friendica.git diff --git a/src/Module/Hashtag.php b/src/Module/Hashtag.php index 82cfa1f847..aebe15dd0d 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 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() { $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); }