missing stripslashed added to read, common array $maybe_slashes with fields that may contain slashes for read+write

This commit is contained in:
Ralf Becker 2001-07-18 23:54:43 +00:00
parent fed982b4a3
commit f05dc3d53d

View File

@ -19,7 +19,9 @@
var $grants; var $grants;
var $data = array( ); var $data = array( );
var $filters = array( ); var $filters = array( );
var $maybe_slashes = array (
'info_des'=>1,'info_subject'=>1,'info_from'=>1,'info_addr'=>1
);
function soinfolog( $info_id = 0) function soinfolog( $info_id = 0)
{ {
global $phpgw; global $phpgw;
@ -197,7 +199,12 @@
if ($info_id != $this->data['info_id']) // data yet read in if ($info_id != $this->data['info_id']) // data yet read in
{ {
$this->data = $this->db->Record; $this->data = $this->db->Record;
} reset($this->maybe_slashes);
while (list($key) = each($this->maybe_slashes))
{
$this->data[$key] = stripslashes($this->data[$key]);
}
}
return $this->data; return $this->data;
} }
@ -220,17 +227,18 @@
{ {
while (list($key,$val) = each($values)) while (list($key,$val) = each($values))
{ {
$this->data['info_'.$key] = $val; // update internal data if ($key != 'info_id')
switch ($key)
{ {
case 'info_id': $key = 'info_'.$key;
break;
case 'des': case 'subject': case 'from': case 'addr': $this->data[$key] = $val; // update internal data
if ($this->maybe_slashes[$key])
{
$val = addslashes($val); $val = addslashes($val);
default: }
if ($query) $query .= ','; if ($query) $query .= ',';
$query .= "info_$key='$val'"; $query .= "$key='$val'";
} }
} }
if ($values['info_id']) if ($values['info_id'])