Fix #1407, #1381, #1398

Fix #1407: Template Manager gives 500 Internal Server Error
Fix #1381: Gravatar plugin does not work
Fix #1398: The time counter for x weeks doesn't work