aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-11-14 19:23:56 -0800
committerfriendica <info@friendica.com>2013-11-14 19:23:56 -0800
commit09d357ed472d2193f9b2d1797452cda1256307a9 (patch)
tree0795daa75598af3921c5fb023eb31361adcda576
parentbf709d49bac7a1075736c052066e5d44d9dfe7eb (diff)
downloadvolse-hubzilla-09d357ed472d2193f9b2d1797452cda1256307a9.tar.gz
volse-hubzilla-09d357ed472d2193f9b2d1797452cda1256307a9.tar.bz2
volse-hubzilla-09d357ed472d2193f9b2d1797452cda1256307a9.zip
baby steps tring to get magix auth working for redmtx
-rw-r--r--mod/magic.php19
1 files changed, 15 insertions, 4 deletions
diff --git a/mod/magic.php b/mod/magic.php
index 4eb688767..4794f86a8 100644
--- a/mod/magic.php
+++ b/mod/magic.php
@@ -33,12 +33,20 @@ function magic_init(&$a) {
if(count($b) >= 2) {
$u = $b[0] . '//' . $b[2];
-dbg(1);
+
$x = q("select xchan.xchan_url, hubloc.* from xchan left join hubloc on xchan_hash = hubloc_hash
- where hubloc_url = '%s' order by hubloc_id desc limit 1",
+ where hubloc_url = '%s' order by hubloc_id desc limit 5",
dbesc($u)
);
-dbg(0);
+
+ if($x) {
+ // They must have a valid hubloc_addr
+ while(! strpos($x[0]['hubloc_addr'],'@')) {
+ array_shift($x);
+ }
+ }
+
+
}
}
@@ -129,7 +137,10 @@ dbg(0);
dbesc(datetime_convert())
);
- goaway($x[0]['hubloc_callback'] . '/' . substr($x[0]['hubloc_addr'],0,strpos($x[0]['hubloc_addr'],'@'))
+ $target_url = $x[0]['hubloc_callback'] . '/' . substr($x[0]['hubloc_addr'],0,strpos($x[0]['hubloc_addr'],'@')) ;
+ logger('mod_magic: redirecting to: ' . $target_url, LOGGER_DEBUG);
+
+ goaway($target_url
. '/?f=&auth=' . $channel['channel_address'] . '@' . $a->get_hostname()
. '&sec=' . $token . '&dest=' . urlencode($dest) . '&version=' . ZOT_REVISION);
}