aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-05-28 22:10:53 -0700
committerfriendica <info@friendica.com>2013-05-28 22:10:53 -0700
commitb25783b9b6a3977df45c0b51c666c9271c8fdc98 (patch)
tree89ed5556fbcbc13e668171a9906152f115c2adcd
parent9e5f54af60de83b75d4d70e2f4685b86a59c5d94 (diff)
downloadvolse-hubzilla-b25783b9b6a3977df45c0b51c666c9271c8fdc98.tar.gz
volse-hubzilla-b25783b9b6a3977df45c0b51c666c9271c8fdc98.tar.bz2
volse-hubzilla-b25783b9b6a3977df45c0b51c666c9271c8fdc98.zip
let's make this failsafe
-rw-r--r--mod/magic.php15
1 files changed, 9 insertions, 6 deletions
diff --git a/mod/magic.php b/mod/magic.php
index 0ecfca4ab..faa62850b 100644
--- a/mod/magic.php
+++ b/mod/magic.php
@@ -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)
+ );
+ }
}