api: getuserstat

Hi,

This is some refactoring and making some interesting stats available thru the api.

It will require at least PHP 5.3 since I made use of namespaces, if this is non-negotiable I'll update the pq to not use namespaces.

Happy coding!