diff options
| author | André Noack <noack@data-quest.de> | 2024-12-12 14:52:00 +0000 |
|---|---|---|
| committer | David Siegfried <david.siegfried@uni-vechta.de> | 2024-12-12 14:52:00 +0000 |
| commit | 940d2aaa8638b4e0c764579cb3977e7be527c81f (patch) | |
| tree | 79bd2d7f02359e1bb24931b33513e082f8404a91 /app/controllers/logout.php | |
| parent | 3a2a88172ccbe97aaecf4ea32b97cd07b92dcb11 (diff) | |
StEP 1552 closes #1552
Closes #1552
Merge request studip/studip!1137
Diffstat (limited to 'app/controllers/logout.php')
| -rw-r--r-- | app/controllers/logout.php | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/app/controllers/logout.php b/app/controllers/logout.php new file mode 100644 index 0000000..22a93f0 --- /dev/null +++ b/app/controllers/logout.php @@ -0,0 +1,63 @@ +<?php +/** + * logout.php - logout + * + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * @author André Noack <noack@data-quest.de> + * @license http://www.gnu.org/licenses/gpl-2.0.html GPL version 2 + * @category Stud.IP + */ +class LogoutController extends AuthenticatedController +{ + protected $allow_nobody = true; + + public function index_action() + { + if ($GLOBALS['user']->id !== 'nobody') { + $my_messaging_settings = $GLOBALS['user']->cfg->MESSAGING_SETTINGS; + + //Wenn Option dafuer gewaehlt, alle ungelsesenen Nachrichten als gelesen speichern + if ($my_messaging_settings["logout_markreaded"]) { + Message::markAllAs(); + } + + $logout_user = $GLOBALS['user']->id; + $_language = $_SESSION['_language']; + $contrast = UserConfig::get($GLOBALS['user']->id)->USER_HIGH_CONTRAST; + + // Get auth plugin of user before logging out since the $auth object will + // be modified by the logout + $auth_plugin = StudipAuthAbstract::getInstance($GLOBALS['user']->auth_plugin); + + sess()->destroy(); + //Session changed zuruecksetzen + $timeout=(time()-(15 * 60)); + $GLOBALS['user']->set_last_action($timeout); + + // Perform logout from auth plugin (if possible) + if ($auth_plugin instanceof StudipAuthSSO) { + $auth_plugin->logout(); + } + + sess()->start(); + $_SESSION['_language'] = $_language; + if ($contrast) { + $_SESSION['contrast'] = $contrast; + } + NotificationCenter::addObserver(function() { + throw new NotificationVetoException(); + }, '__invoke', 'PageCloseWillExecute'); + PageLayout::postSuccess( + _('Sie sind nun aus dem System abgemeldet.'), + array_filter([$GLOBALS['UNI_LOGOUT_ADD']]) + ); + } + + $this->redirect(URLHelper::getURL('dispatch.php/start')); + } +} |
