debug rmagic

This commit is contained in:
friendica 2013-02-08 18:28:39 -08:00
parent f6af431612
commit 28b11f3567
2 changed files with 11 additions and 5 deletions

View File

@ -27,10 +27,12 @@ function magic_init(&$a) {
$b = explode('/',$dest); $b = explode('/',$dest);
if(count($b) >= 2) if(count($b) >= 2)
$u = $b[0] . '//' . $b[2]; $u = $b[0] . '//' . $b[2];
$x = q("select xchan.xchan_url, hubloc.* from xchan left join hubloc on xchan_hash = hubloc_hash $x = q("select xchan.xchan_url, hubloc.* from xchan left join hubloc on xchan_hash = hubloc_hash
where hubloc_url = '%s' limit 1", where hubloc_url = '%s' limit 1",
dbesc($u) dbesc($u)
); );
} }

View File

@ -3,17 +3,21 @@
function rmagic_init(&$a) { function rmagic_init(&$a) {
if(local_user())
goaway(z_root());
$me = get_my_address(); $me = get_my_address();
if($me) { if($me) {
$r = q("select hubloc_url from hubloc where hubloc_addr = '%s' limit 1", $r = q("select hubloc_url from hubloc where hubloc_addr = '%s' limit 1",
dbesc($me) dbesc($me)
); );
if($r) { if($r) {
$dest = z_root() . str_replace('zid=','zid_=',$get_app()->query_string); if($r[0]['hubloc_url'] === z_root())
goaway($r[0]['hubloc_url'] . '/magic' . '?f=&dest=' . z_root() . $dest); goaway(z_root() . '/login');
$dest = z_root() . '/' . str_replace('zid=','zid_=',$get_app()->query_string);
goaway($r[0]['hubloc_url'] . '/magic' . '?f=&dest=' . $dest);
} }
} }
} }
function rmagic_post(&$a) { function rmagic_post(&$a) {
@ -38,8 +42,8 @@ function rmagic_post(&$a) {
} }
if($url) { if($url) {
$dest = z_root() . str_replace('zid=','zid_=',$a->query_string); $dest = z_root() . '/' . str_replace('zid=','zid_=',$a->query_string);
goaway($url . '/magic' . '?f=&dest=' . z_root() . $dest); goaway($url . '/magic' . '?f=&dest=' . $dest);
} }