Revize 1288
Přidáno uživatelem Ondřej Fibich před téměř 13 roky(ů)
freenetis/branches/testing/application/models/iface.php | ||
---|---|---|
*/
|
||
public function get_type ($type = NULL)
|
||
{
|
||
if (!$type)
|
||
if (empty($type) && $this->id)
|
||
$type = $this->type;
|
||
|
||
if (array_key_exists($type, self::$types))
|
||
if (!empty($type) && array_key_exists($type, self::$types))
|
||
return __(self::$types[$type]);
|
||
else
|
||
return NULL;
|
||
... | ... | |
*/
|
||
public function get_types ()
|
||
{
|
||
$types = array();
|
||
|
||
foreach (self::$types as $key => $value)
|
||
$types[$key] = __($value);
|
||
|
||
return $types;
|
||
return array_map('__', self::$types);
|
||
}
|
||
|
||
/**
|
||
... | ... | |
*/
|
||
public function get_default_name ($type = NULL)
|
||
{
|
||
if (!$type)
|
||
if (empty($type) && $this->id)
|
||
$type = $this->type;
|
||
|
||
if (array_key_exists($type, self::$default_names))
|
||
if (!empty($type) && array_key_exists($type, self::$default_names))
|
||
return self::$default_names[$type];
|
||
else
|
||
return NULL;
|
freenetis/branches/testing/application/controllers/json.php | ||
---|---|---|
}
|
||
|
||
$path = $paths[$this->session->get('last_path_id')];
|
||
if ($path[count($path) - 1] == $url)
|
||
|
||
if (count($path) && ($path[count($path) - 1] == $url))
|
||
{
|
||
$paths[] = $path;
|
||
unset($paths[$this->session->get('last_path_id')][count($path) - 1]);
|
||
... | ... | |
{
|
||
foreach ($paths as $id => $path)
|
||
{
|
||
if ($path[count($path) - 1] == $url)
|
||
if (count($path) && ($path[count($path) - 1] == $url))
|
||
{
|
||
$paths[] = $path;
|
||
unset($paths[$id][count($path) - 1]);
|
freenetis/branches/testing/system/core/Kohana.php | ||
---|---|---|
{
|
||
if (($error_pushed = error_get_last()))
|
||
{
|
||
// send error headers
|
||
// get current content of page
|
||
$buffer = ob_get_contents();
|
||
// clean content
|
||
ob_clean();
|
||
// send error header required for unit tester
|
||
header('HTTP/1.1 500 Internal Server Error');
|
||
// enable content
|
||
ob_start();
|
||
|
||
// prepare vars for view
|
||
... | ... | |
$message = $error_pushed['message'];
|
||
|
||
// log error
|
||
Log::add('error', trim(strip_tags(nl2br($buffer))));
|
||
Log::add('error', 'PHP fatal error: ' . trim(strip_tags(nl2br($buffer))));
|
||
Log::write();
|
||
|
||
// load the error view
|
freenetis/branches/testing/system/libraries/Session.php | ||
---|---|---|
class Session
|
||
{
|
||
|
||
// Session singleton
|
||
/**
|
||
* Session singleton
|
||
*
|
||
* @var Session
|
||
*/
|
||
private static $instance;
|
||
// Protected key names (cannot be set by the user)
|
||
protected static $protect = array('session_id', 'user_agent', 'last_activity', 'ip_address', 'total_hits', '_kf_flash_');
|
||
// Configuration and driver
|
||
|
||
/**
|
||
* Protected key names (cannot be set by the user)
|
||
*
|
||
* @var array
|
||
*/
|
||
protected static $protect = array
|
||
(
|
||
'session_id', 'user_agent', 'last_activity',
|
||
'ip_address', 'total_hits', '_kf_flash_'
|
||
);
|
||
|
||
/**
|
||
* Configuration
|
||
*
|
||
* @var array
|
||
*/
|
||
protected static $config;
|
||
|
||
/**
|
||
* Instance of driver
|
||
*
|
||
* @var Session_Driver
|
||
*/
|
||
protected static $driver;
|
||
|
||
/**
|
||
* Driver name
|
||
*
|
||
* @var string
|
||
*/
|
||
protected static $driver_name = 'cookie';
|
||
|
||
/**
|
||
* Session name
|
||
*
|
||
* @var string
|
||
*/
|
||
protected static $name = 'freenetissession';
|
||
|
||
/**
|
||
* Validate
|
||
*
|
||
* @var mixed
|
||
*/
|
||
protected static $validate = array('user_agent');
|
||
// Flash variables
|
||
|
||
/**
|
||
* Flash messages
|
||
*
|
||
* @var mixed
|
||
*/
|
||
protected static $flash;
|
||
// Input library
|
||
|
||
/**
|
||
* Input library
|
||
*
|
||
* @var Input
|
||
*/
|
||
protected $input;
|
||
|
||
/**
|
||
... | ... | |
// Note: the httponly parameter was added in PHP 5.2.0
|
||
if (version_compare(PHP_VERSION, '5.2', '>='))
|
||
{
|
||
session_set_cookie_params
|
||
(
|
||
session_set_cookie_params(
|
||
Config::get('session_expiration'),
|
||
//Config::get('cookie.path'),
|
||
'/', Config::get('cookie.domain'), Config::get('cookie.secure'), Config::get('cookie.httponly')
|
||
'/', Config::get('cookie.domain'),
|
||
Config::get('cookie.secure'),
|
||
Config::get('cookie.httponly')
|
||
);
|
||
}
|
||
else
|
||
{
|
||
session_set_cookie_params
|
||
(
|
||
session_set_cookie_params(
|
||
Config::get('session_expiration'),
|
||
//Config::get('cookie.path'),
|
||
'/', Config::get('cookie.domain'), Config::get('cookie.secure')
|
||
'/', Config::get('cookie.domain'),
|
||
Config::get('cookie.secure')
|
||
);
|
||
}
|
||
|
||
// Register non-native driver as the session handler
|
||
if (self::$driver_name != 'native')
|
||
{
|
||
session_set_save_handler
|
||
(
|
||
array(self::$driver, 'open'), array(self::$driver, 'close'), array(self::$driver, 'read'), array(self::$driver, 'write'), array(self::$driver, 'destroy'), array(self::$driver, 'gc')
|
||
session_set_save_handler(
|
||
array(self::$driver, 'open'),
|
||
array(self::$driver, 'close'),
|
||
array(self::$driver, 'read'),
|
||
array(self::$driver, 'write'),
|
||
array(self::$driver, 'destroy'),
|
||
array(self::$driver, 'gc')
|
||
);
|
||
}
|
||
|
freenetis/branches/testing/system/libraries/drivers/Session/Cookie.php | ||
---|---|---|
* @copyright (c) 2007-2008 Kohana Team
|
||
* @license http://kohanaphp.com/license.html
|
||
*/
|
||
class Session_Cookie_Driver implements Session_Driver {
|
||
class Session_Cookie_Driver implements Session_Driver
|
||
{
|
||
|
||
protected $cookie_name;
|
||
protected $encrypt; // Library
|
||
|
||
public function __construct()
|
||
{
|
||
if (Config::get('session_name')!='')
|
||
$this->cookie_name = Config::get('session_name').'_data';
|
||
else
|
||
$this->cookie_name = 'freenetissession_data';
|
||
if (Config::get('session_name') != '')
|
||
{
|
||
$this->cookie_name = Config::get('session_name') . '_data';
|
||
}
|
||
else
|
||
{
|
||
$this->cookie_name = 'freenetissession_data';
|
||
}
|
||
|
||
if (Config::get('session_encryption'))
|
||
{
|
||
... | ... | |
|
||
public function write($id, $data)
|
||
{
|
||
$old_data = $data;
|
||
$data = (Config::get('session_encryption')) ? $this->encrypt->encode($data) : base64_encode($data);
|
||
|
||
if (strlen($data) > 4048)
|
||
{
|
||
Log::add('error', 'Session data exceeds the 4kB limit, ignoring write.');
|
||
Log::add('error', 'Session data exceeds the 4kB limit, ignoring write, data: [' . $id . ']' . $old_data);
|
||
return FALSE;
|
||
}
|
||
|
||
return cookie::set($this->cookie_name, $data, Config::get('session_expiration'),'/');
|
||
return cookie::set($this->cookie_name, $data, Config::get('session_expiration'), '/');
|
||
}
|
||
|
||
public function destroy($id)
|
||
{
|
||
unset($_COOKIE[$this->cookie_name]);
|
||
|
||
return cookie::delete($this->cookie_name,'/');
|
||
return cookie::delete($this->cookie_name, '/');
|
||
}
|
||
|
||
public function regenerate()
|
Také k dispozici: Unified diff
Opravy (chyb detekovanych logy):
- json: kotrola existence indexu pole v update_path metode
- opravy argumentu array_key_exists v modelu iface
- vlozeni kodu pro detekci chyby pri preteceni bufferu sessions