mirror of
https://git.friendi.ca/friendica/friendica.git
synced 2025-06-17 05:25:15 +02:00
fb addon only working from one site - more debug + simplify permission toggle
This commit is contained in:
parent
89cbd17c72
commit
91190de0f0
2 changed files with 4 additions and 19 deletions
|
@ -123,15 +123,12 @@ function facebook_content(&$a) {
|
|||
function facebook_install() {
|
||||
register_hook('post_local_end', 'addon/facebook/facebook.php', 'facebook_post_hook');
|
||||
register_hook('jot_networks', 'addon/facebook/facebook.php', 'facebook_jot_nets');
|
||||
register_hook('post_local_start','addon/facebook/facebook.php', 'facebook_post_local');
|
||||
|
||||
}
|
||||
|
||||
|
||||
function facebook_uninstall() {
|
||||
unregister_hook('post_local_end', 'addon/facebook/facebook.php', 'facebook_post_hook');
|
||||
unregister_hook('jot_networks', 'addon/facebook/facebook.php', 'facebook_jot_nets');
|
||||
unregister_hook('post_local_start','addon/facebook/facebook.php', 'facebook_post_local');
|
||||
}
|
||||
|
||||
|
||||
|
@ -148,17 +145,6 @@ function facebook_jot_nets(&$a,&$b) {
|
|||
}
|
||||
}
|
||||
|
||||
function facebook_post_local(&$a,&$b) {
|
||||
|
||||
if(! local_user())
|
||||
return;
|
||||
|
||||
if((x($b,'facebook_enable')) && (intval($b['facebook_enable'])))
|
||||
set_pconfig(local_user(),'facebook','enable','1');
|
||||
else
|
||||
del_pconfig(local_user(),'facebook','enable');
|
||||
}
|
||||
|
||||
|
||||
function facebook_post_hook(&$a,&$b) {
|
||||
|
||||
|
@ -179,9 +165,10 @@ function facebook_post_hook(&$a,&$b) {
|
|||
logger('facebook: have appid+secret');
|
||||
|
||||
$fb_post = intval(get_pconfig(local_user(),'facebook','post'));
|
||||
$fb_enable = intval(get_pconfig(local_user(),'facebook','enable'));
|
||||
$fb_enable = (($fb_post && x($_POST,'facebook_enable')) ? intval($_POST['facebook_enable']) : 0);
|
||||
$fb_token = get_pconfig(local_user(),'facebook','access_token');
|
||||
|
||||
logger('facebook: $fb_post: ' . $fb_post . ' $fb_enable: ' . $fb_enable . ' $fb_token: ' . $fb_token,LOGGER_DEBUG);
|
||||
if($fb_post && $fb_token && $fb_enable) {
|
||||
logger('facebook: able to post');
|
||||
require_once('library/facebook.php');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue