moving access to into Request class

This commit is contained in:
El RIDO 2018-01-06 10:27:58 +01:00
parent d92755f030
commit 3bca559826
No known key found for this signature in database
GPG key ID: 0F5C940A6BD81F92
2 changed files with 15 additions and 3 deletions

View file

@ -176,8 +176,7 @@ class PrivateBin
$this->_conf = new Configuration; $this->_conf = new Configuration;
$this->_model = new Model($this->_conf); $this->_model = new Model($this->_conf);
$this->_request = new Request; $this->_request = new Request;
$this->_urlBase = array_key_exists('REQUEST_URI', $_SERVER) ? $this->_urlBase = $this->_request->getRequestUri();
htmlspecialchars($_SERVER['REQUEST_URI']) : '/';
ServerSalt::setPath($this->_conf->getKey('dir', 'traffic')); ServerSalt::setPath($this->_conf->getKey('dir', 'traffic'));
// set default language // set default language

View file

@ -141,7 +141,20 @@ class Request
*/ */
public function getParam($param, $default = '') 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']) : '/';
} }
/** /**