Sfoglia il codice sorgente

moving access to into Request class

El RIDO 8 anni fa
parent
commit
3bca559826
2 ha cambiato i file con 15 aggiunte e 3 eliminazioni
  1. 1 2
      lib/PrivateBin.php
  2. 14 1
      lib/Request.php

+ 1 - 2
lib/PrivateBin.php

@@ -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) ?
-            htmlspecialchars($_SERVER['REQUEST_URI']) : '/';
+        $this->_urlBase = $this->_request->getRequestUri();
         ServerSalt::setPath($this->_conf->getKey('dir', 'traffic'));
         ServerSalt::setPath($this->_conf->getKey('dir', 'traffic'));
 
 
         // set default language
         // set default language

+ 14 - 1
lib/Request.php

@@ -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']) : '/';
     }
     }
 
 
     /**
     /**