Correct deletion

Bring back mod/probe.php and delete include/probe.php as intended.
This commit is contained in:
Adam Magness 2017-11-07 12:31:32 -05:00
parent 8522c47353
commit a782ab50f9
2 changed files with 31 additions and 41 deletions

View file

@ -1,41 +0,0 @@
<?php
use Friendica\Network\Probe;
/**
*
* PROBE_DIASPORA has a bias towards returning Diaspora information
* while PROBE_NORMAL has a bias towards dfrn/zot - in the case where
* an address (such as a Friendica address) supports more than one type
* of network.
*
*/
define('PROBE_NORMAL', 0);
define('PROBE_DIASPORA', 1);
/**
* @brief Probes a network address to discover what kind of protocols we need to communicate with it.
*
* Warning: this function is a bit touchy and there are some subtle dependencies within the logic flow.
* Edit with care.
*
* @deprecated Use Friendica\Network\Probe instead
*
* @see Friendica\Network\Probe::uri()
*
* @param string $url Any URI
* @param int $mode One of the PROBE_* constants
* @return array Same data array returned by Friendica\Network\Probe::uri()
*/
function probe_url($url, $mode = PROBE_NORMAL) {
if ($mode == PROBE_DIASPORA) {
$network = NETWORK_DIASPORA;
} else {
$network = '';
}
$data = Probe::uri($url, $network);
return $data;
}

31
mod/probe.php Normal file
View file

@ -0,0 +1,31 @@
<?php
use Friendica\App;
use Friendica\Network\Probe;
function probe_content(App $a) {
if (!local_user()) {
http_status_exit(403, array("title" => t("Public access denied."),
"description" => t("Only logged in users are permitted to perform a probing.")));
killme();
}
$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')) {
$addr = trim($_GET['addr']);
$res = Probe::uri($addr, "", 0, false);
$o .= '<pre>';
$o .= str_replace("\n", '<br />', print_r($res, true));
$o .= '</pre>';
}
return $o;
}