$client_id = Config::get("buffer", "client_id");
$client_secret = Config::get("buffer", "client_secret");
$access_token = PConfig::get($b['uid'], "buffer","access_token");
+ $callback_url = "";
if ($access_token) {
$buffer = new BufferApp($client_id, $client_secret, $callback_url, $access_token);
return false;
}
+ if (count($hostname) <= 2) {
+ return false;
+ }
+
$site = $hostname[sizeof($hostname) - 2].".".$hostname[sizeof($hostname) - 1];
return (isset($sites[$site]));
function pumpio_get_contact($uid, $contact, $no_insert = false)
{
- GContact::update(["url" => $contact->url, "network" => NETWORK_PUMPIO, "generation" => 2,
- "photo" => $contact->image->url, "name" => $contact->displayName, "hide" => true,
- "nick" => $contact->preferredUsername, "location" => $contact->location->displayName,
- "about" => $contact->summary, "addr" => str_replace("acct:", "", $contact->id)]);
+ $gcontact = ["url" => $contact->url, "network" => NETWORK_PUMPIO, "generation" => 2,
+ "name" => $contact->displayName, "hide" => true,
+ "nick" => $contact->preferredUsername,
+ "addr" => str_replace("acct:", "", $contact->id)];
+
+ if (!empty($contact->location->displayName)) {
+ $gcontact["location"] = $contact->location->displayName;
+ }
+
+ if (!empty($contact->summary)) {
+ $gcontact["about"] = $contact->summary;
+ }
+
+ if (!empty($contact->image->url)) {
+ $gcontact["photo"] = $contact->image->url;
+ }
+
+ GContact::update($gcontact);
$cid = Contact::getIdForURL($contact->url, $uid);
if ($no_insert) {
*/
}
- Contact::updateAvatar($contact->image->url, $uid, $contact_id);
+ if (!empty($contact->image->url)) {
+ Contact::updateAvatar($contact->image->url, $uid, $contact_id);
+ }
return $contact_id;
}
$receiptians = array_merge($receiptians, $post->to);
}
+ $public = false;
+
foreach ($receiptians AS $receiver) {
if (is_string($receiver->objectType) && ($receiver->id == "http://activityschema.org/collection/public")) {
$public = true;
logger('statusnet_post send, result: ' . print_r($result, true) .
"\nmessage: " . $msg, LOGGER_DEBUG . "\nOriginal post: " . print_r($b, true) . "\nPost Data: " . print_r($postdata, true));
- if ($result->source) {
+ if (!empty($result->source)) {
PConfig::set($b["uid"], "statusnet", "application_name", strip_tags($result->source));
}
- if ($result->error) {
+ if (!empty($result->error)) {
logger('Send to GNU Social failed: "' . $result->error . '"');
} elseif ($iscomment) {
logger('statusnet_post: Update extid ' . $result->id . " for post id " . $b['id']);
continue;
}
- if (is_object($post->retweeted_status)) {
+ if (!empty($post->retweeted_status)) {
continue;
}
$link = "";
preg_match("/link='(.*?)'/ism", $attributes, $matches);
- if ($matches[1] != "") {
+ if (!empty($matches[1])) {
$link = $matches[1];
}
preg_match('/link="(.*?)"/ism', $attributes, $matches);
- if ($matches[1] != "") {
+ if (!empty($matches[1])) {
$link = $matches[1];
}
$params['caption'] = '<h1>'.$title."</h1>".
"<p>".$params['caption']."</p>";
- if (trim($params['caption']) == "")
+ if (empty($params['caption']))
$params['caption'] = BBCode::convert("[quote]" . $siteinfo["description"] . "[/quote]", false, 4);
$consumer_key = Config::get('tumblr','consumer_key');
$result = $connection->post($url, $post);
logger('twitter_post send, result: ' . print_r($result, true), LOGGER_DEBUG);
- if ($result->source) {
+ if (!empty($result->source)) {
Config::set("twitter", "application_name", strip_tags($result->source));
}
- if ($result->errors) {
+ if (!empty($result->errors)) {
logger('Send to Twitter failed: "' . print_r($result->errors, true) . '"');
$r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `self`", intval($b['uid']));
return;
}
- $r = dba::select('item', ['id'], ['deleted' => true, 'network' => NETWORK_TWITTER]);
+ $r = dba::select('item', ['id', 'iaid', 'icid'], ['deleted' => true, 'network' => NETWORK_TWITTER]);
while ($row = dba::fetch($r)) {
dba::delete('item', ['id' => $row['id']]);
+ if (!empty($row['iaid']) && !dba::exists('item', ['iaid' => $row['iaid']])) {
+ dba::delete('item-activity', ['id' => $row['iaid']]);
+ }
+ if (!empty($row['icid']) && !dba::exists('item', ['icid' => $row['icid']])) {
+ dba::delete('item-content', ['id' => $row['icid']]);
+ }
}
dba::close($r);
$link = "";
preg_match("/link='(.*?)'/ism", $attributes, $matches);
- if ($matches[1] != "") {
+ if (!empty($matches[1])) {
$link = $matches[1];
}
preg_match('/link="(.*?)"/ism', $attributes, $matches);
- if ($matches[1] != "") {
+ if (!empty($matches[1])) {
$link = $matches[1];
}