Remove usage of evil global variables by injecting custom objects

Mostly create a new settings object (assoc array atm) called settings
and pass it wherever needed.
Stop using $_SERVER in any class