Merge remote-tracking branch 'mike/master' into dev

This commit is contained in:
Mario Vavti 2018-01-18 13:20:23 +01:00
commit a0e1a8e0a2
8 changed files with 37 additions and 29 deletions

View File

@ -315,7 +315,7 @@ class Notifier {
} }
if($target_item['id'] == $target_item['parent']) { if($target_item['mid'] === $target_item['parent_mid']) {
$parent_item = $target_item; $parent_item = $target_item;
$top_level_post = true; $top_level_post = true;
} }

View File

@ -43,6 +43,7 @@ class Site {
$allowed_sites = ((x($_POST,'allowed_sites')) ? notags(trim($_POST['allowed_sites'])) : ''); $allowed_sites = ((x($_POST,'allowed_sites')) ? notags(trim($_POST['allowed_sites'])) : '');
$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);
$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'])) : '');
@ -135,6 +136,7 @@ class Site {
set_config('system','allowed_sites', $allowed_sites); set_config('system','allowed_sites', $allowed_sites);
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','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');
@ -314,6 +316,8 @@ class Site {
'$verify_email' => array('verify_email', t("Verify Email Addresses"), get_config('system','verify_email'), t("Check to verify email addresses used in account registration (recommended).")), '$verify_email' => array('verify_email', t("Verify Email Addresses"), get_config('system','verify_email'), t("Check to verify email addresses used in account registration (recommended).")),
'$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.')),
'$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.")),

View File

@ -97,6 +97,9 @@ class Dirsearch extends \Zotlabs\Web\Controller {
else else
$sync = false; $sync = false;
if(($dirmode == DIRECTORY_MODE_STANDALONE) && (! $hub)) {
$hub = \App::get_hostname();
}
if($hub) if($hub)
$hub_query = " and xchan_hash in (select hubloc_hash from hubloc where hubloc_host = '" . protect_sprintf(dbesc($hub)) . "') "; $hub_query = " and xchan_hash in (select hubloc_hash from hubloc where hubloc_host = '" . protect_sprintf(dbesc($hub)) . "') ";

View File

@ -17,9 +17,16 @@ class Pubstream extends \Zotlabs\Web\Controller {
return login(); return login();
} }
$disable_discover_tab = get_config('system','disable_discover_tab') || get_config('system','disable_discover_tab') === false; $site_firehose = ((intval(get_config('system','site_firehose',0))) ? true : false);
if($disable_discover_tab) $net_firehose = ((get_config('system','disable_discover_tab',1)) ? false : true);
return;
if(! ($site_firehose || $net_firehose)) {
return '';
}
if($net_firehose) {
$site_firehose = false;
}
$mid = ((x($_REQUEST,'mid')) ? $_REQUEST['mid'] : ''); $mid = ((x($_REQUEST,'mid')) ? $_REQUEST['mid'] : '');
@ -142,7 +149,7 @@ class Pubstream extends \Zotlabs\Web\Controller {
require_once('include/channel.php'); require_once('include/channel.php');
require_once('include/security.php'); require_once('include/security.php');
if(get_config('system','site_firehose')) { if($site_firehose) {
$uids = " and item.uid in ( " . stream_perms_api_uids(PERMS_PUBLIC) . " ) and item_private = 0 and item_wall = 1 "; $uids = " and item.uid in ( " . stream_perms_api_uids(PERMS_PUBLIC) . " ) and item_private = 0 and item_wall = 1 ";
} }
else { else {

View File

@ -82,7 +82,8 @@ function import_channel($channel, $account_id, $seize) {
'channel_r_storage', 'channel_r_pages', 'channel_w_stream', 'channel_w_wall', 'channel_r_storage', 'channel_r_pages', 'channel_w_stream', 'channel_w_wall',
'channel_w_comment', 'channel_w_mail', 'channel_w_like', 'channel_w_tagwall', 'channel_w_comment', 'channel_w_mail', 'channel_w_like', 'channel_w_tagwall',
'channel_w_chat', 'channel_w_storage', 'channel_w_pages', 'channel_a_republish', 'channel_w_chat', 'channel_w_storage', 'channel_w_pages', 'channel_a_republish',
'channel_a_delegate', 'perm_limits', 'channel_password', 'channel_salt' 'channel_a_delegate', 'perm_limits', 'channel_password', 'channel_salt',
'channel_moved'
]; ];
$clean = array(); $clean = array();

View File

@ -313,39 +313,25 @@ function dir_tagadelic($count = 0, $hub = '') {
$count = intval($count); $count = intval($count);
$dirmode = get_config('system','directory_mode'); if($hub) {
if(($dirmode == DIRECTORY_MODE_STANDALONE) && (! $hub)) {
$hub = \App::get_hostname();
}
if($hub)
$hub_query = " and xtag_hash in (select hubloc_hash from hubloc where hubloc_host = '" . protect_sprintf(dbesc($hub)) . "') ";
else
$hub_query = '';
if($hub_query) {
// Fetch tags
$r = q("select xtag_term as term, count(xtag_term) as total from xtag $r = q("select xtag_term as term, count(xtag_term) as total from xtag
left join hubloc on xtag_hash = hubloc_hash left join hubloc on xtag_hash = hubloc_hash
where xtag_flags = 0 $hub_query where xtag_flags = 0 and xtag_hash in (select hubloc_hash from hubloc where hubloc_host = '%s' )
group by xtag_term order by total desc %s", group by xtag_term order by total desc %s",
dbesc($hub),
((intval($count)) ? "limit $count" : '') ((intval($count)) ? "limit $count" : '')
); );
} }
else { else {
// Fetch tags
$r = q("select xtag_term as term, count(xtag_term) as total from xtag where xtag_flags = 0 $r = q("select xtag_term as term, count(xtag_term) as total from xtag where xtag_flags = 0
group by xtag_term order by total desc %s", group by xtag_term order by total desc %s",
((intval($count)) ? "limit $count" : '') ((intval($count)) ? "limit $count" : '')
); );
} }
if(! $r) if(! $r)
return array(); return [];
return Zotlabs\Text\Tagadelic::calc($r); return Zotlabs\Text\Tagadelic::calc($r);
} }

View File

@ -127,8 +127,11 @@ function clean_query_string($s = '') {
* @return string * @return string
*/ */
function zidify_callback($match) { function zidify_callback($match) {
$is_zid = ((feature_enabled(local_channel(), 'sendzid')) || (strpos($match[1], 'zrl')) ? true : false);
$replace = '<a' . $match[1] . ' href="' . (($is_zid) ? zid($match[2]) : $match[2]) . '"'; $arr = [ 'zid' => ((strpos($match[1],'zrl')) ? true : false), 'url' => $match[2] ];
call_hooks('zidify', $arr);
$replace = '<a' . $match[1] . ' href="' . (intval($arr['zid']) ? zid($arr['url']) : $arr['url']) . '"';
$x = str_replace($match[0], $replace, $match[0]); $x = str_replace($match[0], $replace, $match[0]);
@ -136,8 +139,11 @@ function zidify_callback($match) {
} }
function zidify_img_callback($match) { function zidify_img_callback($match) {
$is_zid = ((feature_enabled(local_channel(), 'sendzid')) || (strpos($match[1], 'zrl')) ? true : false);
$replace = '<img' . $match[1] . ' src="' . (($is_zid) ? zid($match[2]) : $match[2]) . '"'; $arr = [ 'zid' => ((strpos($match[1],'zrl')) ? true : false), 'url' => $match[2] ];
call_hooks('zidify', $arr);
$replace = '<img' . $match[1] . ' src="' . (intval($arr['zid']) ? zid($arr['url']) : $arr['url']) . '"';
$x = str_replace($match[0], $replace, $match[0]); $x = str_replace($match[0], $replace, $match[0]);

View File

@ -82,6 +82,7 @@
{{include file="field_checkbox.tpl" field=$feed_contacts}} {{include file="field_checkbox.tpl" field=$feed_contacts}}
{{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}}
<div class="submit"><input type="submit" name="page_site" value="{{$submit}}" /></div> <div class="submit"><input type="submit" name="page_site" value="{{$submit}}" /></div>