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);
}
$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">';
$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;
* @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>';
-
}
function fbsync_settings(&$a,&$s) {
+ // Settings are done inside the fbpost addon
+ return;
+
if(! local_user())
return;
/* 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">';