X-Git-Url: http://p2p-next.cs.pub.ro/gitweb/?a=blobdiff_plain;f=application%2Flibraries%2FAuth%2Fextensions.php;fp=application%2Flibraries%2FAuth%2Fextensions.php;h=041dd00101b8b5bfdbbe60572e392fbe88decefc;hb=2881d1393f363efd3c5f0e9b58706e6e35e85717;hp=0000000000000000000000000000000000000000;hpb=480a21049384e47afe920e73972ca336ec8e6a54;p=living-lab-site.git diff --git a/application/libraries/Auth/extensions.php b/application/libraries/Auth/extensions.php new file mode 100644 index 0000000..041dd00 --- /dev/null +++ b/application/libraries/Auth/extensions.php @@ -0,0 +1,69 @@ +ci =& get_instance(); + $this->ci->load->library('session'); + } + + /** + * Set a session key/value pair. + * + * @param string $name The name of the session key to add. + * @param string $value The value to add to the session. + */ + function set($name, $value) + { + $this->ci->session->set_userdata($name, $value); + } + + /** + * Get a key's value from the session. + * + * @param string $name The name of the key to retrieve. + * @param string $default The optional value to return if the key + * is not found in the session. + * @return string $result The key's value in the session or + * $default if it isn't found. + */ + function get($name, $default=NULL) + { + $value = $this->ci->session->userdata($name); + if ($value !== FALSE) + { + return $value; + } + else + { + return $default; + } + } + + /** + * Remove a key/value pair from the session. + * + * @param string $name The name of the key to remove. + */ + function del($name) + { + $this->ci->session->unset_userdata($name); + } + + /** + * Return the contents of the session in array form. + */ + function contents() + { + return $this->ci->session->all_userdata(); + } +} +?>