Merge pull request #8112 from annando/build-query

Use "http_build_query" to build queries
This commit is contained in:
Hypolite Petovan 2020-01-13 13:02:25 -05:00 committed by GitHub
commit 11a0b3ea87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 25 additions and 4 deletions

View File

@ -936,9 +936,14 @@ function network_tabs(App $a)
], ],
]; ];
$parameters = ['conv' => true];
if (!empty($_GET['cid'])) {
$parameters['cid'] = $_GET['cid'];
}
$tabs[] = [ $tabs[] = [
'label' => L10n::t('Personal'), 'label' => L10n::t('Personal'),
'url' => str_replace('/new', '', $cmd) . (!empty($_GET['cid']) ? '/?cid=' . $_GET['cid'] : '/?f=') . '&conv=1', 'url' => str_replace('/new', '', $cmd) . '?' . http_build_query($parameters),
'sel' => $conv_active, 'sel' => $conv_active,
'title' => L10n::t('Posts that mention or involve you'), 'title' => L10n::t('Posts that mention or involve you'),
'id' => 'personal-tab', 'id' => 'personal-tab',
@ -946,9 +951,15 @@ function network_tabs(App $a)
]; ];
if (Feature::isEnabled(local_user(), 'new_tab')) { if (Feature::isEnabled(local_user(), 'new_tab')) {
if (!empty($_GET['cid'])) {
$query = '?' . http_build_query(['cid' => $_GET['cid']]);
} else {
$query = '';
}
$tabs[] = [ $tabs[] = [
'label' => L10n::t('New'), 'label' => L10n::t('New'),
'url' => 'network/new' . (!empty($_GET['cid']) ? '/?cid=' . $_GET['cid'] : ''), 'url' => 'network/new' . $query,
'sel' => $new_active, 'sel' => $new_active,
'title' => L10n::t('Activity Stream - by date'), 'title' => L10n::t('Activity Stream - by date'),
'id' => 'activitiy-by-date-tab', 'id' => 'activitiy-by-date-tab',
@ -957,9 +968,14 @@ function network_tabs(App $a)
} }
if (Feature::isEnabled(local_user(), 'link_tab')) { if (Feature::isEnabled(local_user(), 'link_tab')) {
$parameters = ['bmark' => true];
if (!empty($_GET['cid'])) {
$parameters['cid'] = $_GET['cid'];
}
$tabs[] = [ $tabs[] = [
'label' => L10n::t('Shared Links'), 'label' => L10n::t('Shared Links'),
'url' => str_replace('/new', '', $cmd) . (!empty($_GET['cid']) ? '/?cid=' . $_GET['cid'] : '/?f=') . '&bmark=1', 'url' => str_replace('/new', '', $cmd) . '?' . http_build_query($parameters),
'sel' => $bookmarked_active, 'sel' => $bookmarked_active,
'title' => L10n::t('Interesting Links'), 'title' => L10n::t('Interesting Links'),
'id' => 'shared-links-tab', 'id' => 'shared-links-tab',
@ -967,9 +983,14 @@ function network_tabs(App $a)
]; ];
} }
$parameters = ['tar' => true];
if (!empty($_GET['cid'])) {
$parameters['cid'] = $_GET['cid'];
}
$tabs[] = [ $tabs[] = [
'label' => L10n::t('Starred'), 'label' => L10n::t('Starred'),
'url' => str_replace('/new', '', $cmd) . (!empty($_GET['cid']) ? '/?cid=' . $_GET['cid'] : '/?f=') . '&star=1', 'url' => str_replace('/new', '', $cmd) . '?' . http_build_query($parameters),
'sel' => $starred_active, 'sel' => $starred_active,
'title' => L10n::t('Favourite Posts'), 'title' => L10n::t('Favourite Posts'),
'id' => 'starred-posts-tab', 'id' => 'starred-posts-tab',