Refactor code duplication

Signed-off-by: Marc Delisle <marc@infomarc.info>
Merge branch 'master' of https://github.com/phpmyadmin/phpmyadmin