Switched all ugly link generation with hardcoded app.php references to phpbb_controller_helper::url() method calls, plus fixed a wrongly indented function I happened to spot.