diff options
author | Mario Vavti <mario@mariovavti.com> | 2018-02-15 09:00:52 +0100 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2018-02-15 09:00:52 +0100 |
commit | 45b42cbc1c5356da61923f5bc2fbca1cec9f9119 (patch) | |
tree | b052b2d5e52b751aa7242e7938fca56879d2da7e | |
parent | 033608292007a726b6fdffe839f6e481939f7a1d (diff) | |
parent | 465d89129caaaa0240229f8d6f81d68f26eb60b0 (diff) | |
download | volse-hubzilla-45b42cbc1c5356da61923f5bc2fbca1cec9f9119.tar.gz volse-hubzilla-45b42cbc1c5356da61923f5bc2fbca1cec9f9119.tar.bz2 volse-hubzilla-45b42cbc1c5356da61923f5bc2fbca1cec9f9119.zip |
Merge remote-tracking branch 'mike/master' into dev
-rw-r--r-- | Zotlabs/Lib/Apps.php | 9 | ||||
-rw-r--r-- | Zotlabs/Module/Admin/Site.php | 4 | ||||
-rw-r--r-- | Zotlabs/Module/Pubstream.php | 7 | ||||
-rw-r--r-- | app/pubstream.apd | 6 | ||||
-rwxr-xr-x | boot.php | 20 | ||||
-rw-r--r-- | include/conversation.php | 2 | ||||
-rw-r--r-- | include/nav.php | 4 | ||||
-rwxr-xr-x | view/tpl/admin_site.tpl | 1 |
8 files changed, 41 insertions, 12 deletions
diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index d2a307fd5..f91dc8e49 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -119,6 +119,7 @@ class Apps { static public function parse_app_description($f,$translate = true) { + $ret = array(); $baseurl = z_root(); @@ -194,6 +195,10 @@ class Apps { if(! is_public_profile()) unset($ret); break; + case 'public_stream': + if(! can_view_public_stream()) + unset($ret); + break; case 'observer': if(! $observer) unset($ret); @@ -346,6 +351,10 @@ class Apps { if(! is_public_profile()) return ''; break; + case 'public_stream': + if(! can_view_public_stream()) + return ''; + break; case 'observer': $observer = \App::get_observer(); if(! $observer) diff --git a/Zotlabs/Module/Admin/Site.php b/Zotlabs/Module/Admin/Site.php index 52b36e03e..ca181d5f8 100644 --- a/Zotlabs/Module/Admin/Site.php +++ b/Zotlabs/Module/Admin/Site.php @@ -45,6 +45,7 @@ class Site { $force_publish = ((x($_POST,'publish_all')) ? True : False); $disable_discover_tab = ((x($_POST,'disable_discover_tab')) ? False : True); $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); $enable_context_help = ((x($_POST,'enable_context_help')) ? True : False); $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','disable_discover_tab', $disable_discover_tab); set_config('system','site_firehose', $site_firehose); + set_config('system','open_pubstream', $open_pubstream); set_config('system','force_queue_threshold', $force_queue); if ($global_directory == '') { 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.")), '$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.')), - + '$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.")), '$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.")), diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php index 16a5fdbba..afe53eca7 100644 --- a/Zotlabs/Module/Pubstream.php +++ b/Zotlabs/Module/Pubstream.php @@ -12,11 +12,10 @@ class Pubstream extends \Zotlabs\Web\Controller { if($load) $_SESSION['loadtime'] = datetime_convert(); - - if(observer_prohibited(true)) { - return login(); + if((observer_prohibited(true)) || (! (intval(get_config('system','open_pubstream',1))) && get_observer_hash())) { + return login(); } - + $site_firehose = ((intval(get_config('system','site_firehose',0))) ? true : false); $net_firehose = ((get_config('system','disable_discover_tab',1)) ? false : true); diff --git a/app/pubstream.apd b/app/pubstream.apd index ebfcf38b0..ce9997126 100644 --- a/app/pubstream.apd +++ b/app/pubstream.apd @@ -1,6 +1,6 @@ -version: 2 +version: 2.2 url: $baseurl/pubstream -requires: config:disable_discover_tab=0 +requires: public_stream name: Public Stream photo: icon:globe -categories: Social +categories: Social, nav_featured_app @@ -1685,6 +1685,26 @@ function remote_channel() { 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. * diff --git a/include/conversation.php b/include/conversation.php index 77694deb3..0bb9c769a 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -974,7 +974,7 @@ function author_is_pmable($xchan, $abook) { if($x['result'] !== 'unset') return $x['result']; - if($xchan['xchan_network'] === 'zot') + if($xchan['xchan_network'] === 'zot' && get_observer_hash()) return true; return false; diff --git a/include/nav.php b/include/nav.php index 9c88541d1..df58ee96f 100644 --- a/include/nav.php +++ b/include/nav.php @@ -73,9 +73,7 @@ EOT; // nav links: array of array('href', 'text', 'extra css classes', 'title') $nav = []; - $disable_discover_tab = get_config('system','disable_discover_tab') || get_config('system','disable_discover_tab') === false; - - if(! $disable_discover_tab) + if(can_view_public_stream()) $nav['pubs'] = true; /** diff --git a/view/tpl/admin_site.tpl b/view/tpl/admin_site.tpl index 0eabe620d..78e3ee245 100755 --- a/view/tpl/admin_site.tpl +++ b/view/tpl/admin_site.tpl @@ -84,6 +84,7 @@ {{include file="field_checkbox.tpl" field=$force_publish}} {{include file="field_checkbox.tpl" field=$disable_discover_tab}} {{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> |