]> git.mxchange.org Git - friendica.git/blobdiff - src/App.php
Merge pull request #7388 from annando/issue-7315
[friendica.git] / src / App.php
index 7ef4e49195e2b1285664d362c8c8d6fceca8695a..8b2d50512b80b695f3b770db337e5e395e7e5791 100644 (file)
@@ -8,10 +8,11 @@ use Detection\MobileDetect;
 use DOMDocument;
 use DOMXPath;
 use Exception;
-use Friendica\Core\Config\Cache\IConfigCache;
+use Friendica\Core\Config\Cache\ConfigCache;
 use Friendica\Core\Config\Configuration;
 use Friendica\Core\Hook;
 use Friendica\Core\Theme;
+use Friendica\Database\Database;
 use Friendica\Database\DBA;
 use Friendica\Model\Profile;
 use Friendica\Network\HTTPException;
@@ -122,10 +123,15 @@ class App
         */
        private $profiler;
 
+       /**
+        * @var Database The Friendica database connection
+        */
+       private $database;
+
        /**
         * Returns the current config cache of this node
         *
-        * @return IConfigCache
+        * @return ConfigCache
         */
        public function getConfigCache()
        {
@@ -193,6 +199,14 @@ class App
                return $this->router;
        }
 
+       /**
+        * @return Database
+        */
+       public function getDatabase()
+       {
+               return $this->database;
+       }
+
        /**
         * Register a stylesheet file path to be included in the <head> tag of every page.
         * Inclusion is done in App->initHead().
@@ -232,6 +246,7 @@ class App
        /**
         * @brief App constructor.
         *
+        * @param Database $database The Friendica Database
         * @param Configuration    $config    The Configuration
         * @param App\Mode         $mode      The mode of this Friendica app
         * @param App\Router       $router    The router of this Friendica app
@@ -242,10 +257,11 @@ class App
         *
         * @throws Exception if the Basepath is not usable
         */
-       public function __construct(Configuration $config, App\Mode $mode, App\Router $router, BaseURL $baseURL, LoggerInterface $logger, Profiler $profiler, $isBackend = true)
+       public function __construct(Database $database, Configuration $config, App\Mode $mode, App\Router $router, BaseURL $baseURL, LoggerInterface $logger, Profiler $profiler, $isBackend = true)
        {
                BaseObject::setApp($this);
 
+               $this->database = $database;
                $this->config   = $config;
                $this->mode     = $mode;
                $this->router   = $router;
@@ -993,12 +1009,6 @@ class App
                        );
                }
 
-               if (strstr($this->query_string, '.well-known/host-meta') && ($this->query_string != '.well-known/host-meta')) {
-                       Module\Special\HTTPException::rawContent(
-                               new HTTPException\NotFoundException()
-                       );
-               }
-
                if (!$this->getMode()->isInstall()) {
                        // Force SSL redirection
                        if ($this->baseURL->checkRedirectHttps()) {
@@ -1105,7 +1115,7 @@ class App
 
                // Compatibility with the Android Diaspora client
                if ($this->module == 'stream') {
-                       $this->internalRedirect('network?f=&order=post');
+                       $this->internalRedirect('network?order=post');
                }
 
                if ($this->module == 'conversations') {
@@ -1113,15 +1123,15 @@ class App
                }
 
                if ($this->module == 'commented') {
-                       $this->internalRedirect('network?f=&order=comment');
+                       $this->internalRedirect('network?order=comment');
                }
 
                if ($this->module == 'liked') {
-                       $this->internalRedirect('network?f=&order=comment');
+                       $this->internalRedirect('network?order=comment');
                }
 
                if ($this->module == 'activity') {
-                       $this->internalRedirect('network/?f=&conv=1');
+                       $this->internalRedirect('network?conv=1');
                }
 
                if (($this->module == 'status_messages') && ($this->cmd == 'status_messages/new')) {