From 6a43274826a8a403079bb9e560d7222597816c99 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Thu, 19 Mar 2020 17:56:38 +0900 Subject: [PATCH] Filter error location in JSON and XML responses --- classes/display/DisplayHandler.class.php | 13 +++++++++++++ classes/object/Object.class.php | 10 ++++++++++ 2 files changed, 23 insertions(+) diff --git a/classes/display/DisplayHandler.class.php b/classes/display/DisplayHandler.class.php index a4551764f..475a31d23 100644 --- a/classes/display/DisplayHandler.class.php +++ b/classes/display/DisplayHandler.class.php @@ -56,6 +56,19 @@ class DisplayHandler extends Handler { $handler = new HTMLDisplayHandler(); } + + // Handle error location info + if ($location = $oModule->get('rx_error_location')) + { + if (!Rhymix\Framework\Debug::isEnabledForCurrentUser()) + { + $oModule->unset('rx_error_location'); + } + elseif (starts_with(\RX_BASEDIR, $location)) + { + $oModule->add('rx_error_location', $location = substr($location, strlen(\RX_BASEDIR))); + } + } $output = $handler->toDoc($oModule); diff --git a/classes/object/Object.class.php b/classes/object/Object.class.php index 036c1ab5c..0d5d5ab3a 100644 --- a/classes/object/Object.class.php +++ b/classes/object/Object.class.php @@ -280,6 +280,16 @@ class BaseObject return $output; } + /** + * Method to delete a key + * + * @return void + */ + function unset($key) + { + unset($this->variables[$key]); + } + /** * Method to return either true or false depnding on the value in a 'error' variable *