4images Forum & Community

4images Help / Hilfe => Bug Fixes & Patches => Topic started by: Chris on March 16, 2005, 04:22:29 AM

Title: [1.7] ACP: Can not find images uploaded by nonexistent users
Post by: Chris on March 16, 2005, 04:22:29 AM
ACP = Admin Control Panel

Just discovered a bug that acure when u are trying find an image from the ACP that was uploaded by a not existing user (user was deleted).

To test it u can do the following:
1) create a user
2) upload an image (image must be validated)
3) delete the user
4) in ACP go to "Edit images" and try to find the image.

To fix that, find in /admin/images.php
Code: [Select]
  $sql = "SELECT COUNT(*) AS images
          FROM ".IMAGES_TABLE." i, ".USERS_TABLE." u
          WHERE $condition AND ".get_user_table_field("u.", "user_id")." = i.user_id";

replace it with:
Code: [Select]
  $sql = "SELECT COUNT(*) AS images
          FROM ".IMAGES_TABLE." i
          LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
          WHERE ".$condition;

then find:
Code: [Select]
    $sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_media_file, i.image_date".get_user_table_field(", u.", "user_name")."
            FROM ".IMAGES_TABLE." i, ".USERS_TABLE." u
            WHERE $condition AND ".get_user_table_field("u.", "user_id")." = i.user_id

replace with:
Code: [Select]
    $sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_media_file, i.image_date".get_user_table_field(", u.", "user_name")."
            FROM ".IMAGES_TABLE." i
            LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
            WHERE $condition
Title: Re: ACP: Can not find images uploaded by nonexistent users
Post by: michi-w. on April 25, 2005, 02:36:46 AM
The bugfix has a problem with this mod:

Add thumbnails to admin edit images list
http://www.4homepages.de/forum/index.php?topic=4669.msg19571#msg19571

The thumbnials was replaced through standard icon.

Gruß
michi-w.
Title: Re: ACP: Can not find images uploaded by nonexistent users
Post by: V@no on April 25, 2005, 03:44:46 AM
I dont see anything in that mod that would not work with this fix...
Title: Re: ACP: Can not find images uploaded by nonexistent users
Post by: Chris on April 25, 2005, 04:07:01 AM
The bugfix has a problem with this mod:

FYI  (for your information)

If anything, the mod has a problem with this bug fix.  Bug fixes are posted here for the unmodified 4images you can download from this web site and are not required to support custom mod code in any way.  Having said that, I also do not see any code conflict either.

If you have a problem with the mod, then post a reply to the mod thread and not the bug fix. Thanks.
Title: Re: ACP: Can not find images uploaded by nonexistent users
Post by: michi-w. on April 25, 2005, 05:44:04 AM
As unpleasant!  :oops:

I have the fixe again inserted and now it goes, to first was probably wrong.

Sorry, please delete my question.

Gruß
michi-w.

P.S.
Mod was before ok, thus I could not write in the mod thread, because the fixe was the cause.
The mistake only was by me and not with the fixe.