mirror of
https://github.com/friendica/friendica
synced 2025-03-20 17:48:25 +00:00
Rework Hashtag module to avoid undefined key error
- Address https://github.com/friendica/friendica/issues/13025#issuecomment-1537143590
This commit is contained in:
parent
29329f799d
commit
527c17a8a7
1 changed files with 8 additions and 6 deletions
|
@ -31,23 +31,25 @@ use Friendica\Util\Strings;
|
||||||
*/
|
*/
|
||||||
class Hashtag extends BaseModule
|
class Hashtag extends BaseModule
|
||||||
{
|
{
|
||||||
protected function content(array $request = []): string
|
protected function rawContent(array $request = [])
|
||||||
{
|
{
|
||||||
$result = [];
|
$result = [];
|
||||||
|
|
||||||
$t = Strings::escapeHtml($_REQUEST['t']);
|
if (empty($request['t'])) {
|
||||||
if (empty($t)) {
|
|
||||||
System::jsonExit($result);
|
System::jsonExit($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
$taglist = DBA::select('tag', ['name'], ["`name` LIKE ?", $t . "%"], ['order' => ['name'], 'limit' => 100]);
|
$taglist = DBA::select(
|
||||||
|
'tag',
|
||||||
|
['name'],
|
||||||
|
["`name` LIKE ?", Strings::escapeHtml($request['t']) . "%"],
|
||||||
|
['order' => ['name'], 'limit' => 100]
|
||||||
|
);
|
||||||
while ($tag = DBA::fetch($taglist)) {
|
while ($tag = DBA::fetch($taglist)) {
|
||||||
$result[] = ['text' => $tag['name']];
|
$result[] = ['text' => $tag['name']];
|
||||||
}
|
}
|
||||||
DBA::close($taglist);
|
DBA::close($taglist);
|
||||||
|
|
||||||
System::jsonExit($result);
|
System::jsonExit($result);
|
||||||
|
|
||||||
return '';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue