]> git.mxchange.org Git - friendica.git/blobdiff - mod/dfrn_confirm.php
Merge pull request #6204 from annando/escaping
[friendica.git] / mod / dfrn_confirm.php
index 8c897c76d643ffd626ee612f8750cc93385d7ebb..48c8e32e5a431ff1a767c317f7cf1cc0f91b87f4 100644 (file)
@@ -33,6 +33,7 @@ use Friendica\Protocol\ActivityPub;
 use Friendica\Util\Crypto;
 use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Network;
+use Friendica\Util\Strings;
 use Friendica\Util\XML;
 
 require_once 'include/enotify.php';
@@ -84,7 +85,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
                        $cid      = 0;
                        $hidden   = intval(defaults($handsfree, 'hidden'  , 0));
                } else {
-                       $dfrn_id  = notags(trim(defaults($_POST, 'dfrn_id'   , '')));
+                       $dfrn_id  = Strings::escapeTags(trim(defaults($_POST, 'dfrn_id'   , '')));
                        $intro_id =      intval(defaults($_POST, 'intro_id'  , 0));
                        $duplex   =      intval(defaults($_POST, 'duplex'    , 0));
                        $cid      =      intval(defaults($_POST, 'contact_id', 0));
@@ -212,7 +213,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
                                $params['page'] = 2;
                        }
 
-                       Logger::log('Confirm: posting data to ' . $dfrn_confirm . ': ' . print_r($params, true), LOGGER_DATA);
+                       Logger::log('Confirm: posting data to ' . $dfrn_confirm . ': ' . print_r($params, true), Logger::DATA);
 
                        /*
                         *
@@ -224,7 +225,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
 
                        $res = Network::post($dfrn_confirm, $params, null, $redirects, 120)->getBody();
 
-                       Logger::log(' Confirm: received data: ' . $res, LOGGER_DATA);
+                       Logger::log(' Confirm: received data: ' . $res, Logger::DATA);
 
                        // Now figure out what they responded. Try to be robust if the remote site is
                        // having difficulty and throwing up errors of some kind.
@@ -256,14 +257,14 @@ function dfrn_confirm_post(App $a, $handsfree = null)
 
                        $xml = XML::parseString($res);
                        $status = (int) $xml->status;
-                       $message = unxmlify($xml->message);   // human readable text of what may have gone wrong.
+                       $message = XML::unescape($xml->message);   // human readable text of what may have gone wrong.
                        switch ($status) {
                                case 0:
                                        info(L10n::t("Confirmation completed successfully.") . EOL);
                                        break;
                                case 1:
                                        // birthday paradox - generate new dfrn-id and fall through.
-                                       $new_dfrn_id = random_string();
+                                       $new_dfrn_id = Strings::getRandomHex();
                                        q("UPDATE contact SET `issued-id` = '%s' WHERE `id` = %d AND `uid` = %d",
                                                DBA::escape($new_dfrn_id),
                                                intval($contact_id),
@@ -430,7 +431,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
 
                Logger::log('dfrn_confirm: requestee contacted: ' . $node);
 
-               Logger::log('dfrn_confirm: request: POST=' . print_r($_POST, true), LOGGER_DATA);
+               Logger::log('dfrn_confirm: request: POST=' . print_r($_POST, true), Logger::DATA);
 
                // If $aes_key is set, both of these items require unpacking from the hex transport encoding.