×

Notice

The forum is in read only mode.
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Gravatar

Gravatar 12 years 9 months ago #1790

  • Ronildo Costa
  • Ronildo Costa's Avatar Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 40
  • Thank you received: 0
I'm trying to do an integration with gravatar ( www.gravatar.com ), I'm follow these rules ( en.gravatar.com/site/implement/url ), but something strange happen...

I'm doing this way, in comment.class.php:

+ou- line 2218
$gravatar	= $this->censorText(JOSC_utils::filter($this->_item['email']));

+ou- line 2302
$gravatar	= md5(strtolower($gravatar));
$html 		= str_replace('{gravatar}', $gravatar, $html);

In my index template I put:
{gravatar}

OK so far...
But look, the md5 for my e-mail: This email address is being protected from spambots. You need JavaScript enabled to view it. is?
df858cc39c1f1ee9b167748b6c377335

But if I use this in a file php without Joomla:
<?php
$codigo=md5("ronildo@joomla.com.br");
echo($codigo);
?>
The md5 for my e-mail is:
bb6b3d2b065f0adde62551ad6d2df164 - And this one is the correct.

Any idea?

Gravatar 12 years 9 months ago #1794

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Away
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
Why don't you make
echo $gravatar just before the md5 to see what for value you input there.
because:
echo md5(strtolower('This email address is being protected from spambots. You need JavaScript enabled to view it.')).'<br />';
echo md5("This email address is being protected from spambots. You need JavaScript enabled to view it.");

gives the same value. So you must be giving something different there.

Ops, why do you actually use JOSC_utils::filter($this->_item)?
This function replaces @ with @
here is what it does:
function filter($html, $downward = false)
	{
    /*
     * remind :
     * 	ISO 	= &#code;
     *  HTML 	= &name;
     */
    if ($downward) {
        $html = str_replace('&#64;', '@', $html);
        $html = str_replace('&#92;', '\\', $html);
        $html = str_replace('&#34;', '"', $html);
    } else {
        $html = str_replace('@', '&#64;', stripslashes($html));
        $html = str_replace('\\', '&#92;', $html);
        $html = str_replace('"', '&#34;', $html);
    }
    return $html;
	}

Just make trimm and strtolower and you should be ready.
Greetings!
Daniel

Gravatar 12 years 9 months ago #1795

  • Ronildo Costa
  • Ronildo Costa's Avatar Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 40
  • Thank you received: 0
Hello Daniel...
Thank you was the filter... I change this:
$gravatar    = $this->censorText(JOSC_utils::filter($this->_item['email']));
for this:
$gravatar    = ($this->_item['email']);

And its working... now!
I'm begin in PHP :D

Thank you....

Gravatar 12 years 9 months ago #1797

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Away
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
make it trim($this->item), because
' This email address is being protected from spambots. You need JavaScript enabled to view it.' and 'This email address is being protected from spambots. You need JavaScript enabled to view it.' will generate different md5.

Gravatar 12 years 9 months ago #1798

  • Ronildo Costa
  • Ronildo Costa's Avatar Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 40
  • Thank you received: 0
I tried did that, but dosent work... :(
I think its working now, if happen some problem I can fix... I think is better...
  • Page:
  • 1
Time to create page: 0.212 seconds