diff options
author | Janne Heß <janne@hess.ooo> | 2019-03-07 13:01:52 +0100 |
---|---|---|
committer | msquare <msquare@notrademark.de> | 2019-03-09 13:52:13 +0100 |
commit | afa4506e11f96d05a727e591301f98fb50f8fad4 (patch) | |
tree | ecca4d5bc66589c599b2c71e7d504da52fda7099 | |
parent | cd2f78924b41c70d1bc13fc45e0d025a56e32c48 (diff) |
Support alternative home sites
-rw-r--r-- | config/config.default.php | 4 | ||||
-rw-r--r-- | includes/pages/guest_login.php | 2 | ||||
-rw-r--r-- | includes/pages/user_shifts.php | 5 | ||||
-rw-r--r-- | src/Middleware/LegacyMiddleware.php | 2 |
4 files changed, 10 insertions, 3 deletions
diff --git a/config/config.default.php b/config/config.default.php index 8467e144..8840a00c 100644 --- a/config/config.default.php +++ b/config/config.default.php @@ -69,6 +69,10 @@ return [ // Rewrite URLs with mod_rewrite 'rewrite_urls' => true, + // Redirect to this site after logging in or when pressing the top-left button + // Must be one of news, user_meetings, user_shifts, angeltypes, user_questions + 'home_site' => 'news', + // Number of News shown on one site 'display_news' => 6, diff --git a/includes/pages/guest_login.php b/includes/pages/guest_login.php index 1b16333f..f507548b 100644 --- a/includes/pages/guest_login.php +++ b/includes/pages/guest_login.php @@ -414,7 +414,7 @@ function guest_login() $session->set('uid', $login_user->id); $session->set('locale', $login_user->settings->language); - redirect(page_link_to('news')); + redirect(page_link_to(config('home_site'))); } } diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php index 942b8849..4ddc8f70 100644 --- a/includes/pages/user_shifts.php +++ b/includes/pages/user_shifts.php @@ -118,7 +118,10 @@ function load_days() if (empty($days)) { error(__('The administration has not configured any shifts yet.')); - redirect(page_link_to('/')); + // Do not try to redirect to the current page + if (config('home_site') != 'user_shifts') { + redirect(page_link_to('/')); + } } return $days; } diff --git a/src/Middleware/LegacyMiddleware.php b/src/Middleware/LegacyMiddleware.php index 8524764f..0aca3813 100644 --- a/src/Middleware/LegacyMiddleware.php +++ b/src/Middleware/LegacyMiddleware.php @@ -71,7 +71,7 @@ class LegacyMiddleware implements MiddlewareInterface $page = str_replace('-', '_', $page); } if ($page == '/') { - $page = $this->auth->user() ? 'news' : 'login'; + $page = $this->auth->user() ? config('home_site') : 'login'; } $title = $content = ''; |