Rev 569 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 569 | Rev 585 | ||
---|---|---|---|
Line 19... | Line 19... | ||
19 | 19 | ||
20 | if (!defined('INSIDE_OIDPLUS')) die(); |
20 | if (!defined('INSIDE_OIDPLUS')) die(); |
21 | 21 | ||
22 | class OIDplusAuthContentStoreSession extends OIDplusAuthContentStore { |
22 | class OIDplusAuthContentStoreSession extends OIDplusAuthContentStore { |
23 | 23 | ||
24 | protected function getSessionHandler() { |
24 | protected static function getSessionHandler() { |
25 | static $sesHandler = null; |
25 | static $sesHandler = null; |
26 | if (is_null($sesHandler)) { |
26 | if (is_null($sesHandler)) { |
27 | $sesHandler = new OIDplusSessionHandler(); |
27 | $sesHandler = new OIDplusSessionHandler(); |
28 | } |
28 | } |
29 | return $sesHandler; |
29 | return $sesHandler; |
30 | } |
30 | } |
31 | 31 | ||
32 | // Override abstract functions |
32 | // Override abstract functions |
- | 33 | # TODO: shouldn't we just include OIDplusSessionHandler in this class? |
|
33 | 34 | ||
34 | public function getValue($name, $default = NULL) { |
35 | public function getValue($name, $default = NULL) { |
35 | return $this->getSessionHandler()->getValue($name, $default); |
36 | return self::getSessionHandler()->getValue($name, $default); |
36 | - | ||
37 | } |
37 | } |
38 | 38 | ||
39 | public function setValue($name, $value) { |
39 | public function setValue($name, $value) { |
40 | return $this->getSessionHandler()->setValue($name, $value); |
40 | return self::getSessionHandler()->setValue($name, $value); |
41 | } |
41 | } |
42 | 42 | ||
43 | public function exists($name) { |
43 | public function exists($name) { |
44 | return $this->getSessionHandler()->exists($name); |
44 | return self::getSessionHandler()->exists($name); |
45 | } |
45 | } |
46 | 46 | ||
47 | public function delete($name) { |
47 | public function delete($name) { |
48 | return $this->getSessionHandler()->delete($name); |
48 | return self::getSessionHandler()->delete($name); |
- | 49 | } |
|
- | 50 | ||
- | 51 | public function destroySession() { |
|
- | 52 | return self::getSessionHandler()->destroySession(); |
|
- | 53 | } |
|
- | 54 | ||
- | 55 | public static function getActiveProvider() { |
|
- | 56 | static $contentProvider = null; |
|
- | 57 | ||
- | 58 | if (!$contentProvider) { |
|
- | 59 | if (self::getSessionHandler()->isActive()) { |
|
- | 60 | $contentProvider = new OIDplusAuthContentStoreSession(); |
|
- | 61 | } |
|
- | 62 | } |
|
- | 63 | ||
- | 64 | return $contentProvider; |
|
- | 65 | } |
|
- | 66 | ||
- | 67 | public function raLoginEx($email, &$loginfo) { |
|
- | 68 | $this->raLogin($email); |
|
- | 69 | if (is_null(self::getActiveProvider())) { |
|
- | 70 | $loginfo = 'into new PHP session'; |
|
- | 71 | } else { |
|
- | 72 | $loginfo = 'into existing PHP session'; |
|
- | 73 | } |
|
- | 74 | } |
|
- | 75 | ||
- | 76 | public function adminLoginEx(&$loginfo) { |
|
- | 77 | $this->adminLogin(); |
|
- | 78 | if (is_null(self::getActiveProvider())) { |
|
- | 79 | $loginfo = 'into new PHP session'; |
|
- | 80 | } else { |
|
- | 81 | $loginfo = 'into existing PHP session'; |
|
- | 82 | } |
|
- | 83 | } |
|
- | 84 | ||
- | 85 | public function raLogoutEx($email, &$loginfo) { |
|
- | 86 | $this->raLogout($email); |
|
- | 87 | $loginfo = 'from PHP session'; |
|
- | 88 | } |
|
- | 89 | ||
- | 90 | public function adminLogoutEx(&$loginfo) { |
|
- | 91 | $this->adminLogout(); |
|
- | 92 | $loginfo = 'from PHP session'; |
|
49 | } |
93 | } |
50 | 94 | ||
51 | protected function destroySession() { |
95 | public function activate() { |
52 | return $this->getSessionHandler()->destroySession(); |
96 | # Sessions automatically activate during setValue() |
- | 97 | return; |
|
53 | } |
98 | } |
54 | 99 | ||
55 | } |
100 | } |