diff --git a/mod/home.php b/mod/home.php
deleted file mode 100644
index 9f18101202..0000000000
--- a/mod/home.php
+++ /dev/null
@@ -1,64 +0,0 @@
-user['nickname'])) {
- $a->internalRedirect('network');
- }
-
- if (strlen(Config::get('system','singleuser'))) {
- $a->internalRedirect('profile/' . Config::get('system','singleuser'));
- }
-
-}}
-
-if(! function_exists('home_content')) {
-function home_content(App $a) {
-
- if (!empty($_SESSION['theme'])) {
- unset($_SESSION['theme']);
- }
- if (!empty($_SESSION['mobile-theme'])) {
- unset($_SESSION['mobile-theme']);
- }
-
- $customhome = false;
- $defaultheader = '
' . (Config::get('config', 'sitename') ? L10n::t('Welcome to %s', Config::get('config', 'sitename')) : '') . '
';
-
- $homefilepath = $a->getBasePath() . "/home.html";
- $cssfilepath = $a->getBasePath() . "/home.css";
- if (file_exists($homefilepath)) {
- $customhome = $homefilepath;
- if (file_exists($cssfilepath)) {
- $a->page['htmlhead'] .= '';
- }
- }
-
- $login = Login::form($a->query_string, intval(Config::get('config', 'register_policy')) === \Friendica\Module\Register::CLOSED ? 0 : 1);
-
- $content = '';
- Hook::callAll("home_content",$content);
-
-
- $tpl = Renderer::getMarkupTemplate('home.tpl');
- return Renderer::replaceMacros($tpl, [
- '$defaultheader' => $defaultheader,
- '$customhome' => $customhome,
- '$login' => $login,
- '$content' => $content
- ]);
-}}
diff --git a/src/App/Router.php b/src/App/Router.php
index 6612936e1b..12d5d21569 100644
--- a/src/App/Router.php
+++ b/src/App/Router.php
@@ -40,6 +40,7 @@ class Router
*/
public function collectRoutes()
{
+ $this->routeCollector->addRoute(['GET'], '[/]', Module\Home::class);
$this->routeCollector->addGroup('/.well-known', function (RouteCollector $collector) {
$collector->addRoute(['GET'], '/host-meta' , Module\WellKnown\HostMeta::class);
$collector->addRoute(['GET'], '/nodeinfo[/1.0]' , Module\NodeInfo::class);
@@ -118,6 +119,7 @@ class Router
$collector->addRoute(['POST'], '/{group:\d+}/remove/{contact:\d+}', Module\Group::class);
});
$this->routeCollector->addRoute(['GET'], '/hashtag', Module\Hashtag::class);
+ $this->routeCollector->addRoute(['GET'], '/home', Module\Home::class);
$this->routeCollector->addRoute(['GET'], '/inbox[/{nickname}]', Module\Inbox::class);
$this->routeCollector->addGroup('/install', function (RouteCollector $collector) {
$collector->addRoute(['GET', 'POST'], '[/]', Module\Install::class);
@@ -126,6 +128,7 @@ class Router
$this->routeCollector->addRoute(['GET', 'POST'], '/itemsource[/{guid}]', Module\Itemsource::class);
$this->routeCollector->addRoute(['GET', 'POST'], '/localtime', Module\Localtime::class);
$this->routeCollector->addRoute(['GET', 'POST'], '/login', Module\Login::class);
+ $this->routeCollector->addRoute(['GET', 'POST'], '/logout', Module\Logout::class);
$this->routeCollector->addRoute(['GET'], '/magic', Module\Magic::class);
$this->routeCollector->addRoute(['GET'], '/manifest', Module\Manifest::class);
$this->routeCollector->addRoute(['GET'], '/nodeinfo/1.0', Module\NodeInfo::class);
diff --git a/src/Module/Home.php b/src/Module/Home.php
new file mode 100644
index 0000000000..f58664f9d7
--- /dev/null
+++ b/src/Module/Home.php
@@ -0,0 +1,74 @@
+getConfig();
+
+ if (local_user() && ($app->user['nickname'])) {
+ $app->internalRedirect('network');
+ }
+
+ if (strlen($config->get('system', 'singleuser'))) {
+ $app->internalRedirect('/profile/' . $config->get('system', 'singleuser'));
+ }
+ }
+
+ public static function content()
+ {
+ if (!empty($_SESSION['theme'])) {
+ unset($_SESSION['theme']);
+ }
+
+ if (!empty($_SESSION['mobile-theme'])) {
+ unset($_SESSION['mobile-theme']);
+ }
+
+ $app = self::getApp();
+ $config = $app->getConfig();
+
+ $customHome = '';
+ $defaultHeader = ($config->get('config', 'sitename') ? L10n::t('Welcome to %s', $config->get('config', 'sitename')) : '');
+
+ $homeFilePath = $app->getBaseURL() . '/home.html';
+ $cssFilePath = $app->getBaseURL() . '/home.css';
+
+ if (file_exists($homeFilePath)) {
+ $customHome = $homeFilePath;
+
+ if (file_exists($cssFilePath)) {
+ $app->page['htmlhead'] .= '';
+ }
+ }
+
+ $login = Login::form($app->query_string, $config->get('config', 'register_policy') === Register::CLOSED ? 0 : 1);
+
+ $content = '';
+ Hook::callAll('home_content', $content);
+
+ $tpl = Renderer::getMarkupTemplate('home.tpl');
+ return Renderer::replaceMacros($tpl, [
+ '$defaultheader' => $defaultHeader,
+ '$customhome' => $customHome,
+ '$login' => $login,
+ '$content' => $content,
+ ]);
+ }
+}
diff --git a/view/templates/home.tpl b/view/templates/home.tpl
index eb3f402fc6..d2ce589fdd 100644
--- a/view/templates/home.tpl
+++ b/view/templates/home.tpl
@@ -7,7 +7,7 @@
{{if $customhome != false }}
{{include file="$customhome"}}
{{else}}
- {{$defaultheader nofilter}}
+ {{$defaultheader nofilter}}
{{/if}}
{{$login nofilter}}