redirection to wrong profile in multi-user mode

This commit is contained in:
Mike Macgirvin 2010-09-09 17:09:38 -07:00
parent 62fdf346ff
commit 440a3fea3f
2 changed files with 26 additions and 18 deletions

View file

@ -370,7 +370,8 @@ function dfrn_confirm_post(&$a) {
`uri-date` = '%s', `uri-date` = '%s',
`avatar-date` = '%s', `avatar-date` = '%s',
`blocked` = 0, `blocked` = 0,
`pending` = 0, `pending` = 0,
`duplex` = %d,
`network` = 'dfrn' WHERE `id` = %d LIMIT 1 `network` = 'dfrn' WHERE `id` = %d LIMIT 1
", ",
dbesc($photo), dbesc($photo),
@ -379,6 +380,7 @@ function dfrn_confirm_post(&$a) {
dbesc(datetime_convert()), dbesc(datetime_convert()),
dbesc(datetime_convert()), dbesc(datetime_convert()),
dbesc(datetime_convert()), dbesc(datetime_convert()),
intval($duplex),
intval($contact_id) intval($contact_id)
); );
if($r === false) if($r === false)

View file

@ -27,29 +27,35 @@ function dfrn_poll_init(&$a) {
$r = q("SELECT `contact`.*, `user`.`nickname` $r = q("SELECT `contact`.*, `user`.`nickname`
FROM `contact` LEFT JOIN `user` ON `contact`.`uid` = `user`.`uid` FROM `contact` LEFT JOIN `user` ON `contact`.`uid` = `user`.`uid`
WHERE ( `dfrn-id` = '%s' OR ( `issued-id` = '%s' AND `duplex` = 1 )) LIMIT 1", WHERE ( `dfrn-id` = '%s' OR ( `issued-id` = '%s' AND `duplex` = 1 )) ",
dbesc($dfrn_id), dbesc($dfrn_id),
dbesc($dfrn_id) dbesc($dfrn_id)
); );
if(count($r)) { if(count($r)) {
$s = fetch_url($r[0]['poll'] . '?dfrn_id=' . $dfrn_id . '&type=profile-check'); foreach($r as $rr) {
if(strlen($s)) { if(local_user() && ($rr['uid'] == get_uid()))
$xml = simplexml_load_string($s); continue;
if((int) $xml->status == 1) {
$_SESSION['authenticated'] = 1; $s = fetch_url($rr['poll'] . '?dfrn_id=' . $dfrn_id . '&type=profile-check');
$_SESSION['visitor_id'] = $r[0]['id']; if(strlen($s)) {
notice( t('Hi ') . $r[0]['name'] . EOL); $xml = simplexml_load_string($s);
// Visitors get 1 day session. if((int) $xml->status == 1) {
$session_id = session_id(); $_SESSION['authenticated'] = 1;
$expire = time() + 86400; $_SESSION['visitor_id'] = $rr['id'];
q("UPDATE `session` SET `expire` = '%s' WHERE `sid` = '%s' LIMIT 1", notice( t('Hi ') . $rr['name'] . EOL);
dbesc($expire), // Visitors get 1 day session.
dbesc($session_id)); $session_id = session_id();
$expire = time() + 86400;
q("UPDATE `session` SET `expire` = '%s' WHERE `sid` = '%s' LIMIT 1",
dbesc($expire),
dbesc($session_id)
);
}
} }
$profile = $rr['nickname'];
goaway((strlen($destination_url)) ? $destination_url : $a->get_baseurl() . '/profile/' . $profile);
} }
$profile = $r[0]['nickname'];
goaway((strlen($destination_url)) ? $destination_url : $a->get_baseurl() . '/profile/' . $profile);
} }
goaway($a->get_baseurl()); goaway($a->get_baseurl());