Added safe() function

Added safe() function to allow modules to escape strings prior to sending them to the database.