aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2015-02-08 20:57:37 -0800
committerfriendica <info@friendica.com>2015-02-08 20:57:37 -0800
commit08b757a22cd2804bfec8ecf682b6987b8c06ca49 (patch)
tree477f3a8e84388aab2a4f3c938a166597c7467d19 /include
parent4b348d248975ba07ba9cea62f51eb52d6afb5645 (diff)
parent247579ebf13ead372eee87bd2351078f7219321e (diff)
downloadvolse-hubzilla-08b757a22cd2804bfec8ecf682b6987b8c06ca49.tar.gz
volse-hubzilla-08b757a22cd2804bfec8ecf682b6987b8c06ca49.tar.bz2
volse-hubzilla-08b757a22cd2804bfec8ecf682b6987b8c06ca49.zip
Merge branch 'master' into tres
Conflicts: mod/events.php view/css/mod_events.css
Diffstat (limited to 'include')
-rwxr-xr-xinclude/diaspora.php10
-rw-r--r--include/network.php24
-rw-r--r--include/text.php2
3 files changed, 29 insertions, 7 deletions
diff --git a/include/diaspora.php b/include/diaspora.php
index 518f6ccd1..c02110ae2 100755
--- a/include/diaspora.php
+++ b/include/diaspora.php
@@ -772,7 +772,6 @@ function diaspora_request($importer,$xml) {
-
function diaspora_post($importer,$xml,$msg) {
$a = get_app();
@@ -898,8 +897,8 @@ function diaspora_post($importer,$xml,$msg) {
}
- // this won't work for Friendica or Redmatrix but it's probably the best we can do.
- $plink = 'https://'.substr($diaspora_handle,strpos($diaspora_handle,'@')+1).'/posts/'.$guid;
+ $plink = service_plink($contact,$guid);
+
$datarray['uid'] = $importer['channel_id'];
@@ -1116,8 +1115,7 @@ function diaspora_reshare($importer,$xml,$msg) {
}
}
- // This won't work on redmatrix
- $plink = 'https://'.substr($diaspora_handle,strpos($diaspora_handle,'@')+1).'/posts/'.$guid;
+ $plink = service_plink($contact,$guid);
$datarray['uid'] = $importer['channel_id'];
$datarray['mid'] = $datarray['parent_mid'] = $guid;
@@ -1198,7 +1196,7 @@ function diaspora_asphoto($importer,$xml,$msg) {
return;
}
- $plink = 'https://'.substr($diaspora_handle,strpos($diaspora_handle,'@')+1).'/posts/'.$guid;
+ $plink = service_plink($contact,$guid);
$datarray = array();
diff --git a/include/network.php b/include/network.php
index 5f95cf0e0..84c1c17f8 100644
--- a/include/network.php
+++ b/include/network.php
@@ -1522,3 +1522,27 @@ function scrape_feed($url) {
return $ret;
}
+
+
+function service_plink($contact, $guid) {
+
+ $plink = '';
+
+ $m = parse_url($contact['xchan_url']);
+ if($m) {
+ $url = $scheme . '://' . $m['host'] . (($m['port']) ? ':' . $m['port'] : '');
+ }
+ else
+ $url = 'https://' . substr($contact['xchan_addr'],strpos($contact['xchan_addr'],'@')+1);
+
+ $handle = substr($contact['xchan_addr'], 0, strpos($contact['xchan_addr'],'@'));
+
+ if($contact['xchan_network'] === 'diaspora')
+ $plink = $url . '/posts/' . $guid;
+ if($contact['xchan_network'] === 'friendica-over-diaspora')
+ $plink = $url . '/display/' . $handle . '/' . $guid;
+ if($contact['xchan_network'] === 'zot')
+ $plink = $url . '/channel/' . $handle . '?f=&mid=' . $guid;
+
+ return $plink;
+}
diff --git a/include/text.php b/include/text.php
index 1689dbef7..fc2f35135 100644
--- a/include/text.php
+++ b/include/text.php
@@ -1947,7 +1947,7 @@ function find_xchan_in_array($xchan,$arr) {
function get_rel_link($j,$rel) {
if(is_array($j) && ($j))
foreach($j as $l)
- if(array_key_exists('rel',$j) && $l['rel'] === $rel && array_key_exists('href',$l))
+ if(array_key_exists('rel',$l) && $l['rel'] === $rel && array_key_exists('href',$l))
return $l['href'];
return '';