do a better job of comparing same URLs.
This commit is contained in:
parent
d59585d89d
commit
2ffe0d0b1d
4 changed files with 26 additions and 7 deletions
19
boot.php
19
boot.php
|
@ -2191,3 +2191,22 @@ function get_birthdays() {
|
|||
|
||||
}}
|
||||
|
||||
/**
|
||||
*
|
||||
* Compare two URLs to see if they are the same, but ignore
|
||||
* slight but hopefully insignificant differences such as if one
|
||||
* is https and the other isn't, or if one is www.something and
|
||||
* the other isn't - and also ignore case differences.
|
||||
*
|
||||
* Return true if the URLs match, otherwise false.
|
||||
*
|
||||
*/
|
||||
|
||||
if(! function_exists('link_compare')) {
|
||||
function link_compare($a,$b) {
|
||||
$a1 = str_replace(array('https:','//www.'), array('http:','//'), $a);
|
||||
$b1 = str_replace(array('https:','//www.'), array('http:','//'), $b);
|
||||
if(strcasecmp($a1,$b1) === 0)
|
||||
return true;
|
||||
return false;
|
||||
}}
|
||||
|
|
|
@ -202,7 +202,7 @@ function display_content(&$a) {
|
|||
$template = $wallwall;
|
||||
$commentww = 'ww';
|
||||
// If it is our contact, use a friendly redirect link
|
||||
if(($item['owner-link'] == $item['url']) && ($item['network'] === 'dfrn')) {
|
||||
if((link_compare($item['owner-link'],$item['url'])) && ($item['network'] === 'dfrn')) {
|
||||
$owner_url = $redirect_url;
|
||||
$osparkle = ' sparkle';
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ function display_content(&$a) {
|
|||
}
|
||||
}
|
||||
|
||||
$diff_author = (($item['url'] !== $item['author-link']) ? true : false);
|
||||
$diff_author = ((link_compare($item['url'],$item['author-link'])) ? false : true);
|
||||
|
||||
$profile_name = (((strlen($item['author-name'])) && $diff_author) ? $item['author-name'] : $item['name']);
|
||||
$profile_avatar = (((strlen($item['author-avatar'])) && $diff_author) ? $item['author-avatar'] : $item['thumb']);
|
||||
|
|
|
@ -303,7 +303,7 @@ function network_content(&$a, $update = 0) {
|
|||
$template = $wallwall;
|
||||
$commentww = 'ww';
|
||||
// If it is our contact, use a friendly redirect link
|
||||
if(($item['owner-link'] == $item['url'])
|
||||
if((link_compare($item['owner-link'],$item['url']))
|
||||
&& ($item['network'] === 'dfrn')) {
|
||||
$owner_url = $redirect_url;
|
||||
$osparkle = ' sparkle';
|
||||
|
@ -350,7 +350,7 @@ function network_content(&$a, $update = 0) {
|
|||
|
||||
// Post was remotely authored.
|
||||
|
||||
$diff_author = (($item['url'] !== $item['author-link']) ? true : false);
|
||||
$diff_author = ((link_compare($item['url'],$item['author-link'])) ? false : true);
|
||||
|
||||
$profile_name = (((strlen($item['author-name'])) && $diff_author) ? $item['author-name'] : $item['name']);
|
||||
$profile_avatar = (((strlen($item['author-avatar'])) && $diff_author) ? $item['author-avatar'] : $thumb);
|
||||
|
@ -361,7 +361,7 @@ function network_content(&$a, $update = 0) {
|
|||
// Can we use our special contact URL for this author?
|
||||
|
||||
if(strlen($item['author-link'])) {
|
||||
if($item['author-link'] == $item['url'] && ($item['network'] === 'dfrn') && (! $item['self'])) {
|
||||
if((link_compare($item['author-link'],$item['url'])) && ($item['network'] === 'dfrn') && (! $item['self'])) {
|
||||
$profile_link = $redirect_url;
|
||||
$sparkle = ' sparkle';
|
||||
}
|
||||
|
|
|
@ -297,7 +297,7 @@ function profile_content(&$a, $update = 0) {
|
|||
|
||||
$profile_url = $item['url'];
|
||||
|
||||
// This is my profile but I'm not the author of this post/comment. If it's somebody that's a fan or mutual friend,
|
||||
// This is my profile page but I'm not the author of this post/comment. If it's somebody that's a fan or mutual friend,
|
||||
// I can go directly to their profile as an authenticated guest.
|
||||
|
||||
if(local_user() && ($item['contact-uid'] == $_SESSION['uid'])
|
||||
|
@ -314,7 +314,7 @@ function profile_content(&$a, $update = 0) {
|
|||
// local contact info at all. In this module you should never encounter a third-party author, but we still will do
|
||||
// the right thing if you ever do.
|
||||
|
||||
$diff_author = (($item['url'] !== $item['author-link']) ? true : false);
|
||||
$diff_author = ((link_compare($item['url'],$item['author-link'])) ? false : true);
|
||||
|
||||
$profile_name = (((strlen($item['author-name'])) && $diff_author) ? $item['author-name'] : $item['name']);
|
||||
$profile_avatar = (((strlen($item['author-avatar'])) && $diff_author) ? $item['author-avatar'] : $item['thumb']);
|
||||
|
|
Loading…
Reference in a new issue