$postarray['wall'] = 0;
$postarray['verb'] = ACTIVITY_POST;
+ $postarray['network'] = dbesc(NETWORK_FACEBOOK);
$postarray['uri'] = "fb::".$post->post_id;
$postarray['thr-parent'] = $postarray['uri'];
$postarray['wall'] = 0;
$postarray['verb'] = ACTIVITY_POST;
+ $postarray['network'] = dbesc(NETWORK_FACEBOOK);
$postarray['uri'] = "fb::".$comment->id;
$postarray['thr-parent'] = $parent_uri;
$likedata = array();
$likedata['parent'] = $orig_post['id'];
$likedata['verb'] = ACTIVITY_LIKE;
+ $likedate['network'] = dbesc(NETWORK_FACEBOOK);
$likedata['gravity'] = 3;
$likedata['uid'] = $uid;
$likedata['wall'] = 0;
$likedata['uri'] = item_new_uri($a->get_baseurl(), $uid);
$likedata['parent-uri'] = $orig_post["uri"];
$likedata['app'] = "Facebook";
- $likedata['verb'] = ACTIVITY_LIKE;
if ($like->user_id != $self_id) {
$likedata['contact-id'] = $contact_id;
function fbsync_fetch_contact($uid, $contact, $create_user) {
+ // Check if the unique contact is existing
+ // To-Do: only update once a while
+ $r = q("SELECT id FROM unique_contacts WHERE url='%s' LIMIT 1",
+ dbesc(normalise_link($contact->url)));
+
+ if (count($r) == 0)
+ q("INSERT INTO unique_contacts (url, name, nick, avatar) VALUES ('%s', '%s', '%s', '%s')",
+ dbesc(normalise_link($contact->url)),
+ dbesc($contact->name),
+ dbesc($contact->username),
+ dbesc($contact->pic_square));
+ else
+ q("UPDATE unique_contacts SET name = '%s', nick = '%s', avatar = '%s' WHERE url = '%s'",
+ dbesc($contact->name),
+ dbesc($contact->username),
+ dbesc($contact->pic_square),
+ dbesc(normalise_link($contact->url)));
+
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1",
intval($uid), dbesc("facebook::".$contact->id));
require_once('include/items.php');
- if ($last_updated == "")
+ //if ($last_updated == "")
$last_updated = 0;
logger("fbsync_fetchfeed: fetching content for user ".$self_id);
del_pconfig(local_user(), 'twitter', 'intelligent_shortening');
del_pconfig(local_user(), 'twitter', 'import');
del_pconfig(local_user(), 'twitter', 'create_user');
+ del_pconfig(local_user(), 'twitter', 'own_id');
} else {
if (isset($_POST['twitter-pin'])) {
// if the user supplied us with a PIN from Twitter, let the magic of OAuth happen
$orig_post = $r[0];
}
- // To-Do: Ab dem letzten / nehmen
- $b["body"] = "@".substr($orig_post["author-link"], 20)." ".$b["body"];
+ $nickname = preg_replace("=https?://twitter.com/(.*)=ism", "$1", $orig_post["author-link"]);
+ $nickname = "@[url=".$orig_post["author-link"]."]".$nickname."[/url]";
+
+ logger("twitter_post_hook: comparing ".$nickname." with ".$b["body"], LOGGER_DEBUG);
+ if (strpos($b["body"], $nickname) === false)
+ $b["body"] = $nickname." ".$b["body"];
logger("twitter_post_hook: parent found ".print_r($orig_post, true), LOGGER_DATA);
} else {
function twitter_fetch_contact($uid, $contact, $create_user) {
+ // Check if the unique contact is existing
+ // To-Do: only update once a while
+ $r = q("SELECT id FROM unique_contacts WHERE url='%s' LIMIT 1",
+ dbesc(normalise_link("https://twitter.com/".$contact->screen_name)));
+
+ if (count($r) == 0)
+ q("INSERT INTO unique_contacts (url, name, nick, avatar) VALUES ('%s', '%s', '%s', '%s')",
+ dbesc(normalise_link("https://twitter.com/".$contact->screen_name)),
+ dbesc($contact->name),
+ dbesc($contact->screen_name),
+ dbesc($contact->profile_image_url_https));
+ else
+ q("UPDATE unique_contacts SET name = '%s', nick = '%s', avatar = '%s' WHERE url = '%s'",
+ dbesc($contact->name),
+ dbesc($contact->screen_name),
+ dbesc($contact->profile_image_url_https),
+ dbesc(normalise_link("https://twitter.com/".$contact->screen_name)));
+
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1",
intval($uid), dbesc("twitter::".$contact->id_str));
dbesc(datetime_convert()),
intval($contact_id)
);
+
} else {
// update profile photos once every two weeks as we have no notification of when they change.
$has_picture = false;
$postarray = array();
+ $postarray['network'] = NETWORK_TWITTER;
$postarray['gravity'] = 0;
$postarray['uid'] = $uid;
$postarray['wall'] = 0;
$postarray['body'] = $converted["body"];
$postarray['tag'] = $converted["tags"];
+ twitter_fetch_contact($uid, $post->retweeted_status->user, false);
// Deactivated at the moment, since there are problems with answers to retweets
if (false AND !intval(get_config('system','wall-to-wall_share'))) {
if (sizeof($data["images"]) > 0) {
$imagedata = $data["images"][0];
- $text .= '[img='.$imagedata["width"].'x'.$imagedata["height"].']'.$imagedata["src"].'[/img]' . "\n";
+ //$text .= '[img='.$imagedata["width"].'x'.$imagedata["height"].']'.$imagedata["src"].'[/img]' . "\n";
+ $text .= '[img]'.$imagedata["src"].'[/img]'."\n";
}
if (is_string($data["text"]))
intval($uid), dbesc("twitter::".$own_id));
if(count($r))
$contact_id = $r[0]["id"];
+ else
+ del_pconfig($uid, 'twitter', 'own_id');
+
}
return($contact_id);