diff -r 58852672ff12 -r 68f8a9cc0a18 plugins/SpecialUserPrefs.php
--- a/plugins/SpecialUserPrefs.php Wed Jul 09 21:04:51 2008 -0400
+++ b/plugins/SpecialUserPrefs.php Wed Jul 09 22:40:41 2008 -0400
@@ -896,6 +896,32 @@
echo '
' . $lang->get('usercp_avatar_move_failed') . '
';
}
break;
+ case 'set_gravatar':
+ // set avatar to use Gravatar
+ // make sure we're allowed to do this
+ if ( getConfig('avatar_upload_gravatar') != '1' )
+ {
+ // access denied
+ break;
+ }
+ // first, remove old image
+ if ( $has_avi )
+ {
+ // First switch the avatar off
+ $q = $db->sql_query('UPDATE ' . table_prefix . 'users SET user_has_avatar = 0 WHERE user_id = ' . $session->user_id . ';');
+ if ( !$q )
+ $db->_die('Avatar CP switching user avatar off');
+
+ @unlink($avi_path);
+ }
+ // set to gravatar mode
+ $q = $db->sql_query('UPDATE ' . table_prefix . 'users SET user_has_avatar = 1, avatar_type = \'grv\' WHERE user_id = ' . $session->user_id . ';');
+ if ( !$q )
+ $db->_die('Avatar CP switching user avatar off');
+
+ $has_avi = 1;
+ echo '' . $lang->get('usercp_avatar_gravatar_success') . '
';
+ break;
}
}
@@ -910,14 +936,22 @@
case 'remove':
$('avatar_upload_http').object.style.display = 'none';
$('avatar_upload_file').object.style.display = 'none';
+ $('avatar_upload_gravatar').object.style.display = 'none';
break;
case 'set_http':
$('avatar_upload_http').object.style.display = 'block';
$('avatar_upload_file').object.style.display = 'none';
+ $('avatar_upload_gravatar').object.style.display = 'none';
break;
case 'set_file':
$('avatar_upload_http').object.style.display = 'none';
$('avatar_upload_file').object.style.display = 'block';
+ $('avatar_upload_gravatar').object.style.display = 'none';
+ break;
+ case 'set_gravatar':
+ $('avatar_upload_gravatar').object.style.display = 'block';
+ $('avatar_upload_http').object.style.display = 'none';
+ $('avatar_upload_file').object.style.display = 'none';
break;
}
}
@@ -942,7 +976,7 @@
if ( $has_avi == 1 )
{
- echo '';
+ echo '';
}
else
{
@@ -973,7 +1007,7 @@
}
if ( getConfig('avatar_upload_file') == '1' )
{
- echo '
+ echo '
' . $lang->get('usercp_avatar_lbl_file') . '
' . $lang->get('usercp_avatar_lbl_file_desc') . ' ' . $lang->get('usercp_avatar_limits') . '
@@ -983,6 +1017,24 @@
{
echo '
';
}
+ if ( getConfig('avatar_upload_gravatar') == '1' )
+ {
+ $rating_images = array('g' => '0', 'pg' => '1', 'r' => '2', 'x' => '3');
+ $rating_id = $rating_images[ getConfig('gravatar_rating', 'g') ];
+ $rating_image = "http://s.gravatar.com/images/gravatars/ratings/$rating_id.gif";
+ $max_rating = getConfig('gravatar_rating', 'g');
+ echo '
(
' . $lang->get('usercp_avatar_link_gravatar_info') . ')
+
+
+
+
+ ' . $lang->get("usercp_avatar_gravatar_rating_$max_rating") . '
+
';
+ }
+ else
+ {
+ echo '
';
+ }
echo '
';