2011-08-12 09:58:29 +00:00
|
|
|
<?php
|
|
|
|
|
2012-12-29 08:33:04 +00:00
|
|
|
require_once('include/zot.php');
|
2011-08-12 09:58:29 +00:00
|
|
|
|
|
|
|
function probe_content(&$a) {
|
|
|
|
|
|
|
|
$o .= '<h3>Probe Diagnostic</h3>';
|
|
|
|
|
|
|
|
$o .= '<form action="probe" method="get">';
|
|
|
|
$o .= 'Lookup address: <input type="text" style="width: 250px;" name="addr" value="' . $_GET['addr'] .'" />';
|
|
|
|
$o .= '<input type="submit" name="submit" value="Submit" /></form>';
|
|
|
|
|
|
|
|
$o .= '<br /><br />';
|
|
|
|
|
|
|
|
if(x($_GET,'addr')) {
|
2012-12-29 08:33:04 +00:00
|
|
|
$channel = $a->get_channel();
|
2011-08-12 09:58:29 +00:00
|
|
|
$addr = trim($_GET['addr']);
|
2015-05-12 02:36:07 +00:00
|
|
|
$do_import = ((intval($_GET['import']) && is_site_admin()) ? true : false);
|
2013-10-02 05:20:09 +00:00
|
|
|
$res = zot_finger($addr,$channel,false);
|
2011-08-12 09:58:29 +00:00
|
|
|
$o .= '<pre>';
|
2013-10-02 05:20:09 +00:00
|
|
|
if($res['success'])
|
|
|
|
$j = json_decode($res['body'],true);
|
|
|
|
else {
|
2014-03-25 00:16:01 +00:00
|
|
|
$o .= sprintf( t('Fetching URL returns error: %1$s'),$res['error'] . "\r\n\r\n");
|
2013-10-02 05:20:09 +00:00
|
|
|
$o .= "<strong>https connection failed. Trying again with auto failover to http.</strong>\r\n\r\n";
|
|
|
|
$res = zot_finger($addr,$channel,true);
|
|
|
|
if($res['success'])
|
|
|
|
$j = json_decode($res['body'],true);
|
2014-03-23 22:24:38 +00:00
|
|
|
else
|
2014-03-25 00:16:01 +00:00
|
|
|
$o .= sprintf( t('Fetching URL returns error: %1$s'),$res['error'] . "\r\n\r\n");
|
2014-03-23 22:24:38 +00:00
|
|
|
|
2013-10-02 05:20:09 +00:00
|
|
|
}
|
2015-05-12 02:36:07 +00:00
|
|
|
if($do_import && $j)
|
|
|
|
$x = import_xchan($j);
|
2012-12-29 08:33:04 +00:00
|
|
|
if($j && $j['permissions'] && $j['permissions']['iv'])
|
2013-11-20 23:20:12 +00:00
|
|
|
$j['permissions'] = json_decode(crypto_unencapsulate($j['permissions'],$channel['channel_prvkey']),true);
|
2012-12-29 08:33:04 +00:00
|
|
|
$o .= str_replace("\n",'<br />',print_r($j,true));
|
2011-08-12 09:58:29 +00:00
|
|
|
$o .= '</pre>';
|
|
|
|
}
|
|
|
|
return $o;
|
|
|
|
}
|