Deprecated parts removed

This commit is contained in:
Michael 2017-03-09 06:58:36 +00:00
parent dd7dc77a10
commit 12994aaccd
7 changed files with 118 additions and 232 deletions

View file

@ -5,6 +5,7 @@
* Description: Bidirectional (posting and reading) connector for app.net. * Description: Bidirectional (posting and reading) connector for app.net.
* Version: 0.2 * Version: 0.2
* Author: Michael Vogel <https://pirati.ca/profile/heluecht> * Author: Michael Vogel <https://pirati.ca/profile/heluecht>
* Status: Unsupported
*/ */
/* /*
@ -1118,36 +1119,11 @@ function appnet_expand_annotations($a, $annotations) {
function appnet_fetchcontact($a, $uid, $contact, $me, $create_user) { function appnet_fetchcontact($a, $uid, $contact, $me, $create_user) {
if (function_exists("update_gcontact"))
update_gcontact(array("url" => $contact["canonical_url"], "generation" => 2, update_gcontact(array("url" => $contact["canonical_url"], "generation" => 2,
"network" => NETWORK_APPNET, "photo" => $contact["avatar_image"]["url"], "network" => NETWORK_APPNET, "photo" => $contact["avatar_image"]["url"],
"name" => $contact["name"], "nick" => $contact["username"], "name" => $contact["name"], "nick" => $contact["username"],
"about" => $contact["description"]["text"], "hide" => true, "about" => $contact["description"]["text"], "hide" => true,
"addr" => $contact["username"]."@app.net")); "addr" => $contact["username"]."@app.net"));
else {
// Old Code
$r = q("SELECT id FROM unique_contacts WHERE url='%s' LIMIT 1",
dbesc(normalise_link($contact["canonical_url"])));
if (count($r) == 0)
q("INSERT INTO unique_contacts (url, name, nick, avatar) VALUES ('%s', '%s', '%s', '%s')",
dbesc(normalise_link($contact["canonical_url"])),
dbesc($contact["name"]),
dbesc($contact["username"]),
dbesc($contact["avatar_image"]["url"]));
else
q("UPDATE unique_contacts SET name = '%s', nick = '%s', avatar = '%s' WHERE url = '%s'",
dbesc($contact["name"]),
dbesc($contact["username"]),
dbesc($contact["avatar_image"]["url"]),
dbesc(normalise_link($contact["canonical_url"])));
if (DB_UPDATE_VERSION >= "1177")
q("UPDATE `unique_contacts` SET `location` = '%s', `about` = '%s' WHERE url = '%s'",
dbesc(""),
dbesc($contact["description"]["text"]),
dbesc(normalise_link($contact["canonical_url"])));
}
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1", $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1",
intval($uid), dbesc("adn::".$contact["id"])); intval($uid), dbesc("adn::".$contact["id"]));
@ -1174,8 +1150,8 @@ function appnet_fetchcontact($a, $uid, $contact, $me, $create_user) {
// create contact record // create contact record
q("INSERT INTO `contact` (`uid`, `created`, `url`, `nurl`, `addr`, `alias`, `notify`, `poll`, q("INSERT INTO `contact` (`uid`, `created`, `url`, `nurl`, `addr`, `alias`, `notify`, `poll`,
`name`, `nick`, `photo`, `network`, `rel`, `priority`, `name`, `nick`, `photo`, `network`, `rel`, `priority`,
`writable`, `blocked`, `readonly`, `pending` ) `about`, `writable`, `blocked`, `readonly`, `pending` )
VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, 0, 0, 0 ) ", VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d, 0, 0, 0 ) ",
intval($uid), intval($uid),
dbesc(datetime_convert()), dbesc(datetime_convert()),
dbesc($contact["canonical_url"]), dbesc($contact["canonical_url"]),
@ -1190,6 +1166,7 @@ function appnet_fetchcontact($a, $uid, $contact, $me, $create_user) {
dbesc(NETWORK_APPNET), dbesc(NETWORK_APPNET),
intval(CONTACT_IS_FRIEND), intval(CONTACT_IS_FRIEND),
intval(1), intval(1),
dbesc($contact["description"]["text"]),
intval(1) intval(1)
); );
@ -1231,15 +1208,6 @@ function appnet_fetchcontact($a, $uid, $contact, $me, $create_user) {
dbesc(datetime_convert()), dbesc(datetime_convert()),
intval($contact_id) intval($contact_id)
); );
if (DB_UPDATE_VERSION >= "1177")
q("UPDATE `contact` SET `location` = '%s',
`about` = '%s'
WHERE `id` = %d",
dbesc(""),
dbesc($contact["description"]["text"]),
intval($contact_id)
);
} else { } else {
// update profile photos once every two weeks as we have no notification of when they change. // update profile photos once every two weeks as we have no notification of when they change.
@ -1266,7 +1234,8 @@ function appnet_fetchcontact($a, $uid, $contact, $me, $create_user) {
`nurl` = '%s', `nurl` = '%s',
`addr` = '%s', `addr` = '%s',
`name` = '%s', `name` = '%s',
`nick` = '%s' `nick` = '%s',
`about` = '%s'
WHERE `id` = %d", WHERE `id` = %d",
dbesc($photos[0]), dbesc($photos[0]),
dbesc($photos[1]), dbesc($photos[1]),
@ -1279,13 +1248,6 @@ function appnet_fetchcontact($a, $uid, $contact, $me, $create_user) {
dbesc($contact["username"]."@app.net"), dbesc($contact["username"]."@app.net"),
dbesc($contact["name"]), dbesc($contact["name"]),
dbesc($contact["username"]), dbesc($contact["username"]),
intval($r[0]['id'])
);
if (DB_UPDATE_VERSION >= "1177")
q("UPDATE `contact` SET `location` = '%s',
`about` = '%s'
WHERE `id` = %d",
dbesc(""),
dbesc($contact["description"]["text"]), dbesc($contact["description"]["text"]),
intval($r[0]['id']) intval($r[0]['id'])
); );

View file

@ -1,7 +1,7 @@
<?php <?php
/** /**
* Name: Buffer Post Connector * Name: Buffer Post Connector
* Description: Post to Buffer (Linkedin, App.net, Google+, Facebook, Twitter) * Description: Post to Buffer (Facebook, Google+, LinkedIn, Twitter)
* Version: 0.2 * Version: 0.2
* Author: Michael Vogel <http://pirati.ca/profile/heluecht> * Author: Michael Vogel <http://pirati.ca/profile/heluecht>
*/ */
@ -328,15 +328,14 @@ function buffer_send(&$a,&$b) {
if (isset($post["preview"])) if (isset($post["preview"]))
$post["preview"] = proxy_url($post["preview"]); $post["preview"] = proxy_url($post["preview"]);
//if ($profile->service == "twitter") { //if ($includedlinks) {
if ($includedlinks) { // if (isset($post["url"]))
if (isset($post["url"])) // $post["url"] = short_link($post["url"]);
$post["url"] = short_link($post["url"]); // if (isset($post["image"]))
if (isset($post["image"])) // $post["image"] = short_link($post["image"]);
$post["image"] = short_link($post["image"]); // if (isset($post["preview"]))
if (isset($post["preview"])) // $post["preview"] = short_link($post["preview"]);
$post["preview"] = short_link($post["preview"]); //}
}
// Seems like a bug to me // Seems like a bug to me
// Buffer doesn't add links to Twitter and App.net (but pictures) // Buffer doesn't add links to Twitter and App.net (but pictures)

View file

@ -976,8 +976,8 @@ function pumpio_get_contact($uid, $contact, $no_insert = false) {
// create contact record // create contact record
q("INSERT INTO `contact` (`uid`, `created`, `url`, `nurl`, `addr`, `alias`, `notify`, `poll`, q("INSERT INTO `contact` (`uid`, `created`, `url`, `nurl`, `addr`, `alias`, `notify`, `poll`,
`name`, `nick`, `photo`, `network`, `rel`, `priority`, `name`, `nick`, `photo`, `network`, `rel`, `priority`,
`writable`, `blocked`, `readonly`, `pending` ) `location`, `about`, `writable`, `blocked`, `readonly`, `pending` )
VALUES (%d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, 0, 0, 0)", VALUES (%d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', %d, 0, 0, 0)",
intval($uid), intval($uid),
dbesc(datetime_convert()), dbesc(datetime_convert()),
dbesc($contact->url), dbesc($contact->url),
@ -992,6 +992,8 @@ function pumpio_get_contact($uid, $contact, $no_insert = false) {
dbesc(NETWORK_PUMPIO), dbesc(NETWORK_PUMPIO),
intval(CONTACT_IS_FRIEND), intval(CONTACT_IS_FRIEND),
intval(1), intval(1),
dbesc($contact->location->displayName),
dbesc($contact->summary),
intval(1) intval(1)
); );
@ -1014,15 +1016,6 @@ function pumpio_get_contact($uid, $contact, $no_insert = false) {
require_once('include/group.php'); require_once('include/group.php');
group_add_member($uid,'',$contact_id,$g[0]['def_gid']); group_add_member($uid,'',$contact_id,$g[0]['def_gid']);
} }
if (DB_UPDATE_VERSION >= "1177")
q("UPDATE `contact` SET `location` = '%s',
`about` = '%s'
WHERE `id` = %d",
dbesc($contact->location->displayName),
dbesc($contact->summary),
intval($contact_id)
);
} else { } else {
$contact_id = $r[0]["id"]; $contact_id = $r[0]["id"];

View file

@ -41,6 +41,8 @@ function pumpio_sync_run(&$argv, &$argc){
} }
} }
// This is deprecated with the worker
if (function_exists("get_lockpath")) {
$lockpath = get_lockpath(); $lockpath = get_lockpath();
if ($lockpath != '') { if ($lockpath != '') {
$pidfile = new pidfile($lockpath, 'pumpio_sync'); $pidfile = new pidfile($lockpath, 'pumpio_sync');
@ -55,7 +57,7 @@ function pumpio_sync_run(&$argv, &$argc){
exit; exit;
} }
} }
}
pumpio_sync($a); pumpio_sync($a);
} }

View file

@ -920,36 +920,11 @@ function statusnet_fetch_contact($uid, $contact, $create_user) {
if ($contact->statusnet_profile_url == "") if ($contact->statusnet_profile_url == "")
return(-1); return(-1);
if (function_exists("update_gcontact"))
update_gcontact(array("url" => $contact->statusnet_profile_url, update_gcontact(array("url" => $contact->statusnet_profile_url,
"network" => NETWORK_STATUSNET, "photo" => $contact->profile_image_url, "network" => NETWORK_STATUSNET, "photo" => $contact->profile_image_url,
"name" => $contact->name, "nick" => $contact->screen_name, "name" => $contact->name, "nick" => $contact->screen_name,
"location" => $contact->location, "about" => $contact->description, "location" => $contact->location, "about" => $contact->description,
"addr" => statusnet_address($contact), "generation" => 3)); "addr" => statusnet_address($contact), "generation" => 3));
else {
// Old Code
$r = q("SELECT id FROM unique_contacts WHERE url='%s' LIMIT 1",
dbesc(normalise_link($contact->statusnet_profile_url)));
if (count($r) == 0)
q("INSERT INTO unique_contacts (url, name, nick, avatar) VALUES ('%s', '%s', '%s', '%s')",
dbesc(normalise_link($contact->statusnet_profile_url)),
dbesc($contact->name),
dbesc($contact->screen_name),
dbesc($contact->profile_image_url));
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),
dbesc(normalise_link($contact->statusnet_profile_url)));
if (DB_UPDATE_VERSION >= "1177")
q("UPDATE `unique_contacts` SET `location` = '%s', `about` = '%s' WHERE url = '%s'",
dbesc($contact->location),
dbesc($contact->description),
dbesc(normalise_link($contact->statusnet_profile_url)));
}
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' AND `network` = '%s'LIMIT 1", $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' AND `network` = '%s'LIMIT 1",
intval($uid), dbesc(normalise_link($contact->statusnet_profile_url)), dbesc(NETWORK_STATUSNET)); intval($uid), dbesc(normalise_link($contact->statusnet_profile_url)), dbesc(NETWORK_STATUSNET));
@ -966,8 +941,8 @@ function statusnet_fetch_contact($uid, $contact, $create_user) {
// create contact record // create contact record
q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`, `addr`, `alias`, `notify`, `poll`, q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`, `addr`, `alias`, `notify`, `poll`,
`name`, `nick`, `photo`, `network`, `rel`, `priority`, `name`, `nick`, `photo`, `network`, `rel`, `priority`,
`writable`, `blocked`, `readonly`, `pending` ) `location`, `about`, `writable`, `blocked`, `readonly`, `pending` )
VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, 0, 0, 0 ) ", VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', %d, 0, 0, 0 ) ",
intval($uid), intval($uid),
dbesc(datetime_convert()), dbesc(datetime_convert()),
dbesc($contact->statusnet_profile_url), dbesc($contact->statusnet_profile_url),
@ -982,6 +957,8 @@ function statusnet_fetch_contact($uid, $contact, $create_user) {
dbesc(NETWORK_STATUSNET), dbesc(NETWORK_STATUSNET),
intval(CONTACT_IS_FRIEND), intval(CONTACT_IS_FRIEND),
intval(1), intval(1),
dbesc($contact->location),
dbesc($contact->description),
intval(1) intval(1)
); );
@ -1019,16 +996,6 @@ function statusnet_fetch_contact($uid, $contact, $create_user) {
dbesc(datetime_convert()), dbesc(datetime_convert()),
intval($contact_id) intval($contact_id)
); );
if (DB_UPDATE_VERSION >= "1177")
q("UPDATE `contact` SET `location` = '%s',
`about` = '%s'
WHERE `id` = %d",
dbesc($contact->location),
dbesc($contact->description),
intval($contact_id)
);
} else { } else {
// update profile photos once every two weeks as we have no notification of when they change. // update profile photos once every two weeks as we have no notification of when they change.
@ -1055,7 +1022,9 @@ function statusnet_fetch_contact($uid, $contact, $create_user) {
`nurl` = '%s', `nurl` = '%s',
`addr` = '%s', `addr` = '%s',
`name` = '%s', `name` = '%s',
`nick` = '%s' `nick` = '%s',
`location` = '%s',
`about` = '%s'
WHERE `id` = %d", WHERE `id` = %d",
dbesc($photos[0]), dbesc($photos[0]),
dbesc($photos[1]), dbesc($photos[1]),
@ -1068,13 +1037,6 @@ function statusnet_fetch_contact($uid, $contact, $create_user) {
dbesc(statusnet_address($contact)), dbesc(statusnet_address($contact)),
dbesc($contact->name), dbesc($contact->name),
dbesc($contact->screen_name), dbesc($contact->screen_name),
intval($r[0]['id'])
);
if (DB_UPDATE_VERSION >= "1177")
q("UPDATE `contact` SET `location` = '%s',
`about` = '%s'
WHERE `id` = %d",
dbesc($contact->location), dbesc($contact->location),
dbesc($contact->description), dbesc($contact->description),
intval($r[0]['id']) intval($r[0]['id'])

View file

@ -935,36 +935,11 @@ function twitter_fetch_contact($uid, $contact, $create_user) {
$avatar = twitter_fix_avatar($contact->profile_image_url_https); $avatar = twitter_fix_avatar($contact->profile_image_url_https);
if (function_exists("update_gcontact"))
update_gcontact(array("url" => "https://twitter.com/".$contact->screen_name, update_gcontact(array("url" => "https://twitter.com/".$contact->screen_name,
"network" => NETWORK_TWITTER, "photo" => $avatar, "hide" => true, "network" => NETWORK_TWITTER, "photo" => $avatar, "hide" => true,
"name" => $contact->name, "nick" => $contact->screen_name, "name" => $contact->name, "nick" => $contact->screen_name,
"location" => $contact->location, "about" => $contact->description, "location" => $contact->location, "about" => $contact->description,
"addr" => $contact->screen_name."@twitter.com", "generation" => 2)); "addr" => $contact->screen_name."@twitter.com", "generation" => 2));
else {
// Old Code
$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($avatar));
else
q("UPDATE unique_contacts SET name = '%s', nick = '%s', avatar = '%s' WHERE url = '%s'",
dbesc($contact->name),
dbesc($contact->screen_name),
dbesc($avatar),
dbesc(normalise_link("https://twitter.com/".$contact->screen_name)));
if (DB_UPDATE_VERSION >= "1177")
q("UPDATE `unique_contacts` SET `location` = '%s', `about` = '%s' WHERE url = '%s'",
dbesc($contact->location),
dbesc($contact->description),
dbesc(normalise_link("https://twitter.com/".$contact->screen_name)));
}
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1", $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1",
intval($uid), dbesc("twitter::".$contact->id_str)); intval($uid), dbesc("twitter::".$contact->id_str));
@ -979,10 +954,10 @@ function twitter_fetch_contact($uid, $contact, $create_user) {
if(!count($r)) { if(!count($r)) {
// create contact record // create contact record
q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`, `addr`, `alias`, `notify`, `poll`, q("INSERT INTO `contact` (`uid`, `created`, `url`, `nurl`, `addr`, `alias`, `notify`, `poll`,
`name`, `nick`, `photo`, `network`, `rel`, `priority`, `name`, `nick`, `photo`, `network`, `rel`, `priority`,
`writable`, `blocked`, `readonly`, `pending` ) `location`, `about`, `writable`, `blocked`, `readonly`, `pending`)
VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, 0, 0, 0) ", VALUES (%d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', %d, 0, 0, 0)",
intval($uid), intval($uid),
dbesc(datetime_convert()), dbesc(datetime_convert()),
dbesc("https://twitter.com/".$contact->screen_name), dbesc("https://twitter.com/".$contact->screen_name),
@ -997,6 +972,8 @@ function twitter_fetch_contact($uid, $contact, $create_user) {
dbesc(NETWORK_TWITTER), dbesc(NETWORK_TWITTER),
intval(CONTACT_IS_FRIEND), intval(CONTACT_IS_FRIEND),
intval(1), intval(1),
dbesc($contact->location),
dbesc($contact->description),
intval(1) intval(1)
); );
@ -1021,8 +998,9 @@ function twitter_fetch_contact($uid, $contact, $create_user) {
require_once("Photo.php"); require_once("Photo.php");
$photos = import_profile_photo($avatar,$uid,$contact_id); $photos = import_profile_photo($avatar, $uid, $contact_id, true);
if ($photos) {
q("UPDATE `contact` SET `photo` = '%s', q("UPDATE `contact` SET `photo` = '%s',
`thumb` = '%s', `thumb` = '%s',
`micro` = '%s', `micro` = '%s',
@ -1038,16 +1016,7 @@ function twitter_fetch_contact($uid, $contact, $create_user) {
dbesc(datetime_convert()), dbesc(datetime_convert()),
intval($contact_id) intval($contact_id)
); );
}
if (DB_UPDATE_VERSION >= "1177")
q("UPDATE `contact` SET `location` = '%s',
`about` = '%s'
WHERE `id` = %d",
dbesc($contact->location),
dbesc($contact->description),
intval($contact_id)
);
} else { } else {
// update profile photos once every two weeks as we have no notification of when they change. // update profile photos once every two weeks as we have no notification of when they change.
@ -1062,8 +1031,9 @@ function twitter_fetch_contact($uid, $contact, $create_user) {
require_once("Photo.php"); require_once("Photo.php");
$photos = import_profile_photo($avatar, $uid, $r[0]['id']); $photos = import_profile_photo($avatar, $uid, $r[0]['id'], true);
if ($photos) {
q("UPDATE `contact` SET `photo` = '%s', q("UPDATE `contact` SET `photo` = '%s',
`thumb` = '%s', `thumb` = '%s',
`micro` = '%s', `micro` = '%s',
@ -1074,7 +1044,9 @@ function twitter_fetch_contact($uid, $contact, $create_user) {
`nurl` = '%s', `nurl` = '%s',
`addr` = '%s', `addr` = '%s',
`name` = '%s', `name` = '%s',
`nick` = '%s' `nick` = '%s',
`location` = '%s',
`about` = '%s'
WHERE `id` = %d", WHERE `id` = %d",
dbesc($photos[0]), dbesc($photos[0]),
dbesc($photos[1]), dbesc($photos[1]),
@ -1087,19 +1059,13 @@ function twitter_fetch_contact($uid, $contact, $create_user) {
dbesc($contact->screen_name."@twitter.com"), dbesc($contact->screen_name."@twitter.com"),
dbesc($contact->name), dbesc($contact->name),
dbesc($contact->screen_name), dbesc($contact->screen_name),
intval($r[0]['id'])
);
if (DB_UPDATE_VERSION >= "1177")
q("UPDATE `contact` SET `location` = '%s',
`about` = '%s'
WHERE `id` = %d",
dbesc($contact->location), dbesc($contact->location),
dbesc($contact->description), dbesc($contact->description),
intval($r[0]['id']) intval($r[0]['id'])
); );
} }
} }
}
return($r[0]["id"]); return($r[0]["id"]);
} }

View file

@ -49,7 +49,8 @@ function twitter_sync_run($argv, $argc){
$mode = intval($argv[1]); $mode = intval($argv[1]);
$uid = intval($argv[2]); $uid = intval($argv[2]);
/// @todo Replace it with "App::is_already_running" in the next release // This is deprecated with the worker
if (function_exists("get_lockpath")) {
$lockpath = get_lockpath(); $lockpath = get_lockpath();
if ($lockpath != '') { if ($lockpath != '') {
$pidfile = new pidfile($lockpath, 'twitter_sync-'.$mode.'-'.$uid); $pidfile = new pidfile($lockpath, 'twitter_sync-'.$mode.'-'.$uid);
@ -64,6 +65,7 @@ function twitter_sync_run($argv, $argc){
exit; exit;
} }
} }
}
if ($mode == 1) { if ($mode == 1) {
twitter_fetchtimeline($a, $uid); twitter_fetchtimeline($a, $uid);