Merge branch '3.0'
[GitHub/WoltLab/WCF.git] / wcfsetup / install / files / lib / action / LogoutAction.class.php
CommitLineData
320f4a6d
MW
1<?php
2namespace wcf\action;
3use wcf\system\request\LinkHandler;
4use wcf\system\WCF;
5use wcf\util\HeaderUtil;
6
7/**
8 * Does the user logout.
9 *
10 * @author Marcel Werk
c839bd49 11 * @copyright 2001-2018 WoltLab GmbH
320f4a6d 12 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
e71525e4 13 * @package WoltLabSuite\Core\Action
320f4a6d
MW
14 */
15class LogoutAction extends \wcf\acp\action\LogoutAction {
16 const AVAILABLE_DURING_OFFLINE_MODE = true;
17
18 /**
0fcfe5f6 19 * @inheritDoc
320f4a6d
MW
20 */
21 public function execute() {
22 AbstractSecureAction::execute();
23
24 // do logout
25 WCF::getSession()->delete();
26
27 // remove cookies
28 if (isset($_COOKIE[COOKIE_PREFIX.'userID'])) {
29 HeaderUtil::setCookie('userID', 0);
30 }
31 if (isset($_COOKIE[COOKIE_PREFIX.'password'])) {
32 HeaderUtil::setCookie('password', '');
33 }
34
35 $this->executed();
36
37 // forward to index page
06edbf27 38 HeaderUtil::redirect(LinkHandler::getInstance()->getLink());
320f4a6d
MW
39 exit;
40 }
41}