Review update

Rename function, move others
This commit is contained in:
Adam Magness 2018-01-27 11:13:41 -05:00
commit f04d40a37e
55 changed files with 331 additions and 326 deletions

View file

@ -12,6 +12,7 @@ use Friendica\Module\Login;
use Friendica\Protocol\DFRN;
use Friendica\Protocol\OStatus;
use Friendica\Util\Network;
use Friendica\Util\XML;
require_once 'include/items.php';
@ -99,12 +100,12 @@ function dfrn_poll_init(App $a)
);
if (DBM::is_result($r)) {
$s = Network::fetchURL($r[0]['poll'] . '?dfrn_id=' . $my_id . '&type=profile-check');
$s = Network::fetchUrl($r[0]['poll'] . '?dfrn_id=' . $my_id . '&type=profile-check');
logger("dfrn_poll: old profile returns " . $s, LOGGER_DATA);
if (strlen($s)) {
$xml = Network::parseXmlString($s);
$xml = XML::parseString($s);
if ((int) $xml->status === 1) {
$_SESSION['authenticated'] = 1;
@ -144,7 +145,7 @@ function dfrn_poll_init(App $a)
dbesc($sec)
);
if (!DBM::is_result($r)) {
Network::xmlStatus(3, 'No ticket');
Network::xmlExit(3, 'No ticket');
// NOTREACHED
}
@ -157,7 +158,7 @@ function dfrn_poll_init(App $a)
intval($r[0]['cid'])
);
if (!DBM::is_result($c)) {
Network::xmlStatus(3, 'No profile');
Network::xmlExit(3, 'No profile');
}
$contact = $c[0];
@ -184,7 +185,7 @@ function dfrn_poll_init(App $a)
if ($final_dfrn_id != $orig_id) {
logger('profile_check: ' . $final_dfrn_id . ' != ' . $orig_id, LOGGER_DEBUG);
// did not decode properly - cannot trust this site
Network::xmlStatus(3, 'Bad decryption');
Network::xmlExit(3, 'Bad decryption');
}
header("Content-type: text/xml");
@ -208,10 +209,10 @@ function dfrn_poll_init(App $a)
$r = q("SELECT * FROM `profile_check` WHERE `dfrn_id` = '%s' ORDER BY `expire` DESC",
dbesc($dfrn_id));
if (DBM::is_result($r)) {
Network::xmlStatus(1);
Network::xmlExit(1);
return; // NOTREACHED
}
Network::xmlStatus(0);
Network::xmlExit(0);
return; // NOTREACHED
}
}
@ -236,7 +237,7 @@ function dfrn_poll_post(App $a)
dbesc($sec)
);
if (!DBM::is_result($r)) {
Network::xmlStatus(3, 'No ticket');
Network::xmlExit(3, 'No ticket');
// NOTREACHED
}
@ -249,7 +250,7 @@ function dfrn_poll_post(App $a)
intval($r[0]['cid'])
);
if (!DBM::is_result($c)) {
Network::xmlStatus(3, 'No profile');
Network::xmlExit(3, 'No profile');
}
$contact = $c[0];
@ -276,7 +277,7 @@ function dfrn_poll_post(App $a)
if ($final_dfrn_id != $orig_id) {
logger('profile_check: ' . $final_dfrn_id . ' != ' . $orig_id, LOGGER_DEBUG);
// did not decode properly - cannot trust this site
Network::xmlStatus(3, 'Bad decryption');
Network::xmlExit(3, 'Bad decryption');
}
header("Content-type: text/xml");
@ -482,7 +483,7 @@ function dfrn_poll_content(App $a)
if (($type === 'profile') && (strlen($sec))) {
// URL reply
if ($dfrn_version < 2.2) {
$s = Network::fetchURL($r[0]['poll']
$s = Network::fetchUrl($r[0]['poll']
. '?dfrn_id=' . $encrypted_id
. '&type=profile-check'
. '&dfrn_version=' . DFRN_PROTOCOL_VERSION
@ -490,7 +491,7 @@ function dfrn_poll_content(App $a)
. '&sec=' . $sec
);
} else {
$s = Network::postURL($r[0]['poll'], [
$s = Network::post($r[0]['poll'], [
'dfrn_id' => $encrypted_id,
'type' => 'profile-check',
'dfrn_version' => DFRN_PROTOCOL_VERSION,
@ -521,7 +522,7 @@ function dfrn_poll_content(App $a)
logger("dfrn_poll: sec profile: " . $s, LOGGER_DATA);
if (strlen($s) && strstr($s, '<?xml')) {
$xml = Network::parseXmlString($s);
$xml = XML::parseString($s);
logger('dfrn_poll: profile: parsed xml: ' . print_r($xml, true), LOGGER_DATA);