provide option to block the public stream unless authenticated, since there could be legal issues with unmoderated content
This commit is contained in:
parent
24da5d82db
commit
465d89129c
@ -119,6 +119,7 @@ class Apps {
|
|||||||
|
|
||||||
|
|
||||||
static public function parse_app_description($f,$translate = true) {
|
static public function parse_app_description($f,$translate = true) {
|
||||||
|
|
||||||
$ret = array();
|
$ret = array();
|
||||||
|
|
||||||
$baseurl = z_root();
|
$baseurl = z_root();
|
||||||
@ -194,6 +195,10 @@ class Apps {
|
|||||||
if(! is_public_profile())
|
if(! is_public_profile())
|
||||||
unset($ret);
|
unset($ret);
|
||||||
break;
|
break;
|
||||||
|
case 'public_stream':
|
||||||
|
if(! can_view_public_stream())
|
||||||
|
unset($ret);
|
||||||
|
break;
|
||||||
case 'observer':
|
case 'observer':
|
||||||
if(! $observer)
|
if(! $observer)
|
||||||
unset($ret);
|
unset($ret);
|
||||||
@ -346,6 +351,10 @@ class Apps {
|
|||||||
if(! is_public_profile())
|
if(! is_public_profile())
|
||||||
return '';
|
return '';
|
||||||
break;
|
break;
|
||||||
|
case 'public_stream':
|
||||||
|
if(! can_view_public_stream())
|
||||||
|
return '';
|
||||||
|
break;
|
||||||
case 'observer':
|
case 'observer':
|
||||||
$observer = \App::get_observer();
|
$observer = \App::get_observer();
|
||||||
if(! $observer)
|
if(! $observer)
|
||||||
|
@ -45,6 +45,7 @@ class Site {
|
|||||||
$force_publish = ((x($_POST,'publish_all')) ? True : False);
|
$force_publish = ((x($_POST,'publish_all')) ? True : False);
|
||||||
$disable_discover_tab = ((x($_POST,'disable_discover_tab')) ? False : True);
|
$disable_discover_tab = ((x($_POST,'disable_discover_tab')) ? False : True);
|
||||||
$site_firehose = ((x($_POST,'site_firehose')) ? True : False);
|
$site_firehose = ((x($_POST,'site_firehose')) ? True : False);
|
||||||
|
$open_pubstream = ((x($_POST,'open_pubstream')) ? True : False);
|
||||||
$login_on_homepage = ((x($_POST,'login_on_homepage')) ? True : False);
|
$login_on_homepage = ((x($_POST,'login_on_homepage')) ? True : False);
|
||||||
$enable_context_help = ((x($_POST,'enable_context_help')) ? True : False);
|
$enable_context_help = ((x($_POST,'enable_context_help')) ? True : False);
|
||||||
$global_directory = ((x($_POST,'directory_submit_url')) ? notags(trim($_POST['directory_submit_url'])) : '');
|
$global_directory = ((x($_POST,'directory_submit_url')) ? notags(trim($_POST['directory_submit_url'])) : '');
|
||||||
@ -139,6 +140,7 @@ class Site {
|
|||||||
set_config('system','publish_all', $force_publish);
|
set_config('system','publish_all', $force_publish);
|
||||||
set_config('system','disable_discover_tab', $disable_discover_tab);
|
set_config('system','disable_discover_tab', $disable_discover_tab);
|
||||||
set_config('system','site_firehose', $site_firehose);
|
set_config('system','site_firehose', $site_firehose);
|
||||||
|
set_config('system','open_pubstream', $open_pubstream);
|
||||||
set_config('system','force_queue_threshold', $force_queue);
|
set_config('system','force_queue_threshold', $force_queue);
|
||||||
if ($global_directory == '') {
|
if ($global_directory == '') {
|
||||||
del_config('system', 'directory_submit_url');
|
del_config('system', 'directory_submit_url');
|
||||||
@ -319,7 +321,7 @@ class Site {
|
|||||||
'$force_publish' => array('publish_all', t("Force publish"), get_config('system','publish_all'), t("Check to force all profiles on this site to be listed in the site directory.")),
|
'$force_publish' => array('publish_all', t("Force publish"), get_config('system','publish_all'), t("Check to force all profiles on this site to be listed in the site directory.")),
|
||||||
'$disable_discover_tab' => array('disable_discover_tab', t('Import Public Streams'), $discover_tab, t('Import and allow access to public content pulled from other sites. Warning: this content is unmoderated.')),
|
'$disable_discover_tab' => array('disable_discover_tab', t('Import Public Streams'), $discover_tab, t('Import and allow access to public content pulled from other sites. Warning: this content is unmoderated.')),
|
||||||
'$site_firehose' => array('site_firehose', t('Site only Public Streams'), get_config('system','site_firehose'), t('Allow access to public content originating only from this site if Imported Public Streams are disabled.')),
|
'$site_firehose' => array('site_firehose', t('Site only Public Streams'), get_config('system','site_firehose'), t('Allow access to public content originating only from this site if Imported Public Streams are disabled.')),
|
||||||
|
'$open_pubstream' => array('open_pubstream', t('Allow anybody on the internet to access the Public streams'), get_config('system','open_pubstream',1), t('Disable to require authentication before viewing. Warning: this content is unmoderated.')),
|
||||||
'$login_on_homepage' => array('login_on_homepage', t("Login on Homepage"),((intval($homelogin) || $homelogin === false) ? 1 : '') , t("Present a login box to visitors on the home page if no other content has been configured.")),
|
'$login_on_homepage' => array('login_on_homepage', t("Login on Homepage"),((intval($homelogin) || $homelogin === false) ? 1 : '') , t("Present a login box to visitors on the home page if no other content has been configured.")),
|
||||||
'$enable_context_help' => array('enable_context_help', t("Enable context help"),((intval($enable_context_help) === 1 || $enable_context_help === false) ? 1 : 0) , t("Display contextual help for the current page when the help button is pressed.")),
|
'$enable_context_help' => array('enable_context_help', t("Enable context help"),((intval($enable_context_help) === 1 || $enable_context_help === false) ? 1 : 0) , t("Display contextual help for the current page when the help button is pressed.")),
|
||||||
|
|
||||||
|
@ -12,8 +12,7 @@ class Pubstream extends \Zotlabs\Web\Controller {
|
|||||||
if($load)
|
if($load)
|
||||||
$_SESSION['loadtime'] = datetime_convert();
|
$_SESSION['loadtime'] = datetime_convert();
|
||||||
|
|
||||||
|
if((observer_prohibited(true)) || (! (intval(get_config('system','open_pubstream',1))) && get_observer_hash())) {
|
||||||
if(observer_prohibited(true)) {
|
|
||||||
return login();
|
return login();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
version: 2
|
version: 2.2
|
||||||
url: $baseurl/pubstream
|
url: $baseurl/pubstream
|
||||||
requires: config:disable_discover_tab=0
|
requires: public_stream
|
||||||
name: Public Stream
|
name: Public Stream
|
||||||
photo: icon:globe
|
photo: icon:globe
|
||||||
categories: Social
|
categories: Social, nav_featured_app
|
||||||
|
20
boot.php
20
boot.php
@ -1685,6 +1685,26 @@ function remote_channel() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function can_view_public_stream() {
|
||||||
|
|
||||||
|
if((observer_prohibited(true))
|
||||||
|
|| (! (intval(get_config('system','open_pubstream',1))) && get_observer_hash())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$site_firehose = ((intval(get_config('system','site_firehose',0))) ? true : false);
|
||||||
|
$net_firehose = ((get_config('system','disable_discover_tab',1)) ? false : true);
|
||||||
|
|
||||||
|
if(! ($site_firehose || $net_firehose)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Show an error or alert text on next page load.
|
* @brief Show an error or alert text on next page load.
|
||||||
*
|
*
|
||||||
|
@ -974,7 +974,7 @@ function author_is_pmable($xchan, $abook) {
|
|||||||
if($x['result'] !== 'unset')
|
if($x['result'] !== 'unset')
|
||||||
return $x['result'];
|
return $x['result'];
|
||||||
|
|
||||||
if($xchan['xchan_network'] === 'zot')
|
if($xchan['xchan_network'] === 'zot' && get_observer_hash())
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -73,9 +73,7 @@ EOT;
|
|||||||
// nav links: array of array('href', 'text', 'extra css classes', 'title')
|
// nav links: array of array('href', 'text', 'extra css classes', 'title')
|
||||||
$nav = [];
|
$nav = [];
|
||||||
|
|
||||||
$disable_discover_tab = get_config('system','disable_discover_tab') || get_config('system','disable_discover_tab') === false;
|
if(can_view_public_stream())
|
||||||
|
|
||||||
if(! $disable_discover_tab)
|
|
||||||
$nav['pubs'] = true;
|
$nav['pubs'] = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -84,6 +84,7 @@
|
|||||||
{{include file="field_checkbox.tpl" field=$force_publish}}
|
{{include file="field_checkbox.tpl" field=$force_publish}}
|
||||||
{{include file="field_checkbox.tpl" field=$disable_discover_tab}}
|
{{include file="field_checkbox.tpl" field=$disable_discover_tab}}
|
||||||
{{include file="field_checkbox.tpl" field=$site_firehose}}
|
{{include file="field_checkbox.tpl" field=$site_firehose}}
|
||||||
|
{{include file="field_checkbox.tpl" field=$open_pubstream}}
|
||||||
|
|
||||||
<div class="submit"><input type="submit" name="page_site" value="{{$submit}}" /></div>
|
<div class="submit"><input type="submit" name="page_site" value="{{$submit}}" /></div>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user