aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2015-03-16 17:08:50 -0700
committerfriendica <info@friendica.com>2015-03-16 17:08:50 -0700
commit178b768e3ce43f3c75abec1540fcdc909c8c2197 (patch)
treeb8e53da8fae91ae135a763365340ad08d9eb91d2 /mod
parentccf4734f7bb525ae6b1ebe63e3a2b6b00c4f823b (diff)
downloadvolse-hubzilla-178b768e3ce43f3c75abec1540fcdc909c8c2197.tar.gz
volse-hubzilla-178b768e3ce43f3c75abec1540fcdc909c8c2197.tar.bz2
volse-hubzilla-178b768e3ce43f3c75abec1540fcdc909c8c2197.zip
openid cleanup
Diffstat (limited to 'mod')
-rw-r--r--mod/channel.php2
-rw-r--r--mod/id.php164
2 files changed, 68 insertions, 98 deletions
diff --git a/mod/channel.php b/mod/channel.php
index 3216da7e1..2a0373a81 100644
--- a/mod/channel.php
+++ b/mod/channel.php
@@ -39,7 +39,7 @@ function channel_init(&$a) {
// Not yet ready for prime time
// $a->page['htmlhead'] .= '<link rel="openid.server" href="' . $a->get_baseurl() . '/id/' . $which .'?f=" />' . "\r\n" ;
-// $a->page['htmlhead'] .= '<link rel="openid.delegate" href="' . $a->get_baseurl() . '/id/' . $which .'" />' . "\r\n" ;
+// $a->page['htmlhead'] .= '<link rel="openid.delegate" href="' . $a->get_baseurl() . '/channel/' . $which .'" />' . "\r\n" ;
// Run profile_load() here to make sure the theme is set before
// we start loading content
diff --git a/mod/id.php b/mod/id.php
index 6678004c5..05a2f3dc5 100644
--- a/mod/id.php
+++ b/mod/id.php
@@ -1,5 +1,37 @@
<?php
+ require 'library/openid/provider/provider.php';
+
+
+
+ $attrMap = array(
+ 'namePerson/first' => t('First Name'),
+ 'namePerson/last' => t('Last Name'),
+ 'namePerson/friendly' => t('Nickname'),
+ 'namePerson' => t('Full Name'),
+ 'contact/internet/email' => t('Email'),
+ 'contact/email' => t('Email'),
+ 'media/image/aspect11' => t('Profile Photo'),
+ 'media/image' => t('Profile Photo'),
+ 'media/image/default' => t('Profile Photo'),
+ 'media/image/16x16' => t('Profile Photo 16px'),
+ 'media/image/32x32' => t('Profile Photo 32px'),
+ 'media/image/48x48' => t('Profile Photo 48px'),
+ 'media/image/64x64' => t('Profile Photo 64px'),
+ 'media/image/80x80' => t('Profile Photo 80px'),
+ 'media/image/128x128' => t('Profile Photo 128px'),
+ 'timezone' => t('Timezone'),
+ 'contact/web/default' => t('Homepage URL'),
+ 'language/pref' => t('Language'),
+ 'birthDate/birthYear' => t('Birth Year'),
+ 'birthDate/birthMonth' => t('Birth Month'),
+ 'birthDate/birthday' => t('Birth Day'),
+ 'birthDate' => t('Birthdate'),
+ 'gender' => t('Gender'),
+ );
+
+
+
function id_init(&$a) {
logger('id: ' . print_r($_REQUEST,true));
@@ -17,11 +49,14 @@ function id_init(&$a) {
profile_load($a,$which,$profile);
-require 'library/openid/provider/provider.php';
+ $op = new MysqlProvider;
+ $op->server();
-function getUserData($handle=null)
-{
+}
+
+
+function getUserData($handle=null) {
if(! local_channel()) {
notice( t('Permission denied.') . EOL);
get_app()->page['content'] = login();
@@ -54,9 +89,6 @@ function getUserData($handle=null)
intval($r[0]['channel_account_id'])
);
-
-
-
$gender = '';
if($p[0]['gender'] == t('Male'))
$gender = 'M';
@@ -85,100 +117,43 @@ function getUserData($handle=null)
return $r[0];
/*
- if(isset($_POST['login'],$_POST['password'])) {
- $login = mysql_real_escape_string($_POST['login']);
- $password = sha1($_POST['password']);
- $q = mysql_query("SELECT * FROM Users WHERE login = '$login' AND password = '$password'");
- if($data = mysql_fetch_assoc($q)) {
- return $data;
- }
- if($handle) {
- echo 'Wrong login/password.';
- }
- }
- if($handle) {
- ?>
- <form action="" method="post">
- <input type="hidden" name="openid.assoc_handle" value="<?php echo $handle?>">
- Login: <input type="text" name="login"><br>
- Password: <input type="password" name="password"><br>
- <button>Submit</button>
- </form>
- <?php
- die();
- }
+* if(isset($_POST['login'],$_POST['password'])) {
+* $login = mysql_real_escape_string($_POST['login']);
+* $password = sha1($_POST['password']);
+* $q = mysql_query("SELECT * FROM Users WHERE login = '$login' AND password = '$password'");
+* if($data = mysql_fetch_assoc($q)) {
+* return $data;
+* }
+* if($handle) {
+* echo 'Wrong login/password.';
+* }
+* }
+* if($handle) {
+* ?>
+* <form action="" method="post">
+* <input type="hidden" name="openid.assoc_handle" value="<?php echo $handle?>">
+* Login: <input type="text" name="login"><br>
+* Password: <input type="password" name="password"><br>
+* <button>Submit</button>
+* </form>
+* <?php
+* die();
+* }
*/
}
-function translate_regs() {
-
- // This exists to get around scoping rules
-
- $attrMap = array(
- 'namePerson/first' => t('First Name'),
- 'namePerson/last' => t('Last Name'),
- 'namePerson/friendly' => t('Nickname'),
- 'namePerson' => t('Full Name'),
- 'contact/internet/email' => t('Email'),
- 'contact/email' => t('Email'),
- 'media/image/aspect11' => t('Profile Photo'),
- 'media/image' => t('Profile Photo'),
- 'media/image/default' => t('Profile Photo'),
- 'media/image/16x16' => t('Profile Photo 16px'),
- 'media/image/32x32' => t('Profile Photo 32px'),
- 'media/image/48x48' => t('Profile Photo 48px'),
- 'media/image/64x64' => t('Profile Photo 64px'),
- 'media/image/80x80' => t('Profile Photo 80px'),
- 'media/image/128x128' => t('Profile Photo 128px'),
- 'timezone' => t('Timezone'),
- 'contact/web/default' => t('Homepage URL'),
- 'language/pref' => t('Language'),
- 'birthDate/birthYear' => t('Birth Year'),
- 'birthDate/birthMonth' => t('Birth Month'),
- 'birthDate/birthday' => t('Birth Day'),
- 'birthDate' => t('Birthdate'),
- 'gender' => t('Gender'),
- );
-
- return $attrMap;
-}
class MysqlProvider extends LightOpenIDProvider
{
+
// See http://openid.net/specs/openid-attribute-properties-list-1_0-01.html
// This list contains a few variations of these attributes to maintain
// compatibility with legacy clients
- private $attrMap = array(
- 'namePerson/first' => 'First Name',
- 'namePerson/last' => 'Last Name',
- 'namePerson/friendly' => 'Nickname',
- 'namePerson' => 'Full Name',
- 'contact/internet/email' => 'Email',
- 'contact/email' => 'Email',
- 'media/image/aspect11' => 'Profile Photo',
- 'media/image' => 'Profile Photo',
- 'media/image/default' => 'Profile Photo',
- 'media/image/16x16' => 'Profile Photo 16px',
- 'media/image/32x32' => 'Profile Photo 32px',
- 'media/image/48x48' => 'Profile Photo 48px',
- 'media/image/64x64' => 'Profile Photo 64px',
- 'media/image/80x80' => 'Profile Photo 80px',
- 'media/image/128x128' => 'Profile Photo 128px',
- 'timezone' => 'Timezone',
- 'contact/web/default' => 'Homepage URL',
- 'language/pref' => 'Language',
- 'birthDate/birthYear' => 'Birth Year',
- 'birthDate/birthMonth' => 'Birth Month',
- 'birthDate/birthday' => 'Birth Day',
- 'birthDate' => 'Birthdate',
- 'gender' => 'Gender',
- );
-
private $attrFieldMap = array(
'namePerson/first' => 'firstName',
'namePerson/last' => 'lastName',
@@ -208,6 +183,7 @@ class MysqlProvider extends LightOpenIDProvider
function setup($identity, $realm, $assoc_handle, $attributes)
{
+ global $attrMap;
// logger('identity: ' . $identity);
// logger('realm: ' . $realm);
@@ -216,6 +192,9 @@ class MysqlProvider extends LightOpenIDProvider
$data = getUserData($assoc_handle);
+
+// FIXME this needs to be a template with localised strings
+
$o .= '<form action="" method="post">'
. '<input type="hidden" name="openid.assoc_handle" value="' . $assoc_handle . '">'
. '<input type="hidden" name="login" value="' . $_POST['login'] .'">'
@@ -269,10 +248,6 @@ class MysqlProvider extends LightOpenIDProvider
return false;
}
-
- logger('checkid: checkpoint1');
-
-
$q = get_pconfig(local_channel(),'openid',$realm);
$attrs = array();
@@ -300,9 +275,9 @@ class MysqlProvider extends LightOpenIDProvider
function assoc_handle()
{
-
+ logger('assoc_handle');
$channel = get_app()->get_channel();
- return z_root() . '/id/' . $channel['channel_address'];
+ return z_root() . '/channel/' . $channel['channel_address'];
}
@@ -312,7 +287,6 @@ class MysqlProvider extends LightOpenIDProvider
$channel = channelx_by_nick(basename($handle));
if($channel)
set_pconfig($channel['channel_id'],'openid','associate',$data);
-
}
function getAssoc($handle)
@@ -334,10 +308,6 @@ class MysqlProvider extends LightOpenIDProvider
}
}
-$op = new MysqlProvider;
-$op->server();
-
-}