[3.2] [ticket/12612] Front-facing files should not contain functions

Either merge this into 3.2 or #2616 into 3.1

https://tracker.phpbb.com/browse/PHPBB3-12612