[geeklog-cvs] geeklog: Use the newer "pretty" gravatar.com URLs (feature reque...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Sun Mar 11 13:31:31 EDT 2012


changeset 8522:b53f10bfc679
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/b53f10bfc679
user: Dirk Haun <dirk at haun-online.de>
date: Sun Mar 11 18:31:24 2012 +0100
description:
Use the newer "pretty" gravatar.com URLs (feature request #0001435)

diffstat:

 system/lib-user.php |  20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)

diffs (35 lines):

diff -r a7e99d1b00a1 -r b53f10bfc679 system/lib-user.php
--- a/system/lib-user.php	Sun Mar 11 13:44:34 2012 +0100
+++ b/system/lib-user.php	Sun Mar 11 18:31:24 2012 +0100
@@ -423,20 +423,22 @@
         }
 
         $img = '';
-        if (empty ($photo) || ($photo == 'none')) {
+        if (empty($photo) || ($photo == 'none')) {
             // no photo - try gravatar.com, if allowed
             if ($_CONF['use_gravatar']) {
-                $img = 'http://www.gravatar.com/avatar.php?gravatar_id='
-                     . md5 ($email);
+                $img = 'http://www.gravatar.com/avatar/' . md5($email);
+                $parms = array();
                 if ($width > 0) {
-                    $img .= '&size=' . $width;
+                    $parms[] = 's=' . $width;
                 }
-                if (!empty ($_CONF['gravatar_rating'])) {
-                    $img .= '&rating=' . $_CONF['gravatar_rating'];
+                if (! empty($_CONF['gravatar_rating'])) {
+                    $parms[] = 'r=' . $_CONF['gravatar_rating'];
                 }
-                if (!empty ($_CONF['default_photo'])) {
-                    $img .= '&default='
-                         . urlencode ($_CONF['default_photo']);
+                if (! empty($_CONF['default_photo'])) {
+                    $parms[] = 'd=' . urlencode($_CONF['default_photo']);
+                }
+                if (count($parms) > 0) {
+                    $img .= '?' . implode('&', $parms);
                 }
             }
         } else {



More information about the geeklog-cvs mailing list