X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fitems.php;h=ee514c8fc414c37e2f86c1fd21ac3ceab0080297;hb=1c3bed1777ea51fabdf1ce91c1c34b7ed0c4b04c;hp=c04bef01c3de0ecb72a8e0c98d52d303f60313e1;hpb=ac67f3c1547c8a370cb21a98d2559bb8a98381bd;p=friendica.git diff --git a/include/items.php b/include/items.php index c04bef01c3..ee514c8fc4 100644 --- a/include/items.php +++ b/include/items.php @@ -274,6 +274,7 @@ function consume_feed($xml, $importer, $contact, &$hub, $datedir = 0, $pass = 0) function subscribe_to_hub($url, $importer, $contact, $hubmode = 'subscribe') { $a = get_app(); + $r = null; if (is_array($importer)) { $r = q("SELECT `nickname` FROM `user` WHERE `uid` = %d LIMIT 1", @@ -321,7 +322,7 @@ function drop_items($items) { if (count($items)) { foreach ($items as $item) { - $owner = Item::deleteById($item); + $owner = Item::deleteForUser(['id' => $item], local_user()); if ($owner && !$uid) $uid = $owner; } @@ -334,17 +335,14 @@ function drop_item($id) { // locate item to be deleted - $r = q("SELECT * FROM `item` WHERE `id` = %d LIMIT 1", - intval($id) - ); + $fields = ['id', 'uid', 'contact-id', 'deleted']; + $item = Item::selectFirstForUser(local_user(), $fields, ['id' => $id]); - if (!DBM::is_result($r)) { + if (!DBM::is_result($item)) { notice(L10n::t('Item not found.') . EOL); goaway(System::baseUrl() . '/' . $_SESSION['return_url']); } - $item = $r[0]; - if ($item['deleted']) { return 0; } @@ -363,7 +361,6 @@ function drop_item($id) { } if ((local_user() == $item['uid']) || $contact_id) { - // Check if we should do HTML-based delete confirmation if ($_REQUEST['confirm']) { //
can't take arguments in its "action" parameter @@ -393,7 +390,7 @@ function drop_item($id) { } // delete the item - Item::deleteById($item['id']); + Item::deleteForUser(['id' => $item['id']], local_user()); goaway(System::baseUrl() . '/' . $_SESSION['return_url']); //NOTREACHED