Change parameter order of implode
Fix Scrutinizer errors
Fix various code errors detected by Scrutinizer

Fixed:
- An error with a misplaced bracket in lib/private/util.php
- An error with an incorrect function being called in lib/public/contacts.php