Author Topic: [1.7] ACP: Can not find images uploaded by nonexistent users  (Read 15270 times)

0 Members and 2 Guests are viewing this topic.

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
[1.7] ACP: Can not find images uploaded by nonexistent users
« 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
« Last Edit: July 16, 2005, 08:07:56 PM by V@no »

Offline michi-w.

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
Re: ACP: Can not find images uploaded by nonexistent users
« Reply #1 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.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: ACP: Can not find images uploaded by nonexistent users
« Reply #2 on: April 25, 2005, 03:44:46 AM »
I dont see anything in that mod that would not work with this fix...
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
Re: ACP: Can not find images uploaded by nonexistent users
« Reply #3 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.

Offline michi-w.

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
Re: ACP: Can not find images uploaded by nonexistent users
« Reply #4 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.