use optional openid photo for registration - if supplied
This commit is contained in:
parent
f9f08b4355
commit
dd52aec243
4 changed files with 28 additions and 8 deletions
|
@ -114,7 +114,7 @@ else {
|
||||||
// new account
|
// new account
|
||||||
$_SESSION['register'] = 1;
|
$_SESSION['register'] = 1;
|
||||||
$openid->required = array('namePerson/friendly', 'contact/email', 'namePerson');
|
$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());
|
goaway($openid->authUrl());
|
||||||
// NOTREACHED
|
// NOTREACHED
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,10 @@ function openid_content(&$a) {
|
||||||
$args .= '&username=' . notags(trim($v));
|
$args .= '&username=' . notags(trim($v));
|
||||||
if($k === 'contact/email')
|
if($k === 'contact/email')
|
||||||
$args .= '&email=' . notags(trim($v));
|
$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)
|
if($nick)
|
||||||
|
@ -32,6 +36,11 @@ function openid_content(&$a) {
|
||||||
elseif($first)
|
elseif($first)
|
||||||
$args .= '&nickname=' . $first;
|
$args .= '&nickname=' . $first;
|
||||||
|
|
||||||
|
if($photosq)
|
||||||
|
$args .= '&photo=' . $photosq;
|
||||||
|
elseif($photo)
|
||||||
|
$args .= '&photo=' . $photo;
|
||||||
|
|
||||||
$args .= '&openid_url=' . notags(trim($_SESSION['openid']));
|
$args .= '&openid_url=' . notags(trim($_SESSION['openid']));
|
||||||
if($a->config['register_policy'] != REGISTER_CLOSED)
|
if($a->config['register_policy'] != REGISTER_CLOSED)
|
||||||
goaway($a->get_baseurl() . '/register' . $args);
|
goaway($a->get_baseurl() . '/register' . $args);
|
||||||
|
|
|
@ -39,6 +39,8 @@ function register_post(&$a) {
|
||||||
if(x($_POST,'openid_url'))
|
if(x($_POST,'openid_url'))
|
||||||
$openid_url = notags(trim($_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((! x($username)) || (! x($email)) || (! x($nickname))) {
|
||||||
if($openid_url) {
|
if($openid_url) {
|
||||||
|
@ -49,7 +51,7 @@ function register_post(&$a) {
|
||||||
$openid->identity = $openid_url;
|
$openid->identity = $openid_url;
|
||||||
$openid->returnUrl = $a->get_baseurl() . '/openid';
|
$openid->returnUrl = $a->get_baseurl() . '/openid';
|
||||||
$openid->required = array('namePerson/friendly', 'contact/email', 'namePerson');
|
$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());
|
goaway($openid->authUrl());
|
||||||
// NOTREACHED
|
// NOTREACHED
|
||||||
}
|
}
|
||||||
|
@ -206,11 +208,16 @@ function register_post(&$a) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$use_gravatar = ((get_config('system','no_gravatar')) ? false : true);
|
$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');
|
require_once('include/Photo.php');
|
||||||
|
|
||||||
$photo = gravatar_img($email);
|
if(($use_gravatar) && (! strlen($photo)))
|
||||||
|
$photo = gravatar_img($email);
|
||||||
$photo_failure = false;
|
$photo_failure = false;
|
||||||
|
|
||||||
$filename = basename($photo);
|
$filename = basename($photo);
|
||||||
|
@ -327,10 +334,11 @@ function register_content(&$a) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$username = ((x($_POST,'username')) ? $_POST['username'] : ((x($_GET,'username')) ? $_GET['username'] : ''));
|
$username = ((x($_POST,'username')) ? $_POST['username'] : ((x($_GET,'username')) ? $_GET['username'] : ''));
|
||||||
$email = ((x($_POST,'email')) ? $_POST['email'] : ((x($_GET,'email')) ? $_GET['email'] : ''));
|
$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'] : ''));
|
$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'] : ''));
|
$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 = load_view_file("view/register.tpl");
|
||||||
$o = replace_macros($o, array(
|
$o = replace_macros($o, array(
|
||||||
|
@ -346,6 +354,7 @@ function register_content(&$a) {
|
||||||
'$addrlabel' => t('Your Email Address: '),
|
'$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>\'.'),
|
'$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: '),
|
'$nicklabel' => t('Choose a nickname: '),
|
||||||
|
'$photo' => $photo,
|
||||||
'$regbutt' => t('Register'),
|
'$regbutt' => t('Register'),
|
||||||
'$username' => $username,
|
'$username' => $username,
|
||||||
'$email' => $email,
|
'$email' => $email,
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
<form action="register" method="post" >
|
<form action="register" method="post" >
|
||||||
|
|
||||||
|
<input type="hidden" name="photo" value="$photo" />
|
||||||
|
|
||||||
$registertext
|
$registertext
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue