If a post is a pure reshare, then show the profile of the original author on the display page.

This commit is contained in:
Michael Vogel 2014-08-26 17:10:46 +02:00
parent 4976b1c153
commit 4ad2bbddc7
2 changed files with 128 additions and 55 deletions

View file

@ -586,11 +586,13 @@ function bb_ShareAttributes($share, $simplehtml) {
return($text);
}
function GetProfileUsername($profile, $username, $compact = false) {
function GetProfileUsername($profile, $username, $compact = false, $getnetwork = false) {
$twitter = preg_replace("=https?://twitter.com/(.*)=ism", "$1@twitter.com", $profile);
if ($twitter != $profile) {
if ($compact)
if ($getnetwork)
return(NETWORK_TWITTER);
elseif ($compact)
return($twitter);
else
return($username." (".$twitter.")");
@ -598,7 +600,9 @@ function GetProfileUsername($profile, $username, $compact = false) {
$appnet = preg_replace("=https?://alpha.app.net/(.*)=ism", "$1@alpha.app.net", $profile);
if ($appnet != $profile) {
if ($compact)
if ($getnetwork)
return(NETWORK_APPNET);
elseif ($compact)
return($appnet);
else
return($username." (".$appnet.")");
@ -606,7 +610,9 @@ function GetProfileUsername($profile, $username, $compact = false) {
$gplus = preg_replace("=https?://plus.google.com/(.*)=ism", "$1@plus.google.com", $profile);
if ($gplus != $profile) {
if ($compact)
if ($getnetwork)
return(NETWORK_GPLUS);
elseif ($compact)
return($gplususername." (".$username.")");
else
return($username." (".$gplus.")");
@ -614,7 +620,9 @@ function GetProfileUsername($profile, $username, $compact = false) {
$friendica = preg_replace("=https?://(.*)/profile/(.*)=ism", "$2@$1", $profile);
if ($friendica != $profile) {
if ($compact)
if ($getnetwork)
return(NETWORK_DFRN);
elseif ($compact)
return($friendica);
else
return($username." (".$friendica.")");
@ -622,7 +630,9 @@ function GetProfileUsername($profile, $username, $compact = false) {
$diaspora = preg_replace("=https?://(.*)/u/(.*)=ism", "$2@$1", $profile);
if ($diaspora != $profile) {
if ($compact)
if ($getnetwork)
return(NETWORK_DIASPORA);
elseif ($compact)
return($diaspora);
else
return($username." (".$diaspora.")");
@ -635,7 +645,9 @@ function GetProfileUsername($profile, $username, $compact = false) {
$UserData = fetch_url("http://".$StatusnetHost."/api/users/show.json?user_id=".$StatusnetUser);
$user = json_decode($UserData);
if ($user) {
if ($compact)
if ($getnetwork)
return(NETWORK_STATUSNET);
elseif ($compact)
return($user->screen_name."@".$StatusnetHost);
else
return($username." (".$user->screen_name."@".$StatusnetHost.")");
@ -648,7 +660,9 @@ function GetProfileUsername($profile, $username, $compact = false) {
if ($rest == "") {
$pumpio = preg_replace("=https?://([\.\w]+)/([\.\w]+)(.*)=ism", "$2@$1", $profile);
if ($pumpio != $profile) {
if ($compact)
if ($getnetwork)
return(NETWORK_PUMPIO);
elseif ($compact)
return($pumpio);
else
return($username." (".$pumpio.")");