X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FProtocol%2FOStatus.php;h=2a021c89e9a3dac70fdb5cd42d857c1b6725a697;hb=89ad41aca5acaee12032eaa2704436ca5ce5dad2;hp=5d765bf6f8bfe9cafe47c7a8f5216a21f9cc63b1;hpb=ddacbf2c136c05a8ecf0aa65f8afdbce6134b95c;p=friendica.git diff --git a/src/Protocol/OStatus.php b/src/Protocol/OStatus.php index 5d765bf6f8..2a021c89e9 100644 --- a/src/Protocol/OStatus.php +++ b/src/Protocol/OStatus.php @@ -9,9 +9,10 @@ use Friendica\Core\Cache; use Friendica\Core\Config; use Friendica\Core\System; use Friendica\Database\DBM; -use Friendica\Model\GlobalContact; +use Friendica\Model\Contact; +use Friendica\Model\GContact; use Friendica\Network\Probe; -use Friendica\Object\Contact; +use Friendica\Object\Image; use Friendica\Util\Lock; use Friendica\Util\XML; use dba; @@ -24,7 +25,6 @@ require_once 'include/bbcode.php'; require_once 'include/items.php'; require_once 'mod/share.php'; require_once 'include/enotify.php'; -require_once 'include/Photo.php'; require_once 'include/follow.php'; require_once 'include/api.php'; require_once 'mod/proxy.php'; @@ -151,11 +151,8 @@ class OStatus // Only update the contacts if it is an OStatus contact if ($r && ($r['id'] > 0) && !$onlyfetch && ($contact["network"] == NETWORK_OSTATUS)) { - // This contact is vital, so we awake it from the dead - Contact::unmarkForArchival($contact); // Update contact data - $current = $contact; unset($current['name-date']); @@ -203,7 +200,7 @@ class OStatus if (!empty($author["author-avatar"]) && ($author["author-avatar"] != $current['avatar'])) { logger("Update profile picture for contact ".$contact["id"], LOGGER_DEBUG); - update_contact_avatar($author["author-avatar"], $importer["uid"], $contact["id"]); + Contact::updateAvatar($author["author-avatar"], $importer["uid"], $contact["id"]); } // Ensure that we are having this contact (with uid=0) @@ -223,15 +220,15 @@ class OStatus dba::update('contact', $fields, array('id' => $cid), $old_contact); // Update the avatar - update_contact_avatar($author["author-avatar"], 0, $cid); + Contact::updateAvatar($author["author-avatar"], 0, $cid); } $contact["generation"] = 2; $contact["hide"] = false; // OStatus contacts are never hidden $contact["photo"] = $author["author-avatar"]; - $gcid = GlobalContact::update($contact); + $gcid = GContact::update($contact); - GlobalContact::link($gcid, $contact["uid"], $contact["id"]); + GContact::link($gcid, $contact["uid"], $contact["id"]); } return $author; @@ -298,6 +295,7 @@ class OStatus * @param array $importer user record of the importing user * @param array $contact contact * @param string $hub Called by reference, returns the fetched hub data + * @return void */ public static function import($xml, $importer, &$contact, &$hub) { @@ -309,7 +307,7 @@ class OStatus * * @param string $xml The XML * @param array $importer user record of the importing user - * @param array $contact + * @param array $contact contact * @param string $hub Called by reference, returns the fetched hub data * @param boolean $stored Is the post fresh imported or from the database? * @param boolean $initialize Is it the leading post so that data has to be initialized? @@ -537,6 +535,10 @@ class OStatus return true; } + /** + * @param object $item item + * @return void + */ private static function deleteNotice($item) { $condition = array('uid' => $item['uid'], 'author-link' => $item['author-link'], 'uri' => $item['uri']); @@ -567,6 +569,7 @@ class OStatus * @param object $entry The xml entry that is processed * @param array $item The item array * @param array $importer user record of the importing user + * @return void */ private static function processPost($xpath, $entry, &$item, $importer) { @@ -708,6 +711,7 @@ class OStatus * * @param string $conversation The link to the conversation * @param string $conversation_uri The conversation in "uri" format + * @return void */ private static function fetchConversation($conversation, $conversation_uri) { @@ -768,6 +772,7 @@ class OStatus * @param string $xml The feed * @param string $conversation conversation * @param string $conversation_uri conversation uri + * @return void */ private static function storeConversation($xml, $conversation = '', $conversation_uri = '') { @@ -844,13 +849,14 @@ class OStatus /** * @brief Fetch the own post so that it can be stored later - * @param array $item The item array * * We want to store the original data for later processing. * This function is meant for cases where we process a feed with multiple entries. * In that case we need to fetch the single posts here. * * @param string $self The link to the self item + * @param array $item The item array + * @return void */ private static function fetchSelf($self, &$item) { @@ -885,6 +891,7 @@ class OStatus * @param string $related The link to the related item * @param string $related_uri The related item in "uri" format * @param array $importer user record of the importing user + * @return void */ private static function fetchRelated($related, $related_uri, $importer) { @@ -1293,6 +1300,7 @@ class OStatus * @param object $doc XML document * @param object $root XML root element where the hub links are added * @param object $nick nick + * @return void */ public static function hublinks($doc, $root, $nick) { @@ -1306,6 +1314,7 @@ class OStatus * @param object $doc XML document * @param object $root XML root element where the hub links are added * @param array $item Data of the item that is to be posted + * @return void */ private static function getAttachment($doc, $root, $item) { @@ -1314,7 +1323,7 @@ class OStatus switch ($siteinfo["type"]) { case 'photo': - $imgdata = get_photo_info($siteinfo["image"]); + $imgdata = Image::getInfoFromURL($siteinfo["image"]); $attributes = array("rel" => "enclosure", "href" => $siteinfo["image"], "type" => $imgdata["mime"], @@ -1334,7 +1343,7 @@ class OStatus } if (!Config::get('system', 'ostatus_not_attach_preview') && ($siteinfo["type"] != "photo") && isset($siteinfo["image"])) { - $imgdata = get_photo_info($siteinfo["image"]); + $imgdata = Image::getInfoFromURL($siteinfo["image"]); $attributes = array("rel" => "enclosure", "href" => $siteinfo["image"], "type" => $imgdata["mime"], @@ -1582,7 +1591,7 @@ class OStatus * @param object $doc XML document * @param array $item Data of the item that is to be posted * @param array $owner Contact data of the poster - * @param $repeated_guid + * @param string $repeated_guid guid * @param bool $toplevel Is it for en entry element (false) or a feed entry (true)? * * @return object Entry element @@ -1872,6 +1881,7 @@ class OStatus * @param string $title Title for the post * @param string $verb The activity verb * @param bool $complete Add the "status_net" element? + * @return void */ private static function entryContent($doc, $entry, $item, $owner, $title, $verb = "", $complete = true) { @@ -1892,13 +1902,8 @@ class OStatus XML::addElement($doc, $entry, "content", $body, array("type" => "html")); - XML::addElement( - $doc, - $entry, - "link", - "", - array("rel" => "alternate", "type" => "text/html", - "href" => System::baseUrl()."/display/".$item["guid"]) + XML::addElement($doc, $entry, "link", "", array("rel" => "alternate", "type" => "text/html", + "href" => System::baseUrl()."/display/".$item["guid"]) ); if ($complete && ($item["id"] > 0)) { @@ -1919,6 +1924,7 @@ class OStatus * @param array $item Data of the item that is to be posted * @param array $owner Contact data of the poster * @param bool $complete default true + * @return void */ private static function entryFooter($doc, $entry, $item, $owner, $complete = true) {