]> git.mxchange.org Git - friendica.git/commitdiff
provide config option to not use gravatar during registration
authorFriendika <info@friendika.com>
Thu, 18 Nov 2010 07:24:43 +0000 (23:24 -0800)
committerFriendika <info@friendika.com>
Thu, 18 Nov 2010 07:24:43 +0000 (23:24 -0800)
mod/register.php

index 407bda73ee3fdbb2932809c466e85fa506e0259c..ba6cffea0b7e50c72aea52d92451aee80f90b688 100644 (file)
@@ -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(