if ( ! $synd && ($u->{'allow_contactshow'} eq "Y" ||
$u->{'allow_contactshow'} eq "F") && $remote_isfriend)
This will only allow friends to see someone's contact info, even if you've chosen to allow all to see them.
The correct order of the brackets should be :
if ( ! $synd && ($u->{'allow_contactshow'} eq "Y" ||
$u->{'allow_contactshow'} eq "F" && $remote_isfriend))