Remove deprecated App::query_string - replace with DI::args()->getQueryString()

This commit is contained in:
Philipp Holzer 2019-12-16 01:30:34 +01:00
commit e6f61c2cc7
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
33 changed files with 63 additions and 66 deletions

View file

@ -94,7 +94,7 @@ function api_content(App $a)
if (!local_user()) {
/// @TODO We need login form to redirect to this page
notice(L10n::t('Please login to continue.') . EOL);
return Login::form($a->query_string, false, $request->get_parameters());
return Login::form(DI::args()->getQueryString(), false, $request->get_parameters());
}
//FKOAuth1::loginUser(4);

View file

@ -9,6 +9,7 @@ use Friendica\Content\Pager;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model;
use Friendica\Module;
use Friendica\Util\Proxy as ProxyUtils;
@ -91,7 +92,7 @@ function common_content(App $a)
return $o;
}
$pager = new Pager($a->query_string);
$pager = new Pager(DI::args()->getQueryString());
if ($cid) {
$common_friends = Model\GContact::commonFriends($uid, $cid, $pager->getStart(), $pager->getItemsPerPage());

View file

@ -149,7 +149,7 @@ function community_content(App $a, $update = 0)
$itemspage_network = $a->force_max_items;
}
$pager = new Pager($a->query_string, $itemspage_network);
$pager = new Pager(DI::args()->getQueryString(), $itemspage_network);
$r = community_getitems($pager->getStart(), $pager->getItemsPerPage(), $content, $accounttype);

View file

@ -320,7 +320,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
$o .= "<script> var netargs = '?f=&item_id=" . $item_id . "'; </script>";
}
$o .= conversation($a, [$item], new Pager($a->query_string), 'display', $update_uid, false, 'commented', $item_uid);
$o .= conversation($a, [$item], new Pager(DI::args()->getQueryString()), 'display', $update_uid, false, 'commented', $item_uid);
// Preparing the meta header
$description = trim(HTML::toPlaintext(BBCode::convert($item["body"], false), 0, true));

View file

@ -667,7 +667,7 @@ function item_post(App $a) {
$datarray["item_id"] = -1;
$datarray["author-network"] = Protocol::DFRN;
$o = conversation($a, [array_merge($contact_record, $datarray)], new Pager($a->query_string), 'search', false, true);
$o = conversation($a, [array_merge($contact_record, $datarray)], new Pager(DI::args()->getQueryString()), 'search', false, true);
Logger::log('preview: ' . $o);
echo json_encode(['preview' => $o]);
exit();

View file

@ -134,7 +134,7 @@ function message_content(App $a)
if (!empty($_REQUEST['confirm'])) {
// <form> can't take arguments in its "action" parameter
// so add any arguments as hidden inputs
$query = explode_querystring($a->query_string);
$query = explode_querystring(DI::args()->getQueryString());
$inputs = [];
foreach ($query['args'] as $arg) {
if (strpos($arg, 'confirm=') === false) {
@ -265,7 +265,7 @@ function message_content(App $a)
}
$_SESSION['return_path'] = $a->query_string;
$_SESSION['return_path'] = DI::args()->getQueryString();
if ($a->argc == 1) {
@ -282,7 +282,7 @@ function message_content(App $a)
$total = $r[0]['total'];
}
$pager = new Pager($a->query_string);
$pager = new Pager(DI::args()->getQueryString());
$r = get_messages(local_user(), $pager->getStart(), $pager->getItemsPerPage());

View file

@ -63,7 +63,7 @@ function network_init(App $a)
// convert query string to array. remove friendica args
$query_array = [];
parse_str(parse_url($a->query_string, PHP_URL_QUERY), $query_array);
parse_str(parse_url(DI::args()->getQueryString(), PHP_URL_QUERY), $query_array);
// fetch last used network view and redirect if needed
if (!$is_a_date_query) {
@ -140,7 +140,7 @@ function network_init(App $a)
$a->page['aside'] .= ForumManager::widget(local_user(), $cid);
$a->page['aside'] .= Widget::postedByYear('network', local_user(), false);
$a->page['aside'] .= Widget::networks('network', $_GET['nets'] ?? '');
$a->page['aside'] .= Widget\SavedSearches::getHTML($a->query_string);
$a->page['aside'] .= Widget\SavedSearches::getHTML(DI::args()->getQueryString());
$a->page['aside'] .= Widget::fileAs('network', $_GET['file'] ?? '');
}
@ -309,7 +309,7 @@ function network_content(App $a, $update = 0, $parent = 0)
}
/// @TODO Is this really necessary? $a is already available to hooks
$arr = ['query' => $a->query_string];
$arr = ['query' => DI::args()->getQueryString()];
Hook::callAll('network_content_init', $arr);
$flat_mode = false;
@ -389,7 +389,7 @@ function networkFlatView(App $a, $update = 0)
}
}
$pager = new Pager($a->query_string);
$pager = new Pager(DI::args()->getQueryString());
networkPager($a, $pager, $update);
@ -681,7 +681,7 @@ function networkThreadedView(App $a, $update, $parent)
$sql_range = '';
}
$pager = new Pager($a->query_string);
$pager = new Pager(DI::args()->getQueryString());
$pager_sql = networkPager($a, $pager, $update);
@ -869,7 +869,7 @@ function networkThreadedView(App $a, $update, $parent)
$date_offset = $_GET['offset'];
}
$query_string = $a->query_string;
$query_string = DI::args()->getQueryString();
if ($date_offset && !preg_match('/[?&].offset=/', $query_string)) {
$query_string .= '&offset=' . urlencode($date_offset);
}

View file

@ -8,6 +8,7 @@ use Friendica\Content\Nav;
use Friendica\Content\Pager;
use Friendica\Core\L10n;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Item;
use Friendica\Model\Profile;
@ -53,7 +54,7 @@ function notes_content(App $a, $update = false)
$condition = ['uid' => local_user(), 'post-type' => Item::PT_PERSONAL_NOTE, 'gravity' => GRAVITY_PARENT,
'contact-id'=> $a->contact['id']];
$pager = new Pager($a->query_string, 40);
$pager = new Pager(DI::args()->getQueryString(), 40);
$params = ['order' => ['created' => true],
'limit' => [$pager->getStart(), $pager->getItemsPerPage()]];

View file

@ -116,7 +116,7 @@ function notifications_content(App $a)
}
// Set the pager
$pager = new Pager($a->query_string, $perpage);
$pager = new Pager(DI::args()->getQueryString(), $perpage);
// Add additional informations (needed for json output)
$notifs['items_page'] = $pager->getItemsPerPage();

View file

@ -984,7 +984,7 @@ function photos_content(App $a)
// ACL permissions box
'$group_perms' => L10n::t('Show to Groups'),
'$contact_perms' => L10n::t('Show to Contacts'),
'$return_path' => $a->query_string,
'$return_path' => DI::args()->getQueryString(),
]);
return $o;
@ -1008,7 +1008,7 @@ function photos_content(App $a)
$total = count($r);
}
$pager = new Pager($a->query_string, 20);
$pager = new Pager(DI::args()->getQueryString(), 20);
/// @TODO I have seen this many times, maybe generalize it script-wide and encapsulate it?
$order_field = $_GET['order'] ?? '';
@ -1030,7 +1030,7 @@ function photos_content(App $a)
);
if ($cmd === 'drop') {
$drop_url = $a->query_string;
$drop_url = DI::args()->getQueryString();
return Renderer::replaceMacros(Renderer::getMarkupTemplate('confirm.tpl'), [
'$method' => 'post',
@ -1137,7 +1137,7 @@ function photos_content(App $a)
}
if ($cmd === 'drop') {
$drop_url = $a->query_string;
$drop_url = DI::args()->getQueryString();
return Renderer::replaceMacros(Renderer::getMarkupTemplate('confirm.tpl'), [
'$method' => 'post',
@ -1284,7 +1284,7 @@ function photos_content(App $a)
$condition = ["`parent` = ? AND `parent` != `id`", $link_item['parent']];
$total = DBA::count('item', $condition);
$pager = new Pager($a->query_string);
$pager = new Pager(DI::args()->getQueryString());
$params = ['order' => ['id'], 'limit' => [$pager->getStart(), $pager->getItemsPerPage()]];
$result = Item::selectForUser($link_item['uid'], Item::ITEM_FIELDLIST, $condition, $params);
@ -1348,7 +1348,7 @@ function photos_content(App $a)
// ACL permissions box
'$group_perms' => L10n::t('Show to Groups'),
'$contact_perms' => L10n::t('Show to Contacts'),
'$return_path' => $a->query_string,
'$return_path' => DI::args()->getQueryString(),
]);
}
@ -1371,7 +1371,7 @@ function photos_content(App $a)
'$likethis' => L10n::t("I like this \x28toggle\x29"),
'$nolike' => L10n::t("I don't like this \x28toggle\x29"),
'$wait' => L10n::t('Please wait'),
'$return_path' => $a->query_string,
'$return_path' => DI::args()->getQueryString(),
]);
}
@ -1549,7 +1549,7 @@ function photos_content(App $a)
$total = count($r);
}
$pager = new Pager($a->query_string, 20);
$pager = new Pager(DI::args()->getQueryString(), 20);
$r = q("SELECT `resource-id`, ANY_VALUE(`id`) AS `id`, ANY_VALUE(`filename`) AS `filename`,
ANY_VALUE(`type`) AS `type`, ANY_VALUE(`album`) AS `album`, max(`scale`) AS `scale`,

View file

@ -80,7 +80,7 @@ function regmod_content(App $a)
{
if (!local_user()) {
info(L10n::t('Please login.') . EOL);
return Login::form($a->query_string, intval(Config::get('config', 'register_policy')) === \Friendica\Module\Register::CLOSED ? 0 : 1);
return Login::form(DI::args()->getQueryString(), intval(Config::get('config', 'register_policy')) === \Friendica\Module\Register::CLOSED ? 0 : 1);
}
if (!is_site_admin() || !empty($_SESSION['submanage'])) {

View file

@ -1152,7 +1152,7 @@ function settings_content(App $a)
$private_post = 0;
}
$query_str = $a->query_string;
$query_str = DI::args()->getQueryString();
if (strpos($query_str, 'public=1') !== false) {
$query_str = str_replace(['?public=1', '&public=1'], ['', ''], $query_str);
}

View file

@ -58,7 +58,7 @@ function suggest_content(App $a)
if (!empty($_GET['ignore'])) {
// <form> can't take arguments in its "action" parameter
// so add any arguments as hidden inputs
$query = explode_querystring($a->query_string);
$query = explode_querystring(DI::args()->getQueryString());
$inputs = [];
foreach ($query['args'] as $arg) {
if (strpos($arg, 'confirm=') === false) {

View file

@ -212,7 +212,7 @@ function videos_content(App $a)
$total = count($r);
}
$pager = new Pager($a->query_string, 20);
$pager = new Pager(DI::args()->getQueryString(), 20);
$r = q("SELECT hash, ANY_VALUE(`id`) AS `id`, ANY_VALUE(`created`) AS `created`,
ANY_VALUE(`filename`) AS `filename`, ANY_VALUE(`filetype`) as `filetype`