From c66dcf96ac69e12396d3a952cee722b3a90ac6b3 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 17 Jun 2018 17:04:23 +0000 Subject: [PATCH] New user based item function --- advancedcontentfilter/advancedcontentfilter.php | 2 +- mailstream/mailstream.php | 2 +- statusnet/statusnet.php | 4 ++-- twitter/twitter.php | 4 ++-- windowsphonepush/windowsphonepush.php | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/advancedcontentfilter/advancedcontentfilter.php b/advancedcontentfilter/advancedcontentfilter.php index 43946049..eebec4b0 100644 --- a/advancedcontentfilter/advancedcontentfilter.php +++ b/advancedcontentfilter/advancedcontentfilter.php @@ -405,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::selectFirst(local_user(), Item::DISPLAY_FIELDLIST, $condition, $params); + $item = Item::selectFirstForUser(local_user(), [], $condition, $params); if (!\Friendica\Database\DBM::is_result($item)) { throw new HTTPException\NotFoundException(L10n::t('Unknown post with guid: %s', $args['guid'])); diff --git a/mailstream/mailstream.php b/mailstream/mailstream.php index a68e0b36..bc6d490c 100644 --- a/mailstream/mailstream.php +++ b/mailstream/mailstream.php @@ -336,7 +336,7 @@ function mailstream_cron($a, $b) { if (!$ms_item_id['message-id'] || !strlen($ms_item_id['message-id'])) { logger('mailstream_cron: Item ' . $ms_item_id['id'] . ' URI ' . $ms_item_id['uri'] . ' has no message-id', LOGGER_NORMAL); } - $item = Item::selectFirst($ms_item_id['uid'], Item::DISPLAY_FIELDLIST, ['id' => $ms_item_id['id']]); + $item = Item::selectFirst([], ['id' => $ms_item_id['id']]); $users = q("SELECT * FROM `user` WHERE `uid` = %d", intval($item['uid'])); $user = $users[0]; if ($user && $item) { diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index 56639117..6a3090da 100644 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -462,7 +462,7 @@ function statusnet_post_hook(App $a, &$b) } $condition = ['uri' => $b["thr-parent"], 'uid' => $b["uid"]]; - $orig_post = Item::selectFirst($b["uid"], ['author-link', 'uri'], $condition); + $orig_post = Item::selectFirst(['author-link', 'uri'], $condition); if (!count($orig_post)) { logger("statusnet_post_hook: no parent found " . $b["thr-parent"]); return; @@ -683,7 +683,7 @@ function statusnet_prepare_body(App $a, &$b) $item["plink"] = $a->get_baseurl() . "/display/" . $a->user["nickname"] . "/" . $item["parent"]; $condition = ['uri' => $item["thr-parent"], 'uid' => local_user()]; - $orig_post = Item::selectFirst(local_user(), ['author-link', 'uri'], $condition); + $orig_post = Item::selectFirst(['author-link', 'uri'], $condition); if (count($orig_post)) { $nick = preg_replace("=https?://(.*)/(.*)=ism", "$2", $orig_post["author-link"]); diff --git a/twitter/twitter.php b/twitter/twitter.php index d9f6ece3..3e2d90d7 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -454,7 +454,7 @@ function twitter_post_hook(App $a, &$b) } $condition = ['uri' => $b["thr-parent"], 'uid' => $b["uid"]]; - $orig_post = Item::selectFirst($b["uid"], [], $condition); + $orig_post = Item::selectFirst([], $condition); if (!DBM::is_result($orig_post)) { logger("twitter_post_hook: no parent found " . $b["thr-parent"]); return; @@ -758,7 +758,7 @@ function twitter_prepare_body(App $a, &$b) $item["plink"] = $a->get_baseurl() . "/display/" . $a->user["nickname"] . "/" . $item["parent"]; $condition = ['uri' => $item["thr-parent"], 'uid' => local_user()]; - $orig_post = Item::selectFirst(local_user(), ['author-link'], $condition); + $orig_post = Item::selectFirst(['author-link'], $condition); if (DBM::is_result($orig_post)) { $nicknameplain = preg_replace("=https?://twitter.com/(.*)=ism", "$1", $orig_post["author-link"]); $nickname = "@[url=" . $orig_post["author-link"] . "]" . $nicknameplain . "[/url]"; diff --git a/windowsphonepush/windowsphonepush.php b/windowsphonepush/windowsphonepush.php index a7453b1d..dd461ea4 100644 --- a/windowsphonepush/windowsphonepush.php +++ b/windowsphonepush/windowsphonepush.php @@ -197,7 +197,7 @@ function windowsphonepush_cron() $senditemtext = PConfig::get($rr['uid'], 'windowsphonepush', 'senditemtext'); if ($senditemtext == 1) { // load item with the max id - $item = Item::selectFirst(local_user(), ['author-name', 'body'], ['id' => $count[0]['max']]); + $item = Item::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