]> git.mxchange.org Git - friendica.git/blobdiff - src/App/BaseURL.php
Merge remote-tracking branch 'upstream/develop' into item-notification
[friendica.git] / src / App / BaseURL.php
index 501e5fbd3bc32c6846554761e9fb225b1fa43aad..7c286514a6206e46747da3def5e3d62486f166d0 100644 (file)
@@ -2,7 +2,7 @@
 
 namespace Friendica\App;
 
-use Friendica\Core\Config\Configuration;
+use Friendica\Core\Config\IConfiguration;
 use Friendica\Core\System;
 use Friendica\Util\Network;
 use Friendica\Util\Strings;
@@ -37,7 +37,7 @@ class BaseURL
        /**
         * The Friendica Config
         *
-        * @var Configuration
+        * @var IConfiguration
         */
        private $config;
 
@@ -253,10 +253,10 @@ class BaseURL
        }
 
        /**
-        * @param Configuration $config The Friendica configuration
+        * @param IConfiguration $config The Friendica IConfiguration
         * @param array         $server The $_SERVER array
         */
-       public function __construct(Configuration $config, array $server)
+       public function __construct(IConfiguration $config, array $server)
        {
                $this->config = $config;
                $this->server = $server;
@@ -355,7 +355,7 @@ class BaseURL
                if (!empty($relative_script_path)) {
                        // Module
                        if (!empty($this->server['QUERY_STRING'])) {
-                               $this->urlPath = trim(rdirname($relative_script_path, substr_count(trim($this->server['QUERY_STRING'], '/'), '/') + 1), '/');
+                               $this->urlPath = trim(dirname($relative_script_path, substr_count(trim($this->server['QUERY_STRING'], '/'), '/') + 1), '/');
                        } else {
                                // Root page
                                $this->urlPath = trim($relative_script_path, '/');
@@ -435,4 +435,12 @@ class BaseURL
                $redirectTo = $this->get($ssl) . '/' . ltrim($toUrl, '/');
                System::externalRedirect($redirectTo);
        }
+
+       /**
+        * Returns the base url as string
+        */
+       public function __toString()
+       {
+               return $this->get();
+       }
 }