use Friendica\Model\APContact;
use Friendica\Model\Contact;
use Friendica\Model\Conversation;
-use Friendica\Model\GContact;
use Friendica\Model\Item;
use Friendica\Model\ItemURI;
use Friendica\Model\Tag;
use Friendica\Network\Probe;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Images;
-use Friendica\Util\Network;
use Friendica\Util\Proxy as ProxyUtils;
use Friendica\Util\Strings;
use Friendica\Util\XML;
if (!empty($author["author-avatar"]) && ($author["author-avatar"] != $current['avatar'])) {
Logger::log("Update profile picture for contact ".$contact["id"], Logger::DEBUG);
- Contact::updateAvatar($author["author-avatar"], $importer["uid"], $contact["id"]);
+ Contact::updateAvatar($contact["id"], $author["author-avatar"]);
}
// Ensure that we are having this contact (with uid=0)
- $cid = Contact::getIdForURL($aliaslink, 0, false);
+ $cid = Contact::getIdForURL($aliaslink);
if ($cid) {
$fields = ['url', 'nurl', 'name', 'nick', 'alias', 'about', 'location'];
// Update the avatar
if (!empty($author["author-avatar"])) {
- Contact::updateAvatar($author["author-avatar"], 0, $cid);
+ Contact::updateAvatar($cid, $author["author-avatar"]);
}
}
-
- $contact["generation"] = 2;
- $contact["hide"] = false; // OStatus contacts are never hidden
- if (!empty($author["author-avatar"])) {
- $contact["photo"] = $author["author-avatar"];
- }
- $gcid = GContact::update($contact);
-
- GContact::link($gcid, $contact["uid"], $contact["id"]);
} elseif (empty($contact["network"]) || ($contact["network"] != Protocol::DFRN)) {
$contact = [];
}
} elseif ($item['contact-id'] < 0) {
Logger::log("Item with uri ".$item["uri"]." is from a blocked contact.", Logger::DEBUG);
} else {
- // We are having duplicated entries. Hopefully this solves it.
- if (DI::lock()->acquire('ostatus_process_item_insert')) {
- $ret = Item::insert($item);
- DI::lock()->release('ostatus_process_item_insert');
- Logger::log("Item with uri ".$item["uri"]." for user ".$importer["uid"].' stored. Return value: '.$ret);
- } else {
- $ret = Item::insert($item);
- Logger::log("We couldn't lock - but tried to store the item anyway. Return value is ".$ret);
- }
+ $ret = Item::insert($item);
+ Logger::log("Item with uri ".$item["uri"]." for user ".$importer["uid"].' stored. Return value: '.$ret);
}
}
}
// Only add additional data when there is no picture in the post
if (!strstr($item["body"], '[/img]')) {
- $item["body"] = PageInfo::appendToBody($item["body"]);
+ $item["body"] = PageInfo::searchAndAppendToBody($item["body"]);
}
Tag::storeFromBody($item['uri-id'], $item['body']);
self::$conv_list[$conversation] = true;
- $curlResult = Network::curl($conversation, false, ['accept_content' => 'application/atom+xml, text/html']);
+ $curlResult = DI::httpRequest()->get($conversation, false, ['accept_content' => 'application/atom+xml, text/html']);
if (!$curlResult->isSuccess()) {
return;
}
}
if ($file != '') {
- $conversation_atom = Network::curl($attribute['href']);
+ $conversation_atom = DI::httpRequest()->get($attribute['href']);
if ($conversation_atom->isSuccess()) {
$xml = $conversation_atom->getBody();
return;
}
- $curlResult = Network::curl($self);
+ $curlResult = DI::httpRequest()->get($self);
if (!$curlResult->isSuccess()) {
return;
}
$stored = false;
- $curlResult = Network::curl($related, false, ['accept_content' => 'application/atom+xml, text/html']);
+ $curlResult = DI::httpRequest()->get($related, false, ['accept_content' => 'application/atom+xml, text/html']);
if (!$curlResult->isSuccess()) {
return;
}
}
if ($atom_file != '') {
- $curlResult = Network::curl($atom_file);
+ $curlResult = DI::httpRequest()->get($atom_file);
if ($curlResult->isSuccess()) {
Logger::log('Fetched XML for URI ' . $related_uri, Logger::DEBUG);
// Workaround for older GNU Social servers
if (($xml == '') && strstr($related, '/notice/')) {
- $curlResult = Network::curl(str_replace('/notice/', '/api/statuses/show/', $related).'.atom');
+ $curlResult = DI::httpRequest()->get(str_replace('/notice/', '/api/statuses/show/', $related) . '.atom');
if ($curlResult->isSuccess()) {
Logger::log('GNU Social workaround to fetch XML for URI ' . $related_uri, Logger::DEBUG);
// Even more worse workaround for GNU Social ;-)
if ($xml == '') {
$related_guess = self::convertHref($related_uri);
- $curlResult = Network::curl(str_replace('/notice/', '/api/statuses/show/', $related_guess).'.atom');
+ $curlResult = DI::httpRequest()->get(str_replace('/notice/', '/api/statuses/show/', $related_guess) . '.atom');
if ($curlResult->isSuccess()) {
Logger::log('GNU Social workaround 2 to fetch XML for URI ' . $related_uri, Logger::DEBUG);
$mentioned = $newmentions;
foreach ($mentioned as $mention) {
- $contact = Contact::getByURL($mention, ['contact-type']);
+ $contact = Contact::getByURL($mention, false, ['contact-type']);
if (!empty($contact) && ($contact['contact-type'] == Contact::TYPE_COMMUNITY)) {
XML::addElement($doc, $entry, "link", "",
[
}
$check_date = DateTimeFormat::utc($last_update);
- $authorid = Contact::getIdForURL($owner["url"], 0, false);
+ $authorid = Contact::getIdForURL($owner["url"]);
$condition = ["`uid` = ? AND `received` > ? AND NOT `deleted`
AND `private` != ? AND `visible` AND `wall` AND `parent-network` IN (?, ?)",
* Checks if the given contact url does support OStatus
*
* @param string $url profile url
- * @param boolean $update Update the profile
* @return boolean
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
- public static function isSupportedByContactUrl($url, $update = false)
+ public static function isSupportedByContactUrl($url)
{
- $probe = Probe::uri($url, Protocol::OSTATUS, 0, !$update);
+ $probe = Probe::uri($url, Protocol::OSTATUS);
return $probe['network'] == Protocol::OSTATUS;
}
}