From bbefc61a0cf36da6a02a3ed459b4434dfd3b0998 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Wed, 9 Sep 2020 00:15:25 -0400 Subject: [PATCH] Use Arguments->getCommand() where it makes more sense than getQueryString() - Remove a couple of intermediary query string variables --- include/api.php | 10 +++++----- include/conversation.php | 7 +------ mod/network.php | 4 +--- src/Module/BaseApi.php | 6 +++--- 4 files changed, 10 insertions(+), 17 deletions(-) diff --git a/include/api.php b/include/api.php index 5ae4754b5..643f57b63 100644 --- a/include/api.php +++ b/include/api.php @@ -311,22 +311,22 @@ function api_call(App $a, App\Arguments $args = null) } $type = "json"; - if (strpos($args->getQueryString(), ".xml") > 0) { + if (strpos($args->getCommand(), ".xml") > 0) { $type = "xml"; } - if (strpos($args->getQueryString(), ".json") > 0) { + if (strpos($args->getCommand(), ".json") > 0) { $type = "json"; } - if (strpos($args->getQueryString(), ".rss") > 0) { + if (strpos($args->getCommand(), ".rss") > 0) { $type = "rss"; } - if (strpos($args->getQueryString(), ".atom") > 0) { + if (strpos($args->getCommand(), ".atom") > 0) { $type = "atom"; } try { foreach ($API as $p => $info) { - if (strpos($args->getQueryString(), $p) === 0) { + if (strpos($args->getCommand(), $p) === 0) { if (!api_check_method($info['method'])) { throw new MethodNotAllowedException(); } diff --git a/include/conversation.php b/include/conversation.php index 4afc7c699..bd1e03822 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1148,17 +1148,12 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false) $jotplugins = ''; Hook::callAll('jot_tool', $jotplugins); - $query_str = DI::args()->getQueryString(); - if (strpos($query_str, 'public=1') !== false) { - $query_str = str_replace(['?public=1', '&public=1'], ['', ''], $query_str); - } - // $tpl = Renderer::replaceMacros($tpl,array('$jotplugins' => $jotplugins)); $tpl = Renderer::getMarkupTemplate("jot.tpl"); $o .= Renderer::replaceMacros($tpl,[ '$new_post' => DI::l10n()->t('New Post'), - '$return_path' => $query_str, + '$return_path' => DI::args()->getQueryString(), '$action' => 'item', '$share' => ($x['button'] ?? '') ?: DI::l10n()->t('Share'), '$loading' => DI::l10n()->t('Loading...'), diff --git a/mod/network.php b/mod/network.php index 48f250e44..60bb409e3 100644 --- a/mod/network.php +++ b/mod/network.php @@ -635,9 +635,7 @@ function network_display_post($a, $pager, $mark_all, $update, $ordering, $items) $parents_str = implode(', ', $parents_arr); } - $query_string = DI::args()->getQueryString(); - - $pager->setQueryString($query_string); + $pager->setQueryString(DI::args()->getQueryString()); // We aren't going to try and figure out at the item, group, and page // level which items you've seen and which you haven't. If you're looking diff --git a/src/Module/BaseApi.php b/src/Module/BaseApi.php index 5a5326756..75791e0ea 100644 --- a/src/Module/BaseApi.php +++ b/src/Module/BaseApi.php @@ -42,13 +42,13 @@ class BaseApi extends BaseModule { $arguments = DI::args(); - if (substr($arguments->getQueryString(), -4) === '.xml') { + if (substr($arguments->getCommand(), -4) === '.xml') { self::$format = 'xml'; } - if (substr($arguments->getQueryString(), -4) === '.rss') { + if (substr($arguments->getCommand(), -4) === '.rss') { self::$format = 'rss'; } - if (substr($arguments->getQueryString(), -4) === '.atom') { + if (substr($arguments->getCommand(), -4) === '.atom') { self::$format = 'atom'; } }