nid); $files = array(); if ($node->vid) { $result = db_query('SELECT * FROM {files} f INNER JOIN {upload} r ON f.fid = r.fid WHERE r.vid = %d ORDER BY r.weight, f.fid', $node->vid); while ($file = db_fetch_object($result)) { //$files[$file->fid] = $file; $content = _search_attachments_inline_get_file_contents($file); // Since we want the text of all the attachments for a single node, concatenate // each $attachment_text to the existing value. $combined_attachment_texts[] = $content; } } //Return the string containing all the concatenated text strings $string_to_index = implode(' ', $combined_attachment_texts); return $string_to_index; } /** * get the file contents using the helpers configured in the search_files_module */ function _search_attachments_inline_get_file_contents($file) { global $base_path; $path = $_SERVER['DOCUMENT_ROOT'] . $base_path . $file->filepath; $helpers = search_files_get_helpers(); $pathinfo = (object)pathinfo($path); $file_exists = is_file($path); $helper_exists = array_key_exists($pathinfo->extension, $helpers); //krumo($path . ' | File exists: '. ($file_exists ? 'Yes' : 'No') .' | Helper exists: '. ($helper_exists ? 'Yes' : 'No')); if ($helper_exists && $file_exists) { $cmd = preg_replace('/%file%/', escapeshellarg($path), $helpers[$pathinfo->extension]); //krumo($cmd); $contents = shell_exec($cmd); //krumo($contents); return $contents; } return FALSE; }