New methods in item class

This commit is contained in:
Michael 2018-01-28 11:19:38 +00:00
parent f96a41a411
commit 229b21d7b2
3 changed files with 16 additions and 14 deletions

View file

@ -974,7 +974,7 @@ function pumpio_dolike(&$a, $uid, $self, $post, $own_id, $threadcompletion = tru
$likedata['object'] = '<object><type>' . ACTIVITY_OBJ_NOTE . '</type><local>1</local>' .
'<id>' . $orig_post['uri'] . '</id><link>' . xmlify('<link rel="alternate" type="text/html" href="' . xmlify($orig_post['plink']) . '" />') . '</link><title>' . $orig_post['title'] . '</title><content>' . $orig_post['body'] . '</content></object>';
$ret = item_store($likedata);
$ret = Item::insert($likedata);
logger("pumpio_dolike: ".$ret." User ".$own_id." ".$uid." Contact: ".$contactid." Url ".$orig_post['uri']);
}
@ -1250,7 +1250,7 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet
if (trim($postarray['body']) == "")
return false;
$top_item = item_store($postarray);
$top_item = Item::insert($postarray);
$postarray["id"] = $top_item;
if (($top_item == 0) && ($post->verb == "update")) {
@ -1306,7 +1306,7 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet
'to_email' => $user[0]['email'],
'uid' => $user[0]['uid'],
'item' => $postarray,
'link' => $a->get_baseurl().'/display/'.urlencode(get_item_guid($top_item)),
'link' => $a->get_baseurl().'/display/'.urlencode(Item::getGuidById($top_item)),
'source_name' => $postarray['author-name'],
'source_link' => $postarray['author-link'],
'source_photo' => $postarray['author-avatar'],

View file

@ -55,6 +55,7 @@ use Friendica\Core\L10n;
use Friendica\Core\PConfig;
use Friendica\Model\GContact;
use Friendica\Model\Group;
use Friendica\Model\Item;
use Friendica\Model\Photo;
use Friendica\Model\User;
use Friendica\Util\Network;
@ -1371,7 +1372,7 @@ function statusnet_checknotification(App $a, $uid, $own_url, $top_item, $postarr
'to_email' => $user[0]['email'],
'uid' => $user[0]['uid'],
'item' => $postarray,
'link' => $a->get_baseurl() . '/display/' . urlencode(get_item_guid($top_item)),
'link' => $a->get_baseurl() . '/display/' . urlencode(Item::getGuidById($top_item)),
'source_name' => $postarray['author-name'],
'source_link' => $postarray['author-link'],
'source_photo' => $postarray['author-avatar'],
@ -1495,7 +1496,7 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
continue;
}
$item = item_store($postarray);
$item = Item::insert($postarray);
$postarray["id"] = $item;
logger('statusnet_fetchhometimeline: User ' . $self["nick"] . ' posted home timeline item ' . $item);
@ -1550,7 +1551,7 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
continue;
}
$item = item_store($postarray);
$item = Item::insert($postarray);
$postarray["id"] = $item;
logger('statusnet_fetchhometimeline: User ' . $self["nick"] . ' posted mention timeline item ' . $item);
@ -1579,7 +1580,7 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
'to_email' => $u[0]['email'],
'uid' => $u[0]['uid'],
'item' => $postarray,
'link' => $a->get_baseurl() . '/display/' . urlencode(get_item_guid($item)),
'link' => $a->get_baseurl() . '/display/' . urlencode(Item::getGuidById($item)),
'source_name' => $postarray['author-name'],
'source_link' => $postarray['author-link'],
'source_photo' => $postarray['author-avatar'],
@ -1620,7 +1621,7 @@ function statusnet_complete_conversation(App $a, $uid, $self, $create_user, $nic
continue;
}
$item = item_store($postarray);
$item = Item::insert($postarray);
$postarray["id"] = $item;
logger('statusnet_complete_conversation: User ' . $self["nick"] . ' posted home timeline item ' . $item);

View file

@ -70,6 +70,7 @@ use Friendica\Core\PConfig;
use Friendica\Core\Worker;
use Friendica\Model\GContact;
use Friendica\Model\Group;
use Friendica\Model\Item;
use Friendica\Model\Photo;
use Friendica\Model\Queue;
use Friendica\Model\User;
@ -755,7 +756,7 @@ function twitter_expire(App $a, $b)
if (count($r)) {
foreach ($r as $rr) {
logger('twitter_expire: user ' . $rr['uid']);
item_expire($rr['uid'], $days, NETWORK_TWITTER, true);
Item::expire($rr['uid'], $days, NETWORK_TWITTER, true);
}
}
@ -1603,7 +1604,7 @@ function twitter_checknotification(App $a, $uid, $own_id, $top_item, $postarray)
'to_email' => $user[0]['email'],
'uid' => $user[0]['uid'],
'item' => $postarray,
'link' => $a->get_baseurl() . '/display/' . urlencode(get_item_guid($top_item)),
'link' => $a->get_baseurl() . '/display/' . urlencode(Item::getGuidById($top_item)),
'source_name' => $postarray['author-name'],
'source_link' => $postarray['author-link'],
'source_photo' => $postarray['author-avatar'],
@ -1657,7 +1658,7 @@ function twitter_fetchparentposts(App $a, $uid, $post, $connection, $self, $own_
if (trim($postarray['body']) == "")
continue;
$item = item_store($postarray);
$item = Item::insert($postarray);
$postarray["id"] = $item;
logger('twitter_fetchparentpost: User ' . $self["nick"] . ' posted parent timeline item ' . $item);
@ -1774,7 +1775,7 @@ function twitter_fetchhometimeline(App $a, $uid)
continue;
}
$item = item_store($postarray);
$item = Item::insert($postarray);
$postarray["id"] = $item;
logger('twitter_fetchhometimeline: User ' . $self["nick"] . ' posted home timeline item ' . $item);
@ -1826,7 +1827,7 @@ function twitter_fetchhometimeline(App $a, $uid)
continue;
}
$item = item_store($postarray);
$item = Item::insert($postarray);
$postarray["id"] = $item;
if ($item && function_exists("check_item_notification")) {
@ -1861,7 +1862,7 @@ function twitter_fetchhometimeline(App $a, $uid)
'to_email' => $u[0]['email'],
'uid' => $u[0]['uid'],
'item' => $postarray,
'link' => $a->get_baseurl() . '/display/' . urlencode(get_item_guid($item)),
'link' => $a->get_baseurl() . '/display/' . urlencode(Item::getGuidById($item)),
'source_name' => $postarray['author-name'],
'source_link' => $postarray['author-link'],
'source_photo' => $postarray['author-avatar'],