summaryrefslogtreecommitdiff
path: root/app/Core/Session/SessionStorage.php
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2017-12-06 16:19:11 -0800
committerFrédéric Guillot <fguillot@apple.com>2017-12-12 15:04:28 -0800
commitccd177ada6823c27a6408427f19c238fd701c39e (patch)
tree9846c792bd4c4f9318768f00db0e8f00cc25954b /app/Core/Session/SessionStorage.php
parent421531bd4f0af6a26e0b7971e23d5af1d5cf7d05 (diff)
Store PHP sessions in the database
Diffstat (limited to 'app/Core/Session/SessionStorage.php')
-rw-r--r--app/Core/Session/SessionStorage.php92
1 files changed, 0 insertions, 92 deletions
diff --git a/app/Core/Session/SessionStorage.php b/app/Core/Session/SessionStorage.php
deleted file mode 100644
index bb6771f1..00000000
--- a/app/Core/Session/SessionStorage.php
+++ /dev/null
@@ -1,92 +0,0 @@
-<?php
-
-namespace Kanboard\Core\Session;
-
-/**
- * Session Storage
- *
- * @package session
- * @author Frederic Guillot
- *
- * @property array $user
- * @property array $flash
- * @property array $csrf
- * @property array $postAuthenticationValidated
- * @property array $filters
- * @property string $redirectAfterLogin
- * @property string $captcha
- * @property string $commentSorting
- * @property bool $hasSubtaskInProgress
- * @property bool $hasRememberMe
- * @property bool $subtaskListToggle
- * @property string $scope
- * @property bool $twoFactorBeforeCodeCalled
- * @property string $twoFactorSecret
- * @property string $oauthState
- * @property int $smsTwoFactorSecret
- */
-class SessionStorage
-{
- /**
- * Pointer to external storage
- *
- * @access private
- * @var array
- */
- private $storage = array();
-
- /**
- * Set external storage
- *
- * @access public
- * @param array $storage External session storage (example: $_SESSION)
- */
- public function setStorage(array &$storage)
- {
- $this->storage =& $storage;
-
- // Load dynamically existing session variables into object properties
- foreach ($storage as $key => $value) {
- $this->$key = $value;
- }
- }
-
- /**
- * Get all session variables
- *
- * @access public
- * @return array
- */
- public function getAll()
- {
- $session = get_object_vars($this);
- unset($session['storage']);
-
- return $session;
- }
-
- /**
- * Flush session data
- *
- * @access public
- */
- public function flush()
- {
- $session = get_object_vars($this);
- unset($session['storage']);
-
- foreach (array_keys($session) as $property) {
- unset($this->$property);
- }
- }
-
- /**
- * Copy class properties to external storage
- *
- * @access public
- */
- public function __destruct()
- {
- $this->storage = $this->getAll();
- }
-}