Add AuthBackend.search_users() hook function

As discussed in review 5503, this adds an overrideable function that can be
used to replace the default user-search filter.

Testing Done:
All tests pass aside from a few VCS-dependent ones, which are skipped.

Reviewed at https://reviews.reviewboard.org/r/5635/
Fix unit tests to cope with extensions static media changes.

The changes to the location for extensions static media caused a huge number of
unit tests to break, due to the updates required checks. This change creates
both the current and legacy media directories as part of the test
initialization, and updates one test that checks the number of failing
updates checks to handle the fact that there are now two media directories that
get checked.

Testing done: Ran unit tests.

Reviewed at https://reviews.reviewboard.org/r/5658/
Make use of gravatars configurable.

When external internet access is blocked, using Review Board is annoying
because it tries to load gravatars, which can spin for a long time on every
page load, and show broken images. This change adds a setting for whether
gravatars should be used.

Testing done:
Looked at the page header, user infobox, and user page sidebar, and saw that
they all no longer contained broken images.

Fixes bug 3030.

Reviewed at https://reviews.reviewboard.org/r/5656/
Properly handle text attachment encodings for thumbnail generation.

Uploading a utf-16le encoded text file as an attachment would cause a
traceback, since it can't be coerced to unicode using the default encoding.
Since we have the mimetype, we can pull the encoding out of that, and decode
properly.

Testing done: Ran unit tests and tested uploading file through the web UI.

Fixes bug 3282.

Reviewed at https://reviews.reviewboard.org/r/5630/
Merge branch 'release-1.7.x' into release-2.0.x
Merge branch 'release-2.0.x'