]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Home.php
Merge pull request #13831 from friendica/warning
[friendica.git] / src / Module / Home.php
index f89920e54b6b8269c57cce10f418f2fb6a5b880c..c202fbfcd9334ffb8540bf82d97c9699c5cb81ff 100644 (file)
@@ -1,4 +1,23 @@
 <?php
+/**
+ * @copyright Copyright (C) 2010-2024, the Friendica project
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
 
 namespace Friendica\Module;
 
@@ -6,14 +25,23 @@ use Friendica\BaseModule;
 use Friendica\Core\Hook;
 use Friendica\Core\Renderer;
 use Friendica\DI;
+use Friendica\Model\User;
 use Friendica\Module\Security\Login;
+use Friendica\Protocol\ActivityPub;
 
 /**
  * Home module - Landing page of the current node
  */
 class Home extends BaseModule
 {
-       public static function content(array $parameters = [])
+       protected function rawContent(array $request = [])
+       {
+               if (ActivityPub::isRequest()) {
+                       DI::baseUrl()->redirect(User::getActorName());
+               }
+       }
+
+       protected function content(array $request = []): string
        {
                $app = DI::app();
                $config = DI::config();
@@ -23,11 +51,11 @@ class Home extends BaseModule
 
                Hook::callAll('home_init', $ret);
 
-               if (local_user() && ($app->user['nickname'])) {
+               if (DI::userSession()->getLocalUserId() && ($app->getLoggedInUserNickname())) {
                        DI::baseUrl()->redirect('network');
                }
 
-               if (strlen($config->get('system', 'singleuser'))) {
+               if ($config->get('system', 'singleuser')) {
                        DI::baseUrl()->redirect('/profile/' . $config->get('system', 'singleuser'));
                }
 
@@ -41,7 +69,7 @@ class Home extends BaseModule
                        $customHome = $homeFilePath;
 
                        if (file_exists($cssFilePath)) {
-                               DI::page()['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . DI::baseUrl()->get() . '/home.css' . '" media="all" />';
+                               DI::page()->registerStylesheet('home.css', 'all');
                        }
                }