| verzia 1.23, 2002/03/18 23:24:37 |
verzia 1.24, 2002/03/19 23:20:39 |
|
|
| * - PHP support utils |
* - PHP support utils |
| * 18/03/2002 - PEAR compliant expected error catching and handling |
* 18/03/2002 - PEAR compliant expected error catching and handling |
| * - removed all errors and warnings in code (undefined keys |
* - removed all errors and warnings in code (undefined keys |
| * in arrays, bad eval() processing, etc) |
* in arrays, bad eval() processing, etc.) |
| |
* 19/03/2002 - use of PHP's substr() instead SQL's substring() |
| */ |
*/ |
| |
|
| |
define('WEB_LOG_VALUE_SUBSTR_LENGTH', 255); |
| |
define('WEB_LOG_SESSION_TIMEOUT_DEFAULT', 1800); |
| |
define('WEB_LOG_RAW_LOG_DEFAULT', 1); |
| |
|
| /* |
/* |
| * Ident library |
* Ident library |
| */ |
*/ |
| Riadok 67 class Web_Log { |
|
| Riadok 72 class Web_Log { |
|
| */ |
*/ |
| |
|
| var $_session_timeout; |
var $_session_timeout; |
| //var $_session_keys = array('remote_addr', 'http_user_agent', 'ident_username'); |
|
| var $_session_keys = array('remote_addr', 'http_user_agent'); |
var $_session_keys = array('remote_addr', 'http_user_agent'); |
| |
/* |
| |
var $_session_keys = array( |
| |
'remote_addr', |
| |
'http_user_agent', |
| |
'ident_username', |
| |
'ident_ostype'); |
| |
*/ |
| |
|
| /* Raw log variable |
/* Raw log variable |
| |
|
| Riadok 294 class Web_Log { |
|
| Riadok 305 class Web_Log { |
|
| { |
{ |
| |
|
| if (empty($session_timeout)) |
if (empty($session_timeout)) |
| $session_timeout = 1800; /* 30 mins. */ |
$session_timeout = WEB_LOG_SESSION_TIMEOUT_DEFAULT; |
| |
|
| $this->_session_timeout = $session_timeout; |
$this->_session_timeout = $session_timeout; |
| |
|
| Riadok 305 class Web_Log { |
|
| Riadok 316 class Web_Log { |
|
| unset($this->_cache_active_sessions); |
unset($this->_cache_active_sessions); |
| unset($this->_cache_raw_log_active_sessions); |
unset($this->_cache_raw_log_active_sessions); |
| |
|
| $this->_raw_log = 0; |
$this->_raw_log = WEB_LOG_RAW_LOG_DEFAULT; |
| |
|
| if (! empty($dsn)) { |
if (! empty($dsn)) { |
| $this->setDSN($dsn); |
$this->setDSN($dsn); |
| Riadok 656 class Web_Log { |
|
| Riadok 667 class Web_Log { |
|
| $sep = ($keys == '' ? '' : ', '); |
$sep = ($keys == '' ? '' : ', '); |
| $val = ''; |
$val = ''; |
| |
|
| |
/* commented code is not neccessary */ |
| if ($this->_raw_log) { |
if ($this->_raw_log) { |
| if (isset($this->_props[$prop_name]['value'])) { |
if (isset($this->_props[$prop_name]['value']) |
| |
&& ! empty($this->_props[$prop_name]['value'])) { |
| $val = addslashes($this->_props[$prop_name]['value']); |
$val = addslashes($this->_props[$prop_name]['value']); |
| if (! empty($this->_props[$prop_name]['table'])) |
if (! empty($this->_props[$prop_name]['table'])) |
| $val = "'$val'"; |
$val = "'" . addslashes(substr($val, 0, |
| |
WEB_LOG_VALUE_SUBSTR_LENGTH)) . "'"; |
| } |
} |
| else { |
else { |
| $val = 0; |
$val = 0; |
| } |
} |
| } |
} |
| else { |
else { |
| if (isset($this->_props[$prop_name]['id'])) { |
if (isset($this->_props[$prop_name]['id']) |
| |
&& ! empty($this->_props[$prop_name]['id'])) { |
| $val = $this->_props[$prop_name]['id']; |
$val = $this->_props[$prop_name]['id']; |
| } |
} |
| else { |
else { |
| Riadok 714 class Web_Log { |
|
| Riadok 729 class Web_Log { |
|
| |
|
| for ($i = 0; $i < 2; $i++) { |
for ($i = 0; $i < 2; $i++) { |
| $query = "select id from $table" |
$query = "select id from $table" |
| ." where value = substring('" .addslashes($value). "', 1, 255)" |
." where value = '" |
| ." limit 1"; // TODO: 'limit' is MySQL dependent, or no? |
. addslashes(substr($value, 0, WEB_LOG_VALUE_SUBSTR_LENGTH)) |
| |
."' limit 1"; // TODO: 'limit' is MySQL dependent, or no? |
| $id = $this->_db->getOne($query); |
$id = $this->_db->getOne($query); |
| |
|
| if (DB::isError($id)) |
if (DB::isError($id)) |
| Riadok 794 class Web_Log { |
|
| Riadok 810 class Web_Log { |
|
| $where .= ($where == '' ? "where " : " and "); |
$where .= ($where == '' ? "where " : " and "); |
| |
|
| $where .= $this->_props[$session_key]['column']; |
$where .= $this->_props[$session_key]['column']; |
| $where .= " = "; |
|
| $where .= $this->_raw_log |
$where .= $this->_raw_log |
| ? "substring('" |
? (isset($this->_props[$session_key]['value']) |
| . addslashes($this->_props[$session_key]['value']) |
? " = '" . addslashes(substr( |
| . "', 1, 255)" |
$this->_props[$session_key]['value'], |
| : "'" . $this->_props[$session_key]['id'] . "'"; |
0, WEB_LOG_VALUE_SUBSTR_LENGTH)) . "'" |
| |
: ' is NULL') |
| |
: (isset($this->_props[$session_key]['id']) |
| |
? " = '" . $this->_props[$session_key]['id'] . "'" |
| |
: ' is NULL'); |
| } |
} |
| } |
} |
| |
|