WIP: [feature/session-storage] Turn some db access in session into storage calls

Some work I started some time last year, as a starting point for whoever works on this refactoring

http://tracker.phpbb.com/browse/PHPBB3-9733