From b4c277da22442cdb2d424490eee9ed9fcedf2c76 Mon Sep 17 00:00:00 2001 From: Friendika Date: Wed, 17 Nov 2010 23:24:43 -0800 Subject: [PATCH] provide config option to not use gravatar during registration --- mod/register.php | 51 ++++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/mod/register.php b/mod/register.php index 407bda73e..ba6cffea0 100644 --- a/mod/register.php +++ b/mod/register.php @@ -206,45 +206,46 @@ function register_post(&$a) { } require_once('include/Photo.php'); + $nograv = get_config('system','no_gravatar'); + if(! $nograv) { + $photo = gravatar_img($email); + $photo_failure = false; - $photo = gravatar_img($email); - $photo_failure = false; + $filename = basename($photo); + $img_str = fetch_url($photo,true); + $img = new Photo($img_str); + if($img->is_valid()) { - $filename = basename($photo); - $img_str = fetch_url($photo,true); - $img = new Photo($img_str); - if($img->is_valid()) { - - $img->scaleImageSquare(175); + $img->scaleImageSquare(175); - $hash = photo_new_resource(); + $hash = photo_new_resource(); - $r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 4 ); + $r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 4 ); - if($r === false) - $photo_failure = true; + if($r === false) + $photo_failure = true; - $img->scaleImage(80); + $img->scaleImage(80); - $r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 5 ); + $r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 5 ); - if($r === false) - $photo_failure = true; + if($r === false) + $photo_failure = true; - $img->scaleImage(48); + $img->scaleImage(48); - $r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 6 ); + $r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 6 ); - if($r === false) - $photo_failure = true; + if($r === false) + $photo_failure = true; - if(! $photo_failure) { - q("UPDATE `photo` SET `profile` = 1 WHERE `resource-id` = '%s' ", - dbesc($hash) - ); + if(! $photo_failure) { + q("UPDATE `photo` SET `profile` = 1 WHERE `resource-id` = '%s' ", + dbesc($hash) + ); + } } } - if( $a->config['register_policy'] == REGISTER_OPEN ) { $email_tpl = load_view_file("view/register_open_eml.tpl"); $email_tpl = replace_macros($email_tpl, array(