provide config option to not use gravatar during registration

This commit is contained in:
Friendika 2010-11-17 23:24:43 -08:00
parent 6516de06df
commit b4c277da22
1 changed files with 26 additions and 25 deletions

View File

@ -206,45 +206,46 @@ function register_post(&$a) {
} }
require_once('include/Photo.php'); require_once('include/Photo.php');
$nograv = get_config('system','no_gravatar');
if(! $nograv) {
$photo = gravatar_img($email);
$photo_failure = false;
$photo = gravatar_img($email); $filename = basename($photo);
$photo_failure = false; $img_str = fetch_url($photo,true);
$img = new Photo($img_str);
if($img->is_valid()) {
$filename = basename($photo); $img->scaleImageSquare(175);
$img_str = fetch_url($photo,true);
$img = new Photo($img_str);
if($img->is_valid()) {
$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) if($r === false)
$photo_failure = true; $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) if($r === false)
$photo_failure = true; $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) if($r === false)
$photo_failure = true; $photo_failure = true;
if(! $photo_failure) { if(! $photo_failure) {
q("UPDATE `photo` SET `profile` = 1 WHERE `resource-id` = '%s' ", q("UPDATE `photo` SET `profile` = 1 WHERE `resource-id` = '%s' ",
dbesc($hash) dbesc($hash)
); );
}
} }
} }
if( $a->config['register_policy'] == REGISTER_OPEN ) { if( $a->config['register_policy'] == REGISTER_OPEN ) {
$email_tpl = load_view_file("view/register_open_eml.tpl"); $email_tpl = load_view_file("view/register_open_eml.tpl");
$email_tpl = replace_macros($email_tpl, array( $email_tpl = replace_macros($email_tpl, array(