Doctrine conversion for publisher

- Most functions moved to doctrine
- Fixes to system module and core for issues discovered while testing
- Some PSR-2 changes
- Move to .tpl template names
- Fix GPL links

More is needed, but this is a start