First step to fix 404's with a shared addressbook
Refactor code to make it simpler
Use join instead of 2 queries
Remove uneeded func
Fix double line
also search for shared contacts
Merge pull request #710 from owncloud/fix_404

Fix 404 contact not found with shared addressbook