aboutsummaryrefslogtreecommitdiffstats
path: root/boot.php
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2010-11-15 16:49:27 -0800
committerFriendika <info@friendika.com>2010-11-15 16:49:27 -0800
commit9be5a7c750e2634a37529945ced226e0cb06c274 (patch)
treed3d83062572fb82da046c99d5049eefe15fe78c7 /boot.php
parenteae34f323b85d4126c81eda679d1350d171fd8da (diff)
downloadvolse-hubzilla-9be5a7c750e2634a37529945ced226e0cb06c274.tar.gz
volse-hubzilla-9be5a7c750e2634a37529945ced226e0cb06c274.tar.bz2
volse-hubzilla-9be5a7c750e2634a37529945ced226e0cb06c274.zip
use gravatar for default avatars
Diffstat (limited to 'boot.php')
-rw-r--r--boot.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/boot.php b/boot.php
index 3ed349777..baf1f4812 100644
--- a/boot.php
+++ b/boot.php
@@ -376,6 +376,11 @@ function fetch_url($url,$binary = false, &$redirects = 0) {
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
+
+ $curl_time = intval(get_config('system','curl_timeout'));
+ if($curl_time)
+ curl_setopt($ch, CURLOPT_TIMEOUT, $curl_time);
+
// by default we will allow self-signed certs
// but you can override this
@@ -434,6 +439,10 @@ function post_url($url,$params, $headers = null, &$redirects = 0) {
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$params);
+ $curl_time = intval(get_config('system','curl_timeout'));
+ if($curl_time)
+ curl_setopt($ch, CURLOPT_TIMEOUT, $curl_time);
+
if(is_array($headers))
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
@@ -1451,3 +1460,18 @@ function valid_email($x){
return false;
}}
+
+if(! function_exists('gravatar_img')) {
+function gravatar_img($email) {
+ $size = 175;
+ $opt = 'identicon'; // psuedo-random geometric pattern if not found
+ $rating = 'pg';
+ $hash = md5(trim(strtolower($email)));
+
+ $url = 'http://www.gravatar.com/avatar/' . $hash . '.jpg'
+ . '?s=' . $size . '&d=' . $opt . '&r=' . $rating;
+
+ logger('gravatar: ' . $email . ' ' . $url);
+ return $url;
+}}
+