mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-16 20:05:14 +02:00
Use magicLink whenever possible
This commit is contained in:
parent
885f2b52d1
commit
8a34895a23
23 changed files with 61 additions and 165 deletions
|
@ -70,7 +70,7 @@ function allfriends_content(App $a)
|
|||
} else {
|
||||
$connlnk = System::baseUrl() . '/follow/?url=' . $rr['url'];
|
||||
$photo_menu = [
|
||||
'profile' => [L10n::t("View Profile"), Profile::zrl($rr['url'])],
|
||||
'profile' => [L10n::t("View Profile"), Contact::magicLink($rr['url'])],
|
||||
'follow' => [L10n::t("Connect/Follow"), $connlnk]
|
||||
];
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ function contacts_init(App $a)
|
|||
$vcard_widget = replace_macros(get_markup_template("vcard-widget.tpl"), [
|
||||
'$name' => htmlentities($a->data['contact']['name']),
|
||||
'$photo' => $a->data['contact']['photo'],
|
||||
'$url' => ($a->data['contact']['network'] == NETWORK_DFRN) ? "redir/" . $a->data['contact']['id'] : $a->data['contact']['url'],
|
||||
'$url' => Contact::MagicLink($a->data['contact']['url']),
|
||||
'$addr' => (($a->data['contact']['addr'] != "") ? ($a->data['contact']['addr']) : ""),
|
||||
'$network_name' => $networkname,
|
||||
'$network' => L10n::t('Network:'),
|
||||
|
@ -536,11 +536,10 @@ function contacts_content(App $a)
|
|||
|
||||
$relation_text = sprintf($relation_text, htmlentities($contact['name']));
|
||||
|
||||
if (($contact['network'] === NETWORK_DFRN) && ($contact['rel'])) {
|
||||
$url = "redir/{$contact['id']}";
|
||||
$url = Contact::magicLink($contact['url']);
|
||||
if (strpos($url, 'redir/') === 0) {
|
||||
$sparkle = ' class="sparkle" ';
|
||||
} else {
|
||||
$url = $contact['url'];
|
||||
$sparkle = '';
|
||||
}
|
||||
|
||||
|
@ -940,11 +939,11 @@ function _contact_detail_for_template($rr)
|
|||
default:
|
||||
break;
|
||||
}
|
||||
if (($rr['network'] === NETWORK_DFRN) && ($rr['rel'])) {
|
||||
$url = "redir/{$rr['id']}";
|
||||
|
||||
$url = Contact::magicLink($rr['url']);
|
||||
if (strpos($url, 'redir/') === 0) {
|
||||
$sparkle = ' class="sparkle" ';
|
||||
} else {
|
||||
$url = $rr['url'];
|
||||
$sparkle = '';
|
||||
}
|
||||
|
||||
|
|
|
@ -189,7 +189,6 @@ function dfrn_request_post(App $a)
|
|||
}
|
||||
|
||||
// (ignore reply, nothing we can do it failed)
|
||||
// Old: goaway(Profile::zrl($dfrn_url));
|
||||
goaway($forwardurl);
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
|
|
@ -156,7 +156,7 @@ function directory_content(App $a)
|
|||
$location_e = $location;
|
||||
|
||||
$photo_menu = [
|
||||
'profile' => [L10n::t("View Profile"), Profile::zrl($profile_link)]
|
||||
'profile' => [L10n::t("View Profile"), Contact::magicLink($profile_link)]
|
||||
];
|
||||
|
||||
$entry = [
|
||||
|
|
|
@ -11,7 +11,6 @@ use Friendica\Core\System;
|
|||
use Friendica\Core\Worker;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\GContact;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Protocol\PortableContact;
|
||||
use Friendica\Util\Network;
|
||||
|
@ -214,7 +213,7 @@ function dirfind_content(App $a, $prefix = "") {
|
|||
$connlnk = System::baseUrl().'/follow/?url='.(($jj->connect) ? $jj->connect : $jj->url);
|
||||
$conntxt = L10n::t('Connect');
|
||||
$photo_menu = [
|
||||
'profile' => [L10n::t("View Profile"), Profile::zrl($jj->url)],
|
||||
'profile' => [L10n::t("View Profile"), Contact::magicLink($jj->url)],
|
||||
'follow' => [L10n::t("Connect/Follow"), $connlnk]
|
||||
];
|
||||
}
|
||||
|
@ -223,7 +222,7 @@ function dirfind_content(App $a, $prefix = "") {
|
|||
|
||||
$entry = [
|
||||
'alt_text' => $alt_text,
|
||||
'url' => Profile::magicLink($jj->url),
|
||||
'url' => Contact::magicLink($jj->url),
|
||||
'itemurl' => $itemurl,
|
||||
'name' => htmlentities($jj->name),
|
||||
'thumb' => proxy_url($jj->photo, false, PROXY_SIZE_THUMB),
|
||||
|
|
|
@ -72,7 +72,7 @@ function hovercard_content()
|
|||
'nick' => $contact['nick'],
|
||||
'addr' => defaults($contact, 'addr', $contact['url']),
|
||||
'thumb' => proxy_url($contact['thumb'], false, PROXY_SIZE_THUMB),
|
||||
'url' => $cid ? ('redir/' . $cid) : Profile::zrl($contact['url']),
|
||||
'url' => Contact::magicLink($contact['url']),
|
||||
'nurl' => $contact['nurl'], // We additionally store the nurl as identifier
|
||||
'location' => $contact['location'],
|
||||
'gender' => $contact['gender'],
|
||||
|
|
|
@ -86,14 +86,14 @@ function match_content(App $a)
|
|||
$jj->photo = str_replace("http:///photo/", get_server()."/photo/", $jj->photo);
|
||||
$connlnk = System::baseUrl() . '/follow/?url=' . $jj->url;
|
||||
$photo_menu = [
|
||||
'profile' => [L10n::t("View Profile"), Profile::zrl($jj->url)],
|
||||
'profile' => [L10n::t("View Profile"), Contact::magicLink($jj->url)],
|
||||
'follow' => [L10n::t("Connect/Follow"), $connlnk]
|
||||
];
|
||||
|
||||
$contact_details = Contact::getDetailsByURL($jj->url, local_user());
|
||||
|
||||
$entry = [
|
||||
'url' => Profile::zrl($jj->url),
|
||||
'url' => Contact::magicLink($jj->url),
|
||||
'itemurl' => (($contact_details['addr'] != "") ? $contact_details['addr'] : $jj->url),
|
||||
'name' => $jj->name,
|
||||
'details' => $contact_details['location'],
|
||||
|
|
|
@ -341,11 +341,8 @@ function message_content(App $a)
|
|||
if ($message['from-url'] == $myprofile) {
|
||||
$from_url = $myprofile;
|
||||
$sparkle = '';
|
||||
} elseif ($message['contact-id'] != 0) {
|
||||
$from_url = 'redir/' . $message['contact-id'];
|
||||
$sparkle = ' sparkle';
|
||||
} else {
|
||||
$from_url = $message['from-url'] . "?zrl=" . urlencode($myprofile);
|
||||
$from_url = Contact::magicLink($message['from-url']);
|
||||
$sparkle = ' sparkle';
|
||||
}
|
||||
|
||||
|
@ -470,7 +467,7 @@ function render_messages(array $msg, $t)
|
|||
$rslt .= replace_macros($tpl, [
|
||||
'$id' => $rr['id'],
|
||||
'$from_name' => $participants,
|
||||
'$from_url' => (($rr['network'] === NETWORK_DFRN) ? 'redir/' . $rr['contact-id'] : $rr['url']),
|
||||
'$from_url' => Contact::magicLink($rr['url']),
|
||||
'$from_addr' => $contact['addr'],
|
||||
'$sparkle' => ' sparkle',
|
||||
'$from_photo' => proxy_url($from_photo, false, PROXY_SIZE_THUMB),
|
||||
|
|
|
@ -1538,14 +1538,10 @@ function photos_content(App $a)
|
|||
continue;
|
||||
}
|
||||
|
||||
$redirect_url = 'redir/' . $item['cid'];
|
||||
|
||||
if (local_user() && ($item['contact-uid'] == local_user())
|
||||
&& ($item['network'] == NETWORK_DFRN) && !$item['self']) {
|
||||
$profile_url = $redirect_url;
|
||||
$profile_url = Contact::MagicLinkById($item['cid']);
|
||||
if (strpos($profile_url, 'redir/') === 0) {
|
||||
$sparkle = ' sparkle';
|
||||
} else {
|
||||
$profile_url = $item['url'];
|
||||
$sparkle = '';
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
*/
|
||||
use Friendica\App;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\GContact;
|
||||
use Friendica\Model\Profile;
|
||||
|
||||
|
@ -12,7 +13,7 @@ function randprof_init(App $a)
|
|||
$x = GContact::getRandomUrl();
|
||||
|
||||
if ($x) {
|
||||
goaway(Profile::zrl($x));
|
||||
goaway(Contact::magicLink($x));
|
||||
}
|
||||
|
||||
goaway(System::baseUrl() . '/profile');
|
||||
|
|
|
@ -79,7 +79,7 @@ function suggest_content(App $a) {
|
|||
$connlnk = System::baseUrl() . '/follow/?url=' . (($rr['connect']) ? $rr['connect'] : $rr['url']);
|
||||
$ignlnk = System::baseUrl() . '/suggest?ignore=' . $rr['id'];
|
||||
$photo_menu = [
|
||||
'profile' => [L10n::t("View Profile"), Profile::zrl($rr["url"])],
|
||||
'profile' => [L10n::t("View Profile"), Contact::magicLink($rr["url"])],
|
||||
'follow' => [L10n::t("Connect/Follow"), $connlnk],
|
||||
'hide' => [L10n::t('Ignore/Hide'), $ignlnk]
|
||||
];
|
||||
|
@ -87,7 +87,7 @@ function suggest_content(App $a) {
|
|||
$contact_details = Contact::getDetailsByURL($rr["url"], local_user(), $rr);
|
||||
|
||||
$entry = [
|
||||
'url' => Profile::zrl($rr['url']),
|
||||
'url' => Contact::magicLink($rr['url']),
|
||||
'itemurl' => (($contact_details['addr'] != "") ? $contact_details['addr'] : $rr['url']),
|
||||
'img_hover' => $rr['url'],
|
||||
'name' => $contact_details['name'],
|
||||
|
|
|
@ -118,7 +118,7 @@ function unfollow_content(App $a)
|
|||
'$nickname' => "",
|
||||
'$name' => $contact["name"],
|
||||
'$url' => $contact["url"],
|
||||
'$zrl' => Profile::zrl($contact["url"]),
|
||||
'$zrl' => Contact::magicLink($contact["url"]),
|
||||
'$url_label' => L10n::t("Profile URL"),
|
||||
'$myaddr' => $myaddr,
|
||||
'$request' => $request,
|
||||
|
|
|
@ -96,15 +96,6 @@ function viewcontacts_content(App $a)
|
|||
continue;
|
||||
}
|
||||
|
||||
$url = $rr['url'];
|
||||
|
||||
// route DFRN profiles through the redirect
|
||||
if ($is_owner && ($rr['network'] === NETWORK_DFRN) && ($rr['rel'])) {
|
||||
$url = 'redir/' . $rr['id'];
|
||||
} else {
|
||||
$url = Profile::zrl($url);
|
||||
}
|
||||
|
||||
$contact_details = Contact::getDetailsByURL($rr['url'], $a->profile['uid'], $rr);
|
||||
|
||||
$contacts[] = [
|
||||
|
@ -118,7 +109,7 @@ function viewcontacts_content(App $a)
|
|||
'tags' => $contact_details['keywords'],
|
||||
'about' => $contact_details['about'],
|
||||
'account_type' => Contact::getAccountType($contact_details),
|
||||
'url' => $url,
|
||||
'url' => Contact::magicLink($rr['url']),
|
||||
'sparkle' => '',
|
||||
'itemurl' => (($contact_details['addr'] != "") ? $contact_details['addr'] : $rr['url']),
|
||||
'network' => ContactSelector::networkToName($rr['network'], $rr['url']),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue