Removed useless code
Fix #10853: Sort by Category name instead of category_id

Modified filter_get_query_sort_data to add a left join on the category
table and sort on the name column, when the sort key is category_id
Issue #10853: allow sorting for other foreign-key fields

Code now handles category_id, project_id, handler_id and reporter_id

However, sorting by user on a single database field is not perfect due to
user information shown changing at display time (user_get_name function)
particularly when show_realname = ON
Issue #10853: improve sorting of username fields

This involves a complex SQL statement using CASE, COALESCE and CONCAT
functions, which is required to have (at least semi-) proper sorting of
username fields.

The sort key is defined as follows: realname (if $g_show_realname is
defined) if not null, username if not null, and finally
$g_prefix_for_deleted_users + user id (basically replicating the logic
of user_get_name() function).

The foreign key map is now a static variable.