Index: modules/atom/atom.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/atom/atom.module,v retrieving revision 1.11 diff -u -r1.11 atom.module --- modules/atom/atom.module 5 Dec 2004 14:06:12 -0000 1.11 +++ modules/atom/atom.module 16 Feb 2005 21:51:45 -0000 @@ -1,62 +1,92 @@ "); - $items[] = array('path' => 'atom/feed', 'title' => t('atom feed'), - 'callback' => 'atom_feed', - 'access' => user_access('access content'), - 'type' => MENU_CALLBACK); + if ($may_cache) { + $items[] = array('path' => 'atom/feed', 'title' => t('atom feed'), + 'callback' => 'atom_feed', + 'access' => user_access('access content'), + 'type' => MENU_CALLBACK); + } return $items; } +/** + * Produces an atom 0.3 feed for the front page content. + */ function atom_feed() { global $base_url; + $output = ""; $last_mod = 0; - $nodes = db_query_range("SELECT n.nid, u.uid, u.name FROM {node} n, {users} u WHERE n.uid = u.uid AND n.promote = '1' AND n.status = '1' ORDER BY n.created DESC", 0, 15); - - while ($node = db_fetch_object($nodes)) { - $item = node_load(array("nid" => $node->nid)); - $link = url("node/$node->nid", NULL, NULL, true); - $output .= " \n"; - $output .= " ". $item->title ."\n"; - $output .= " \n"; - $output .= " $link\n"; - $output .= " ". _atom_timestamp2w3dtf($item->created) ."\n"; - $output .= " ". _atom_timestamp2w3dtf($item->changed) ."\n"; - $last_mod = $item->changed; - $output .= " \n"; - if ($node->name) { - $output .= " ". $node->name ."\n"; - } - else { - $output .= " ". variable_get('anonymous', 'Anonymous') ."\n"; + $nodes = db_query_range("SELECT n.nid FROM {node} n WHERE n.promote = '1' AND n.status = '1' ORDER BY n.created DESC", 0, 15); + + while ($node = db_fetch_object($nodes)) { + $item = node_load(array("nid" => $node->nid)); + $link = url("node/$node->nid", NULL, NULL, true); + $output .= " \n"; + $output .= ' '. drupal_specialchars(strip_tags($item->title)) ."\n"; + $output .= ' '. "\n"; + $output .= ' '. $link ."\n"; + $output .= ' '. _atom_timestamp2w3dtf($item->created) ."\n"; + $output .= ' '. _atom_timestamp2w3dtf($item->changed) ."\n"; + $last_mod = $item->changed; + $output .= " \n"; + if ($item->name) { + $output .= ' '. $item->name ."\n"; + } + else { + $output .= ' '. variable_get('anonymous', 'Anonymous') ."\n"; + } + $output .= " \n"; + if (module_exist('taxonomy')) { + $terms = taxonomy_node_get_terms($item->nid); + foreach ($terms as $term) { + $output .= ' '. drupal_specialchars(strip_tags($term->name)) . "\n"; } - $output .= " \n"; - $output .= " \n"; } + // Summary + $output .= ' teaser); + $output .= " ]]>\n"; - header("Content-Type: application/xml"); - print "\n"; - print "\n"; - print " ". variable_get("site_name", "drupal") ." - ". variable_get("site_slogan", "") ."\n"; - print " \n"; - print " ". _atom_timestamp2w3dtf($last_mod) ."\n"; - print $output; - print "\n"; + // Body + $output .= ' body); + $output .= " ]]>\n"; + $output .= " \n"; + } + + header("Content-Type: application/xml"); + print ''. "\n"; + print ''. "\n"; + print ' '. variable_get("site_name", "drupal") ."\n"; + print ' '. variable_get("site_slogan", "") . "\n"; + print ' '. "\n"; + print ' '. _atom_timestamp2w3dtf($last_mod) ."\n"; + print $output; + print "\n"; } function _atom_timestamp2w3dtf($timestamp) {