aboutsummaryrefslogtreecommitdiffstats
path: root/mod
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 /mod
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 'mod')
-rw-r--r--mod/connect.php28
-rw-r--r--mod/follow.php3
-rw-r--r--mod/zfinger.php2
3 files changed, 25 insertions, 8 deletions
diff --git a/mod/connect.php b/mod/connect.php
index 0ab994ddd..c2b55d997 100644
--- a/mod/connect.php
+++ b/mod/connect.php
@@ -31,12 +31,13 @@ function connect_post(&$a) {
$channel = $a->get_channel();
if(($channel['channel_pageflags'] & PAGE_PREMIUM) != $premium)
- $r = q("update channel set channel_flags = channel_flags ^ %d where channel_id = %d limit 1",
+ $r = q("update channel set channel_pageflags = channel_pageflags ^ %d where channel_id = %d limit 1",
intval(PAGE_PREMIUM),
intval(local_user())
);
set_pconfig($a->profile['profile_uid'],'system','selltext',$text);
- return;
+ goaway(z_root() . '/' . $a->query_string);
+
}
$url = '';
@@ -53,7 +54,7 @@ function connect_post(&$a) {
}
}
if($url)
- goaway($url);
+ goaway($url . '&confirm=1');
else
notice('Unable to connect to your home hub location.');
@@ -68,20 +69,34 @@ function connect_content(&$a) {
$text = get_pconfig($a->profile['profile_uid'],'system','selltext');
if($edit) {
+ $channel = $a->get_channel();
+
$o = replace_macros(get_markup_template('sellpage_edit.tpl'),array(
+ '$header' => t('Premium Channel Setup'),
+ '$address' => $a->profile['channel_address'],
+ '$premium' => array('premium', t('Enable premium channel connection restrictions'),(($channel['channel_pageflags'] & PAGE_PREMIUM) ? '1' : ''),''),
+ '$lbl_about' => t('Please enter your restrictions or conditions, such as paypal receipt, usage guidelines, etc.'),
+ '$text' => $text,
+ '$desc' => t('This channel may require additional steps or acknowledgement of the following conditions prior to connecting:'),
+ '$lbl2' => t('Potential connections will then see the following text before proceeding:'),
+ '$desc2' => t('By continuing, I certify that I have complied with any instructions provided on this page.'),
+ '$submit' => t('Submit'),
));
return $o;
}
else {
+ if(! $text)
+ $text = t('(No specific instructions have been provided by the channel owner.)');
+
$submit = replace_macros(get_markup_template('sellpage_submit.tpl'), array(
'$continue' => t('Continue'),
'$address' => $a->profile['channel_address']
));
$o = replace_macros(get_markup_template('sellpage_view.tpl'),array(
- '$header' => t('Restricted Channel'),
+ '$header' => t('Restricted or Premium Channel'),
'$desc' => t('This channel may require additional steps or acknowledgement of the following conditions prior to connecting:'),
'$text' => prepare_text($text),
@@ -90,8 +105,9 @@ function connect_content(&$a) {
));
-
-
+ $arr = array('profile' => $a->profile,'observer' => $a->get_observer(), 'sellpage' => $o, 'submit' => $submit);
+ call_hooks('connect_premium', $arr);
+ $o = $arr['sellpage'];
}
diff --git a/mod/follow.php b/mod/follow.php
index d21c50df6..9f5a8183b 100644
--- a/mod/follow.php
+++ b/mod/follow.php
@@ -12,8 +12,9 @@ function follow_init(&$a) {
$uid = local_user();
$url = notags(trim($_REQUEST['url']));
$return_url = $_SESSION['return_url'];
+ $confirm = intval($_REQUEST['confirm']);
- $result = new_contact($uid,$url,$a->get_channel(),true);
+ $result = new_contact($uid,$url,$a->get_channel(),true,$confirm);
if($result['success'] == false) {
if($result['message'])
diff --git a/mod/zfinger.php b/mod/zfinger.php
index d5b750537..320f0ca71 100644
--- a/mod/zfinger.php
+++ b/mod/zfinger.php
@@ -140,7 +140,7 @@ function zfinger_init(&$a) {
// This is a template - %s will be replaced with the follow_url we discover for the return channel.
if($special_channel)
- $ret['connect_url'] = z_root() . '/connect/' . $e['channel_address'] . '?f=&follow=%s';
+ $ret['connect_url'] = z_root() . '/connect/' . $e['channel_address'];
// This is a template for our follow url, %s will be replaced with a webbie