MantisBT

View Issue Details Jump to Notes ] Wiki ] Related Changesets ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0010850mantisbtfeaturepublic2009-08-19 04:122011-08-18 06:11
Reportersdurkin 
Assigned Tojreese 
PrioritylowSeveritytweakReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version1.2.0rc1 
Target Version1.2.5Fixed in Version1.2.5 
Summary0010850: Gravatar code wrong
DescriptionIn 1.2.0rc1, the code generated for Gravitars is ...

<img
  class="avatar"
  src="http://www.gravatar.com/avatar.php? [^]
    gravatar_id=63905e29cdedf189b53cd0efeb973ae1&
    default=http%3A%2F%2Fwww.mantisbt.org%2Fbugs%2Fimages%2Fno_avatar.png&
    size=80&
    rating=G"
  alt="User avatar"
  width="80"
  height="80"/>


This currently works, but as you can see from the gravatar spec ...
http://en.gravatar.com/site/implement/url [^]

it is incorrect. For better future-proofing, the code should be changed to something like ... (I hope my entered formatting is preserved).

<img
  class="avatar"
  src="http://www.gravatar.com/avatar/63905e29cdedf189b53cd0efeb973ae1.jpg? [^]
    default=http%3A%2F%2Fwww.mantisbt.org%2Fbugs%2Fimages%2Fno_avatar.png&
    size=80&
    rating=G"
  alt="User avatar"
  width="80"
  height="80"/>

Tagspatch
Attached Filespatch file icon gravatar_url_2011-05-04.patch [^] (989 bytes) 2011-04-05 04:49 [Show Content]

- Relationships

-  Notes
User avatar (0022762)
sdurkin (reporter)
2009-08-19 04:14

Also, it would be really good if administrators could turn on wavatar or monsterid defaults.

Eg:
http://www.gravatar.com/avatar/3b3be63a4c2a439b013787725dfce802?d=identicon [^]
http://www.gravatar.com/avatar/3b3be63a4c2a439b013787725dfce802?d=monsterid [^]
http://www.gravatar.com/avatar/3b3be63a4c2a439b013787725dfce802?d=wavatar [^]
http://www.gravatar.com/avatar/3b3be63a4c2a439b013787725dfce802?d=404 [^]
User avatar (0022763)
sdurkin (reporter)
2009-08-19 04:55

Forget the wavatar thing. I just noticed you can set:
  $g_default_avatar = "wavatar";
in file config_inc.php and this will enable Wavatars!
Nice one.
User avatar (0022764)
sdurkin (reporter)
2009-08-19 05:10

I can see that the code snippets from the developer resources on the Gravatar website support the 1.2.0rc1 implementation, but I think that these developer resources are out of date.

My suggested implementation in core/user_api.php would be ...

function user_get_avatar( $p_user_id, $p_size = 80 ) {
    $t_email = strtolower( user_get_email( $p_user_id ) );
    if( is_blank( $t_email ) ) {
        $t_result = false;
    } else {
        $t_default_image = config_get( 'default_avatar' );
        $t_size = $p_size;

        $t_use_ssl = false;
        if( isset( $_SERVER['HTTPS'] ) && ( strtolower( $_SERVER['HTTPS'] ) != 'off' ) ) {
            $t_use_ssl = true;
        }

        if( !$t_use_ssl ) {
            $t_gravatar_domain = 'http://www.gravatar.com/avatar/'; [^]
        } else {
            $t_gravatar_domain = 'https://secure.gravatar.com/avatar/'; [^]
        }

        $t_avatar_url = $t_gravatar_domain . md5( $t_email ) . '.jpg&default=' . urlencode( $t_default_image ) . '&size=' . $t_size . '&;rating=G';
        $t_result = array(
            $t_avatar_url,
            $t_size,
            $t_size,
        );
    }

    return $t_result;
}
User avatar (0022765)
sdurkin (reporter)
2009-08-19 05:15

oops - there should be a ? after .jpg, not an &
User avatar (0028524)
atrol (developer)
2011-04-04 16:07

dominik, you added a patch without any comments
Do we have to reopen the issue?
You changed &default to ?default
Should &size also be ?size and &rating be ?rating
User avatar (0028525)
dominik (reporter)
2011-04-05 02:52

Hi Atrol

Yes the issue should be reopened (I cannot do this I get an error "access denied")...

No the path is right, it's just the first & which should be an ? to mark the start of parameters...

Sorry for the missing clarifications...

Greetings Dominik
User avatar (0028526)
atrol (developer)
2011-04-05 03:58

Dominik, I am wondering because I found ?s (short form of size) and ?r (short form of rating) when looking at the link that David provided
http://en.gravatar.com/site/implement/images/ [^]
User avatar (0028527)
dominik (reporter)
2011-04-05 04:48

Hi Atrol

You're right - there are two things to consider:

a) the old patch did only fix the semantically wrong url:

without patch:
http://www.gravatar.com/avatar/6edf05ec8a5816f00d1730a76b247f59&default=blabla&size=80&rating=G [^]

with patch:
http://www.gravatar.com/avatar/6edf05ec8a5816f00d1730a76b247f59?default=blabla&size=80&rating=G [^]

b) the new patch contains also the new short params:

with new patch:
http://www.gravatar.com/avatar/6edf05ec8a5816f00d1730a76b247f59?d=blabla&s=80&r=G [^]
User avatar (0028528)
atrol (developer)
2011-04-05 06:04

Thanks Dominik, I removed the old patch.
User avatar (0028537)
jreese (administrator)
2011-04-05 14:21

Fix committed to 1.2.x and master branches.
User avatar (0028538)
atrol (developer)
2011-04-05 15:24

Reminder sent to: jreese

John, IMO your commit was not the right one.
There is still &size and &rating instead of ?size and ?rating
(or the short form ?s and ?r)

I think that Dominik's patch gravatar_url_2011-05-04.patch is OK.
At least should be if the documentation is correct
http://en.gravatar.com/site/implement/images/ [^]
User avatar (0028539)
jreese (administrator)
2011-04-05 16:40

Well, only the first & needed to be changed to a ?, and their documentation says that both the short and long forms are acceptable, at which point I would prefer to use the lang forms to be more explicit. The patch I committed is therefore basically comparable to what Dominik submitted.
User avatar (0028541)
atrol (developer)
2011-04-05 17:49

I agree to use the long form

Still confusing:
The example http://en.gravatar.com/site/implement/images/ [^] uses ? for all parameters, not only the first one
but http://de.gravatar.com/site/implement/images/php/ [^] uses ? and & mixed

I played with Firebug to test the size parameter.
& is working and ? is wrong.
So one part of the gravatar documentation is wrong and your patch is OK concerning ? and &

There is also another difference to the documentation
The allowed values for parameter rating are documented lower case. We use G (suitable for display on all websites with any audience type)
I tried G and g, both work.

So your patch is also OK concerning G and g

- Related Changesets
MantisBT: master 0cb72b7c
Timestamp: 2011-03-25 10:04:22
Author: dhx
Details ] Diff ]
Fix 0010850: Update Gravatar URL format to meet current standard

Gravatar's official URL syntax for loading an image is different to the
older mechanism MantisBT is still using. The official syntax is
available at:

http://en.gravatar.com/site/implement/images/ [^]
mod - core/user_api.php Diff ] File ]
MantisBT: master-1.2.x cd33b412
Timestamp: 2011-03-25 10:04:22
Author: dhx
Details ] Diff ]
Fix 0010850: Update Gravatar URL format to meet current standard

Gravatar's official URL syntax for loading an image is different to the
older mechanism MantisBT is still using. The official syntax is
available at:

http://en.gravatar.com/site/implement/images/ [^]
mod - core/user_api.php Diff ] File ]
MantisBT: master-1.2.x 162c0d27
Timestamp: 2011-04-05 18:13:28
Author: jreese
Details ] Diff ]
Fix 0010850: commit cd33b412 generates incorrect url
mod - core/user_api.php Diff ] File ]
MantisBT: master b01c7265
Timestamp: 2011-04-05 18:13:28
Author: jreese
Details ] Diff ]
Fix 0010850: commit cd33b412 generates incorrect url
mod - core/user_api.php Diff ] File ]

- Issue History
Date Modified Username Field Change
2009-08-19 04:12 sdurkin New Issue
2009-08-19 04:14 sdurkin Note Added: 0022762
2009-08-19 04:55 sdurkin Note Added: 0022763
2009-08-19 05:10 sdurkin Note Added: 0022764
2009-08-19 05:15 sdurkin Note Added: 0022765
2009-08-25 02:35 vboctor Tag Attached: patch
2009-08-25 02:36 vboctor Status new => acknowledged
2011-03-25 06:07 dhx Assigned To => dhx
2011-03-25 06:07 dhx Status acknowledged => assigned
2011-03-25 06:07 dhx Target Version => 1.2.5
2011-03-25 06:07 dhx Description Updated View Revisions
2011-03-25 06:14 dhx Status assigned => resolved
2011-03-25 06:14 dhx Fixed in Version => 1.2.5
2011-03-25 06:14 dhx Resolution open => fixed
2011-03-25 06:14 dhx Changeset attached => MantisBT master 0cb72b7c
2011-03-25 06:14 dhx Changeset attached => MantisBT master-1.2.x cd33b412
2011-04-04 11:17 dominik File Added: gravatar_url.patch
2011-04-04 16:07 atrol Note Added: 0028524
2011-04-05 02:52 dominik Note Added: 0028525
2011-04-05 03:58 atrol Note Added: 0028526
2011-04-05 03:58 atrol Status resolved => feedback
2011-04-05 03:58 atrol Resolution fixed => reopened
2011-04-05 04:48 dominik Note Added: 0028527
2011-04-05 04:49 dominik File Added: gravatar_url_2011-05-04.patch
2011-04-05 06:03 atrol Status feedback => assigned
2011-04-05 06:04 atrol Note Added: 0028528
2011-04-05 06:04 atrol File Deleted: gravatar_url.patch
2011-04-05 12:25 jreese Target Version 1.2.5 => 1.2.6
2011-04-05 14:14 jreese Changeset attached => MantisBT master-1.2.x 162c0d27
2011-04-05 14:15 jreese Changeset attached => MantisBT master b01c7265
2011-04-05 14:21 jreese Note Added: 0028537
2011-04-05 14:21 jreese Status assigned => resolved
2011-04-05 14:21 jreese Resolution reopened => fixed
2011-04-05 14:21 jreese Assigned To dhx => jreese
2011-04-05 14:23 jreese Status resolved => closed
2011-04-05 15:24 atrol Note Added: 0028538
2011-04-05 16:40 jreese Note Added: 0028539
2011-04-05 17:49 atrol Note Added: 0028541
2011-04-05 17:49 atrol Target Version 1.2.6 => 1.2.5
2011-04-05 17:50 atrol Summary Gravitar code wrong => Gravatar code wrong


MantisBT 1.2.16dev master-1.2.x-05091f5 [^]
Copyright © 2000 - 2013 MantisBT Team
Time: 0.0884 seconds.
memory usage: 2,923 KB
Powered by Mantis Bugtracker