New user based item function
authorMichael <heluecht@pirati.ca>
Sun, 17 Jun 2018 17:04:23 +0000 (17:04 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 17 Jun 2018 17:04:23 +0000 (17:04 +0000)
advancedcontentfilter/advancedcontentfilter.php
mailstream/mailstream.php
statusnet/statusnet.php
twitter/twitter.php
windowsphonepush/windowsphonepush.php

index 4394604..eebec4b 100644 (file)
@@ -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']));
index a68e0b3..bc6d490 100644 (file)
@@ -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) {
index 5663911..6a3090d 100644 (file)
@@ -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"]);
 
index d9f6ece..3e2d90d 100644 (file)
@@ -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]";
index a7453b1..dd461ea 100644 (file)
@@ -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