Add escapeSimple method to rcube_db() object, to be used instead of quote() which will not allways work in virtuser query, for example when using something like REGEXP '(^|,)%u(,|$)'
| | |
| | | |
| | | // try to resolve the e-mail address from the virtuser table |
| | | if (!empty($CONFIG['virtuser_query']) && |
| | | ($sql_result = $DB->query(preg_replace('/%u/', $DB->quote($user), $CONFIG['virtuser_query']))) && |
| | | ($sql_result = $DB->query(preg_replace('/%u/', $DB->escapeSimple($user), $CONFIG['virtuser_query']))) && |
| | | ($DB->num_rows()>0)) |
| | | { |
| | | while ($sql_arr = $DB->fetch_array($sql_result)) |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Escapes a string |
| | | * |
| | | * @param string The string to be escaped |
| | | * @return string The escaped string |
| | | * @access public |
| | | */ |
| | | function escapeSimple($str) |
| | | { |
| | | if (!$this->db_handle) |
| | | $this->db_connect('r'); |
| | | |
| | | return $this->db_handle->escapeSimple($str); |
| | | } |
| | | |
| | | |
| | | /* |
| | | * Return SQL function for current time and date |
| | | * |
| | |
| | | |
| | | } // end class rcube_db |
| | | |
| | | ?> |
| | | ?> |