FROM ' . CATEGORIES_TABLE . ' INNER JOIN ' . IMAGE_CATEGORY_TABLE . ' ON category_id = id WHERE image_id = ' . $_GET['id'] . ' ' . get_sql_condition_FandF(array('forbidden_categories' => 'category_id', 'forbidden_images' => 'image_id'), ' AND') . ' LIMIT 1 ;'; if (pwg_db_num_rows(pwg_query($query)) < 1) { do_error(401, 'Access denied'); } include_once PHPWG_ROOT_PATH . 'include/functions_picture.inc.php'; $file = ''; switch ($_GET['part']) { case 'e': if (!$user['enabled_high']) { $deriv = new DerivativeImage(IMG_XXLARGE, new SrcImage($element_info)); if (!$deriv->same_as_source()) { do_error(401, 'Access denied e'); } } $file = get_element_path($element_info); break; case 'r': $file = original_to_representative(get_element_path($element_info), $element_info['representative_ext']); break; case 'f': $file = original_to_format(get_element_path($element_info), $format['ext']); $element_info['file'] = get_filename_wo_extension($element_info['file']) . '.' . $format['ext']; break; } if (empty($file)) { do_error(404, 'Requested file not found');