]> git.mxchange.org Git - friendica.git/blobdiff - mod/network.php
Rename removeTags to escapeTags
[friendica.git] / mod / network.php
index 5913f804b62609ac8c11639c865b84d33e438b7c..81a2f2b2ba63e8514b634664d50191099d10e03b 100644 (file)
@@ -10,6 +10,7 @@ use Friendica\Content\ForumManager;
 use Friendica\Content\Nav;
 use Friendica\Content\Pager;
 use Friendica\Content\Widget;
+use Friendica\Content\Text\HTML;
 use Friendica\Core\ACL;
 use Friendica\Core\Addon;
 use Friendica\Core\Config;
@@ -27,6 +28,7 @@ use Friendica\Model\Profile;
 use Friendica\Module\Login;
 use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Proxy as ProxyUtils;
+use Friendica\Util\Strings;
 
 require_once 'include/conversation.php';
 require_once 'include/items.php';
@@ -40,7 +42,7 @@ function network_init(App $a)
 
        Hook::add('head', __FILE__, 'network_infinite_scroll_head');
 
-       $search = (x($_GET, 'search') ? escape_tags($_GET['search']) : '');
+       $search = (x($_GET, 'search') ? Strings::escapeHtml($_GET['search']) : '');
 
        if (($search != '') && !empty($_GET['submit'])) {
                $a->internalRedirect('search?search=' . urlencode($search));
@@ -201,11 +203,11 @@ function saved_searches($search)
                ];
        }
 
-       $tpl = get_markup_template('saved_searches_aside.tpl');
+       $tpl = Renderer::getMarkupTemplate('saved_searches_aside.tpl');
        $o = Renderer::replaceMacros($tpl, [
                '$title'     => L10n::t('Saved Searches'),
                '$add'       => L10n::t('add'),
-               '$searchbox' => search($search, 'netsearch-box', $srchurl, true),
+               '$searchbox' => HTML::search($search, 'netsearch-box', $srchurl, true),
                '$saved'     => $saved,
        ]);
 
@@ -348,7 +350,7 @@ function networkConversation(App $a, $items, Pager $pager, $mode, $update, $orde
 
        if (!$update) {
                if (PConfig::get(local_user(), 'system', 'infinite_scroll')) {
-                       $o .= scroll_loader();
+                       $o .= HTML::scrollLoader();
                } else {
                        $o .= $pager->renderMinimal(count($items));
                }
@@ -517,9 +519,9 @@ function networkThreadedView(App $a, $update, $parent)
                for ($x = 1; $x < $a->argc; $x ++) {
                        if (is_a_date_arg($a->argv[$x])) {
                                if ($datequery) {
-                                       $datequery2 = escape_tags($a->argv[$x]);
+                                       $datequery2 = Strings::escapeHtml($a->argv[$x]);
                                } else {
-                                       $datequery = escape_tags($a->argv[$x]);
+                                       $datequery = Strings::escapeHtml($a->argv[$x]);
                                        $_GET['order'] = 'post';
                                }
                        } elseif (intval($a->argv[$x])) {
@@ -535,7 +537,7 @@ function networkThreadedView(App $a, $update, $parent)
        $star  = intval(defaults($_GET, 'star' , 0));
        $bmark = intval(defaults($_GET, 'bmark', 0));
        $conv  = intval(defaults($_GET, 'conv' , 0));
-       $order = notags(defaults($_GET, 'order', 'comment'));
+       $order = Strings::escapeTags(defaults($_GET, 'order', 'comment'));
        $nets  =        defaults($_GET, 'nets' , '');
 
        if ($cid) {
@@ -648,13 +650,13 @@ function networkThreadedView(App $a, $update, $parent)
 
                        $sql_post_table .= " INNER JOIN `item` AS `temp1` ON `temp1`.`id` = " . $sql_table . "." . $sql_parent;
                        $sql_extra3 .= " AND (`thread`.`contact-id` IN ($contact_str) ";
-                       $sql_extra3 .= " OR (`thread`.`contact-id` = '$contact_str_self' AND `temp1`.`allow_gid` LIKE '" . protect_sprintf('%<' . intval($gid) . '>%') . "' AND `temp1`.`private`))";
+                       $sql_extra3 .= " OR (`thread`.`contact-id` = '$contact_str_self' AND `temp1`.`allow_gid` LIKE '" . Strings::protectSprintf('%<' . intval($gid) . '>%') . "' AND `temp1`.`private`))";
                } else {
                        $sql_extra3 .= " AND false ";
                        info(L10n::t('Group is empty'));
                }
 
-               $o = Renderer::replaceMacros(get_markup_template('section_title.tpl'), [
+               $o = Renderer::replaceMacros(Renderer::getMarkupTemplate('section_title.tpl'), [
                        '$title' => L10n::t('Group: %s', $group['name'])
                ]) . $o;
        } elseif ($cid) {
@@ -675,7 +677,7 @@ function networkThreadedView(App $a, $update, $parent)
 
                        $entries[0]['account_type'] = Contact::getAccountType($contact);
 
-                       $o = Renderer::replaceMacros(get_markup_template('viewcontact_template.tpl'), [
+                       $o = Renderer::replaceMacros(Renderer::getMarkupTemplate('viewcontact_template.tpl'), [
                                'contacts' => $entries,
                                'id' => 'network',
                        ]) . $o;
@@ -696,11 +698,11 @@ function networkThreadedView(App $a, $update, $parent)
        }
 
        if ($datequery) {
-               $sql_extra3 .= protect_sprintf(sprintf(" AND $sql_table.created <= '%s' ",
+               $sql_extra3 .= Strings::protectSprintf(sprintf(" AND $sql_table.created <= '%s' ",
                                DBA::escape(DateTimeFormat::convert($datequery, 'UTC', date_default_timezone_get()))));
        }
        if ($datequery2) {
-               $sql_extra3 .= protect_sprintf(sprintf(" AND $sql_table.created >= '%s' ",
+               $sql_extra3 .= Strings::protectSprintf(sprintf(" AND $sql_table.created >= '%s' ",
                                DBA::escape(DateTimeFormat::convert($datequery2, 'UTC', date_default_timezone_get()))));
        }
 
@@ -881,7 +883,7 @@ function networkThreadedView(App $a, $update, $parent)
                        foreach ($data as $item) {
                                // Don't show hash tag posts from blocked or ignored contacts
                                $condition = ["`nurl` = ? AND `uid` = ? AND (`blocked` OR `readonly`)",
-                                       normalise_link($item['author-link']), local_user()];
+                                       Strings::normaliseLink($item['author-link']), local_user()];
                                if (!DBA::exists('contact', $condition)) {
                                        $s[$item['uri']] = $item;
                                }
@@ -1033,7 +1035,7 @@ function network_tabs(App $a)
        $arr = ['tabs' => $tabs];
        Addon::callHooks('network_tabs', $arr);
 
-       $tpl = get_markup_template('common_tabs.tpl');
+       $tpl = Renderer::getMarkupTemplate('common_tabs.tpl');
 
        return Renderer::replaceMacros($tpl, ['$tabs' => $arr['tabs']]);
 
@@ -1059,7 +1061,7 @@ function network_infinite_scroll_head(App $a, &$htmlhead)
        if (PConfig::get(local_user(), 'system', 'infinite_scroll')
                && defaults($_GET, 'mode', '') != 'minimal'
        ) {
-               $tpl = get_markup_template('infinite_scroll_head.tpl');
+               $tpl = Renderer::getMarkupTemplate('infinite_scroll_head.tpl');
                $htmlhead .= Renderer::replaceMacros($tpl, [
                        '$pageno'     => $pager->getPage(),
                        '$reload_uri' => $pager->getBaseQueryString()