4images Help / Hilfe > Bug Fixes & Patches

[1.7] ACP: Can not find images uploaded by nonexistent users

(1/1)

Chris:
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: ---  $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";
--- End code ---

replace it with:

--- Code: ---  $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;
--- End code ---

then find:

--- Code: ---    $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
--- End code ---

replace with:

--- Code: ---    $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
--- End code ---

michi-w.:
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.

V@no:
I dont see anything in that mod that would not work with this fix...

Chris:

--- Quote from: michi-w. on April 25, 2005, 02:36:46 AM ---The bugfix has a problem with this mod:
--- End quote ---

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.

michi-w.:
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.

Navigation

[0] Message Index

Go to full version