mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2024-11-25 18:43:15 +00:00
Facebook: The settings of "fbsync" are shown inside of "fbpost" if activated.
This commit is contained in:
parent
7521977ab8
commit
71a42a1749
2 changed files with 39 additions and 6 deletions
|
@ -152,6 +152,12 @@ function fbpost_post(&$a) {
|
|||
set_pconfig($uid,'facebook','post_to_page', $values[0]);
|
||||
set_pconfig($uid,'facebook','page_access_token', $values[1]);
|
||||
|
||||
$result = q("SELECT `installed` FROM `addon` WHERE `name` = 'fbsync' AND `installed`");
|
||||
if (count($result) > 0) {
|
||||
set_pconfig(local_user(),'fbsync','sync',intval($_POST['fbsync']));
|
||||
set_pconfig(local_user(),'fbsync','create_user',intval($_POST['create_user']));
|
||||
}
|
||||
|
||||
info( t('Settings updated.') . EOL);
|
||||
}
|
||||
|
||||
|
@ -207,7 +213,15 @@ function fbpost_content(&$a) {
|
|||
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'
|
||||
. $a->get_baseurl() . '/addon/fbpost/fbpost.css' . '" media="all" />' . "\r\n";
|
||||
|
||||
$o .= '<h3>' . t('Facebook Export/Mirror') . '</h3>';
|
||||
$result = q("SELECT `installed` FROM `addon` WHERE `name` = 'fbsync' AND `installed`");
|
||||
$fbsync = (count($result) > 0);
|
||||
|
||||
if($fbsync)
|
||||
$title = t('Facebook Import/Export/Mirror');
|
||||
else
|
||||
$title = t('Facebook Export/Mirror');
|
||||
|
||||
$o .= '<img class="connector" src="images/facebook.png" /><h3 class="connector">'.$title.'</h3>';
|
||||
|
||||
if(! $fb_installed) {
|
||||
$o .= '<div id="fbpost-enable-wrapper">';
|
||||
|
@ -279,8 +293,20 @@ function fbpost_content(&$a) {
|
|||
|
||||
$o .= "</select>";
|
||||
|
||||
$o .= '<p><input type="submit" name="submit" value="' . t('Save Settings') . '" /></form></div>';
|
||||
if ($fbsync) {
|
||||
|
||||
$o .= '<div class="clear"></div>';
|
||||
|
||||
$sync_enabled = get_pconfig(local_user(),'fbsync','sync');
|
||||
$checked = (($sync_enabled) ? ' checked="checked" ' : '');
|
||||
$o .= '<input type="checkbox" name="fbsync" value="1"' . $checked . '/>' . ' ' . t('Import Facebook newsfeed.') . EOL;
|
||||
|
||||
$create_user = get_pconfig(local_user(),'fbsync','create_user');
|
||||
$checked = (($create_user) ? ' checked="checked" ' : '');
|
||||
$o .= '<input type="checkbox" name="create_user" value="1"' . $checked . '/>' . ' ' . t('Automatically create contacts.') . EOL;
|
||||
|
||||
}
|
||||
$o .= '<p><input type="submit" name="submit" value="' . t('Save Settings') . '" /></form></div>';
|
||||
}
|
||||
|
||||
return $o;
|
||||
|
@ -291,11 +317,15 @@ function fbpost_content(&$a) {
|
|||
* @param null|object $b
|
||||
*/
|
||||
function fbpost_plugin_settings(&$a,&$b) {
|
||||
$result = q("SELECT `installed` FROM `addon` WHERE `name` = 'fbsync' AND `installed`");
|
||||
if(count($result) > 0)
|
||||
$title = t('Facebook Import/Export/Mirror');
|
||||
else
|
||||
$title = t('Facebook Export/Mirror');
|
||||
|
||||
$b .= '<div class="settings-block">';
|
||||
$b .= '<a href="fbpost"><h3>' . t('Facebook Export/Mirror') . '</a></h3>';
|
||||
$b .= '<a href="fbpost"><img class="connector" src="images/facebook.png" /><h3 class="connector">'.$title.'</h3></a>';
|
||||
$b .= '</div>';
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -100,6 +100,9 @@ function fbsync_follow($a, &$contact) {
|
|||
|
||||
function fbsync_settings(&$a,&$s) {
|
||||
|
||||
// Settings are done inside the fbpost addon
|
||||
return;
|
||||
|
||||
if(! local_user())
|
||||
return;
|
||||
|
||||
|
@ -120,11 +123,11 @@ function fbsync_settings(&$a,&$s) {
|
|||
/* Add some HTML to the existing form */
|
||||
|
||||
$s .= '<span id="settings_fbsync_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_fbsync_expanded\'); openClose(\'settings_fbsync_inflated\');">';
|
||||
$s .= '<h3>' . t('Facebook Import') . '</h3>';
|
||||
$s .= '<img class="connector" src="images/facebook.png" /><h3 class="connector">'. t('Facebook Import').'</h3>';
|
||||
$s .= '</span>';
|
||||
$s .= '<div id="settings_fbsync_expanded" class="settings-block" style="display: none;">';
|
||||
$s .= '<span class="fakelink" onclick="openClose(\'settings_fbsync_expanded\'); openClose(\'settings_fbsync_inflated\');">';
|
||||
$s .= '<h3>' . t('Facebook Import') . '</h3>';
|
||||
$s .= '<img class="connector" src="images/facebook.png" /><h3 class="connector">'. t('Facebook Import').'</h3>';
|
||||
$s .= '</span>';
|
||||
|
||||
$s .= '<div id="fbsync-enable-wrapper">';
|
||||
|
|
Loading…
Reference in a new issue