* Description: Bidirectional (posting and reading) connector for app.net.
* Version: 0.2
* Author: Michael Vogel <https://pirati.ca/profile/heluecht>
+ * Status: Unsupported
*/
/*
function appnet_fetchcontact($a, $uid, $contact, $me, $create_user) {
- if (function_exists("update_gcontact"))
- update_gcontact(array("url" => $contact["canonical_url"], "generation" => 2,
- "network" => NETWORK_APPNET, "photo" => $contact["avatar_image"]["url"],
- "name" => $contact["name"], "nick" => $contact["username"],
- "about" => $contact["description"]["text"], "hide" => true,
- "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"])));
- }
+ update_gcontact(array("url" => $contact["canonical_url"], "generation" => 2,
+ "network" => NETWORK_APPNET, "photo" => $contact["avatar_image"]["url"],
+ "name" => $contact["name"], "nick" => $contact["username"],
+ "about" => $contact["description"]["text"], "hide" => true,
+ "addr" => $contact["username"]."@app.net"));
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1",
intval($uid), dbesc("adn::".$contact["id"]));
// create contact record
q("INSERT INTO `contact` (`uid`, `created`, `url`, `nurl`, `addr`, `alias`, `notify`, `poll`,
`name`, `nick`, `photo`, `network`, `rel`, `priority`,
- `writable`, `blocked`, `readonly`, `pending` )
- VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, 0, 0, 0 ) ",
+ `about`, `writable`, `blocked`, `readonly`, `pending` )
+ VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d, 0, 0, 0 ) ",
intval($uid),
dbesc(datetime_convert()),
dbesc($contact["canonical_url"]),
dbesc(NETWORK_APPNET),
intval(CONTACT_IS_FRIEND),
intval(1),
+ dbesc($contact["description"]["text"]),
intval(1)
);
dbesc(datetime_convert()),
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 {
// update profile photos once every two weeks as we have no notification of when they change.
`nurl` = '%s',
`addr` = '%s',
`name` = '%s',
- `nick` = '%s'
+ `nick` = '%s',
+ `about` = '%s'
WHERE `id` = %d",
dbesc($photos[0]),
dbesc($photos[1]),
dbesc($contact["username"]."@app.net"),
dbesc($contact["name"]),
dbesc($contact["username"]),
+ dbesc($contact["description"]["text"]),
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"]),
- intval($r[0]['id'])
- );
}
}
<?php
/**
* 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
* Author: Michael Vogel <http://pirati.ca/profile/heluecht>
*/
if (isset($post["preview"]))
$post["preview"] = proxy_url($post["preview"]);
- //if ($profile->service == "twitter") {
- if ($includedlinks) {
- if (isset($post["url"]))
- $post["url"] = short_link($post["url"]);
- if (isset($post["image"]))
- $post["image"] = short_link($post["image"]);
- if (isset($post["preview"]))
- $post["preview"] = short_link($post["preview"]);
- }
+ //if ($includedlinks) {
+ // if (isset($post["url"]))
+ // $post["url"] = short_link($post["url"]);
+ // if (isset($post["image"]))
+ // $post["image"] = short_link($post["image"]);
+ // if (isset($post["preview"]))
+ // $post["preview"] = short_link($post["preview"]);
+ //}
// Seems like a bug to me
// Buffer doesn't add links to Twitter and App.net (but pictures)
// create contact record
q("INSERT INTO `contact` (`uid`, `created`, `url`, `nurl`, `addr`, `alias`, `notify`, `poll`,
`name`, `nick`, `photo`, `network`, `rel`, `priority`,
- `writable`, `blocked`, `readonly`, `pending` )
- VALUES (%d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, 0, 0, 0)",
+ `location`, `about`, `writable`, `blocked`, `readonly`, `pending` )
+ VALUES (%d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', %d, 0, 0, 0)",
intval($uid),
dbesc(datetime_convert()),
dbesc($contact->url),
dbesc(NETWORK_PUMPIO),
intval(CONTACT_IS_FRIEND),
intval(1),
+ dbesc($contact->location->displayName),
+ dbesc($contact->summary),
intval(1)
);
require_once('include/group.php');
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 {
$contact_id = $r[0]["id"];
}
}
- $lockpath = get_lockpath();
- if ($lockpath != '') {
- $pidfile = new pidfile($lockpath, 'pumpio_sync');
- if($pidfile->is_already_running()) {
- logger("Already running");
- if ($pidfile->running_time() > 9*60) {
- $pidfile->kill();
- logger("killed stale process");
- // Calling a new instance
- proc_run('php','addon/pumpio/pumpio_sync.php');
+ // This is deprecated with the worker
+ if (function_exists("get_lockpath")) {
+ $lockpath = get_lockpath();
+ if ($lockpath != '') {
+ $pidfile = new pidfile($lockpath, 'pumpio_sync');
+ if($pidfile->is_already_running()) {
+ logger("Already running");
+ if ($pidfile->running_time() > 9*60) {
+ $pidfile->kill();
+ logger("killed stale process");
+ // Calling a new instance
+ proc_run('php','addon/pumpio/pumpio_sync.php');
+ }
+ exit;
}
- exit;
}
}
-
pumpio_sync($a);
}
if ($contact->statusnet_profile_url == "")
return(-1);
- if (function_exists("update_gcontact"))
- update_gcontact(array("url" => $contact->statusnet_profile_url,
- "network" => NETWORK_STATUSNET, "photo" => $contact->profile_image_url,
- "name" => $contact->name, "nick" => $contact->screen_name,
- "location" => $contact->location, "about" => $contact->description,
- "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)));
- }
+ update_gcontact(array("url" => $contact->statusnet_profile_url,
+ "network" => NETWORK_STATUSNET, "photo" => $contact->profile_image_url,
+ "name" => $contact->name, "nick" => $contact->screen_name,
+ "location" => $contact->location, "about" => $contact->description,
+ "addr" => statusnet_address($contact), "generation" => 3));
$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));
// create contact record
q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`, `addr`, `alias`, `notify`, `poll`,
`name`, `nick`, `photo`, `network`, `rel`, `priority`,
- `writable`, `blocked`, `readonly`, `pending` )
- VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, 0, 0, 0 ) ",
+ `location`, `about`, `writable`, `blocked`, `readonly`, `pending` )
+ VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', %d, 0, 0, 0 ) ",
intval($uid),
dbesc(datetime_convert()),
dbesc($contact->statusnet_profile_url),
dbesc(NETWORK_STATUSNET),
intval(CONTACT_IS_FRIEND),
intval(1),
+ dbesc($contact->location),
+ dbesc($contact->description),
intval(1)
);
dbesc(datetime_convert()),
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 {
// update profile photos once every two weeks as we have no notification of when they change.
`nurl` = '%s',
`addr` = '%s',
`name` = '%s',
- `nick` = '%s'
+ `nick` = '%s',
+ `location` = '%s',
+ `about` = '%s'
WHERE `id` = %d",
dbesc($photos[0]),
dbesc($photos[1]),
dbesc(statusnet_address($contact)),
dbesc($contact->name),
dbesc($contact->screen_name),
+ dbesc($contact->location),
+ dbesc($contact->description),
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->description),
- intval($r[0]['id'])
- );
}
}
$avatar = twitter_fix_avatar($contact->profile_image_url_https);
- if (function_exists("update_gcontact"))
- update_gcontact(array("url" => "https://twitter.com/".$contact->screen_name,
- "network" => NETWORK_TWITTER, "photo" => $avatar, "hide" => true,
- "name" => $contact->name, "nick" => $contact->screen_name,
- "location" => $contact->location, "about" => $contact->description,
- "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)));
- }
+ update_gcontact(array("url" => "https://twitter.com/".$contact->screen_name,
+ "network" => NETWORK_TWITTER, "photo" => $avatar, "hide" => true,
+ "name" => $contact->name, "nick" => $contact->screen_name,
+ "location" => $contact->location, "about" => $contact->description,
+ "addr" => $contact->screen_name."@twitter.com", "generation" => 2));
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1",
intval($uid), dbesc("twitter::".$contact->id_str));
if(!count($r)) {
// 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`,
- `writable`, `blocked`, `readonly`, `pending` )
- VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, 0, 0, 0) ",
+ `location`, `about`, `writable`, `blocked`, `readonly`, `pending`)
+ VALUES (%d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', %d, 0, 0, 0)",
intval($uid),
dbesc(datetime_convert()),
dbesc("https://twitter.com/".$contact->screen_name),
dbesc(NETWORK_TWITTER),
intval(CONTACT_IS_FRIEND),
intval(1),
+ dbesc($contact->location),
+ dbesc($contact->description),
intval(1)
);
require_once("Photo.php");
- $photos = import_profile_photo($avatar,$uid,$contact_id);
-
- q("UPDATE `contact` SET `photo` = '%s',
- `thumb` = '%s',
- `micro` = '%s',
- `name-date` = '%s',
- `uri-date` = '%s',
- `avatar-date` = '%s'
- WHERE `id` = %d",
- dbesc($photos[0]),
- dbesc($photos[1]),
- dbesc($photos[2]),
- dbesc(datetime_convert()),
- dbesc(datetime_convert()),
- dbesc(datetime_convert()),
- intval($contact_id)
- );
+ $photos = import_profile_photo($avatar, $uid, $contact_id, true);
- if (DB_UPDATE_VERSION >= "1177")
- q("UPDATE `contact` SET `location` = '%s',
- `about` = '%s'
+ if ($photos) {
+ q("UPDATE `contact` SET `photo` = '%s',
+ `thumb` = '%s',
+ `micro` = '%s',
+ `name-date` = '%s',
+ `uri-date` = '%s',
+ `avatar-date` = '%s'
WHERE `id` = %d",
- dbesc($contact->location),
- dbesc($contact->description),
+ dbesc($photos[0]),
+ dbesc($photos[1]),
+ dbesc($photos[2]),
+ dbesc(datetime_convert()),
+ dbesc(datetime_convert()),
+ dbesc(datetime_convert()),
intval($contact_id)
);
-
+ }
} else {
// update profile photos once every two weeks as we have no notification of when they change.
require_once("Photo.php");
- $photos = import_profile_photo($avatar, $uid, $r[0]['id']);
-
- q("UPDATE `contact` SET `photo` = '%s',
- `thumb` = '%s',
- `micro` = '%s',
- `name-date` = '%s',
- `uri-date` = '%s',
- `avatar-date` = '%s',
- `url` = '%s',
- `nurl` = '%s',
- `addr` = '%s',
- `name` = '%s',
- `nick` = '%s'
- WHERE `id` = %d",
- dbesc($photos[0]),
- dbesc($photos[1]),
- dbesc($photos[2]),
- dbesc(datetime_convert()),
- dbesc(datetime_convert()),
- dbesc(datetime_convert()),
- dbesc("https://twitter.com/".$contact->screen_name),
- dbesc(normalise_link("https://twitter.com/".$contact->screen_name)),
- dbesc($contact->screen_name."@twitter.com"),
- dbesc($contact->name),
- dbesc($contact->screen_name),
- intval($r[0]['id'])
- );
-
- if (DB_UPDATE_VERSION >= "1177")
- q("UPDATE `contact` SET `location` = '%s',
+ $photos = import_profile_photo($avatar, $uid, $r[0]['id'], true);
+
+ if ($photos) {
+ q("UPDATE `contact` SET `photo` = '%s',
+ `thumb` = '%s',
+ `micro` = '%s',
+ `name-date` = '%s',
+ `uri-date` = '%s',
+ `avatar-date` = '%s',
+ `url` = '%s',
+ `nurl` = '%s',
+ `addr` = '%s',
+ `name` = '%s',
+ `nick` = '%s',
+ `location` = '%s',
`about` = '%s'
WHERE `id` = %d",
+ dbesc($photos[0]),
+ dbesc($photos[1]),
+ dbesc($photos[2]),
+ dbesc(datetime_convert()),
+ dbesc(datetime_convert()),
+ dbesc(datetime_convert()),
+ dbesc("https://twitter.com/".$contact->screen_name),
+ dbesc(normalise_link("https://twitter.com/".$contact->screen_name)),
+ dbesc($contact->screen_name."@twitter.com"),
+ dbesc($contact->name),
+ dbesc($contact->screen_name),
dbesc($contact->location),
dbesc($contact->description),
intval($r[0]['id'])
);
+ }
}
}
$mode = intval($argv[1]);
$uid = intval($argv[2]);
- /// @todo Replace it with "App::is_already_running" in the next release
- $lockpath = get_lockpath();
- if ($lockpath != '') {
- $pidfile = new pidfile($lockpath, 'twitter_sync-'.$mode.'-'.$uid);
- if ($pidfile->is_already_running()) {
- logger("Already running");
- if ($pidfile->running_time() > 9*60) {
- $pidfile->kill();
- logger("killed stale process");
- // Calling a new instance
- proc_run('php','addon/twitter/twitter_sync.php', $mode, $uid);
+ // This is deprecated with the worker
+ if (function_exists("get_lockpath")) {
+ $lockpath = get_lockpath();
+ if ($lockpath != '') {
+ $pidfile = new pidfile($lockpath, 'twitter_sync-'.$mode.'-'.$uid);
+ if ($pidfile->is_already_running()) {
+ logger("Already running");
+ if ($pidfile->running_time() > 9*60) {
+ $pidfile->kill();
+ logger("killed stale process");
+ // Calling a new instance
+ proc_run('php','addon/twitter/twitter_sync.php', $mode, $uid);
+ }
+ exit;
}
- exit;
}
}