OpenID login and comment improoved
[living-lab-site.git] / application / libraries / Auth / extensions.php
1 <?php
2
3 /**
4  * CodeIgniter style sessions.
5  * 
6  * @package OpenID
7  */
8 class Auth_Yadis_CISession extends Auth_Yadis_PHPSession {
9         
10         protected $ci = NULL;
11         
12         public function __construct()
13         {
14                 $this->ci =& get_instance();
15                 $this->ci->load->library('session');
16         }
17         
18     /**
19      * Set a session key/value pair.
20      *
21      * @param string $name The name of the session key to add.
22      * @param string $value The value to add to the session.
23      */
24     function set($name, $value)
25     {
26                 $this->ci->session->set_userdata($name, $value);
27     }
28
29     /**
30      * Get a key's value from the session.
31      *
32      * @param string $name The name of the key to retrieve.
33      * @param string $default The optional value to return if the key
34      * is not found in the session.
35      * @return string $result The key's value in the session or
36      * $default if it isn't found.
37      */
38     function get($name, $default=NULL)
39     {
40                 $value = $this->ci->session->userdata($name);
41         if ($value !== FALSE) 
42                 {
43             return $value;
44         }
45                 else
46                 {
47             return $default;
48         }
49     }
50
51     /**
52      * Remove a key/value pair from the session.
53      *
54      * @param string $name The name of the key to remove.
55      */
56     function del($name)
57     {
58         $this->ci->session->unset_userdata($name);
59     }
60
61     /**
62      * Return the contents of the session in array form.
63      */
64     function contents()
65     {
66         return $this->ci->session->all_userdata();
67     }
68 }
69 ?>