diff -crB imagecache/imagecache.module imagecache_original/imagecache.module
*** imagecache/imagecache.module	Thu Sep 29 14:56:53 2011
--- imagecache_original/imagecache.module	Mon May 16 11:12:33 2011
***************
*** 430,441 ****
   *   ImageCache generate images but not send them to a browser.
   */
  function _imagecache_cache($presetname, $path) {
- 
- 
-     if(!imagecache_verified_relationship($presetname, $path)){
-         return;
-     }
- 
    if (!$preset = imagecache_preset_by_name($presetname)) {
      // Send a 404 if we don't know of a preset.
      header("HTTP/1.0 404 Not Found");
--- 430,435 ----
***************
*** 1364,1410 ****
    return $files;
  }
  
- 
- function imagecache_verified_relationship($presetname, $filename) {
- 
-     $nodetypes = node_get_types();
-     $valid_types = array();
- 
- 
-     //Exlude the content types that has no relation with the preset we
-     // are working on
-     foreach ($nodetypes as $type => $content) {
-         $list = variable_get('preset_imagecache_list' . $type, 'test');
-         if (in_array($presetname, $list, true)) {
-             $valid_types[] = $type;
-         }
-     }
- 
-     //if the preset has no relations with any content type return false
-     if (!count($valid_types)) {
-         return false;
-     }
- 
-     //obtain fid from the filename
-     $fid = db_fetch_object(db_query("SELECT fid FROM files WHERE filepath = '%s'", file_directory_path() . "/$filename"))->fid;
- 
- 
- 
-     //if the file exists on the permited nodes return true, if not
-     //the file creation is not permited and return false
-     $result = db_query("SELECT field_name as field, type_name as type FROM content_node_field_instance WHERE widget_module='imagefield'  and type_name in(" . db_placeholders($valid_types, 'varchar') . ')', $valid_types);
-     while ($field_instance = db_fetch_object($result)) {
-         if (db_table_exists("content_{$field_instance->field}")) {
-             $succed = db_fetch_object(db_query("SELECT * FROM content_{$field_instance->field} where {$field_instance->field}_fid='%d'", $fid));
-             if ($succed->nid)
-                 return true;
-         }elseif (db_table_exists("content_type_{$field_instance->type}")) {
-             $succed = db_fetch_object(db_query("SELECT * FROM content_type_{$field_instance->type} where {$field_instance->field}_fid='%d'", $fid));
-             if ($succed->nid)
-                 return true;
-         }
-     }
- 
- 
-     return false;
- }
--- 1358,1360 ----
diff -crB imagecache/imagecache_ui.module imagecache_original/imagecache_ui.module
*** imagecache/imagecache_ui.module	Thu Sep 29 14:59:34 2011
--- imagecache_original/imagecache_ui.module	Mon May 16 11:12:33 2011
***************
*** 44,58 ****
      'type' => MENU_LOCAL_TASK,
    );
  
-   $items['admin/build/imagecache/relationships'] = array(
-     'title' => 'Content Types',
-     'file' => 'imagecache_ui.pages.inc',
-     'page callback' => 'drupal_get_form',
-     'page arguments' => array('imagecache_ui_relationship_form'),
-     'access arguments' => array('administer imagecache'),
-     'type' => MENU_LOCAL_TASK,
-   );
- 
    $items['admin/build/imagecache/%imagecache_ui_preset'] = array(
      'title callback' => 'imagecache_preset_title_callback',
      'title arguments' => array('Edit preset: !presetname', 3),
--- 44,49 ----
diff -crB imagecache/imagecache_ui.pages.inc imagecache_original/imagecache_ui.pages.inc
*** imagecache/imagecache_ui.pages.inc	Thu Sep 29 14:58:30 2011
--- imagecache_original/imagecache_ui.pages.inc	Mon May 16 11:12:33 2011
***************
*** 452,489 ****
    drupal_set_message(t('The action has been deleted.'));
    $form_state['redirect'] = 'admin/build/imagecache/'. $action['presetid'];
  }
- 
- 
- function imagecache_ui_relationship_form($form_state, $preset = array()) {
-     $nodetypes = node_get_types();
-     $presets = imagecache_presets();
- 
- 
-     foreach ($presets as $preset_id => $preset) {
-         $preset_list[$preset['presetname']] = $preset['presetname'];
-     }
- 
-     foreach ($nodetypes as $type => $content) {
-         $form[$type] = array(
-             '#type' => 'fieldset',
-             '#title' => t($type),
-             '#weight' => 5,
-             '#collapsible' => TRUE,
-             '#collapsed' => FALSE,
-             '#weight' => -50,
-         );
- 
-         $form[$type]['preset_imagecache_list'.$type] = array(
-             '#type' => 'checkboxes',
-             '#title' => t('Preset List'),
-             '#default_value' => variable_get('preset_imagecache_list'.$type, array()),
-             '#options' => $preset_list,
-             '#description' => t('Select the presets that you want to be active on '.$type),
-         );
-     }
- 
- 
- 
- 
-     return system_settings_form($form);
- }
--- 452,454 ----
