Source cleaning mod/unfollow.php
- Normalize quotes - Remove unneeded EOL - Use DBA method where tasteful
This commit is contained in:
parent
b81eaec885
commit
55c676d8b0
|
@ -11,21 +11,22 @@ use Friendica\Database\DBA;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Model\Profile;
|
use Friendica\Model\Profile;
|
||||||
|
|
||||||
function unfollow_post(App $a)
|
function unfollow_post()
|
||||||
{
|
{
|
||||||
|
$return_url = $_SESSION['return_url'];
|
||||||
|
|
||||||
if (!local_user()) {
|
if (!local_user()) {
|
||||||
notice(L10n::t('Permission denied.') . EOL);
|
notice(L10n::t('Permission denied.'));
|
||||||
goaway($_SESSION['return_url']);
|
goaway($return_url);
|
||||||
// NOTREACHED
|
// NOTREACHED
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_REQUEST['cancel']) {
|
if ($_REQUEST['cancel']) {
|
||||||
goaway($_SESSION['return_url']);
|
goaway($return_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
$uid = local_user();
|
$uid = local_user();
|
||||||
$url = notags(trim($_REQUEST['url']));
|
$url = notags(trim(defaults($_REQUEST, 'url', '')));
|
||||||
$return_url = $_SESSION['return_url'];
|
|
||||||
|
|
||||||
$condition = ["`uid` = ? AND (`rel` = ? OR `rel` = ?) AND (`nurl` = ? OR `alias` = ? OR `alias` = ?) AND `network` != ?",
|
$condition = ["`uid` = ? AND (`rel` = ? OR `rel` = ?) AND (`nurl` = ? OR `alias` = ? OR `alias` = ?) AND `network` != ?",
|
||||||
$uid, Contact::SHARING, Contact::FRIEND, normalise_link($url),
|
$uid, Contact::SHARING, Contact::FRIEND, normalise_link($url),
|
||||||
|
@ -70,8 +71,8 @@ function unfollow_post(App $a)
|
||||||
|
|
||||||
function unfollow_content(App $a)
|
function unfollow_content(App $a)
|
||||||
{
|
{
|
||||||
if (! local_user()) {
|
if (!local_user()) {
|
||||||
notice(L10n::t('Permission denied.') . EOL);
|
notice(L10n::t('Permission denied.'));
|
||||||
goaway($_SESSION['return_url']);
|
goaway($_SESSION['return_url']);
|
||||||
// NOTREACHED
|
// NOTREACHED
|
||||||
}
|
}
|
||||||
|
@ -79,8 +80,6 @@ function unfollow_content(App $a)
|
||||||
$uid = local_user();
|
$uid = local_user();
|
||||||
$url = notags(trim($_REQUEST['url']));
|
$url = notags(trim($_REQUEST['url']));
|
||||||
|
|
||||||
$submit = L10n::t('Submit Request');
|
|
||||||
|
|
||||||
$condition = ["`uid` = ? AND (`rel` = ? OR `rel` = ?) AND (`nurl` = ? OR `alias` = ? OR `alias` = ?)",
|
$condition = ["`uid` = ? AND (`rel` = ? OR `rel` = ?) AND (`nurl` = ? OR `alias` = ? OR `alias` = ?)",
|
||||||
local_user(), Contact::SHARING, Contact::FRIEND, normalise_link($url),
|
local_user(), Contact::SHARING, Contact::FRIEND, normalise_link($url),
|
||||||
normalise_link($url), $url];
|
normalise_link($url), $url];
|
||||||
|
@ -99,58 +98,56 @@ function unfollow_content(App $a)
|
||||||
// NOTREACHED
|
// NOTREACHED
|
||||||
}
|
}
|
||||||
|
|
||||||
$request = System::baseUrl()."/unfollow";
|
$request = System::baseUrl() . '/unfollow';
|
||||||
$tpl = get_markup_template('auto_request.tpl');
|
$tpl = get_markup_template('auto_request.tpl');
|
||||||
|
|
||||||
$r = q("SELECT `url` FROM `contact` WHERE `uid` = %d AND `self` LIMIT 1", intval($uid));
|
$self = DBA::selectFirst('contact', ['url'], ['uid' => $uid, 'self' => true]);
|
||||||
|
|
||||||
if (!$r) {
|
if (!DBA::isResult($self)) {
|
||||||
notice(L10n::t('Permission denied.') . EOL);
|
notice(L10n::t('Permission denied.'));
|
||||||
goaway($_SESSION['return_url']);
|
goaway($_SESSION['return_url']);
|
||||||
// NOTREACHED
|
// NOTREACHED
|
||||||
}
|
}
|
||||||
|
|
||||||
$myaddr = $r[0]["url"];
|
|
||||||
|
|
||||||
// Makes the connection request for friendica contacts easier
|
// Makes the connection request for friendica contacts easier
|
||||||
$_SESSION["fastlane"] = $contact["url"];
|
$_SESSION['fastlane'] = $contact['url'];
|
||||||
|
|
||||||
$header = L10n::t("Disconnect/Unfollow");
|
$header = L10n::t('Disconnect/Unfollow');
|
||||||
|
|
||||||
$o = replace_macros($tpl, [
|
$o = replace_macros($tpl, [
|
||||||
'$header' => htmlentities($header),
|
'$header' => htmlentities($header),
|
||||||
'$desc' => "",
|
'$desc' => '',
|
||||||
'$pls_answer' => "",
|
'$pls_answer' => '',
|
||||||
'$does_know_you' => "",
|
'$does_know_you' => '',
|
||||||
'$add_note' => "",
|
'$add_note' => '',
|
||||||
'$page_desc' => "",
|
'$page_desc' => '',
|
||||||
'$friendica' => "",
|
'$friendica' => '',
|
||||||
'$statusnet' => "",
|
'$statusnet' => '',
|
||||||
'$diaspora' => "",
|
'$diaspora' => '',
|
||||||
'$diasnote' => "",
|
'$diasnote' => '',
|
||||||
'$your_address' => L10n::t('Your Identity Address:'),
|
'$your_address' => L10n::t('Your Identity Address:'),
|
||||||
'$invite_desc' => "",
|
'$invite_desc' => '',
|
||||||
'$emailnet' => "",
|
'$emailnet' => '',
|
||||||
'$submit' => $submit,
|
'$submit' => L10n::t('Submit Request'),
|
||||||
'$cancel' => L10n::t('Cancel'),
|
'$cancel' => L10n::t('Cancel'),
|
||||||
'$nickname' => "",
|
'$nickname' => '',
|
||||||
'$name' => $contact["name"],
|
'$name' => $contact['name'],
|
||||||
'$url' => $contact["url"],
|
'$url' => $contact['url'],
|
||||||
'$zrl' => Contact::magicLink($contact["url"]),
|
'$zrl' => Contact::magicLink($contact['url']),
|
||||||
'$url_label' => L10n::t("Profile URL"),
|
'$url_label' => L10n::t('Profile URL'),
|
||||||
'$myaddr' => $myaddr,
|
'$myaddr' => $self['url'],
|
||||||
'$request' => $request,
|
'$request' => $request,
|
||||||
'$keywords' => "",
|
'$keywords' => '',
|
||||||
'$keywords_label' => ""
|
'$keywords_label'=> ''
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$a->page['aside'] = "";
|
$a->page['aside'] = '';
|
||||||
Profile::load($a, "", 0, Contact::getDetailsByURL($contact["url"]));
|
Profile::load($a, '', 0, Contact::getDetailsByURL($contact['url']));
|
||||||
|
|
||||||
$o .= replace_macros(get_markup_template('section_title.tpl'), ['$title' => L10n::t('Status Messages and Posts')]);
|
$o .= replace_macros(get_markup_template('section_title.tpl'), ['$title' => L10n::t('Status Messages and Posts')]);
|
||||||
|
|
||||||
// Show last public posts
|
// Show last public posts
|
||||||
$o .= Contact::getPostsFromUrl($contact["url"]);
|
$o .= Contact::getPostsFromUrl($contact['url']);
|
||||||
|
|
||||||
return $o;
|
return $o;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user