Fix gravatar and coding standard

1. Renamed gravitar to gravatar
2. Logic for gravatar (should be in missing gravitar.php) added to
addphoto.php
3. Support for https in gravatar
4. Refactored JS file to have same callback for all ajaax requests
5. Fixed CS in php files