3 function auto_redir(&$a, $contact_nick) {
5 // disabling temporarily - seeing a lot of recursive redirects, triggered in my case
6 // because one of my contacts has the same nickname as me so it's redirecting to his site
7 // (I'm trying to load my own profile page and he is remote so it shouldn't redirect anyway).
8 // Need some time to sort this out.
14 $r = q("SELECT id FROM contact WHERE uid = ( SELECT uid FROM user WHERE nickname = '%s' LIMIT 1 ) AND nick = '%s' AND network = '%s' and self = 0 LIMIT 1",
16 dbesc($a->user['nickname']),
20 if((!$r) || (! count($r)) || $r[0]['id'] == remote_user())
24 $r = q("SELECT * FROM contact WHERE nick = '%s' AND network = '%s' AND uid = %d LIMIT 1",
30 if(! ($r && count($r)))
35 $dfrn_id = $orig_id = (($r[0]['issued-id']) ? $r[0]['issued-id'] : $r[0]['dfrn-id']);
37 if($r[0]['duplex'] && $r[0]['issued-id']) {
38 $orig_id = $r[0]['issued-id'];
39 $dfrn_id = '1:' . $orig_id;
41 if($r[0]['duplex'] && $r[0]['dfrn-id']) {
42 $orig_id = $r[0]['dfrn-id'];
43 $dfrn_id = '0:' . $orig_id;
46 $sec = random_string();
48 q("INSERT INTO `profile_check` ( `uid`, `cid`, `dfrn_id`, `sec`, `expire`)
49 VALUES( %d, %s, '%s', '%s', %d )",
59 logger('check_redir: ' . $r[0]['name'] . ' ' . $sec, LOGGER_DEBUG);
60 $dest = (($url) ? '&destination_url=' . $url : '');
61 goaway ($r[0]['poll'] . '?dfrn_id=' . $dfrn_id
62 . '&dfrn_version=' . DFRN_PROTOCOL_VERSION . '&type=profile&sec=' . $sec . $dest );