Fixes some bugs and makes some general improvements

Big commit; I apologise. It contains:

1. Fixes doctype
2. Adds (simple) ability to run YM locally (via config)
3. Refactors the Dashboard JS into it's own file (i.e. no more nasty embedded in HTML)
4. Adds start-up test to ensure that the database connection is okay (otherwise it emerges as a 'weird' error via the authentication code)