mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2024-11-22 09:33:46 +00:00
Ability to restrict Facebook fiend linking on a site. This is provided as a plugin so that it can be seen in a public site addon list.
This commit is contained in:
parent
084a4b68f6
commit
0e778309db
4 changed files with 41 additions and 1 deletions
BIN
facebook.tgz
BIN
facebook.tgz
Binary file not shown.
|
@ -430,6 +430,10 @@ function facebook_post(&$a) {
|
||||||
$uid = local_user();
|
$uid = local_user();
|
||||||
if($uid){
|
if($uid){
|
||||||
|
|
||||||
|
|
||||||
|
$fb_limited = get_config('facebook','restrict');
|
||||||
|
|
||||||
|
|
||||||
$value = ((x($_POST,'post_by_default')) ? intval($_POST['post_by_default']) : 0);
|
$value = ((x($_POST,'post_by_default')) ? intval($_POST['post_by_default']) : 0);
|
||||||
set_pconfig($uid,'facebook','post_by_default', $value);
|
set_pconfig($uid,'facebook','post_by_default', $value);
|
||||||
|
|
||||||
|
@ -445,6 +449,12 @@ function facebook_post(&$a) {
|
||||||
set_pconfig($uid,'facebook','blocked_apps',escape_tags(trim($_POST['blocked_apps'])));
|
set_pconfig($uid,'facebook','blocked_apps',escape_tags(trim($_POST['blocked_apps'])));
|
||||||
|
|
||||||
$linkvalue = ((x($_POST,'facebook_linking')) ? intval($_POST['facebook_linking']) : 0);
|
$linkvalue = ((x($_POST,'facebook_linking')) ? intval($_POST['facebook_linking']) : 0);
|
||||||
|
|
||||||
|
if($fb_limited) {
|
||||||
|
if($linkvalue == 0)
|
||||||
|
set_pconfig($uid,'facebook','no_linking', 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
set_pconfig($uid,'facebook','no_linking', (($linkvalue) ? 0 : 1));
|
set_pconfig($uid,'facebook','no_linking', (($linkvalue) ? 0 : 1));
|
||||||
|
|
||||||
// FB linkage was allowed but has just been turned off - remove all FB contacts and posts
|
// FB linkage was allowed but has just been turned off - remove all FB contacts and posts
|
||||||
|
@ -496,6 +506,9 @@ function facebook_content(&$a) {
|
||||||
info( t('Updating contacts') . EOL);
|
info( t('Updating contacts') . EOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$fb_limited = get_config('facebook','restrict');
|
||||||
|
|
||||||
$o = '';
|
$o = '';
|
||||||
|
|
||||||
$fb_installed = false;
|
$fb_installed = false;
|
||||||
|
@ -549,6 +562,15 @@ function facebook_content(&$a) {
|
||||||
|
|
||||||
$no_linking = get_pconfig(local_user(),'facebook','no_linking');
|
$no_linking = get_pconfig(local_user(),'facebook','no_linking');
|
||||||
$checked = (($no_linking) ? '' : ' checked="checked" ');
|
$checked = (($no_linking) ? '' : ' checked="checked" ');
|
||||||
|
if($fb_limited) {
|
||||||
|
if($no_linking) {
|
||||||
|
$o .= EOL . '<strong>' . t('Facebook friend linking has been disabled on this site. The following settings will have no effect.') . '</strong>' . EOL;
|
||||||
|
$checked .= " disabled ";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$o .= EOL . '<strong>' . t('Facebook friend linking has been disabled on this site. If you disable it, you will be unable to re-enable it.') . '</strong>' . EOL;
|
||||||
|
}
|
||||||
|
}
|
||||||
$o .= '<input type="checkbox" name="facebook_linking" value="1"' . $checked . '/>' . ' ' . t('Link all your Facebook friends and conversations on this website') . EOL ;
|
$o .= '<input type="checkbox" name="facebook_linking" value="1"' . $checked . '/>' . ' ' . t('Link all your Facebook friends and conversations on this website') . EOL ;
|
||||||
|
|
||||||
$o .= '<p>' . t('Facebook conversations consist of your <em>profile wall</em> and your friend <em>stream</em>.');
|
$o .= '<p>' . t('Facebook conversations consist of your <em>profile wall</em> and your friend <em>stream</em>.');
|
||||||
|
|
BIN
facebook_restrict.tgz
Normal file
BIN
facebook_restrict.tgz
Normal file
Binary file not shown.
18
facebook_restrict/facebook_restrict.php
Normal file
18
facebook_restrict/facebook_restrict.php
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name: Facebook Restrict
|
||||||
|
* Description: Install this addon and Facebook users will not be able to link friends. Existing users that are linking friends will not be affected.
|
||||||
|
* Version: 1.0
|
||||||
|
* Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
function facebook_restrict_install() {
|
||||||
|
set_config('facebook','restrict',1);
|
||||||
|
}
|
||||||
|
|
||||||
|
function facebook_restrict_uninstall() {
|
||||||
|
set_config('facebook','restrict',0);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue