3 function redir_init(&$a) {
5 if((! local_user()) || (! ($a->argc == 2)) || (! intval($a->argv[1])))
6 goaway($a->get_baseurl());
7 $r = q("SELECT `network`, `issued-id`, `dfrn-id`, `duplex`, `poll` FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
11 if((! count($r)) || ($r[0]['network'] !== 'dfrn'))
12 goaway($a->get_baseurl());
14 $dfrn_id = $orig_id = (($r[0]['issued-id']) ? $r[0]['issued-id'] : $r[0]['dfrn-id']);
16 if($r[0]['duplex'] && $r[0]['issued-id']) {
17 $orig_id = $r[0]['issued-id'];
18 $dfrn_id = '1:' . $orig_id;
20 if($r[0]['duplex'] && $r[0]['dfrn-id']) {
21 $orig_id = $r[0]['dfrn-id'];
22 $dfrn_id = '0:' . $orig_id;
24 q("INSERT INTO `profile_check` ( `uid`, `dfrn_id`, `expire`)
25 VALUES( %d, '%s', %d )",
26 intval($_SESSION['uid']),
29 goaway ($r[0]['poll'] . '?dfrn_id=' . $dfrn_id
30 . '&dfrn_version=' . DFRN_PROTOCOL_VERSION . '&type=profile');