2019-05-18 22:17:57 +02:00
|
|
|
<?php
|
2024-08-24 15:27:00 +02:00
|
|
|
|
|
|
|
// Copyright (C) 2010-2024, the Friendica project
|
|
|
|
// SPDX-FileCopyrightText: 2010-2024 the Friendica project
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
2019-05-18 22:17:57 +02:00
|
|
|
|
|
|
|
namespace Friendica\Module;
|
|
|
|
|
|
|
|
use Friendica\BaseModule;
|
2019-12-15 22:34:11 +01:00
|
|
|
use Friendica\DI;
|
2019-05-18 22:17:57 +02:00
|
|
|
use Friendica\Model\Contact;
|
|
|
|
|
|
|
|
/**
|
2019-05-19 03:12:22 +02:00
|
|
|
* Redirects to a random Friendica profile this node knows about
|
2019-05-18 22:17:57 +02:00
|
|
|
*/
|
|
|
|
class RandomProfile extends BaseModule
|
|
|
|
{
|
2021-11-20 15:38:03 +01:00
|
|
|
protected function content(array $request = []): string
|
2019-05-18 22:17:57 +02:00
|
|
|
{
|
2024-11-17 20:00:34 +00:00
|
|
|
$appHelper = DI::appHelper();
|
2019-05-18 22:17:57 +02:00
|
|
|
|
2021-02-17 18:59:19 +00:00
|
|
|
$contact = Contact::getRandomContact();
|
2019-05-18 22:17:57 +02:00
|
|
|
|
2021-02-17 18:59:19 +00:00
|
|
|
if (!empty($contact)) {
|
|
|
|
$link = Contact::magicLinkByContact($contact);
|
2024-11-10 16:19:02 +00:00
|
|
|
$appHelper->redirect($link);
|
2019-05-18 22:17:57 +02:00
|
|
|
}
|
|
|
|
|
2019-12-16 00:28:31 +01:00
|
|
|
DI::baseUrl()->redirect('profile');
|
2021-11-14 23:13:47 +01:00
|
|
|
|
|
|
|
return '';
|
2019-05-18 22:17:57 +02:00
|
|
|
}
|
|
|
|
}
|