add "tiered" access policy, add tagcloud to directory pages

This commit is contained in:
friendica 2013-09-18 17:47:26 -07:00
parent e06b4c6dfc
commit e4d2e2200e
7 changed files with 29 additions and 8 deletions

View File

@ -149,7 +149,7 @@ define ( 'REGISTER_OPEN', 2 );
define ( 'ACCESS_PRIVATE', 0 ); define ( 'ACCESS_PRIVATE', 0 );
define ( 'ACCESS_PAID', 1 ); define ( 'ACCESS_PAID', 1 );
define ( 'ACCESS_FREE', 2 ); define ( 'ACCESS_FREE', 2 );
define ( 'ACCESS_TIERED', 3 );
/** /**
* relationship types * relationship types

View File

@ -221,7 +221,7 @@ function dir_tagblock($link,$r) {
if($r) { if($r) {
$o = '<div class="dirtagblock widget"><h3>' . t('Keywords') . '</h3><div class="tags" align="center">'; $o = '<div class="dirtagblock widget"><h3>' . t('Keywords') . '</h3><div class="tags" align="center">';
foreach($r as $rr) { foreach($r as $rr) {
$o .= '<a href="'.$link .'/' . '?f=&keyword=' . urlencode($rr['term']).'" class="tag'.$rr['weight'].'">'.$rr['term'].'</a> ' . "\r\n"; $o .= '<a href="'.$link .'/' . '?f=&keywords=' . urlencode($rr['term']).'" class="tag'.$rr['normalise'].'">'.$rr['term'].'</a> ' . "\r\n";
} }
$o .= '</div></div>'; $o .= '</div></div>';
} }

View File

@ -1563,6 +1563,8 @@ function import_site($arr,$pubkey) {
$access_policy = ACCESS_PAID; $access_policy = ACCESS_PAID;
if($arr['access_policy'] === 'free') if($arr['access_policy'] === 'free')
$access_policy = ACCESS_FREE; $access_policy = ACCESS_FREE;
if($arr['access_policy'] === 'tiered')
$access_policy = ACCESS_TIERED;
} }
$directory_url = htmlentities($arr['directory_url'],ENT_COMPAT,'UTF-8',false); $directory_url = htmlentities($arr['directory_url'],ENT_COMPAT,'UTF-8',false);

View File

@ -32,6 +32,7 @@ function directory_content(&$a) {
else else
$search = ((x($_GET,'search')) ? notags(trim(rawurldecode($_GET['search']))) : ''); $search = ((x($_GET,'search')) ? notags(trim(rawurldecode($_GET['search']))) : '');
$keywords = (($_GET['keywords']) ? $_GET['keywords'] : '');
$tpl = get_markup_template('directory_header.tpl'); $tpl = get_markup_template('directory_header.tpl');
@ -68,11 +69,14 @@ function directory_content(&$a) {
if($url) { if($url) {
$query = $url . '?f=' ; // We might want to make the tagadelic count (&kw=) configurable or turn it off completely.
$query = $url . '?f=&kw=24' ;
if($search) if($search)
$query .= '&name=' . urlencode($search) . '&keywords=' . urlencode($search); $query .= '&name=' . urlencode($search) . '&keywords=' . urlencode($search);
if(strpos($search,'@')) if(strpos($search,'@'))
$query .= '&address=' . urlencode($search); $query .= '&address=' . urlencode($search);
if($keywords)
$query .= '&keywords=' . urlencode($keywords);
$sort_order = ((x($_REQUEST,'order')) ? $_REQUEST['order'] : ''); $sort_order = ((x($_REQUEST,'order')) ? $_REQUEST['order'] : '');
if($sort_order) if($sort_order)
@ -175,6 +179,10 @@ function directory_content(&$a) {
} }
if($j['keywords']) {
$a->set_widget('dirtagblock',dir_tagblock(z_root() . '/directory',$j['keywords']));
}
// logger('mod_directory: entries: ' . print_r($entries,true), LOGGER_DATA); // logger('mod_directory: entries: ' . print_r($entries,true), LOGGER_DATA);
$o .= replace_macros($tpl, array( $o .= replace_macros($tpl, array(

View File

@ -40,6 +40,7 @@ function dirsearch_content(&$a) {
$keywords = ((x($_REQUEST,'keywords')) ? $_REQUEST['keywords'] : ''); $keywords = ((x($_REQUEST,'keywords')) ? $_REQUEST['keywords'] : '');
$agege = ((x($_REQUEST,'agege')) ? intval($_REQUEST['agege']) : 0 ); $agege = ((x($_REQUEST,'agege')) ? intval($_REQUEST['agege']) : 0 );
$agele = ((x($_REQUEST,'agele')) ? intval($_REQUEST['agele']) : 0 ); $agele = ((x($_REQUEST,'agele')) ? intval($_REQUEST['agele']) : 0 );
$kw = ((x($_REQUEST,'kw')) ? intval($_REQUEST['kw']) : 0 );
$sync = ((x($_REQUEST,'sync')) ? datetime_convert('UTC','UTC',$_REQUEST['sync']) : ''); $sync = ((x($_REQUEST,'sync')) ? datetime_convert('UTC','UTC',$_REQUEST['sync']) : '');
$sort_order = ((x($_REQUEST,'order')) ? $_REQUEST['order'] : ''); $sort_order = ((x($_REQUEST,'order')) ? $_REQUEST['order'] : '');
@ -175,12 +176,12 @@ function dirsearch_content(&$a) {
} }
$ret['results'] = $entries; $ret['results'] = $entries;
if(! $sync) { if(($kw) && (! $sync)) {
$k = dir_tagadelic(24); $k = dir_tagadelic($kw);
if($k) { if($k) {
$ret['keywords'] = array(); $ret['keywords'] = array();
foreach($k as $kv) { foreach($k as $kv) {
$ret['keywords'][] = array('term' => $kv[0],'weight' => $kv[1]); $ret['keywords'][] = array('term' => $kv[0],'weight' => $kv[1], 'normalise' => $kv[2]);
} }
} }
} }
@ -203,6 +204,8 @@ function list_public_sites() {
$access = 'free'; $access = 'free';
elseif($rr['site_access'] == ACCESS_PAID) elseif($rr['site_access'] == ACCESS_PAID)
$access = 'paid'; $access = 'paid';
elseif($rr['site_access'] == ACCESS_TIERED)
$access = 'tiered';
else else
$access = 'private'; $access = 'private';

View File

@ -226,6 +226,8 @@ function zfinger_init(&$a) {
$ret['site']['access_policy'] = 'paid'; $ret['site']['access_policy'] = 'paid';
if($access_policy == ACCESS_FREE) if($access_policy == ACCESS_FREE)
$ret['site']['access_policy'] = 'free'; $ret['site']['access_policy'] = 'free';
if($access_policy == ACCESS_TIERED)
$ret['site']['access_policy'] = 'tiered';
require_once('include/account.php'); require_once('include/account.php');
$ret['site']['accounts'] = account_total(); $ret['site']['accounts'] = account_total();

View File

@ -47,16 +47,22 @@ $a->config['system']['admin_email'] = '{{$adminmail}}';
// Site access restrictions. By default we will create private sites. // Site access restrictions. By default we will create private sites.
// Your choices are ACCESS_PRIVATE, ACCESS_PAID, and ACCESS_FREE. // Your choices are ACCESS_PRIVATE, ACCESS_PAID, ACCESS_TIERED, and ACCESS_FREE.
// If you leave REGISTER_OPEN above, anybody may register on your // If you leave REGISTER_OPEN above, anybody may register on your
// site, however your site will not be listed anywhere as an open // site, however your site will not be listed anywhere as an open
// registration hub. We will use the system access policy (below) // registration hub. We will use the system access policy (below)
// to determine whether or not to list your site in the directory // to determine whether or not to list your site in the directory
// as an open hub where anybody may create accounts. Your choice of // as an open hub where anybody may create accounts. Your choice of
// paid or free determines how these listings will be presented. // paid, tiered, or free determines how these listings will be presented.
$a->config['system']['access_policy'] = ACCESS_PRIVATE; $a->config['system']['access_policy'] = ACCESS_PRIVATE;
// If you operate a public site, you might wish that people are directed
// to a "sellpage" where you can describe for features or policies or service plans in depth.
// This must be an absolute URL beginning with http:// or https:// .
$a->config['system']['sellpage'] = '';
// Maximum size of an imported message, 0 is unlimited // Maximum size of an imported message, 0 is unlimited