[WIP] [ticket/12068] Add template events on topiclist and posting_layout

See:
https://area51.phpbb.com/phpBB/viewtopic.php?f=111&t=44989
https://area51.phpbb.com/phpBB/viewtopic.php?f=111&t=44999

Ticket:
http://tracker.phpbb.com/browse/PHPBB3-12068

Some extra edits were done automatically by my editor to remove spacing at the end of lines. Since that's in accordance with the coding guidelines (iirc) it should be fine to go in this patch.