phpBB Gallery - Bug tracker

categorie - last image are not shown if disapproved (fix completed in git)

 

Create a categorie wit a subalbum in it.

set the permissions to " approve by administrators ".

Upload an image into the mentioned subalbum.

Go back to the categorie:

You will see :
Images: 1
Last image: "empty image name" from "Guest" at "01.01.1970"

Reason:

In " gallery/includes/functions_display.php "
we grap the "last image" in the first sql statement. ( $album[$i]['last_image'] )

But in the section:

// ------------------------------------------
// Get Last Pic of this Category
// ------------------------------------------


we are trying to grap the last_image infos, even if they are disapproved....

so, if the image is disapproved, the query will be empty.

Code: Select all
      // ----------------------------
      // Check Pic Approval
      // ----------------------------
      if (($album[$i]['album_approval'] == ALBUM_ADMIN) || ($album[$i]['album_approval'] == ALBUM_MOD))
      {
         $pic_approval_sql = 'AND p.image_approval = 1';
      }
      else
      {
         $pic_approval_sql = '';
      }

[.....]

            WHERE p.image_id = ' . $album[$i]['last_image'] . ' ' . $pic_approval_sql . '



If we remove the $pic_approvel_sql from the sql statement, the last disapproved image will be shown correctly on the catergory index. ( image_id, image_name, user_id, username and so on )

I a user clicks now on the link to the last (disapproved) image, he will be informed, that he has not the permission to view this (disapproved) image.

So, what shall we do ? ;-)

Comments

Posted by nickvergessen » Thu Jan 31, 2008 1:29 pm

i think, i'll fix this, when we drop the left joins

Posted by nickvergessen » Mon Mar 03, 2008 12:06 am

not the best way, but it works
[svn]http://phpbb-gallery.svn.sourceforge.net/viewvc/phpbb-gallery/trunk/root/gallery/includes/functions_display.php?r1=322&r2=344[/svn]
we may add a column unaproved images, when removing the left joins

Ticket details