2016-04-19 03:38:38 +00:00
|
|
|
<?php
|
|
|
|
|
2022-05-03 10:41:08 +00:00
|
|
|
namespace Code\Module\Dev;
|
2016-04-19 03:38:38 +00:00
|
|
|
|
2022-02-16 04:08:28 +00:00
|
|
|
use Code\Web\Controller;
|
2021-12-02 22:33:36 +00:00
|
|
|
|
2021-12-02 23:02:31 +00:00
|
|
|
class Xchan extends Controller
|
|
|
|
{
|
|
|
|
|
|
|
|
public function get()
|
|
|
|
{
|
|
|
|
|
|
|
|
$o = '<h3>' . t('Xchan Lookup') . '</h3>';
|
|
|
|
|
2022-05-03 10:41:08 +00:00
|
|
|
$o .= '<form action="dev/xchan" method="get">';
|
2021-12-02 23:02:31 +00:00
|
|
|
$o .= t('Lookup xchan beginning with (or webbie): ');
|
|
|
|
$o .= '<input type="text" style="width:250px;" name="addr" value="' . $_GET['addr'] . '">';
|
|
|
|
$o .= '<input type="submit" name="submit" value="' . t('Submit') . '"></form>';
|
|
|
|
$o .= '<br><br>';
|
|
|
|
|
|
|
|
if (x($_GET, 'addr')) {
|
|
|
|
$addr = trim($_GET['addr']);
|
|
|
|
|
2021-12-03 03:01:39 +00:00
|
|
|
$r = q(
|
|
|
|
"select * from xchan where xchan_hash like '%s%%' or xchan_addr = '%s' group by xchan_hash",
|
2021-12-02 23:02:31 +00:00
|
|
|
dbesc($addr),
|
|
|
|
dbesc($addr)
|
|
|
|
);
|
|
|
|
|
|
|
|
if ($r) {
|
|
|
|
foreach ($r as $rr) {
|
|
|
|
$o .= str_replace(array("\n", " "), array("<br>", " "), print_r($rr, true)) . EOL;
|
|
|
|
|
2021-12-03 03:01:39 +00:00
|
|
|
$s = q(
|
2022-06-07 01:55:58 +00:00
|
|
|
"select * from hubloc where hubloc_hash = '%s'",
|
|
|
|
dbesc($rr['xchan_hash'])
|
2021-12-02 23:02:31 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
if ($s) {
|
2021-12-03 03:01:39 +00:00
|
|
|
foreach ($s as $rrr) {
|
2021-12-02 23:02:31 +00:00
|
|
|
$o .= str_replace(array("\n", " "), array("<br>", " "), print_r($rrr, true)) . EOL;
|
2021-12-03 03:01:39 +00:00
|
|
|
}
|
2021-12-02 23:02:31 +00:00
|
|
|
}
|
|
|
|
}
|
2021-12-03 03:01:39 +00:00
|
|
|
} else {
|
2021-12-02 23:02:31 +00:00
|
|
|
notice(t('Not found.') . EOL);
|
2021-12-03 03:01:39 +00:00
|
|
|
}
|
2021-12-02 23:02:31 +00:00
|
|
|
}
|
|
|
|
return $o;
|
|
|
|
}
|
2016-04-19 03:38:38 +00:00
|
|
|
}
|