blob: 734334249779dfb7da9ec51308751fbc076c7014 [file] [log] [blame]
Darren Hillc4e266b2011-08-30 15:40:27 -04001<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
2/**
3 * CodeIgniter
4 *
5 * An open source application development framework for PHP 5.1.6 or newer
6 *
7 * @package CodeIgniter
8 * @author ExpressionEngine Dev Team
9 * @copyright Copyright (c) 2008 - 2010, EllisLab, Inc.
10 * @license http://codeigniter.com/user_guide/license.html
11 * @link http://codeigniter.com
12 * @since Version 2.0
13 * @filesource
14 */
15
16
17/**
Darren Hill5073a372011-08-31 13:54:19 -040018 * CI_Session Class
Darren Hillc4e266b2011-08-30 15:40:27 -040019 *
20 * The user interface defined by EllisLabs, now with puggable drivers to manage different storage mechanisms.
Darren Hill5073a372011-08-31 13:54:19 -040021 * By default, the native PHP session driver will load, but the 'sess_driver' config/param item (see above) can be
22 * used to specify the 'cookie' driver, or any other you might create.
Darren Hillc4e266b2011-08-30 15:40:27 -040023 * Once loaded, this driver setup is a drop-in replacement for the former CI_Session library, taking its place as the
24 * 'session' member of the global controller framework (e.g.: $CI->session or $this->session).
25 * In keeping with the CI_Driver methodology, multiple drivers may be loaded, although this might be a bit confusing.
Darren Hill5073a372011-08-31 13:54:19 -040026 * The CI_Session library class keeps track of the most recently loaded driver as "current" to call for driver methods.
Darren Hillc4e266b2011-08-30 15:40:27 -040027 * Ideally, one driver is loaded and all calls go directly through the main library interface. However, any methods
28 * called through the specific driver will switch the "current" driver to itself before invoking the library method
29 * (which will then call back into the driver for low-level operations). So, alternation between two drivers can be
30 * achieved by specifying which driver to use for each call (e.g.: $this->session->native->set_userdata('foo', 'bar');
31 * $this->session->cookie->userdata('foo'); $this->session->native->unset_userdata('foo');). Notice in the previous
32 * example that the _native_ userdata value 'foo' would be set to 'bar', which would NOT be returned by the call for
33 * the _cookie_ userdata 'foo', nor would the _cookie_ value be unset by the call to unset the _native_ 'foo' value.
34 *
35 * @package CodeIgniter
36 * @subpackage Libraries
37 * @category Sessions
Darren Hill5073a372011-08-31 13:54:19 -040038 * @author ExpressionEngine Dev Team
Darren Hillc4e266b2011-08-30 15:40:27 -040039 * @link http://codeigniter.com/user_guide/libraries/sessions.html
40 */
Darren Hilla2ae6572011-09-01 07:36:26 -040041class CI_Session extends CI_Driver_Library {
Darren Hillc4e266b2011-08-30 15:40:27 -040042 public $params = array();
Darren Hilla2ae6572011-09-01 07:36:26 -040043 protected $current = null;
44 protected $userdata = array();
Darren Hillc4e266b2011-08-30 15:40:27 -040045
46 const FLASHDATA_KEY = 'flash';
47 const FLASHDATA_NEW = ':new:';
48 const FLASHDATA_OLD = ':old:';
49 const FLASHDATA_EXP = ':exp:';
50 const EXPIRATION_KEY = '__expirations';
51 const TEMP_EXP_DEF = 300;
52
53 /**
Darren Hill5073a372011-08-31 13:54:19 -040054 * CI_Session constructor
Darren Hillc4e266b2011-08-30 15:40:27 -040055 *
56 * The constructor loads the configured driver ('sess_driver' in config.php or as a parameter), running
57 * routines in its constructor, and manages flashdata aging.
58 *
Darren Hill5073a372011-08-31 13:54:19 -040059 * @param array Configuration parameters
Darren Hillc4e266b2011-08-30 15:40:27 -040060 */
61 public function __construct(array $params = array())
62 {
Darren Hill5073a372011-08-31 13:54:19 -040063 log_message('debug', 'CI_Session Class Initialized');
Darren Hillc4e266b2011-08-30 15:40:27 -040064
65 // Get valid drivers list
66 $CI =& get_instance();
dchill42c5872252012-07-30 14:53:11 -040067 $this->valid_drivers = array('Session_native', 'Session_cookie');
Darren Hillc4e266b2011-08-30 15:40:27 -040068 $key = 'sess_valid_drivers';
69 $drivers = (isset($params[$key])) ? $params[$key] : $CI->config->item($key);
70 if ($drivers)
71 {
dchill4277ee3fd2012-07-24 11:50:01 -040072 if ( ! is_array($drivers)) $drivers = array($drivers);
Darren Hillc4e266b2011-08-30 15:40:27 -040073
74 // Add driver names to valid list
75 foreach ($drivers as $driver)
76 {
dchill4277ee3fd2012-07-24 11:50:01 -040077 if ( ! in_array(strtolower($driver), array_map('strtolower', $this->valid_drivers)))
Darren Hillc4e266b2011-08-30 15:40:27 -040078 {
79 $this->valid_drivers[] = $driver;
80 }
81 }
82 }
83
84 // Get driver to load
85 $key = 'sess_driver';
86 $driver = (isset($params[$key])) ? $params[$key] : $CI->config->item($key);
dchill4277ee3fd2012-07-24 11:50:01 -040087 if ( ! $driver) $driver = 'cookie';
88 if ( ! in_array('session_'.strtolower($driver), array_map('strtolower', $this->valid_drivers)))
Darren Hillc4e266b2011-08-30 15:40:27 -040089 {
90 $this->valid_drivers[] = 'Session_'.$driver;
91 }
92
93 // Save a copy of parameters in case drivers need access
94 $this->params = $params;
95
96 // Load driver and get array reference
97 $this->load_driver($driver);
98 $this->userdata =& $this->current->get_userdata();
99
100 // Delete 'old' flashdata (from last request)
101 $this->_flashdata_sweep();
102
103 // Mark all new flashdata as old (data will be deleted before next request)
104 $this->_flashdata_mark();
105
106 // Delete expired tempdata
107 $this->_tempdata_sweep();
108
Darren Hill5073a372011-08-31 13:54:19 -0400109 log_message('debug', 'CI_Session routines successfully run');
Darren Hillc4e266b2011-08-30 15:40:27 -0400110 }
111
112 /**
113 * Loads session storage driver
114 *
Darren Hill5073a372011-08-31 13:54:19 -0400115 * @param string Driver classname
116 * @return object Loaded driver object
Darren Hillc4e266b2011-08-30 15:40:27 -0400117 */
118 public function load_driver($driver)
119 {
120 // Save reference to most recently loaded driver as library default
121 $this->current = parent::load_driver($driver);
122 return $this->current;
123 }
124
125 /**
126 * Select default session storage driver
127 *
Darren Hill5073a372011-08-31 13:54:19 -0400128 * @param string Driver classname
129 * @return void
Darren Hillc4e266b2011-08-30 15:40:27 -0400130 */
131 public function select_driver($driver)
132 {
133 // Validate driver name
dchill42c5872252012-07-30 14:53:11 -0400134 $lowername = strtolower(str_replace('CI_', '', $driver));
Darren Hillc4e266b2011-08-30 15:40:27 -0400135 if (in_array($lowername, array_map('strtolower', $this->valid_drivers)))
136 {
137 // See if regular or lowercase variant is loaded
138 if (class_exists($driver))
139 {
140 $this->current = $this->$driver;
141 }
142 else if (class_exists($lowername))
143 {
144 $this->current = $this->$lowername;
145 }
146 else
147 {
148 $this->load_driver($driver);
149 }
150 }
151 }
152
153 /**
154 * Destroy the current session
155 *
Darren Hill5073a372011-08-31 13:54:19 -0400156 * @return void
Darren Hillc4e266b2011-08-30 15:40:27 -0400157 */
158 public function sess_destroy()
159 {
160 // Just call destroy on driver
161 $this->current->sess_destroy();
162 }
163
164 /**
165 * Regenerate the current session
166 *
Darren Hill5073a372011-08-31 13:54:19 -0400167 * @param boolean Destroy session data flag (default: false)
168 * @return void
Darren Hillc4e266b2011-08-30 15:40:27 -0400169 */
170 public function sess_regenerate($destroy = false)
171 {
172 // Just call regenerate on driver
173 $this->current->sess_regenerate($destroy);
174 }
175
176 /**
177 * Fetch a specific item from the session array
178 *
Darren Hill5073a372011-08-31 13:54:19 -0400179 * @param string Item key
dchill42c5872252012-07-30 14:53:11 -0400180 * @return string Item value or NULL if not found
Darren Hillc4e266b2011-08-30 15:40:27 -0400181 */
182 public function userdata($item)
183 {
dchill42c5872252012-07-30 14:53:11 -0400184 // Return value or NULL if not found
dchill4277ee3fd2012-07-24 11:50:01 -0400185 return ( ! isset($this->userdata[$item])) ? NULL : $this->userdata[$item];
Darren Hillc4e266b2011-08-30 15:40:27 -0400186 }
187
188 /**
189 * Fetch all session data
190 *
191 * @return array User data array
192 */
193 public function all_userdata()
194 {
195 // Return entire array
dchill4277ee3fd2012-07-24 11:50:01 -0400196 return ( ! isset($this->userdata)) ? NULL : $this->userdata;
Darren Hillc4e266b2011-08-30 15:40:27 -0400197 }
198
199 /**
dchill42c5079de2012-07-23 10:53:47 -0400200 * Fetch all flashdata
201 *
202 * @return array Flash data array
203 */
204 public function all_flashdata()
205 {
206 $out = array();
207
208 // loop through all userdata
209 foreach ($this->all_userdata() as $key => $val)
210 {
dchill42c5872252012-07-30 14:53:11 -0400211 // if it contains flashdata, add it
dchill42c5079de2012-07-23 10:53:47 -0400212 if (strpos($key, self::FLASHDATA_KEY.self::FLASHDATA_OLD) !== FALSE)
213 {
214 $out[$key] = $val;
215 }
216 }
217 return $out;
218 }
219
220 /**
Darren Hillc4e266b2011-08-30 15:40:27 -0400221 * Add or change data in the "userdata" array
222 *
Darren Hill5073a372011-08-31 13:54:19 -0400223 * @param mixed Item name or array of items
224 * @param string Item value or empty string
225 * @return void
Darren Hillc4e266b2011-08-30 15:40:27 -0400226 */
227 public function set_userdata($newdata = array(), $newval = '')
228 {
229 // Wrap params as array if singular
230 if (is_string($newdata))
231 {
232 $newdata = array($newdata => $newval);
233 }
234
235 // Set each name/value pair
236 if (count($newdata) > 0)
237 {
238 foreach ($newdata as $key => $val)
239 {
240 $this->userdata[$key] = $val;
241 }
242 }
243
244 // Tell driver data changed
245 $this->current->sess_save();
246 }
247
248 /**
249 * Delete a session variable from the "userdata" array
250 *
Darren Hill5073a372011-08-31 13:54:19 -0400251 * @param mixed Item name or array of item names
252 * @return void
Darren Hillc4e266b2011-08-30 15:40:27 -0400253 */
254 public function unset_userdata($newdata = array())
255 {
256 // Wrap single name as array
257 if (is_string($newdata))
258 {
259 $newdata = array($newdata => '');
260 }
261
262 // Unset each item name
263 if (count($newdata) > 0)
264 {
265 foreach ($newdata as $key => $val)
266 {
267 unset($this->userdata[$key]);
268 }
269 }
270
271 // Tell driver data changed
272 $this->current->sess_save();
273 }
274
275 /**
276 * Determine if an item exists
277 *
Darren Hill5073a372011-08-31 13:54:19 -0400278 * @param string Item name
279 * @return boolean
Darren Hillc4e266b2011-08-30 15:40:27 -0400280 */
281 public function has_userdata($item)
282 {
283 // Check for item name
284 return isset($this->userdata[$item]);
285 }
286
287 /**
288 * Add or change flashdata, only available until the next request
289 *
Darren Hill5073a372011-08-31 13:54:19 -0400290 * @param mixed Item name or array of items
291 * @param string Item value or empty string
292 * @return void
Darren Hillc4e266b2011-08-30 15:40:27 -0400293 */
294 public function set_flashdata($newdata = array(), $newval = '')
295 {
296 // Wrap item as array if singular
297 if (is_string($newdata))
298 {
299 $newdata = array($newdata => $newval);
300 }
301
302 // Prepend each key name and set value
303 if (count($newdata) > 0)
304 {
305 foreach ($newdata as $key => $val)
306 {
307 $flashdata_key = self::FLASHDATA_KEY.self::FLASHDATA_NEW.$key;
308 $this->set_userdata($flashdata_key, $val);
309 }
310 }
311 }
312
313 /**
314 * Keeps existing flashdata available to next request.
315 *
Darren Hill5073a372011-08-31 13:54:19 -0400316 * @param string Item key
317 * @return void
Darren Hillc4e266b2011-08-30 15:40:27 -0400318 */
319 public function keep_flashdata($key)
320 {
dchill42c5079de2012-07-23 10:53:47 -0400321 // 'old' flashdata gets removed. Here we mark all flashdata as 'new' to preserve it from _flashdata_sweep()
322 // Note the function will return NULL if the $key provided cannot be found
Darren Hillc4e266b2011-08-30 15:40:27 -0400323 $old_flashdata_key = self::FLASHDATA_KEY.self::FLASHDATA_OLD.$key;
324 $value = $this->userdata($old_flashdata_key);
325
326 $new_flashdata_key = self::FLASHDATA_KEY.self::FLASHDATA_NEW.$key;
327 $this->set_userdata($new_flashdata_key, $value);
328 }
329
330 /**
331 * Fetch a specific flashdata item from the session array
332 *
Darren Hill5073a372011-08-31 13:54:19 -0400333 * @param string Item key
334 * @return string
Darren Hillc4e266b2011-08-30 15:40:27 -0400335 */
336 public function flashdata($key)
337 {
338 // Prepend key and retrieve value
339 $flashdata_key = self::FLASHDATA_KEY.self::FLASHDATA_OLD.$key;
340 return $this->userdata($flashdata_key);
341 }
342
343 /**
344 * Add or change tempdata, only available
345 * until expiration
346 *
Darren Hill5073a372011-08-31 13:54:19 -0400347 * @param mixed Item name or array of items
348 * @param string Item value or empty string
349 * @param int Item lifetime in seconds or 0 for default
350 * @return void
Darren Hillc4e266b2011-08-30 15:40:27 -0400351 */
352 public function set_tempdata($newdata = array(), $newval = '', $expire = 0)
353 {
354 // Set expiration time
355 $expire = time() + ($expire ? $expire : self::TEMP_EXP_DEF);
356
357 // Wrap item as array if singular
358 if (is_string($newdata))
359 {
360 $newdata = array($newdata => $newval);
361 }
362
363 // Get or create expiration list
364 $expirations = $this->userdata(self::EXPIRATION_KEY);
dchill4277ee3fd2012-07-24 11:50:01 -0400365 if ( ! $expirations)
Darren Hillc4e266b2011-08-30 15:40:27 -0400366 {
367 $expirations = array();
368 }
369
370 // Prepend each key name and set value
371 if (count($newdata) > 0)
372 {
373 foreach ($newdata as $key => $val)
374 {
375 $tempdata_key = self::FLASHDATA_KEY.self::FLASHDATA_EXP.$key;
376 $expirations[$tempdata_key] = $expire;
377 $this->set_userdata($tempdata_key, $val);
378 }
379 }
380
381 // Update expiration list
382 $this->set_userdata(self::EXPIRATION_KEY, $expirations);
383 }
384
385 /**
386 * Delete a temporary session variable from the "userdata" array
387 *
Darren Hill5073a372011-08-31 13:54:19 -0400388 * @param mixed Item name or array of item names
389 * @return void
Darren Hillc4e266b2011-08-30 15:40:27 -0400390 */
391 public function unset_tempdata($newdata = array())
392 {
393 // Get expirations list
394 $expirations = $this->userdata(self::EXPIRATION_KEY);
dchill4277ee3fd2012-07-24 11:50:01 -0400395 if ( ! $expirations || ! count($expirations))
Darren Hillc4e266b2011-08-30 15:40:27 -0400396 {
397 // Nothing to do
398 return;
399 }
400
401 // Wrap single name as array
402 if (is_string($newdata))
403 {
404 $newdata = array($newdata => '');
405 }
406
407 // Prepend each item name and unset
408 if (count($newdata) > 0)
409 {
410 foreach ($newdata as $key => $val)
411 {
412 $tempdata_key = self::FLASHDATA_KEY.self::FLASHDATA_EXP.$key;
413 unset($expirations[$tempdata_key]);
414 $this->unset_userdata($tempdata_key);
415 }
416 }
417
418 // Update expiration list
419 $this->set_userdata(self::EXPIRATION_KEY, $expirations);
420 }
421
422 /**
423 * Fetch a specific tempdata item from the session array
424 *
Darren Hill5073a372011-08-31 13:54:19 -0400425 * @param string Item key
426 * @return string
Darren Hillc4e266b2011-08-30 15:40:27 -0400427 */
428 public function tempdata($key)
429 {
430 // Prepend key and return value
431 $tempdata_key = self::FLASHDATA_KEY.self::FLASHDATA_EXP.$key;
432 return $this->userdata($tempdata_key);
433 }
434
435 /**
436 * Identifies flashdata as 'old' for removal
437 * when _flashdata_sweep() runs.
438 *
Darren Hilla2ae6572011-09-01 07:36:26 -0400439 * @access protected
Darren Hillc4e266b2011-08-30 15:40:27 -0400440 * @return void
441 */
Darren Hilla2ae6572011-09-01 07:36:26 -0400442 protected function _flashdata_mark()
Darren Hillc4e266b2011-08-30 15:40:27 -0400443 {
444 $userdata = $this->all_userdata();
445 foreach ($userdata as $name => $value)
446 {
447 $parts = explode(self::FLASHDATA_NEW, $name);
448 if (is_array($parts) && count($parts) === 2)
449 {
450 $new_name = self::FLASHDATA_KEY.self::FLASHDATA_OLD.$parts[1];
451 $this->set_userdata($new_name, $value);
452 $this->unset_userdata($name);
453 }
454 }
455 }
456
457 /**
458 * Removes all flashdata marked as 'old'
459 *
Darren Hilla2ae6572011-09-01 07:36:26 -0400460 * @access protected
Darren Hillc4e266b2011-08-30 15:40:27 -0400461 * @return void
462 */
Darren Hilla2ae6572011-09-01 07:36:26 -0400463 protected function _flashdata_sweep()
Darren Hillc4e266b2011-08-30 15:40:27 -0400464 {
465 $userdata = $this->all_userdata();
466 foreach ($userdata as $key => $value)
467 {
468 if (strpos($key, self::FLASHDATA_OLD))
469 {
470 $this->unset_userdata($key);
471 }
472 }
473 }
474
475 /**
476 * Removes all expired tempdata
477 *
Darren Hilla2ae6572011-09-01 07:36:26 -0400478 * @access protected
Darren Hillc4e266b2011-08-30 15:40:27 -0400479 * @return void
480 */
Darren Hilla2ae6572011-09-01 07:36:26 -0400481 protected function _tempdata_sweep()
Darren Hillc4e266b2011-08-30 15:40:27 -0400482 {
483 // Get expirations list
484 $expirations = $this->userdata(self::EXPIRATION_KEY);
dchill4277ee3fd2012-07-24 11:50:01 -0400485 if ( ! $expirations || ! count($expirations))
Darren Hillc4e266b2011-08-30 15:40:27 -0400486 {
487 // Nothing to do
488 return;
489 }
490
491 // Unset expired elements
492 $now = time();
493 $userdata = $this->all_userdata();
494 foreach ($userdata as $key => $value)
495 {
496 if (strpos($key, self::FLASHDATA_EXP) && $expirations[$key] < $now)
497 {
498 unset($expirations[$key]);
499 $this->unset_userdata($key);
500 }
501 }
502
503 // Update expiration list
504 $this->set_userdata(self::EXPIRATION_KEY, $expirations);
505 }
506}
Darren Hill5073a372011-08-31 13:54:19 -0400507// END CI_Session Class
Darren Hillc4e266b2011-08-30 15:40:27 -0400508
509
510/**
Darren Hill5073a372011-08-31 13:54:19 -0400511 * CI_Session_driver Class
Darren Hillc4e266b2011-08-30 15:40:27 -0400512 *
Darren Hill5073a372011-08-31 13:54:19 -0400513 * Extend this class to make a new CI_Session driver.
514 * A CI_Session driver basically manages an array of name/value pairs with some sort of storage mechanism.
515 * To make a new driver, derive from (extend) CI_Session_driver. Overload the initialize method and read or create
Darren Hillc4e266b2011-08-30 15:40:27 -0400516 * session data. Then implement a save handler to write changed data to storage (sess_save), a destroy handler
517 * to remove deleted data (sess_destroy), and an access handler to expose the data (get_userdata).
Darren Hill5073a372011-08-31 13:54:19 -0400518 * Put your driver in the libraries/Session/drivers folder anywhere in the loader paths. This includes the
519 * application directory, the system directory, or any path you add with $CI->load->add_package_path().
520 * Your driver must be named CI_Session_<name>, and your filename must be Session_<name>.php,
521 * preferably also capitalized. (e.g.: CI_Session_foo in libraries/Session/drivers/Session_foo.php)
522 * Then specify the driver by setting 'sess_driver' in your config file or as a parameter when loading the CI_Session
Darren Hillc4e266b2011-08-30 15:40:27 -0400523 * object. (e.g.: $config['sess_driver'] = 'foo'; OR $CI->load->driver('session', array('sess_driver' => 'foo')); )
524 * Already provided are the Native driver, which manages the native PHP $_SESSION array, and
525 * the Cookie driver, which manages the data in a browser cookie, with optional extra storage in a database table.
526 *
Darren Hill5073a372011-08-31 13:54:19 -0400527 * @package CodeIgniter
528 * @subpackage Libraries
Darren Hillc4e266b2011-08-30 15:40:27 -0400529 * @category Sessions
Darren Hill5073a372011-08-31 13:54:19 -0400530 * @author ExpressionEngine Dev Team
Darren Hillc4e266b2011-08-30 15:40:27 -0400531 */
Darren Hill5073a372011-08-31 13:54:19 -0400532abstract class CI_Session_driver extends CI_Driver {
Darren Hillc4e266b2011-08-30 15:40:27 -0400533 /**
534 * Decorate
535 *
536 * Decorates the child with the parent driver lib's methods and properties
537 *
538 * @param object Parent library object
539 * @return void
540 */
541 public function decorate($parent)
542 {
543 // Call base class decorate first
544 parent::decorate($parent);
545
dchill42c5872252012-07-30 14:53:11 -0400546 // Call initialize method now that driver has access to $this->_parent
Darren Hillc4e266b2011-08-30 15:40:27 -0400547 $this->initialize();
548 }
549
550 /**
551 * __call magic method
552 *
553 * Handles access to the parent driver library's methods
554 *
Darren Hill5073a372011-08-31 13:54:19 -0400555 * @param string Library method name
556 * @param array Method arguments (default: none)
Darren Hillc4e266b2011-08-30 15:40:27 -0400557 * @return mixed
558 */
559 public function __call($method, $args = array())
560 {
561 // Make sure the parent library uses this driver
dchill42c5872252012-07-30 14:53:11 -0400562 $this->_parent->select_driver(get_class($this));
Darren Hillc4e266b2011-08-30 15:40:27 -0400563 return parent::__call($method, $args);
564 }
565
566 /**
567 * Initialize driver
568 *
Darren Hill5073a372011-08-31 13:54:19 -0400569 * @return void
Darren Hillc4e266b2011-08-30 15:40:27 -0400570 */
571 protected function initialize()
572 {
573 // Overload this method to implement initialization
574 }
575
576 /**
577 * Save the session data
578 *
579 * Data in the array has changed - perform any storage synchronization necessary
580 * The child class MUST implement this abstract method!
581 *
Darren Hill5073a372011-08-31 13:54:19 -0400582 * @return void
Darren Hillc4e266b2011-08-30 15:40:27 -0400583 */
584 abstract public function sess_save();
585
586 /**
587 * Destroy the current session
588 *
589 * Clean up storage for this session - it has been terminated
590 * The child class MUST implement this abstract method!
591 *
Darren Hill5073a372011-08-31 13:54:19 -0400592 * @return void
Darren Hillc4e266b2011-08-30 15:40:27 -0400593 */
594 abstract public function sess_destroy();
595
596 /**
597 * Regenerate the current session
598 *
599 * Regenerate the session id
600 * The child class MUST implement this abstract method!
601 *
Darren Hill5073a372011-08-31 13:54:19 -0400602 * @param boolean Destroy session data flag (default: false)
603 * @return void
Darren Hillc4e266b2011-08-30 15:40:27 -0400604 */
605 abstract public function sess_regenerate($destroy = false);
606
607 /**
608 * Get a reference to user data array
609 *
Darren Hill5073a372011-08-31 13:54:19 -0400610 * Give array access to the main CI_Session object
Darren Hillc4e266b2011-08-30 15:40:27 -0400611 * The child class MUST implement this abstract method!
612 *
Darren Hill5073a372011-08-31 13:54:19 -0400613 * @return array Reference to userdata
Darren Hillc4e266b2011-08-30 15:40:27 -0400614 */
615 abstract public function &get_userdata();
616}
Darren Hill5073a372011-08-31 13:54:19 -0400617// END CI_Session_driver Class
Darren Hillc4e266b2011-08-30 15:40:27 -0400618
619
620/* End of file Session.php */
621/* Location: ./system/libraries/Session/Session.php */
622?>