From cdba83f115e25e2f27a8a2c0b26d5d78fb48ef5c Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Fri, 21 Jul 2023 11:47:10 -0400 Subject: [PATCH] Update for processwire/processwire-issues#1443 --- wire/core/ProcessController.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/wire/core/ProcessController.php b/wire/core/ProcessController.php index 8b64eacc..76bb42c6 100644 --- a/wire/core/ProcessController.php +++ b/wire/core/ProcessController.php @@ -343,7 +343,18 @@ class ProcessController extends Wire { if(!$method) { throw new ProcessController404Exception("Unrecognized path"); } - + + if($method === 'executeNavJSON' && !$this->wire()->config->ajax && !$debug) { + // disallow navJSON output when not ajax and not debug mode + if(!$this->wire()->user->isLoggedin()) wire404(); + $navJSON = substr($this->wire()->input->url(), -8); + if($navJSON === 'navJSON/') { + $this->wire()->session->location('../'); + } else if($navJSON === '/navJSON') { + $this->wire()->session->location('./'); + } + } + // call method from Process (and time it if debug mode enabled) $className = $process->className(); if($debug) Debug::timer("$className.$method()"); @@ -500,6 +511,3 @@ class ProcessController extends Wire { } } - - -