-use Friendica\Protocol\Dfrn;
-
-require_once('include/items.php');
-require_once('include/auth.php');
-require_once('include/ostatus.php');
-
-function dfrn_poll_init(App $a) {
- $dfrn_id = ((x($_GET,'dfrn_id')) ? $_GET['dfrn_id'] : '');
- $type = ((x($_GET,'type')) ? $_GET['type'] : 'data');
- $last_update = ((x($_GET,'last_update')) ? $_GET['last_update'] : '');
- $destination_url = ((x($_GET,'destination_url')) ? $_GET['destination_url'] : '');
- $challenge = ((x($_GET,'challenge')) ? $_GET['challenge'] : '');
- $sec = ((x($_GET,'sec')) ? $_GET['sec'] : '');
- $dfrn_version = ((x($_GET,'dfrn_version')) ? (float) $_GET['dfrn_version'] : 2.0);
- $perm = ((x($_GET,'perm')) ? $_GET['perm'] : 'r');
- $quiet = ((x($_GET,'quiet')) ? true : false);
+use Friendica\Core\Session;
+use Friendica\Database\DBA;
+use Friendica\DI;
+use Friendica\Protocol\DFRN;
+use Friendica\Protocol\OStatus;
+use Friendica\Util\Network;
+use Friendica\Util\Strings;
+use Friendica\Util\XML;
+
+function dfrn_poll_init(App $a)
+{
+ DI::auth()->withSession($a);
+
+ $dfrn_id = $_GET['dfrn_id'] ?? '';
+ $type = ($_GET['type'] ?? '') ?: 'data';
+ $last_update = $_GET['last_update'] ?? '';
+ $destination_url = $_GET['destination_url'] ?? '';
+ $challenge = $_GET['challenge'] ?? '';
+ $sec = $_GET['sec'] ?? '';
+ $dfrn_version = floatval(($_GET['dfrn_version'] ?? 0.0) ?: 2.0);
+ $quiet = !empty($_GET['quiet']);