$query=$this->db->query("SELECT * FROM ".TABLE_RETENTION_RULE." WHERE domain LIKE ? OR `from` LIKE ? OR subject LIKE ? ORDER BY domain, id",array('%'.$s.'%','%'.$s.'%','%'.$s.'%'));
}else{
$query=$this->db->query("SELECT * FROM ".TABLE_RETENTION_RULE." ORDER BY domain, id");
$query=$this->db->query("INSERT INTO ".TABLE_RETENTION_RULE." (`domain`,`from`,`to`,`subject`,`_size`,`size`,`attachment_name`,`attachment_type`,`_attachment_size`,`attachment_size`,`spam`,`days`) VALUES(?,?,?,?,?,?,?,?,?,?,?,?)",array($domain,$data['from'],$data['to'],$data['subject'],$data['_size'],$data['size'],$data['attachment_name'],$data['attachment_type'],$data['_attachment_size'],$data['attachment_size'],$data['spam'],$data['days']));
$query=$this->db->query("UPDATE ".VIEW_MESSAGES." SET retained = ? WHERE arrived > ? AND (todomain=? OR fromdomain=?)",array($retained,$start_ts,$data['domain'],$data['domain']));