### Eclipse Workspace Patch 1.0 #P drupal6 Index: modules/aggregator/aggregator.module =================================================================== RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.module,v retrieving revision 1.335 diff -u -r1.335 aggregator.module --- modules/aggregator/aggregator.module 7 Apr 2007 07:38:36 -0000 1.335 +++ modules/aggregator/aggregator.module 10 Apr 2007 16:02:19 -0000 @@ -551,14 +551,14 @@ * Add/edit/delete an aggregator feed. */ function aggregator_save_feed($edit) { - if ($edit['fid']) { + if (!empty($edit['fid'])) { // An existing feed is being modified, delete the category listings. db_query('DELETE FROM {aggregator_category_feed} WHERE fid = %d', $edit['fid']); } - if ($edit['fid'] && $edit['title']) { + if (!empty($edit['fid']) && !empty($edit['title'])) { db_query("UPDATE {aggregator_feed} SET title = '%s', url = '%s', refresh = %d WHERE fid = %d", $edit['title'], $edit['url'], $edit['refresh'], $edit['fid']); } - else if ($edit['fid']) { + else if (!empty($edit['fid'])) { $result = db_query('SELECT iid FROM {aggregator_item} WHERE fid = %d', $edit['fid']); while ($item = db_fetch_object($result)) { $items[] = "iid = $item->iid"; @@ -621,7 +621,7 @@ $element = $name; } case 'LINK': - if ($attributes['REL'] == 'alternate') { + if (!empty($attributes['REL']) && $attributes['REL'] == 'alternate') { if ($element == 'ITEM') { $items[$item]['LINK'] = $attributes['HREF']; } @@ -672,6 +672,9 @@ global $channel, $element, $items, $item, $image, $tag; switch ($element) { case 'ITEM': + if(empty($items[$item][$tag])) { + $items[$item][$tag] = ''; + } $items[$item][$tag] .= $data; break; case 'IMAGE': @@ -759,7 +762,7 @@ $image[$key] = trim($value); } - if ($image['LINK'] && $image['URL'] && $image['TITLE']) { + if (!empty($image['LINK']) && !empty($image['URL']) && !empty($image['TITLE'])) { // Note, we should really use theme_image() here but that only works with local images it won't work with images fetched with a URL unless PHP version > 5 $image = ''. check_plain($image['TITLE']) .''; } @@ -895,13 +898,13 @@ /** * Atom feeds have a CONTENT and/or SUMMARY tag instead of a DESCRIPTION tag */ - if ($item['CONTENT:ENCODED']) { + if (!empty($item['CONTENT:ENCODED'])) { $item['DESCRIPTION'] = $item['CONTENT:ENCODED']; } - else if ($item['SUMMARY']) { + else if (!empty($item['SUMMARY'])) { $item['DESCRIPTION'] = $item['SUMMARY']; } - else if ($item['CONTENT']) { + else if (!empty($item['CONTENT'])) { $item['DESCRIPTION'] = $item['CONTENT']; } @@ -945,8 +948,7 @@ else { $entry = db_fetch_object(db_query("SELECT iid FROM {aggregator_item} WHERE fid = %d AND title = '%s'", $feed['fid'], $title)); } - - aggregator_save_item(array('iid' => $entry->iid, 'fid' => $feed['fid'], 'timestamp' => $timestamp, 'title' => $title, 'link' => $link, 'author' => $item['AUTHOR'], 'description' => $item['DESCRIPTION'], 'guid' => $guid)); + aggregator_save_item(array('iid' => (isset($entry->iid)?$entry->iid:''), 'fid' => $feed['fid'], 'timestamp' => $timestamp, 'title' => $title, 'link' => $link, 'author' => (empty($item['AUTHOR'])?'':$item['AUTHOR']), 'description' => $item['DESCRIPTION'], 'guid' => $guid)); } /* @@ -1384,7 +1386,7 @@ function theme_aggregator_page_item($item) { $source = ''; - if ($item->ftitle && $item->fid) { + if (isset($item->ftitle) && isset($item->fid)) { $source = l($item->ftitle, "aggregator/sources/$item->fid", array('attributes' => array('class' => 'feed-item-source'))) . ' -'; } @@ -1395,7 +1397,7 @@ $source_date = format_date($item->timestamp, 'custom', variable_get('date_format_medium', 'D, m/d/Y - H:i')); } - $output .= "
\n"; + $output = "
\n"; $output .= '

'. check_plain($item->title) ."

\n"; $output .= "
$source $source_date
\n";