Implement IoC plus some refactoring

Database stuff is now handled by the new DBHandler class.
All classes are inheriting from it, hence contain a static instance of $db.

Signed-off-by: Simone <hello@simonewebdesign.it>