<?php
/**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2021, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
// NOTREACHED
}
- unfollow_process();
+ $url = Strings::escapeTags(trim($_REQUEST['url'] ?? ''));
+
+ unfollow_process($url);
}
function unfollow_content(App $a)
// NOTREACHED
}
- if (!empty($_REQUEST['auto'])) {
- unfollow_process();
- }
-
$uid = local_user();
$url = Strings::escapeTags(trim($_REQUEST['url']));
local_user(), Contact::SHARING, Contact::FRIEND, Strings::normaliseLink($url),
Strings::normaliseLink($url), $url];
- $contact = DBA::selectFirst('contact', ['url', 'network', 'addr', 'name'], $condition);
+ $contact = DBA::selectFirst('contact', ['url', 'id', 'uid', 'network', 'addr', 'name'], $condition);
if (!DBA::isResult($contact)) {
notice(DI::l10n()->t("You aren't following this contact."));
// Makes the connection request for friendica contacts easier
$_SESSION['fastlane'] = $contact['url'];
+ if (!empty($_REQUEST['auto'])) {
+ unfollow_process($contact['url']);
+ }
+
$o = Renderer::replaceMacros($tpl, [
'$header' => DI::l10n()->t('Disconnect/Unfollow'),
'$page_desc' => '',
'$submit' => DI::l10n()->t('Submit Request'),
'$cancel' => DI::l10n()->t('Cancel'),
'$url' => $contact['url'],
- '$zrl' => Contact::magicLink($contact['url']),
+ '$zrl' => Contact::magicLinkByContact($contact),
'$url_label' => DI::l10n()->t('Profile URL'),
'$myaddr' => $self['url'],
'$request' => $request,
return $o;
}
-function unfollow_process()
+function unfollow_process(string $url)
{
$base_return_path = 'contact';
$uid = local_user();
- $url = Strings::escapeTags(trim($_REQUEST['url'] ?? ''));
$condition = ["`uid` = ? AND (`rel` = ? OR `rel` = ?) AND (`nurl` = ? OR `alias` = ? OR `alias` = ?)",
$uid, Contact::SHARING, Contact::FRIEND, Strings::normaliseLink($url),