some zot-id infrastructure

This commit is contained in:
friendica 2012-01-29 15:47:25 -08:00
parent e43a3a412c
commit 61246cbd1c
3 changed files with 48 additions and 32 deletions

View File

@ -9,7 +9,7 @@ require_once('include/nav.php');
require_once('include/cache.php');
define ( 'FRIENDICA_PLATFORM', 'Friendica');
define ( 'FRIENDICA_VERSION', '2.3.1238' );
define ( 'FRIENDICA_VERSION', '2.3.1239' );
define ( 'DFRN_PROTOCOL_VERSION', '2.22' );
define ( 'DB_UPDATE_VERSION', 1118 );

View File

@ -86,6 +86,7 @@ function dfrn_poll_init(&$a) {
$_SESSION['authenticated'] = 1;
$_SESSION['visitor_id'] = $r[0]['id'];
$_SESSION['visitor_home'] = $r[0]['url'];
$_SESSION['visitor_handle'] = $r[0]['addr'];
$_SESSION['visitor_visiting'] = $r[0]['uid'];
info( sprintf(t('%s welcomes %s'), $r[0]['username'] , $r[0]['name']) . EOL);
// Visitors get 1 day session.

View File

@ -2,17 +2,20 @@
function redir_init(&$a) {
if((! local_user()) || (! ($a->argc == 2)) || (! intval($a->argv[1])))
goaway(z_root());
$cid = $a->argv[1];
$url = ((x($_GET,'url')) ? $_GET['url'] : '');
// traditional DFRN
if(local_user() && $a->argc == 2 && intval($a->argv[1])) {
$cid = $a->argv[1];
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($cid),
intval(local_user())
);
if((! count($r)) || ($r[0]['network'] !== 'dfrn'))
if((! count($r)) || ($r[0]['network'] !== NETWORK_DFRN))
goaway(z_root());
$dfrn_id = $orig_id = (($r[0]['issued-id']) ? $r[0]['issued-id'] : $r[0]['dfrn-id']);
@ -41,5 +44,17 @@ function redir_init(&$a) {
$dest = (($url) ? '&destination_url=' . $url : '');
goaway ($r[0]['poll'] . '?dfrn_id=' . $dfrn_id
. '&dfrn_version=' . DFRN_PROTOCOL_VERSION . '&type=profile&sec=' . $sec . $dest );
}
if(local_user())
$handle = $a->user['nickname'] . '@' . substr($a->get_baseurl(),strpos($a->get_baseurl(),'://')+3);
if(remote_user())
$handle = $_SESSION['handle'];
if($url) {
$url = str_replace('{zid}','&zid=' . $handle,$url);
goaway($url);
}
goaway(z_root());
}