Fix escaping

This commit is contained in:
Laurent Destailleur 2023-03-20 21:38:56 +01:00
parent 0e6a3aa2be
commit f154e893d9

View File

@ -1872,20 +1872,18 @@ class Ticket extends CommonObject
{ {
$contacts = array(); $contacts = array();
// Generation requete recherche // Forge the search SQL
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."socpeople"; $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."socpeople";
$sql .= " WHERE entity IN (".getEntity('contact').")"; $sql .= " WHERE entity IN (".getEntity('contact').")";
if (!empty($socid)) { if (!empty($socid)) {
$sql .= " AND fk_soc='".$this->db->escape($socid)."'"; $sql .= " AND fk_soc = ".((int) $socid);
} }
if (!empty($email)) { if (!empty($email)) {
$sql .= " AND "; $sql .= " AND ";
if (!$case) { if (!$case) {
$sql .= "email LIKE '".$this->db->escape($email)."'"; $sql .= "email = '".$this->db->escape($email)."'";
} else { } else {
$sql .= "email LIKE BINARY '".$this->db->escape($email)."'"; $sql .= "email LIKE BINARY '".$this->db->escape($this->db->escapeforlike($email))."'";
} }
} }