mirror of
https://github.com/friendica/friendica
synced 2025-04-28 12:24:23 +02:00
Most functions now moved from include/items.php
This commit is contained in:
parent
b158914c41
commit
7b27dda784
22 changed files with 1488 additions and 1523 deletions
|
@ -19,6 +19,7 @@ use Friendica\Database\DBM;
|
|||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\GContact;
|
||||
use Friendica\Model\Group;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Model\Term;
|
||||
use Friendica\Model\User;
|
||||
|
@ -922,7 +923,7 @@ class DFRN
|
|||
}
|
||||
|
||||
if ($item['allow_cid'] || $item['allow_gid'] || $item['deny_cid'] || $item['deny_gid']) {
|
||||
$body = fix_private_photos($item['body'], $owner['uid'], $item, $cid);
|
||||
$body = Item::fixPrivatePhotos($item['body'], $owner['uid'], $item, $cid);
|
||||
} else {
|
||||
$body = $item['body'];
|
||||
}
|
||||
|
@ -1059,7 +1060,7 @@ class DFRN
|
|||
$entry->appendChild($actarg);
|
||||
}
|
||||
|
||||
$tags = item_getfeedtags($item);
|
||||
$tags = Item::getFeedTags($item);
|
||||
|
||||
if (count($tags)) {
|
||||
foreach ($tags as $t) {
|
||||
|
@ -2214,7 +2215,7 @@ class DFRN
|
|||
"to_email" => $importer["email"],
|
||||
"uid" => $importer["importer_uid"],
|
||||
"item" => $item,
|
||||
"link" => System::baseUrl()."/display/".urlencode(get_item_guid($posted_id)),
|
||||
"link" => System::baseUrl()."/display/".urlencode(Item::getGuidById($posted_id)),
|
||||
"source_name" => stripslashes($item["author-name"]),
|
||||
"source_link" => $item["author-link"],
|
||||
"source_photo" => ((link_compare($item["author-link"], $importer["url"]))
|
||||
|
@ -2254,22 +2255,22 @@ class DFRN
|
|||
// This function once was responsible for DFRN and OStatus.
|
||||
if (activity_match($item["verb"], ACTIVITY_FOLLOW)) {
|
||||
logger("New follower");
|
||||
new_follower($importer, $contact, $item, $nickname);
|
||||
Contact::newFollower($importer, $contact, $item, $nickname);
|
||||
return false;
|
||||
}
|
||||
if (activity_match($item["verb"], ACTIVITY_UNFOLLOW)) {
|
||||
logger("Lost follower");
|
||||
lose_follower($importer, $contact, $item);
|
||||
Contact::loseFollower($importer, $contact, $item);
|
||||
return false;
|
||||
}
|
||||
if (activity_match($item["verb"], ACTIVITY_REQ_FRIEND)) {
|
||||
logger("New friend request");
|
||||
new_follower($importer, $contact, $item, $nickname, true);
|
||||
Contact::newFollower($importer, $contact, $item, $nickname, true);
|
||||
return false;
|
||||
}
|
||||
if (activity_match($item["verb"], ACTIVITY_UNFRIEND)) {
|
||||
logger("Lost sharer");
|
||||
lose_sharer($importer, $contact, $item);
|
||||
Contact::loseSharer($importer, $contact, $item);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
|
@ -2448,7 +2449,7 @@ class DFRN
|
|||
// make sure nobody is trying to sneak some html tags by us
|
||||
$item["body"] = notags(base64url_decode($item["body"]));
|
||||
|
||||
$item["body"] = limit_body_size($item["body"]);
|
||||
$item["body"] = Item::limitBodySize($item["body"]);
|
||||
|
||||
/// @todo Do we really need this check for HTML elements? (It was copied from the old function)
|
||||
if ((strpos($item['body'], '<') !== false) && (strpos($item['body'], '>') !== false)) {
|
||||
|
@ -2502,7 +2503,7 @@ class DFRN
|
|||
|
||||
$item["guid"] = $xpath->query("dfrn:diaspora_guid/text()", $entry)->item(0)->nodeValue;
|
||||
|
||||
// We store the data from "dfrn:diaspora_signature" in a different table, this is done in "item_store"
|
||||
// We store the data from "dfrn:diaspora_signature" in a different table, this is done in "Item::insert"
|
||||
$dsprsig = unxmlify($xpath->query("dfrn:diaspora_signature/text()", $entry)->item(0)->nodeValue);
|
||||
if ($dsprsig != "") {
|
||||
$item["dsprsig"] = $dsprsig;
|
||||
|
@ -2670,7 +2671,7 @@ class DFRN
|
|||
}
|
||||
|
||||
if (in_array($entrytype, [DFRN_REPLY, DFRN_REPLY_RC])) {
|
||||
$posted_id = item_store($item);
|
||||
$posted_id = Item::insert($item);
|
||||
$parent = 0;
|
||||
|
||||
if ($posted_id) {
|
||||
|
@ -2700,7 +2701,7 @@ class DFRN
|
|||
/*
|
||||
* The item owner info is not our contact. It's OK and is to be expected if this is a tgroup delivery,
|
||||
* but otherwise there's a possible data mixup on the sender's system.
|
||||
* the tgroup delivery code called from item_store will correct it if it's a forum,
|
||||
* the tgroup delivery code called from Item::insert will correct it if it's a forum,
|
||||
* but we're going to unconditionally correct it here so that the post will always be owned by our contact.
|
||||
*/
|
||||
logger('Correcting item owner.', LOGGER_DEBUG);
|
||||
|
@ -2716,9 +2717,9 @@ class DFRN
|
|||
|
||||
// This is my contact on another system, but it's really me.
|
||||
// Turn this into a wall post.
|
||||
$notify = item_is_remote_self($importer, $item);
|
||||
$notify = Item::isRemoteSelf($importer, $item);
|
||||
|
||||
$posted_id = item_store($item, false, $notify);
|
||||
$posted_id = Item::insert($item, false, $notify);
|
||||
|
||||
logger("Item was stored with id ".$posted_id, LOGGER_DEBUG);
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ use Friendica\Database\DBM;
|
|||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\GContact;
|
||||
use Friendica\Model\Group;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Model\Queue;
|
||||
use Friendica\Model\User;
|
||||
|
@ -1730,7 +1731,7 @@ class Diaspora
|
|||
|
||||
self::fetchGuid($datarray);
|
||||
|
||||
$message_id = item_store($datarray);
|
||||
$message_id = Item::insert($datarray);
|
||||
|
||||
if ($message_id <= 0) {
|
||||
return false;
|
||||
|
@ -2051,7 +2052,7 @@ class Diaspora
|
|||
|
||||
$datarray["body"] = self::constructLikeBody($contact, $parent_item, $guid);
|
||||
|
||||
$message_id = item_store($datarray);
|
||||
$message_id = Item::insert($datarray);
|
||||
|
||||
if ($message_id <= 0) {
|
||||
return false;
|
||||
|
@ -2417,7 +2418,7 @@ class Diaspora
|
|||
$arr["deny_cid"] = $user["deny_cid"];
|
||||
$arr["deny_gid"] = $user["deny_gid"];
|
||||
|
||||
$i = item_store($arr);
|
||||
$i = Item::insert($arr);
|
||||
if ($i) {
|
||||
Worker::add(PRIORITY_HIGH, "Notifier", "activity", $i);
|
||||
}
|
||||
|
@ -2501,7 +2502,7 @@ class Diaspora
|
|||
return true;
|
||||
} else {
|
||||
logger("Author ".$author." doesn't want to follow us anymore.", LOGGER_DEBUG);
|
||||
lose_follower($importer, $contact);
|
||||
Contact::loseFollower($importer, $contact);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -2780,7 +2781,7 @@ class Diaspora
|
|||
$datarray["object-type"] = $original_item["object-type"];
|
||||
|
||||
self::fetchGuid($datarray);
|
||||
$message_id = item_store($datarray);
|
||||
$message_id = Item::insert($datarray);
|
||||
|
||||
self::sendParticipation($contact, $datarray);
|
||||
|
||||
|
@ -3020,7 +3021,7 @@ class Diaspora
|
|||
}
|
||||
|
||||
self::fetchGuid($datarray);
|
||||
$message_id = item_store($datarray);
|
||||
$message_id = Item::insert($datarray);
|
||||
|
||||
self::sendParticipation($contact, $datarray);
|
||||
|
||||
|
|
|
@ -423,7 +423,7 @@ class Feed {
|
|||
if (!$simulate) {
|
||||
logger("Stored feed: ".print_r($item, true), LOGGER_DEBUG);
|
||||
|
||||
$notify = item_is_remote_self($contact, $item);
|
||||
$notify = Item::isRemoteSelf($contact, $item);
|
||||
|
||||
// Distributed items should have a well formatted URI.
|
||||
// Additionally we have to avoid conflicts with identical URI between imported feeds and these items.
|
||||
|
@ -433,7 +433,7 @@ class Feed {
|
|||
unset($item['parent-uri']);
|
||||
}
|
||||
|
||||
$id = item_store($item, false, $notify);
|
||||
$id = Item::insert($item, false, $notify);
|
||||
|
||||
logger("Feed for contact ".$contact["url"]." stored under id ".$id);
|
||||
} else {
|
||||
|
|
|
@ -14,6 +14,7 @@ use Friendica\Database\DBM;
|
|||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\GContact;
|
||||
use Friendica\Model\Conversation;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Object\Image;
|
||||
use Friendica\Util\Lock;
|
||||
|
@ -455,12 +456,12 @@ class OStatus
|
|||
}
|
||||
|
||||
if ($item["verb"] == ACTIVITY_FOLLOW) {
|
||||
new_follower($importer, $contact, $item, $nickname);
|
||||
Contact::newFollower($importer, $contact, $item, $nickname);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($item["verb"] == NAMESPACE_OSTATUS."/unfollow") {
|
||||
lose_follower($importer, $contact, $item, $dummy);
|
||||
Contact::loseFollower($importer, $contact, $item, $dummy);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -521,12 +522,12 @@ class OStatus
|
|||
logger("Item with uri ".$item["uri"]." is from a blocked contact.", LOGGER_DEBUG);
|
||||
} else {
|
||||
// We are having duplicated entries. Hopefully this solves it.
|
||||
if (Lock::set('ostatus_process_item_store')) {
|
||||
$ret = item_store($item);
|
||||
Lock::remove('ostatus_process_item_store');
|
||||
if (Lock::set('ostatus_process_item_insert')) {
|
||||
$ret = Item::insert($item);
|
||||
Lock::remove('ostatus_process_item_insert');
|
||||
logger("Item with uri ".$item["uri"]." for user ".$importer["uid"].' stored. Return value: '.$ret);
|
||||
} else {
|
||||
$ret = item_store($item);
|
||||
$ret = Item::insert($item);
|
||||
logger("We couldn't lock - but tried to store the item anyway. Return value is ".$ret);
|
||||
}
|
||||
}
|
||||
|
@ -1996,7 +1997,7 @@ class OStatus
|
|||
XML::addElement($doc, $entry, "ostatus:conversation", $conversation_uri, $attributes);
|
||||
}
|
||||
|
||||
$tags = item_getfeedtags($item);
|
||||
$tags = item::getFeedTags($item);
|
||||
|
||||
if (count($tags)) {
|
||||
foreach ($tags as $t) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue