[ticket/11151] Function documentation

- Use `functions.php`
- Add function parameter and return documentation.
- Apply prefix `phpbb_`
- Better variable names

PHPBB3-11151