Kohana v3.3.0

This commit is contained in:
Deon George
2013-04-22 14:09:50 +10:00
commit f96694b18f
1280 changed files with 145034 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
<?php defined('SYSPATH') OR die('No direct script access.');
/**
* Cookie-based session class.
*
* @package Kohana
* @category Session
* @author Kohana Team
* @copyright (c) 2008-2012 Kohana Team
* @license http://kohanaframework.org/license
*/
class Kohana_Session_Cookie extends Session {
/**
* @param string $id session id
* @return string
*/
protected function _read($id = NULL)
{
return Cookie::get($this->_name, NULL);
}
/**
* @return null
*/
protected function _regenerate()
{
// Cookie sessions have no id
return NULL;
}
/**
* @return bool
*/
protected function _write()
{
return Cookie::set($this->_name, $this->__toString(), $this->_lifetime);
}
/**
* @return bool
*/
protected function _restart()
{
return TRUE;
}
/**
* @return bool
*/
protected function _destroy()
{
return Cookie::delete($this->_name);
}
} // End Session_Cookie

View File

@@ -0,0 +1,11 @@
<?php defined('SYSPATH') OR die('No direct script access.');
/**
* @package Kohana
* @category Exceptions
* @author Kohana Team
* @copyright (c) 2009-2012 Kohana Team
* @license http://kohanaframework.org/license
*/
class Kohana_Session_Exception extends Kohana_Exception {
const SESSION_CORRUPT = 1;
}

View File

@@ -0,0 +1,107 @@
<?php defined('SYSPATH') OR die('No direct script access.');
/**
* Native PHP session class.
*
* @package Kohana
* @category Session
* @author Kohana Team
* @copyright (c) 2008-2012 Kohana Team
* @license http://kohanaframework.org/license
*/
class Kohana_Session_Native extends Session {
/**
* @return string
*/
public function id()
{
return session_id();
}
/**
* @param string $id session id
* @return null
*/
protected function _read($id = NULL)
{
// Sync up the session cookie with Cookie parameters
session_set_cookie_params($this->_lifetime, Cookie::$path, Cookie::$domain, Cookie::$secure, Cookie::$httponly);
// Do not allow PHP to send Cache-Control headers
session_cache_limiter(FALSE);
// Set the session cookie name
session_name($this->_name);
if ($id)
{
// Set the session id
session_id($id);
}
// Start the session
session_start();
// Use the $_SESSION global for storing data
$this->_data =& $_SESSION;
return NULL;
}
/**
* @return string
*/
protected function _regenerate()
{
// Regenerate the session id
session_regenerate_id();
return session_id();
}
/**
* @return bool
*/
protected function _write()
{
// Write and close the session
session_write_close();
return TRUE;
}
/**
* @return bool
*/
protected function _restart()
{
// Fire up a new session
$status = session_start();
// Use the $_SESSION global for storing data
$this->_data =& $_SESSION;
return $status;
}
/**
* @return bool
*/
protected function _destroy()
{
// Destroy the current session
session_destroy();
// Did destruction work?
$status = ! session_id();
if ($status)
{
// Make sure the session cannot be restarted
Cookie::delete($this->_name);
}
return $status;
}
} // End Session_Native