aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/auth.php2
-rw-r--r--mod/openid.php9
-rw-r--r--mod/register.php23
-rw-r--r--view/register.tpl2
4 files changed, 28 insertions, 8 deletions
diff --git a/include/auth.php b/include/auth.php
index 05d5dfd6f..7f45c6d58 100644
--- a/include/auth.php
+++ b/include/auth.php
@@ -114,7 +114,7 @@ else {
// new account
$_SESSION['register'] = 1;
$openid->required = array('namePerson/friendly', 'contact/email', 'namePerson');
- $openid->optional = array('namePerson/first','media/image/aspect11');
+ $openid->optional = array('namePerson/first','media/image/aspect11','media/image/default');
goaway($openid->authUrl());
// NOTREACHED
}
diff --git a/mod/openid.php b/mod/openid.php
index 443d839fa..94f08c430 100644
--- a/mod/openid.php
+++ b/mod/openid.php
@@ -25,6 +25,10 @@ function openid_content(&$a) {
$args .= '&username=' . notags(trim($v));
if($k === 'contact/email')
$args .= '&email=' . notags(trim($v));
+ if($k === 'media/image/aspect11')
+ $photosq = bin2hex(trim($v));
+ if($k === 'media/image/default')
+ $photo = bin2hex(trim($v));
}
}
if($nick)
@@ -32,6 +36,11 @@ function openid_content(&$a) {
elseif($first)
$args .= '&nickname=' . $first;
+ if($photosq)
+ $args .= '&photo=' . $photosq;
+ elseif($photo)
+ $args .= '&photo=' . $photo;
+
$args .= '&openid_url=' . notags(trim($_SESSION['openid']));
if($a->config['register_policy'] != REGISTER_CLOSED)
goaway($a->get_baseurl() . '/register' . $args);
diff --git a/mod/register.php b/mod/register.php
index 69c34f8e9..20ea0175a 100644
--- a/mod/register.php
+++ b/mod/register.php
@@ -39,6 +39,8 @@ function register_post(&$a) {
if(x($_POST,'openid_url'))
$openid_url = notags(trim($_POST['openid_url']));
+ $photo = ((x($_POST,'photo')) ? notags(trim($_POST['photo'])) : '');
+
if((! x($username)) || (! x($email)) || (! x($nickname))) {
if($openid_url) {
@@ -49,7 +51,7 @@ function register_post(&$a) {
$openid->identity = $openid_url;
$openid->returnUrl = $a->get_baseurl() . '/openid';
$openid->required = array('namePerson/friendly', 'contact/email', 'namePerson');
- $openid->optional = array('namePerson/first','media/image/aspect11');
+ $openid->optional = array('namePerson/first','media/image/aspect11','media/image/default');
goaway($openid->authUrl());
// NOTREACHED
}
@@ -206,11 +208,16 @@ function register_post(&$a) {
}
$use_gravatar = ((get_config('system','no_gravatar')) ? false : true);
- if($use_gravatar) {
+
+ // if we have an openid photo use it.
+ // otherwise unless it is disabled, use gravatar
+
+ if($use_gravatar || strlen($photo)) {
require_once('include/Photo.php');
- $photo = gravatar_img($email);
+ if(($use_gravatar) && (! strlen($photo)))
+ $photo = gravatar_img($email);
$photo_failure = false;
$filename = basename($photo);
@@ -327,10 +334,11 @@ function register_content(&$a) {
return;
}
- $username = ((x($_POST,'username')) ? $_POST['username'] : ((x($_GET,'username')) ? $_GET['username'] : ''));
- $email = ((x($_POST,'email')) ? $_POST['email'] : ((x($_GET,'email')) ? $_GET['email'] : ''));
- $openid_url = ((x($_POST,'openid_url')) ? $_POST['openid_url'] : ((x($_GET,'openid_url')) ? $_GET['openid_url'] : ''));
- $nickname = ((x($_POST,'nickname')) ? $_POST['nickname'] : ((x($_GET,'nickname')) ? $_GET['nickname'] : ''));
+ $username = ((x($_POST,'username')) ? $_POST['username'] : ((x($_GET,'username')) ? $_GET['username'] : ''));
+ $email = ((x($_POST,'email')) ? $_POST['email'] : ((x($_GET,'email')) ? $_GET['email'] : ''));
+ $openid_url = ((x($_POST,'openid_url')) ? $_POST['openid_url'] : ((x($_GET,'openid_url')) ? $_GET['openid_url'] : ''));
+ $nickname = ((x($_POST,'nickname')) ? $_POST['nickname'] : ((x($_GET,'nickname')) ? $_GET['nickname'] : ''));
+ $photo = ((x($_POST,'photo')) ? $_POST['photo'] : ((x($_GET,'photo')) ? hex2bin($_GET['photo']) : ''));
$o = load_view_file("view/register.tpl");
$o = replace_macros($o, array(
@@ -346,6 +354,7 @@ function register_content(&$a) {
'$addrlabel' => t('Your Email Address: '),
'$nickdesc' => t('Choose a profile nickname. This must begin with a text character. Your global profile locator will then be \'<strong>nickname@$sitename</strong>\'.'),
'$nicklabel' => t('Choose a nickname: '),
+ '$photo' => $photo,
'$regbutt' => t('Register'),
'$username' => $username,
'$email' => $email,
diff --git a/view/register.tpl b/view/register.tpl
index 10f7f0222..b4d1e31d2 100644
--- a/view/register.tpl
+++ b/view/register.tpl
@@ -2,6 +2,8 @@
<form action="register" method="post" >
+ <input type="hidden" name="photo" value="$photo" />
+
$registertext