aboutsummaryrefslogtreecommitdiffstats
path: root/include/network.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2015-02-08 18:31:51 -0800
committerfriendica <info@friendica.com>2015-02-08 18:31:51 -0800
commit64191de5e741fc1c365db45f197b2153c14e17c2 (patch)
tree45eb556afe2a8150393b3e659d5d4c168d24caf8 /include/network.php
parent7893b649552f23125835cd759ba00230b02a0ab3 (diff)
downloadvolse-hubzilla-64191de5e741fc1c365db45f197b2153c14e17c2.tar.gz
volse-hubzilla-64191de5e741fc1c365db45f197b2153c14e17c2.tar.bz2
volse-hubzilla-64191de5e741fc1c365db45f197b2153c14e17c2.zip
generate the correct service permalink
Diffstat (limited to 'include/network.php')
-rw-r--r--include/network.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/network.php b/include/network.php
index 224d9d5e1..366ac0d24 100644
--- a/include/network.php
+++ b/include/network.php
@@ -1523,3 +1523,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;
+}