From 3bca5598268623389eb3f2333c2e2be85f4caa4f Mon Sep 17 00:00:00 2001 From: El RIDO Date: Sat, 6 Jan 2018 10:27:58 +0100 Subject: [PATCH] moving access to into Request class --- lib/PrivateBin.php | 3 +-- lib/Request.php | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/lib/PrivateBin.php b/lib/PrivateBin.php index f26abad1..39fb2db3 100644 --- a/lib/PrivateBin.php +++ b/lib/PrivateBin.php @@ -176,8 +176,7 @@ class PrivateBin $this->_conf = new Configuration; $this->_model = new Model($this->_conf); $this->_request = new Request; - $this->_urlBase = array_key_exists('REQUEST_URI', $_SERVER) ? - htmlspecialchars($_SERVER['REQUEST_URI']) : '/'; + $this->_urlBase = $this->_request->getRequestUri(); ServerSalt::setPath($this->_conf->getKey('dir', 'traffic')); // set default language diff --git a/lib/Request.php b/lib/Request.php index f6daa508..3fb35e32 100644 --- a/lib/Request.php +++ b/lib/Request.php @@ -141,7 +141,20 @@ class Request */ public function getParam($param, $default = '') { - return array_key_exists($param, $this->_params) ? $this->_params[$param] : $default; + return array_key_exists($param, $this->_params) ? + $this->_params[$param] : $default; + } + + /** + * Get request URI + * + * @access public + * @return string + */ + public function getRequestUri() + { + return array_key_exists('REQUEST_URI', $_SERVER) ? + htmlspecialchars($_SERVER['REQUEST_URI']) : '/'; } /**