Commit 7e5b4698 authored by Francois Marier's avatar Francois Marier
Browse files

Add a site-wide setting to enable/disable Gravatar integration


Signed-off-by: default avatarFrancois Marier <francois@catalyst.net.nz>
parent e52eb3e1
......@@ -250,6 +250,13 @@ $siteoptionform = array(
'description' => get_string('userscanchooseviewthemesdescription', 'admin'),
'defaultvalue' => get_config('userscanchooseviewthemes'),
),
'remoteavatars' => array(
'type' => 'checkbox',
'title' => get_string('remoteavatars', 'admin'),
'description' => get_string('remoteavatarsdescription', 'admin'),
'defaultvalue' => get_config('remoteavatars'),
'help' => true,
),
)
);
......@@ -275,6 +282,7 @@ function siteoptions_submit(Pieform $form, $values) {
'registration_sendweeklyupdates', 'institutionexpirynotification', 'institutionautosuspend',
'captchaonregisterform', 'captchaoncontactform', 'showselfsearchsideblock', 'showtagssideblock',
'tagssideblockmaxtags', 'country', 'viewmicroheaders', 'userscanchooseviewthemes',
'remoteavatars',
);
$oldlanguage = get_config('lang');
$oldtheme = get_config('theme');
......
......@@ -169,6 +169,8 @@ $string['language'] = 'Language';
$string['country'] = 'Country';
$string['pathtoclam'] = 'Path to clam';
$string['pathtoclamdescription'] = 'The filesystem path to clamscan or clamdscan';
$string['remoteavatars'] = 'Display remote avatars';
$string['remoteavatarsdescription'] = 'If checked, the <a href="http://www.gravatar.com">Gravatar</a> service will be used for users\' default profile icons.';
$string['searchplugin'] = 'Search plugin';
$string['searchplugindescription'] = 'Search plugin to use';
$string['sessionlifetime'] = 'Session lifetime';
......
<h3>Display remote avatars</h3>
<p>If this option is enabled,
the <a href="http://www.gravatar.com">Gravatar</a> online service will be
used to display profile icons for users who don't have one set in
Mahara. This allows users to set their profile icon once on the Gravatar
site instead of having to do it on every Mahara and online service
individually. (If Gravatar doesn't have an icon for that user, then the
default Mahara icon will be shown.)</p>
<h4>Reasons to turn it off</h4>
<p>This option should be disabled in installations (such as locked-down
intranets) where <b>users don't have access to the wider Internet</b>. Using
Gravatar in such an environment would simply add extra delays.</p>
<p>Also, for <b>sites delivered over https</b>, enabling Gravator profile
icons might trigger security warnings on some browsers. This is due to the
fact that Gravatar images are served via normal unencrypted http.</p>
......@@ -180,6 +180,11 @@ switch ($type) {
* @returns string The URL of the image or FALSE if none was found
*/
function gravatar_icon($email, $size, $earlyexpiry) {
if (!get_config('remoteavatars')) {
return false;
}
$md5sum = md5(strtolower($email));
$s = 100;
......@@ -192,5 +197,3 @@ function gravatar_icon($email, $size, $earlyexpiry) {
$notfound = get_config('wwwroot').'thumb.php?type=profileiconbyid' . ($earlyexpiry ? '&earlyexpiry=1' : '');
return "$url&d=".urlencode($notfound);
}
?>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment