mirror of
https://github.com/friendica/friendica
synced 2024-12-22 22:40:16 +00: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
|
@ -4731,7 +4731,7 @@ function post_photo_item($hash, $allow_cid, $deny_cid, $allow_gid, $deny_gid, $f
|
|||
. '[/url]';
|
||||
|
||||
// do the magic for storing the item in the database and trigger the federation to other contacts
|
||||
item_store($arr);
|
||||
Item::insert($arr);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -11,6 +11,7 @@ use Friendica\Core\L10n;
|
|||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Util\Map;
|
||||
|
||||
|
@ -399,7 +400,7 @@ function event_store($arr) {
|
|||
$item_arr['object'] .= '<content>' . xmlify(format_event_bbcode($event)) . '</content>';
|
||||
$item_arr['object'] .= '</object>' . "\n";
|
||||
|
||||
$item_id = item_store($item_arr);
|
||||
$item_id = Item::insert($item_arr);
|
||||
if ($item_id) {
|
||||
q("UPDATE `item` SET `event-id` = %d WHERE `uid` = %d AND `id` = %d",
|
||||
intval($event['id']),
|
||||
|
|
1467
include/items.php
1467
include/items.php
File diff suppressed because it is too large
Load diff
|
@ -9,6 +9,7 @@ use Friendica\Core\System;
|
|||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Protocol\Diaspora;
|
||||
|
||||
/**
|
||||
|
@ -244,7 +245,7 @@ EOT;
|
|||
'unseen' => 1,
|
||||
];
|
||||
|
||||
$new_item_id = item_store($new_item);
|
||||
$new_item_id = Item::insert($new_item);
|
||||
|
||||
// @todo: Explain this block
|
||||
if (! $item['visible']) {
|
||||
|
|
|
@ -26,6 +26,7 @@ use Friendica\Core\Worker;
|
|||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Group;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Protocol\Diaspora;
|
||||
|
@ -439,7 +440,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
|
|||
$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);
|
||||
}
|
||||
|
@ -701,7 +702,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
|
|||
$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);
|
||||
}
|
||||
|
|
|
@ -729,7 +729,7 @@ function item_post(App $a) {
|
|||
unset($datarray['self']);
|
||||
unset($datarray['api_source']);
|
||||
|
||||
$post_id = item_store($datarray);
|
||||
$post_id = Item::insert($datarray);
|
||||
|
||||
if (!$post_id) {
|
||||
logger("Item wasn't stored.");
|
||||
|
|
|
@ -8,6 +8,7 @@ use Friendica\Core\L10n;
|
|||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Module\Login;
|
||||
use Friendica\Model\Item;
|
||||
|
||||
function notify_init(App $a)
|
||||
{
|
||||
|
@ -27,7 +28,7 @@ function notify_init(App $a)
|
|||
require_once("include/items.php");
|
||||
$urldata = parse_url($note['link']);
|
||||
$guid = basename($urldata["path"]);
|
||||
$itemdata = get_item_id($guid, local_user());
|
||||
$itemdata = Item::getIdAndNickByGuid($guid, local_user());
|
||||
if ($itemdata["id"] != 0) {
|
||||
$note['link'] = System::baseUrl().'/display/'.$itemdata["nick"].'/'.$itemdata["id"];
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ use Friendica\Core\Worker;
|
|||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Group;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Photo;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Network\Probe;
|
||||
|
@ -519,7 +520,7 @@ function photos_post(App $a)
|
|||
. '[img]' . System::baseUrl() . '/photo/' . $p[0]['resource-id'] . '-' . $p[0]['scale'] . '.'. $ext . '[/img]'
|
||||
. '[/url]';
|
||||
|
||||
$item_id = item_store($arr);
|
||||
$item_id = Item::insert($arr);
|
||||
}
|
||||
|
||||
if ($item_id) {
|
||||
|
@ -709,7 +710,7 @@ function photos_post(App $a)
|
|||
. System::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource-id'] . '</id>';
|
||||
$arr['target'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . System::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource-id'] . '" />' . "\n" . '<link rel="preview" type="'.$p[0]['type'].'" href="' . System::baseUrl() . "/photo/" . $p[0]['resource-id'] . '-' . $best . '.' . $ext . '" />') . '</link></target>';
|
||||
|
||||
$item_id = item_store($arr);
|
||||
$item_id = Item::insert($arr);
|
||||
if ($item_id) {
|
||||
Worker::add(PRIORITY_HIGH, "Notifier", "tag", $item_id);
|
||||
}
|
||||
|
@ -931,7 +932,7 @@ function photos_post(App $a)
|
|||
. '[img]' . System::baseUrl() . "/photo/{$photo_hash}-{$smallest}.".$Image->getExt() . '[/img]'
|
||||
. '[/url]';
|
||||
|
||||
$item_id = item_store($arr);
|
||||
$item_id = Item::insert($arr);
|
||||
// Update the photo albums cache
|
||||
Photo::clearAlbumCache($page_owner_uid);
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ use Friendica\Core\L10n;
|
|||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Item;
|
||||
|
||||
require_once 'include/security.php';
|
||||
require_once 'include/bbcode.php';
|
||||
|
@ -132,7 +133,7 @@ function poke_init(App $a) {
|
|||
$arr['object'] .= xmlify('<link rel="photo" type="image/jpeg" href="' . $target['photo'] . '" />' . "\n");
|
||||
$arr['object'] .= '</link></object>' . "\n";
|
||||
|
||||
$item_id = item_store($arr);
|
||||
$item_id = Item::insert($arr);
|
||||
if($item_id) {
|
||||
//q("UPDATE `item` SET `plink` = '%s' WHERE `uid` = %d AND `id` = %d",
|
||||
// dbesc(System::baseUrl() . '/display/' . $poster['nickname'] . '/' . $item_id),
|
||||
|
|
|
@ -15,6 +15,7 @@ use Friendica\Core\Worker;
|
|||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\GContact;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Network\Probe;
|
||||
|
||||
function profiles_init(App $a) {
|
||||
|
@ -601,7 +602,7 @@ function profile_activity($changed, $value) {
|
|||
$arr['deny_cid'] = $a->user['deny_cid'];
|
||||
$arr['deny_gid'] = $a->user['deny_gid'];
|
||||
|
||||
$i = item_store($arr);
|
||||
$i = Item::insert($arr);
|
||||
if ($i) {
|
||||
Worker::add(PRIORITY_HIGH, "Notifier", "activity", $i);
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ use Friendica\Core\Addon;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Item;
|
||||
|
||||
require_once 'include/security.php';
|
||||
require_once 'include/bbcode.php';
|
||||
|
@ -149,7 +150,7 @@ EOT;
|
|||
$arr['visible'] = 1;
|
||||
$arr['unseen'] = 1;
|
||||
|
||||
$post_id = item_store($arr);
|
||||
$post_id = Item::insert($arr);
|
||||
|
||||
if (! $item['visible']) {
|
||||
$r = q("UPDATE `item` SET `visible` = 1 WHERE `id` = %d AND `uid` = %d",
|
||||
|
|
|
@ -8,6 +8,7 @@ use Friendica\Core\L10n;
|
|||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Item;
|
||||
|
||||
require_once 'include/security.php';
|
||||
require_once 'include/bbcode.php';
|
||||
|
@ -145,13 +146,7 @@ EOT;
|
|||
$arr['unseen'] = 1;
|
||||
$arr['origin'] = 1;
|
||||
|
||||
$post_id = item_store($arr);
|
||||
|
||||
// q("UPDATE `item` set plink = '%s' where id = %d",
|
||||
// dbesc(System::baseUrl() . '/display/' . $owner_nick . '/' . $post_id),
|
||||
// intval($post_id)
|
||||
// );
|
||||
|
||||
$post_id = Item::insert($arr);
|
||||
|
||||
if(! $item['visible']) {
|
||||
$r = q("UPDATE `item` SET `visible` = 1 WHERE `id` = %d AND `uid` = %d",
|
||||
|
|
|
@ -1354,4 +1354,113 @@ class Contact extends BaseObject
|
|||
|
||||
return $contact;
|
||||
}
|
||||
|
||||
public static function newFollower($importer, $contact, $datarray, $item, $sharing = false) {
|
||||
$url = notags(trim($datarray['author-link']));
|
||||
$name = notags(trim($datarray['author-name']));
|
||||
$photo = notags(trim($datarray['author-avatar']));
|
||||
|
||||
if (is_object($item)) {
|
||||
$rawtag = $item->get_item_tags(NAMESPACE_ACTIVITY,'actor');
|
||||
if ($rawtag && $rawtag[0]['child'][NAMESPACE_POCO]['preferredUsername'][0]['data']) {
|
||||
$nick = $rawtag[0]['child'][NAMESPACE_POCO]['preferredUsername'][0]['data'];
|
||||
}
|
||||
} else {
|
||||
$nick = $item;
|
||||
}
|
||||
|
||||
if (is_array($contact)) {
|
||||
if (($contact['network'] == NETWORK_OSTATUS && $contact['rel'] == CONTACT_IS_SHARING)
|
||||
|| ($sharing && $contact['rel'] == CONTACT_IS_FOLLOWER)) {
|
||||
dba::update('contact', ['rel' => CONTACT_IS_FRIEND, 'writable' => true],
|
||||
['id' => $contact['id'], 'uid' => $importer['uid']]);
|
||||
}
|
||||
// send email notification to owner?
|
||||
} else {
|
||||
// create contact record
|
||||
q("INSERT INTO `contact` (`uid`, `created`, `url`, `nurl`, `name`, `nick`, `photo`, `network`, `rel`,
|
||||
`blocked`, `readonly`, `pending`, `writable`)
|
||||
VALUES (%d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, 0, 0, 1, 1)",
|
||||
intval($importer['uid']),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc($url),
|
||||
dbesc(normalise_link($url)),
|
||||
dbesc($name),
|
||||
dbesc($nick),
|
||||
dbesc($photo),
|
||||
dbesc(NETWORK_OSTATUS),
|
||||
intval(CONTACT_IS_FOLLOWER)
|
||||
);
|
||||
|
||||
$r = q("SELECT `id`, `network` FROM `contact` WHERE `uid` = %d AND `url` = '%s' AND `pending` = 1 LIMIT 1",
|
||||
intval($importer['uid']),
|
||||
dbesc($url)
|
||||
);
|
||||
if (DBM::is_result($r)) {
|
||||
$contact_record = $r[0];
|
||||
Contact::updateAvatar($photo, $importer["uid"], $contact_record["id"], true);
|
||||
}
|
||||
|
||||
/// @TODO Encapsulate this into a function/method
|
||||
$r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
|
||||
intval($importer['uid'])
|
||||
);
|
||||
if (DBM::is_result($r) && !in_array($r[0]['page-flags'], [PAGE_SOAPBOX, PAGE_FREELOVE, PAGE_COMMUNITY])) {
|
||||
// create notification
|
||||
$hash = random_string();
|
||||
|
||||
if (is_array($contact_record)) {
|
||||
dba::insert('intro', ['uid' => $importer['uid'], 'contact-id' => $contact_record['id'],
|
||||
'blocked' => false, 'knowyou' => false,
|
||||
'hash' => $hash, 'datetime' => datetime_convert()]);
|
||||
}
|
||||
|
||||
Group::addMember(User::getDefaultGroup($importer['uid'], $contact_record["network"]), $contact_record['id']);
|
||||
|
||||
if (($r[0]['notify-flags'] & NOTIFY_INTRO) &&
|
||||
in_array($r[0]['page-flags'], [PAGE_NORMAL])) {
|
||||
|
||||
notification([
|
||||
'type' => NOTIFY_INTRO,
|
||||
'notify_flags' => $r[0]['notify-flags'],
|
||||
'language' => $r[0]['language'],
|
||||
'to_name' => $r[0]['username'],
|
||||
'to_email' => $r[0]['email'],
|
||||
'uid' => $r[0]['uid'],
|
||||
'link' => System::baseUrl() . '/notifications/intro',
|
||||
'source_name' => ((strlen(stripslashes($contact_record['name']))) ? stripslashes($contact_record['name']) : L10n::t('[Name Withheld]')),
|
||||
'source_link' => $contact_record['url'],
|
||||
'source_photo' => $contact_record['photo'],
|
||||
'verb' => ($sharing ? ACTIVITY_FRIEND : ACTIVITY_FOLLOW),
|
||||
'otype' => 'intro'
|
||||
]);
|
||||
|
||||
}
|
||||
} elseif (DBM::is_result($r) && in_array($r[0]['page-flags'], [PAGE_SOAPBOX, PAGE_FREELOVE, PAGE_COMMUNITY])) {
|
||||
q("UPDATE `contact` SET `pending` = 0 WHERE `uid` = %d AND `url` = '%s' AND `pending` LIMIT 1",
|
||||
intval($importer['uid']),
|
||||
dbesc($url)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static function loseFollower($importer, $contact, array $datarray = [], $item = "") {
|
||||
|
||||
if (($contact['rel'] == CONTACT_IS_FRIEND) || ($contact['rel'] == CONTACT_IS_SHARING)) {
|
||||
dba::update('contact', ['rel' => CONTACT_IS_SHARING], ['id' => $contact['id']]);
|
||||
} else {
|
||||
Contact::remove($contact['id']);
|
||||
}
|
||||
}
|
||||
|
||||
public static function loseSharer($importer, $contact, array $datarray = [], $item = "") {
|
||||
|
||||
if (($contact['rel'] == CONTACT_IS_FRIEND) || ($contact['rel'] == CONTACT_IS_FOLLOWER)) {
|
||||
dba::update('contact', ['rel' => CONTACT_IS_FOLLOWER], ['id' => $contact['id']]);
|
||||
} else {
|
||||
Contact::remove($contact['id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
1320
src/Model/Item.php
1320
src/Model/Item.php
File diff suppressed because it is too large
Load diff
|
@ -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) {
|
||||
|
|
|
@ -207,7 +207,7 @@ class Delivery {
|
|||
logger('notifier: '.$target_item["guid"].' dfrndelivery: '.$contact['name']);
|
||||
|
||||
if ($mail) {
|
||||
$item['body'] = fix_private_photos($item['body'],$owner['uid'],null,$message[0]['contact-id']);
|
||||
$item['body'] = Item::fixPrivatePhotos($item['body'],$owner['uid'],null,$message[0]['contact-id']);
|
||||
$atom = DFRN::mail($item, $owner);
|
||||
} elseif ($fsuggest) {
|
||||
$atom = DFRN::fsuggest($item, $owner);
|
||||
|
|
|
@ -9,6 +9,7 @@ namespace Friendica\Worker;
|
|||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Database\DBM;
|
||||
use dba;
|
||||
|
||||
|
@ -43,7 +44,7 @@ class Expire {
|
|||
$user = dba::selectFirst('user', ['uid', 'username', 'expire'], ['uid' => $param]);
|
||||
if (DBM::is_result($user)) {
|
||||
logger('Expire items for user '.$user['uid'].' ('.$user['username'].') - interval: '.$user['expire'], LOGGER_DEBUG);
|
||||
item_expire($user['uid'], $user['expire']);
|
||||
Item::expire($user['uid'], $user['expire']);
|
||||
logger('Expire items for user '.$user['uid'].' ('.$user['username'].') - done ', LOGGER_DEBUG);
|
||||
}
|
||||
return;
|
||||
|
|
|
@ -8,6 +8,7 @@ use Friendica\Core\Config;
|
|||
use Friendica\Core\PConfig;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Protocol\Email;
|
||||
use Friendica\Protocol\PortableContact;
|
||||
use Friendica\Util\Network;
|
||||
|
@ -487,7 +488,7 @@ class OnePoll
|
|||
continue;
|
||||
}
|
||||
$datarray['body'] = escape_tags($r['body']);
|
||||
$datarray['body'] = limit_body_size($datarray['body']);
|
||||
$datarray['body'] = Item::limitBodySize($datarray['body']);
|
||||
|
||||
logger("Mail: Importing ".$msg_uid." for ".$mailconf['user']);
|
||||
|
||||
|
@ -531,7 +532,7 @@ class OnePoll
|
|||
$datarray['allow_cid'] = '<' . $contact['id'] . '>';
|
||||
}
|
||||
|
||||
$stored_item = item_store($datarray);
|
||||
$stored_item = Item::insert($datarray);
|
||||
|
||||
switch ($mailconf['action']) {
|
||||
case 0:
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
namespace Friendica\Worker;
|
||||
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Core\Config;
|
||||
|
||||
require_once("include/items.php");
|
||||
|
@ -46,7 +47,7 @@ class SpoolPost {
|
|||
continue;
|
||||
}
|
||||
|
||||
$result = item_store($arr);
|
||||
$result = Item::insert($arr);
|
||||
|
||||
logger("Spool file ".$file." stored: ".$result, LOGGER_DEBUG);
|
||||
unlink($fullfile);
|
||||
|
|
Loading…
Reference in a new issue