Fixed silly bug that made getAvatar() return also pending avatars.
Moved some more sql queries to handlers, and fixed a sql error.
Added isMember() function that returns true if the current user is a crew member. Similar to the isAuthenticated() except that this could return false even if isAuthenticated() is true.