1: <?php
2: /**
3: * The Horde_Kolab_Session_Abstract class provides general
4: * functionality for the Kolab user session data.
5: *
6: * PHP version 5
7: *
8: * @category Kolab
9: * @package Kolab_Session
10: * @author Gunnar Wrobel <wrobel@pardus.de>
11: * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
12: * @link http://pear.horde.org/index.php?package=Kolab_Session
13: */
14:
15: /**
16: * The Horde_Kolab_Session_Abstract class provides general
17: * functionality for the Kolab user session data.
18: *
19: * Copyright 2008-2012 Horde LLC (http://www.horde.org/)
20: *
21: * See the enclosed file COPYING for license information (LGPL). If you
22: * did not receive this file, see http://www.horde.org/licenses/lgpl21.
23: *
24: * @category Kolab
25: * @package Kolab_Session
26: * @author Gunnar Wrobel <wrobel@pardus.de>
27: * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
28: * @link http://pear.horde.org/index.php?package=Kolab_Session
29: */
30: abstract class Horde_Kolab_Session_Abstract implements Horde_Kolab_Session
31: {
32: /**
33: * The session data.
34: *
35: * @var array
36: */
37: protected $_data;
38:
39: /**
40: * Return the user id used for connecting the session.
41: *
42: * @return string The user id.
43: */
44: public function getId()
45: {
46: if (isset($this->_data['user']['id'])) {
47: return $this->_data['user']['id'];
48: }
49: }
50:
51: /**
52: * Return the users mail address.
53: *
54: * @return string The users mail address.
55: */
56: public function getMail()
57: {
58: if (isset($this->_data['user']['mail'])) {
59: return $this->_data['user']['mail'];
60: }
61: }
62:
63: /**
64: * Return the users uid.
65: *
66: * @return string The users uid.
67: */
68: public function getUid()
69: {
70: if (isset($this->_data['user']['uid'])) {
71: return $this->_data['user']['uid'];
72: }
73: }
74:
75: /**
76: * Return the users name.
77: *
78: * @return string The users name.
79: */
80: public function getName()
81: {
82: if (isset($this->_data['user']['name'])) {
83: return $this->_data['user']['name'];
84: }
85: }
86:
87: /**
88: * Return the imap server.
89: *
90: * @return string The imap host for the current user.
91: */
92: public function getImapServer()
93: {
94: if (isset($this->_data['imap']['server'])) {
95: return $this->_data['imap']['server'];
96: }
97: }
98:
99: /**
100: * Return the freebusy server.
101: *
102: * @return string The freebusy host for the current user.
103: */
104: public function getFreebusyServer()
105: {
106: if (isset($this->_data['fb']['server'])) {
107: return $this->_data['fb']['server'];
108: }
109: }
110:
111: /**
112: * Import the session data from an array.
113: *
114: * @param array The session data.
115: *
116: * @return NULL
117: */
118: public function import(array $session_data)
119: {
120: $this->_data = $session_data;
121: }
122:
123: /**
124: * Export the session data as array.
125: *
126: * @return array The session data.
127: */
128: public function export()
129: {
130: return $this->_data;
131: }
132:
133: /**
134: * Clear the session data.
135: *
136: * @return NULL
137: */
138: public function purge()
139: {
140: $this->_data = array();
141: }
142: }
143: