Add check for Magic Quotes

This should prevent #2977