Audit of parameter sanitization in Groups and Core database classes

- Uses wp_parse_id_list() to sanitize parameters of integer arrays
- Implements a more consistent approach to LIKE clause sanitization

Props johnjamesjacoby

Introduces a number of unit tests for the Groups and Core database classes, to
accompany the security hardening.

See #4989

git-svn-id: https://buddypress.svn.wordpress.org/trunk@7015 cdf35c40-ae34-48e0-9cc9-0c9da1808c22