Remove "f" parameter / network page parameter cleanup

This commit is contained in:
Michael 2020-01-13 20:10:13 +00:00
parent ac04ff88b8
commit b83f328983
11 changed files with 34 additions and 75 deletions

View file

@ -86,7 +86,7 @@ function item_redir_and_replace_images($body, $images, $cid) {
$search = '/\[url\=(.*?)\]\[!#saved_image([0-9]*)#!\]\[\/url\]' . '/is'; $search = '/\[url\=(.*?)\]\[!#saved_image([0-9]*)#!\]\[\/url\]' . '/is';
$replace = '[url=' . DI::baseUrl() . '/redir/' . $cid $replace = '[url=' . DI::baseUrl() . '/redir/' . $cid
. '?f=1&url=' . '$1' . '][!#saved_image' . '$2' .'#!][/url]'; . '?url=' . '$1' . '][!#saved_image' . '$2' .'#!][/url]';
$newbody .= substr($origbody, 0, $pos['start']['open']); $newbody .= substr($origbody, 0, $pos['start']['open']);
$subject = substr($origbody, $pos['start']['open'], $pos['end']['close'] - $pos['start']['open']); $subject = substr($origbody, $pos['start']['open'], $pos['end']['close'] - $pos['start']['open']);
@ -935,7 +935,7 @@ function item_photo_menu($item) {
} }
if ($cid && !$item['self']) { if ($cid && !$item['self']) {
$poke_link = 'poke/?f=&c=' . $cid; $poke_link = 'poke?c=' . $cid;
$contact_url = 'contact/' . $cid; $contact_url = 'contact/' . $cid;
$posts_link = 'contact/' . $cid . '/posts'; $posts_link = 'contact/' . $cid . '/posts';

View file

@ -541,7 +541,7 @@ function dfrn_poll_content(App $a)
switch ($destination_url) { switch ($destination_url) {
case 'profile': case 'profile':
DI::baseUrl()->redirect('profile/' . $profile . '?f=&tab=profile'); DI::baseUrl()->redirect('profile/' . $profile . '?tab=profile');
break; break;
case 'photos': case 'photos':
DI::baseUrl()->redirect('photos/' . $profile); DI::baseUrl()->redirect('photos/' . $profile);
@ -551,7 +551,7 @@ function dfrn_poll_content(App $a)
DI::baseUrl()->redirect('profile/' . $profile); DI::baseUrl()->redirect('profile/' . $profile);
break; break;
default: default:
$appendix = (strstr($destination_url, '?') ? '&f=&redir=1' : '?f=&redir=1'); $appendix = (strstr($destination_url, '?') ? '&redir=1' : '?redir=1');
DI::baseUrl()->redirect($destination_url . $appendix); DI::baseUrl()->redirect($destination_url . $appendix);
break; break;
} }

View file

@ -315,7 +315,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
} }
if (!$update) { if (!$update) {
$o .= "<script> var netargs = '?f=&item_id=" . $item_id . "'; </script>"; $o .= "<script> var netargs = '?item_id=" . $item_id . "'; </script>";
} }
$o .= conversation($a, [$item], new Pager(DI::args()->getQueryString()), 'display', $update_uid, false, 'commented', $item_uid); $o .= conversation($a, [$item], new Pager(DI::args()->getQueryString()), 'display', $update_uid, false, 'commented', $item_uid);

View file

@ -86,19 +86,11 @@ function network_init(App $a)
// last selected tab is _not_ '/network?order=activity'. // last selected tab is _not_ '/network?order=activity'.
// and this isn't a date query // and this isn't a date query
$tab_baseurls = [
'', //all
'', //postord
'', //conv
'/new', //new
'', //starred
'', //bookmarked
];
$tab_args = [ $tab_args = [
'order=activity', //all 'order=activity', //all
'order=post', //postord 'order=post', //postord
'conv=1', //conv 'conv=1', //conv
'', //new 'new=1', //new
'star=1', //starred 'star=1', //starred
'bmark=1', //bookmarked 'bmark=1', //bookmarked
]; ];
@ -106,8 +98,6 @@ function network_init(App $a)
$k = array_search('active', $last_sel_tabs); $k = array_search('active', $last_sel_tabs);
if ($k != 3) { if ($k != 3) {
$net_baseurl .= $tab_baseurls[$k];
// parse out tab queries // parse out tab queries
$dest_qa = []; $dest_qa = [];
$dest_qs = $tab_args[$k]; $dest_qs = $tab_args[$k];
@ -152,7 +142,7 @@ function network_init(App $a)
* '/network?order=activity' => $activity_active = 'active' * '/network?order=activity' => $activity_active = 'active'
* '/network?order=post' => $postord_active = 'active' * '/network?order=post' => $postord_active = 'active'
* '/network?conv=1', => $conv_active = 'active' * '/network?conv=1', => $conv_active = 'active'
* '/network/new', => $new_active = 'active' * '/network?new=1', => $new_active = 'active'
* '/network?star=1', => $starred_active = 'active' * '/network?star=1', => $starred_active = 'active'
* '/network?bmark=1', => $bookmarked_active = 'active' * '/network?bmark=1', => $bookmarked_active = 'active'
* *
@ -169,7 +159,7 @@ function network_query_get_sel_tab(App $a)
$conv_active = ''; $conv_active = '';
$postord_active = ''; $postord_active = '';
if (($a->argc > 1 && $a->argv[1] === 'new') || ($a->argc > 2 && $a->argv[2] === 'new')) { if (!empty($_GET['new'])) {
$new_active = 'active'; $new_active = 'active';
} }
@ -312,21 +302,7 @@ function network_content(App $a, $update = 0, $parent = 0)
$arr = ['query' => DI::args()->getQueryString()]; $arr = ['query' => DI::args()->getQueryString()];
Hook::callAll('network_content_init', $arr); Hook::callAll('network_content_init', $arr);
$flat_mode = false; if (!empty($_GET['new']) || !empty($_GET['file'])) {
if ($a->argc > 1) {
for ($x = 1; $x < $a->argc; $x ++) {
if ($a->argv[$x] === 'new') {
$flat_mode = true;
}
}
}
if (!empty($_GET['file'])) {
$flat_mode = true;
}
if ($flat_mode) {
$o = networkFlatView($a, $update); $o = networkFlatView($a, $update);
} else { } else {
$o = networkThreadedView($a, $update, $parent); $o = networkThreadedView($a, $update, $parent);
@ -916,11 +892,16 @@ function network_tabs(App $a)
$cmd = DI::args()->getCommand(); $cmd = DI::args()->getCommand();
$def_param = [];
if (!empty($_GET['cid'])) {
$def_param['cid'] = $_GET['cid'];
}
// tabs // tabs
$tabs = [ $tabs = [
[ [
'label' => L10n::t('Latest Activity'), 'label' => L10n::t('Latest Activity'),
'url' => str_replace('/new', '', $cmd) . '?order=activity' . (!empty($_GET['cid']) ? '&cid=' . $_GET['cid'] : ''), 'url' => $cmd . '?' . http_build_query(array_merge($def_param, ['order' => 'activity'])),
'sel' => $all_active, 'sel' => $all_active,
'title' => L10n::t('Sort by latest activity'), 'title' => L10n::t('Sort by latest activity'),
'id' => 'activity-order-tab', 'id' => 'activity-order-tab',
@ -928,7 +909,7 @@ function network_tabs(App $a)
], ],
[ [
'label' => L10n::t('Latest Posts'), 'label' => L10n::t('Latest Posts'),
'url' => str_replace('/new', '', $cmd) . '?order=post' . (!empty($_GET['cid']) ? '&cid=' . $_GET['cid'] : ''), 'url' => $cmd . '?' . http_build_query(array_merge($def_param, ['order' => 'post'])),
'sel' => $post_active, 'sel' => $post_active,
'title' => L10n::t('Sort by post received date'), 'title' => L10n::t('Sort by post received date'),
'id' => 'post-order-tab', 'id' => 'post-order-tab',
@ -936,14 +917,9 @@ 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) . '?' . http_build_query($parameters), 'url' => $cmd . '?' . http_build_query(array_merge($def_param, ['conv' => true])),
'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',
@ -951,15 +927,9 @@ 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' . $query, 'url' => $cmd . '?' . http_build_query(array_merge($def_param, ['new' => true])),
'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',
@ -968,14 +938,9 @@ 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) . '?' . http_build_query($parameters), 'url' => $cmd . '?' . http_build_query(array_merge($def_param, ['bmark' => true])),
'sel' => $bookmarked_active, 'sel' => $bookmarked_active,
'title' => L10n::t('Interesting Links'), 'title' => L10n::t('Interesting Links'),
'id' => 'shared-links-tab', 'id' => 'shared-links-tab',
@ -983,14 +948,9 @@ 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) . '?' . http_build_query($parameters), 'url' => $cmd . '?' . http_build_query(array_merge($def_param, ['star' => true])),
'sel' => $starred_active, 'sel' => $starred_active,
'title' => L10n::t('Favourite Posts'), 'title' => L10n::t('Favourite Posts'),
'id' => 'starred-posts-tab', 'id' => 'starred-posts-tab',

View file

@ -42,7 +42,7 @@ function oexchange_content(App $a) {
$tags = ((!empty($_REQUEST['tags'])) $tags = ((!empty($_REQUEST['tags']))
? '&tags=' . urlencode(Strings::escapeTags(trim($_REQUEST['tags']))) : ''); ? '&tags=' . urlencode(Strings::escapeTags(trim($_REQUEST['tags']))) : '');
$s = Network::fetchUrl(DI::baseUrl() . '/parse_url?f=&url=' . $url . $title . $description . $tags); $s = Network::fetchUrl(DI::baseUrl() . '/parse_url?url=' . $url . $title . $description . $tags);
if (!strlen($s)) { if (!strlen($s)) {
return; return;

View file

@ -1071,7 +1071,7 @@ function photos_content(App $a)
if ($order_field === 'posted') { if ($order_field === 'posted') {
$order = [L10n::t('Show Newest First'), 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album), 'oldest']; $order = [L10n::t('Show Newest First'), 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album), 'oldest'];
} else { } else {
$order = [L10n::t('Show Oldest First'), 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '?f=&order=posted', 'newest']; $order = [L10n::t('Show Oldest First'), 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '?order=posted', 'newest'];
} }
$photos = []; $photos = [];
@ -1091,7 +1091,7 @@ function photos_content(App $a)
'id' => $rr['id'], 'id' => $rr['id'],
'twist' => ' ' . ($twist ? 'rotleft' : 'rotright') . rand(2,4), 'twist' => ' ' . ($twist ? 'rotleft' : 'rotright') . rand(2,4),
'link' => 'photos/' . $a->data['user']['nickname'] . '/image/' . $rr['resource-id'] 'link' => 'photos/' . $a->data['user']['nickname'] . '/image/' . $rr['resource-id']
. ($order_field === 'posted' ? '?f=&order=posted' : ''), . ($order_field === 'posted' ? '?order=posted' : ''),
'title' => L10n::t('View Photo'), 'title' => L10n::t('View Photo'),
'src' => 'photo/' . $rr['resource-id'] . '-' . $rr['scale'] . '.' .$ext, 'src' => 'photo/' . $rr['resource-id'] . '-' . $rr['scale'] . '.' .$ext,
'alt' => $imgalt_e, 'alt' => $imgalt_e,
@ -1191,10 +1191,10 @@ function photos_content(App $a)
} }
if (!is_null($prv)) { if (!is_null($prv)) {
$prevlink = 'photos/' . $a->data['user']['nickname'] . '/image/' . $prvnxt[$prv]['resource-id'] . ($order_field === 'posted' ? '?f=&order=posted' : ''); $prevlink = 'photos/' . $a->data['user']['nickname'] . '/image/' . $prvnxt[$prv]['resource-id'] . ($order_field === 'posted' ? '?order=posted' : '');
} }
if (!is_null($nxt)) { if (!is_null($nxt)) {
$nextlink = 'photos/' . $a->data['user']['nickname'] . '/image/' . $prvnxt[$nxt]['resource-id'] . ($order_field === 'posted' ? '?f=&order=posted' : ''); $nextlink = 'photos/' . $a->data['user']['nickname'] . '/image/' . $prvnxt[$nxt]['resource-id'] . ($order_field === 'posted' ? '?order=posted' : '');
} }
$tpl = Renderer::getMarkupTemplate('photo_edit_head.tpl'); $tpl = Renderer::getMarkupTemplate('photo_edit_head.tpl');
@ -1252,7 +1252,7 @@ function photos_content(App $a)
$photo = [ $photo = [
'href' => 'photo/' . $hires['resource-id'] . '-' . $hires['scale'] . '.' . $phototypes[$hires['type']], 'href' => 'photo/' . $hires['resource-id'] . '-' . $hires['scale'] . '.' . $phototypes[$hires['type']],
'title'=> L10n::t('View Full Size'), 'title'=> L10n::t('View Full Size'),
'src' => 'photo/' . $lores['resource-id'] . '-' . $lores['scale'] . '.' . $phototypes[$lores['type']] . '?f=&_u=' . DateTimeFormat::utcNow('ymdhis'), 'src' => 'photo/' . $lores['resource-id'] . '-' . $lores['scale'] . '.' . $phototypes[$lores['type']] . '?_u=' . DateTimeFormat::utcNow('ymdhis'),
'height' => $hires['height'], 'height' => $hires['height'],
'width' => $hires['width'], 'width' => $hires['width'],
'album' => $hires['album'], 'album' => $hires['album'],

View file

@ -51,7 +51,7 @@ final class Item
$categories[] = [ $categories[] = [
'name' => $savedFolderName, 'name' => $savedFolderName,
'url' => $url, 'url' => $url,
'removeurl' => ((local_user() == $item['uid']) ? 'filerm/' . $item['id'] . '?f=&cat=' . rawurlencode($savedFolderName) : ""), 'removeurl' => ((local_user() == $item['uid']) ? 'filerm/' . $item['id'] . '?cat=' . rawurlencode($savedFolderName) : ""),
'first' => $first, 'first' => $first,
'last' => false 'last' => false
]; ];
@ -67,7 +67,7 @@ final class Item
$folders[] = [ $folders[] = [
'name' => $savedFolderName, 'name' => $savedFolderName,
'url' => "#", 'url' => "#",
'removeurl' => ((local_user() == $item['uid']) ? 'filerm/' . $item['id'] . '?f=&term=' . rawurlencode($savedFolderName) : ""), 'removeurl' => ((local_user() == $item['uid']) ? 'filerm/' . $item['id'] . '?term=' . rawurlencode($savedFolderName) : ""),
'first' => $first, 'first' => $first,
'last' => false 'last' => false
]; ];

View file

@ -239,7 +239,6 @@ class Nav
// The following nav links are only show to logged in users // The following nav links are only show to logged in users
if (local_user()) { if (local_user()) {
$nav['network'] = ['network', L10n::t('Network'), '', L10n::t('Conversations from your friends')]; $nav['network'] = ['network', L10n::t('Network'), '', L10n::t('Conversations from your friends')];
$nav['net_reset'] = ['network/?f=', L10n::t('Network Reset'), '', L10n::t('Load Network page with no filters')];
$nav['home'] = ['profile/' . $a->user['nickname'], L10n::t('Home'), '', L10n::t('Your posts and conversations')]; $nav['home'] = ['profile/' . $a->user['nickname'], L10n::t('Home'), '', L10n::t('Your posts and conversations')];

View file

@ -222,7 +222,7 @@ function string2bb(element) {
match: /(^|\s)(\#)([^ \n]{2,})$/, match: /(^|\s)(\#)([^ \n]{2,})$/,
index: 3, index: 3,
search: function(term, callback) { search: function(term, callback) {
$.getJSON(baseurl + '/hashtag/' + '?f=&t=' + term) $.getJSON(baseurl + '/hashtag/' + '?t=' + term)
.done(function(data) { .done(function(data) {
callback($.map(data, function(entry) { callback($.map(data, function(entry) {
// .toLowerCase() enables case-insensitive search // .toLowerCase() enables case-insensitive search
@ -275,7 +275,7 @@ function string2bb(element) {
tags = { tags = {
match: /(^|\s)(\#)([^ \n]{2,})$/, match: /(^|\s)(\#)([^ \n]{2,})$/,
index: 3, index: 3,
search: function(term, callback) { $.getJSON(baseurl + '/hashtag/' + '?f=&t=' + term).done(function(data) { callback($.map(data, function(entry) { return entry.text.indexOf(term) === 0 ? entry : null; })); }); }, search: function(term, callback) { $.getJSON(baseurl + '/hashtag/' + '?t=' + term).done(function(data) { callback($.map(data, function(entry) { return entry.text.indexOf(term) === 0 ? entry : null; })); }); },
replace: function(item) { return "$1$2" + item.text; }, replace: function(item) { return "$1$2" + item.text; },
template: tag_format template: tag_format
}; };

View file

@ -498,7 +498,7 @@ function insertBBCodeInTextarea(BBCode, textarea) {
function NavUpdate() { function NavUpdate() {
if (!stopped) { if (!stopped) {
var pingCmd = 'ping?format=json' + ((localUser != 0) ? '&f=&uid=' + localUser : ''); var pingCmd = 'ping?format=json' + ((localUser != 0) ? '&uid=' + localUser : '');
$.get(pingCmd, function(data) { $.get(pingCmd, function(data) {
if (data.result) { if (data.result) {
// send nav-update event // send nav-update event
@ -980,7 +980,7 @@ Array.prototype.remove = function(item) {
function previewTheme(elm) { function previewTheme(elm) {
theme = $(elm).val(); theme = $(elm).val();
$.getJSON('pretheme?f=&theme=' + theme,function(data) { $.getJSON('pretheme?theme=' + theme,function(data) {
$('#theme-preview').html('<div id="theme-desc">' + data.desc + '</div><div id="theme-version">' + data.version + '</div><div id="theme-credits">' + data.credits + '</div><a href="' + data.img + '"><img src="' + data.img + '" width="320" height="240" alt="' + theme + '" /></a>'); $('#theme-preview').html('<div id="theme-desc">' + data.desc + '</div><div id="theme-version">' + data.version + '</div><div id="theme-credits">' + data.credits + '</div><a href="' + data.img + '"><img src="' + data.img + '" width="320" height="240" alt="' + theme + '" /></a>');
}); });

View file

@ -127,7 +127,7 @@ function frio_item_photo_links(App $a, &$body_info)
function frio_item_photo_menu(App $a, &$arr) function frio_item_photo_menu(App $a, &$arr)
{ {
foreach ($arr['menu'] as $k => $v) { foreach ($arr['menu'] as $k => $v) {
if (strpos($v, 'poke/?f=&c=') === 0 || strpos($v, 'message/new/') === 0) { if (strpos($v, 'poke?c=') === 0 || strpos($v, 'message/new/') === 0) {
$v = 'javascript:addToModal(\'' . $v . '\'); return false;'; $v = 'javascript:addToModal(\'' . $v . '\'); return false;';
$arr['menu'][$k] = $v; $arr['menu'][$k] = $v;
} }
@ -181,7 +181,7 @@ function frio_contact_photo_menu(App $a, &$args)
// Add to pm and poke links a new key with the value 'modal'. // Add to pm and poke links a new key with the value 'modal'.
// Later we can make conditions in the corresponing templates (e.g. // Later we can make conditions in the corresponing templates (e.g.
// contact_template.tpl) // contact_template.tpl)
if (strpos($pokelink, 'poke/?f=&c=' . $cid) !== false) { if (strpos($pokelink, 'poke?c=' . $cid) !== false) {
$args['menu']['poke'][3] = 'modal'; $args['menu']['poke'][3] = 'modal';
} }