[ticket/13238] Use an array and loop instead of repeating the block

PHPBB3-13238