X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fphotos.php;h=9bc870ca13fe34265dac0fbf5d08071c1d7f33af;hb=baf316e89808b1480f1fa69916cc2b60c343993b;hp=32d52c64895fe768fc2d7aef1b86704567e9deef;hpb=2fd14eac7068bd842720510fac00ad42d5199c25;p=friendica.git diff --git a/mod/photos.php b/mod/photos.php index 32d52c6489..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']); @@ -1251,8 +1239,6 @@ function photos_content(App $a) if (!Config::get('system', 'no_count', false)) { $order_field = defaults($_GET, 'order', ''); if ($order_field === 'posted') { - if (!Config::get('system', 'no_count', false)) { - if ($_GET['order'] === 'posted') { $order = 'ASC'; } else { $order = 'DESC'; @@ -1287,6 +1273,7 @@ function photos_content(App $a) if (count($ph) == 1) { $hires = $lores = $ph[0]; } + if (count($ph) > 1) { if ($ph[1]['scale'] == 2) { // original is 640 or less, we can display it directly @@ -1551,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 = ''; }