define('FACEBOOK_DEFAULT_POLL_INTERVAL', 60); // given in minutes
define('FACEBOOK_MIN_POLL_INTERVAL', 5);
+require_once('include/security.php');
function facebook_install() {
register_hook('post_local', 'addon/facebook/facebook.php', 'facebook_post_local');
function facebook_plugin_admin(&$a, &$o){
+
+
$o = '<input type="hidden" name="form_security_token" value="' . get_form_security_token("fbsave") . '">';
$o .= '<h4>' . t('Facebook API Key') . '</h4>';
}
// don't store post if we don't have a contact
-
if(! x($datarray,'contact-id')) {
- //if (get_config('facebook', 'pages')) {
- // // If no user is found then post it under the own id.
- // // Definitely a quickhack
- // $datarray['contact-id'] = $self[0]['id'];
- //} else {
- logger('facebook: no contact '.$from->name.' '.$from->id.'. post ignored');
- continue;
- //}
+ logger('facebook: no contact '.$from->name.' '.$from->id.'. post ignored');
+ continue;
}
$datarray['verb'] = ACTIVITY_POST;
}
}
+ if (($datarray['app'] == "Events") and $entry->actions)
+ foreach ($entry->actions as $action)
+ if ($action->name == "View")
+ $datarray['body'] .= " [url=".$action->link."]".$entry->story."[/url]";
+
// Just as a test - to see if these are the missing entries
- if(trim($datarray['body']) == '')
- $datarray['body'] = $entry->story;
+ //if(trim($datarray['body']) == '')
+ // $datarray['body'] = $entry->story;
+
+ // Adding the "story" text to see if there are useful data in it (testing)
+ //if (($datarray['app'] != "Events") and $entry->story)
+ // $datarray['body'] .= "\n".$entry->story;
if(trim($datarray['body']) == '') {
logger('facebook: empty body '.$entry->id.' '.print_r($entry, true));
//if(($datarray['body'] != '') and ($uid == 1))
// $datarray['body'] .= "[noparse]".print_r($entry, true)."[/noparse]";
- if ($entry->place->name)
- $datarray['coord'] = $entry->place->name;
- else if ($entry->place->location->street or $entry->place->location->city or $entry->place->location->Denmark) {
+ if ($entry->place->name or $entry->place->location->street or
+ $entry->place->location->city or $entry->place->location->Denmark) {
+ $datarray['coord'] = '';
+ if ($entry->place->name)
+ $datarray['coord'] .= $entry->place->name;
if ($entry->place->location->street)
- $datarray['coord'] = $entry->place->location->street;
+ $datarray['coord'] .= $entry->place->location->street;
if ($entry->place->location->city)
$datarray['coord'] .= " ".$entry->place->location->city;
if ($entry->place->location->country)