]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Hashtag.php
Merge pull request #8271 from MrPetovan/bug/8229-frio-mobile-back-to-top
[friendica.git] / src / Module / Hashtag.php
index c35a6440c0d3b379cdd3105cf39f2f3ca65860c7..50719774fb51cb5f3595e8c3adf5e7567b62e756 100644 (file)
@@ -1,15 +1,30 @@
 <?php
 /**
- * @file src/Module/Hashtag.php
+ * @copyright Copyright (C) 2020, Friendica
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
  */
+
 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.
@@ -17,23 +32,23 @@ require_once 'include/text.php';
 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`",
+               $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)) {
+               while ($tag = DBA::fetch($taglist)) {
                        $result[] = ['text' => $tag['term']];
                }
-               dba::close($taglist);
+               DBA::close($taglist);
 
                System::jsonExit($result);
        }