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;
use Friendica\Core\Hook;
use Friendica\Core\L10n;
+use Friendica\Core\Logger;
use Friendica\Core\PConfig;
use Friendica\Core\Protocol;
+use Friendica\Core\Renderer;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
use Friendica\Model\Group;
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';
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));
$a->page['aside'] = '';
}
- $a->page['aside'] .= (Feature::isEnabled(local_user(), 'groups') ?
- Group::sidebarWidget('network/0', 'network', 'standard', $group_id) : '');
- $a->page['aside'] .= (Feature::isEnabled(local_user(), 'forumlist_widget') ? ForumManager::widget(local_user(), $cid) : '');
+ $a->page['aside'] .= Group::sidebarWidget('network/0', 'network', 'standard', $group_id);
+ $a->page['aside'] .= ForumManager::widget(local_user(), $cid);
$a->page['aside'] .= posted_date_widget('network', local_user(), false);
$a->page['aside'] .= Widget::networks('network', (x($_GET, 'nets') ? $_GET['nets'] : ''));
$a->page['aside'] .= saved_searches($search);
function saved_searches($search)
{
- if (!Feature::isEnabled(local_user(), 'savedsearch')) {
- return '';
- }
-
$a = get_app();
$srchurl = '/network?f='
];
}
- $tpl = get_markup_template('saved_searches_aside.tpl');
- $o = replace_macros($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,
]);
// Set this so that the conversation function can find out contact info for our wall-wall items
$a->page_contact = $a->contact;
+ if (!is_array($items)) {
+ Logger::log("Expecting items to be an array. Got " . print_r($items, true));
+ $items = [];
+ }
+
$o = conversation($a, $items, $pager, $mode, $update, false, $ordering, local_user());
if (!$update) {
if (PConfig::get(local_user(), 'system', 'infinite_scroll')) {
- $o .= scroll_loader();
+ $o .= HTML::scrollLoader();
} else {
$o .= $pager->renderMinimal(count($items));
}
$o = networkThreadedView($a, $update, $parent);
}
+ if ($o === '') {
+ info("No items found");
+ }
+
return $o;
}
}
DBA::close($result);
+ if (count($posts) == 0) {
+ return '';
+ }
$condition = ['uid' => local_user(), 'id' => $posts];
} else {
$condition = ['uid' => local_user()];
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])) {
$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) {
$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 = replace_macros(get_markup_template('section_title.tpl'), [
+ $o = Renderer::replaceMacros(Renderer::getMarkupTemplate('section_title.tpl'), [
'$title' => L10n::t('Group: %s', $group['name'])
]) . $o;
} elseif ($cid) {
$entries[0]['account_type'] = Contact::getAccountType($contact);
- $o = replace_macros(get_markup_template('viewcontact_template.tpl'), [
+ $o = Renderer::replaceMacros(Renderer::getMarkupTemplate('viewcontact_template.tpl'), [
'contacts' => $entries,
'id' => 'network',
]) . $o;
}
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()))));
}
$_SESSION['network_last_date'] = $tag_top_limit;
}
- logger('Tagged items: ' . count($data) . ' - ' . $bottom_limit . ' - ' . $top_limit . ' - ' . local_user().' - '.(int)$update);
+ Logger::log('Tagged items: ' . count($data) . ' - ' . $bottom_limit . ' - ' . $top_limit . ' - ' . local_user().' - '.(int)$update);
$s = [];
foreach ($r as $item) {
$s[$item['uri']] = $item;
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;
}
],
];
- if (Feature::isEnabled(local_user(), 'personal_tab')) {
- $tabs[] = [
- 'label' => L10n::t('Personal'),
- 'url' => str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&conv=1',
- 'sel' => $conv_active,
- 'title' => L10n::t('Posts that mention or involve you'),
- 'id' => 'personal-tab',
- 'accesskey' => 'r',
- ];
- }
+ $tabs[] = [
+ 'label' => L10n::t('Personal'),
+ 'url' => str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&conv=1',
+ 'sel' => $conv_active,
+ 'title' => L10n::t('Posts that mention or involve you'),
+ 'id' => 'personal-tab',
+ 'accesskey' => 'r',
+ ];
if (Feature::isEnabled(local_user(), 'new_tab')) {
$tabs[] = [
];
}
- if (Feature::isEnabled(local_user(), 'star_posts')) {
- $tabs[] = [
- 'label' => L10n::t('Starred'),
- 'url' => str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&star=1',
- 'sel' => $starred_active,
- 'title' => L10n::t('Favourite Posts'),
- 'id' => 'starred-posts-tab',
- 'accesskey' => 'm',
- ];
- }
+ $tabs[] = [
+ 'label' => L10n::t('Starred'),
+ 'url' => str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&star=1',
+ 'sel' => $starred_active,
+ 'title' => L10n::t('Favourite Posts'),
+ 'id' => 'starred-posts-tab',
+ 'accesskey' => 'm',
+ ];
// save selected tab, but only if not in file mode
if (!x($_GET, 'file')) {
$arr = ['tabs' => $tabs];
Addon::callHooks('network_tabs', $arr);
- $tpl = get_markup_template('common_tabs.tpl');
+ $tpl = Renderer::getMarkupTemplate('common_tabs.tpl');
- return replace_macros($tpl, ['$tabs' => $arr['tabs']]);
+ return Renderer::replaceMacros($tpl, ['$tabs' => $arr['tabs']]);
// --- end item filter tabs
}
if (PConfig::get(local_user(), 'system', 'infinite_scroll')
&& defaults($_GET, 'mode', '') != 'minimal'
) {
- $tpl = get_markup_template('infinite_scroll_head.tpl');
- $htmlhead .= replace_macros($tpl, [
+ $tpl = Renderer::getMarkupTemplate('infinite_scroll_head.tpl');
+ $htmlhead .= Renderer::replaceMacros($tpl, [
'$pageno' => $pager->getPage(),
'$reload_uri' => $pager->getBaseQueryString()
]);
}
-}
\ No newline at end of file
+}