let's make this failsafe

This commit is contained in:
friendica 2013-05-28 22:10:53 -07:00
parent 9e5f54af60
commit b25783b9b6

View File

@ -25,14 +25,17 @@ function magic_init(&$a) {
else {
// See if we know anybody at the dest site that will unlock the door for us
$b = explode('/',$dest);
$u = '';
if(count($b) >= 2)
$u = $b[0] . '//' . $b[2];
$u = $b[0] . '//' . $b[2];
logger('mod_magic: fallback: ' . $b . ' -> ' . $u);
$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",
dbesc($u)
);
if($u) {
$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",
dbesc($u)
);
}
}