Activity: when redirecting unauthenticated users away from a single activity permalink, make sure the value of the `redirect_to` parameter has been URL encoded.

Also improves the readability of this section of code by moving it out of the ternary operator.

See #5926

git-svn-id: https://buddypress.svn.wordpress.org/trunk@9062 cdf35c40-ae34-48e0-9cc9-0c9da1808c22