Browse code

Support of path string occurrence in basePath

RafaƂ Szklarczyk authored on 06/09/2019 08:41:53
Showing 1 changed files
... ...
@@ -46,7 +46,9 @@ class Application{
46 46
 
47 47
     public function basePath(){
48 48
         if(isset($this->request->path)&&$this->request->path!=''){
49
-            return strstr($_SERVER['REQUEST_URI'], $this->request->path, true);
49
+            $base = explode('%23',explode('?',$_SERVER['REQUEST_URI'],2)[0],2)[0];
50
+            if (substr($base,-strlen($this->request->path))===$this->request->path) $base = substr($base, 0, strlen($base)-strlen($this->request->path));
51
+            return $base;
50 52
         }
51 53
         else
52 54
             return explode('%23',explode('?',$_SERVER['REQUEST_URI'],2)[0],2)[0];