From 7180ae4033ef2340efc8675085a7540ebd19a6ae Mon Sep 17 00:00:00 2001 From: Matthew Exon Date: Wed, 28 Dec 2022 19:40:50 +0100 Subject: [PATCH] replace local_user --- retriever/retriever.php | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/retriever/retriever.php b/retriever/retriever.php index 7b9a7bf4..d374ca80 100644 --- a/retriever/retriever.php +++ b/retriever/retriever.php @@ -10,6 +10,7 @@ use Friendica\Core\Addon; use Friendica\Core\Hook; use Friendica\Core\Logger; use Friendica\Core\Renderer; +use Friendica\Core\Session; use Friendica\Core\System; use Friendica\Content\Text\HTML; use Friendica\Content\Text\BBCode; @@ -844,12 +845,12 @@ function retriever_transform_images(array &$item, array $resource) { * @param App $a The App object */ function retriever_content(App $a) { - if (!local_user()) { + if (!Session::getLocalUser()) { $a->page['content'] .= "

Please log in

"; return; } if (isset(DI::args()->getArgv()[1]) and DI::args()->getArgv()[1] === 'help') { - $feeds = DBA::selectToArray('contact', ['id', 'name', 'thumb'], ['uid' => local_user(), 'network' => 'feed']); + $feeds = DBA::selectToArray('contact', ['id', 'name', 'thumb'], ['uid' => Session::getLocalUser(), 'network' => 'feed']); for ($i = 0; $i < count($feeds); ++$i) { $feeds[$i]['url'] = DI::baseUrl()->get(true) . '/retriever/' . $feeds[$i]['id']; } @@ -862,13 +863,13 @@ function retriever_content(App $a) { } if (isset(DI::args()->getArgv()[1])) { $arg1 = DI::args()->getArgv()[1]; - $retriever_rule = get_retriever_rule($arg1, local_user(), false); + $retriever_rule = get_retriever_rule($arg1, Session::getLocalUser(), false); if (!$retriever_rule) { $retriever_rule = ['id' => 0, 'data' => ['enable' => 0, 'modurl' => '', 'pattern' => '', 'replace' => '', 'images' => 0, 'storecookies' => 0, 'cookiedata' => '', 'customxslt' => '', 'include' => '', 'exclude' => '']]; } if (!empty($_POST["id"])) { - $retriever_rule = get_retriever_rule($arg1, local_user(), true); + $retriever_rule = get_retriever_rule($arg1, Session::getLocalUser(), true); $retriever_rule['data'] = array(); foreach (array('modurl', 'pattern', 'replace', 'enable', 'images', 'customxslt', 'storecookies', 'cookiedata') as $setting) { if (empty($_POST['retriever_' . $setting])) { @@ -1017,8 +1018,8 @@ function retriever_post_remote_hook(App &$a, array &$item) { * @param string $s HTML string to which to append settings content (by ref) */ function retriever_addon_settings(App &$a, string &$s) { - $all_photos = DI::config()->get(local_user(), 'retriever', 'all_photos'); - $oembed = DI::config()->get(local_user(), 'retriever', 'oembed'); + $all_photos = DI::config()->get(Session::getLocalUser(), 'retriever', 'all_photos'); + $oembed = DI::config()->get(Session::getLocalUser(), 'retriever', 'oembed'); $template = Renderer::getMarkupTemplate('/settings.tpl', 'addon/retriever/'); $config = array('$submit' => DI::l10n()->t('Save Settings'), '$title' => DI::l10n()->t('Retriever Settings'), @@ -1043,15 +1044,15 @@ function retriever_addon_settings(App &$a, string &$s) { */ function retriever_addon_settings_post(App $a, array $post) { if ($post['retriever_all_photos']) { - DI::config()->set(local_user(), 'retriever', 'all_photos', $post['retriever_all_photos']); + DI::config()->set(Session::getLocalUser(), 'retriever', 'all_photos', $post['retriever_all_photos']); } else { - DI::config()->delete(local_user(), 'retriever', 'all_photos'); + DI::config()->delete(Session::getLocalUser(), 'retriever', 'all_photos'); } if ($post['retriever_oembed']) { - DI::config()->set(local_user(), 'retriever', 'oembed', $post['retriever_oembed']); + DI::config()->set(Session::getLocalUser(), 'retriever', 'oembed', $post['retriever_oembed']); } else { - DI::config()->delete(local_user(), 'retriever', 'oembed'); + DI::config()->delete(Session::getLocalUser(), 'retriever', 'oembed'); } }