X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FHashtag.php;h=9c90b97b27cce16bc4e54c0100dbb031fe023a74;hb=3bca4fe2a64671d09e08346456cdfa6c12f996e9;hp=c35a6440c0d3b379cdd3105cf39f2f3ca65860c7;hpb=c9f02d534e2016acf18d7fa18db193d056495841;p=friendica.git diff --git a/src/Module/Hashtag.php b/src/Module/Hashtag.php index c35a6440c0..9c90b97b27 100644 --- a/src/Module/Hashtag.php +++ b/src/Module/Hashtag.php @@ -1,40 +1,55 @@ . + * */ + 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 rawContent(array $request = []) { $result = []; - $t = escape_tags($_REQUEST['t']); - if (empty($t)) { - System::jsonExit($result); + if (empty($request['t'])) { + $this->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']]; + while ($tag = DBA::fetch($taglist)) { + $result[] = ['text' => $tag['name']]; } - dba::close($taglist); + DBA::close($taglist); - System::jsonExit($result); + $this->jsonExit($result); } }