Most functions now moved from include/items.php

This commit is contained in:
Michael 2018-01-28 11:18:08 +00:00
commit 7b27dda784
22 changed files with 1488 additions and 1523 deletions

View file

@ -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);
}

View file

@ -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.");

View file

@ -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"];
}

View file

@ -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);

View file

@ -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),

View file

@ -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);
}

View file

@ -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",

View file

@ -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",