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
$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:
$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:
$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:
$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