Security fixes

* Security fixes (for forum, emails mainly)
* Reintroduced email script (though is disused and will be moved later)

Manually merged (due to issues with Yuk's end)
** May contain regressions - please watch out. **