aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-08-21 22:10:08 -0700
committerfriendica <info@friendica.com>2013-08-21 22:10:08 -0700
commit925b046794b77345c1321a3c74e4561d5c10ec95 (patch)
tree607a59b59d7f60f2e6b615b5454758f76254cdf2 /include
parent6cea04eb440c2bb08bcb81ae13749c08d09b755c (diff)
downloadvolse-hubzilla-925b046794b77345c1321a3c74e4561d5c10ec95.tar.gz
volse-hubzilla-925b046794b77345c1321a3c74e4561d5c10ec95.tar.bz2
volse-hubzilla-925b046794b77345c1321a3c74e4561d5c10ec95.zip
premium/restricted channel connections implemented, configure at yoursite/channel/nickname - this basically redirects "follow" requests to a premium channel's sell page if it has one configured. You can still click through and create a connection request (introduction), but this provides a means for the channel owner to state their terms. If you don't abide by the terms, you will likely be blocked or the channel deleted. This facility is extensible in a number of ways.
Diffstat (limited to 'include')
-rw-r--r--include/Contact.php9
-rw-r--r--include/follow.php7
2 files changed, 14 insertions, 2 deletions
diff --git a/include/Contact.php b/include/Contact.php
index bf536ccd5..46d356f3f 100644
--- a/include/Contact.php
+++ b/include/Contact.php
@@ -15,13 +15,20 @@ function rconnect_url($channel_id,$xchan) {
if($r)
return '';
+ $r = q("select * from xchan where xchan_hash = '%s' limit 1",
+ dbesc($xchan)
+ );
+
+ if(($r) && ($r[0]['xchan_follow']))
+ return $r[0]['xchan_follow'];
+
$r = q("select hubloc_url from hubloc where hubloc_hash = '%s' and ( hubloc_flags & %d ) limit 1",
dbesc($xchan),
intval(HUBLOC_FLAGS_PRIMARY)
);
if($r)
- return $r[0]['hubloc_url'];
+ return $r[0]['hubloc_url'] . '/follow?f=&url=%s';
return '';
}
diff --git a/include/follow.php b/include/follow.php
index ce550b07f..510c6cd7e 100644
--- a/include/follow.php
+++ b/include/follow.php
@@ -11,7 +11,7 @@
require_once('include/zot.php');
-function new_contact($uid,$url,$channel,$interactive = false) {
+function new_contact($uid,$url,$channel,$interactive = false, $confirm = false) {
$result = array('success' => false,'message' => '');
@@ -60,6 +60,11 @@ function new_contact($uid,$url,$channel,$interactive = false) {
return $result;
}
+ // Premium channel, set confirm before callback to avoid recursion
+
+ if(array_key_exists('connect_url',$j) && (! $confirm))
+ goaway($j['connect_url']);
+
// check service class limits