]> git.mxchange.org Git - friendica.git/commitdiff
Query replaced
authorMichael <heluecht@pirati.ca>
Fri, 8 Oct 2021 10:28:28 +0000 (10:28 +0000)
committerMichael <heluecht@pirati.ca>
Fri, 8 Oct 2021 10:28:28 +0000 (10:28 +0000)
mod/photos.php

index f3b907dd80e889b26573132c8fba4bf64d12a58d..05767d4a4c70987c664b8aa5a482f6dc91de21ba 100644 (file)
@@ -1245,14 +1245,7 @@ function photos_content(App $a)
                // The difference is that we won't be displaying the conversation head item
                // as a "post" but displaying instead the photo it is linked to
 
-               /// @todo Rewrite this query. To do so, $sql_extra must be changed
-               $linked_items = q("SELECT `id` FROM `post-user-view` WHERE `resource-id` = '%s' $sql_extra LIMIT 1",
-                       DBA::escape($datum)
-               );
-               if (DBA::isResult($linked_items)) {
-                       // This is a workaround to not being forced to rewrite the while $sql_extra handling
-                       $link_item = Post::selectFirst([], ['id' => $linked_items[0]['id']]);
-               }
+               $link_item = Post::selectFirst([], ["`resource-id` = ?" . $sql_extra, $datum]);
 
                if (!empty($link_item['parent']) && !empty($link_item['uid'])) {
                        $condition = ["`parent` = ? AND `gravity` = ?",  $link_item['parent'], GRAVITY_COMMENT];