Merge pull request #619 from fermionic/20130216-redir-with-contact-url
add support for doing a redir/ based on contact url
This commit is contained in:
commit
00cd04f193
1 changed files with 24 additions and 8 deletions
|
@ -4,20 +4,36 @@ function redir_init(&$a) {
|
||||||
|
|
||||||
$url = ((x($_GET,'url')) ? $_GET['url'] : '');
|
$url = ((x($_GET,'url')) ? $_GET['url'] : '');
|
||||||
$quiet = ((x($_GET,'quiet')) ? '&quiet=1' : '');
|
$quiet = ((x($_GET,'quiet')) ? '&quiet=1' : '');
|
||||||
|
$con_url = ((x($_GET,'conurl')) ? $_GET['conurl'] : '');
|
||||||
|
|
||||||
// traditional DFRN
|
// traditional DFRN
|
||||||
|
|
||||||
if(local_user() && $a->argc > 1 && intval($a->argv[1])) {
|
if( $con_url || (local_user() && $a->argc > 1 && intval($a->argv[1])) ) {
|
||||||
|
|
||||||
$cid = $a->argv[1];
|
if($con_url) {
|
||||||
|
$con_url = str_replace('https', 'http', $con_url);
|
||||||
|
|
||||||
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
$r = q("SELECT * FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d LIMIT 1",
|
||||||
intval($cid),
|
dbesc($con_url),
|
||||||
intval(local_user())
|
intval(local_user())
|
||||||
);
|
);
|
||||||
|
|
||||||
if((! count($r)) || ($r[0]['network'] !== NETWORK_DFRN))
|
if((! count($r)) || ($r[0]['network'] !== NETWORK_DFRN))
|
||||||
goaway(z_root());
|
goaway(z_root());
|
||||||
|
|
||||||
|
$cid = $r[0]['id'];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$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'] !== NETWORK_DFRN))
|
||||||
|
goaway(z_root());
|
||||||
|
}
|
||||||
|
|
||||||
$dfrn_id = $orig_id = (($r[0]['issued-id']) ? $r[0]['issued-id'] : $r[0]['dfrn-id']);
|
$dfrn_id = $orig_id = (($r[0]['issued-id']) ? $r[0]['issued-id'] : $r[0]['dfrn-id']);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue