mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2024-11-21 20:03:40 +00:00
Addons are now using the new post functions
This commit is contained in:
parent
0417ee39fd
commit
1533d9a758
7 changed files with 26 additions and 20 deletions
|
@ -43,6 +43,7 @@ use Friendica\Database\DBA;
|
|||
use Friendica\Database\DBStructure;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Post;
|
||||
use Friendica\Model\Tag;
|
||||
use Friendica\Module\Security\Login;
|
||||
use Friendica\Network\HTTPException;
|
||||
|
@ -404,7 +405,7 @@ function advancedcontentfilter_get_variables_guid(ServerRequestInterface $reques
|
|||
|
||||
$condition = ["`guid` = ? AND (`uid` = ? OR `uid` = 0)", $args['guid'], local_user()];
|
||||
$params = ['order' => ['uid' => true]];
|
||||
$item = Item::selectFirstForUser(local_user(), [], $condition, $params);
|
||||
$item = Post::selectFirstForUser(local_user(), [], $condition, $params);
|
||||
|
||||
if (!DBA::isResult($item)) {
|
||||
throw new HTTPException\NotFoundException(DI::l10n()->t('Unknown post with guid: %s', $args['guid']));
|
||||
|
|
|
@ -13,6 +13,7 @@ use Friendica\Core\Renderer;
|
|||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Post;
|
||||
use Friendica\Protocol\Activity;
|
||||
|
||||
function mailstream_install() {
|
||||
|
@ -213,7 +214,7 @@ function mailstream_subject($item) {
|
|||
$parent = $item['thr-parent'];
|
||||
// Don't look more than 100 levels deep for a subject, in case of loops
|
||||
for ($i = 0; ($i < 100) && $parent; $i++) {
|
||||
$parent_item = Item::selectFirst(['thr-parent', 'title'], ['uri' => $parent]);
|
||||
$parent_item = Post::selectFirst(['thr-parent', 'title'], ['uri' => $parent]);
|
||||
if (!DBA::isResult($parent_item)) {
|
||||
break;
|
||||
}
|
||||
|
@ -337,7 +338,7 @@ function mailstream_cron($a, $b) {
|
|||
if (!$ms_item_id['message-id'] || !strlen($ms_item_id['message-id'])) {
|
||||
Logger::info('mailstream_cron: Item ' . $ms_item_id['id'] . ' URI ' . $ms_item_id['uri'] . ' has no message-id');
|
||||
}
|
||||
$item = Item::selectFirst([], ['id' => $ms_item_id['id']]);
|
||||
$item = Post::selectFirst([], ['id' => $ms_item_id['id']]);
|
||||
$users = q("SELECT * FROM `user` WHERE `uid` = %d", intval($item['uid']));
|
||||
$user = $users[0];
|
||||
if ($user && $item) {
|
||||
|
|
|
@ -18,6 +18,7 @@ use Friendica\DI;
|
|||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Group;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Post;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Protocol\Activity;
|
||||
use Friendica\Protocol\ActivityNamespace;
|
||||
|
@ -438,7 +439,7 @@ function pumpio_send(App $a, array &$b)
|
|||
if ($b['parent'] != $b['id']) {
|
||||
// Looking if its a reply to a pumpio post
|
||||
$condition = ['id' => $b['parent'], 'network' => Protocol::PUMPIO];
|
||||
$orig_post = Item::selectFirst([], $condition);
|
||||
$orig_post = Post::selectFirst([], $condition);
|
||||
|
||||
if (!DBA::isResult($orig_post)) {
|
||||
Logger::log("pumpio_send: no pumpio post ".$b["parent"]);
|
||||
|
@ -609,7 +610,7 @@ function pumpio_action(App $a, $uid, $uri, $action, $content = "")
|
|||
$hostname = DI::pConfig()->get($uid, 'pumpio', 'host');
|
||||
$username = DI::pConfig()->get($uid, "pumpio", "user");
|
||||
|
||||
$orig_post = Item::selectFirst([], ['uri' => $uri, 'uid' => $uid]);
|
||||
$orig_post = Post::selectFirst([], ['uri' => $uri, 'uid' => $uid]);
|
||||
|
||||
if (!DBA::isResult($orig_post)) {
|
||||
return;
|
||||
|
@ -872,9 +873,9 @@ function pumpio_dounlike(App $a, $uid, $self, $post, $own_id)
|
|||
{
|
||||
// Searching for the unliked post
|
||||
// Two queries for speed issues
|
||||
$orig_post = Item::selectFirst([], ['uri' => $post->object->id, 'uid' => $uid]);
|
||||
$orig_post = Post::selectFirst([], ['uri' => $post->object->id, 'uid' => $uid]);
|
||||
if (!DBA::isResult($orig_post)) {
|
||||
$orig_post = Item::selectFirst([], ['extid' => $post->object->id, 'uid' => $uid]);
|
||||
$orig_post = Post::selectFirst([], ['extid' => $post->object->id, 'uid' => $uid]);
|
||||
if (!DBA::isResult($orig_post)) {
|
||||
return;
|
||||
}
|
||||
|
@ -917,9 +918,9 @@ function pumpio_dolike(App $a, $uid, $self, $post, $own_id, $threadcompletion =
|
|||
|
||||
// Searching for the liked post
|
||||
// Two queries for speed issues
|
||||
$orig_post = Item::selectFirst([], ['uri' => $post->object->id, 'uid' => $uid]);
|
||||
$orig_post = Post::selectFirst([], ['uri' => $post->object->id, 'uid' => $uid]);
|
||||
if (!DBA::isResult($orig_post)) {
|
||||
$orig_post = Item::selectFirst([], ['extid' => $post->object->id, 'uid' => $uid]);
|
||||
$orig_post = Post::selectFirst([], ['extid' => $post->object->id, 'uid' => $uid]);
|
||||
if (!DBA::isResult($orig_post)) {
|
||||
return;
|
||||
}
|
||||
|
@ -1503,7 +1504,7 @@ function pumpio_fetchallcomments(App $a, $uid, $id)
|
|||
|
||||
// Fetching the original post
|
||||
$condition = ["`uri` = ? AND `uid` = ? AND `extid` != ''", $id, $uid];
|
||||
$original = Item::selectFirst(['extid'], $condition);
|
||||
$original = Post::selectFirst(['extid'], $condition);
|
||||
if (!DBA::isResult($original)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -54,6 +54,7 @@ use Friendica\Model\Group;
|
|||
use Friendica\Model\Item;
|
||||
use Friendica\Model\ItemContent;
|
||||
use Friendica\Model\Photo;
|
||||
use Friendica\Model\Post;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Protocol\Activity;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
@ -495,7 +496,7 @@ function statusnet_post_hook(App $a, &$b)
|
|||
}
|
||||
|
||||
$condition = ['uri' => $b["thr-parent"], 'uid' => $b["uid"]];
|
||||
$orig_post = Item::selectFirst(['author-link', 'uri'], $condition);
|
||||
$orig_post = Post::selectFirst(['author-link', 'uri'], $condition);
|
||||
if (!DBA::isResult($orig_post)) {
|
||||
Logger::log("statusnet_post_hook: no parent found " . $b["thr-parent"]);
|
||||
return;
|
||||
|
@ -716,7 +717,7 @@ function statusnet_prepare_body(App $a, &$b)
|
|||
$item["plink"] = DI::baseUrl()->get() . "/display/" . $item["guid"];
|
||||
|
||||
$condition = ['uri' => $item["thr-parent"], 'uid' => local_user()];
|
||||
$orig_post = Item::selectFirst(['author-link', 'uri'], $condition);
|
||||
$orig_post = Post::selectFirst(['author-link', 'uri'], $condition);
|
||||
if (DBA::isResult($orig_post)) {
|
||||
$nick = preg_replace("=https?://(.*)/(.*)=ism", "$2", $orig_post["author-link"]);
|
||||
|
||||
|
@ -1106,9 +1107,9 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex
|
|||
if (!empty($content->in_reply_to_status_id)) {
|
||||
$thr_parent = $hostname . "::" . $content->in_reply_to_status_id;
|
||||
|
||||
$item = Item::selectFirst(['uri'], ['uri' => $thr_parent, 'uid' => $uid]);
|
||||
$item = Post::selectFirst(['uri'], ['uri' => $thr_parent, 'uid' => $uid]);
|
||||
if (!DBA::isResult($item)) {
|
||||
$item = Item::selectFirst(['uri'], ['extid' => $thr_parent, 'uid' => $uid]);
|
||||
$item = Post::selectFirst(['uri'], ['extid' => $thr_parent, 'uid' => $uid]);
|
||||
}
|
||||
|
||||
if (DBA::isResult($item)) {
|
||||
|
|
|
@ -559,7 +559,7 @@ function twitter_post_hook(App $a, array &$b)
|
|||
}
|
||||
|
||||
$condition = ['uri' => $b["thr-parent"], 'uid' => $b["uid"]];
|
||||
$thr_parent = Item::selectFirst(['uri', 'extid', 'author-link', 'author-nick', 'author-network'], $condition);
|
||||
$thr_parent = Post::selectFirst(['uri', 'extid', 'author-link', 'author-nick', 'author-network'], $condition);
|
||||
if (!DBA::isResult($thr_parent)) {
|
||||
Logger::warning('No parent found', ['thr-parent' => $b["thr-parent"]]);
|
||||
return;
|
||||
|
@ -885,7 +885,7 @@ function twitter_prepare_body(App $a, array &$b)
|
|||
$item["plink"] = DI::baseUrl()->get() . "/display/" . $item["guid"];
|
||||
|
||||
$condition = ['uri' => $item["thr-parent"], 'uid' => local_user()];
|
||||
$orig_post = Item::selectFirst(['author-link'], $condition);
|
||||
$orig_post = Post::selectFirst(['author-link'], $condition);
|
||||
if (DBA::isResult($orig_post)) {
|
||||
$nicknameplain = preg_replace("=https?://twitter.com/(.*)=ism", "$1", $orig_post["author-link"]);
|
||||
$nickname = "@[url=" . $orig_post["author-link"] . "]" . $nicknameplain . "[/url]";
|
||||
|
@ -1601,9 +1601,9 @@ function twitter_createpost(App $a, $uid, $post, array $self, $create_user, $onl
|
|||
if ($post->in_reply_to_status_id_str != "") {
|
||||
$thr_parent = "twitter::" . $post->in_reply_to_status_id_str;
|
||||
|
||||
$item = Item::selectFirst(['uri'], ['uri' => $thr_parent, 'uid' => $uid]);
|
||||
$item = Post::selectFirst(['uri'], ['uri' => $thr_parent, 'uid' => $uid]);
|
||||
if (!DBA::isResult($item)) {
|
||||
$item = Item::selectFirst(['uri'], ['extid' => $thr_parent, 'uid' => $uid]);
|
||||
$item = Post::selectFirst(['uri'], ['extid' => $thr_parent, 'uid' => $uid]);
|
||||
}
|
||||
|
||||
if (DBA::isResult($item)) {
|
||||
|
|
|
@ -10,6 +10,7 @@ use Friendica\Core\Hook;
|
|||
use Friendica\DI;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Post;
|
||||
|
||||
function viewsrc_install() {
|
||||
Hook::register('item_photo_menu', 'addon/viewsrc/viewsrc.php', 'viewsrc_item_photo_menu');
|
||||
|
@ -35,7 +36,7 @@ function viewsrc_item_photo_menu(&$a, &$b)
|
|||
}
|
||||
|
||||
if (local_user() != $b['item']['uid']) {
|
||||
$item = Item::selectFirstForUser(local_user(), ['id'], ['uid' => local_user(), 'guid' => $b['item']['guid']]);
|
||||
$item = Post::selectFirstForUser(local_user(), ['id'], ['uid' => local_user(), 'guid' => $b['item']['guid']]);
|
||||
if (!DBA::isResult($item)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ use Friendica\Core\Logger;
|
|||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Post;
|
||||
use Friendica\Model\User;
|
||||
|
||||
function windowsphonepush_install()
|
||||
|
@ -184,7 +185,7 @@ function windowsphonepush_cron()
|
|||
$senditemtext = DI::pConfig()->get($rr['uid'], 'windowsphonepush', 'senditemtext');
|
||||
if ($senditemtext == 1) {
|
||||
// load item with the max id
|
||||
$item = Item::selectFirst(['author-name', 'body'], ['id' => $count[0]['max']]);
|
||||
$item = Post::selectFirst(['author-name', 'body'], ['id' => $count[0]['max']]);
|
||||
|
||||
// as user allows to send the item, we want to show the sender of the item in the toast
|
||||
// toasts are limited to one line, therefore place is limited - author shall be in
|
||||
|
|
Loading…
Reference in a new issue