Merge branch 'master' of https://github.com/redmatrix/redmatrix
This commit is contained in:
		| @@ -64,6 +64,15 @@ function diaspora_dispatch($importer,$msg) { | |||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	$allowed = get_pconfig($importer['channel_id'],'system','diaspora_allowed'); | ||||||
|  | 	if($allowed === false) | ||||||
|  | 		$allowed = 1; | ||||||
|  |  | ||||||
|  | 	if(! intval($allowed)) { | ||||||
|  | 		logger('mod-diaspora: disallowed for channel ' . $importer['channel_name']); | ||||||
|  | 		return; | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	// php doesn't like dashes in variable names | 	// php doesn't like dashes in variable names | ||||||
|  |  | ||||||
| 	$msg['message'] = str_replace( | 	$msg['message'] = str_replace( | ||||||
| @@ -169,6 +178,16 @@ function diaspora_process_outbound($arr) { | |||||||
| */ | */ | ||||||
|  |  | ||||||
|  |  | ||||||
|  | 	$allowed = get_pconfig($arr['channel']['channel_id'],'system','diaspora_allowed'); | ||||||
|  | 	if($allowed === false) | ||||||
|  | 		$allowed = 1; | ||||||
|  |  | ||||||
|  | 	if(! intval($allowed)) { | ||||||
|  | 		logger('mod-diaspora: disallowed for channel ' . $arr['channel']['channel_name']); | ||||||
|  | 		return; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  |  | ||||||
| 	if($arr['location']) | 	if($arr['location']) | ||||||
| 		return; | 		return; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -135,6 +135,15 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false) | |||||||
| 				$result['message'] = t('Protocol disabled.'); | 				$result['message'] = t('Protocol disabled.'); | ||||||
| 				return $result; | 				return $result; | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
|  | 			$allowed = get_pconfig($uid,'system','diaspora_allowed'); | ||||||
|  | 			if($allowed === false) | ||||||
|  | 				$allowed = 1; | ||||||
|  |  | ||||||
|  | 			if(! intval($allowed)) { | ||||||
|  | 				$result['message'] = t('Protocol blocked for this channel.'); | ||||||
|  | 				return $result; | ||||||
|  | 			} | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$their_perms = 0; | 		$their_perms = 0; | ||||||
|   | |||||||
| @@ -280,6 +280,7 @@ function admin_page_site_post(&$a){ | |||||||
|  |  | ||||||
| 	$register_text		=	((x($_POST,'register_text'))	? notags(trim($_POST['register_text']))		: ''); | 	$register_text		=	((x($_POST,'register_text'))	? notags(trim($_POST['register_text']))		: ''); | ||||||
| 	$frontpage		    =	((x($_POST,'frontpage'))	? notags(trim($_POST['frontpage']))		: ''); | 	$frontpage		    =	((x($_POST,'frontpage'))	? notags(trim($_POST['frontpage']))		: ''); | ||||||
|  | 	$mirror_frontpage   =	((x($_POST,'mirror_frontpage'))	? intval(trim($_POST['mirror_frontpage']))		: 0); | ||||||
|  |  | ||||||
| 	$allowed_sites        = ((x($_POST,'allowed_sites'))	? notags(trim($_POST['allowed_sites']))		: ''); | 	$allowed_sites        = ((x($_POST,'allowed_sites'))	? notags(trim($_POST['allowed_sites']))		: ''); | ||||||
| 	$allowed_email        = ((x($_POST,'allowed_email'))	? notags(trim($_POST['allowed_email']))		: ''); | 	$allowed_email        = ((x($_POST,'allowed_email'))	? notags(trim($_POST['allowed_email']))		: ''); | ||||||
| @@ -309,6 +310,7 @@ function admin_page_site_post(&$a){ | |||||||
| 	set_config('system', 'poll_interval', $poll_interval); | 	set_config('system', 'poll_interval', $poll_interval); | ||||||
| 	set_config('system', 'maxloadavg', $maxloadavg); | 	set_config('system', 'maxloadavg', $maxloadavg); | ||||||
| 	set_config('system', 'frontpage', $frontpage); | 	set_config('system', 'frontpage', $frontpage); | ||||||
|  | 	set_config('system', 'mirror_frontpage', $mirror_frontpage); | ||||||
| 	set_config('system', 'sitename', $sitename); | 	set_config('system', 'sitename', $sitename); | ||||||
| 	set_config('system', 'login_on_homepage', $login_on_homepage); | 	set_config('system', 'login_on_homepage', $login_on_homepage); | ||||||
| 	set_config('system', 'verify_email', $verify_email); | 	set_config('system', 'verify_email', $verify_email); | ||||||
| @@ -472,6 +474,7 @@ function admin_page_site(&$a) { | |||||||
| 		'$access_policy'	=> array('access_policy', t("Which best describes the types of account offered by this hub?"), get_config('system','access_policy'), "This is displayed on the public server site list.", $access_choices), | 		'$access_policy'	=> array('access_policy', t("Which best describes the types of account offered by this hub?"), get_config('system','access_policy'), "This is displayed on the public server site list.", $access_choices), | ||||||
| 		'$register_text'	=> array('register_text', t("Register text"), htmlspecialchars(get_config('system','register_text'), ENT_QUOTES, 'UTF-8'), t("Will be displayed prominently on the registration page.")), | 		'$register_text'	=> array('register_text', t("Register text"), htmlspecialchars(get_config('system','register_text'), ENT_QUOTES, 'UTF-8'), t("Will be displayed prominently on the registration page.")), | ||||||
| 		'$frontpage'	=> array('frontpage', t("Site homepage to show visitors (default: login box)"), get_config('system','frontpage'), t("example: 'public' to show public stream, 'page/sys/home' to show a system webpage called 'home' or 'include:home.html' to include a file.")), | 		'$frontpage'	=> array('frontpage', t("Site homepage to show visitors (default: login box)"), get_config('system','frontpage'), t("example: 'public' to show public stream, 'page/sys/home' to show a system webpage called 'home' or 'include:home.html' to include a file.")), | ||||||
|  | 		'$mirror_frontpage'	=> array('mirror_frontpage', t("Preserve site homepage URL"), get_config('system','mirror_frontpage'), t('Present the site homepage in a frame at the original location instead of redirecting')), | ||||||
| 		'$abandon_days'     => array('abandon_days', t('Accounts abandoned after x days'), get_config('system','account_abandon_days'), t('Will not waste system resources polling external sites for abandonded accounts. Enter 0 for no time limit.')), | 		'$abandon_days'     => array('abandon_days', t('Accounts abandoned after x days'), get_config('system','account_abandon_days'), t('Will not waste system resources polling external sites for abandonded accounts. Enter 0 for no time limit.')), | ||||||
| 		'$allowed_sites'	=> array('allowed_sites', t("Allowed friend domains"), get_config('system','allowed_sites'), t("Comma separated list of domains which are allowed to establish friendships with this site. Wildcards are accepted. Empty to allow any domains")), | 		'$allowed_sites'	=> array('allowed_sites', t("Allowed friend domains"), get_config('system','allowed_sites'), t("Comma separated list of domains which are allowed to establish friendships with this site. Wildcards are accepted. Empty to allow any domains")), | ||||||
| 		'$allowed_email'	=> array('allowed_email', t("Allowed email domains"), get_config('system','allowed_email'), t("Comma separated list of domains which are allowed in email addresses for registrations to this site. Wildcards are accepted. Empty to allow any domains")), | 		'$allowed_email'	=> array('allowed_email', t("Allowed email domains"), get_config('system','allowed_email'), t("Comma separated list of domains which are allowed in email addresses for registrations to this site. Wildcards are accepted. Empty to allow any domains")), | ||||||
|   | |||||||
| @@ -124,6 +124,7 @@ function settings_post(&$a) { | |||||||
| 		call_hooks('feature_settings_post', $_POST); | 		call_hooks('feature_settings_post', $_POST); | ||||||
|  |  | ||||||
| 		if($_POST['dspr-submit']) { | 		if($_POST['dspr-submit']) { | ||||||
|  | 			set_pconfig(local_channel(),'system','diaspora_allowed',intval($_POST['dspr_allowed'])); | ||||||
| 			set_pconfig(local_channel(),'system','diaspora_public_comments',intval($_POST['dspr_pubcomment'])); | 			set_pconfig(local_channel(),'system','diaspora_public_comments',intval($_POST['dspr_pubcomment'])); | ||||||
| 			set_pconfig(local_channel(),'system','prevent_tag_hijacking',intval($_POST['dspr_hijack'])); | 			set_pconfig(local_channel(),'system','prevent_tag_hijacking',intval($_POST['dspr_hijack'])); | ||||||
| 			info( t('Diaspora Policy Settings updated.') . EOL); | 			info( t('Diaspora Policy Settings updated.') . EOL); | ||||||
| @@ -667,12 +668,13 @@ function settings_content(&$a) { | |||||||
| 			$settings_addons = t('No feature settings configured'); | 			$settings_addons = t('No feature settings configured'); | ||||||
|  |  | ||||||
| 		if($diaspora_enabled) { | 		if($diaspora_enabled) { | ||||||
|  | 			$dspr_allowed = get_pconfig(local_channel(),'system','diaspora_allowed'); | ||||||
|  | 			if($dspr_allowed === false) | ||||||
|  | 				$dspr_allowed = 1; | ||||||
| 			$pubcomments = get_pconfig(local_channel(),'system','diaspora_public_comments'); | 			$pubcomments = get_pconfig(local_channel(),'system','diaspora_public_comments'); | ||||||
| 			if($pubcomments === false) | 			if($pubcomments === false) | ||||||
| 				$pubcomments = 1; | 				$pubcomments = 1; | ||||||
| 			$hijacking = get_pconfig(local_channel(),'system','prevent_tag_hijacking'); | 			$hijacking = get_pconfig(local_channel(),'system','prevent_tag_hijacking'); | ||||||
|  |  | ||||||
|  |  | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		call_hooks('feature_settings', $settings_addons); | 		call_hooks('feature_settings', $settings_addons); | ||||||
| @@ -684,6 +686,7 @@ function settings_content(&$a) { | |||||||
| 			'$diaspora_enabled' => $diaspora_enabled, | 			'$diaspora_enabled' => $diaspora_enabled, | ||||||
| 			'$dsprdesc' => t('Settings for the built-in Diaspora emulator'),  | 			'$dsprdesc' => t('Settings for the built-in Diaspora emulator'),  | ||||||
| 			'$pubcomments' => array('dspr_pubcomment', t('Allow any Diaspora member to comment on your public posts'), $pubcomments, '', $yes_no), | 			'$pubcomments' => array('dspr_pubcomment', t('Allow any Diaspora member to comment on your public posts'), $pubcomments, '', $yes_no), | ||||||
|  | 			'$dspr_allowed' => array('dspr_allowed', t('Enable the Diaspora protocol for this channel'), $dspr_allowed, '', $yes_no), | ||||||
| 			'$dsprtitle' => t('Diaspora Policy Settings'), | 			'$dsprtitle' => t('Diaspora Policy Settings'), | ||||||
| 			'$hijacking' => array('dspr_hijack', t('Prevent your hashtags from being redirected to other sites'), $hijacking, '', $yes_no), | 			'$hijacking' => array('dspr_hijack', t('Prevent your hashtags from being redirected to other sites'), $hijacking, '', $yes_no), | ||||||
| 			'$dsprsubmit' => t('Submit'), | 			'$dsprsubmit' => t('Submit'), | ||||||
|   | |||||||
| @@ -47,6 +47,7 @@ | |||||||
| 	{{include file="field_select.tpl" field=$theme}} | 	{{include file="field_select.tpl" field=$theme}} | ||||||
|     {{include file="field_select.tpl" field=$theme_mobile}} |     {{include file="field_select.tpl" field=$theme_mobile}} | ||||||
|     {{include file="field_input.tpl" field=$frontpage}} |     {{include file="field_input.tpl" field=$frontpage}} | ||||||
|  |     {{include file="field_checkbox.tpl" field=$mirror_frontpage}} | ||||||
|     {{include file="field_checkbox.tpl" field=$login_on_homepage}} |     {{include file="field_checkbox.tpl" field=$login_on_homepage}} | ||||||
|  |  | ||||||
| 	 | 	 | ||||||
|   | |||||||
| @@ -17,6 +17,7 @@ | |||||||
| 				<div id="dspr-settings-content" class="panel-collapse collapse" role="tabpanel" aria-labelledby="dspr-settings"> | 				<div id="dspr-settings-content" class="panel-collapse collapse" role="tabpanel" aria-labelledby="dspr-settings"> | ||||||
| 					<div class="section-content-tools-wrapper"> | 					<div class="section-content-tools-wrapper"> | ||||||
|  |  | ||||||
|  | 						{{include file="field_checkbox.tpl" field=$dspr_allowed}} | ||||||
| 						{{include file="field_checkbox.tpl" field=$pubcomments}} | 						{{include file="field_checkbox.tpl" field=$pubcomments}} | ||||||
| 						{{include file="field_checkbox.tpl" field=$hijacking}} | 						{{include file="field_checkbox.tpl" field=$hijacking}} | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user