[ticket/12487] Update code

- Replace $user->lang[] calls with $user->lang()
- Remove unused global definitions
- Remove unused variables
- Update $user->img() calls