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",
if (count($items)) {
foreach ($items as $item) {
- $owner = Item::deleteById($item);
+ $owner = Item::deleteForUser(['id' => $item], local_user());
if ($owner && !$uid)
$uid = $owner;
}
// 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;
}
}
if ((local_user() == $item['uid']) || $contact_id) {
-
// Check if we should do HTML-based delete confirmation
if ($_REQUEST['confirm']) {
// <form> can't take arguments in its "action" parameter
}
// delete the item
- Item::deleteById($item['id']);
+ Item::deleteForUser(['id' => $item['id']], local_user());
goaway(System::baseUrl() . '/' . $_SESSION['return_url']);
//NOTREACHED