X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fphotos.php;h=9bc870ca13fe34265dac0fbf5d08071c1d7f33af;hb=a54fea313ff93b43ae0c691df2a8cf9c8c363006;hp=235acdfc47bdfd0b354003b5e8f80e0e315a4f03;hpb=ce75177d4e40882ecffe35fcc7b101d8716801e0;p=friendica.git diff --git a/mod/photos.php b/mod/photos.php index 235acdfc47..9bc870ca13 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -284,14 +284,7 @@ function photos_post(App $a) ); // find and delete the corresponding item with all the comments and likes/dislikes - $r = q("SELECT `id` FROM `item` WHERE `resource-id` IN ( $str_res ) AND `uid` = %d", - intval($page_owner_uid) - ); - if (DBM::is_result($r)) { - foreach ($r as $rr) { - Item::deleteById($rr['id']); - } - } + Item::deleteForUser(['resource-id' => $res, 'uid' => $page_owner_uid], $page_owner_uid); // Update the photo albums cache Photo::clearAlbumCache($page_owner_uid); @@ -344,16 +337,11 @@ function photos_post(App $a) intval($page_owner_uid), dbesc($r[0]['resource-id']) ); - $i = q("SELECT `id` FROM `item` WHERE `resource-id` = '%s' AND `uid` = %d LIMIT 1", - dbesc($r[0]['resource-id']), - intval($page_owner_uid) - ); - if (DBM::is_result($i)) { - Item::deleteById($i[0]['id']); - // Update the photo albums cache - Photo::clearAlbumCache($page_owner_uid); - } + Item::deleteForUser(['resource-id' => $r[0]['resource-id'], 'uid' => $page_owner_uid], $page_owner_uid); + + // Update the photo albums cache + Photo::clearAlbumCache($page_owner_uid); } goaway('photos/' . $a->data['user']['nickname']); @@ -1550,14 +1538,10 @@ function photos_content(App $a) continue; } - $redirect_url = 'redir/' . $item['cid']; - - if (local_user() && ($item['contact-uid'] == local_user()) - && ($item['network'] == NETWORK_DFRN) && !$item['self']) { - $profile_url = $redirect_url; + $profile_url = Contact::MagicLinkById($item['cid']); + if (strpos($profile_url, 'redir/') === 0) { $sparkle = ' sparkle'; } else { - $profile_url = $item['url']; $sparkle = ''; }