Misc. Forum + Chat Bugfixes

Fixes #960.
Fixes #961.
Fixes #959.
Fixes #968.
Fixes #969.

http://jenkins.buttonweavers.com:8080/job/buttonmen-AdmiralJota/164/

(I believe the one PMD warning is one that was introduced earlier, not anything new in this pull.)
In general, i'm not a big fan of doing stuff like this as "here" functions.  I prefer defining separate module-level functions so we can unit test them independently.  Individual cases of here functions aren't that big a deal, but i wanted to mention the general principle, and this is as good a place as any.