From 4762476c89fb0aace3c45910c0db0059876091a5 Mon Sep 17 00:00:00 2001 From: nupplaPhil Date: Sun, 26 Jan 2020 23:53:49 +0100 Subject: [PATCH] Use parameters --- src/Module/NoScrape.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Module/NoScrape.php b/src/Module/NoScrape.php index 26cae9817d..984ed9d608 100644 --- a/src/Module/NoScrape.php +++ b/src/Module/NoScrape.php @@ -22,12 +22,17 @@ class NoScrape extends BaseModule { $a = DI::app(); - $which = DI::args()->get(1); - - $profile = 0; - if ((local_user()) && (DI::args()->get(2) === 'view')) { + if (isset($parameters['nick'])) { + // Get infos about a specific nick (public) + $which = $parameters['nick']; + $profile = 0; + } elseif (local_user() && isset($parameters['profile']) && DI::args()->get(2) == 'view') { + // view infos about a known profile (needs a login) $which = $a->user['nickname']; - $profile = DI::args()->get(1); + $profile = $parameters['profile']; + } else { + System::jsonError(404, 'Invalid request'); + exit(); } Profile::load($a, $which, $profile); -- 2.39.5