From e33b6e0b5a1f444786d00a2666be1b23dc659c8a Mon Sep 17 00:00:00 2001 From: Friendika Date: Fri, 1 Apr 2011 00:59:10 -0700 Subject: [PATCH] redirect to symbolic rather than absolute URL locations --- mod/dfrn_poll.php | 18 ++++++++++++++++-- mod/redir.php | 5 +++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/mod/dfrn_poll.php b/mod/dfrn_poll.php index fe9504deb4..82ad709070 100644 --- a/mod/dfrn_poll.php +++ b/mod/dfrn_poll.php @@ -447,6 +447,19 @@ function dfrn_poll_content(&$a) { )); } + switch($destination_url) { + case 'profile': + $dest = $a->get_baseurl() . '/profile/' . $profile . '?tab=profile'; + break; + case 'photos': + $dest = $a->get_baseurl() . '/photos/' . $profile; + break; + case 'status': + default: + $dest = $a->get_baseurl() . '/profile/' . $profile; + break; + } + logger("dfrn_poll: sec profile: " . $s, LOGGER_DATA); if(strlen($s) && strstr($s,'get_baseurl() . '/profile/' . $profile); + + goaway($dest); } - goaway($a->get_baseurl()); + goaway($dest); // NOTREACHED } diff --git a/mod/redir.php b/mod/redir.php index ac21aa17eb..8d0c8f4b3a 100644 --- a/mod/redir.php +++ b/mod/redir.php @@ -5,6 +5,7 @@ function redir_init(&$a) { if((! local_user()) || (! ($a->argc == 2)) || (! intval($a->argv[1]))) goaway($a->get_baseurl()); $cid = $a->argv[1]; + $url = ((x($_GET,'url')) ? $_GET['url'] : ''); $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($cid), @@ -37,8 +38,8 @@ function redir_init(&$a) { ); logger('mod_redir: ' . $r[0]['name'] . ' ' . $sec, LOGGER_DEBUG); - + $dest = (($url) ? '&destination_url=' . $url : ''); goaway ($r[0]['poll'] . '?dfrn_id=' . $dfrn_id - . '&dfrn_version=' . DFRN_PROTOCOL_VERSION . '&type=profile&sec=' . $sec); + . '&dfrn_version=' . DFRN_PROTOCOL_VERSION . '&type=profile&sec=' . $sec . $dest ); }