5 use wcf\system\exception\IllegalLinkException
;
6 use wcf\system\session\SessionHandler
;
9 use wcf\util\StringUtil
;
12 * Deletes a specific user session.
14 * @author Joshua Ruesweg
15 * @copyright 2001-2020 WoltLab GmbH
16 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
17 * @package WoltLabSuite\Core\Action
19 class DeleteSessionAction
extends AbstractAction
24 public $loginRequired = true;
34 public function readParameters()
36 parent
::readParameters();
38 if (isset($_POST['sessionID'])) {
39 $this->sessionID
= StringUtil
::trim($_POST['sessionID']);
42 if (empty($this->sessionID
)) {
43 throw new IllegalLinkException();
47 foreach (SessionHandler
::getInstance()->getUserSessions(WCF
::getUser()) as $session) {
48 if ($session->getSessionID() === $this->sessionID
) {
55 throw new IllegalLinkException();
62 public function execute()
66 SessionHandler
::getInstance()->deleteUserSession($this->sessionID
);
70 // send JSON-encoded response
71 \
header('Content-type: application/json');
73 'sessionID' => $this->sessionID
,