Merge pull request #12083 from MrPetovan/task/4090-move-mod-unfollow
Move mod/unfollow.php to src/Module
This commit is contained in:
commit
170d776a2b
11 changed files with 315 additions and 273 deletions
|
@ -143,7 +143,7 @@ function follow_content(App $a)
|
|||
'$submit' => $submit,
|
||||
'$cancel' => DI::l10n()->t('Cancel'),
|
||||
|
||||
'$request' => $request,
|
||||
'$action' => $request,
|
||||
'$name' => $contact['name'],
|
||||
'$url' => $contact['url'],
|
||||
'$zrl' => Profile::zrl($contact['url']),
|
||||
|
|
151
mod/unfollow.php
151
mod/unfollow.php
|
@ -1,151 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2022, the Friendica project
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Widget;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
function unfollow_post(App $a)
|
||||
{
|
||||
if (!DI::userSession()->getLocalUserId()) {
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
DI::baseUrl()->redirect('login');
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
$url = trim($_REQUEST['url'] ?? '');
|
||||
|
||||
unfollow_process($url);
|
||||
}
|
||||
|
||||
function unfollow_content(App $a)
|
||||
{
|
||||
$base_return_path = 'contact';
|
||||
|
||||
if (!DI::userSession()->getLocalUserId()) {
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
DI::baseUrl()->redirect('login');
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
$uid = DI::userSession()->getLocalUserId();
|
||||
$url = trim($_REQUEST['url']);
|
||||
|
||||
$condition = ["`uid` = ? AND (`rel` = ? OR `rel` = ?) AND (`nurl` = ? OR `alias` = ? OR `alias` = ?)",
|
||||
DI::userSession()->getLocalUserId(), Contact::SHARING, Contact::FRIEND, Strings::normaliseLink($url),
|
||||
Strings::normaliseLink($url), $url];
|
||||
|
||||
$contact = DBA::selectFirst('contact', ['url', 'id', 'uid', 'network', 'addr', 'name'], $condition);
|
||||
|
||||
if (!DBA::isResult($contact)) {
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t("You aren't following this contact."));
|
||||
DI::baseUrl()->redirect($base_return_path);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
if (!Protocol::supportsFollow($contact['network'])) {
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Unfollowing is currently not supported by your network.'));
|
||||
DI::baseUrl()->redirect($base_return_path . '/' . $contact['id']);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
$request = DI::baseUrl() . '/unfollow';
|
||||
$tpl = Renderer::getMarkupTemplate('auto_request.tpl');
|
||||
|
||||
$self = DBA::selectFirst('contact', ['url'], ['uid' => $uid, 'self' => true]);
|
||||
|
||||
if (!DBA::isResult($self)) {
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
DI::baseUrl()->redirect($base_return_path);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
if (!empty($_REQUEST['auto'])) {
|
||||
unfollow_process($contact['url']);
|
||||
}
|
||||
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$header' => DI::l10n()->t('Disconnect/Unfollow'),
|
||||
'$page_desc' => '',
|
||||
'$your_address' => DI::l10n()->t('Your Identity Address:'),
|
||||
'$invite_desc' => '',
|
||||
'$submit' => DI::l10n()->t('Submit Request'),
|
||||
'$cancel' => DI::l10n()->t('Cancel'),
|
||||
'$url' => $contact['url'],
|
||||
'$zrl' => Contact::magicLinkByContact($contact),
|
||||
'$url_label' => DI::l10n()->t('Profile URL'),
|
||||
'$myaddr' => $self['url'],
|
||||
'$request' => $request,
|
||||
'$keywords' => '',
|
||||
'$keywords_label'=> ''
|
||||
]);
|
||||
|
||||
DI::page()['aside'] = Widget\VCard::getHTML(Contact::getByURL($contact['url'], false));
|
||||
|
||||
$o .= Renderer::replaceMacros(Renderer::getMarkupTemplate('section_title.tpl'), ['$title' => DI::l10n()->t('Status Messages and Posts')]);
|
||||
|
||||
// Show last public posts
|
||||
$o .= Contact::getPostsFromUrl($contact['url']);
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
||||
function unfollow_process(string $url)
|
||||
{
|
||||
$base_return_path = 'contact';
|
||||
|
||||
$uid = DI::userSession()->getLocalUserId();
|
||||
|
||||
$owner = User::getOwnerDataById($uid);
|
||||
if (!$owner) {
|
||||
throw new \Friendica\Network\HTTPException\NotFoundException();
|
||||
}
|
||||
|
||||
$condition = ["`uid` = ? AND (`rel` = ? OR `rel` = ?) AND (`nurl` = ? OR `alias` = ? OR `alias` = ?)",
|
||||
$uid, Contact::SHARING, Contact::FRIEND, Strings::normaliseLink($url),
|
||||
Strings::normaliseLink($url), $url];
|
||||
$contact = DBA::selectFirst('contact', [], $condition);
|
||||
|
||||
if (!DBA::isResult($contact)) {
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t("You aren't following this contact."));
|
||||
DI::baseUrl()->redirect($base_return_path);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
$return_path = $base_return_path . '/' . $contact['id'];
|
||||
|
||||
try {
|
||||
Contact::unfollow($contact);
|
||||
$notice_message = DI::l10n()->t('Contact was successfully unfollowed');
|
||||
} catch (Exception $e) {
|
||||
DI::logger()->error($e->getMessage(), ['contact' => $contact]);
|
||||
$notice_message = DI::l10n()->t('Unable to unfollow this contact, please contact your administrator');
|
||||
}
|
||||
|
||||
DI::sysmsg()->addNotice($notice_message);
|
||||
DI::baseUrl()->redirect($return_path);
|
||||
}
|
|
@ -70,7 +70,7 @@ class VCard
|
|||
$rel = $contact['rel'];
|
||||
$pending = $contact['pending'];
|
||||
} else {
|
||||
$pcontact = Contact::selectFirst([], ['uid' => DI::userSession()->getLocalUserId(), 'uri-id' => $contact['uri-id']]);
|
||||
$pcontact = Contact::selectFirst([], ['uid' => DI::userSession()->getLocalUserId(), 'uri-id' => $contact['uri-id'], 'deleted' => false]);
|
||||
|
||||
$id = $pcontact['id'] ?? 0;
|
||||
$rel = $pcontact['rel'] ?? Contact::NOTHING;
|
||||
|
@ -83,7 +83,7 @@ class VCard
|
|||
|
||||
if (empty($contact['self']) && Protocol::supportsFollow($contact['network'])) {
|
||||
if (in_array($rel, [Contact::SHARING, Contact::FRIEND])) {
|
||||
$unfollow_link = 'unfollow?url=' . urlencode($contact['url']) . '&auto=1';
|
||||
$unfollow_link = 'contact/unfollow?url=' . urlencode($contact['url']) . '&auto=1';
|
||||
} elseif (!$pending) {
|
||||
$follow_link = 'follow?url=' . urlencode($contact['url']) . '&auto=1';
|
||||
}
|
||||
|
|
|
@ -902,7 +902,7 @@ class Contact
|
|||
self::clearFollowerFollowingEndpointCache($contact['uid']);
|
||||
|
||||
// Archive the contact
|
||||
self::update(['archive' => true, 'network' => Protocol::PHANTOM, 'deleted' => true], ['id' => $id]);
|
||||
self::update(['archive' => true, 'network' => Protocol::PHANTOM, 'rel' => self::NOTHING, 'deleted' => true], ['id' => $id]);
|
||||
|
||||
if (!DBA::exists('contact', ['uri-id' => $contact['uri-id'], 'deleted' => false])) {
|
||||
Avatar::deleteCache($contact);
|
||||
|
@ -1176,7 +1176,7 @@ class Contact
|
|||
$unfollow_link = '';
|
||||
if (!$contact['self'] && Protocol::supportsFollow($contact['network'])) {
|
||||
if ($contact['uid'] && in_array($contact['rel'], [self::SHARING, self::FRIEND])) {
|
||||
$unfollow_link = 'unfollow?url=' . urlencode($contact['url']) . '&auto=1';
|
||||
$unfollow_link = 'contact/unfollow?url=' . urlencode($contact['url']) . '&auto=1';
|
||||
} elseif(!$contact['pending']) {
|
||||
$follow_link = 'follow?url=' . urlencode($contact['url']) . '&auto=1';
|
||||
}
|
||||
|
|
|
@ -335,13 +335,13 @@ class Profile
|
|||
if (!$visitor_is_authenticated) {
|
||||
// Remote follow is only available for local profiles
|
||||
if (!empty($profile['nickname']) && strpos($profile_url, DI::baseUrl()->get()) === 0) {
|
||||
$follow_link = 'remote_follow/' . $profile['nickname'];
|
||||
$follow_link = 'profile/' . $profile['nickname'] . '/remote_follow';
|
||||
}
|
||||
} else {
|
||||
if ($visitor_is_following) {
|
||||
$unfollow_link = $visitor_base_path . '/unfollow?url=' . urlencode($profile_url) . '&auto=1';
|
||||
$unfollow_link = $visitor_base_path . '/contact/unfollow?url=' . urlencode($profile_url) . '&auto=1';
|
||||
} else {
|
||||
$follow_link = $visitor_base_path .'/follow?url=' . urlencode($profile_url) . '&auto=1';
|
||||
$follow_link = $visitor_base_path . '/follow?url=' . urlencode($profile_url) . '&auto=1';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
184
src/Module/Contact/Unfollow.php
Normal file
184
src/Module/Contact/Unfollow.php
Normal file
|
@ -0,0 +1,184 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2022, the Friendica project
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Friendica\Module\Contact;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Widget;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session\Capability\IHandleUserSessions;
|
||||
use Friendica\Database\Database;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Module\Response;
|
||||
use Friendica\Navigation\SystemMessages;
|
||||
use Friendica\Util\Profiler;
|
||||
use Friendica\Util\Strings;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class Unfollow extends \Friendica\BaseModule
|
||||
{
|
||||
/** @var IHandleUserSessions */
|
||||
private $userSession;
|
||||
|
||||
/** @var SystemMessages */
|
||||
private $systemMessages;
|
||||
|
||||
/** @var Database */
|
||||
private $database;
|
||||
|
||||
/** @var App\Page */
|
||||
private $page;
|
||||
|
||||
public function __construct(App\Page $page, Database $database, SystemMessages $systemMessages, IHandleUserSessions $userSession, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, array $server, array $parameters = [])
|
||||
{
|
||||
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
|
||||
|
||||
$this->userSession = $userSession;
|
||||
$this->systemMessages = $systemMessages;
|
||||
$this->database = $database;
|
||||
$this->page = $page;
|
||||
}
|
||||
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
if (!$this->userSession->getLocalUserId()) {
|
||||
$this->systemMessages->addNotice($this->t('Permission denied.'));
|
||||
$this->baseUrl->redirect('login');
|
||||
}
|
||||
|
||||
$url = trim($request['url'] ?? '');
|
||||
|
||||
$this->process($url);
|
||||
}
|
||||
|
||||
protected function content(array $request = []): string
|
||||
{
|
||||
$base_return_path = 'contact';
|
||||
|
||||
if (!$this->userSession->getLocalUserId()) {
|
||||
$this->systemMessages->addNotice($this->t('Permission denied.'));
|
||||
$this->baseUrl->redirect('login');
|
||||
}
|
||||
|
||||
$uid = $this->userSession->getLocalUserId();
|
||||
$url = trim($request['url']);
|
||||
|
||||
$condition = [
|
||||
"`uid` = ?
|
||||
AND (`rel` = ? OR `rel` = ?)
|
||||
AND (`nurl` = ? OR `alias` = ? OR `alias` = ?)",
|
||||
$this->userSession->getLocalUserId(),
|
||||
Contact::SHARING, Contact::FRIEND,
|
||||
Strings::normaliseLink($url), Strings::normaliseLink($url), $url,
|
||||
];
|
||||
|
||||
$contact = $this->database->selectFirst('contact', ['url', 'id', 'uid', 'network', 'addr', 'name'], $condition);
|
||||
if (!$this->database->isResult($contact)) {
|
||||
$this->systemMessages->addNotice($this->t("You aren't following this contact."));
|
||||
$this->baseUrl->redirect($base_return_path);
|
||||
}
|
||||
|
||||
if (!Protocol::supportsFollow($contact['network'])) {
|
||||
$this->systemMessages->addNotice($this->t('Unfollowing is currently not supported by your network.'));
|
||||
$this->baseUrl->redirect($base_return_path . '/' . $contact['id']);
|
||||
}
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate('auto_request.tpl');
|
||||
|
||||
$self = $this->database->selectFirst('contact', ['url'], ['uid' => $uid, 'self' => true]);
|
||||
|
||||
if (!$this->database->isResult($self)) {
|
||||
$this->systemMessages->addNotice($this->t('Permission denied.'));
|
||||
$this->baseUrl->redirect($base_return_path);
|
||||
}
|
||||
|
||||
if (!empty($request['auto'])) {
|
||||
$this->process($contact['url']);
|
||||
}
|
||||
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$header' => $this->t('Disconnect/Unfollow'),
|
||||
'$page_desc' => '',
|
||||
'$your_address' => $this->t('Your Identity Address:'),
|
||||
'$invite_desc' => '',
|
||||
'$submit' => $this->t('Submit Request'),
|
||||
'$cancel' => $this->t('Cancel'),
|
||||
'$url' => $contact['url'],
|
||||
'$zrl' => Contact::magicLinkByContact($contact),
|
||||
'$url_label' => $this->t('Profile URL'),
|
||||
'$myaddr' => $self['url'],
|
||||
'$action' => $this->baseUrl . '/contact/unfollow',
|
||||
'$keywords' => '',
|
||||
'$keywords_label' => ''
|
||||
]);
|
||||
|
||||
$this->page['aside'] = Widget\VCard::getHTML(Contact::getByURL($contact['url'], false));
|
||||
|
||||
$o .= Renderer::replaceMacros(Renderer::getMarkupTemplate('section_title.tpl'), ['$title' => $this->t('Status Messages and Posts')]);
|
||||
|
||||
// Show last public posts
|
||||
$o .= Contact::getPostsFromUrl($contact['url']);
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
||||
private function process(string $url): void
|
||||
{
|
||||
$base_return_path = 'contact';
|
||||
|
||||
$uid = $this->userSession->getLocalUserId();
|
||||
|
||||
$owner = User::getOwnerDataById($uid);
|
||||
if (!$owner) {
|
||||
throw new \Friendica\Network\HTTPException\NotFoundException();
|
||||
}
|
||||
|
||||
$condition = [
|
||||
"`uid` = ?
|
||||
AND (`rel` = ? OR `rel` = ?)
|
||||
AND (`nurl` = ? OR `alias` = ? OR `alias` = ?)",
|
||||
$uid, Contact::SHARING, Contact::FRIEND,
|
||||
Strings::normaliseLink($url), Strings::normaliseLink($url), $url,
|
||||
];
|
||||
$contact = $this->database->selectFirst('contact', [], $condition);
|
||||
|
||||
if (!$this->database->isResult($contact)) {
|
||||
$this->systemMessages->addNotice($this->t("You aren't following this contact."));
|
||||
$this->baseUrl->redirect($base_return_path);
|
||||
}
|
||||
|
||||
$return_path = $base_return_path . '/' . $contact['id'];
|
||||
|
||||
try {
|
||||
Contact::unfollow($contact);
|
||||
$notice_message = $this->t('Contact was successfully unfollowed');
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->error($e->getMessage(), ['contact' => $contact]);
|
||||
$notice_message = $this->t('Unable to unfollow this contact, please contact your administrator');
|
||||
}
|
||||
|
||||
$this->systemMessages->addNotice($notice_message);
|
||||
$this->baseUrl->redirect($return_path);
|
||||
}
|
||||
}
|
|
@ -19,7 +19,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace Friendica\Module;
|
||||
namespace Friendica\Module\Profile;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\App\Page;
|
||||
|
@ -30,11 +30,14 @@ use Friendica\Core\Logger;
|
|||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Search;
|
||||
use Friendica\Core\Session\Capability\IHandleUserSessions;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Module\Response;
|
||||
use Friendica\Navigation\SystemMessages;
|
||||
use Friendica\Network\HTTPException;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Util\Profiler;
|
||||
|
@ -45,54 +48,61 @@ use Psr\Log\LoggerInterface;
|
|||
*/
|
||||
class RemoteFollow extends BaseModule
|
||||
{
|
||||
/** @var array */
|
||||
protected $owner;
|
||||
/** @var SystemMessages */
|
||||
private $systemMessages;
|
||||
/** @var Page */
|
||||
protected $page;
|
||||
/** @var IHandleUserSessions */
|
||||
private $userSession;
|
||||
|
||||
public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, App\Page $page, LoggerInterface $logger, Profiler $profiler, Response $response, array $server, array $parameters = [])
|
||||
/** @var array */
|
||||
protected $owner;
|
||||
|
||||
public function __construct(IHandleUserSessions $userSession, SystemMessages $systemMessages, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, App\Page $page, LoggerInterface $logger, Profiler $profiler, Response $response, array $server, array $parameters = [])
|
||||
{
|
||||
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
|
||||
|
||||
$this->owner = User::getOwnerDataByNick($this->parameters['profile']);
|
||||
$this->systemMessages = $systemMessages;
|
||||
$this->page = $page;
|
||||
$this->userSession = $userSession;
|
||||
|
||||
$this->owner = User::getOwnerDataByNick($this->parameters['nickname']);
|
||||
if (!$this->owner) {
|
||||
throw new HTTPException\NotFoundException($this->t('User not found.'));
|
||||
}
|
||||
|
||||
$this->page = $page;
|
||||
}
|
||||
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
if (!empty($_POST['cancel']) || empty($_POST['dfrn_url'])) {
|
||||
$this->baseUrl->redirect();
|
||||
if (!empty($request['cancel']) || empty($request['dfrn_url'])) {
|
||||
$this->baseUrl->redirect('profile/' . $this->parameters['nickname']);
|
||||
}
|
||||
|
||||
if (empty($this->owner)) {
|
||||
DI::sysmsg()->addNotice($this->t('Profile unavailable.'));
|
||||
$this->systemMessages->addNotice($this->t('Profile unavailable.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$url = Probe::cleanURI($_POST['dfrn_url']);
|
||||
|
||||
$url = Probe::cleanURI($request['dfrn_url']);
|
||||
if (!strlen($url)) {
|
||||
DI::sysmsg()->addNotice($this->t("Invalid locator"));
|
||||
$this->systemMessages->addNotice($this->t('Invalid locator'));
|
||||
return;
|
||||
}
|
||||
|
||||
// Detect the network, make sure the provided URL is valid
|
||||
$data = Contact::getByURL($url);
|
||||
if (!$data) {
|
||||
DI::sysmsg()->addNotice($this->t("The provided profile link doesn't seem to be valid"));
|
||||
$this->systemMessages->addNotice($this->t("The provided profile link doesn't seem to be valid"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (empty($data['subscribe'])) {
|
||||
DI::sysmsg()->addNotice($this->t("Remote subscription can't be done for your network. Please subscribe directly on your system."));
|
||||
$this->systemMessages->addNotice($this->t("Remote subscription can't be done for your network. Please subscribe directly on your system."));
|
||||
return;
|
||||
}
|
||||
|
||||
Logger::notice('Remote request', ['url' => $url, 'follow' => $this->owner['url'], 'remote' => $data['subscribe']]);
|
||||
|
||||
$this->logger->notice('Remote request', ['url' => $url, 'follow' => $this->owner['url'], 'remote' => $data['subscribe']]);
|
||||
|
||||
// Substitute our user's feed URL into $data['subscribe']
|
||||
// Send the subscriber home to subscribe
|
||||
// Diaspora needs the uri in the format user@domain.tld
|
||||
|
@ -101,24 +111,20 @@ class RemoteFollow extends BaseModule
|
|||
} else {
|
||||
$uri = urlencode($this->owner['url']);
|
||||
}
|
||||
|
||||
|
||||
$follow_link = str_replace('{uri}', $uri, $data['subscribe']);
|
||||
System::externalRedirect($follow_link);
|
||||
}
|
||||
|
||||
protected function content(array $request = []): string
|
||||
{
|
||||
if (empty($this->owner)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$this->page['aside'] = Widget\VCard::getHTML($this->owner);
|
||||
|
||||
$target_addr = $this->owner['addr'];
|
||||
$target_url = $this->owner['url'];
|
||||
$target_url = $this->owner['url'];
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate('auto_request.tpl');
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
return Renderer::replaceMacros($tpl, [
|
||||
'$header' => $this->t('Friend/Connection Request'),
|
||||
'$page_desc' => $this->t('Enter your Webfinger address (user@domain.tld) or profile URL here. If this isn\'t supported by your system, you have to subscribe to <strong>%s</strong> or <strong>%s</strong> directly on your system.', $target_addr, $target_url),
|
||||
'$invite_desc' => $this->t('If you are not yet a member of the free social web, <a href="%s">follow this link to find a public Friendica node and join us today</a>.', Search::getGlobalDirectory() . '/servers'),
|
||||
|
@ -127,10 +133,9 @@ class RemoteFollow extends BaseModule
|
|||
'$submit' => $this->t('Submit Request'),
|
||||
'$cancel' => $this->t('Cancel'),
|
||||
|
||||
'$request' => 'remote_follow/' . $this->parameters['profile'],
|
||||
'$action' => 'profile/' . $this->parameters['nickname'] . '/remote_follow',
|
||||
'$name' => $this->owner['name'],
|
||||
'$myaddr' => Profile::getMyURL(),
|
||||
'$myaddr' => $this->userSession->getMyUrl(),
|
||||
]);
|
||||
return $o;
|
||||
}
|
||||
}
|
|
@ -33,14 +33,15 @@ use Friendica\Module;
|
|||
$profileRoutes = [
|
||||
'' => [Module\Profile\Index::class, [R::GET]],
|
||||
'/attachment/upload' => [Module\Profile\Attachment\Upload::class, [ R::POST]],
|
||||
'/profile' => [Module\Profile\Profile::class, [R::GET]],
|
||||
'/schedule' => [Module\Profile\Schedule::class, [R::GET, R::POST]],
|
||||
'/contacts/common' => [Module\Profile\Common::class, [R::GET]],
|
||||
'/contacts[/{type}]' => [Module\Profile\Contacts::class, [R::GET]],
|
||||
'/status[/{category}[/{date1}[/{date2}]]]' => [Module\Profile\Status::class, [R::GET]],
|
||||
'/media' => [Module\Profile\Media::class, [R::GET]],
|
||||
'/unkmail' => [Module\Profile\UnkMail::class, [R::GET, R::POST]],
|
||||
'/photos/upload' => [Module\Profile\Photos\Upload::class, [ R::POST]],
|
||||
'/profile' => [Module\Profile\Profile::class, [R::GET]],
|
||||
'/remote_follow' => [Module\Profile\RemoteFollow::class, [R::GET, R::POST]],
|
||||
'/schedule' => [Module\Profile\Schedule::class, [R::GET, R::POST]],
|
||||
'/status[/{category}[/{date1}[/{date2}]]]' => [Module\Profile\Status::class, [R::GET]],
|
||||
'/unkmail' => [Module\Profile\UnkMail::class, [R::GET, R::POST]],
|
||||
];
|
||||
|
||||
$apiRoutes = [
|
||||
|
@ -386,6 +387,7 @@ return [
|
|||
'/hidden' => [Module\Contact::class, [R::GET]],
|
||||
'/ignored' => [Module\Contact::class, [R::GET]],
|
||||
'/hovercard' => [Module\Contact\Hovercard::class, [R::GET]],
|
||||
'/unfollow' => [Module\Contact\Unfollow::class, [R::GET, R::POST]],
|
||||
],
|
||||
|
||||
'/credits' => [Module\Credits::class, [R::GET]],
|
||||
|
@ -589,7 +591,6 @@ return [
|
|||
|
||||
'/randprof' => [Module\RandomProfile::class, [R::GET]],
|
||||
'/register' => [Module\Register::class, [R::GET, R::POST]],
|
||||
'/remote_follow/{profile}' => [Module\RemoteFollow::class, [R::GET, R::POST]],
|
||||
'/robots.txt' => [Module\RobotsTxt::class, [R::GET]],
|
||||
'/rsd.xml' => [Module\ReallySimpleDiscovery::class, [R::GET]],
|
||||
'/smilies[/json]' => [Module\Smilies::class, [R::GET]],
|
||||
|
|
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: 2022.12-dev\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2022-10-31 14:54-0400\n"
|
||||
"POT-Creation-Date: 2022-10-31 15:34-0400\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -32,8 +32,9 @@ msgstr ""
|
|||
#: src/Module/HCard.php:51 src/Module/Profile/Common.php:40
|
||||
#: src/Module/Profile/Common.php:51 src/Module/Profile/Contacts.php:39
|
||||
#: src/Module/Profile/Contacts.php:49 src/Module/Profile/Media.php:38
|
||||
#: src/Module/Profile/Photos/Upload.php:87 src/Module/Profile/Status.php:58
|
||||
#: src/Module/Register.php:267 src/Module/RemoteFollow.php:59
|
||||
#: src/Module/Profile/Photos/Upload.php:87
|
||||
#: src/Module/Profile/RemoteFollow.php:71 src/Module/Profile/Status.php:58
|
||||
#: src/Module/Register.php:267
|
||||
msgid "User not found."
|
||||
msgstr ""
|
||||
|
||||
|
@ -123,13 +124,14 @@ msgstr ""
|
|||
#: mod/message.php:114 mod/notes.php:44 mod/ostatus_subscribe.php:33
|
||||
#: mod/photos.php:159 mod/photos.php:886 mod/repair_ostatus.php:31
|
||||
#: mod/settings.php:40 mod/settings.php:50 mod/settings.php:156
|
||||
#: mod/suggest.php:34 mod/uimport.php:33 mod/unfollow.php:35
|
||||
#: mod/unfollow.php:50 mod/unfollow.php:82 src/Module/Attach.php:56
|
||||
#: mod/suggest.php:34 mod/uimport.php:33 src/Module/Attach.php:56
|
||||
#: src/Module/BaseApi.php:94 src/Module/BaseNotifications.php:98
|
||||
#: src/Module/Contact/Advanced.php:60 src/Module/Delegation.php:118
|
||||
#: src/Module/FollowConfirm.php:38 src/Module/FriendSuggest.php:57
|
||||
#: src/Module/Group.php:40 src/Module/Group.php:83 src/Module/Invite.php:42
|
||||
#: src/Module/Invite.php:131 src/Module/Notifications/Notification.php:76
|
||||
#: src/Module/Contact/Advanced.php:60 src/Module/Contact/Unfollow.php:66
|
||||
#: src/Module/Contact/Unfollow.php:80 src/Module/Contact/Unfollow.php:112
|
||||
#: src/Module/Delegation.php:118 src/Module/FollowConfirm.php:38
|
||||
#: src/Module/FriendSuggest.php:57 src/Module/Group.php:40
|
||||
#: src/Module/Group.php:83 src/Module/Invite.php:42 src/Module/Invite.php:131
|
||||
#: src/Module/Notifications/Notification.php:76
|
||||
#: src/Module/Notifications/Notification.php:107
|
||||
#: src/Module/Profile/Attachment/Upload.php:97 src/Module/Profile/Common.php:55
|
||||
#: src/Module/Profile/Contacts.php:55 src/Module/Profile/Photos/Upload.php:108
|
||||
|
@ -268,8 +270,9 @@ msgstr ""
|
|||
|
||||
#: mod/editpost.php:130 mod/fbrowser.php:119 mod/fbrowser.php:146
|
||||
#: mod/follow.php:144 mod/photos.php:999 mod/photos.php:1100 mod/tagrm.php:35
|
||||
#: mod/tagrm.php:127 mod/unfollow.php:97 src/Content/Conversation.php:389
|
||||
#: src/Module/Contact/Revoke.php:109 src/Module/RemoteFollow.php:128
|
||||
#: mod/tagrm.php:127 src/Content/Conversation.php:389
|
||||
#: src/Module/Contact/Revoke.php:109 src/Module/Contact/Unfollow.php:126
|
||||
#: src/Module/Profile/RemoteFollow.php:134
|
||||
#: src/Module/Security/TwoFactor/SignOut.php:125
|
||||
msgid "Cancel"
|
||||
msgstr ""
|
||||
|
@ -449,7 +452,8 @@ msgstr ""
|
|||
msgid "Files"
|
||||
msgstr ""
|
||||
|
||||
#: mod/follow.php:74 mod/unfollow.php:96 src/Module/RemoteFollow.php:127
|
||||
#: mod/follow.php:74 src/Module/Contact/Unfollow.php:125
|
||||
#: src/Module/Profile/RemoteFollow.php:133
|
||||
msgid "Submit Request"
|
||||
msgstr ""
|
||||
|
||||
|
@ -475,17 +479,16 @@ msgstr ""
|
|||
msgid "Connect/Follow"
|
||||
msgstr ""
|
||||
|
||||
#: mod/follow.php:139 src/Module/RemoteFollow.php:126
|
||||
#: mod/follow.php:139 src/Module/Profile/RemoteFollow.php:132
|
||||
msgid "Please answer the following:"
|
||||
msgstr ""
|
||||
|
||||
#: mod/follow.php:140 mod/unfollow.php:94
|
||||
#: mod/follow.php:140 src/Module/Contact/Unfollow.php:123
|
||||
msgid "Your Identity Address:"
|
||||
msgstr ""
|
||||
|
||||
#: mod/follow.php:141 mod/unfollow.php:100
|
||||
#: src/Module/Admin/Blocklist/Contact.php:116
|
||||
#: src/Module/Contact/Profile.php:366
|
||||
#: mod/follow.php:141 src/Module/Admin/Blocklist/Contact.php:116
|
||||
#: src/Module/Contact/Profile.php:366 src/Module/Contact/Unfollow.php:129
|
||||
#: src/Module/Notifications/Introductions.php:129
|
||||
#: src/Module/Notifications/Introductions.php:198
|
||||
msgid "Profile URL"
|
||||
|
@ -506,8 +509,8 @@ msgstr ""
|
|||
msgid "Add a personal note:"
|
||||
msgstr ""
|
||||
|
||||
#: mod/follow.php:163 mod/unfollow.php:109 src/Module/BaseProfile.php:59
|
||||
#: src/Module/Contact.php:447
|
||||
#: mod/follow.php:163 src/Module/BaseProfile.php:59 src/Module/Contact.php:447
|
||||
#: src/Module/Contact/Unfollow.php:138
|
||||
msgid "Status Messages and Posts"
|
||||
msgstr ""
|
||||
|
||||
|
@ -1483,26 +1486,6 @@ msgid ""
|
|||
"select \"Export account\""
|
||||
msgstr ""
|
||||
|
||||
#: mod/unfollow.php:65 mod/unfollow.php:134
|
||||
msgid "You aren't following this contact."
|
||||
msgstr ""
|
||||
|
||||
#: mod/unfollow.php:71
|
||||
msgid "Unfollowing is currently not supported by your network."
|
||||
msgstr ""
|
||||
|
||||
#: mod/unfollow.php:92
|
||||
msgid "Disconnect/Unfollow"
|
||||
msgstr ""
|
||||
|
||||
#: mod/unfollow.php:143
|
||||
msgid "Contact was successfully unfollowed"
|
||||
msgstr ""
|
||||
|
||||
#: mod/unfollow.php:146
|
||||
msgid "Unable to unfollow this contact, please contact your administrator"
|
||||
msgstr ""
|
||||
|
||||
#: src/App.php:490
|
||||
msgid "No system theme config value set."
|
||||
msgstr ""
|
||||
|
@ -7198,6 +7181,26 @@ msgstr ""
|
|||
msgid "Yes"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Contact/Unfollow.php:98 src/Module/Contact/Unfollow.php:167
|
||||
msgid "You aren't following this contact."
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Contact/Unfollow.php:103
|
||||
msgid "Unfollowing is currently not supported by your network."
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Contact/Unfollow.php:121
|
||||
msgid "Disconnect/Unfollow"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Contact/Unfollow.php:175
|
||||
msgid "Contact was successfully unfollowed"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Contact/Unfollow.php:178
|
||||
msgid "Unable to unfollow this contact, please contact your administrator"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Conversation/Community.php:73
|
||||
msgid ""
|
||||
"This community stream shows all public posts received by this node. They may "
|
||||
|
@ -8393,6 +8396,47 @@ msgstr ""
|
|||
msgid "%s's comments"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Profile/RemoteFollow.php:82
|
||||
msgid "Profile unavailable."
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Profile/RemoteFollow.php:88
|
||||
msgid "Invalid locator"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Profile/RemoteFollow.php:95
|
||||
msgid "The provided profile link doesn't seem to be valid"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Profile/RemoteFollow.php:100
|
||||
msgid ""
|
||||
"Remote subscription can't be done for your network. Please subscribe "
|
||||
"directly on your system."
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Profile/RemoteFollow.php:128
|
||||
msgid "Friend/Connection Request"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Profile/RemoteFollow.php:129
|
||||
#, php-format
|
||||
msgid ""
|
||||
"Enter your Webfinger address (user@domain.tld) or profile URL here. If this "
|
||||
"isn't supported by your system, you have to subscribe to <strong>%s</strong> "
|
||||
"or <strong>%s</strong> directly on your system."
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Profile/RemoteFollow.php:130
|
||||
#, php-format
|
||||
msgid ""
|
||||
"If you are not yet a member of the free social web, <a href=\"%s\">follow "
|
||||
"this link to find a public Friendica node and join us today</a>."
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Profile/RemoteFollow.php:131
|
||||
msgid "Your Webfinger address or profile URL:"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Profile/Schedule.php:84
|
||||
msgid "Scheduled"
|
||||
msgstr ""
|
||||
|
@ -8585,47 +8629,6 @@ msgstr ""
|
|||
msgid "Your registration is pending approval by the site owner."
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/RemoteFollow.php:72
|
||||
msgid "Profile unavailable."
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/RemoteFollow.php:78
|
||||
msgid "Invalid locator"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/RemoteFollow.php:85
|
||||
msgid "The provided profile link doesn't seem to be valid"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/RemoteFollow.php:90
|
||||
msgid ""
|
||||
"Remote subscription can't be done for your network. Please subscribe "
|
||||
"directly on your system."
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/RemoteFollow.php:122
|
||||
msgid "Friend/Connection Request"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/RemoteFollow.php:123
|
||||
#, php-format
|
||||
msgid ""
|
||||
"Enter your Webfinger address (user@domain.tld) or profile URL here. If this "
|
||||
"isn't supported by your system, you have to subscribe to <strong>%s</strong> "
|
||||
"or <strong>%s</strong> directly on your system."
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/RemoteFollow.php:124
|
||||
#, php-format
|
||||
msgid ""
|
||||
"If you are not yet a member of the free social web, <a href=\"%s\">follow "
|
||||
"this link to find a public Friendica node and join us today</a>."
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/RemoteFollow.php:125
|
||||
msgid "Your Webfinger address or profile URL:"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Search/Acl.php:55
|
||||
msgid "You must be logged in to use this module."
|
||||
msgstr ""
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
</p>
|
||||
{{/if}}
|
||||
|
||||
<form action="{{$request}}" method="post">
|
||||
<form action="{{$action}}" method="post">
|
||||
{{if $url}}
|
||||
<dl>
|
||||
<dt>{{$url_label}}</dt>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
</p>
|
||||
{{/if}}
|
||||
|
||||
<form action="{{$request}}" method="post">
|
||||
<form action="{{$action}}" method="post">
|
||||
{{if $url}}
|
||||
<dl>
|
||||
<dt>{{$url_label}}</dt>
|
||||
|
|
Loading…
Reference in a new issue