basic structure for premium channel implementation

This commit is contained in:
friendica 2013-08-21 17:15:56 -07:00
parent d8ef1417fb
commit 2d3a489f51
5 changed files with 30 additions and 6 deletions

View file

@ -43,7 +43,7 @@ require_once('include/taxonomy.php');
define ( 'RED_PLATFORM', 'Red Matrix' );
define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R');
define ( 'ZOT_REVISION', 1 );
define ( 'DB_UPDATE_VERSION', 1063 );
define ( 'DB_UPDATE_VERSION', 1064 );
define ( 'EOL', '<br />' . "\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
@ -190,13 +190,10 @@ define ( 'PAGE_HIDDEN', 0x0001 );
define ( 'PAGE_AUTOCONNECT', 0x0002 );
define ( 'PAGE_APPLICATION', 0x0004 );
define ( 'PAGE_DIRECTORY_CHANNEL', 0x0008 ); // system channel used for directory synchronisation
define ( 'PAGE_PREMIUM', 0x0010 );
define ( 'PAGE_REMOVED', 0x8000 );
//define ( 'PAGE_FREELOVE', 3 );
//define ( 'PAGE_BLOG', 4 );
//define ( 'PAGE_PRVGROUP', 5 );
/**
* Photo types

View file

@ -926,6 +926,8 @@ CREATE TABLE IF NOT EXISTS `xchan` (
`xchan_addr` char(255) NOT NULL DEFAULT '',
`xchan_url` char(255) NOT NULL DEFAULT '',
`xchan_connurl` char(255) NOT NULL DEFAULT '',
`xchan_follow` char(255) NOT NULL DEFAULT '',
`xchan_connpage` char(255) NOT NULL DEFAULT '',
`xchan_name` char(255) NOT NULL DEFAULT '',
`xchan_network` char(255) NOT NULL DEFAULT '',
`xchan_instance_url` char(255) NOT NULL DEFAULT '',
@ -940,6 +942,8 @@ CREATE TABLE IF NOT EXISTS `xchan` (
KEY `xchan_url` (`xchan_url`),
KEY `xchan_flags` (`xchan_flags`),
KEY `xchan_connurl` (`xchan_connurl`),
KEY `xchan_follow` (`xchan_follow`),
KEY `xchan_connpage` (`xchan_connpage`),
KEY `xchan_instance_url` (`xchan_instance_url`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

View file

@ -1,6 +1,6 @@
<?php
define( 'UPDATE_VERSION' , 1063 );
define( 'UPDATE_VERSION' , 1064 );
/**
*
@ -742,3 +742,11 @@ KEY `pelm_result` (`pelm_result`)
return UPDATE_FAILED;
}
function update_r1063() {
$r = q("ALTER TABLE `xchan` ADD `xchan_follow` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `xchan_connurl` ,
ADD `xchan_connpage` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `xchan_follow` ,
ADD INDEX ( `xchan_follow` ), ADD INDEX ( `xchan_connpage`) ");
if($r)
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}

3
mod/connect.php Normal file
View file

@ -0,0 +1,3 @@
<?php /** @file */
// Placeholder for channel sell pages

View file

@ -71,6 +71,8 @@ function zfinger_init(&$a) {
$id = $e['channel_id'];
$special_channel = (($e['channel_pageflags'] & PAGE_PREMIUM) ? true : false);
$searchable = (($e['channel_pageflags'] & PAGE_HIDDEN) ? false : true);
if($e['xchan_flags'] & XCHAN_FLAGS_HIDDEN)
$searchable = false;
@ -134,6 +136,16 @@ function zfinger_init(&$a) {
$ret['searchable'] = $searchable;
// premium or other channel desiring some contact with potential followers before connecting.
// 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';
// This is a template for our follow url, %s will be replaced with a webbie
$ret['follow_url'] = z_root() . '/follow?f=&url=%s';
$permissions = get_all_perms($e['channel_id'],(($ztarget && $zsig)
? base64url_encode(hash('whirlpool',$ztarget . $zsig,true))
: '' ),false);