[ticket/12487] Remove unused variables and global definition

PHPBB3-12487